File tree Expand file tree Collapse file tree 2 files changed +18
-11
lines changed
docs/.vitepress/components Expand file tree Collapse file tree 2 files changed +18
-11
lines changed Original file line number Diff line number Diff line change 79
79
field => fieldsList? .indexOf (field .label ) !== - 1
80
80
);
81
81
82
+ function setClassName (field ) {
83
+ return field .label === ' dimensionsTransition'
84
+ ? form => (form .maintainSpace ? ' disabled' : ' ' )
85
+ : undefined ;
86
+ }
87
+
88
+ function setDisabled (field ) {
89
+ return field .label === ' dimensionsTransition'
90
+ ? form => form .maintainSpace ?? false
91
+ : undefined ;
92
+ }
82
93
defineEmits ([' resetAnimation' ]);
83
94
< / script>
84
95
93
104
: type= " field.type"
94
105
: tag- name= " field.tagName"
95
106
: select- options= " field.selectOptions ?? []"
107
+ : class - name= " setClassName(field)"
108
+ : disabled= " setDisabled(field)"
96
109
@change- field= " opts => $emit('resetAnimation', opts)"
97
110
/ >
98
111
< / div>
Original file line number Diff line number Diff line change 11
11
eventName: String ,
12
12
tagName: String ,
13
13
selectOptions: Array ,
14
+ disabled: Function ,
14
15
});
15
16
const {
16
17
label = ' ' ,
17
18
type = ' text' ,
18
19
tagName = ' input' ,
19
20
selectOptions = [],
21
+ className = () => ' ' ,
22
+ disabled = () => false ,
20
23
} = props;
21
24
const form = typeof props .form === ' function' ? props .form () : ref ({});
22
25
26
29
</script >
27
30
28
31
<template >
29
- <label
30
- :for =" toKebabCase(label)"
31
- :class ="
32
- label === 'dimensionsTransition'
33
- ? form.maintainSpace
34
- ? 'disabled'
35
- : ''
36
- : ''
37
- "
38
- >
32
+ <label :for =" toKebabCase(label)" :class =" className(form)" >
39
33
{{ label }}:
40
34
<input
41
35
v-if =" tagName === 'input'"
44
38
:type =" type"
45
39
:id =" toKebabCase(label)"
46
40
:name =" toKebabCase(label)"
47
- :disabled =" label === 'dimensionsTransition' ? form.maintainSpace : false "
41
+ :disabled =" disabled( form) "
48
42
/>
49
43
<select
50
44
v-if =" tagName === 'select'"
You can’t perform that action at this time.
0 commit comments