@vc-shell/framework 1.0.180 → 1.0.182
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/CHANGELOG.md +18 -0
- package/dist/framework.js +5020 -5002
- package/dist/index.css +1 -1
- package/dist/shared/components/popup-handler/components/vc-popup-container/vc-popup-container.vue.d.ts.map +1 -1
- package/dist/shared/components/popup-handler/composables/usePopup/index.d.ts.map +1 -1
- package/dist/tailwind.config.d.ts +1 -2
- package/dist/tailwind.config.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/components/atoms/vc-badge/index.d.ts +1 -79
- package/dist/ui/components/atoms/vc-badge/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-badge/vc-badge.stories.d.ts +389 -6
- package/dist/ui/components/atoms/vc-badge/vc-badge.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-button/vc-button.stories.d.ts +2295 -5
- package/dist/ui/components/atoms/vc-button/vc-button.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-card/vc-card.stories.d.ts +1119 -5
- package/dist/ui/components/atoms/vc-card/vc-card.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-checkbox/vc-checkbox.stories.d.ts +1778 -5
- package/dist/ui/components/atoms/vc-checkbox/vc-checkbox.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-col/vc-col.stories.d.ts +51 -5
- package/dist/ui/components/atoms/vc-col/vc-col.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-hint/vc-hint.stories.d.ts +37 -5
- package/dist/ui/components/atoms/vc-hint/vc-hint.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-icon/vc-icon.stories.d.ts +62 -5
- package/dist/ui/components/atoms/vc-icon/vc-icon.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-image/vc-image.stories.d.ts +103 -5
- package/dist/ui/components/atoms/vc-image/vc-image.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-label/vc-label.stories.d.ts +101 -5
- package/dist/ui/components/atoms/vc-label/vc-label.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-link/vc-link.stories.d.ts +103 -5
- package/dist/ui/components/atoms/vc-link/vc-link.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-loading/vc-loading.stories.d.ts +18 -5
- package/dist/ui/components/atoms/vc-loading/vc-loading.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-progress/vc-progress.stories.d.ts +85 -5
- package/dist/ui/components/atoms/vc-progress/vc-progress.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-row/vc-row.stories.d.ts +25 -5
- package/dist/ui/components/atoms/vc-row/vc-row.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-status/vc-status.stories.d.ts +116 -5
- package/dist/ui/components/atoms/vc-status/vc-status.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-switch/vc-switch.stories.d.ts +53 -5
- package/dist/ui/components/atoms/vc-switch/vc-switch.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-video/vc-video.stories.d.ts +59 -0
- package/dist/ui/components/atoms/vc-video/vc-video.stories.d.ts.map +1 -0
- package/dist/ui/components/atoms/vc-widget/vc-widget.stories.d.ts +42 -5
- package/dist/ui/components/atoms/vc-widget/vc-widget.stories.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.d.ts +40 -5
- package/dist/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-editor/vc-editor.stories.d.ts +179 -5
- package/dist/ui/components/molecules/vc-editor/vc-editor.stories.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-field/vc-field.stories.d.ts +12 -0
- package/dist/ui/components/molecules/vc-field/vc-field.stories.d.ts.map +1 -0
- package/dist/ui/components/molecules/vc-file-upload/index.d.ts +19 -0
- package/dist/ui/components/molecules/vc-file-upload/index.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.stories.d.ts +182 -5
- package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.stories.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.vue.d.ts +4 -0
- package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-form/vc-form.stories.d.ts +29 -5
- package/dist/ui/components/molecules/vc-form/vc-form.stories.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-input/vc-input.stories.d.ts +347 -5
- package/dist/ui/components/molecules/vc-input/vc-input.stories.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.stories.d.ts +354 -5
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.stories.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.stories.d.ts +889 -0
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.stories.d.ts.map +1 -0
- package/dist/ui/components/molecules/vc-pagination/vc-pagination.stories.d.ts +74 -5
- package/dist/ui/components/molecules/vc-pagination/vc-pagination.stories.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-rating/vc-rating.stories.d.ts +498 -5
- package/dist/ui/components/molecules/vc-rating/vc-rating.stories.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-select/vc-select.stories.d.ts +2567 -5
- package/dist/ui/components/molecules/vc-select/vc-select.stories.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-slider/vc-slider.stories.d.ts +156 -5
- package/dist/ui/components/molecules/vc-slider/vc-slider.stories.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-textarea/vc-textarea.stories.d.ts +1297 -5
- package/dist/ui/components/molecules/vc-textarea/vc-textarea.stories.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-app/vc-app.stories.d.ts +276 -5
- package/dist/ui/components/organisms/vc-app/vc-app.stories.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-app/vc-app.vue.d.ts +82 -3
- package/dist/ui/components/organisms/vc-app/vc-app.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-blade/index.d.ts +1 -179
- package/dist/ui/components/organisms/vc-blade/index.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-blade/vc-blade.stories.d.ts +209 -5
- package/dist/ui/components/organisms/vc-blade/vc-blade.stories.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts +6 -3
- package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-gallery/vc-gallery.stories.d.ts +155 -6
- package/dist/ui/components/organisms/vc-gallery/vc-gallery.stories.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts +0 -4
- package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts +13 -8
- package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/vc-table.stories.d.ts +1272 -5
- package/dist/ui/components/organisms/vc-table/vc-table.stories.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
- package/package.json +6 -5
- package/shared/components/popup-handler/components/vc-popup-container/vc-popup-container.vue +1 -0
- package/shared/components/popup-handler/composables/usePopup/index.ts +8 -7
- package/tailwind.config.ts +2 -46
- package/ui/components/atoms/vc-badge/index.ts +1 -13
- package/ui/components/atoms/vc-badge/vc-badge.stories.ts +48 -20
- package/ui/components/atoms/vc-button/vc-button.stories.ts +111 -19
- package/ui/components/atoms/vc-card/vc-card.stories.ts +96 -18
- package/ui/components/atoms/vc-checkbox/vc-checkbox.stories.ts +75 -16
- package/ui/components/atoms/vc-col/vc-col.stories.ts +16 -17
- package/ui/components/atoms/vc-hint/vc-hint.stories.ts +18 -16
- package/ui/components/atoms/vc-icon/vc-icon.stories.ts +57 -16
- package/ui/components/atoms/vc-image/vc-image.stories.ts +72 -24
- package/ui/components/atoms/vc-label/vc-label.stories.ts +26 -16
- package/ui/components/atoms/vc-link/vc-link.stories.ts +29 -16
- package/ui/components/atoms/vc-loading/vc-loading.stories.ts +11 -16
- package/ui/components/atoms/vc-progress/vc-progress.stories.ts +22 -16
- package/ui/components/atoms/vc-row/vc-row.stories.ts +14 -17
- package/ui/components/atoms/vc-status/vc-status.stories.ts +78 -16
- package/ui/components/atoms/vc-switch/vc-switch.stories.ts +18 -16
- package/ui/components/atoms/vc-video/vc-video.stories.ts +33 -0
- package/ui/components/atoms/vc-widget/vc-widget.stories.ts +13 -17
- package/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.ts +22 -19
- package/ui/components/molecules/vc-editor/vc-editor.stories.ts +24 -16
- package/ui/components/molecules/vc-field/vc-field.stories.ts +114 -0
- package/ui/components/molecules/vc-file-upload/vc-file-upload.stories.ts +34 -16
- package/ui/components/molecules/vc-file-upload/vc-file-upload.vue +3 -1
- package/ui/components/molecules/vc-form/vc-form.stories.ts +20 -16
- package/ui/components/molecules/vc-input/vc-input.stories.ts +144 -14
- package/ui/components/molecules/vc-input-currency/vc-input-currency.stories.ts +61 -18
- package/ui/components/molecules/vc-multivalue/vc-multivalue.stories.ts +120 -0
- package/ui/components/molecules/vc-pagination/vc-pagination.stories.ts +17 -14
- package/ui/components/molecules/vc-rating/vc-rating.stories.ts +51 -15
- package/ui/components/molecules/vc-select/vc-select.stories.ts +605 -29
- package/ui/components/molecules/vc-select/vc-select.vue +9 -3
- package/ui/components/molecules/vc-slider/vc-slider.stories.ts +34 -21
- package/ui/components/molecules/vc-textarea/vc-textarea.stories.ts +46 -14
- package/ui/components/organisms/vc-app/vc-app.stories.ts +204 -51
- package/ui/components/organisms/vc-app/vc-app.vue +31 -24
- package/ui/components/organisms/vc-blade/index.ts +1 -11
- package/ui/components/organisms/vc-blade/vc-blade.stories.ts +60 -16
- package/ui/components/organisms/vc-blade/vc-blade.vue +7 -2
- package/ui/components/organisms/vc-gallery/vc-gallery.stories.ts +68 -24
- package/ui/components/organisms/vc-gallery/vc-gallery.vue +7 -6
- package/ui/components/organisms/vc-popup/vc-popup.vue +7 -1
- package/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue +1 -0
- package/ui/components/organisms/vc-table/vc-table.stories.ts +144 -30
- package/ui/components/organisms/vc-table/vc-table.vue +13 -7
- package/dist/ui/components/organisms/vc-login-form/vc-login-form.stories.d.ts +0 -7
- package/dist/ui/components/organisms/vc-login-form/vc-login-form.stories.d.ts.map +0 -1
- package/dist/ui/components/organisms/vc-popup/vc-popup.stories.d.ts +0 -7
- package/dist/ui/components/organisms/vc-popup/vc-popup.stories.d.ts.map +0 -1
- package/ui/components/organisms/vc-login-form/vc-login-form.stories.ts +0 -52
- package/ui/components/organisms/vc-popup/vc-popup.stories.ts +0 -21
|
@@ -1,38 +1,614 @@
|
|
|
1
|
-
import type { Meta,
|
|
1
|
+
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
2
2
|
import { VcSelect } from "./";
|
|
3
|
+
import { ref } from "vue";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
export default {
|
|
5
6
|
title: "molecules/VcSelect",
|
|
6
|
-
|
|
7
|
+
component: VcSelect as Record<keyof typeof VcSelect, unknown>,
|
|
8
|
+
args: {
|
|
9
|
+
label: "Select",
|
|
10
|
+
placeholder: "Select an option",
|
|
11
|
+
},
|
|
12
|
+
argTypes: {
|
|
13
|
+
options: {
|
|
14
|
+
table: {
|
|
15
|
+
type: {
|
|
16
|
+
summary: "((keyword?: string, skip?: number, ids?: string[]) => Promise<P>) | T[]",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
optionLabel: {
|
|
21
|
+
control: "text",
|
|
22
|
+
},
|
|
23
|
+
optionValue: {
|
|
24
|
+
control: "text",
|
|
25
|
+
},
|
|
26
|
+
debounce: {
|
|
27
|
+
control: "number",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
} satisfies Meta<typeof VcSelect>;
|
|
31
|
+
|
|
32
|
+
export const ObjectArrayOptions: StoryFn<typeof VcSelect> = (args) => ({
|
|
33
|
+
components: { VcSelect } as Record<keyof typeof VcSelect, unknown>,
|
|
34
|
+
setup() {
|
|
35
|
+
const val = ref();
|
|
36
|
+
return { args, val };
|
|
37
|
+
},
|
|
38
|
+
template: `<VcSelect
|
|
39
|
+
v-bind="args"
|
|
40
|
+
v-model="val"
|
|
41
|
+
:options="[
|
|
42
|
+
{ title: 'Option 1', label: 'Option 1' },
|
|
43
|
+
{ title: 'Option 2', label: 'Option 2' },
|
|
44
|
+
{ title: 'Option 3', label: 'Option 3' },
|
|
45
|
+
]"
|
|
46
|
+
optionLabel="label"
|
|
47
|
+
optionValue="title"
|
|
48
|
+
></VcSelect>`,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export const StringArrayOptions: StoryFn<typeof VcSelect> = (args) => ({
|
|
52
|
+
components: { VcSelect } as Record<keyof typeof VcSelect, unknown>,
|
|
53
|
+
setup() {
|
|
54
|
+
const val = ref();
|
|
55
|
+
return { args, val };
|
|
56
|
+
},
|
|
57
|
+
template: `<VcSelect v-bind="args" v-model="val" :options="['Option 1', 'Option 2', 'Option 3']"></VcSelect>`,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export const AsyncOptions: StoryFn<typeof VcSelect> = (args) => ({
|
|
61
|
+
components: { VcSelect } as Record<keyof typeof VcSelect, unknown>,
|
|
62
|
+
setup() {
|
|
63
|
+
const val = ref();
|
|
64
|
+
const getItems = async () =>
|
|
65
|
+
new Promise((resolve) => {
|
|
66
|
+
setTimeout(() => {
|
|
67
|
+
resolve({
|
|
68
|
+
results: [
|
|
69
|
+
{ title: "Option 1", label: "Option 1" },
|
|
70
|
+
{ title: "Option 2", label: "Option 2" },
|
|
71
|
+
{ title: "Option 3", label: "Option 3" },
|
|
72
|
+
],
|
|
73
|
+
totalCount: 3,
|
|
74
|
+
});
|
|
75
|
+
}, 1000);
|
|
76
|
+
});
|
|
77
|
+
return { args, val, getItems };
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
template: `
|
|
81
|
+
<VcSelect
|
|
82
|
+
v-bind="args"
|
|
83
|
+
v-model="val"
|
|
84
|
+
:options="getItems"
|
|
85
|
+
optionLabel="label"
|
|
86
|
+
optionValue="title"
|
|
87
|
+
></VcSelect>`,
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
export const EmitValueTrueProp: StoryFn<typeof VcSelect> = (args) => ({
|
|
91
|
+
components: { VcSelect } as Record<keyof typeof VcSelect, unknown>,
|
|
92
|
+
setup() {
|
|
93
|
+
const val = ref("Option 1");
|
|
94
|
+
return { args, val };
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
template: `
|
|
98
|
+
<div>
|
|
99
|
+
<VcSelect
|
|
100
|
+
v-bind="args"
|
|
101
|
+
v-model="val"
|
|
102
|
+
:options="[
|
|
103
|
+
{ title: 'Option 1', label: 'Option 1 label' },
|
|
104
|
+
{ title: 'Option 2', label: 'Option 2 label' },
|
|
105
|
+
{ title: 'Option 3', label: 'Option 3 label' },
|
|
106
|
+
]"
|
|
107
|
+
optionLabel="label"
|
|
108
|
+
optionValue="title"
|
|
109
|
+
></VcSelect>
|
|
110
|
+
|
|
111
|
+
<p>Selected value: {{val}}</p>
|
|
112
|
+
</div>`,
|
|
113
|
+
});
|
|
114
|
+
EmitValueTrueProp.parameters = {
|
|
115
|
+
docs: {
|
|
116
|
+
description: {
|
|
117
|
+
story: "The default emitValue === <b>true</b> returns the value of key defined in optionValue",
|
|
118
|
+
},
|
|
119
|
+
},
|
|
7
120
|
};
|
|
8
121
|
|
|
9
|
-
export
|
|
10
|
-
|
|
122
|
+
export const EmitValueFalseProp: StoryFn<typeof VcSelect> = (args) => ({
|
|
123
|
+
components: { VcSelect } as Record<keyof typeof VcSelect, unknown>,
|
|
124
|
+
setup() {
|
|
125
|
+
const val = ref({ title: "Option 1", label: "Option 1 label" });
|
|
126
|
+
return { args, val };
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
template: `
|
|
130
|
+
<div>
|
|
131
|
+
<VcSelect
|
|
132
|
+
v-bind="args"
|
|
133
|
+
v-model="val"
|
|
134
|
+
:emit-value="false"
|
|
135
|
+
:options="[
|
|
136
|
+
{ title: 'Option 1', label: 'Option 1 label' },
|
|
137
|
+
{ title: 'Option 2', label: 'Option 2 label' },
|
|
138
|
+
{ title: 'Option 3', label: 'Option 3 label' },
|
|
139
|
+
]"
|
|
140
|
+
optionLabel="label"
|
|
141
|
+
optionValue="title"
|
|
142
|
+
></VcSelect>
|
|
11
143
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
144
|
+
<p>Selected value: {{val}}</p>
|
|
145
|
+
</div>`,
|
|
146
|
+
});
|
|
147
|
+
EmitValueFalseProp.parameters = {
|
|
148
|
+
docs: {
|
|
149
|
+
description: {
|
|
150
|
+
story: "emitValue === <b>false</b> returns the complete object as the result",
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export const MapOptionsTrueProp: StoryFn<typeof VcSelect> = (args) => ({
|
|
156
|
+
components: { VcSelect } as Record<keyof typeof VcSelect, unknown>,
|
|
157
|
+
setup() {
|
|
158
|
+
const val = ref("Option 1 title");
|
|
159
|
+
return { args, val };
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
template: `
|
|
163
|
+
<div>
|
|
164
|
+
<VcSelect
|
|
165
|
+
v-bind="args"
|
|
166
|
+
v-model="val"
|
|
167
|
+
:options="[
|
|
168
|
+
{ title: 'Option 1 title', label: 'Option 1 label' },
|
|
169
|
+
{ title: 'Option 2 title', label: 'Option 2 label' },
|
|
170
|
+
{ title: 'Option 3 title', label: 'Option 3 label' },
|
|
171
|
+
]"
|
|
172
|
+
optionLabel="label"
|
|
173
|
+
optionValue="title"
|
|
174
|
+
></VcSelect>
|
|
175
|
+
|
|
176
|
+
<p>Selected value: {{val}}</p>
|
|
177
|
+
</div>`,
|
|
178
|
+
});
|
|
179
|
+
MapOptionsTrueProp.parameters = {
|
|
180
|
+
docs: {
|
|
181
|
+
description: {
|
|
182
|
+
story:
|
|
183
|
+
"The default mapOptions === <b>true</b> maps map labels of model from 'options' Array. If you are using emit-value you will probably need to use map-options to display the label text in the select field rather than the value.",
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export const MapOptionsFalseProp: StoryFn<typeof VcSelect> = (args) => ({
|
|
189
|
+
components: { VcSelect } as Record<keyof typeof VcSelect, unknown>,
|
|
190
|
+
setup() {
|
|
191
|
+
const val = ref("Option 1 title");
|
|
192
|
+
return { args, val };
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
template: `
|
|
196
|
+
<div>
|
|
197
|
+
<VcSelect
|
|
198
|
+
v-bind="args"
|
|
199
|
+
v-model="val"
|
|
200
|
+
:map-options="false"
|
|
201
|
+
:options="[
|
|
202
|
+
{ title: 'Option 1 title', label: 'Option 1 label' },
|
|
203
|
+
{ title: 'Option 2 title', label: 'Option 2 label' },
|
|
204
|
+
{ title: 'Option 3 title', label: 'Option 3 label' },
|
|
205
|
+
]"
|
|
206
|
+
optionLabel="label"
|
|
207
|
+
optionValue="title"
|
|
208
|
+
></VcSelect>
|
|
209
|
+
|
|
210
|
+
<p>Selected value: {{val}}</p>
|
|
211
|
+
</div>`,
|
|
212
|
+
});
|
|
213
|
+
MapOptionsFalseProp.parameters = {
|
|
214
|
+
docs: {
|
|
215
|
+
description: {
|
|
216
|
+
story: "mapOptions === <b>false</b> will not map labels of model from 'options' Array.",
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
export const Error = ObjectArrayOptions.bind({});
|
|
222
|
+
Error.args = {
|
|
223
|
+
error: true,
|
|
224
|
+
errorMessage: "Some error message",
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
export const Tooltip = ObjectArrayOptions.bind({});
|
|
228
|
+
Tooltip.args = {
|
|
229
|
+
tooltip: "Some tooltip",
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export const Disabled = ObjectArrayOptions.bind({});
|
|
233
|
+
Disabled.args = {
|
|
234
|
+
disabled: true,
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
export const SearchableInput = ObjectArrayOptions.bind({});
|
|
238
|
+
SearchableInput.args = {
|
|
239
|
+
searchable: true,
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
export const SearchableInputCustomDebounce = SearchableInput.bind({});
|
|
243
|
+
SearchableInputCustomDebounce.args = {
|
|
244
|
+
searchable: true,
|
|
245
|
+
debounce: 2000,
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
export const Required = ObjectArrayOptions.bind({});
|
|
249
|
+
Required.args = {
|
|
250
|
+
required: true,
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
export const MultipleSelect: StoryFn<typeof VcSelect> = (args) => ({
|
|
254
|
+
components: { VcSelect } as Record<keyof typeof VcSelect, unknown>,
|
|
255
|
+
setup() {
|
|
256
|
+
const val = ref([
|
|
257
|
+
{ title: "Option 1", label: "Option 1" },
|
|
258
|
+
{ title: "Option 2", label: "Option 2" },
|
|
259
|
+
]);
|
|
260
|
+
return { args, val };
|
|
261
|
+
},
|
|
262
|
+
|
|
263
|
+
template: `
|
|
264
|
+
<VcSelect
|
|
265
|
+
v-bind="args"
|
|
266
|
+
v-model="val"
|
|
267
|
+
multiple
|
|
268
|
+
:options="[
|
|
269
|
+
{ title: 'Option 1', label: 'Option 1' },
|
|
270
|
+
{ title: 'Option 2', label: 'Option 2' },
|
|
271
|
+
{ title: 'Option 3', label: 'Option 3' },
|
|
272
|
+
]"
|
|
273
|
+
optionLabel="label"
|
|
274
|
+
optionValue="title"
|
|
275
|
+
></VcSelect>`,
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
export const NotClearable: StoryFn<typeof VcSelect> = (args) => ({
|
|
279
|
+
components: { VcSelect } as Record<keyof typeof VcSelect, unknown>,
|
|
280
|
+
setup() {
|
|
281
|
+
const val = ref("Option 1");
|
|
282
|
+
return { args, val };
|
|
283
|
+
},
|
|
284
|
+
template: `<VcSelect
|
|
285
|
+
v-bind="args"
|
|
286
|
+
v-model="val"
|
|
287
|
+
:clearable="false"
|
|
288
|
+
:options="[
|
|
289
|
+
{ title: 'Option 1', label: 'Option 1' },
|
|
290
|
+
{ title: 'Option 2', label: 'Option 2' },
|
|
291
|
+
{ title: 'Option 3', label: 'Option 3' },
|
|
292
|
+
]"
|
|
293
|
+
optionLabel="label"
|
|
294
|
+
optionValue="title"
|
|
295
|
+
></VcSelect>`,
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
export const Loading = ObjectArrayOptions.bind({});
|
|
299
|
+
Loading.args = {
|
|
300
|
+
loading: true,
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
export const Prefix = ObjectArrayOptions.bind({});
|
|
304
|
+
Prefix.args = {
|
|
305
|
+
prefix: "prefix",
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
export const Suffix = ObjectArrayOptions.bind({});
|
|
309
|
+
Suffix.args = {
|
|
310
|
+
suffix: "suffix",
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
export const Hint = ObjectArrayOptions.bind({});
|
|
314
|
+
Hint.args = {
|
|
315
|
+
hint: "Some hint",
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
export const CustomSelectControlSlot: StoryFn<typeof VcSelect> = (args) => ({
|
|
319
|
+
components: { VcSelect } as Record<keyof typeof VcSelect, unknown>,
|
|
320
|
+
setup() {
|
|
321
|
+
const val = ref();
|
|
322
|
+
return { args, val };
|
|
323
|
+
},
|
|
324
|
+
template: `<VcSelect
|
|
325
|
+
v-bind="args"
|
|
326
|
+
v-model="val"
|
|
327
|
+
:options="[
|
|
328
|
+
{ title: 'Option 1', label: 'Option 1' },
|
|
329
|
+
{ title: 'Option 2', label: 'Option 2' },
|
|
330
|
+
{ title: 'Option 3', label: 'Option 3' },
|
|
331
|
+
]"
|
|
332
|
+
optionLabel="label"
|
|
333
|
+
optionValue="title"
|
|
334
|
+
customSelectControl
|
|
335
|
+
>
|
|
336
|
+
<template #control="scope">
|
|
337
|
+
<VcButton @click="scope.toggleHandler" class="tw-w-full">Custom control</VcButton>
|
|
338
|
+
</template>
|
|
339
|
+
</VcSelect>`,
|
|
340
|
+
});
|
|
341
|
+
CustomSelectControlSlot.parameters = {
|
|
342
|
+
docs: {
|
|
343
|
+
description: {
|
|
344
|
+
story: `
|
|
345
|
+
"control": (scope: {
|
|
346
|
+
/**
|
|
347
|
+
* Toggle dropdown handler
|
|
348
|
+
*/
|
|
349
|
+
toggleHandler: () => void;
|
|
350
|
+
}) => any;`,
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
export const CustomPrependInnerSlot: StoryFn<typeof VcSelect> = (args) => ({
|
|
356
|
+
components: { VcSelect } as Record<keyof typeof VcSelect, unknown>,
|
|
357
|
+
setup() {
|
|
358
|
+
const val = ref();
|
|
359
|
+
return { args, val };
|
|
360
|
+
},
|
|
361
|
+
template: `<VcSelect
|
|
362
|
+
v-bind="args"
|
|
363
|
+
v-model="val"
|
|
364
|
+
:options="[
|
|
365
|
+
{ title: 'Option 1', label: 'Option 1' },
|
|
366
|
+
{ title: 'Option 2', label: 'Option 2' },
|
|
367
|
+
{ title: 'Option 3', label: 'Option 3' },
|
|
368
|
+
]"
|
|
369
|
+
optionLabel="label"
|
|
370
|
+
optionValue="title"
|
|
371
|
+
customPrependInner
|
|
372
|
+
>
|
|
373
|
+
<template #prepend-inner>
|
|
374
|
+
<VcButton>Action</VcButton>
|
|
375
|
+
</template>
|
|
376
|
+
</VcSelect>`,
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
export const CustomAppendInnerSlot: StoryFn<typeof VcSelect> = (args) => ({
|
|
380
|
+
components: { VcSelect } as Record<keyof typeof VcSelect, unknown>,
|
|
381
|
+
setup() {
|
|
382
|
+
const val = ref();
|
|
383
|
+
return { args, val };
|
|
384
|
+
},
|
|
385
|
+
template: `<VcSelect
|
|
386
|
+
v-bind="args"
|
|
387
|
+
v-model="val"
|
|
388
|
+
:options="[
|
|
389
|
+
{ title: 'Option 1', label: 'Option 1' },
|
|
390
|
+
{ title: 'Option 2', label: 'Option 2' },
|
|
391
|
+
{ title: 'Option 3', label: 'Option 3' },
|
|
392
|
+
]"
|
|
393
|
+
optionLabel="label"
|
|
394
|
+
optionValue="title"
|
|
395
|
+
customAppendInner
|
|
396
|
+
>
|
|
397
|
+
<template #append-inner>
|
|
398
|
+
<VcButton>Action</VcButton>
|
|
399
|
+
</template>
|
|
400
|
+
</VcSelect>`,
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
export const CustomPrependSlot: StoryFn<typeof VcSelect> = (args) => ({
|
|
404
|
+
components: { VcSelect } as Record<keyof typeof VcSelect, unknown>,
|
|
405
|
+
setup() {
|
|
406
|
+
const val = ref();
|
|
407
|
+
return { args, val };
|
|
408
|
+
},
|
|
409
|
+
template: `<VcSelect
|
|
410
|
+
v-bind="args"
|
|
411
|
+
v-model="val"
|
|
412
|
+
:options="[
|
|
413
|
+
{ title: 'Option 1', label: 'Option 1' },
|
|
414
|
+
{ title: 'Option 2', label: 'Option 2' },
|
|
415
|
+
{ title: 'Option 3', label: 'Option 3' },
|
|
416
|
+
]"
|
|
417
|
+
optionLabel="label"
|
|
418
|
+
optionValue="title"
|
|
419
|
+
customPrepend
|
|
420
|
+
>
|
|
421
|
+
<template #prepend>
|
|
422
|
+
<VcButton>Action</VcButton>
|
|
423
|
+
</template>
|
|
424
|
+
</VcSelect>`,
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
export const CustomAppendSlot: StoryFn<typeof VcSelect> = (args) => ({
|
|
428
|
+
components: { VcSelect } as Record<keyof typeof VcSelect, unknown>,
|
|
429
|
+
setup() {
|
|
430
|
+
const val = ref();
|
|
431
|
+
return { args, val };
|
|
432
|
+
},
|
|
433
|
+
template: `<VcSelect
|
|
434
|
+
v-bind="args"
|
|
435
|
+
v-model="val"
|
|
436
|
+
:options="[
|
|
437
|
+
{ title: 'Option 1', label: 'Option 1' },
|
|
438
|
+
{ title: 'Option 2', label: 'Option 2' },
|
|
439
|
+
{ title: 'Option 3', label: 'Option 3' },
|
|
440
|
+
]"
|
|
441
|
+
optionLabel="label"
|
|
442
|
+
optionValue="title"
|
|
443
|
+
customAppend
|
|
444
|
+
>
|
|
445
|
+
<template #append>
|
|
446
|
+
<VcButton>Action</VcButton>
|
|
447
|
+
</template>
|
|
448
|
+
</VcSelect>`,
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
export const CustomNoOptionsSlot: StoryFn<typeof VcSelect> = (args) => ({
|
|
452
|
+
components: { VcSelect } as Record<keyof typeof VcSelect, unknown>,
|
|
453
|
+
setup() {
|
|
454
|
+
const val = ref();
|
|
455
|
+
return { args, val };
|
|
456
|
+
},
|
|
457
|
+
template: `<VcSelect
|
|
458
|
+
v-bind="args"
|
|
459
|
+
v-model="val"
|
|
460
|
+
:options="[]"
|
|
461
|
+
optionLabel="label"
|
|
462
|
+
optionValue="title"
|
|
463
|
+
customNoOptions
|
|
464
|
+
>
|
|
465
|
+
<template #no-options>
|
|
466
|
+
<h2 class="tw-font-bold">I'm custom slot!</h2>
|
|
467
|
+
<p>Please try again later</p>
|
|
468
|
+
</template>
|
|
469
|
+
</VcSelect>`,
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
export const CustomErrorSlot: StoryFn<typeof VcSelect> = (args) => ({
|
|
473
|
+
components: { VcSelect } as Record<keyof typeof VcSelect, unknown>,
|
|
474
|
+
setup() {
|
|
475
|
+
const val = ref();
|
|
476
|
+
return { args, val };
|
|
477
|
+
},
|
|
478
|
+
template: `<VcSelect
|
|
479
|
+
v-bind="args"
|
|
480
|
+
v-model="val"
|
|
481
|
+
:options="[]"
|
|
482
|
+
optionLabel="label"
|
|
483
|
+
optionValue="title"
|
|
484
|
+
error
|
|
485
|
+
customError
|
|
486
|
+
>
|
|
487
|
+
<template #error>
|
|
488
|
+
<p class="tw-font-bold">I'm custom error message!</p>
|
|
489
|
+
</template>
|
|
490
|
+
</VcSelect>`,
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
export const CustomHintSlot: StoryFn<typeof VcSelect> = (args) => ({
|
|
494
|
+
components: { VcSelect } as Record<keyof typeof VcSelect, unknown>,
|
|
495
|
+
setup() {
|
|
496
|
+
const val = ref();
|
|
497
|
+
return { args, val };
|
|
498
|
+
},
|
|
499
|
+
template: `<VcSelect
|
|
500
|
+
v-bind="args"
|
|
501
|
+
v-model="val"
|
|
502
|
+
:options="[]"
|
|
503
|
+
optionLabel="label"
|
|
504
|
+
optionValue="title"
|
|
505
|
+
customHint
|
|
506
|
+
>
|
|
507
|
+
<template #hint>
|
|
508
|
+
<p class="tw-font-bold">I'm custom hint message!</p>
|
|
509
|
+
</template>
|
|
510
|
+
</VcSelect>`,
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
export const CustomSelectedOptionSlot: StoryFn<typeof VcSelect> = (args) => ({
|
|
514
|
+
components: { VcSelect } as Record<keyof typeof VcSelect, unknown>,
|
|
515
|
+
setup() {
|
|
516
|
+
const val = ref("Option 1");
|
|
517
|
+
return { args, val };
|
|
518
|
+
},
|
|
519
|
+
template: `<VcSelect
|
|
520
|
+
v-bind="args"
|
|
521
|
+
v-model="val"
|
|
522
|
+
:options="[
|
|
523
|
+
{ title: 'Option 1', label: 'Option 1' },
|
|
524
|
+
{ title: 'Option 2', label: 'Option 2' },
|
|
525
|
+
{ title: 'Option 3', label: 'Option 3' },
|
|
526
|
+
]"
|
|
527
|
+
optionLabel="label"
|
|
528
|
+
optionValue="title"
|
|
529
|
+
>
|
|
530
|
+
<template #selected-item="{ opt }">
|
|
531
|
+
|
|
532
|
+
<VcIcon class="tw-mr-2 tw-text-green-300" icon="fas fa-check" />
|
|
533
|
+
<p>{{opt.label}}</p>
|
|
534
|
+
|
|
535
|
+
</template>
|
|
536
|
+
</VcSelect>`,
|
|
537
|
+
});
|
|
538
|
+
CustomSelectedOptionSlot.parameters = {
|
|
539
|
+
docs: {
|
|
540
|
+
description: {
|
|
541
|
+
story: `
|
|
542
|
+
"selected-item": (scope: {
|
|
543
|
+
/**
|
|
544
|
+
* Selection index
|
|
545
|
+
*/
|
|
546
|
+
index: number;
|
|
547
|
+
/**
|
|
548
|
+
* Selected option -- its value is taken from model
|
|
549
|
+
*/
|
|
550
|
+
opt: Option;
|
|
551
|
+
/**
|
|
552
|
+
* Always true -- passed as prop
|
|
553
|
+
*/
|
|
554
|
+
selected: boolean;
|
|
555
|
+
/**
|
|
556
|
+
* Remove selected option located at specific index
|
|
557
|
+
* @param index Index at which to remove selection
|
|
558
|
+
*/
|
|
559
|
+
removeAtIndex: (index: number) => void;
|
|
560
|
+
}) => any;`,
|
|
561
|
+
},
|
|
562
|
+
},
|
|
563
|
+
};
|
|
564
|
+
|
|
565
|
+
export const CustomListOptionSlot: StoryFn<typeof VcSelect> = (args) => ({
|
|
566
|
+
components: { VcSelect } as Record<keyof typeof VcSelect, unknown>,
|
|
567
|
+
setup() {
|
|
568
|
+
const val = ref("Option 1");
|
|
569
|
+
return { args, val };
|
|
570
|
+
},
|
|
571
|
+
template: `<VcSelect
|
|
572
|
+
v-bind="args"
|
|
573
|
+
v-model="val"
|
|
574
|
+
:options="[
|
|
575
|
+
{ title: 'Option 1', label: 'Option 1' },
|
|
576
|
+
{ title: 'Option 2', label: 'Option 2' },
|
|
577
|
+
{ title: 'Option 3', label: 'Option 3' },
|
|
578
|
+
]"
|
|
579
|
+
optionLabel="label"
|
|
580
|
+
optionValue="title"
|
|
581
|
+
>
|
|
582
|
+
<template #option="{ opt }">
|
|
583
|
+
<VcIcon class="tw-mr-2 tw-text-green-300" icon="fas fa-check" />
|
|
584
|
+
<p>{{opt.label}}</p>
|
|
585
|
+
</template>
|
|
586
|
+
</VcSelect>`,
|
|
587
|
+
});
|
|
588
|
+
CustomListOptionSlot.parameters = {
|
|
589
|
+
docs: {
|
|
590
|
+
description: {
|
|
591
|
+
story: `
|
|
592
|
+
option: (scope: {
|
|
593
|
+
/**
|
|
594
|
+
* Option index
|
|
595
|
+
*/
|
|
596
|
+
index: number;
|
|
597
|
+
/**
|
|
598
|
+
* Option -- its value is taken from 'options' prop
|
|
599
|
+
*/
|
|
600
|
+
opt: Option;
|
|
601
|
+
/**
|
|
602
|
+
* Is option selected
|
|
603
|
+
*/
|
|
604
|
+
selected: boolean;
|
|
605
|
+
/**
|
|
606
|
+
* Add/remove option from model
|
|
607
|
+
* @param opt Option to add to model
|
|
608
|
+
*/
|
|
609
|
+
toggleOption: (opt: any) => void;
|
|
610
|
+
}) => any;
|
|
611
|
+
`,
|
|
17
612
|
},
|
|
18
|
-
template: '<vc-select v-bind="args"></vc-select>',
|
|
19
|
-
}),
|
|
20
|
-
args: {
|
|
21
|
-
options: [
|
|
22
|
-
{
|
|
23
|
-
title: "123",
|
|
24
|
-
label: "First label",
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
title: "222",
|
|
28
|
-
label: "Second label",
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
title: "333",
|
|
32
|
-
label: "Third label",
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
optionLabel: "label",
|
|
36
|
-
optionValue: "title",
|
|
37
613
|
},
|
|
38
614
|
};
|
|
@@ -568,9 +568,15 @@ watch(
|
|
|
568
568
|
);
|
|
569
569
|
|
|
570
570
|
if (typeof data === "object" && !Array.isArray(data) && "results" in data) {
|
|
571
|
-
|
|
572
|
-
(x) =>
|
|
573
|
-
|
|
571
|
+
if (props.multiple) {
|
|
572
|
+
defaultValue.value = data.results?.filter((x) =>
|
|
573
|
+
props.modelValue.includes(x[props.optionValue as keyof T]),
|
|
574
|
+
) as Option[];
|
|
575
|
+
} else {
|
|
576
|
+
defaultValue.value = data.results?.filter(
|
|
577
|
+
(x) => x[props.optionValue as keyof T] === props.modelValue,
|
|
578
|
+
) as Option[];
|
|
579
|
+
}
|
|
574
580
|
} else if (Array.isArray(data)) {
|
|
575
581
|
defaultValue.value = data?.filter((x) => x[props.optionValue as keyof T] === props.modelValue);
|
|
576
582
|
}
|