@vc-shell/framework 1.0.188 → 1.0.190
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 +26 -0
- package/core/plugins/moment/humanize.ts +6 -7
- package/core/types/index.ts +12 -1
- package/dist/core/plugins/moment/humanize.d.ts.map +1 -1
- package/dist/core/types/index.d.ts +1 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/framework.js +30782 -20187
- package/dist/index.css +1 -1
- package/dist/shared/components/error-interceptor/interceptor.d.ts.map +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/InputField.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/TextareaField.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 +407 -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 +460 -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 +407 -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/factories/types/index.d.ts +1 -0
- package/dist/shared/modules/dynamic/factories/types/index.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 +88 -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.stories.d.ts +16 -16
- 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.stories.d.ts +16 -4
- package/dist/ui/components/molecules/vc-editor/vc-editor.stories.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts +2 -1
- package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-input/vc-input.stories.d.ts +30 -16
- 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 +12 -12
- 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.stories.d.ts +63 -63
- package/dist/ui/components/molecules/vc-textarea/vc-textarea.vue.d.ts +6 -6
- package/dist/ui/components/molecules/vc-textarea/vc-textarea.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue.d.ts +1 -0
- 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/_internal/vc-table-column-switcher/vc-table-column-switcher.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/vc-table.stories.d.ts +8 -2
- 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 +3 -1
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
- package/package.json +8 -4
- package/shared/components/error-interceptor/interceptor.ts +1 -1
- 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 +5 -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/InputField.ts +1 -0
- 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/TextareaField.ts +1 -0
- 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 +166 -0
- package/shared/modules/dynamic/components/fields/storybook/Checkbox.stories.ts +185 -0
- package/shared/modules/dynamic/components/fields/storybook/ContentField.stories.ts +245 -0
- package/shared/modules/dynamic/components/fields/storybook/EditorField.stories.ts +192 -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 +298 -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 +203 -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 +1 -0
- package/shared/modules/dynamic/factories/types/index.ts +2 -0
- 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 +93 -40
- package/shared/modules/dynamic/types/models.ts +8 -7
- package/shared/pages/LoginPage/components/login/Login.vue +1 -1
- 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 +47 -33
- package/ui/components/molecules/vc-field/_internal/vc-field-type/vc-field-type.vue +2 -2
- package/ui/components/molecules/vc-input/vc-input.stories.ts +14 -0
- 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.stories.ts +1 -1
- package/ui/components/molecules/vc-textarea/vc-textarea.vue +5 -15
- package/ui/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue +1 -1
- package/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue +140 -108
- package/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue +20 -6
- package/ui/components/organisms/vc-table/vc-table.stories.ts +6 -2
- package/ui/components/organisms/vc-table/vc-table.vue +176 -124
|
@@ -0,0 +1,298 @@
|
|
|
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
|
+
maxlength: {
|
|
91
|
+
description: "Maximum number of characters that can be entered.",
|
|
92
|
+
control: "number",
|
|
93
|
+
table: {
|
|
94
|
+
type: {
|
|
95
|
+
summary: "number",
|
|
96
|
+
},
|
|
97
|
+
defaultValue: {
|
|
98
|
+
summary: 1024,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
parameters: {
|
|
104
|
+
docs: {
|
|
105
|
+
canvas: {
|
|
106
|
+
sourceState: "none",
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
} satisfies Meta<InputSchema>;
|
|
111
|
+
|
|
112
|
+
export const Template: StoryFn<InputSchema> = (args) => ({
|
|
113
|
+
components: { page },
|
|
114
|
+
setup() {
|
|
115
|
+
const context = reactive({
|
|
116
|
+
item: {
|
|
117
|
+
mockedProperty: "I am input field",
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
return { args, context };
|
|
121
|
+
},
|
|
122
|
+
template,
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
export const WithLabel = Template.bind({});
|
|
126
|
+
WithLabel.args = {
|
|
127
|
+
label: "Input label",
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export const WithTooltip = WithLabel.bind({});
|
|
131
|
+
WithTooltip.args = {
|
|
132
|
+
label: "Input label",
|
|
133
|
+
tooltip: "Input tooltip",
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export const WithPlaceholder = Template.bind({});
|
|
137
|
+
WithPlaceholder.args = {
|
|
138
|
+
label: "Input label",
|
|
139
|
+
placeholder: "Input placeholder",
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export const WithPrepend: StoryFn<InputSchema> = (args) => ({
|
|
143
|
+
components: { page },
|
|
144
|
+
setup() {
|
|
145
|
+
const context = reactive({
|
|
146
|
+
item: {
|
|
147
|
+
mockedProperty: "I am input field",
|
|
148
|
+
},
|
|
149
|
+
scope: {
|
|
150
|
+
btnClick: () => alert("Button clicked!"),
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
return { args, context };
|
|
154
|
+
},
|
|
155
|
+
template,
|
|
156
|
+
});
|
|
157
|
+
WithPrepend.args = {
|
|
158
|
+
label: "Input label",
|
|
159
|
+
prepend: {
|
|
160
|
+
component: "vc-button",
|
|
161
|
+
id: "prependButtonId",
|
|
162
|
+
content: "Prepend",
|
|
163
|
+
method: "btnClick",
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const WithAppend = WithPrepend.bind({});
|
|
168
|
+
WithAppend.args = {
|
|
169
|
+
label: "Input label",
|
|
170
|
+
append: {
|
|
171
|
+
component: "vc-button",
|
|
172
|
+
id: "appendButtonId",
|
|
173
|
+
content: "Append",
|
|
174
|
+
method: "btnClick",
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export const WithPrependInner = WithPrepend.bind({});
|
|
179
|
+
WithPrependInner.args = {
|
|
180
|
+
label: "Input label",
|
|
181
|
+
prependInner: {
|
|
182
|
+
component: "vc-button",
|
|
183
|
+
id: "prependInnerButtonId",
|
|
184
|
+
content: "Prepend Inner",
|
|
185
|
+
method: "btnClick",
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const WithAppendInner = WithPrepend.bind({});
|
|
190
|
+
WithAppendInner.args = {
|
|
191
|
+
label: "Input label",
|
|
192
|
+
appendInner: {
|
|
193
|
+
component: "vc-button",
|
|
194
|
+
id: "appendInnerButtonId",
|
|
195
|
+
content: "Append Inner",
|
|
196
|
+
method: "btnClick",
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export const WithClearable = Template.bind({});
|
|
201
|
+
WithClearable.args = {
|
|
202
|
+
label: "Input label",
|
|
203
|
+
clearable: true,
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export const WithDisabled: StoryFn<InputSchema> = (args) => ({
|
|
207
|
+
components: { page },
|
|
208
|
+
setup() {
|
|
209
|
+
const context = reactive({
|
|
210
|
+
item: {
|
|
211
|
+
mockedProperty: "I am input field",
|
|
212
|
+
},
|
|
213
|
+
scope: {
|
|
214
|
+
disabledFn: true,
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
return { args, context };
|
|
218
|
+
},
|
|
219
|
+
template,
|
|
220
|
+
});
|
|
221
|
+
WithDisabled.args = {
|
|
222
|
+
label: "Input label",
|
|
223
|
+
disabled: { method: "disabledFn" },
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
export const WithVisibilityMethod: StoryFn<InputSchema> = (args) => ({
|
|
227
|
+
components: { page },
|
|
228
|
+
setup() {
|
|
229
|
+
const isVisible = ref(false);
|
|
230
|
+
const toggle = () => {
|
|
231
|
+
isVisible.value = !isVisible.value;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
const context = reactive({
|
|
235
|
+
item: {
|
|
236
|
+
mockedProperty: "I am input field",
|
|
237
|
+
},
|
|
238
|
+
scope: {
|
|
239
|
+
visibilityFn: isVisible,
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
return { args, context, toggle };
|
|
244
|
+
},
|
|
245
|
+
template: templateWithVisibilityToggle,
|
|
246
|
+
});
|
|
247
|
+
WithVisibilityMethod.args = {
|
|
248
|
+
label: "Input label",
|
|
249
|
+
visibility: { method: "visibilityFn" },
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
export const WithUpdateMethod: StoryFn<InputSchema> = (args) => ({
|
|
253
|
+
components: { page },
|
|
254
|
+
setup() {
|
|
255
|
+
const context = reactive({
|
|
256
|
+
item: {
|
|
257
|
+
mockedProperty: "I am input field",
|
|
258
|
+
},
|
|
259
|
+
scope: {
|
|
260
|
+
updateFn: (value: string) => alert(`Value updated to: ${value}`),
|
|
261
|
+
},
|
|
262
|
+
});
|
|
263
|
+
return { args, context };
|
|
264
|
+
},
|
|
265
|
+
template,
|
|
266
|
+
});
|
|
267
|
+
WithUpdateMethod.args = {
|
|
268
|
+
label: "Input label",
|
|
269
|
+
update: { method: "updateFn" },
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
export const WithValidation: StoryFn<InputSchema> = (args) => ({
|
|
273
|
+
components: { page },
|
|
274
|
+
setup() {
|
|
275
|
+
const context = reactive({
|
|
276
|
+
item: {
|
|
277
|
+
mockedProperty: undefined,
|
|
278
|
+
},
|
|
279
|
+
scope: {},
|
|
280
|
+
});
|
|
281
|
+
return { args, context };
|
|
282
|
+
},
|
|
283
|
+
template,
|
|
284
|
+
});
|
|
285
|
+
WithValidation.args = {
|
|
286
|
+
label: "Input label",
|
|
287
|
+
placeholder: "Enter a number",
|
|
288
|
+
rules: {
|
|
289
|
+
required: true,
|
|
290
|
+
numeric: true,
|
|
291
|
+
},
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
export const WithHorizontalSeparator = Template.bind({});
|
|
295
|
+
WithHorizontalSeparator.args = {
|
|
296
|
+
label: "Input label",
|
|
297
|
+
horizontalSeparator: true,
|
|
298
|
+
};
|
|
@@ -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
|
+
};
|