@vc-shell/framework 1.0.187 → 1.0.189

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/CHANGELOG.md +18 -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 +5907 -5885
  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 +4 -2
  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,186 @@
1
+ import { Meta, StoryFn } from "@storybook/vue3";
2
+ import Checkbox from "../Checkbox";
3
+ import { computed, reactive, ref } from "vue";
4
+ import page from "./pages/DynamicRender";
5
+ import { template, templateWithVisibilityToggle } from "./common/templates";
6
+ import * as _ from "lodash-es";
7
+ import { SchemaBaseArgTypes } from "./common/args";
8
+ import { CheckboxSchema } from "../../..";
9
+
10
+ export default {
11
+ title: "DynamicViews/atoms/VcCheckbox",
12
+ component: page,
13
+ args: {
14
+ id: "checkboxId",
15
+ component: "vc-checkbox",
16
+ content: "Checkbox text",
17
+ property: "mockedProperty",
18
+ },
19
+ argTypes: {
20
+ ..._.omit(SchemaBaseArgTypes, ["multilanguage", "placeholder"]),
21
+ component: {
22
+ description: "Component type.",
23
+ type: {
24
+ required: true,
25
+ name: "string",
26
+ },
27
+ table: {
28
+ type: {
29
+ summary: "vc-checkbox",
30
+ },
31
+ defaultValue: {
32
+ summary: "vc-checkbox",
33
+ },
34
+ },
35
+ },
36
+ content: {
37
+ description: `Checkbox text content.
38
+ Supports i18n keys.`,
39
+ type: {
40
+ required: true,
41
+ name: "string",
42
+ },
43
+ table: {
44
+ type: {
45
+ summary: "string",
46
+ },
47
+ },
48
+ },
49
+ trueValue: {
50
+ description: "Value when checkbox is checked.",
51
+ table: {
52
+ type: {
53
+ summary: "any",
54
+ },
55
+ defaultValue: {
56
+ summary: "true",
57
+ },
58
+ },
59
+ },
60
+ falseValue: {
61
+ description: "Value when checkbox is unchecked.",
62
+ table: {
63
+ type: {
64
+ summary: "any",
65
+ },
66
+ defaultValue: {
67
+ summary: "false",
68
+ },
69
+ },
70
+ },
71
+ },
72
+ parameters: {
73
+ docs: {
74
+ canvas: {
75
+ sourceState: "none",
76
+ },
77
+ },
78
+ },
79
+ } satisfies Meta<CheckboxSchema>;
80
+
81
+ export const Template: StoryFn<CheckboxSchema> = (args) => ({
82
+ components: { page },
83
+ setup: () => {
84
+ const context = reactive({
85
+ item: {
86
+ mockedProperty: true,
87
+ },
88
+ });
89
+
90
+ return { args, context };
91
+ },
92
+ template,
93
+ });
94
+
95
+ export const Disabled: StoryFn<CheckboxSchema> = (args) => ({
96
+ components: { page },
97
+ setup: () => {
98
+ const context = reactive({
99
+ item: {
100
+ mockedProperty: false,
101
+ },
102
+ scope: {
103
+ disabledFn: computed(() => true),
104
+ },
105
+ });
106
+ return { args, context };
107
+ },
108
+ template,
109
+ });
110
+ Disabled.args = {
111
+ disabled: {
112
+ method: "disabledFn",
113
+ },
114
+ };
115
+
116
+ export const Checked: StoryFn<CheckboxSchema> = (args) => ({
117
+ components: { page },
118
+ setup: () => {
119
+ const context = reactive({
120
+ item: {
121
+ mockedProperty: true,
122
+ },
123
+ });
124
+ return { args, context };
125
+ },
126
+ template,
127
+ });
128
+
129
+ export const WithVisibilityMethod: StoryFn<CheckboxSchema> = (args) => ({
130
+ components: { page },
131
+ setup: () => {
132
+ const isVisible = ref(false);
133
+ const toggle = () => {
134
+ isVisible.value = !isVisible.value;
135
+ };
136
+
137
+ const context = reactive({
138
+ item: {
139
+ mockedProperty: false,
140
+ },
141
+ scope: {
142
+ visibilityFn: isVisible,
143
+ },
144
+ });
145
+ return { args, context, toggle };
146
+ },
147
+ template: templateWithVisibilityToggle,
148
+ });
149
+ WithVisibilityMethod.args = {
150
+ visibility: {
151
+ method: "visibilityFn",
152
+ },
153
+ };
154
+
155
+ export const HorizontalSeparator = Template.bind({});
156
+ HorizontalSeparator.args = {
157
+ horizontalSeparator: true,
158
+ };
159
+
160
+ export const WithUpdateMethod: StoryFn<CheckboxSchema> = (args) => ({
161
+ components: { page },
162
+ setup: () => {
163
+ const context = reactive({
164
+ item: {
165
+ mockedProperty: false,
166
+ },
167
+ scope: {
168
+ updateFn: (value: string) => alert(`Value updated to: ${value}`),
169
+ },
170
+ });
171
+ return { args, context };
172
+ },
173
+ template,
174
+ });
175
+ WithUpdateMethod.args = {
176
+ update: {
177
+ method: "updateFn",
178
+ },
179
+ };
180
+
181
+ export const WithRequiredRule = Template.bind({});
182
+ WithRequiredRule.args = {
183
+ rules: {
184
+ required: true,
185
+ },
186
+ };
@@ -0,0 +1,246 @@
1
+ import { Meta, StoryFn } from "@storybook/vue3";
2
+ import ContentField from "../ContentField";
3
+ import { computed, reactive, ref } from "vue";
4
+ import page from "./pages/DynamicRender";
5
+ import { template, templateWithVisibilityToggle } from "./common/templates";
6
+ import * as _ from "lodash-es";
7
+ import { SchemaBaseArgTypes } from "./common/args";
8
+ import { FieldSchema } from "../../..";
9
+
10
+ export default {
11
+ title: "DynamicViews/molecules/VcField",
12
+ component: page,
13
+ args: {
14
+ id: "ContentFieldId",
15
+ component: "vc-field",
16
+ property: "mockedProperty",
17
+ variant: "text",
18
+ },
19
+ argTypes: {
20
+ ..._.pick(SchemaBaseArgTypes, ["id", "property", "label", "visibility", "tooltip", "horizontalSeparator"]),
21
+ component: {
22
+ description: "Component type.",
23
+ type: {
24
+ required: true,
25
+ name: "string",
26
+ },
27
+ table: {
28
+ type: {
29
+ summary: "vc-field",
30
+ },
31
+ defaultValue: {
32
+ summary: "vc-field",
33
+ },
34
+ },
35
+ },
36
+ variant: {
37
+ description: "Field variant.",
38
+ control: "radio",
39
+ options: ["date-ago", "date", "link", "text", "email"],
40
+ table: {
41
+ type: {
42
+ summary: "date-ago | date | link | text | email",
43
+ },
44
+ defaultValue: {
45
+ summary: "text",
46
+ },
47
+ },
48
+ },
49
+ copyable: {
50
+ description: "Whether the field is copyable or not.",
51
+ control: "boolean",
52
+ table: {
53
+ type: {
54
+ summary: "boolean",
55
+ },
56
+ defaultValue: {
57
+ summary: "false",
58
+ },
59
+ },
60
+ },
61
+ orientation: {
62
+ description: "Field orientation.",
63
+ control: "radio",
64
+ options: ["horizontal", "vertical"],
65
+ table: {
66
+ type: {
67
+ summary: "horizontal | vertical",
68
+ },
69
+ defaultValue: {
70
+ summary: "vertical",
71
+ },
72
+ },
73
+ },
74
+ aspectRatio: {
75
+ description: `Field columns aspect ratio.
76
+ Uses CSS flex-grow property.`,
77
+ control: "array",
78
+ table: {
79
+ type: {
80
+ summary: "[number, number]",
81
+ },
82
+ defaultValue: {
83
+ summary: "[1, 1]",
84
+ },
85
+ },
86
+ },
87
+ },
88
+ parameters: {
89
+ docs: {
90
+ canvas: {
91
+ sourceState: "none",
92
+ },
93
+ },
94
+ },
95
+ } satisfies Meta<FieldSchema>;
96
+
97
+ export const Template: StoryFn<FieldSchema> = (args) => ({
98
+ components: { page },
99
+ setup: () => {
100
+ const context = reactive({
101
+ item: {
102
+ mockedProperty: "I am a content field",
103
+ },
104
+ });
105
+ return { args, context };
106
+ },
107
+ template,
108
+ });
109
+
110
+ export const WithLabel: StoryFn<FieldSchema> = (args) => ({
111
+ components: { page },
112
+ setup: () => {
113
+ const context = reactive({
114
+ item: {
115
+ mockedProperty: "I am a content field",
116
+ },
117
+ });
118
+ return { args, context };
119
+ },
120
+ template,
121
+ });
122
+ WithLabel.args = {
123
+ label: "Field label",
124
+ };
125
+
126
+ export const WithTooltip = WithLabel.bind({});
127
+ WithTooltip.args = {
128
+ label: "Field label",
129
+ tooltip: "Field tooltip",
130
+ };
131
+
132
+ export const WithHorizontalOrientation = WithLabel.bind({});
133
+ WithHorizontalOrientation.storyName = "Horizontal Orientation";
134
+ WithHorizontalOrientation.args = {
135
+ label: "Field label",
136
+ orientation: "horizontal",
137
+ };
138
+
139
+ export const WithAspectRatio = WithLabel.bind({});
140
+ WithAspectRatio.storyName = "Horizontal Orientation With Aspect Ratio 1:2";
141
+ WithAspectRatio.args = {
142
+ label: "Field label",
143
+ orientation: "horizontal",
144
+ aspectRatio: [1, 2],
145
+ };
146
+
147
+ export const CopyableLink: StoryFn<FieldSchema> = (args) => ({
148
+ components: { page },
149
+ setup: () => {
150
+ const context = reactive({
151
+ item: {
152
+ mockedProperty: "https://virtocommerce.com/",
153
+ },
154
+ });
155
+ return { args, context };
156
+ },
157
+ template,
158
+ });
159
+ CopyableLink.args = {
160
+ label: "Field label",
161
+ variant: "link",
162
+ copyable: true,
163
+ };
164
+
165
+ export const DateAgo: StoryFn<FieldSchema> = (args) => ({
166
+ components: { page },
167
+ setup: () => {
168
+ const context = reactive({
169
+ item: {
170
+ mockedProperty: new Date("01.01.2024"),
171
+ },
172
+ });
173
+ return { args, context };
174
+ },
175
+ template,
176
+ });
177
+ DateAgo.args = {
178
+ label: "Field label",
179
+ variant: "date-ago",
180
+ };
181
+
182
+ export const SimpleDate: StoryFn<FieldSchema> = (args) => ({
183
+ components: { page },
184
+ setup: () => {
185
+ const context = reactive({
186
+ item: {
187
+ mockedProperty: new Date(),
188
+ },
189
+ });
190
+ return { args, context };
191
+ },
192
+ template,
193
+ });
194
+ SimpleDate.storyName = "Date";
195
+ SimpleDate.args = {
196
+ label: "Field label",
197
+ variant: "date",
198
+ };
199
+
200
+ export const Email: StoryFn<FieldSchema> = (args) => ({
201
+ components: { page },
202
+ setup: () => {
203
+ const context = reactive({
204
+ item: {
205
+ mockedProperty: "mail@seller.net",
206
+ },
207
+ });
208
+ return { args, context };
209
+ },
210
+ template,
211
+ });
212
+ Email.args = {
213
+ label: "Field label",
214
+ variant: "email",
215
+ };
216
+
217
+ export const WithVisibilityMethod: StoryFn<FieldSchema> = (args) => ({
218
+ components: { page },
219
+ setup: () => {
220
+ const isVisible = ref(false);
221
+ const toggle = () => {
222
+ isVisible.value = !isVisible.value;
223
+ };
224
+
225
+ const context = reactive({
226
+ item: {
227
+ mockedProperty: "I am a content field",
228
+ },
229
+ scope: {
230
+ visibilityFn: isVisible,
231
+ },
232
+ });
233
+ return { args, context, toggle };
234
+ },
235
+ template: templateWithVisibilityToggle,
236
+ });
237
+ WithVisibilityMethod.args = {
238
+ label: "Field label",
239
+ visibility: { method: "visibilityFn" },
240
+ };
241
+
242
+ export const WithHorizontalSeparator = Template.bind({});
243
+ WithHorizontalSeparator.args = {
244
+ label: "Field label",
245
+ horizontalSeparator: true,
246
+ };
@@ -0,0 +1,185 @@
1
+ import { Meta, StoryFn } from "@storybook/vue3";
2
+ import EditorField from "../EditorField";
3
+ import { template, templateWithVisibilityToggle } from "./common/templates";
4
+ import page from "./pages/DynamicRender";
5
+ import { nextTick, reactive, ref } from "vue";
6
+ import * as _ from "lodash-es";
7
+ import { SchemaBaseArgTypes } from "./common/args";
8
+ import { EditorSchema } from "../../..";
9
+
10
+ export default {
11
+ title: "DynamicViews/molecules/VcEditor",
12
+ component: page,
13
+ args: {
14
+ id: "EditorId",
15
+ component: "vc-editor",
16
+ property: "mockedProperty",
17
+ },
18
+ argTypes: {
19
+ ...SchemaBaseArgTypes,
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
+ assetsFolder: {
36
+ description: "Assets folder for the editor image uploads.",
37
+ type: {
38
+ required: true,
39
+ name: "string",
40
+ },
41
+ table: {
42
+ type: {
43
+ summary: "string",
44
+ },
45
+ },
46
+ },
47
+ },
48
+ parameters: {
49
+ docs: {
50
+ canvas: {
51
+ sourceState: "none",
52
+ },
53
+ },
54
+ },
55
+ } satisfies Meta<EditorSchema>;
56
+
57
+ export const Template: StoryFn<EditorSchema> = (args) => ({
58
+ components: { page },
59
+ setup() {
60
+ const context = reactive({
61
+ item: {
62
+ id: "some-alpha-num-id",
63
+ mockedProperty: "I am an editor",
64
+ },
65
+ });
66
+ return { args, context };
67
+ },
68
+ template,
69
+ });
70
+
71
+ export const WithLabel = Template.bind({});
72
+ WithLabel.args = {
73
+ label: "Editor label",
74
+ };
75
+
76
+ export const WithTooltip = WithLabel.bind({});
77
+ WithTooltip.args = {
78
+ label: "Editor label",
79
+ tooltip: "I am a tooltip",
80
+ };
81
+
82
+ export const WithPlaceholder = Template.bind({});
83
+ WithPlaceholder.args = {
84
+ label: "Editor label",
85
+ placeholder: "I am a placeholder",
86
+ };
87
+
88
+ export const WithValidation: StoryFn<EditorSchema> = (args) => ({
89
+ components: { page },
90
+ setup() {
91
+ const context = reactive({
92
+ item: {
93
+ id: "some-alpha-num-id",
94
+ mockedProperty: null,
95
+ },
96
+ });
97
+ return { args, context };
98
+ },
99
+ template,
100
+ });
101
+ WithValidation.args = {
102
+ label: "Editor label",
103
+ rules: { required: true },
104
+ placeholder: "I am a placeholder",
105
+ };
106
+
107
+ export const WithDisabled: StoryFn<EditorSchema> = (args) => ({
108
+ components: { page },
109
+ setup() {
110
+ const context = reactive({
111
+ item: {
112
+ id: "some-alpha-num-id",
113
+ mockedProperty: "I am an editor",
114
+ },
115
+ scope: {
116
+ disabledFn: true,
117
+ },
118
+ });
119
+ return { args, context };
120
+ },
121
+ template,
122
+ });
123
+ WithDisabled.args = {
124
+ label: "Editor label",
125
+ disabled: {
126
+ method: "disabledFn",
127
+ },
128
+ };
129
+
130
+ export const WithVisibilityMethod: StoryFn<EditorSchema> = (args) => ({
131
+ components: { page },
132
+ setup() {
133
+ const isVisible = ref(false);
134
+ const toggle = () => {
135
+ isVisible.value = !isVisible.value;
136
+ };
137
+
138
+ const context = reactive({
139
+ item: {
140
+ id: "some-alpha-num-id",
141
+ mockedProperty: "I am an editor",
142
+ },
143
+ scope: {
144
+ visibilityFn: isVisible,
145
+ },
146
+ });
147
+ return { args, context, toggle };
148
+ },
149
+ template: templateWithVisibilityToggle,
150
+ });
151
+ WithVisibilityMethod.args = {
152
+ label: "Editor label",
153
+ visibility: {
154
+ method: "visibilityFn",
155
+ },
156
+ };
157
+
158
+ export const WithUpdateMethod: StoryFn<EditorSchema> = (args) => ({
159
+ components: { page },
160
+ setup() {
161
+ const context = reactive({
162
+ item: {
163
+ id: "some-alpha-num-id",
164
+ mockedProperty: undefined,
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
+ label: "Editor label",
176
+ update: {
177
+ method: "updateFn",
178
+ },
179
+ };
180
+
181
+ export const WithHorizontalSeparator = Template.bind({});
182
+ WithHorizontalSeparator.args = {
183
+ label: "Editor label",
184
+ horizontalSeparator: true,
185
+ };