@vc-shell/framework 1.0.188 → 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.
Files changed (147) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/core/plugins/moment/humanize.ts +6 -7
  3. package/dist/core/plugins/moment/humanize.d.ts.map +1 -1
  4. package/dist/framework.js +5719 -5699
  5. package/dist/index.css +1 -1
  6. package/dist/shared/modules/dynamic/components/fields/Button.d.ts.map +1 -1
  7. package/dist/shared/modules/dynamic/components/fields/ContentField.d.ts.map +1 -1
  8. package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts.map +1 -1
  9. package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts +4 -1
  10. package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts.map +1 -1
  11. package/dist/shared/modules/dynamic/components/fields/GalleryField.d.ts.map +1 -1
  12. package/dist/shared/modules/dynamic/components/fields/ImageField.d.ts.map +1 -1
  13. package/dist/shared/modules/dynamic/components/fields/MultivalueField.d.ts.map +1 -1
  14. package/dist/shared/modules/dynamic/components/fields/SelectField.d.ts.map +1 -1
  15. package/dist/shared/modules/dynamic/components/fields/StatusField.d.ts.map +1 -1
  16. package/dist/shared/modules/dynamic/components/fields/VideoField.d.ts.map +1 -1
  17. package/dist/shared/modules/dynamic/components/fields/storybook/Button.stories.d.ts +417 -0
  18. package/dist/shared/modules/dynamic/components/fields/storybook/Button.stories.d.ts.map +1 -0
  19. package/dist/shared/modules/dynamic/components/fields/storybook/Card.stories.d.ts +357 -0
  20. package/dist/shared/modules/dynamic/components/fields/storybook/Card.stories.d.ts.map +1 -0
  21. package/dist/shared/modules/dynamic/components/fields/storybook/Checkbox.stories.d.ts +398 -0
  22. package/dist/shared/modules/dynamic/components/fields/storybook/Checkbox.stories.d.ts.map +1 -0
  23. package/dist/shared/modules/dynamic/components/fields/storybook/ContentField.stories.d.ts +392 -0
  24. package/dist/shared/modules/dynamic/components/fields/storybook/ContentField.stories.d.ts.map +1 -0
  25. package/dist/shared/modules/dynamic/components/fields/storybook/EditorField.stories.d.ts +398 -0
  26. package/dist/shared/modules/dynamic/components/fields/storybook/EditorField.stories.d.ts.map +1 -0
  27. package/dist/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.d.ts +372 -0
  28. package/dist/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.d.ts.map +1 -0
  29. package/dist/shared/modules/dynamic/components/fields/storybook/GalleryField.stories.d.ts +391 -0
  30. package/dist/shared/modules/dynamic/components/fields/storybook/GalleryField.stories.d.ts.map +1 -0
  31. package/dist/shared/modules/dynamic/components/fields/storybook/ImageField.stories.d.ts +372 -0
  32. package/dist/shared/modules/dynamic/components/fields/storybook/ImageField.stories.d.ts.map +1 -0
  33. package/dist/shared/modules/dynamic/components/fields/storybook/InputCurrency.stories.d.ts +439 -0
  34. package/dist/shared/modules/dynamic/components/fields/storybook/InputCurrency.stories.d.ts.map +1 -0
  35. package/dist/shared/modules/dynamic/components/fields/storybook/InputField.stories.d.ts +448 -0
  36. package/dist/shared/modules/dynamic/components/fields/storybook/InputField.stories.d.ts.map +1 -0
  37. package/dist/shared/modules/dynamic/components/fields/storybook/MultivalueField.stories.d.ts +459 -0
  38. package/dist/shared/modules/dynamic/components/fields/storybook/MultivalueField.stories.d.ts.map +1 -0
  39. package/dist/shared/modules/dynamic/components/fields/storybook/RatingField.stories.d.ts +359 -0
  40. package/dist/shared/modules/dynamic/components/fields/storybook/RatingField.stories.d.ts.map +1 -0
  41. package/dist/shared/modules/dynamic/components/fields/storybook/SelectField.stories.d.ts +507 -0
  42. package/dist/shared/modules/dynamic/components/fields/storybook/SelectField.stories.d.ts.map +1 -0
  43. package/dist/shared/modules/dynamic/components/fields/storybook/StatusField.stories.d.ts +392 -0
  44. package/dist/shared/modules/dynamic/components/fields/storybook/StatusField.stories.d.ts.map +1 -0
  45. package/dist/shared/modules/dynamic/components/fields/storybook/SwitchField.stories.d.ts +14 -0
  46. package/dist/shared/modules/dynamic/components/fields/storybook/SwitchField.stories.d.ts.map +1 -0
  47. package/dist/shared/modules/dynamic/components/fields/storybook/TextareaField.stories.d.ts +395 -0
  48. package/dist/shared/modules/dynamic/components/fields/storybook/TextareaField.stories.d.ts.map +1 -0
  49. package/dist/shared/modules/dynamic/components/fields/storybook/VideoField.stories.d.ts +322 -0
  50. package/dist/shared/modules/dynamic/components/fields/storybook/VideoField.stories.d.ts.map +1 -0
  51. package/dist/shared/modules/dynamic/components/fields/storybook/common/args.d.ts +113 -0
  52. package/dist/shared/modules/dynamic/components/fields/storybook/common/args.d.ts.map +1 -0
  53. package/dist/shared/modules/dynamic/components/fields/storybook/common/templates.d.ts +3 -0
  54. package/dist/shared/modules/dynamic/components/fields/storybook/common/templates.d.ts.map +1 -0
  55. package/dist/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.d.ts +235 -0
  56. package/dist/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.d.ts.map +1 -0
  57. package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceHighlighter.d.ts +4 -0
  58. package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceHighlighter.d.ts.map +1 -0
  59. package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceTransform.d.ts +3 -0
  60. package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceTransform.d.ts.map +1 -0
  61. package/dist/shared/modules/dynamic/factories/base/useDetailsFactory.d.ts.map +1 -1
  62. package/dist/shared/modules/dynamic/helpers/getters.d.ts.map +1 -1
  63. package/dist/shared/modules/dynamic/types/index.d.ts +73 -38
  64. package/dist/shared/modules/dynamic/types/index.d.ts.map +1 -1
  65. package/dist/shared/modules/dynamic/types/models.d.ts.map +1 -1
  66. package/dist/tsconfig.tsbuildinfo +1 -1
  67. package/dist/ui/components/atoms/vc-card/vc-card.vue.d.ts.map +1 -1
  68. package/dist/ui/components/atoms/vc-switch/index.d.ts +1 -39
  69. package/dist/ui/components/atoms/vc-switch/index.d.ts.map +1 -1
  70. package/dist/ui/components/atoms/vc-switch/vc-switch.stories.d.ts +30 -11
  71. package/dist/ui/components/atoms/vc-switch/vc-switch.stories.d.ts.map +1 -1
  72. package/dist/ui/components/atoms/vc-switch/vc-switch.vue.d.ts +22 -3
  73. package/dist/ui/components/atoms/vc-switch/vc-switch.vue.d.ts.map +1 -1
  74. package/dist/ui/components/atoms/vc-video/index.d.ts +1 -35
  75. package/dist/ui/components/atoms/vc-video/index.d.ts.map +1 -1
  76. package/dist/ui/components/atoms/vc-video/vc-video.stories.d.ts +5 -27
  77. package/dist/ui/components/atoms/vc-video/vc-video.stories.d.ts.map +1 -1
  78. package/dist/ui/components/atoms/vc-video/vc-video.vue.d.ts +3 -18
  79. package/dist/ui/components/atoms/vc-video/vc-video.vue.d.ts.map +1 -1
  80. package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts.map +1 -1
  81. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts.map +1 -1
  82. package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.stories.d.ts +252 -42
  83. package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.stories.d.ts.map +1 -1
  84. package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts +36 -6
  85. package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts.map +1 -1
  86. package/dist/ui/components/molecules/vc-select/vc-select.stories.d.ts +96 -32
  87. package/dist/ui/components/molecules/vc-select/vc-select.stories.d.ts.map +1 -1
  88. package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts +3 -3
  89. package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts.map +1 -1
  90. package/dist/ui/components/molecules/vc-textarea/vc-textarea.vue.d.ts.map +1 -1
  91. package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
  92. package/package.json +4 -4
  93. package/shared/modules/dynamic/components/fields/Button.ts +5 -2
  94. package/shared/modules/dynamic/components/fields/Card.ts +4 -4
  95. package/shared/modules/dynamic/components/fields/ContentField.ts +1 -0
  96. package/shared/modules/dynamic/components/fields/DynamicProperty.ts +5 -6
  97. package/shared/modules/dynamic/components/fields/EditorField.ts +4 -3
  98. package/shared/modules/dynamic/components/fields/Fieldset.ts +1 -1
  99. package/shared/modules/dynamic/components/fields/GalleryField.ts +6 -3
  100. package/shared/modules/dynamic/components/fields/ImageField.ts +0 -1
  101. package/shared/modules/dynamic/components/fields/InputCurrency.ts +1 -1
  102. package/shared/modules/dynamic/components/fields/MultivalueField.ts +3 -2
  103. package/shared/modules/dynamic/components/fields/SelectField.ts +1 -0
  104. package/shared/modules/dynamic/components/fields/StatusField.ts +20 -10
  105. package/shared/modules/dynamic/components/fields/VideoField.ts +0 -1
  106. package/shared/modules/dynamic/components/fields/storybook/Button.stories.ts +247 -0
  107. package/shared/modules/dynamic/components/fields/storybook/Card.stories.ts +167 -0
  108. package/shared/modules/dynamic/components/fields/storybook/Checkbox.stories.ts +186 -0
  109. package/shared/modules/dynamic/components/fields/storybook/ContentField.stories.ts +246 -0
  110. package/shared/modules/dynamic/components/fields/storybook/EditorField.stories.ts +185 -0
  111. package/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.ts +409 -0
  112. package/shared/modules/dynamic/components/fields/storybook/GalleryField.stories.ts +239 -0
  113. package/shared/modules/dynamic/components/fields/storybook/ImageField.stories.ts +186 -0
  114. package/shared/modules/dynamic/components/fields/storybook/InputCurrency.stories.ts +267 -0
  115. package/shared/modules/dynamic/components/fields/storybook/InputField.stories.ts +286 -0
  116. package/shared/modules/dynamic/components/fields/storybook/MultivalueField.stories.ts +347 -0
  117. package/shared/modules/dynamic/components/fields/storybook/RatingField.stories.ts +131 -0
  118. package/shared/modules/dynamic/components/fields/storybook/SelectField.stories.ts +653 -0
  119. package/shared/modules/dynamic/components/fields/storybook/StatusField.stories.ts +202 -0
  120. package/shared/modules/dynamic/components/fields/storybook/SwitchField.stories.ts +178 -0
  121. package/shared/modules/dynamic/components/fields/storybook/TextareaField.stories.ts +191 -0
  122. package/shared/modules/dynamic/components/fields/storybook/VideoField.stories.ts +92 -0
  123. package/shared/modules/dynamic/components/fields/storybook/common/args.ts +130 -0
  124. package/shared/modules/dynamic/components/fields/storybook/common/templates.ts +8 -0
  125. package/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.ts +54 -0
  126. package/shared/modules/dynamic/components/fields/storybook/utils/sourceHighlighter.ts +16 -0
  127. package/shared/modules/dynamic/components/fields/storybook/utils/sourceTransform.ts +41 -0
  128. package/shared/modules/dynamic/factories/base/useDetailsFactory.ts +1 -0
  129. package/shared/modules/dynamic/helpers/getters.ts +3 -0
  130. package/shared/modules/dynamic/helpers/nodeBuilder.ts +1 -1
  131. package/shared/modules/dynamic/helpers/setters.ts +1 -1
  132. package/shared/modules/dynamic/types/index.ts +78 -40
  133. package/shared/modules/dynamic/types/models.ts +8 -7
  134. package/ui/components/atoms/vc-card/vc-card.vue +12 -2
  135. package/ui/components/atoms/vc-switch/index.ts +1 -3
  136. package/ui/components/atoms/vc-switch/vc-switch.vue +10 -3
  137. package/ui/components/atoms/vc-video/index.ts +1 -3
  138. package/ui/components/atoms/vc-video/vc-video.stories.ts +1 -15
  139. package/ui/components/atoms/vc-video/vc-video.vue +4 -37
  140. package/ui/components/molecules/vc-editor/vc-editor.vue +28 -9
  141. package/ui/components/molecules/vc-field/_internal/vc-field-type/vc-field-type.vue +2 -2
  142. package/ui/components/molecules/vc-input-currency/vc-input-currency.vue +8 -0
  143. package/ui/components/molecules/vc-multivalue/vc-multivalue.vue +21 -9
  144. package/ui/components/molecules/vc-select/vc-select.stories.ts +74 -3
  145. package/ui/components/molecules/vc-select/vc-select.vue +35 -38
  146. package/ui/components/molecules/vc-textarea/vc-textarea.vue +1 -9
  147. package/ui/components/organisms/vc-table/vc-table.vue +1 -0
@@ -0,0 +1,286 @@
1
+ import { Meta, StoryFn } from "@storybook/vue3";
2
+ import { InputSchema } from "../../..";
3
+ import { SchemaBaseArgTypes } from "./common/args";
4
+ import page from "./pages/DynamicRender";
5
+ import { template, templateWithVisibilityToggle } from "./common/templates";
6
+ import { reactive, ref } from "vue";
7
+
8
+ export default {
9
+ title: "DynamicViews/molecules/VcInput",
10
+ component: page,
11
+ args: {
12
+ id: "inputFieldId",
13
+ component: "vc-input",
14
+ property: "mockedProperty",
15
+ variant: "text",
16
+ },
17
+ argTypes: {
18
+ ...SchemaBaseArgTypes,
19
+ component: {
20
+ description: "Component type.",
21
+ type: {
22
+ required: true,
23
+ name: "string",
24
+ },
25
+ table: {
26
+ type: {
27
+ summary: "vc-input",
28
+ },
29
+ defaultValue: {
30
+ summary: "vc-input",
31
+ },
32
+ },
33
+ },
34
+ variant: {
35
+ description: "Field variant.",
36
+ control: "radio",
37
+ options: ["number", "text", "password", "email", "tel", "url", "time", "date", "datetime-local"],
38
+ table: {
39
+ type: {
40
+ summary: "number | text | password | email | tel | url | time | date | datetime-local",
41
+ },
42
+ defaultValue: {
43
+ summary: "text",
44
+ },
45
+ },
46
+ },
47
+ clearable: {
48
+ description: "Whether the input is clearable or not.",
49
+ table: {
50
+ type: {
51
+ summary: "boolean",
52
+ },
53
+ defaultValue: {
54
+ summary: "false",
55
+ },
56
+ },
57
+ },
58
+ prepend: {
59
+ description: "Schema of component to be displayed before the input.",
60
+ table: {
61
+ type: {
62
+ summary: "ControlSchema",
63
+ },
64
+ },
65
+ },
66
+ append: {
67
+ description: "Schema of component to be displayed after the input.",
68
+ table: {
69
+ type: {
70
+ summary: "ControlSchema",
71
+ },
72
+ },
73
+ },
74
+ appendInner: {
75
+ description: "Schema of component to be displayed inside the input after the value.",
76
+ table: {
77
+ type: {
78
+ summary: "ControlSchema",
79
+ },
80
+ },
81
+ },
82
+ prependInner: {
83
+ description: "Schema of component to be displayed inside the input before the value.",
84
+ table: {
85
+ type: {
86
+ summary: "ControlSchema",
87
+ },
88
+ },
89
+ },
90
+ },
91
+ parameters: {
92
+ docs: {
93
+ canvas: {
94
+ sourceState: "none",
95
+ },
96
+ },
97
+ },
98
+ } satisfies Meta<InputSchema>;
99
+
100
+ export const Template: StoryFn<InputSchema> = (args) => ({
101
+ components: { page },
102
+ setup() {
103
+ const context = reactive({
104
+ item: {
105
+ mockedProperty: "I am input field",
106
+ },
107
+ });
108
+ return { args, context };
109
+ },
110
+ template,
111
+ });
112
+
113
+ export const WithLabel = Template.bind({});
114
+ WithLabel.args = {
115
+ label: "Input label",
116
+ };
117
+
118
+ export const WithTooltip = WithLabel.bind({});
119
+ WithTooltip.args = {
120
+ label: "Input label",
121
+ tooltip: "Input tooltip",
122
+ };
123
+
124
+ export const WithPlaceholder = Template.bind({});
125
+ WithPlaceholder.args = {
126
+ label: "Input label",
127
+ placeholder: "Input placeholder",
128
+ };
129
+
130
+ export const WithPrepend: StoryFn<InputSchema> = (args) => ({
131
+ components: { page },
132
+ setup() {
133
+ const context = reactive({
134
+ item: {
135
+ mockedProperty: "I am input field",
136
+ },
137
+ scope: {
138
+ btnClick: () => alert("Button clicked!"),
139
+ },
140
+ });
141
+ return { args, context };
142
+ },
143
+ template,
144
+ });
145
+ WithPrepend.args = {
146
+ label: "Input label",
147
+ prepend: {
148
+ component: "vc-button",
149
+ id: "prependButtonId",
150
+ content: "Prepend",
151
+ method: "btnClick",
152
+ },
153
+ };
154
+
155
+ export const WithAppend = WithPrepend.bind({});
156
+ WithAppend.args = {
157
+ label: "Input label",
158
+ append: {
159
+ component: "vc-button",
160
+ id: "appendButtonId",
161
+ content: "Append",
162
+ method: "btnClick",
163
+ },
164
+ };
165
+
166
+ export const WithPrependInner = WithPrepend.bind({});
167
+ WithPrependInner.args = {
168
+ label: "Input label",
169
+ prependInner: {
170
+ component: "vc-button",
171
+ id: "prependInnerButtonId",
172
+ content: "Prepend Inner",
173
+ method: "btnClick",
174
+ },
175
+ };
176
+
177
+ export const WithAppendInner = WithPrepend.bind({});
178
+ WithAppendInner.args = {
179
+ label: "Input label",
180
+ appendInner: {
181
+ component: "vc-button",
182
+ id: "appendInnerButtonId",
183
+ content: "Append Inner",
184
+ method: "btnClick",
185
+ },
186
+ };
187
+
188
+ export const WithClearable = Template.bind({});
189
+ WithClearable.args = {
190
+ label: "Input label",
191
+ clearable: true,
192
+ };
193
+
194
+ export const WithDisabled: StoryFn<InputSchema> = (args) => ({
195
+ components: { page },
196
+ setup() {
197
+ const context = reactive({
198
+ item: {
199
+ mockedProperty: "I am input field",
200
+ },
201
+ scope: {
202
+ disabledFn: true,
203
+ },
204
+ });
205
+ return { args, context };
206
+ },
207
+ template,
208
+ });
209
+ WithDisabled.args = {
210
+ label: "Input label",
211
+ disabled: { method: "disabledFn" },
212
+ };
213
+
214
+ export const WithVisibilityMethod: StoryFn<InputSchema> = (args) => ({
215
+ components: { page },
216
+ setup() {
217
+ const isVisible = ref(false);
218
+ const toggle = () => {
219
+ isVisible.value = !isVisible.value;
220
+ };
221
+
222
+ const context = reactive({
223
+ item: {
224
+ mockedProperty: "I am input field",
225
+ },
226
+ scope: {
227
+ visibilityFn: isVisible,
228
+ },
229
+ });
230
+
231
+ return { args, context, toggle };
232
+ },
233
+ template: templateWithVisibilityToggle,
234
+ });
235
+ WithVisibilityMethod.args = {
236
+ label: "Input label",
237
+ visibility: { method: "visibilityFn" },
238
+ };
239
+
240
+ export const WithUpdateMethod: StoryFn<InputSchema> = (args) => ({
241
+ components: { page },
242
+ setup() {
243
+ const context = reactive({
244
+ item: {
245
+ mockedProperty: "I am input field",
246
+ },
247
+ scope: {
248
+ updateFn: (value: string) => alert(`Value updated to: ${value}`),
249
+ },
250
+ });
251
+ return { args, context };
252
+ },
253
+ template,
254
+ });
255
+ WithUpdateMethod.args = {
256
+ label: "Input label",
257
+ update: { method: "updateFn" },
258
+ };
259
+
260
+ export const WithValidation: StoryFn<InputSchema> = (args) => ({
261
+ components: { page },
262
+ setup() {
263
+ const context = reactive({
264
+ item: {
265
+ mockedProperty: undefined,
266
+ },
267
+ scope: {},
268
+ });
269
+ return { args, context };
270
+ },
271
+ template,
272
+ });
273
+ WithValidation.args = {
274
+ label: "Input label",
275
+ placeholder: "Enter a number",
276
+ rules: {
277
+ required: true,
278
+ numeric: true,
279
+ },
280
+ };
281
+
282
+ export const WithHorizontalSeparator = Template.bind({});
283
+ WithHorizontalSeparator.args = {
284
+ label: "Input label",
285
+ horizontalSeparator: true,
286
+ };
@@ -0,0 +1,347 @@
1
+ import { Meta, StoryFn, setup } from "@storybook/vue3";
2
+ import { MultivalueSchema } from "../../..";
3
+ import { SchemaBaseArgTypes } from "./common/args";
4
+ import { template, templateWithVisibilityToggle } from "./common/templates";
5
+ import page from "./pages/DynamicRender";
6
+ import { computed, defineComponent, reactive, ref, watch } from "vue";
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.item.id}}</h2>
15
+ <p>Title - {{context.item.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.value }}
22
+ </div>
23
+ </template>
24
+ `,
25
+ };
26
+
27
+ setup((app) => {
28
+ app.component("CustomMultivalue", customTemplateComponent);
29
+ });
30
+
31
+ export default {
32
+ title: "DynamicViews/molecules/VcMultivalue",
33
+ component: page,
34
+ args: {
35
+ id: "multivalueFieldId",
36
+ component: "vc-multivalue",
37
+
38
+ property: "mockedProperty",
39
+ },
40
+ argTypes: {
41
+ ...SchemaBaseArgTypes,
42
+ component: {
43
+ description: "Component type.",
44
+ type: {
45
+ required: true,
46
+ name: "string",
47
+ },
48
+ table: {
49
+ type: {
50
+ summary: "vc-multivalue",
51
+ },
52
+ defaultValue: {
53
+ summary: "vc-multivalue",
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
+ options: {
90
+ description: "Array with multivalue dictionary. Array should be defined in the blade `scope`.",
91
+ table: {
92
+ type: {
93
+ summary: "string",
94
+ },
95
+ },
96
+ },
97
+ multivalue: {
98
+ description: "Whether the select is multivalue or not.",
99
+ control: "boolean",
100
+ table: {
101
+ type: {
102
+ summary: "boolean",
103
+ },
104
+ },
105
+ },
106
+ variant: {
107
+ description: "Multivalue type",
108
+ control: "radio",
109
+ options: ["number", "text"],
110
+ table: {
111
+ type: {
112
+ summary: "number | text",
113
+ },
114
+ defaultValue: {
115
+ summary: "text",
116
+ },
117
+ },
118
+ },
119
+ customTemplate: {
120
+ description: `Name of custom template to display data in multivalue.
121
+ Component should be registered globally.
122
+ Supported slots:
123
+ \n1) \`selected-item\` - selected item
124
+ \n2) \`option\` - options in dropdown list
125
+ \nComponent should have the following props:
126
+ \n1) \`context\` - object with the following properties:
127
+ \n - \`item\` - selected item
128
+ \n - \`value\` - selected value
129
+ \n - \`remove\` - function to remove the option
130
+ \n2) \`slotName\` - name of the slot to render`,
131
+ table: {
132
+ type: {
133
+ summary: "{ component: string }",
134
+ },
135
+ },
136
+ },
137
+ },
138
+ parameters: {
139
+ docs: {
140
+ canvas: {
141
+ sourceState: "none",
142
+ },
143
+ },
144
+ },
145
+ } satisfies Meta<MultivalueSchema>;
146
+
147
+ export const Template: StoryFn<MultivalueSchema> = (args) => ({
148
+ components: { page },
149
+ setup() {
150
+ const context = reactive({
151
+ item: {
152
+ mockedProperty: undefined,
153
+ },
154
+ scope: {},
155
+ });
156
+ return { args, context };
157
+ },
158
+ template,
159
+ });
160
+ Template.args = {
161
+ placeholder: "Write something and press Enter",
162
+ };
163
+
164
+ export const NumberInput: StoryFn<MultivalueSchema> = (args) => ({
165
+ components: { page },
166
+ setup() {
167
+ const context = reactive({
168
+ item: {
169
+ mockedProperty: undefined,
170
+ },
171
+ scope: {},
172
+ });
173
+ return { args, context };
174
+ },
175
+ template,
176
+ });
177
+ NumberInput.args = {
178
+ variant: "number",
179
+ placeholder: "Write something and press Enter",
180
+ };
181
+
182
+ export const Multivalue: StoryFn<MultivalueSchema> = (args) => ({
183
+ components: { page },
184
+ setup() {
185
+ const context = reactive({
186
+ item: {
187
+ mockedProperty: undefined,
188
+ },
189
+ scope: {
190
+ mockedOptionsArray: [
191
+ { id: "1", title: "Option 1" },
192
+ { id: "2", title: "Option 2" },
193
+ { id: "3", title: "Option 3" },
194
+ ],
195
+ },
196
+ });
197
+ return { args, context };
198
+ },
199
+ template,
200
+ });
201
+ Multivalue.args = {
202
+ multivalue: true,
203
+ options: "mockedOptionsArray",
204
+ };
205
+
206
+ export const CustomTemplate: StoryFn<MultivalueSchema> = (args) => ({
207
+ components: { page, VcIcon },
208
+ setup() {
209
+ const context = reactive({
210
+ item: {
211
+ mockedProperty: [{ id: "1", title: "Option 1" }],
212
+ },
213
+ scope: {
214
+ mockedOptionsArray: [
215
+ { id: "1", title: "Option 1" },
216
+ { id: "2", title: "Option 2" },
217
+ { id: "3", title: "Option 3" },
218
+ ],
219
+ },
220
+ });
221
+ return { args, context };
222
+ },
223
+ template,
224
+ });
225
+ CustomTemplate.storyName = "Custom template for dropdown item and selected item";
226
+ CustomTemplate.args = {
227
+ options: "mockedOptionsArray",
228
+ multivalue: true,
229
+ customTemplate: { component: "custom-multivalue" },
230
+ };
231
+
232
+ export const WithLabel: StoryFn<MultivalueSchema> = (args) => ({
233
+ components: { page },
234
+ setup() {
235
+ const context = reactive({
236
+ item: {
237
+ mockedProperty: [],
238
+ },
239
+ scope: {},
240
+ });
241
+ return { args, context };
242
+ },
243
+ template,
244
+ });
245
+
246
+ WithLabel.args = {
247
+ label: "Input label",
248
+ };
249
+
250
+ export const WithValidation = WithLabel.bind({});
251
+ WithValidation.args = {
252
+ label: "Input label",
253
+ placeholder: "Enter a number",
254
+ rules: {
255
+ required: true,
256
+ },
257
+ };
258
+
259
+ export const WithTooltip = WithLabel.bind({});
260
+
261
+ WithTooltip.args = {
262
+ label: "Input label",
263
+ tooltip: "I am a tooltip",
264
+ };
265
+
266
+ export const WithDisabled: StoryFn<MultivalueSchema> = (args) => ({
267
+ components: { page },
268
+ setup() {
269
+ const context = reactive({
270
+ item: {
271
+ mockedProperty: [],
272
+ },
273
+ scope: {
274
+ disabledFn: true,
275
+ },
276
+ });
277
+ return { args, context };
278
+ },
279
+ template,
280
+ });
281
+ WithDisabled.args = {
282
+ label: "Input label",
283
+ disabled: {
284
+ method: "disabledFn",
285
+ },
286
+ };
287
+
288
+ export const WithPlaceholder = WithLabel.bind({});
289
+ WithPlaceholder.args = {
290
+ label: "Input label",
291
+ placeholder: "I am a placeholder",
292
+ };
293
+
294
+ export const WithVisibilityMethod: StoryFn<MultivalueSchema> = (args) => ({
295
+ components: { page },
296
+ setup() {
297
+ const isVisible = ref(false);
298
+ const toggle = () => {
299
+ isVisible.value = !isVisible.value;
300
+ };
301
+
302
+ const context = reactive({
303
+ item: {
304
+ mockedProperty: [],
305
+ },
306
+ scope: {
307
+ visibilityFn: isVisible,
308
+ },
309
+ });
310
+ return { args, context, toggle };
311
+ },
312
+ template: templateWithVisibilityToggle,
313
+ });
314
+ WithVisibilityMethod.args = {
315
+ label: "Input label",
316
+ visibility: {
317
+ method: "visibilityFn",
318
+ },
319
+ };
320
+
321
+ export const WithUpdateMethod: StoryFn<MultivalueSchema> = (args) => ({
322
+ components: { page },
323
+ setup() {
324
+ const context = reactive({
325
+ item: {
326
+ mockedProperty: [],
327
+ },
328
+ scope: {
329
+ updateFn: (value: string) => alert(`Value updated to: ${JSON.stringify(value, null, 2)}`),
330
+ },
331
+ });
332
+ return { args, context };
333
+ },
334
+ template,
335
+ });
336
+ WithUpdateMethod.args = {
337
+ label: "Input label",
338
+ update: {
339
+ method: "updateFn",
340
+ },
341
+ };
342
+
343
+ export const WithHorizontalSeparator = Template.bind({});
344
+ WithHorizontalSeparator.args = {
345
+ label: "Input label",
346
+ horizontalSeparator: true,
347
+ };