@vc-shell/framework 1.0.187 → 1.0.189
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/core/plugins/moment/humanize.ts +6 -7
- package/dist/core/plugins/moment/humanize.d.ts.map +1 -1
- package/dist/framework.js +5907 -5885
- package/dist/index.css +1 -1
- package/dist/shared/modules/dynamic/components/fields/Button.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/ContentField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts +4 -1
- package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/GalleryField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/ImageField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/MultivalueField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/SelectField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/StatusField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/VideoField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/Button.stories.d.ts +417 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/Button.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/Card.stories.d.ts +357 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/Card.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/Checkbox.stories.d.ts +398 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/Checkbox.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/ContentField.stories.d.ts +392 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/ContentField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/EditorField.stories.d.ts +398 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/EditorField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.d.ts +372 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/GalleryField.stories.d.ts +391 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/GalleryField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/ImageField.stories.d.ts +372 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/ImageField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/InputCurrency.stories.d.ts +439 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/InputCurrency.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/InputField.stories.d.ts +448 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/InputField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/MultivalueField.stories.d.ts +459 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/MultivalueField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/RatingField.stories.d.ts +359 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/RatingField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/SelectField.stories.d.ts +507 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/SelectField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/StatusField.stories.d.ts +392 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/StatusField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/SwitchField.stories.d.ts +14 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/SwitchField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/TextareaField.stories.d.ts +395 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/TextareaField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/VideoField.stories.d.ts +322 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/VideoField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/common/args.d.ts +113 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/common/args.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/common/templates.d.ts +3 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/common/templates.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.d.ts +235 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceHighlighter.d.ts +4 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceHighlighter.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceTransform.d.ts +3 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceTransform.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/factories/base/useDetailsFactory.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/getters.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/types/index.d.ts +73 -38
- package/dist/shared/modules/dynamic/types/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/types/models.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/components/atoms/vc-card/vc-card.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-switch/index.d.ts +1 -39
- package/dist/ui/components/atoms/vc-switch/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-switch/vc-switch.stories.d.ts +30 -11
- package/dist/ui/components/atoms/vc-switch/vc-switch.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-switch/vc-switch.vue.d.ts +22 -3
- package/dist/ui/components/atoms/vc-switch/vc-switch.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-video/index.d.ts +1 -35
- package/dist/ui/components/atoms/vc-video/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-video/vc-video.stories.d.ts +5 -27
- package/dist/ui/components/atoms/vc-video/vc-video.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-video/vc-video.vue.d.ts +3 -18
- package/dist/ui/components/atoms/vc-video/vc-video.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.stories.d.ts +252 -42
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.stories.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts +36 -6
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-select/vc-select.stories.d.ts +96 -32
- 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 +3 -3
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-textarea/vc-textarea.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
- package/package.json +4 -4
- package/shared/modules/dynamic/components/fields/Button.ts +5 -2
- package/shared/modules/dynamic/components/fields/Card.ts +4 -4
- package/shared/modules/dynamic/components/fields/ContentField.ts +1 -0
- package/shared/modules/dynamic/components/fields/DynamicProperty.ts +5 -6
- package/shared/modules/dynamic/components/fields/EditorField.ts +4 -3
- package/shared/modules/dynamic/components/fields/Fieldset.ts +1 -1
- package/shared/modules/dynamic/components/fields/GalleryField.ts +6 -3
- package/shared/modules/dynamic/components/fields/ImageField.ts +0 -1
- package/shared/modules/dynamic/components/fields/InputCurrency.ts +1 -1
- package/shared/modules/dynamic/components/fields/MultivalueField.ts +3 -2
- package/shared/modules/dynamic/components/fields/SelectField.ts +1 -0
- package/shared/modules/dynamic/components/fields/StatusField.ts +20 -10
- package/shared/modules/dynamic/components/fields/VideoField.ts +0 -1
- package/shared/modules/dynamic/components/fields/storybook/Button.stories.ts +247 -0
- package/shared/modules/dynamic/components/fields/storybook/Card.stories.ts +167 -0
- package/shared/modules/dynamic/components/fields/storybook/Checkbox.stories.ts +186 -0
- package/shared/modules/dynamic/components/fields/storybook/ContentField.stories.ts +246 -0
- package/shared/modules/dynamic/components/fields/storybook/EditorField.stories.ts +185 -0
- package/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.ts +409 -0
- package/shared/modules/dynamic/components/fields/storybook/GalleryField.stories.ts +239 -0
- package/shared/modules/dynamic/components/fields/storybook/ImageField.stories.ts +186 -0
- package/shared/modules/dynamic/components/fields/storybook/InputCurrency.stories.ts +267 -0
- package/shared/modules/dynamic/components/fields/storybook/InputField.stories.ts +286 -0
- package/shared/modules/dynamic/components/fields/storybook/MultivalueField.stories.ts +347 -0
- package/shared/modules/dynamic/components/fields/storybook/RatingField.stories.ts +131 -0
- package/shared/modules/dynamic/components/fields/storybook/SelectField.stories.ts +653 -0
- package/shared/modules/dynamic/components/fields/storybook/StatusField.stories.ts +202 -0
- package/shared/modules/dynamic/components/fields/storybook/SwitchField.stories.ts +178 -0
- package/shared/modules/dynamic/components/fields/storybook/TextareaField.stories.ts +191 -0
- package/shared/modules/dynamic/components/fields/storybook/VideoField.stories.ts +92 -0
- package/shared/modules/dynamic/components/fields/storybook/common/args.ts +130 -0
- package/shared/modules/dynamic/components/fields/storybook/common/templates.ts +8 -0
- package/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.ts +54 -0
- package/shared/modules/dynamic/components/fields/storybook/utils/sourceHighlighter.ts +16 -0
- package/shared/modules/dynamic/components/fields/storybook/utils/sourceTransform.ts +41 -0
- package/shared/modules/dynamic/factories/base/useDetailsFactory.ts +4 -2
- package/shared/modules/dynamic/helpers/getters.ts +3 -0
- package/shared/modules/dynamic/helpers/nodeBuilder.ts +1 -1
- package/shared/modules/dynamic/helpers/setters.ts +1 -1
- package/shared/modules/dynamic/types/index.ts +78 -40
- package/shared/modules/dynamic/types/models.ts +8 -7
- package/ui/components/atoms/vc-card/vc-card.vue +12 -2
- package/ui/components/atoms/vc-switch/index.ts +1 -3
- package/ui/components/atoms/vc-switch/vc-switch.vue +10 -3
- package/ui/components/atoms/vc-video/index.ts +1 -3
- package/ui/components/atoms/vc-video/vc-video.stories.ts +1 -15
- package/ui/components/atoms/vc-video/vc-video.vue +4 -37
- package/ui/components/molecules/vc-editor/vc-editor.vue +28 -9
- package/ui/components/molecules/vc-field/_internal/vc-field-type/vc-field-type.vue +2 -2
- package/ui/components/molecules/vc-input-currency/vc-input-currency.vue +8 -0
- package/ui/components/molecules/vc-multivalue/vc-multivalue.vue +21 -9
- package/ui/components/molecules/vc-select/vc-select.stories.ts +74 -3
- package/ui/components/molecules/vc-select/vc-select.vue +35 -38
- package/ui/components/molecules/vc-textarea/vc-textarea.vue +1 -9
- package/ui/components/organisms/vc-table/vc-table.vue +1 -0
|
@@ -0,0 +1,653 @@
|
|
|
1
|
+
import { StoryFn, Meta, setup } from "@storybook/vue3";
|
|
2
|
+
import { SchemaBaseArgTypes } from "./common/args";
|
|
3
|
+
import page from "./pages/DynamicRender";
|
|
4
|
+
import { SelectSchema } from "../../..";
|
|
5
|
+
import { reactive, ref } from "vue";
|
|
6
|
+
import { template, templateWithVisibilityToggle } from "./common/templates";
|
|
7
|
+
import { VcIcon } from "../../../../../../ui/components/atoms/vc-icon";
|
|
8
|
+
|
|
9
|
+
const customTemplateComponent = {
|
|
10
|
+
props: ["context", "slotName"],
|
|
11
|
+
template: `
|
|
12
|
+
<template v-if="slotName === 'option'">
|
|
13
|
+
<div class="tw-flex tw-flex-col">
|
|
14
|
+
<h2>ID - {{context.opt.id}}</h2>
|
|
15
|
+
<p>Title - {{context.opt.title}}</p>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
<template v-else-if="slotName === 'selected-item'">
|
|
19
|
+
<div class="tw-flex tw-flex-row tw-gap-3 tw-items-center">
|
|
20
|
+
<VcIcon icon="fas fa-check" class="tw-text-green-500" />
|
|
21
|
+
{{context.opt.title}}
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
`,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
setup((app) => {
|
|
28
|
+
app.component("CustomSelect", customTemplateComponent);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
title: "DynamicViews/molecules/VcSelect",
|
|
33
|
+
component: page,
|
|
34
|
+
args: {
|
|
35
|
+
id: "selectFieldId",
|
|
36
|
+
component: "vc-select",
|
|
37
|
+
property: "mockedProperty",
|
|
38
|
+
optionsMethod: "mockedOptionsArray",
|
|
39
|
+
},
|
|
40
|
+
argTypes: {
|
|
41
|
+
...SchemaBaseArgTypes,
|
|
42
|
+
component: {
|
|
43
|
+
description: "Component type for select.",
|
|
44
|
+
type: {
|
|
45
|
+
required: true,
|
|
46
|
+
name: "string",
|
|
47
|
+
},
|
|
48
|
+
table: {
|
|
49
|
+
type: {
|
|
50
|
+
summary: "vc-select",
|
|
51
|
+
},
|
|
52
|
+
defaultValue: {
|
|
53
|
+
summary: "vc-select",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
optionValue: {
|
|
58
|
+
description: "Property which holds the `value`",
|
|
59
|
+
type: {
|
|
60
|
+
required: true,
|
|
61
|
+
name: "string",
|
|
62
|
+
},
|
|
63
|
+
control: "text",
|
|
64
|
+
table: {
|
|
65
|
+
type: {
|
|
66
|
+
summary: "string",
|
|
67
|
+
},
|
|
68
|
+
defaultValue: {
|
|
69
|
+
summary: "id",
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
optionLabel: {
|
|
74
|
+
description: "Property which holds the `label`",
|
|
75
|
+
type: {
|
|
76
|
+
required: true,
|
|
77
|
+
name: "string",
|
|
78
|
+
},
|
|
79
|
+
control: "text",
|
|
80
|
+
table: {
|
|
81
|
+
type: {
|
|
82
|
+
summary: "string",
|
|
83
|
+
},
|
|
84
|
+
defaultValue: {
|
|
85
|
+
summary: "title",
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
optionsMethod: {
|
|
90
|
+
description: `Method that is used to get select options.
|
|
91
|
+
Method should be defined in the blade \`scope\` and could be:
|
|
92
|
+
\n1) async method with the following arguments: (\`keyword: string\`, \`skip\`, \`ids?: string[]\`).
|
|
93
|
+
\n2) any array
|
|
94
|
+
\n3) composable returning array`,
|
|
95
|
+
type: {
|
|
96
|
+
required: true,
|
|
97
|
+
name: "string",
|
|
98
|
+
},
|
|
99
|
+
table: {
|
|
100
|
+
type: {
|
|
101
|
+
summary: "string",
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
customTemplate: {
|
|
106
|
+
description: `Name of custom template to display data in select.
|
|
107
|
+
Component should be registered globally.
|
|
108
|
+
Supported slots:
|
|
109
|
+
\n1) \`selected-item\` - selected item
|
|
110
|
+
\n2) \`option\` - options in dropdown list
|
|
111
|
+
|
|
112
|
+
\nComponent should have the following props:
|
|
113
|
+
\n1) \`context\` - object with the following properties:
|
|
114
|
+
\n- \`index\` - index of the selected option
|
|
115
|
+
\n- \`opt\` - option object
|
|
116
|
+
\n- \`selected\` - boolean value indicating if the option is selected
|
|
117
|
+
\n- \`toggleOption\` - function to toggle the option
|
|
118
|
+
\n- \`removeAtIndex\` - function to remove the option at the index
|
|
119
|
+
\n2) \`slotName\` - name of the slot to render`,
|
|
120
|
+
table: {
|
|
121
|
+
type: {
|
|
122
|
+
summary: "{ component: string }",
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
clearable: {
|
|
127
|
+
description: "Whether the select is clearable or not.",
|
|
128
|
+
control: "boolean",
|
|
129
|
+
table: {
|
|
130
|
+
type: {
|
|
131
|
+
summary: "boolean",
|
|
132
|
+
},
|
|
133
|
+
defaultValue: {
|
|
134
|
+
summary: false,
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
emitValue: {
|
|
139
|
+
description: `Update model with the value of the selected option instead of the whole option.
|
|
140
|
+
\n Example:
|
|
141
|
+
\nIf emitValue is \`true\` and the selected option is { id: 1, title: "Option 1" }, the model will be updated with 1.
|
|
142
|
+
\nIf emitValue is \`false\`, the model will be updated with the whole option.`,
|
|
143
|
+
table: {
|
|
144
|
+
type: {
|
|
145
|
+
summary: "boolean",
|
|
146
|
+
},
|
|
147
|
+
defaultValue: {
|
|
148
|
+
summary: "true",
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
searchable: {
|
|
153
|
+
description: "Whether the select is searchable or not.",
|
|
154
|
+
table: {
|
|
155
|
+
type: {
|
|
156
|
+
summary: "boolean",
|
|
157
|
+
},
|
|
158
|
+
defaultValue: {
|
|
159
|
+
summary: false,
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
multiple: {
|
|
164
|
+
description: "Select multiple values.",
|
|
165
|
+
table: {
|
|
166
|
+
type: {
|
|
167
|
+
summary: "boolean",
|
|
168
|
+
},
|
|
169
|
+
defaultValue: {
|
|
170
|
+
summary: false,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
mapOptions: {
|
|
175
|
+
description:
|
|
176
|
+
"Try to 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.",
|
|
177
|
+
table: {
|
|
178
|
+
type: {
|
|
179
|
+
summary: "boolean",
|
|
180
|
+
},
|
|
181
|
+
defaultValue: {
|
|
182
|
+
summary: true,
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
parameters: {
|
|
188
|
+
docs: {
|
|
189
|
+
canvas: {
|
|
190
|
+
sourceState: "none",
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
} satisfies Meta<SelectSchema>;
|
|
195
|
+
|
|
196
|
+
export const Template: StoryFn<SelectSchema> = (args) => ({
|
|
197
|
+
components: { page },
|
|
198
|
+
setup() {
|
|
199
|
+
const context = reactive({
|
|
200
|
+
item: {
|
|
201
|
+
mockedProperty: 1,
|
|
202
|
+
},
|
|
203
|
+
scope: {
|
|
204
|
+
mockedOptionsArray: [
|
|
205
|
+
{ id: 1, title: "Option 1" },
|
|
206
|
+
{ id: 2, title: "Option 2" },
|
|
207
|
+
{ id: 3, title: "Option 3" },
|
|
208
|
+
{ id: 4, title: "Option 4" },
|
|
209
|
+
],
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
return { args, context };
|
|
213
|
+
},
|
|
214
|
+
template,
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
export const WithLabel = Template.bind({});
|
|
218
|
+
WithLabel.args = {
|
|
219
|
+
label: "Select label",
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export const WithTooltip = WithLabel.bind({});
|
|
223
|
+
WithTooltip.args = {
|
|
224
|
+
label: "Select label",
|
|
225
|
+
tooltip: "Select tooltip",
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
export const WithPlaceholder: StoryFn<SelectSchema> = (args) => ({
|
|
229
|
+
components: { page },
|
|
230
|
+
setup() {
|
|
231
|
+
const context = reactive({
|
|
232
|
+
item: {
|
|
233
|
+
mockedProperty: null,
|
|
234
|
+
},
|
|
235
|
+
scope: {
|
|
236
|
+
mockedOptionsArray: [
|
|
237
|
+
{ id: 1, title: "Option 1" },
|
|
238
|
+
{ id: 2, title: "Option 2" },
|
|
239
|
+
{ id: 3, title: "Option 3" },
|
|
240
|
+
{ id: 4, title: "Option 4" },
|
|
241
|
+
],
|
|
242
|
+
},
|
|
243
|
+
});
|
|
244
|
+
return { args, context };
|
|
245
|
+
},
|
|
246
|
+
template,
|
|
247
|
+
});
|
|
248
|
+
WithPlaceholder.args = {
|
|
249
|
+
label: "Select label",
|
|
250
|
+
placeholder: "Select item from dropdown",
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
export const WithValidation = Template.bind({});
|
|
254
|
+
WithValidation.args = {
|
|
255
|
+
label: "Select label",
|
|
256
|
+
rules: { required: true },
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
export const WithAsyncOptions: StoryFn<SelectSchema> = (args) => ({
|
|
260
|
+
components: { page },
|
|
261
|
+
setup() {
|
|
262
|
+
const context = reactive({
|
|
263
|
+
item: {
|
|
264
|
+
mockedProperty: null,
|
|
265
|
+
},
|
|
266
|
+
scope: {
|
|
267
|
+
mockedOptionsArray: async (keyword?: string, skip = 0, ids?: string[]) =>
|
|
268
|
+
new Promise((resolve) => {
|
|
269
|
+
setTimeout(() => {
|
|
270
|
+
resolve({
|
|
271
|
+
results: [
|
|
272
|
+
{ title: "Option 1", label: "Option 1" },
|
|
273
|
+
{ title: "Option 2", label: "Option 2" },
|
|
274
|
+
{ title: "Option 3", label: "Option 3" },
|
|
275
|
+
],
|
|
276
|
+
totalCount: 3,
|
|
277
|
+
});
|
|
278
|
+
}, 1000);
|
|
279
|
+
}),
|
|
280
|
+
},
|
|
281
|
+
});
|
|
282
|
+
return { args, context };
|
|
283
|
+
},
|
|
284
|
+
template,
|
|
285
|
+
});
|
|
286
|
+
WithAsyncOptions.args = {
|
|
287
|
+
label: "Select label",
|
|
288
|
+
optionLabel: "label",
|
|
289
|
+
optionValue: "title",
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
export const WithObjectArrayOptions: StoryFn<SelectSchema> = (args) => ({
|
|
293
|
+
components: { page },
|
|
294
|
+
setup() {
|
|
295
|
+
const context = reactive({
|
|
296
|
+
item: {
|
|
297
|
+
mockedProperty: null,
|
|
298
|
+
},
|
|
299
|
+
scope: {
|
|
300
|
+
mockedOptionsArray: [
|
|
301
|
+
{ id: 1, title: "Option 1" },
|
|
302
|
+
{ id: 2, title: "Option 2" },
|
|
303
|
+
{ id: 3, title: "Option 3" },
|
|
304
|
+
{ id: 4, title: "Option 4" },
|
|
305
|
+
],
|
|
306
|
+
},
|
|
307
|
+
});
|
|
308
|
+
return { args, context };
|
|
309
|
+
},
|
|
310
|
+
template,
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
export const WithStringArrayOptions: StoryFn<SelectSchema> = (args) => ({
|
|
314
|
+
components: { page },
|
|
315
|
+
setup() {
|
|
316
|
+
const context = reactive({
|
|
317
|
+
item: {
|
|
318
|
+
mockedProperty: null,
|
|
319
|
+
},
|
|
320
|
+
scope: {
|
|
321
|
+
mockedOptionsArray: ["Option 1", "Option 2", "Option 3", "Option 4"],
|
|
322
|
+
},
|
|
323
|
+
});
|
|
324
|
+
return { args, context };
|
|
325
|
+
},
|
|
326
|
+
template,
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
export const EmitValueTrueProp: StoryFn<SelectSchema> = (args) => ({
|
|
330
|
+
components: { page },
|
|
331
|
+
setup() {
|
|
332
|
+
const context = reactive({
|
|
333
|
+
item: {
|
|
334
|
+
mockedProperty: 1,
|
|
335
|
+
},
|
|
336
|
+
scope: {
|
|
337
|
+
mockedOptionsArray: [
|
|
338
|
+
{ id: 1, title: "Option 1" },
|
|
339
|
+
{ id: 2, title: "Option 2" },
|
|
340
|
+
{ id: 3, title: "Option 3" },
|
|
341
|
+
{ id: 4, title: "Option 4" },
|
|
342
|
+
],
|
|
343
|
+
},
|
|
344
|
+
});
|
|
345
|
+
return { args, context };
|
|
346
|
+
},
|
|
347
|
+
template,
|
|
348
|
+
});
|
|
349
|
+
EmitValueTrueProp.parameters = {
|
|
350
|
+
docs: {
|
|
351
|
+
description: {
|
|
352
|
+
story: "The default emitValue === <b>true</b> returns the value of key defined in optionValue",
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
export const EmitValueFalseProp: StoryFn<SelectSchema> = (args) => ({
|
|
358
|
+
components: { page },
|
|
359
|
+
setup() {
|
|
360
|
+
const context = reactive({
|
|
361
|
+
item: {
|
|
362
|
+
mockedProperty: { id: 1, title: "Option 1" },
|
|
363
|
+
},
|
|
364
|
+
scope: {
|
|
365
|
+
mockedOptionsArray: [
|
|
366
|
+
{ id: 1, title: "Option 1" },
|
|
367
|
+
{ id: 2, title: "Option 2" },
|
|
368
|
+
{ id: 3, title: "Option 3" },
|
|
369
|
+
{ id: 4, title: "Option 4" },
|
|
370
|
+
],
|
|
371
|
+
},
|
|
372
|
+
});
|
|
373
|
+
return { args, context };
|
|
374
|
+
},
|
|
375
|
+
template,
|
|
376
|
+
});
|
|
377
|
+
EmitValueFalseProp.args = {
|
|
378
|
+
emitValue: false,
|
|
379
|
+
};
|
|
380
|
+
EmitValueFalseProp.parameters = {
|
|
381
|
+
docs: {
|
|
382
|
+
description: {
|
|
383
|
+
story: "emitValue === <b>false</b> returns the complete object as the result",
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
export const MapOptionsTrueProp: StoryFn<SelectSchema> = (args) => ({
|
|
389
|
+
components: { page },
|
|
390
|
+
setup() {
|
|
391
|
+
const context = reactive({
|
|
392
|
+
item: {
|
|
393
|
+
mockedProperty: 1,
|
|
394
|
+
},
|
|
395
|
+
scope: {
|
|
396
|
+
mockedOptionsArray: [
|
|
397
|
+
{ value: 1, label: "Option 1" },
|
|
398
|
+
{ value: 2, label: "Option 2" },
|
|
399
|
+
{ value: 3, label: "Option 3" },
|
|
400
|
+
{ value: 4, label: "Option 4" },
|
|
401
|
+
],
|
|
402
|
+
},
|
|
403
|
+
});
|
|
404
|
+
return { args, context };
|
|
405
|
+
},
|
|
406
|
+
template,
|
|
407
|
+
});
|
|
408
|
+
MapOptionsTrueProp.parameters = {
|
|
409
|
+
docs: {
|
|
410
|
+
description: {
|
|
411
|
+
story:
|
|
412
|
+
"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.",
|
|
413
|
+
},
|
|
414
|
+
},
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
export const MapOptionsFalseProp: StoryFn<SelectSchema> = (args) => ({
|
|
418
|
+
components: { page },
|
|
419
|
+
setup() {
|
|
420
|
+
const context = reactive({
|
|
421
|
+
item: {
|
|
422
|
+
mockedProperty: 1,
|
|
423
|
+
},
|
|
424
|
+
scope: {
|
|
425
|
+
mockedOptionsArray: [
|
|
426
|
+
{ value: 1, label: "Option 1" },
|
|
427
|
+
{ value: 2, label: "Option 2" },
|
|
428
|
+
{ value: 3, label: "Option 3" },
|
|
429
|
+
{ value: 4, label: "Option 4" },
|
|
430
|
+
],
|
|
431
|
+
},
|
|
432
|
+
});
|
|
433
|
+
return { args, context };
|
|
434
|
+
},
|
|
435
|
+
template,
|
|
436
|
+
});
|
|
437
|
+
MapOptionsFalseProp.args = {
|
|
438
|
+
mapOptions: false,
|
|
439
|
+
};
|
|
440
|
+
MapOptionsFalseProp.parameters = {
|
|
441
|
+
docs: {
|
|
442
|
+
description: {
|
|
443
|
+
story: "mapOptions === <b>false</b> will not map labels of model from 'options' Array",
|
|
444
|
+
},
|
|
445
|
+
},
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
export const Multiple: StoryFn<SelectSchema> = (args) => ({
|
|
449
|
+
components: { page },
|
|
450
|
+
setup() {
|
|
451
|
+
const context = reactive({
|
|
452
|
+
item: {
|
|
453
|
+
mockedProperty: ["Option 1", "Option 2"],
|
|
454
|
+
},
|
|
455
|
+
scope: {
|
|
456
|
+
mockedOptionsArray: [
|
|
457
|
+
{ id: 1, title: "Option 1" },
|
|
458
|
+
{ id: 2, title: "Option 2" },
|
|
459
|
+
{ id: 3, title: "Option 3" },
|
|
460
|
+
{ id: 4, title: "Option 4" },
|
|
461
|
+
],
|
|
462
|
+
},
|
|
463
|
+
});
|
|
464
|
+
return { args, context };
|
|
465
|
+
},
|
|
466
|
+
template,
|
|
467
|
+
});
|
|
468
|
+
Multiple.args = {
|
|
469
|
+
multiple: true,
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
export const Searchable: StoryFn<SelectSchema> = (args) => ({
|
|
473
|
+
components: { page },
|
|
474
|
+
setup() {
|
|
475
|
+
const context = reactive({
|
|
476
|
+
item: {
|
|
477
|
+
mockedProperty: null,
|
|
478
|
+
},
|
|
479
|
+
scope: {
|
|
480
|
+
mockedOptionsArray: [
|
|
481
|
+
{ id: 1, title: "Option 1" },
|
|
482
|
+
{ id: 2, title: "Option 2" },
|
|
483
|
+
{ id: 3, title: "Option 3" },
|
|
484
|
+
{ id: 4, title: "Option 4" },
|
|
485
|
+
],
|
|
486
|
+
},
|
|
487
|
+
});
|
|
488
|
+
return { args, context };
|
|
489
|
+
},
|
|
490
|
+
template,
|
|
491
|
+
});
|
|
492
|
+
Searchable.args = {
|
|
493
|
+
searchable: true,
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
export const WithDisabled: StoryFn<SelectSchema> = (args) => ({
|
|
497
|
+
components: { page },
|
|
498
|
+
setup() {
|
|
499
|
+
const context = reactive({
|
|
500
|
+
item: {
|
|
501
|
+
mockedProperty: 1,
|
|
502
|
+
},
|
|
503
|
+
scope: {
|
|
504
|
+
mockedOptionsArray: [
|
|
505
|
+
{ id: 1, title: "Option 1" },
|
|
506
|
+
{ id: 2, title: "Option 2" },
|
|
507
|
+
{ id: 3, title: "Option 3" },
|
|
508
|
+
{ id: 4, title: "Option 4" },
|
|
509
|
+
],
|
|
510
|
+
disabledFn: true,
|
|
511
|
+
},
|
|
512
|
+
});
|
|
513
|
+
return { args, context };
|
|
514
|
+
},
|
|
515
|
+
template,
|
|
516
|
+
});
|
|
517
|
+
WithDisabled.args = {
|
|
518
|
+
disabled: {
|
|
519
|
+
method: "disabledFn",
|
|
520
|
+
},
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
export const WithClearable = Template.bind({});
|
|
524
|
+
WithClearable.args = {
|
|
525
|
+
label: "Select label",
|
|
526
|
+
clearable: true,
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
export const WithVisibilityMethod: StoryFn<SelectSchema> = (args) => ({
|
|
530
|
+
components: { page },
|
|
531
|
+
setup() {
|
|
532
|
+
const isVisible = ref(false);
|
|
533
|
+
const toggle = () => {
|
|
534
|
+
isVisible.value = !isVisible.value;
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
const context = reactive({
|
|
538
|
+
item: {
|
|
539
|
+
mockedProperty: 1,
|
|
540
|
+
},
|
|
541
|
+
scope: {
|
|
542
|
+
mockedOptionsArray: [
|
|
543
|
+
{ id: 1, title: "Option 1" },
|
|
544
|
+
{ id: 2, title: "Option 2" },
|
|
545
|
+
{ id: 3, title: "Option 3" },
|
|
546
|
+
{ id: 4, title: "Option 4" },
|
|
547
|
+
],
|
|
548
|
+
visibilityFn: isVisible,
|
|
549
|
+
},
|
|
550
|
+
});
|
|
551
|
+
return { args, context, toggle };
|
|
552
|
+
},
|
|
553
|
+
template: templateWithVisibilityToggle,
|
|
554
|
+
});
|
|
555
|
+
WithVisibilityMethod.args = {
|
|
556
|
+
visibility: {
|
|
557
|
+
method: "visibilityFn",
|
|
558
|
+
},
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
export const WithUpdateMethod: StoryFn<SelectSchema> = (args) => ({
|
|
562
|
+
components: { page },
|
|
563
|
+
setup() {
|
|
564
|
+
const context = reactive({
|
|
565
|
+
item: {
|
|
566
|
+
mockedProperty: 1,
|
|
567
|
+
},
|
|
568
|
+
scope: {
|
|
569
|
+
mockedOptionsArray: [
|
|
570
|
+
{ id: 1, title: "Option 1" },
|
|
571
|
+
{ id: 2, title: "Option 2" },
|
|
572
|
+
{ id: 3, title: "Option 3" },
|
|
573
|
+
{ id: 4, title: "Option 4" },
|
|
574
|
+
],
|
|
575
|
+
updateFn: (value: string) => alert(`Value updated to: ${value}`),
|
|
576
|
+
},
|
|
577
|
+
});
|
|
578
|
+
|
|
579
|
+
return { args, context };
|
|
580
|
+
},
|
|
581
|
+
template,
|
|
582
|
+
});
|
|
583
|
+
WithUpdateMethod.args = {
|
|
584
|
+
update: {
|
|
585
|
+
method: "updateFn",
|
|
586
|
+
},
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
export const WithHorizontalSeparator = Template.bind({});
|
|
590
|
+
|
|
591
|
+
WithHorizontalSeparator.args = {
|
|
592
|
+
label: "Select label",
|
|
593
|
+
horizontalSeparator: true,
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
export const CustomTemplate: StoryFn<SelectSchema> = (args) => ({
|
|
597
|
+
components: { page },
|
|
598
|
+
setup() {
|
|
599
|
+
const context = reactive({
|
|
600
|
+
item: {
|
|
601
|
+
mockedProperty: 1,
|
|
602
|
+
},
|
|
603
|
+
scope: {
|
|
604
|
+
mockedOptionsArray: [
|
|
605
|
+
{ id: 1, title: "Option 1" },
|
|
606
|
+
{ id: 2, title: "Option 2" },
|
|
607
|
+
{ id: 3, title: "Option 3" },
|
|
608
|
+
{ id: 4, title: "Option 4" },
|
|
609
|
+
],
|
|
610
|
+
},
|
|
611
|
+
});
|
|
612
|
+
return { args, context };
|
|
613
|
+
},
|
|
614
|
+
template,
|
|
615
|
+
});
|
|
616
|
+
|
|
617
|
+
CustomTemplate.storyName = "Custom template for dropdown item and selected item";
|
|
618
|
+
CustomTemplate.args = {
|
|
619
|
+
label: "Select label",
|
|
620
|
+
customTemplate: {
|
|
621
|
+
component: "custom-select",
|
|
622
|
+
},
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
export const CustomTemplateWithMultiple: StoryFn<SelectSchema> = (args) => ({
|
|
626
|
+
components: { page, VcIcon },
|
|
627
|
+
setup() {
|
|
628
|
+
const context = reactive({
|
|
629
|
+
item: {
|
|
630
|
+
mockedProperty: [1, 2],
|
|
631
|
+
},
|
|
632
|
+
scope: {
|
|
633
|
+
mockedOptionsArray: [
|
|
634
|
+
{ id: 1, title: "Option 1" },
|
|
635
|
+
{ id: 2, title: "Option 2" },
|
|
636
|
+
{ id: 3, title: "Option 3" },
|
|
637
|
+
{ id: 4, title: "Option 4" },
|
|
638
|
+
],
|
|
639
|
+
},
|
|
640
|
+
});
|
|
641
|
+
return { args, context };
|
|
642
|
+
},
|
|
643
|
+
template,
|
|
644
|
+
});
|
|
645
|
+
|
|
646
|
+
CustomTemplateWithMultiple.storyName = "Custom template for dropdown item and selected item with multiple values";
|
|
647
|
+
CustomTemplateWithMultiple.args = {
|
|
648
|
+
label: "Select label",
|
|
649
|
+
multiple: true,
|
|
650
|
+
customTemplate: {
|
|
651
|
+
component: "custom-select",
|
|
652
|
+
},
|
|
653
|
+
};
|