@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.
Files changed (181) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/core/plugins/moment/humanize.ts +6 -7
  3. package/core/types/index.ts +12 -1
  4. package/dist/core/plugins/moment/humanize.d.ts.map +1 -1
  5. package/dist/core/types/index.d.ts +1 -1
  6. package/dist/core/types/index.d.ts.map +1 -1
  7. package/dist/framework.js +30782 -20187
  8. package/dist/index.css +1 -1
  9. package/dist/shared/components/error-interceptor/interceptor.d.ts.map +1 -1
  10. package/dist/shared/modules/dynamic/components/fields/Button.d.ts.map +1 -1
  11. package/dist/shared/modules/dynamic/components/fields/ContentField.d.ts.map +1 -1
  12. package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts.map +1 -1
  13. package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts +4 -1
  14. package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts.map +1 -1
  15. package/dist/shared/modules/dynamic/components/fields/GalleryField.d.ts.map +1 -1
  16. package/dist/shared/modules/dynamic/components/fields/ImageField.d.ts.map +1 -1
  17. package/dist/shared/modules/dynamic/components/fields/InputField.d.ts.map +1 -1
  18. package/dist/shared/modules/dynamic/components/fields/MultivalueField.d.ts.map +1 -1
  19. package/dist/shared/modules/dynamic/components/fields/SelectField.d.ts.map +1 -1
  20. package/dist/shared/modules/dynamic/components/fields/StatusField.d.ts.map +1 -1
  21. package/dist/shared/modules/dynamic/components/fields/TextareaField.d.ts.map +1 -1
  22. package/dist/shared/modules/dynamic/components/fields/VideoField.d.ts.map +1 -1
  23. package/dist/shared/modules/dynamic/components/fields/storybook/Button.stories.d.ts +417 -0
  24. package/dist/shared/modules/dynamic/components/fields/storybook/Button.stories.d.ts.map +1 -0
  25. package/dist/shared/modules/dynamic/components/fields/storybook/Card.stories.d.ts +357 -0
  26. package/dist/shared/modules/dynamic/components/fields/storybook/Card.stories.d.ts.map +1 -0
  27. package/dist/shared/modules/dynamic/components/fields/storybook/Checkbox.stories.d.ts +398 -0
  28. package/dist/shared/modules/dynamic/components/fields/storybook/Checkbox.stories.d.ts.map +1 -0
  29. package/dist/shared/modules/dynamic/components/fields/storybook/ContentField.stories.d.ts +392 -0
  30. package/dist/shared/modules/dynamic/components/fields/storybook/ContentField.stories.d.ts.map +1 -0
  31. package/dist/shared/modules/dynamic/components/fields/storybook/EditorField.stories.d.ts +407 -0
  32. package/dist/shared/modules/dynamic/components/fields/storybook/EditorField.stories.d.ts.map +1 -0
  33. package/dist/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.d.ts +372 -0
  34. package/dist/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.d.ts.map +1 -0
  35. package/dist/shared/modules/dynamic/components/fields/storybook/GalleryField.stories.d.ts +391 -0
  36. package/dist/shared/modules/dynamic/components/fields/storybook/GalleryField.stories.d.ts.map +1 -0
  37. package/dist/shared/modules/dynamic/components/fields/storybook/ImageField.stories.d.ts +372 -0
  38. package/dist/shared/modules/dynamic/components/fields/storybook/ImageField.stories.d.ts.map +1 -0
  39. package/dist/shared/modules/dynamic/components/fields/storybook/InputCurrency.stories.d.ts +439 -0
  40. package/dist/shared/modules/dynamic/components/fields/storybook/InputCurrency.stories.d.ts.map +1 -0
  41. package/dist/shared/modules/dynamic/components/fields/storybook/InputField.stories.d.ts +460 -0
  42. package/dist/shared/modules/dynamic/components/fields/storybook/InputField.stories.d.ts.map +1 -0
  43. package/dist/shared/modules/dynamic/components/fields/storybook/MultivalueField.stories.d.ts +459 -0
  44. package/dist/shared/modules/dynamic/components/fields/storybook/MultivalueField.stories.d.ts.map +1 -0
  45. package/dist/shared/modules/dynamic/components/fields/storybook/RatingField.stories.d.ts +359 -0
  46. package/dist/shared/modules/dynamic/components/fields/storybook/RatingField.stories.d.ts.map +1 -0
  47. package/dist/shared/modules/dynamic/components/fields/storybook/SelectField.stories.d.ts +507 -0
  48. package/dist/shared/modules/dynamic/components/fields/storybook/SelectField.stories.d.ts.map +1 -0
  49. package/dist/shared/modules/dynamic/components/fields/storybook/StatusField.stories.d.ts +392 -0
  50. package/dist/shared/modules/dynamic/components/fields/storybook/StatusField.stories.d.ts.map +1 -0
  51. package/dist/shared/modules/dynamic/components/fields/storybook/SwitchField.stories.d.ts +14 -0
  52. package/dist/shared/modules/dynamic/components/fields/storybook/SwitchField.stories.d.ts.map +1 -0
  53. package/dist/shared/modules/dynamic/components/fields/storybook/TextareaField.stories.d.ts +407 -0
  54. package/dist/shared/modules/dynamic/components/fields/storybook/TextareaField.stories.d.ts.map +1 -0
  55. package/dist/shared/modules/dynamic/components/fields/storybook/VideoField.stories.d.ts +322 -0
  56. package/dist/shared/modules/dynamic/components/fields/storybook/VideoField.stories.d.ts.map +1 -0
  57. package/dist/shared/modules/dynamic/components/fields/storybook/common/args.d.ts +113 -0
  58. package/dist/shared/modules/dynamic/components/fields/storybook/common/args.d.ts.map +1 -0
  59. package/dist/shared/modules/dynamic/components/fields/storybook/common/templates.d.ts +3 -0
  60. package/dist/shared/modules/dynamic/components/fields/storybook/common/templates.d.ts.map +1 -0
  61. package/dist/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.d.ts +235 -0
  62. package/dist/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.d.ts.map +1 -0
  63. package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceHighlighter.d.ts +4 -0
  64. package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceHighlighter.d.ts.map +1 -0
  65. package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceTransform.d.ts +3 -0
  66. package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceTransform.d.ts.map +1 -0
  67. package/dist/shared/modules/dynamic/factories/base/useDetailsFactory.d.ts.map +1 -1
  68. package/dist/shared/modules/dynamic/factories/types/index.d.ts +1 -0
  69. package/dist/shared/modules/dynamic/factories/types/index.d.ts.map +1 -1
  70. package/dist/shared/modules/dynamic/helpers/getters.d.ts.map +1 -1
  71. package/dist/shared/modules/dynamic/types/index.d.ts +88 -38
  72. package/dist/shared/modules/dynamic/types/index.d.ts.map +1 -1
  73. package/dist/shared/modules/dynamic/types/models.d.ts.map +1 -1
  74. package/dist/tsconfig.tsbuildinfo +1 -1
  75. package/dist/ui/components/atoms/vc-card/vc-card.stories.d.ts +16 -16
  76. package/dist/ui/components/atoms/vc-card/vc-card.vue.d.ts.map +1 -1
  77. package/dist/ui/components/atoms/vc-switch/index.d.ts +1 -39
  78. package/dist/ui/components/atoms/vc-switch/index.d.ts.map +1 -1
  79. package/dist/ui/components/atoms/vc-switch/vc-switch.stories.d.ts +30 -11
  80. package/dist/ui/components/atoms/vc-switch/vc-switch.stories.d.ts.map +1 -1
  81. package/dist/ui/components/atoms/vc-switch/vc-switch.vue.d.ts +22 -3
  82. package/dist/ui/components/atoms/vc-switch/vc-switch.vue.d.ts.map +1 -1
  83. package/dist/ui/components/atoms/vc-video/index.d.ts +1 -35
  84. package/dist/ui/components/atoms/vc-video/index.d.ts.map +1 -1
  85. package/dist/ui/components/atoms/vc-video/vc-video.stories.d.ts +5 -27
  86. package/dist/ui/components/atoms/vc-video/vc-video.stories.d.ts.map +1 -1
  87. package/dist/ui/components/atoms/vc-video/vc-video.vue.d.ts +3 -18
  88. package/dist/ui/components/atoms/vc-video/vc-video.vue.d.ts.map +1 -1
  89. package/dist/ui/components/molecules/vc-editor/vc-editor.stories.d.ts +16 -4
  90. package/dist/ui/components/molecules/vc-editor/vc-editor.stories.d.ts.map +1 -1
  91. package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts +2 -1
  92. package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts.map +1 -1
  93. package/dist/ui/components/molecules/vc-input/vc-input.stories.d.ts +30 -16
  94. package/dist/ui/components/molecules/vc-input/vc-input.stories.d.ts.map +1 -1
  95. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.stories.d.ts +12 -12
  96. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts.map +1 -1
  97. package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.stories.d.ts +252 -42
  98. package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.stories.d.ts.map +1 -1
  99. package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts +36 -6
  100. package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts.map +1 -1
  101. package/dist/ui/components/molecules/vc-select/vc-select.stories.d.ts +96 -32
  102. package/dist/ui/components/molecules/vc-select/vc-select.stories.d.ts.map +1 -1
  103. package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts +3 -3
  104. package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts.map +1 -1
  105. package/dist/ui/components/molecules/vc-textarea/vc-textarea.stories.d.ts +63 -63
  106. package/dist/ui/components/molecules/vc-textarea/vc-textarea.vue.d.ts +6 -6
  107. package/dist/ui/components/molecules/vc-textarea/vc-textarea.vue.d.ts.map +1 -1
  108. package/dist/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue.d.ts +1 -0
  109. package/dist/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue.d.ts.map +1 -1
  110. package/dist/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue.d.ts.map +1 -1
  111. package/dist/ui/components/organisms/vc-table/vc-table.stories.d.ts +8 -2
  112. package/dist/ui/components/organisms/vc-table/vc-table.stories.d.ts.map +1 -1
  113. package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts +3 -1
  114. package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
  115. package/package.json +8 -4
  116. package/shared/components/error-interceptor/interceptor.ts +1 -1
  117. package/shared/modules/dynamic/components/fields/Button.ts +5 -2
  118. package/shared/modules/dynamic/components/fields/Card.ts +4 -4
  119. package/shared/modules/dynamic/components/fields/ContentField.ts +1 -0
  120. package/shared/modules/dynamic/components/fields/DynamicProperty.ts +5 -6
  121. package/shared/modules/dynamic/components/fields/EditorField.ts +5 -3
  122. package/shared/modules/dynamic/components/fields/Fieldset.ts +1 -1
  123. package/shared/modules/dynamic/components/fields/GalleryField.ts +6 -3
  124. package/shared/modules/dynamic/components/fields/ImageField.ts +0 -1
  125. package/shared/modules/dynamic/components/fields/InputCurrency.ts +1 -1
  126. package/shared/modules/dynamic/components/fields/InputField.ts +1 -0
  127. package/shared/modules/dynamic/components/fields/MultivalueField.ts +3 -2
  128. package/shared/modules/dynamic/components/fields/SelectField.ts +1 -0
  129. package/shared/modules/dynamic/components/fields/StatusField.ts +20 -10
  130. package/shared/modules/dynamic/components/fields/TextareaField.ts +1 -0
  131. package/shared/modules/dynamic/components/fields/VideoField.ts +0 -1
  132. package/shared/modules/dynamic/components/fields/storybook/Button.stories.ts +247 -0
  133. package/shared/modules/dynamic/components/fields/storybook/Card.stories.ts +166 -0
  134. package/shared/modules/dynamic/components/fields/storybook/Checkbox.stories.ts +185 -0
  135. package/shared/modules/dynamic/components/fields/storybook/ContentField.stories.ts +245 -0
  136. package/shared/modules/dynamic/components/fields/storybook/EditorField.stories.ts +192 -0
  137. package/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.ts +409 -0
  138. package/shared/modules/dynamic/components/fields/storybook/GalleryField.stories.ts +239 -0
  139. package/shared/modules/dynamic/components/fields/storybook/ImageField.stories.ts +186 -0
  140. package/shared/modules/dynamic/components/fields/storybook/InputCurrency.stories.ts +267 -0
  141. package/shared/modules/dynamic/components/fields/storybook/InputField.stories.ts +298 -0
  142. package/shared/modules/dynamic/components/fields/storybook/MultivalueField.stories.ts +347 -0
  143. package/shared/modules/dynamic/components/fields/storybook/RatingField.stories.ts +131 -0
  144. package/shared/modules/dynamic/components/fields/storybook/SelectField.stories.ts +653 -0
  145. package/shared/modules/dynamic/components/fields/storybook/StatusField.stories.ts +202 -0
  146. package/shared/modules/dynamic/components/fields/storybook/SwitchField.stories.ts +178 -0
  147. package/shared/modules/dynamic/components/fields/storybook/TextareaField.stories.ts +203 -0
  148. package/shared/modules/dynamic/components/fields/storybook/VideoField.stories.ts +92 -0
  149. package/shared/modules/dynamic/components/fields/storybook/common/args.ts +130 -0
  150. package/shared/modules/dynamic/components/fields/storybook/common/templates.ts +8 -0
  151. package/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.ts +54 -0
  152. package/shared/modules/dynamic/components/fields/storybook/utils/sourceHighlighter.ts +16 -0
  153. package/shared/modules/dynamic/components/fields/storybook/utils/sourceTransform.ts +41 -0
  154. package/shared/modules/dynamic/factories/base/useDetailsFactory.ts +1 -0
  155. package/shared/modules/dynamic/factories/types/index.ts +2 -0
  156. package/shared/modules/dynamic/helpers/getters.ts +3 -0
  157. package/shared/modules/dynamic/helpers/nodeBuilder.ts +1 -1
  158. package/shared/modules/dynamic/helpers/setters.ts +1 -1
  159. package/shared/modules/dynamic/types/index.ts +93 -40
  160. package/shared/modules/dynamic/types/models.ts +8 -7
  161. package/shared/pages/LoginPage/components/login/Login.vue +1 -1
  162. package/ui/components/atoms/vc-card/vc-card.vue +12 -2
  163. package/ui/components/atoms/vc-switch/index.ts +1 -3
  164. package/ui/components/atoms/vc-switch/vc-switch.vue +10 -3
  165. package/ui/components/atoms/vc-video/index.ts +1 -3
  166. package/ui/components/atoms/vc-video/vc-video.stories.ts +1 -15
  167. package/ui/components/atoms/vc-video/vc-video.vue +4 -37
  168. package/ui/components/molecules/vc-editor/vc-editor.vue +47 -33
  169. package/ui/components/molecules/vc-field/_internal/vc-field-type/vc-field-type.vue +2 -2
  170. package/ui/components/molecules/vc-input/vc-input.stories.ts +14 -0
  171. package/ui/components/molecules/vc-input-currency/vc-input-currency.vue +8 -0
  172. package/ui/components/molecules/vc-multivalue/vc-multivalue.vue +21 -9
  173. package/ui/components/molecules/vc-select/vc-select.stories.ts +74 -3
  174. package/ui/components/molecules/vc-select/vc-select.vue +35 -38
  175. package/ui/components/molecules/vc-textarea/vc-textarea.stories.ts +1 -1
  176. package/ui/components/molecules/vc-textarea/vc-textarea.vue +5 -15
  177. package/ui/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue +1 -1
  178. package/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue +140 -108
  179. package/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue +20 -6
  180. package/ui/components/organisms/vc-table/vc-table.stories.ts +6 -2
  181. package/ui/components/organisms/vc-table/vc-table.vue +176 -124
@@ -0,0 +1,185 @@
1
+ import { Meta, StoryFn } from "@storybook/vue3";
2
+ import { computed, reactive, ref } from "vue";
3
+ import page from "./pages/DynamicRender";
4
+ import { template, templateWithVisibilityToggle } from "./common/templates";
5
+ import * as _ from "lodash-es";
6
+ import { SchemaBaseArgTypes } from "./common/args";
7
+ import { CheckboxSchema } from "../../..";
8
+
9
+ export default {
10
+ title: "DynamicViews/atoms/VcCheckbox",
11
+ component: page,
12
+ args: {
13
+ id: "checkboxId",
14
+ component: "vc-checkbox",
15
+ content: "Checkbox text",
16
+ property: "mockedProperty",
17
+ },
18
+ argTypes: {
19
+ ..._.omit(SchemaBaseArgTypes, ["multilanguage", "placeholder"]),
20
+ component: {
21
+ description: "Component type.",
22
+ type: {
23
+ required: true,
24
+ name: "string",
25
+ },
26
+ table: {
27
+ type: {
28
+ summary: "vc-checkbox",
29
+ },
30
+ defaultValue: {
31
+ summary: "vc-checkbox",
32
+ },
33
+ },
34
+ },
35
+ content: {
36
+ description: `Checkbox text content.
37
+ Supports i18n keys.`,
38
+ type: {
39
+ required: true,
40
+ name: "string",
41
+ },
42
+ table: {
43
+ type: {
44
+ summary: "string",
45
+ },
46
+ },
47
+ },
48
+ trueValue: {
49
+ description: "Value when checkbox is checked.",
50
+ table: {
51
+ type: {
52
+ summary: "any",
53
+ },
54
+ defaultValue: {
55
+ summary: "true",
56
+ },
57
+ },
58
+ },
59
+ falseValue: {
60
+ description: "Value when checkbox is unchecked.",
61
+ table: {
62
+ type: {
63
+ summary: "any",
64
+ },
65
+ defaultValue: {
66
+ summary: "false",
67
+ },
68
+ },
69
+ },
70
+ },
71
+ parameters: {
72
+ docs: {
73
+ canvas: {
74
+ sourceState: "none",
75
+ },
76
+ },
77
+ },
78
+ } satisfies Meta<CheckboxSchema>;
79
+
80
+ export const Template: StoryFn<CheckboxSchema> = (args) => ({
81
+ components: { page },
82
+ setup: () => {
83
+ const context = reactive({
84
+ item: {
85
+ mockedProperty: true,
86
+ },
87
+ });
88
+
89
+ return { args, context };
90
+ },
91
+ template,
92
+ });
93
+
94
+ export const Disabled: StoryFn<CheckboxSchema> = (args) => ({
95
+ components: { page },
96
+ setup: () => {
97
+ const context = reactive({
98
+ item: {
99
+ mockedProperty: false,
100
+ },
101
+ scope: {
102
+ disabledFn: computed(() => true),
103
+ },
104
+ });
105
+ return { args, context };
106
+ },
107
+ template,
108
+ });
109
+ Disabled.args = {
110
+ disabled: {
111
+ method: "disabledFn",
112
+ },
113
+ };
114
+
115
+ export const Checked: StoryFn<CheckboxSchema> = (args) => ({
116
+ components: { page },
117
+ setup: () => {
118
+ const context = reactive({
119
+ item: {
120
+ mockedProperty: true,
121
+ },
122
+ });
123
+ return { args, context };
124
+ },
125
+ template,
126
+ });
127
+
128
+ export const WithVisibilityMethod: StoryFn<CheckboxSchema> = (args) => ({
129
+ components: { page },
130
+ setup: () => {
131
+ const isVisible = ref(false);
132
+ const toggle = () => {
133
+ isVisible.value = !isVisible.value;
134
+ };
135
+
136
+ const context = reactive({
137
+ item: {
138
+ mockedProperty: false,
139
+ },
140
+ scope: {
141
+ visibilityFn: isVisible,
142
+ },
143
+ });
144
+ return { args, context, toggle };
145
+ },
146
+ template: templateWithVisibilityToggle,
147
+ });
148
+ WithVisibilityMethod.args = {
149
+ visibility: {
150
+ method: "visibilityFn",
151
+ },
152
+ };
153
+
154
+ export const HorizontalSeparator = Template.bind({});
155
+ HorizontalSeparator.args = {
156
+ horizontalSeparator: true,
157
+ };
158
+
159
+ export const WithUpdateMethod: StoryFn<CheckboxSchema> = (args) => ({
160
+ components: { page },
161
+ setup: () => {
162
+ const context = reactive({
163
+ item: {
164
+ mockedProperty: false,
165
+ },
166
+ scope: {
167
+ updateFn: (value: string) => alert(`Value updated to: ${value}`),
168
+ },
169
+ });
170
+ return { args, context };
171
+ },
172
+ template,
173
+ });
174
+ WithUpdateMethod.args = {
175
+ update: {
176
+ method: "updateFn",
177
+ },
178
+ };
179
+
180
+ export const WithRequiredRule = Template.bind({});
181
+ WithRequiredRule.args = {
182
+ rules: {
183
+ required: true,
184
+ },
185
+ };
@@ -0,0 +1,245 @@
1
+ import { Meta, StoryFn } from "@storybook/vue3";
2
+ import { reactive, ref } from "vue";
3
+ import page from "./pages/DynamicRender";
4
+ import { template, templateWithVisibilityToggle } from "./common/templates";
5
+ import * as _ from "lodash-es";
6
+ import { SchemaBaseArgTypes } from "./common/args";
7
+ import { FieldSchema } from "../../..";
8
+
9
+ export default {
10
+ title: "DynamicViews/molecules/VcField",
11
+ component: page,
12
+ args: {
13
+ id: "ContentFieldId",
14
+ component: "vc-field",
15
+ property: "mockedProperty",
16
+ variant: "text",
17
+ },
18
+ argTypes: {
19
+ ..._.pick(SchemaBaseArgTypes, ["id", "property", "label", "visibility", "tooltip", "horizontalSeparator"]),
20
+ component: {
21
+ description: "Component type.",
22
+ type: {
23
+ required: true,
24
+ name: "string",
25
+ },
26
+ table: {
27
+ type: {
28
+ summary: "vc-field",
29
+ },
30
+ defaultValue: {
31
+ summary: "vc-field",
32
+ },
33
+ },
34
+ },
35
+ variant: {
36
+ description: "Field variant.",
37
+ control: "radio",
38
+ options: ["date-ago", "date", "link", "text", "email"],
39
+ table: {
40
+ type: {
41
+ summary: "date-ago | date | link | text | email",
42
+ },
43
+ defaultValue: {
44
+ summary: "text",
45
+ },
46
+ },
47
+ },
48
+ copyable: {
49
+ description: "Whether the field is copyable or not.",
50
+ control: "boolean",
51
+ table: {
52
+ type: {
53
+ summary: "boolean",
54
+ },
55
+ defaultValue: {
56
+ summary: "false",
57
+ },
58
+ },
59
+ },
60
+ orientation: {
61
+ description: "Field orientation.",
62
+ control: "radio",
63
+ options: ["horizontal", "vertical"],
64
+ table: {
65
+ type: {
66
+ summary: "horizontal | vertical",
67
+ },
68
+ defaultValue: {
69
+ summary: "vertical",
70
+ },
71
+ },
72
+ },
73
+ aspectRatio: {
74
+ description: `Field columns aspect ratio.
75
+ Uses CSS flex-grow property.`,
76
+ control: "array",
77
+ table: {
78
+ type: {
79
+ summary: "[number, number]",
80
+ },
81
+ defaultValue: {
82
+ summary: "[1, 1]",
83
+ },
84
+ },
85
+ },
86
+ },
87
+ parameters: {
88
+ docs: {
89
+ canvas: {
90
+ sourceState: "none",
91
+ },
92
+ },
93
+ },
94
+ } satisfies Meta<FieldSchema>;
95
+
96
+ export const Template: StoryFn<FieldSchema> = (args) => ({
97
+ components: { page },
98
+ setup: () => {
99
+ const context = reactive({
100
+ item: {
101
+ mockedProperty: "I am a content field",
102
+ },
103
+ });
104
+ return { args, context };
105
+ },
106
+ template,
107
+ });
108
+
109
+ export const WithLabel: StoryFn<FieldSchema> = (args) => ({
110
+ components: { page },
111
+ setup: () => {
112
+ const context = reactive({
113
+ item: {
114
+ mockedProperty: "I am a content field",
115
+ },
116
+ });
117
+ return { args, context };
118
+ },
119
+ template,
120
+ });
121
+ WithLabel.args = {
122
+ label: "Field label",
123
+ };
124
+
125
+ export const WithTooltip = WithLabel.bind({});
126
+ WithTooltip.args = {
127
+ label: "Field label",
128
+ tooltip: "Field tooltip",
129
+ };
130
+
131
+ export const WithHorizontalOrientation = WithLabel.bind({});
132
+ WithHorizontalOrientation.storyName = "Horizontal Orientation";
133
+ WithHorizontalOrientation.args = {
134
+ label: "Field label",
135
+ orientation: "horizontal",
136
+ };
137
+
138
+ export const WithAspectRatio = WithLabel.bind({});
139
+ WithAspectRatio.storyName = "Horizontal Orientation With Aspect Ratio 1:2";
140
+ WithAspectRatio.args = {
141
+ label: "Field label",
142
+ orientation: "horizontal",
143
+ aspectRatio: [1, 2],
144
+ };
145
+
146
+ export const CopyableLink: StoryFn<FieldSchema> = (args) => ({
147
+ components: { page },
148
+ setup: () => {
149
+ const context = reactive({
150
+ item: {
151
+ mockedProperty: "https://virtocommerce.com/",
152
+ },
153
+ });
154
+ return { args, context };
155
+ },
156
+ template,
157
+ });
158
+ CopyableLink.args = {
159
+ label: "Field label",
160
+ variant: "link",
161
+ copyable: true,
162
+ };
163
+
164
+ export const DateAgo: StoryFn<FieldSchema> = (args) => ({
165
+ components: { page },
166
+ setup: () => {
167
+ const context = reactive({
168
+ item: {
169
+ mockedProperty: new Date("01.01.2024"),
170
+ },
171
+ });
172
+ return { args, context };
173
+ },
174
+ template,
175
+ });
176
+ DateAgo.args = {
177
+ label: "Field label",
178
+ variant: "date-ago",
179
+ };
180
+
181
+ export const SimpleDate: StoryFn<FieldSchema> = (args) => ({
182
+ components: { page },
183
+ setup: () => {
184
+ const context = reactive({
185
+ item: {
186
+ mockedProperty: new Date(),
187
+ },
188
+ });
189
+ return { args, context };
190
+ },
191
+ template,
192
+ });
193
+ SimpleDate.storyName = "Date";
194
+ SimpleDate.args = {
195
+ label: "Field label",
196
+ variant: "date",
197
+ };
198
+
199
+ export const Email: StoryFn<FieldSchema> = (args) => ({
200
+ components: { page },
201
+ setup: () => {
202
+ const context = reactive({
203
+ item: {
204
+ mockedProperty: "mail@seller.net",
205
+ },
206
+ });
207
+ return { args, context };
208
+ },
209
+ template,
210
+ });
211
+ Email.args = {
212
+ label: "Field label",
213
+ variant: "email",
214
+ };
215
+
216
+ export const WithVisibilityMethod: StoryFn<FieldSchema> = (args) => ({
217
+ components: { page },
218
+ setup: () => {
219
+ const isVisible = ref(false);
220
+ const toggle = () => {
221
+ isVisible.value = !isVisible.value;
222
+ };
223
+
224
+ const context = reactive({
225
+ item: {
226
+ mockedProperty: "I am a content field",
227
+ },
228
+ scope: {
229
+ visibilityFn: isVisible,
230
+ },
231
+ });
232
+ return { args, context, toggle };
233
+ },
234
+ template: templateWithVisibilityToggle,
235
+ });
236
+ WithVisibilityMethod.args = {
237
+ label: "Field label",
238
+ visibility: { method: "visibilityFn" },
239
+ };
240
+
241
+ export const WithHorizontalSeparator = Template.bind({});
242
+ WithHorizontalSeparator.args = {
243
+ label: "Field label",
244
+ horizontalSeparator: true,
245
+ };
@@ -0,0 +1,192 @@
1
+ import { Meta, StoryFn } from "@storybook/vue3";
2
+ import { template, templateWithVisibilityToggle } from "./common/templates";
3
+ import page from "./pages/DynamicRender";
4
+ import { reactive, ref } from "vue";
5
+ import { SchemaBaseArgTypes } from "./common/args";
6
+ import { EditorSchema } from "../../..";
7
+
8
+ export default {
9
+ title: "DynamicViews/molecules/VcEditor",
10
+ component: page,
11
+ args: {
12
+ id: "EditorId",
13
+ component: "vc-editor",
14
+ property: "mockedProperty",
15
+ },
16
+ argTypes: {
17
+ ...SchemaBaseArgTypes,
18
+ component: {
19
+ description: "Component type.",
20
+ type: {
21
+ required: true,
22
+ name: "string",
23
+ },
24
+ table: {
25
+ type: {
26
+ summary: "vc-field",
27
+ },
28
+ defaultValue: {
29
+ summary: "vc-field",
30
+ },
31
+ },
32
+ },
33
+ assetsFolder: {
34
+ description: "Assets folder for the editor image uploads.",
35
+ type: {
36
+ required: true,
37
+ name: "string",
38
+ },
39
+ table: {
40
+ type: {
41
+ summary: "string",
42
+ },
43
+ },
44
+ },
45
+ maxlength: {
46
+ description: "Maximum length of the editor content.",
47
+ control: "number",
48
+ table: {
49
+ type: {
50
+ summary: "number",
51
+ },
52
+ },
53
+ },
54
+ },
55
+ parameters: {
56
+ docs: {
57
+ canvas: {
58
+ sourceState: "none",
59
+ },
60
+ },
61
+ },
62
+ } satisfies Meta<EditorSchema>;
63
+
64
+ export const Template: StoryFn<EditorSchema> = (args) => ({
65
+ components: { page },
66
+ setup() {
67
+ const context = reactive({
68
+ item: {
69
+ id: "some-alpha-num-id",
70
+ mockedProperty: "I am an editor",
71
+ },
72
+ });
73
+ return { args, context };
74
+ },
75
+ template,
76
+ });
77
+
78
+ export const WithLabel = Template.bind({});
79
+ WithLabel.args = {
80
+ label: "Editor label",
81
+ };
82
+
83
+ export const WithTooltip = WithLabel.bind({});
84
+ WithTooltip.args = {
85
+ label: "Editor label",
86
+ tooltip: "I am a tooltip",
87
+ };
88
+
89
+ export const WithPlaceholder = Template.bind({});
90
+ WithPlaceholder.args = {
91
+ label: "Editor label",
92
+ placeholder: "I am a placeholder",
93
+ };
94
+
95
+ export const WithValidation: StoryFn<EditorSchema> = (args) => ({
96
+ components: { page },
97
+ setup() {
98
+ const context = reactive({
99
+ item: {
100
+ id: "some-alpha-num-id",
101
+ mockedProperty: null,
102
+ },
103
+ });
104
+ return { args, context };
105
+ },
106
+ template,
107
+ });
108
+ WithValidation.args = {
109
+ label: "Editor label",
110
+ rules: { required: true },
111
+ placeholder: "I am a placeholder",
112
+ };
113
+
114
+ export const WithDisabled: StoryFn<EditorSchema> = (args) => ({
115
+ components: { page },
116
+ setup() {
117
+ const context = reactive({
118
+ item: {
119
+ id: "some-alpha-num-id",
120
+ mockedProperty: "I am an editor",
121
+ },
122
+ scope: {
123
+ disabledFn: true,
124
+ },
125
+ });
126
+ return { args, context };
127
+ },
128
+ template,
129
+ });
130
+ WithDisabled.args = {
131
+ label: "Editor label",
132
+ disabled: {
133
+ method: "disabledFn",
134
+ },
135
+ };
136
+
137
+ export const WithVisibilityMethod: StoryFn<EditorSchema> = (args) => ({
138
+ components: { page },
139
+ setup() {
140
+ const isVisible = ref(false);
141
+ const toggle = () => {
142
+ isVisible.value = !isVisible.value;
143
+ };
144
+
145
+ const context = reactive({
146
+ item: {
147
+ id: "some-alpha-num-id",
148
+ mockedProperty: "I am an editor",
149
+ },
150
+ scope: {
151
+ visibilityFn: isVisible,
152
+ },
153
+ });
154
+ return { args, context, toggle };
155
+ },
156
+ template: templateWithVisibilityToggle,
157
+ });
158
+ WithVisibilityMethod.args = {
159
+ label: "Editor label",
160
+ visibility: {
161
+ method: "visibilityFn",
162
+ },
163
+ };
164
+
165
+ export const WithUpdateMethod: StoryFn<EditorSchema> = (args) => ({
166
+ components: { page },
167
+ setup() {
168
+ const context = reactive({
169
+ item: {
170
+ id: "some-alpha-num-id",
171
+ mockedProperty: undefined,
172
+ },
173
+ scope: {
174
+ updateFn: (value: string) => alert(`Value updated to: ${value}`),
175
+ },
176
+ });
177
+ return { args, context };
178
+ },
179
+ template,
180
+ });
181
+ WithUpdateMethod.args = {
182
+ label: "Editor label",
183
+ update: {
184
+ method: "updateFn",
185
+ },
186
+ };
187
+
188
+ export const WithHorizontalSeparator = Template.bind({});
189
+ WithHorizontalSeparator.args = {
190
+ label: "Editor label",
191
+ horizontalSeparator: true,
192
+ };