@vc-shell/framework 1.0.153 → 1.0.154

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 (175) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/core/composables/useMenuService/index.ts +30 -24
  3. package/core/directives/loading/styles.css +1 -1
  4. package/core/types/index.ts +5 -1
  5. package/dist/core/composables/useMenuService/index.d.ts +2 -2
  6. package/dist/core/composables/useMenuService/index.d.ts.map +1 -1
  7. package/dist/core/types/index.d.ts +5 -1
  8. package/dist/core/types/index.d.ts.map +1 -1
  9. package/dist/framework.js +12655 -12557
  10. package/dist/index.css +1 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/shared/components/popup-handler/components/vc-popup-container/vc-popup-container.vue.d.ts.map +1 -1
  13. package/dist/shared/components/popup-handler/types/index.d.ts +2 -2
  14. package/dist/shared/components/popup-handler/types/index.d.ts.map +1 -1
  15. package/dist/shared/modules/dynamic/components/FIELD_MAP.d.ts.map +1 -1
  16. package/dist/shared/modules/dynamic/components/SchemaRender.d.ts +42 -3
  17. package/dist/shared/modules/dynamic/components/SchemaRender.d.ts.map +1 -1
  18. package/dist/shared/modules/dynamic/components/factories.d.ts +19 -17
  19. package/dist/shared/modules/dynamic/components/factories.d.ts.map +1 -1
  20. package/dist/shared/modules/dynamic/components/fields/Button.d.ts +15 -6
  21. package/dist/shared/modules/dynamic/components/fields/Button.d.ts.map +1 -1
  22. package/dist/shared/modules/dynamic/components/fields/Card.d.ts +14 -5
  23. package/dist/shared/modules/dynamic/components/fields/Card.d.ts.map +1 -1
  24. package/dist/shared/modules/dynamic/components/fields/Checkbox.d.ts +15 -6
  25. package/dist/shared/modules/dynamic/components/fields/Checkbox.d.ts.map +1 -1
  26. package/dist/shared/modules/dynamic/components/fields/ContentField.d.ts +15 -6
  27. package/dist/shared/modules/dynamic/components/fields/ContentField.d.ts.map +1 -1
  28. package/dist/shared/modules/dynamic/components/fields/CustomComponent.d.ts +137 -0
  29. package/dist/shared/modules/dynamic/components/fields/CustomComponent.d.ts.map +1 -0
  30. package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts +14 -5
  31. package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts.map +1 -1
  32. package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts +15 -6
  33. package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts.map +1 -1
  34. package/dist/shared/modules/dynamic/components/fields/Fieldset.d.ts +15 -6
  35. package/dist/shared/modules/dynamic/components/fields/Fieldset.d.ts.map +1 -1
  36. package/dist/shared/modules/dynamic/components/fields/GalleryField.d.ts +15 -6
  37. package/dist/shared/modules/dynamic/components/fields/GalleryField.d.ts.map +1 -1
  38. package/dist/shared/modules/dynamic/components/fields/ImageField.d.ts +15 -6
  39. package/dist/shared/modules/dynamic/components/fields/ImageField.d.ts.map +1 -1
  40. package/dist/shared/modules/dynamic/components/fields/InputCurrency.d.ts +15 -6
  41. package/dist/shared/modules/dynamic/components/fields/InputCurrency.d.ts.map +1 -1
  42. package/dist/shared/modules/dynamic/components/fields/InputField.d.ts +15 -6
  43. package/dist/shared/modules/dynamic/components/fields/InputField.d.ts.map +1 -1
  44. package/dist/shared/modules/dynamic/components/fields/MultivalueField.d.ts +15 -6
  45. package/dist/shared/modules/dynamic/components/fields/MultivalueField.d.ts.map +1 -1
  46. package/dist/shared/modules/dynamic/components/fields/RatingField.d.ts +137 -0
  47. package/dist/shared/modules/dynamic/components/fields/RatingField.d.ts.map +1 -0
  48. package/dist/shared/modules/dynamic/components/fields/SelectField.d.ts +15 -6
  49. package/dist/shared/modules/dynamic/components/fields/SelectField.d.ts.map +1 -1
  50. package/dist/shared/modules/dynamic/components/fields/StatusField.d.ts +15 -6
  51. package/dist/shared/modules/dynamic/components/fields/StatusField.d.ts.map +1 -1
  52. package/dist/shared/modules/dynamic/components/fields/SwitchField.d.ts +137 -0
  53. package/dist/shared/modules/dynamic/components/fields/SwitchField.d.ts.map +1 -0
  54. package/dist/shared/modules/dynamic/components/fields/Table.d.ts +137 -0
  55. package/dist/shared/modules/dynamic/components/fields/Table.d.ts.map +1 -0
  56. package/dist/shared/modules/dynamic/components/fields/TextareaField.d.ts +15 -6
  57. package/dist/shared/modules/dynamic/components/fields/TextareaField.d.ts.map +1 -1
  58. package/dist/shared/modules/dynamic/components/fields/VideoField.d.ts +15 -6
  59. package/dist/shared/modules/dynamic/components/fields/VideoField.d.ts.map +1 -1
  60. package/dist/shared/modules/dynamic/components/fields/props.d.ts +15 -6
  61. package/dist/shared/modules/dynamic/components/fields/props.d.ts.map +1 -1
  62. package/dist/shared/modules/dynamic/composables/index.d.ts +2 -0
  63. package/dist/shared/modules/dynamic/composables/index.d.ts.map +1 -1
  64. package/dist/shared/modules/dynamic/composables/useFilterBuilder/index.d.ts +1 -0
  65. package/dist/shared/modules/dynamic/composables/useFilterBuilder/index.d.ts.map +1 -1
  66. package/dist/shared/modules/dynamic/composables/useTableTemplates/index.d.ts +12 -0
  67. package/dist/shared/modules/dynamic/composables/useTableTemplates/index.d.ts.map +1 -0
  68. package/dist/shared/modules/dynamic/{helpers/toolbarReducer.d.ts → composables/useToolbarReducer/index.d.ts} +6 -5
  69. package/dist/shared/modules/dynamic/composables/useToolbarReducer/index.d.ts.map +1 -0
  70. package/dist/shared/modules/dynamic/factories/base/useDetailsFactory.d.ts +1 -1
  71. package/dist/shared/modules/dynamic/factories/base/useDetailsFactory.d.ts.map +1 -1
  72. package/dist/shared/modules/dynamic/factories/types/index.d.ts +2 -2
  73. package/dist/shared/modules/dynamic/factories/types/index.d.ts.map +1 -1
  74. package/dist/shared/modules/dynamic/helpers/nodeBuilder.d.ts.map +1 -1
  75. package/dist/shared/modules/dynamic/helpers/visibilityHandler.d.ts +4 -0
  76. package/dist/shared/modules/dynamic/helpers/visibilityHandler.d.ts.map +1 -0
  77. package/dist/shared/modules/dynamic/index.d.ts +2 -1
  78. package/dist/shared/modules/dynamic/index.d.ts.map +1 -1
  79. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts +15 -2
  80. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts.map +1 -1
  81. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts +14 -1
  82. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts.map +1 -1
  83. package/dist/shared/modules/dynamic/types/index.d.ts +138 -36
  84. package/dist/shared/modules/dynamic/types/index.d.ts.map +1 -1
  85. package/dist/shared/modules/dynamic/types/models.d.ts +13 -21
  86. package/dist/shared/modules/dynamic/types/models.d.ts.map +1 -1
  87. package/dist/shared/utilities/vueUtils.d.ts +1 -1
  88. package/dist/shared/utilities/vueUtils.d.ts.map +1 -1
  89. package/dist/tsconfig.tsbuildinfo +1 -1
  90. package/dist/ui/components/atoms/index.d.ts +0 -1
  91. package/dist/ui/components/atoms/index.d.ts.map +1 -1
  92. package/dist/ui/components/atoms/vc-col/vc-col.vue.d.ts +4 -4
  93. package/dist/ui/components/atoms/vc-label/vc-label.vue.d.ts.map +1 -1
  94. package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts.map +1 -1
  95. package/dist/ui/components/molecules/vc-field/_internal/vc-field-type/vc-field-type.vue.d.ts +1 -1
  96. package/dist/ui/components/molecules/vc-field/_internal/vc-field-type/vc-field-type.vue.d.ts.map +1 -1
  97. package/dist/ui/components/molecules/vc-field/vc-field.vue.d.ts +16 -2
  98. package/dist/ui/components/molecules/vc-field/vc-field.vue.d.ts.map +1 -1
  99. package/dist/ui/components/molecules/vc-input/vc-input.vue.d.ts +4 -4
  100. package/dist/ui/components/molecules/vc-input/vc-input.vue.d.ts.map +1 -1
  101. package/dist/ui/components/molecules/vc-rating/index.d.ts +1 -119
  102. package/dist/ui/components/molecules/vc-rating/index.d.ts.map +1 -1
  103. package/dist/ui/components/molecules/vc-rating/vc-rating.vue.d.ts +10 -3
  104. package/dist/ui/components/molecules/vc-rating/vc-rating.vue.d.ts.map +1 -1
  105. package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts.map +1 -1
  106. package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts +6 -6
  107. package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
  108. package/package.json +6 -6
  109. package/shared/components/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue +11 -11
  110. package/shared/components/popup-handler/components/vc-popup-container/vc-popup-container.vue +4 -1
  111. package/shared/components/popup-handler/types/index.ts +2 -5
  112. package/shared/modules/dynamic/components/FIELD_MAP.ts +8 -0
  113. package/shared/modules/dynamic/components/SchemaRender.ts +15 -5
  114. package/shared/modules/dynamic/components/factories.ts +53 -35
  115. package/shared/modules/dynamic/components/fields/Button.ts +1 -2
  116. package/shared/modules/dynamic/components/fields/Card.ts +15 -6
  117. package/shared/modules/dynamic/components/fields/Checkbox.ts +15 -16
  118. package/shared/modules/dynamic/components/fields/ContentField.ts +2 -2
  119. package/shared/modules/dynamic/components/fields/CustomComponent.ts +19 -0
  120. package/shared/modules/dynamic/components/fields/DynamicProperty.ts +1 -2
  121. package/shared/modules/dynamic/components/fields/EditorField.ts +11 -14
  122. package/shared/modules/dynamic/components/fields/Fieldset.ts +62 -68
  123. package/shared/modules/dynamic/components/fields/GalleryField.ts +1 -2
  124. package/shared/modules/dynamic/components/fields/ImageField.ts +1 -2
  125. package/shared/modules/dynamic/components/fields/InputCurrency.ts +11 -14
  126. package/shared/modules/dynamic/components/fields/InputField.ts +11 -14
  127. package/shared/modules/dynamic/components/fields/MultivalueField.ts +11 -14
  128. package/shared/modules/dynamic/components/fields/RatingField.ts +21 -0
  129. package/shared/modules/dynamic/components/fields/SelectField.ts +11 -14
  130. package/shared/modules/dynamic/components/fields/StatusField.ts +1 -4
  131. package/shared/modules/dynamic/components/fields/SwitchField.ts +22 -0
  132. package/shared/modules/dynamic/components/fields/Table.ts +58 -0
  133. package/shared/modules/dynamic/components/fields/TextareaField.ts +11 -14
  134. package/shared/modules/dynamic/components/fields/VideoField.ts +1 -2
  135. package/shared/modules/dynamic/components/fields/props.ts +1 -5
  136. package/shared/modules/dynamic/composables/index.ts +2 -0
  137. package/shared/modules/dynamic/composables/useFilterBuilder/index.ts +25 -26
  138. package/shared/modules/dynamic/composables/useTableTemplates/index.ts +63 -0
  139. package/shared/modules/dynamic/composables/useToolbarReducer/index.ts +71 -0
  140. package/shared/modules/dynamic/factories/base/useDetailsFactory.ts +2 -2
  141. package/shared/modules/dynamic/factories/types/index.ts +1 -1
  142. package/shared/modules/dynamic/helpers/nodeBuilder.ts +60 -39
  143. package/shared/modules/dynamic/helpers/visibilityHandler.ts +22 -0
  144. package/shared/modules/dynamic/index.ts +2 -1
  145. package/shared/modules/dynamic/pages/dynamic-blade-form.vue +47 -42
  146. package/shared/modules/dynamic/pages/dynamic-blade-list.vue +48 -88
  147. package/shared/modules/dynamic/types/index.ts +159 -34
  148. package/shared/modules/dynamic/types/models.ts +22 -21
  149. package/shared/utilities/vueUtils.ts +5 -1
  150. package/ui/components/atoms/index.ts +0 -1
  151. package/ui/components/atoms/vc-col/vc-col.vue +3 -3
  152. package/ui/components/atoms/vc-label/vc-label.vue +21 -7
  153. package/ui/components/molecules/vc-editor/vc-editor.vue +15 -7
  154. package/ui/components/molecules/vc-field/_internal/vc-field-type/vc-field-type.vue +22 -17
  155. package/ui/components/molecules/vc-field/vc-field.vue +48 -25
  156. package/ui/components/molecules/vc-input/vc-input.vue +7 -9
  157. package/ui/components/molecules/vc-multivalue/vc-multivalue.vue +1 -1
  158. package/ui/components/molecules/vc-rating/index.ts +1 -10
  159. package/ui/components/molecules/vc-rating/vc-rating.stories.ts +1 -1
  160. package/ui/components/molecules/vc-rating/vc-rating.vue +10 -5
  161. package/ui/components/molecules/vc-select/vc-select.vue +4 -5
  162. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue +1 -1
  163. package/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue +16 -24
  164. package/ui/components/organisms/vc-table/vc-table.vue +6 -5
  165. package/dist/shared/modules/dynamic/helpers/toolbarReducer.d.ts.map +0 -1
  166. package/dist/ui/components/atoms/vc-info-row/index.d.ts +0 -32
  167. package/dist/ui/components/atoms/vc-info-row/index.d.ts.map +0 -1
  168. package/dist/ui/components/atoms/vc-info-row/vc-info-row.stories.d.ts +0 -7
  169. package/dist/ui/components/atoms/vc-info-row/vc-info-row.stories.d.ts.map +0 -1
  170. package/dist/ui/components/atoms/vc-info-row/vc-info-row.vue.d.ts +0 -32
  171. package/dist/ui/components/atoms/vc-info-row/vc-info-row.vue.d.ts.map +0 -1
  172. package/shared/modules/dynamic/helpers/toolbarReducer.ts +0 -43
  173. package/ui/components/atoms/vc-info-row/index.ts +0 -3
  174. package/ui/components/atoms/vc-info-row/vc-info-row.stories.ts +0 -25
  175. package/ui/components/atoms/vc-info-row/vc-info-row.vue +0 -40
@@ -1,18 +1,9 @@
1
1
  <template>
2
- <!-- Normal -->
3
- <template v-if="type === 'normal'">
4
- <div class="tw-flex tw-flex-row tw-justify-stretch tw-truncate tw-mt-1">
5
- <div class="tw-truncate">
6
- <p>{{ value }}</p>
7
- </div>
8
- </div>
9
- </template>
10
-
11
2
  <!-- Text -->
12
3
  <template v-if="type === 'text'">
13
4
  <div class="tw-flex tw-flex-row tw-justify-stretch tw-truncate">
14
- <div class="tw-truncate">
15
- <VcHint class="!tw-text-s">{{ value }}</VcHint>
5
+ <div class="tw-text-wrap">
6
+ <p>{{ value }}</p>
16
7
  </div>
17
8
  </div>
18
9
  </template>
@@ -20,8 +11,8 @@
20
11
  <!-- Date -->
21
12
  <template v-if="type === 'date'">
22
13
  <div class="tw-flex tw-flex-row tw-justify-stretch tw-truncate">
23
- <div class="tw-truncate">
24
- <VcHint class="!tw-text-s"> {{ value.toLocaleDateString() }}</VcHint>
14
+ <div class="tw-text-wrap">
15
+ <p>{{ value.toLocaleDateString() }}</p>
25
16
  </div>
26
17
  </div>
27
18
  </template>
@@ -29,8 +20,8 @@
29
20
  <!-- Date ago -->
30
21
  <template v-if="type === 'date-ago'">
31
22
  <div class="tw-flex tw-flex-row tw-justify-stretch tw-truncate">
32
- <div class="tw-truncate">
33
- <VcHint class="!tw-text-s"> {{ moment(value).fromNow() ?? "N/A" }}</VcHint>
23
+ <div class="tw-text-wrap">
24
+ <p>{{ moment(value).fromNow() ?? "N/A" }}</p>
34
25
  </div>
35
26
  </div>
36
27
  </template>
@@ -38,7 +29,7 @@
38
29
  <!-- Link -->
39
30
  <template v-if="type === 'link'">
40
31
  <div class="tw-flex tw-flex-row tw-justify-stretch tw-truncate">
41
- <div class="tw-truncate">
32
+ <div class="tw-truncate tw-text-wrap">
42
33
  <VcLink
43
34
  class="vc-link !tw-text-s tw-truncate tw-w-full"
44
35
  @click="onLinkClick"
@@ -48,13 +39,27 @@
48
39
  <slot></slot>
49
40
  </div>
50
41
  </template>
42
+
43
+ <!-- Email -->
44
+ <template v-if="type === 'email'">
45
+ <div class="tw-flex tw-flex-row tw-justify-stretch tw-truncate">
46
+ <div class="tw-text-wrap">
47
+ <a
48
+ :href="`mailto:${value}`"
49
+ class="vc-link !tw-text-s tw-truncate tw-w-full"
50
+ >{{ value }}</a
51
+ >
52
+ </div>
53
+ <slot></slot>
54
+ </div>
55
+ </template>
51
56
  </template>
52
57
 
53
58
  <script lang="ts" setup>
54
59
  import moment from "moment";
55
60
 
56
61
  export interface Props {
57
- type: "text" | "date" | "date-ago" | "link" | "normal";
62
+ type: "text" | "date" | "date-ago" | "link" | "email";
58
63
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
64
  value: any;
60
65
  }
@@ -1,32 +1,44 @@
1
1
  <template>
2
- <div>
3
- <!-- Field label -->
4
- <VcLabel v-if="label">
5
- <span>{{ label }}</span>
6
- <template
7
- v-if="tooltip"
8
- #tooltip
9
- >{{ tooltip }}</template
10
- ></VcLabel
11
- >
12
- <VcFieldType
13
- :value="modelValue"
14
- :type="type"
15
- >
16
- <VcButton
17
- v-if="copyable"
18
- icon="far fa-copy"
19
- size="m"
20
- class="tw-ml-2"
21
- text
22
- @click="copy(modelValue)"
23
- ></VcButton>
24
- </VcFieldType>
2
+ <div
3
+ :class="[
4
+ {
5
+ 'tw-flex-col': orientation === 'vertical',
6
+ 'tw-flex-row tw-items-center': orientation === 'horizontal',
7
+ },
8
+ 'tw-flex ',
9
+ ]"
10
+ >
11
+ <VcCol :size="aspectRatio[0]">
12
+ <!-- Field label -->
13
+ <VcLabel v-if="label">
14
+ <span>{{ label }}</span>
15
+ <template
16
+ v-if="tooltip"
17
+ #tooltip
18
+ >{{ tooltip }}</template
19
+ ></VcLabel
20
+ >
21
+ </VcCol>
22
+ <VcCol :size="aspectRatio[1]">
23
+ <VcFieldType
24
+ :value="modelValue"
25
+ :type="type"
26
+ >
27
+ <VcButton
28
+ v-if="copyable"
29
+ icon="far fa-copy"
30
+ size="m"
31
+ class="tw-ml-2"
32
+ text
33
+ @click="copy(modelValue)"
34
+ ></VcButton>
35
+ </VcFieldType>
36
+ </VcCol>
25
37
  </div>
26
38
  </template>
27
39
 
28
40
  <script lang="ts" setup>
29
- import { VcLabel } from "./../../";
41
+ import { VcLabel, VcCol } from "./../../";
30
42
  import VcFieldType from "./_internal/vc-field-type/vc-field-type.vue";
31
43
 
32
44
  export interface Props {
@@ -41,7 +53,7 @@ export interface Props {
41
53
  /**
42
54
  * Field type
43
55
  */
44
- type?: "text" | "normal" | "date" | "date-ago" | "link";
56
+ type?: "text" | "date" | "date-ago" | "link" | "email";
45
57
  /**
46
58
  * Field content
47
59
  */
@@ -51,10 +63,21 @@ export interface Props {
51
63
  * Add button for field content copying
52
64
  */
53
65
  copyable?: boolean;
66
+ // TODO Add to documentation
67
+ /**
68
+ * Field orientation
69
+ */
70
+ orientation?: "horizontal" | "vertical";
71
+ /**
72
+ * Aspect ratio for columns
73
+ */
74
+ aspectRatio?: [number, number];
54
75
  }
55
76
 
56
77
  withDefaults(defineProps<Props>(), {
57
78
  type: "text",
79
+ orientation: "vertical",
80
+ aspectRatio: () => [1, 1],
58
81
  });
59
82
 
60
83
  function copy(value: string) {
@@ -264,7 +264,7 @@ export interface Emits {
264
264
  /**
265
265
  * Emitted when the component needs to change the model; Is also used by v-model
266
266
  */
267
- (event: "update:modelValue", value: string | number | Date | null): void;
267
+ (event: "update:modelValue", value: string | number | Date | null | undefined): void;
268
268
  }
269
269
 
270
270
  const props = withDefaults(defineProps<Props>(), {
@@ -342,14 +342,12 @@ const rawModel = computed(() => unref(props.modelValue));
342
342
  const mutatedModel = ref();
343
343
 
344
344
  watch(
345
- () => rawModel.value,
345
+ rawModel,
346
346
  (newVal) => {
347
- if (internalType.value === "datetime-local" || internalType.value === "date") {
348
- if (newVal instanceof Date && !isNaN(newVal.valueOf())) {
349
- mutatedModel.value = moment(newVal).format("YYYY-MM-DDTHH:mm");
350
- } else {
351
- mutatedModel.value = undefined;
352
- }
347
+ if (internalType.value === "datetime-local" && newVal instanceof Date && !isNaN(newVal.valueOf())) {
348
+ mutatedModel.value = moment(newVal).format("YYYY-MM-DDTHH:mm");
349
+ } else if (internalType.value === "date" && newVal instanceof Date && !isNaN(newVal.valueOf())) {
350
+ mutatedModel.value = moment(newVal).format("YYYY-MM-DD");
353
351
  } else {
354
352
  mutatedModel.value = newVal;
355
353
  }
@@ -376,7 +374,7 @@ function emitValue(val: string | number | Date | null) {
376
374
  if (mutatedModel.value !== val) {
377
375
  let value;
378
376
  if (internalType.value === "datetime-local" || internalType.value === "date") {
379
- value = moment(val).toDate();
377
+ value = val ? moment(val).toDate() : undefined;
380
378
  } else if (internalType.value === "number" && val !== null) {
381
379
  value = +val;
382
380
  } else {
@@ -63,7 +63,7 @@
63
63
  @click.stop="toggleDropdown"
64
64
  >Add +</VcButton
65
65
  >
66
- <teleport to="#app">
66
+ <teleport to="body">
67
67
  <div
68
68
  v-if="isOpened"
69
69
  ref="dropdownRef"
@@ -1,10 +1 @@
1
- import { VNode } from "vue";
2
- import _Rating from "./vc-rating.vue";
3
-
4
- export const VcRating = _Rating as typeof _Rating & {
5
- new (): {
6
- $slots: {
7
- details: () => VNode[];
8
- };
9
- };
10
- };
1
+ export { default as VcRating } from "./vc-rating.vue";
@@ -18,6 +18,6 @@ export const Primary: Story = {
18
18
  template: '<vc-rating v-bind="args"></vc-rating>',
19
19
  }),
20
20
  args: {
21
- rating: 4,
21
+ modelValue: 4,
22
22
  },
23
23
  };
@@ -15,16 +15,16 @@
15
15
  </VcLabel>
16
16
 
17
17
  <!-- Rating icon -->
18
- <template v-if="rating">
18
+ <template v-if="modelValue">
19
19
  <template v-if="variant == 'stars'">
20
20
  <VcIcon
21
- v-for="index in rating"
21
+ v-for="index in modelValue"
22
22
  :key="index"
23
23
  icon="fas fa-star"
24
24
  class="vc-rating__icon"
25
25
  ></VcIcon>
26
26
  <VcIcon
27
- v-for="index in max - rating"
27
+ v-for="index in max - modelValue"
28
28
  :key="index"
29
29
  icon="far fa-star"
30
30
  class="vc-rating__icon"
@@ -36,7 +36,7 @@
36
36
  icon="fas fa-star"
37
37
  class="vc-rating__icon"
38
38
  ></VcIcon>
39
- <span class="vc-rating__rating">{{ rating }}/{{ max }}</span>
39
+ <span class="vc-rating__rating">{{ modelValue }}/{{ max }}</span>
40
40
  <slot name="details"></slot>
41
41
  </template>
42
42
  </template>
@@ -47,18 +47,23 @@
47
47
  </template>
48
48
 
49
49
  <script lang="ts" setup>
50
+ import { VNode } from "vue";
50
51
  import { VcLabel, VcIcon } from "./../../";
51
52
 
52
53
  export interface Props {
53
54
  label?: string;
54
55
  placeholder?: string;
55
56
  tooltip?: string;
56
- rating: number;
57
+ modelValue: number;
57
58
  max?: number;
58
59
  variant?: "stars" | "star-and-text" | "text";
59
60
  }
60
61
 
61
62
  withDefaults(defineProps<Props>(), { max: 5, variant: "stars" });
63
+
64
+ defineSlots<{
65
+ details: VNode[];
66
+ }>();
62
67
  </script>
63
68
 
64
69
  <style lang="scss">
@@ -204,7 +204,7 @@
204
204
  </slot>
205
205
  </div>
206
206
 
207
- <teleport to="#app">
207
+ <teleport to="body">
208
208
  <div
209
209
  v-if="isOpened"
210
210
  ref="dropdownRef"
@@ -752,17 +752,16 @@ function isOptionSelected(opt: Option) {
752
752
  }
753
753
 
754
754
  function closeDropdown() {
755
+ onDropdownClose();
755
756
  isOpened.value = false;
756
757
  emit("close");
757
-
758
- onDropdownClose();
759
758
  }
760
759
 
761
760
  const onDropdownClose = async () => {
762
761
  if (props.options && typeof props.options === "function") {
763
- optionsList.value = (await props.options()).results as Option[];
762
+ optionsTemp.value = (await props.options()).results as Option[];
764
763
  } else {
765
- optionsList.value = props.options as Option[];
764
+ optionsTemp.value = props.options as Option[];
766
765
  }
767
766
 
768
767
  filterString.value = undefined;
@@ -22,7 +22,7 @@
22
22
  {{ title }}
23
23
  </div>
24
24
  </div>
25
- <teleport to="#app">
25
+ <teleport to="body">
26
26
  <div
27
27
  v-if="isDropActive"
28
28
  ref="bladeDropRef"
@@ -1,16 +1,17 @@
1
1
  <template>
2
2
  <div class="tw-relative tw-w-min tw-float-right tw-mr-4">
3
- <VcButton
4
- ref="referenceButton"
5
- small
6
- icon="fas fa-bars"
7
- @click.stop="isActive = !isActive"
8
- ></VcButton>
9
- <teleport to="#app">
3
+ <div ref="referenceButton">
4
+ <VcButton
5
+ small
6
+ icon="fas fa-bars"
7
+ @click.stop="isActive = !isActive"
8
+ ></VcButton>
9
+ </div>
10
+ <teleport to="body">
10
11
  <div
11
12
  v-if="isActive"
12
13
  ref="floatingDrop"
13
- v-on-click-outside="close"
14
+ v-on-click-outside="[close, { ignore: [referenceButton] }]"
14
15
  :style="floatingDropStyle"
15
16
  class="tw-flex tw-flex-col tw-box-border tw-max-h-[300px] tw-h-auto tw-z-10 tw-overflow-hidden tw-absolute tw-bg-white tw-border tw-border-solid tw-border-[#e5e7eb] tw-w-max tw-right-0"
16
17
  >
@@ -23,7 +24,7 @@
23
24
  v-for="item in items"
24
25
  :key="item.id"
25
26
  class="tw-flex tw-items-center tw-min-h-[30px] tw-box-border tw-rounded-[3px] tw-px-2 tw-cursor-pointer hover:tw-bg-[#eff7fc] tw-border-b"
26
- :class="{ 'tw-bg-[#eff7fc]': item.visible || !('visible' in item) }"
27
+ :class="{ 'tw-bg-[#eff7fc]': item.visible }"
27
28
  @click="selectItem(item)"
28
29
  >
29
30
  {{ item.title }}
@@ -36,7 +37,7 @@
36
37
  </template>
37
38
 
38
39
  <script lang="ts" setup>
39
- import { ref, computed } from "vue";
40
+ import { ref, computed, onMounted } from "vue";
40
41
  import { ITableColumns } from "./../../../../../../core/types";
41
42
  import { vOnClickOutside } from "@vueuse/components";
42
43
  import { useFloating, flip, shift, autoUpdate } from "@floating-ui/vue";
@@ -53,8 +54,8 @@ withDefaults(defineProps<Props>(), {});
53
54
  const emit = defineEmits<Emits>();
54
55
 
55
56
  const isActive = ref(false);
56
- const referenceButton = ref();
57
- const floatingDrop = ref();
57
+ const referenceButton = ref(null);
58
+ const floatingDrop = ref(null);
58
59
  const floater = useFloating(referenceButton, floatingDrop, {
59
60
  placement: "bottom-end",
60
61
  whileElementsMounted: autoUpdate,
@@ -69,20 +70,11 @@ const floatingDropStyle = computed(() => {
69
70
  });
70
71
 
71
72
  function selectItem(item: ITableColumns) {
72
- emit("change", isVisible(item));
73
+ emit("change", toggleVisibility(item));
73
74
  }
74
75
 
75
- function isVisible(item: ITableColumns) {
76
- if ("visible" in item) {
77
- if (item.visible) {
78
- item.visible = false;
79
- } else {
80
- item.visible = true;
81
- }
82
- } else {
83
- item.visible = false;
84
- }
85
-
76
+ function toggleVisibility(item: ITableColumns) {
77
+ item.visible = !item.visible;
86
78
  return item;
87
79
  }
88
80
 
@@ -325,7 +325,7 @@
325
325
  <td
326
326
  v-for="cell in filteredCols"
327
327
  :key="`${(typeof item === 'object' && 'id' in item && item.id) || itemIndex}_${cell.id}`"
328
- class="tw-box-border tw-overflow-hidden tw-px-3 [&~:not(.vc-image)]:tw-truncate"
328
+ class="tw-box-border tw-overflow-hidden tw-px-3 [&~:not(.vc-image):not(.vc-status)]:tw-truncate"
329
329
  :class="cell.class"
330
330
  :style="{ maxWidth: cell.width, width: cell.width }"
331
331
  >
@@ -524,7 +524,7 @@ interface ITableItemRef {
524
524
  const emit = defineEmits<{
525
525
  paginationClick: [page: number];
526
526
  selectionChanged: [values: T[]];
527
- "search:change": [value: string | number | Date | null];
527
+ "search:change": [value: string | number | Date | null | undefined];
528
528
  headerClick: [item: ITableColumns];
529
529
  value: [Record<string, unknown>];
530
530
  itemClick: [item: T];
@@ -672,9 +672,10 @@ watch(
672
672
  watch(
673
673
  () => props.columns,
674
674
  (newVal) => {
675
- defaultColumns.value = newVal;
675
+ restoreState();
676
676
 
677
677
  if (newVal.length !== state.value.length) {
678
+ defaultColumns.value = newVal.map((col) => ({ ...col, visible: col.visible ?? true }));
678
679
  saveState();
679
680
  }
680
681
  },
@@ -1032,12 +1033,12 @@ function restoreState() {
1032
1033
  console.debug("[@vc-shell/framewok#vc-table.vue] - Restore state");
1033
1034
  if (Object.keys(state.value).length) {
1034
1035
  defaultColumns.value = state.value.map((item) => {
1035
- const column = defaultColumns.value.find((x) => x.id === item.id);
1036
+ const column = props.columns.find((x) => x.id === item.id);
1036
1037
  if (column) {
1037
1038
  return {
1038
1039
  ...item,
1039
1040
  title: column.title,
1040
- visible: column.visible,
1041
+ // visible: column.visible,
1041
1042
  sortable: column.sortable,
1042
1043
  alwaysVisible: column.alwaysVisible,
1043
1044
  type: column.type,
@@ -1 +0,0 @@
1
- {"version":3,"file":"toolbarReducer.d.ts","sourceRoot":"","sources":["../../../../../shared/modules/dynamic/helpers/toolbarReducer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAiB,WAAW,EAAE,MAAM,KAAK,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3F,eAAO,MAAM,cAAc,SAAU;IACnC,oBAAoB,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IAChD,sBAAsB,EAAE,cAAc,CAAC,kBAAkB,CAAC,CAAC;IAC3D,mBAAmB,EAAE,cAAc,CAAC,kBAAkB,CAAC,CAAC;IACxD,OAAO,EAAE,iBAAiB,mBAAmB,CAAC,GAAG,iBAAiB,gBAAgB,CAAC,CAAC;CACrF,KAAG,iBAAiB,YAAY,aAAa,EAAE,CAAC,CAAC,GAAG,SA8BpD,CAAC"}
@@ -1,32 +0,0 @@
1
- export declare const VcInfoRow: import("vue").DefineComponent<{
2
- type: {
3
- type: import("vue").PropType<"default" | "email">;
4
- default: string;
5
- };
6
- label: {
7
- type: import("vue").PropType<string>;
8
- };
9
- tooltip: {
10
- type: import("vue").PropType<string>;
11
- };
12
- value: {
13
- type: import("vue").PropType<string | number>;
14
- };
15
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
16
- type: {
17
- type: import("vue").PropType<"default" | "email">;
18
- default: string;
19
- };
20
- label: {
21
- type: import("vue").PropType<string>;
22
- };
23
- tooltip: {
24
- type: import("vue").PropType<string>;
25
- };
26
- value: {
27
- type: import("vue").PropType<string | number>;
28
- };
29
- }>>, {
30
- type: "default" | "email";
31
- }, {}>;
32
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../ui/components/atoms/vc-info-row/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAA8B,CAAC"}
@@ -1,7 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import { VcInfoRow } from "./";
3
- declare const meta: Meta<typeof VcInfoRow>;
4
- export default meta;
5
- type Story = StoryObj<typeof VcInfoRow>;
6
- export declare const Primary: Story;
7
- //# sourceMappingURL=vc-info-row.stories.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vc-info-row.stories.d.ts","sourceRoot":"","sources":["../../../../../ui/components/atoms/vc-info-row/vc-info-row.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAE/B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,SAAS,CAGhC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,SAAS,CAAC,CAAC;AAExC,eAAO,MAAM,OAAO,EAAE,KAarB,CAAC"}
@@ -1,32 +0,0 @@
1
- export interface Props {
2
- label?: string;
3
- value?: string | number;
4
- tooltip?: string;
5
- type?: "default" | "email";
6
- }
7
- declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
8
- type: string;
9
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
10
- type: string;
11
- }>>>, {
12
- type: "default" | "email";
13
- }, {}>;
14
- export default _default;
15
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
16
- type __VLS_TypePropsToRuntimeProps<T> = {
17
- [K in keyof T]-?: {} extends Pick<T, K> ? {
18
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
19
- } : {
20
- type: import('vue').PropType<T[K]>;
21
- required: true;
22
- };
23
- };
24
- type __VLS_WithDefaults<P, D> = {
25
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
26
- default: D[K];
27
- }> : P[K];
28
- };
29
- type __VLS_Prettify<T> = {
30
- [K in keyof T]: T[K];
31
- } & {};
32
- //# sourceMappingURL=vc-info-row.vue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vc-info-row.vue.d.ts","sourceRoot":"","sources":["../../../../../ui/components/atoms/vc-info-row/vc-info-row.vue.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,KAAK;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;CAC5B;;;;;;;;AA2KD,wBAMG;AACH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAE1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QACxE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KACb,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AACN,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
@@ -1,43 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { IBladeToolbar } from "../../../../core/types";
3
- import * as _ from "lodash-es";
4
- import { UnwrapNestedRefs, computed, ref, ComputedRef } from "vue";
5
- import { SettingsSchema } from "../types";
6
- import { BaseBladeScope, DetailsBladeContext, ListBladeContext } from "../factories/types";
7
-
8
- export const toolbarReducer = (args: {
9
- defaultToolbarSchema: SettingsSchema["toolbar"];
10
- defaultToolbarBindings: BaseBladeScope["toolbarOverrides"];
11
- customToolbarConfig: BaseBladeScope["toolbarOverrides"];
12
- context: UnwrapNestedRefs<DetailsBladeContext> | UnwrapNestedRefs<ListBladeContext>;
13
- }): UnwrapNestedRefs<ComputedRef<IBladeToolbar[]>> | undefined => {
14
- if (!args) return;
15
- const toolbarMethodsMerge = _.merge(ref({}), ref(args.defaultToolbarBindings), ref(args.customToolbarConfig));
16
- return computed(() =>
17
- args.defaultToolbarSchema.reduce((acc, curr) => {
18
- const toolbarItemCtx = toolbarMethodsMerge.value[
19
- curr.method as keyof typeof toolbarMethodsMerge.value
20
- ] as IBladeToolbar;
21
- if (toolbarItemCtx) {
22
- const context =
23
- typeof toolbarItemCtx === "function"
24
- ? {
25
- clickHandler: async () => await (toolbarItemCtx as (ctx: typeof args.context) => any)(args.context),
26
- }
27
- : {
28
- ...toolbarItemCtx,
29
- clickHandler() {
30
- return toolbarItemCtx.clickHandler?.call(null, args.context);
31
- },
32
- };
33
-
34
- acc.push({
35
- ...curr,
36
- ...context,
37
- });
38
- }
39
-
40
- return acc;
41
- }, [] as IBladeToolbar[]),
42
- );
43
- };
@@ -1,3 +0,0 @@
1
- import _InfoRow from "./vc-info-row.vue";
2
-
3
- export const VcInfoRow = _InfoRow as typeof _InfoRow;
@@ -1,25 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import { VcInfoRow } from "./";
3
-
4
- const meta: Meta<typeof VcInfoRow> = {
5
- title: "atoms/VcInfoRow",
6
- component: VcInfoRow,
7
- };
8
-
9
- export default meta;
10
- type Story = StoryObj<typeof VcInfoRow>;
11
-
12
- export const Primary: Story = {
13
- render: (args) => ({
14
- components: { VcInfoRow },
15
- setup() {
16
- return { args };
17
- },
18
- template: '<vc-info-row v-bind="args"></vc-info-row>',
19
- }),
20
- args: {
21
- label: "Name",
22
- value: "This is my name",
23
- type: "default",
24
- },
25
- };