@volverjs/ui-vue 0.0.9 → 0.0.10-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -1
- package/auto-imports.d.ts +1 -1
- package/bin/icons.cjs +1 -1
- package/bin/icons.js +13 -5
- package/dist/components/VvAccordion/index.d.ts +1 -1
- package/dist/components/VvButton/VvButton.es.js +3 -3
- package/dist/components/VvCheckbox/VvCheckbox.es.js +3 -3
- package/dist/components/VvCheckbox/index.d.ts +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +5 -5
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +21 -32
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +66 -66
- package/dist/components/VvCombobox/index.d.ts +22 -22
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +156 -156
- package/dist/components/VvDropdown/index.d.ts +22 -22
- package/dist/components/VvRadio/VvRadio.es.js +3 -3
- package/dist/components/VvRadio/index.d.ts +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +5 -5
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.es.js +6 -6
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/index.es.js +21 -32
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/group/useInjectedGroupState.d.ts +1 -1
- package/dist/composables/useOptions.d.ts +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +22 -22
- package/dist/stories/Combobox/ComboboxOptions.stories.d.ts +1 -0
- package/dist/stories/InputText/InputTextMask.stories.d.ts +1 -1
- package/package.json +8 -7
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvCombobox/VvCombobox.vue +13 -25
- package/src/components/VvSelect/VvSelect.vue +4 -4
- package/src/composables/useOptions.ts +2 -2
- package/src/stories/Button/ButtonModifiers.stories.ts +4 -14
- package/src/stories/Combobox/ComboboxOptions.stories.ts +18 -0
- package/src/stories/InputText/InputTextMask.stories.ts +1 -1
- package/src/utils/ObjectUtilities.ts +3 -2
|
@@ -182,8 +182,8 @@
|
|
|
182
182
|
const {
|
|
183
183
|
getOptionLabel,
|
|
184
184
|
getOptionValue,
|
|
185
|
-
getOptionDisabled,
|
|
186
185
|
getOptionGrouped,
|
|
186
|
+
isOptionDisabled,
|
|
187
187
|
} = useOptions(props)
|
|
188
188
|
|
|
189
189
|
// options filtered by search text
|
|
@@ -210,7 +210,7 @@
|
|
|
210
210
|
* Check if an option exist into modelValue array (multiple) or is equal to modelValue (single)
|
|
211
211
|
* @param {String | Option} option
|
|
212
212
|
*/
|
|
213
|
-
function
|
|
213
|
+
function isOptionSelected(option: string | Option) {
|
|
214
214
|
if (Array.isArray(props.modelValue)) {
|
|
215
215
|
// check if contain whole option or option value
|
|
216
216
|
return (
|
|
@@ -230,29 +230,17 @@
|
|
|
230
230
|
* Check if is multiple mode, object mode or "string" mode
|
|
231
231
|
*/
|
|
232
232
|
const selectedOptions = computed(() => {
|
|
233
|
-
|
|
234
|
-
if (Array.isArray(props.modelValue)) {
|
|
235
|
-
selectedValues = props.modelValue as Array<typeof props.modelValue>
|
|
236
|
-
} else if (props.modelValue) {
|
|
237
|
-
selectedValues = [props.modelValue]
|
|
238
|
-
}
|
|
239
|
-
const options = props.options.reduce(
|
|
233
|
+
const options = props.options.reduce<Array<Option | string>>(
|
|
240
234
|
(acc, value) => {
|
|
241
235
|
if (isGroup(value)) {
|
|
242
236
|
return [...acc, ...getOptionGrouped(value)]
|
|
243
237
|
}
|
|
244
238
|
return [...acc, value]
|
|
245
239
|
},
|
|
246
|
-
[]
|
|
240
|
+
[],
|
|
247
241
|
)
|
|
248
|
-
|
|
249
242
|
return options.filter((option) => {
|
|
250
|
-
|
|
251
|
-
return getOptionGrouped(option).some((item) =>
|
|
252
|
-
selectedValues.includes(getOptionValue(item)),
|
|
253
|
-
)
|
|
254
|
-
}
|
|
255
|
-
return selectedValues.includes(getOptionValue(option))
|
|
243
|
+
return isOptionSelected(option)
|
|
256
244
|
})
|
|
257
245
|
})
|
|
258
246
|
|
|
@@ -518,8 +506,8 @@
|
|
|
518
506
|
option,
|
|
519
507
|
)"
|
|
520
508
|
v-bind="{
|
|
521
|
-
|
|
522
|
-
|
|
509
|
+
selected: isOptionSelected(item),
|
|
510
|
+
disabled: isOptionDisabled(item),
|
|
523
511
|
unselectable,
|
|
524
512
|
deselectHintLabel:
|
|
525
513
|
propsDefaults.deselectHintLabel,
|
|
@@ -538,8 +526,8 @@
|
|
|
538
526
|
v-bind="{
|
|
539
527
|
option,
|
|
540
528
|
selectedOptions,
|
|
541
|
-
selected:
|
|
542
|
-
disabled:
|
|
529
|
+
selected: isOptionSelected(item),
|
|
530
|
+
disabled: isOptionDisabled(item),
|
|
543
531
|
}"
|
|
544
532
|
>
|
|
545
533
|
{{ getOptionLabel(item) }}
|
|
@@ -549,8 +537,8 @@
|
|
|
549
537
|
<VvDropdownOption
|
|
550
538
|
v-else
|
|
551
539
|
v-bind="{
|
|
552
|
-
|
|
553
|
-
|
|
540
|
+
selected: isOptionSelected(option),
|
|
541
|
+
disabled: isOptionDisabled(option),
|
|
554
542
|
unselectable,
|
|
555
543
|
deselectHintLabel:
|
|
556
544
|
propsDefaults.deselectHintLabel,
|
|
@@ -568,8 +556,8 @@
|
|
|
568
556
|
v-bind="{
|
|
569
557
|
option,
|
|
570
558
|
selectedOptions,
|
|
571
|
-
selected:
|
|
572
|
-
disabled:
|
|
559
|
+
selected: isOptionSelected(option),
|
|
560
|
+
disabled: isOptionDisabled(option),
|
|
573
561
|
}"
|
|
574
562
|
>
|
|
575
563
|
{{ getOptionLabel(option) }}
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
const {
|
|
140
140
|
getOptionLabel,
|
|
141
141
|
getOptionValue,
|
|
142
|
-
|
|
142
|
+
isOptionDisabled,
|
|
143
143
|
getOptionGrouped,
|
|
144
144
|
} = useOptions(props)
|
|
145
145
|
|
|
@@ -195,7 +195,7 @@
|
|
|
195
195
|
<option
|
|
196
196
|
v-if="!isGroup(option)"
|
|
197
197
|
:key="index"
|
|
198
|
-
:disabled="
|
|
198
|
+
:disabled="isOptionDisabled(option)"
|
|
199
199
|
:value="getOptionValue(option)"
|
|
200
200
|
>
|
|
201
201
|
{{ getOptionLabel(option) }}
|
|
@@ -203,13 +203,13 @@
|
|
|
203
203
|
<optgroup
|
|
204
204
|
v-else
|
|
205
205
|
:key="`group-${index}`"
|
|
206
|
-
:disabled="
|
|
206
|
+
:disabled="isOptionDisabled(option)"
|
|
207
207
|
:label="getOptionLabel(option)"
|
|
208
208
|
>
|
|
209
209
|
<option
|
|
210
210
|
v-for="(item, i) in getOptionGrouped(option)"
|
|
211
211
|
:key="`group-${index}-item-${i}`"
|
|
212
|
-
:disabled="
|
|
212
|
+
:disabled="isOptionDisabled(item)"
|
|
213
213
|
:value="getOptionValue(item)"
|
|
214
214
|
>
|
|
215
215
|
{{ getOptionLabel(item) }}
|
|
@@ -24,7 +24,7 @@ export function useOptions(props: any) {
|
|
|
24
24
|
: get(option, valueKey.value)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
const
|
|
27
|
+
const isOptionDisabled = (option: string | Option): boolean => {
|
|
28
28
|
if (typeof option !== 'object' && option !== null) return false
|
|
29
29
|
|
|
30
30
|
return typeof disabledKey.value === 'function'
|
|
@@ -41,7 +41,7 @@ export function useOptions(props: any) {
|
|
|
41
41
|
options,
|
|
42
42
|
getOptionLabel,
|
|
43
43
|
getOptionValue,
|
|
44
|
-
|
|
44
|
+
isOptionDisabled,
|
|
45
45
|
getOptionGrouped,
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -3,7 +3,6 @@ import VvButton from '@/components/VvButton/VvButton.vue'
|
|
|
3
3
|
import { Default } from './Button.stories'
|
|
4
4
|
import { argTypes, defaultArgs } from './Button.settings'
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
const meta: Meta<typeof VvButton> = {
|
|
8
7
|
title: 'Components/Button/Modifiers',
|
|
9
8
|
component: VvButton,
|
|
@@ -70,9 +69,6 @@ export const StaticLight: Story = {
|
|
|
70
69
|
},
|
|
71
70
|
render: (args) => ({
|
|
72
71
|
components: { VvButton },
|
|
73
|
-
backgrounds: {
|
|
74
|
-
default: 'dark',
|
|
75
|
-
},
|
|
76
72
|
setup() {
|
|
77
73
|
return { args }
|
|
78
74
|
},
|
|
@@ -81,23 +77,18 @@ export const StaticLight: Story = {
|
|
|
81
77
|
<vv-button v-bind="args" data-testId="element" />
|
|
82
78
|
</div>
|
|
83
79
|
`,
|
|
84
|
-
})
|
|
85
|
-
|
|
80
|
+
}),
|
|
86
81
|
}
|
|
87
82
|
|
|
88
|
-
|
|
89
83
|
export const StaticDark: Story = {
|
|
90
84
|
...Default,
|
|
91
85
|
args: {
|
|
92
86
|
...Default.args,
|
|
93
|
-
label: 'Static
|
|
94
|
-
modifiers: 'static-
|
|
87
|
+
label: 'Static dark',
|
|
88
|
+
modifiers: 'static-dark',
|
|
95
89
|
},
|
|
96
90
|
render: (args) => ({
|
|
97
91
|
components: { VvButton },
|
|
98
|
-
backgrounds: {
|
|
99
|
-
default: 'dark',
|
|
100
|
-
},
|
|
101
92
|
setup() {
|
|
102
93
|
return { args }
|
|
103
94
|
},
|
|
@@ -106,7 +97,7 @@ export const StaticDark: Story = {
|
|
|
106
97
|
<vv-button v-bind="args" data-testId="element" />
|
|
107
98
|
</div>
|
|
108
99
|
`,
|
|
109
|
-
})
|
|
100
|
+
}),
|
|
110
101
|
}
|
|
111
102
|
|
|
112
103
|
export const Block: Story = {
|
|
@@ -137,7 +128,6 @@ export const FullBleed: Story = {
|
|
|
137
128
|
},
|
|
138
129
|
}
|
|
139
130
|
|
|
140
|
-
|
|
141
131
|
export const Action: Story = {
|
|
142
132
|
...Default,
|
|
143
133
|
args: {
|
|
@@ -94,3 +94,21 @@ export const DotPathOptions: Story = {
|
|
|
94
94
|
],
|
|
95
95
|
},
|
|
96
96
|
}
|
|
97
|
+
|
|
98
|
+
export const ObjectValue: Story = {
|
|
99
|
+
...Default,
|
|
100
|
+
args: {
|
|
101
|
+
...Default.args,
|
|
102
|
+
multiple: true,
|
|
103
|
+
options: [
|
|
104
|
+
{
|
|
105
|
+
value: { name: 'John Doe', email: 'john.doe@test.com' },
|
|
106
|
+
label: 'John Doe',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
value: { name: 'Jane Doe', email: 'jane.doe@test.com' },
|
|
110
|
+
label: 'Jane Doe',
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
}
|
|
@@ -9,9 +9,10 @@ import type { Ref } from 'vue'
|
|
|
9
9
|
*/
|
|
10
10
|
// eslint-disable-next-line
|
|
11
11
|
export function equals(obj1: any, obj2: any, field?: string) {
|
|
12
|
-
if (field)
|
|
12
|
+
if (field) {
|
|
13
13
|
return resolveFieldData(obj1, field) === resolveFieldData(obj2, field)
|
|
14
|
-
|
|
14
|
+
}
|
|
15
|
+
return deepEquals(obj1, obj2)
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
/**
|