File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66<template >
77 <div class =" settings-entry" >
8- <input :id = " id "
8+ <NcCheckboxRadioSwitch v-model = " inputVal "
99 type =" checkbox"
10- class =" checkbox"
11- :checked =" inputVal"
12- :disabled =" disabled"
13- @change =" $emit('input', $event.target.checked)" >
14- <label :for =" id" >{{ label }}</label ><br >
15- <em v-if =" hint !== ''" >{{ hint }}</em >
10+ :disabled =" disabled" >
11+ {{ label }}
12+ </NcCheckboxRadioSwitch >
13+ <em v-if =" hint !== ''" class =" checkbox-hint" >{{ hint }}</em >
1614 <div >
1715 <slot />
1816 </div >
1917 </div >
2018</template >
2119
2220<script >
23- let uuid = 0
21+ import NcCheckboxRadioSwitch from ' @nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js'
22+
2423export default {
2524 name: ' SettingsCheckbox' ,
25+ components: {
26+ NcCheckboxRadioSwitch,
27+ },
2628 props: {
2729 label: {
2830 type: String ,
@@ -46,25 +48,19 @@ export default {
4648 inputVal: this .value ,
4749 }
4850 },
49- computed: {
50- id () {
51- return ' settings-checkbox-' + this .uuid
52- },
53- },
5451 watch: {
5552 value (newVal ) {
5653 this .inputVal = this .value
5754 },
58- },
59- beforeCreate () {
60- this .uuid = uuid .toString ()
61- uuid += 1
55+ inputVal (newVal ) {
56+ this .$emit (' input' , newVal)
57+ },
6258 },
6359}
6460 </script >
6561
6662<style scoped>
67- .settings-entry {
68- padding-bottom : 15 px ;
69- }
63+ .checkbox-hint {
64+ margin-right : calc ( var ( --default-grid-baseline ) * 3 ) ;
65+ }
7066 </style >
Original file line number Diff line number Diff line change 66<template >
77 <form @submit.prevent =" submit" >
88 <div class =" input-wrapper" >
9- <label :for =" id" >{{ label }}</label >
10- <input :id =" id"
11- v-model =" inputVal"
12- type =" text"
9+ <NcTextField v-model =" inputVal"
10+ :label =" label"
1311 :disabled =" disabled"
14- @input =" $emit('input', $event.target.value)" >
15- <input type =" submit"
16- class =" icon-confirm"
17- value =" " >
12+ @input =" $emit('input', $event.target.value)" />
13+ <NcButton type =" submit"
14+ :disabled =" disabled"
15+ @click =" submit" >
16+ {{ t('richdocuments', 'Save') }}
17+ </NcButton >
1818 </div >
19- <p v-if =" hint !== ''" class =" hint" >
20- {{ hint }}
21- </p >
2219 </form >
2320</template >
2421
2522<script >
26- let uuid = 0
23+ import NcTextField from ' @nextcloud/vue/dist/Components/NcTextField.js'
24+ import NcButton from ' @nextcloud/vue/dist/Components/NcButton.js'
25+
2726export default {
2827 name: ' SettingsInputText' ,
28+ components: {
29+ NcTextField,
30+ NcButton,
31+ },
2932 props: {
3033 label: {
3134 type: String ,
@@ -49,20 +52,11 @@ export default {
4952 inputVal: this .value ,
5053 }
5154 },
52- computed: {
53- id () {
54- return ' settings-input-text-' + this .uuid
55- },
56- },
5755 watch: {
5856 value (newVal ) {
5957 this .inputVal = newVal
6058 },
6159 },
62- beforeCreate () {
63- this .uuid = uuid .toString ()
64- uuid += 1
65- },
6660 methods: {
6761 submit () {
6862 this .$emit (' update' , this .inputVal )
@@ -74,16 +68,14 @@ export default {
7468<style scoped>
7569 .input-wrapper {
7670 display : flex ;
77- flex-wrap : wrap ;
7871 width : 100% ;
79- max-width : 400px ;
72+ gap : calc (var (--default-grid-baseline ) * 2 );
73+ align-items : baseline ;
8074 }
8175
82- label {
83- width : 100% ;
84- }
85-
86- input [type = text ] {
76+ .input-field {
77+ width : auto ;
78+ max-width : 400px ;
8779 flex-grow : 1 ;
8880 }
8981
You can’t perform that action at this time.
0 commit comments