@vc-shell/framework 1.0.38 → 1.0.39

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 (142) hide show
  1. package/components/atoms/vc-badge/vc-badge.stories.ts +27 -0
  2. package/components/atoms/vc-badge/vc-badge.vue +63 -0
  3. package/components/atoms/vc-button/vc-button.stories.ts +34 -0
  4. package/components/atoms/vc-button/vc-button.vue +219 -0
  5. package/components/atoms/vc-card/vc-card.vue +137 -0
  6. package/components/atoms/vc-checkbox/vc-checkbox.stories.ts +25 -0
  7. package/components/atoms/vc-checkbox/vc-checkbox.vue +130 -0
  8. package/components/atoms/vc-col/vc-col.vue +22 -0
  9. package/components/atoms/vc-container/vc-container.stories.ts +31 -0
  10. package/components/atoms/vc-container/vc-container.vue +220 -0
  11. package/components/atoms/vc-hint/vc-hint.stories.ts +23 -0
  12. package/components/atoms/vc-hint/vc-hint.vue +11 -0
  13. package/components/atoms/vc-icon/vc-icon.stories.ts +32 -0
  14. package/components/atoms/vc-icon/vc-icon.vue +36 -0
  15. package/components/atoms/vc-image/vc-image.stories.ts +40 -0
  16. package/components/atoms/vc-image/vc-image.vue +122 -0
  17. package/components/atoms/vc-info-row/vc-info-row.vue +42 -0
  18. package/components/atoms/vc-label/vc-label.stories.ts +23 -0
  19. package/components/atoms/vc-label/vc-label.vue +49 -0
  20. package/components/atoms/vc-link/vc-link.stories.ts +30 -0
  21. package/components/atoms/vc-link/vc-link.vue +46 -0
  22. package/components/atoms/vc-loading/vc-loading.vue +30 -0
  23. package/components/atoms/vc-progress/vc-progress.stories.ts +25 -0
  24. package/components/atoms/vc-progress/vc-progress.vue +65 -0
  25. package/components/atoms/vc-row/vc-row.vue +13 -0
  26. package/components/atoms/vc-status/vc-status.stories.ts +26 -0
  27. package/components/atoms/vc-status/vc-status.vue +78 -0
  28. package/components/atoms/vc-status-icon/vc-status-icon.vue +21 -0
  29. package/components/atoms/vc-switch/vc-switch.stories.ts +27 -0
  30. package/components/atoms/vc-switch/vc-switch.vue +100 -0
  31. package/components/atoms/vc-widget/vc-widget.vue +85 -0
  32. package/components/index.ts +43 -0
  33. package/components/molecules/vc-breadcrumbs/_internal/vc-breadcrumbs-item/vc-breadcrumbs-item.vue +103 -0
  34. package/components/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.ts +39 -0
  35. package/components/molecules/vc-breadcrumbs/vc-breadcrumbs.vue +21 -0
  36. package/components/molecules/vc-editor/vc-editor.vue +117 -0
  37. package/components/molecules/vc-file-upload/vc-file-upload.vue +134 -0
  38. package/components/molecules/vc-form/vc-form.stories.ts +23 -0
  39. package/components/molecules/vc-form/vc-form.vue +5 -0
  40. package/components/molecules/vc-input/vc-input.stories.ts +26 -0
  41. package/components/molecules/vc-input/vc-input.vue +443 -0
  42. package/components/molecules/vc-multivalue/vc-multivalue.vue +447 -0
  43. package/components/molecules/vc-notification/vc-notification.vue +101 -0
  44. package/components/molecules/vc-pagination/vc-pagination.stories.ts +23 -0
  45. package/components/molecules/vc-pagination/vc-pagination.vue +169 -0
  46. package/components/molecules/vc-rating/vc-rating.stories.ts +23 -0
  47. package/components/molecules/vc-rating/vc-rating.vue +77 -0
  48. package/components/molecules/vc-select/vc-select.stories.ts +25 -0
  49. package/components/molecules/vc-select/vc-select.vue +402 -0
  50. package/components/molecules/vc-slider/vc-slider.vue +106 -0
  51. package/components/molecules/vc-textarea/vc-textarea.stories.ts +23 -0
  52. package/components/molecules/vc-textarea/vc-textarea.vue +155 -0
  53. package/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue +146 -0
  54. package/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue +148 -0
  55. package/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue +157 -0
  56. package/components/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue +110 -0
  57. package/components/organisms/vc-app/vc-app.stories.ts +75 -0
  58. package/components/organisms/vc-app/vc-app.vue +171 -0
  59. package/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue +126 -0
  60. package/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue +223 -0
  61. package/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue +67 -0
  62. package/components/organisms/vc-blade/vc-blade.stories.ts +46 -0
  63. package/components/organisms/vc-blade/vc-blade.vue +87 -0
  64. package/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +292 -0
  65. package/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue +123 -0
  66. package/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue +93 -0
  67. package/components/organisms/vc-gallery/vc-gallery.vue +186 -0
  68. package/components/organisms/vc-login-form/vc-login-form.stories.ts +55 -0
  69. package/components/organisms/vc-login-form/vc-login-form.vue +48 -0
  70. package/components/organisms/vc-popup/vc-popup.stories.ts +23 -0
  71. package/components/organisms/vc-popup/vc-popup.vue +97 -0
  72. package/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue +113 -0
  73. package/components/organisms/vc-table/_internal/vc-table-counter/vc-table-counter.vue +29 -0
  74. package/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue +152 -0
  75. package/components/organisms/vc-table/_internal/vc-table-mobile-item/vc-table-mobile-item.vue +272 -0
  76. package/components/organisms/vc-table/vc-table.stories.ts +99 -0
  77. package/components/organisms/vc-table/vc-table.vue +638 -0
  78. package/core/api/index.ts +1 -0
  79. package/core/api/platform.ts +8332 -0
  80. package/core/composables/index.ts +8 -0
  81. package/core/composables/useAutosave/index.ts +57 -0
  82. package/core/composables/useFunctions/debounce.ts +18 -0
  83. package/core/composables/useFunctions/delay.ts +7 -0
  84. package/core/composables/useFunctions/index.ts +21 -0
  85. package/core/composables/useFunctions/once.ts +14 -0
  86. package/core/composables/useFunctions/sleep.ts +4 -0
  87. package/core/composables/useFunctions/throttle.ts +17 -0
  88. package/core/composables/useI18n/index.ts +28 -0
  89. package/core/composables/useLogger/index.ts +24 -0
  90. package/core/composables/useNotifications/index.ts +116 -0
  91. package/core/composables/usePermissions/index.ts +32 -0
  92. package/core/composables/useSettings/index.ts +36 -0
  93. package/core/composables/useUser/index.ts +266 -0
  94. package/core/directives/autofocus/index.ts +9 -0
  95. package/core/directives/click-outside/index.ts +21 -0
  96. package/core/directives/index.ts +4 -0
  97. package/core/directives/loading/index.ts +28 -0
  98. package/core/directives/permissions/index.ts +20 -0
  99. package/core/plugins/index.ts +1 -0
  100. package/core/plugins/validation/index.ts +2 -0
  101. package/core/plugins/validation/rules.ts +196 -0
  102. package/core/types/index.ts +92 -0
  103. package/core/utilities/camelToSnake.ts +7 -0
  104. package/core/utilities/index.ts +1 -0
  105. package/dist/core/composables/useNotifications/index.d.ts +1 -1
  106. package/dist/core/composables/useNotifications/index.d.ts.map +1 -1
  107. package/dist/core/composables/useUser/index.d.ts +2 -2
  108. package/dist/core/composables/useUser/index.d.ts.map +1 -1
  109. package/dist/core/plugins/validation/index.d.ts.map +1 -1
  110. package/dist/core/types/index.d.ts +1 -1
  111. package/dist/core/types/index.d.ts.map +1 -1
  112. package/dist/framework.js +70 -97
  113. package/dist/framework.js.map +1 -1
  114. package/dist/shared/app-switcher/composables/useAppSwitcher/index.d.ts +1 -1
  115. package/dist/shared/app-switcher/composables/useAppSwitcher/index.d.ts.map +1 -1
  116. package/dist/shared/app-switcher/index.d.ts +2 -2
  117. package/dist/shared/app-switcher/index.d.ts.map +1 -1
  118. package/dist/shared/blade-navigation/composables/useBladeNavigation/index.d.ts +1 -1
  119. package/dist/shared/blade-navigation/composables/useBladeNavigation/index.d.ts.map +1 -1
  120. package/dist/shared/blade-navigation/types/index.d.ts +1 -1
  121. package/dist/shared/blade-navigation/types/index.d.ts.map +1 -1
  122. package/dist/style.css +1 -1
  123. package/dist/tsconfig.tsbuildinfo +1 -0
  124. package/dist/vite.config.d.ts.map +1 -1
  125. package/package.json +11 -8
  126. package/shared/app-switcher/components/index.ts +1 -0
  127. package/shared/app-switcher/components/vc-app-switcher/vc-app-switcher.vue +90 -0
  128. package/shared/app-switcher/composables/index.ts +1 -0
  129. package/shared/app-switcher/composables/useAppSwitcher/index.ts +54 -0
  130. package/shared/app-switcher/index.ts +14 -0
  131. package/shared/assets/components/assets-details/assets-details.vue +138 -0
  132. package/shared/assets/components/index.ts +1 -0
  133. package/shared/assets/index.ts +19 -0
  134. package/shared/assets/locales/en.json +29 -0
  135. package/shared/assets/locales/index.ts +2 -0
  136. package/shared/blade-navigation/components/index.ts +1 -0
  137. package/shared/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue +84 -0
  138. package/shared/blade-navigation/composables/index.ts +1 -0
  139. package/shared/blade-navigation/composables/useBladeNavigation/index.ts +216 -0
  140. package/shared/blade-navigation/index.ts +15 -0
  141. package/shared/blade-navigation/types/index.ts +52 -0
  142. package/shared/index.ts +16 -0
@@ -0,0 +1,272 @@
1
+ <template>
2
+ <div
3
+ class="relative flex flex-nowrap items-stretch transition duration-200"
4
+ :class="{ 'transition-none': isMoving }"
5
+ :style="`transform: translateX(${offsetX}px)`"
6
+ @click="$emit('click')"
7
+ @touchstart="touchStart"
8
+ @touchmove="touchMove"
9
+ @touchend="touchEnd"
10
+ @touchcancel="touchCancel"
11
+ >
12
+ <!-- Left swipe actions-->
13
+ <div
14
+ class="flex-shrink-0 w-[80px] flex flex-col [justify-content:stretch] bg-[#a9bfd2]"
15
+ v-if="leftSwipeActions && leftSwipeActions.length"
16
+ >
17
+ <div
18
+ class="flex grow basis-[1] flex-col justify-center items-center text-white"
19
+ :class="[`vc-table-mobile__item-action_${leftSwipeActions[0].variant}`]"
20
+ @click.stop="leftSwipeActions[0].clickHandler(item)"
21
+ >
22
+ <VcIcon :icon="leftSwipeActions[0].icon"></VcIcon>
23
+ <div class="mt-1 text-lg">
24
+ {{ leftSwipeActions[0].title }}
25
+ </div>
26
+ </div>
27
+ </div>
28
+
29
+ <div class="flex-shrink-0 w-full">
30
+ <!-- Mobile item slot content -->
31
+ <slot></slot>
32
+ </div>
33
+
34
+ <!-- Item actions -->
35
+ <div
36
+ class="flex-shrink-0 w-[80px] flex flex-col [justify-content:stretch] bg-[#a9bfd2]"
37
+ v-if="rightSwipeActions && rightSwipeActions.length"
38
+ >
39
+ <!-- First available action -->
40
+ <div
41
+ class="flex grow basis-[1] flex-col justify-center items-center text-white"
42
+ :class="[
43
+ `vc-table-mobile__item-action_${rightSwipeActions[0].variant}`,
44
+ ]"
45
+ @click.stop="rightSwipeActions[0].clickHandler(item)"
46
+ >
47
+ <VcIcon :icon="rightSwipeActions[0].icon"></VcIcon>
48
+ <div class="vc-table-mobile__item-action-text">
49
+ {{ rightSwipeActions[0].title }}
50
+ </div>
51
+ </div>
52
+
53
+ <!-- Second available action -->
54
+ <div
55
+ v-if="rightSwipeActions.length === 2"
56
+ class="flex grow basis-[1] flex-col justify-center items-center text-white"
57
+ :class="[
58
+ `vc-table-mobile__item-action_${rightSwipeActions[1].variant}`,
59
+ ]"
60
+ @click.stop="rightSwipeActions[1].clickHandler(item)"
61
+ >
62
+ <VcIcon :icon="rightSwipeActions[1].icon"></VcIcon>
63
+ <div class="mt-1 text-lg">
64
+ {{ rightSwipeActions[1].title }}
65
+ </div>
66
+ </div>
67
+
68
+ <!-- Other available actions -->
69
+ <template v-if="rightSwipeActions.length > 2">
70
+ <div
71
+ class="flex grow basis-[1] flex-col justify-center items-center text-white"
72
+ @click.stop="isActionsPopupVisible = true"
73
+ >
74
+ <VcIcon icon="fas fa-ellipsis-h"></VcIcon>
75
+ <div class="mt-1 text-lg">More</div>
76
+ </div>
77
+
78
+ <!-- Actions popup -->
79
+ <teleport to="body" v-if="isActionsPopupVisible">
80
+ <div
81
+ class="absolute left-0 top-0 right-0 bottom-0 bg-[rgba(107,121,135,0.15)] flex items-center justify-center z-[99]"
82
+ >
83
+ <div
84
+ class="bg-white rounded-[6px] overflow-hidden p-5 max-w-[80%] w-[350px] border border-solid border-[#eef0f2] box-border shadow-[1px_1px_22px_rgba(126,142,157,0.2)]"
85
+ >
86
+ <div class="flex w-full items-center">
87
+ <span
88
+ class="grow text-[#2e3d4e] text-[19px] font-semibold tracking-[-0.01em]"
89
+ >
90
+ {{ $t("All actions") }}
91
+ </span>
92
+ <VcIcon
93
+ class="text-[#c2d7e4]"
94
+ icon="fas fa-times-circle"
95
+ size="xl"
96
+ @click="isActionsPopupVisible = false"
97
+ ></VcIcon>
98
+ </div>
99
+
100
+ <div class="flex flex-wrap my-5 justify-between">
101
+ <div
102
+ v-for="(itemAction, i) in itemActions"
103
+ :key="i"
104
+ class="flex grow shrink-0 flex-col items-center text-[#319ed4] my-2 box-border p-1 max-w-[80px]"
105
+ @click="itemAction.clickHandler(item)"
106
+ >
107
+ <VcIcon :icon="itemAction.icon" size="xl"></VcIcon>
108
+ <div class="text-base mt-2 text-center">
109
+ {{ itemAction.title }}
110
+ </div>
111
+ </div>
112
+ </div>
113
+ </div>
114
+ </div>
115
+ </teleport>
116
+ </template>
117
+ </div>
118
+ </div>
119
+ </template>
120
+
121
+ <script lang="ts" setup>
122
+ import { computed, ref, watch } from "vue";
123
+ import { IActionBuilderResult } from "@/core/types";
124
+ import { VcIcon } from "@/components";
125
+
126
+ export interface Props {
127
+ item: {
128
+ id: string;
129
+ };
130
+ actionBuilder?: (item: { id: string }) => IActionBuilderResult[];
131
+ swipingItem?: string;
132
+ }
133
+
134
+ export interface Emits {
135
+ (event: "swipeStart", id: string): void;
136
+ }
137
+
138
+ const props = withDefaults(defineProps<Props>(), {
139
+ item: undefined,
140
+ actionBuilder: undefined,
141
+ swipingItem: null,
142
+ });
143
+
144
+ const emit = defineEmits<Emits>();
145
+ const offsetX = ref(0);
146
+ const startX = ref(0);
147
+ const startY = ref(0);
148
+ const startOffsetX = ref(0);
149
+ const isMoving = ref(false);
150
+ const threshold = 10;
151
+ const maxWidth = 80;
152
+ const isActionsPopupVisible = ref(false);
153
+ const itemActions = ref([]);
154
+
155
+ watch(
156
+ () => props.swipingItem,
157
+ (newVal) => {
158
+ if (newVal !== props.item.id) {
159
+ handleOffset();
160
+ }
161
+ }
162
+ );
163
+
164
+ const rightSwipeActions = computed(
165
+ () =>
166
+ itemActions.value &&
167
+ itemActions.value.length &&
168
+ itemActions.value.filter(
169
+ (actions: IActionBuilderResult) => !actions.leftActions
170
+ )
171
+ );
172
+ const leftSwipeActions = computed(
173
+ () =>
174
+ itemActions.value &&
175
+ itemActions.value.length &&
176
+ itemActions.value.filter(
177
+ (actions: IActionBuilderResult) => actions.leftActions
178
+ )
179
+ );
180
+
181
+ function handleOffset() {
182
+ if (
183
+ itemActions.value.some((action: IActionBuilderResult) => action.leftActions)
184
+ ) {
185
+ offsetX.value = -maxWidth;
186
+ startOffsetX.value = offsetX.value;
187
+ } else {
188
+ offsetX.value = 0;
189
+ startOffsetX.value = 0;
190
+ }
191
+ }
192
+
193
+ async function touchStart(e: TouchEvent): Promise<void> {
194
+ startX.value = e.touches[0].clientX;
195
+ startY.value = e.touches[0].clientY;
196
+ startOffsetX.value = offsetX.value;
197
+ isMoving.value = true;
198
+
199
+ if (!itemActions.value.length) {
200
+ if (typeof props.actionBuilder === "function") {
201
+ itemActions.value = props.actionBuilder(props.item);
202
+
203
+ handleOffset();
204
+ }
205
+ }
206
+ }
207
+
208
+ function touchMove(e: TouchEvent): void {
209
+ emit("swipeStart", props.item.id);
210
+ if (itemActions.value && itemActions.value.length) {
211
+ const deltaX = e.touches[0].clientX - startX.value;
212
+ const deltaY = e.touches[0].clientY - startY.value;
213
+
214
+ if (
215
+ Math.abs(deltaX) > threshold &&
216
+ (rightSwipeActions.value && rightSwipeActions.value.length
217
+ ? leftSwipeActions.value && leftSwipeActions.value.length
218
+ ? Math.abs(startOffsetX.value + deltaX) <= maxWidth * 2
219
+ : Math.abs(startOffsetX.value + deltaX) <= maxWidth
220
+ : Math.abs(startOffsetX.value + deltaX) <= maxWidth) &&
221
+ startOffsetX.value + deltaX < 0
222
+ ) {
223
+ if (Math.abs(deltaY) < threshold * 2) {
224
+ e.preventDefault();
225
+ }
226
+ offsetX.value = startOffsetX.value + deltaX;
227
+ }
228
+ }
229
+ }
230
+
231
+ function touchEnd(): void {
232
+ const absoluteOffsetX = Math.abs(offsetX.value);
233
+ if (absoluteOffsetX < maxWidth) {
234
+ offsetX.value = absoluteOffsetX < maxWidth / 2 ? 0 : -maxWidth;
235
+ } else {
236
+ offsetX.value =
237
+ absoluteOffsetX <= maxWidth * 2 - threshold * 2
238
+ ? -maxWidth
239
+ : -maxWidth * 2;
240
+ }
241
+
242
+ isMoving.value = false;
243
+ }
244
+
245
+ function touchCancel(): void {
246
+ const absoluteOffsetX = Math.abs(offsetX.value);
247
+ if (absoluteOffsetX < maxWidth) {
248
+ offsetX.value = absoluteOffsetX < maxWidth / 2 ? 0 : -maxWidth;
249
+ } else {
250
+ offsetX.value =
251
+ absoluteOffsetX <= maxWidth * 2 - threshold * 2
252
+ ? -maxWidth
253
+ : -maxWidth * 2;
254
+ }
255
+
256
+ isMoving.value = false;
257
+ }
258
+ </script>
259
+
260
+ <style lang="scss">
261
+ .vc-table-mobile__item {
262
+ &-action {
263
+ &_success {
264
+ @apply bg-[#87b563];
265
+ }
266
+
267
+ &_danger {
268
+ @apply bg-[#ff4a4a];
269
+ }
270
+ }
271
+ }
272
+ </style>
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Table component.
3
+ * @author Iurii A Taranov <me@flanker72.ru>
4
+ */
5
+ import { Story } from "@storybook/vue3";
6
+ import VcTable from "./vc-table.vue";
7
+ import VcHint from "../../atoms/vc-hint/vc-hint.vue";
8
+ import VcImage from "../../atoms/vc-image/vc-image.vue";
9
+
10
+ export default {
11
+ title: "organisms/vc-table",
12
+ component: VcTable,
13
+ };
14
+
15
+ const Template: Story = (args) => ({
16
+ components: { VcTable, VcHint, VcImage },
17
+ setup() {
18
+ return { args };
19
+ },
20
+ template: `
21
+ <div class="flex h-[400px] overflow-hidden">
22
+ <vc-table v-bind="args">
23
+ <template v-slot:item_img="itemData">
24
+ <vc-image aspect="1x1" size="auto" :bordered="true" :src="itemData.item.img"></vc-image>
25
+ </template>
26
+ <template v-slot:item_name="itemData">
27
+ <div class="flex flex-col">
28
+ <div>{{ itemData.item.name }}</div>
29
+ <vc-hint>{{ itemData.item.description }}</vc-hint>
30
+ </div>
31
+ </template>
32
+ </vc-table>
33
+ </div>
34
+ `,
35
+ });
36
+
37
+ export const Table = Template.bind({});
38
+ Table.storyName = "vc-table";
39
+ Table.args = {
40
+ multiselect: true,
41
+
42
+ columns: [
43
+ {
44
+ id: "img",
45
+ title: "Pic",
46
+ width: 60,
47
+ class: "pr-0",
48
+ },
49
+ {
50
+ id: "name",
51
+ title: "Name",
52
+ sortable: true,
53
+ },
54
+ {
55
+ id: "sku",
56
+ title: "SKU",
57
+ sortable: true,
58
+ width: 100,
59
+ },
60
+ ],
61
+
62
+ items: [
63
+ {
64
+ id: 1,
65
+ img: "/images/1.jpg",
66
+ name: "Lenovo IdeaCentre 310S-08",
67
+ description: "Physical",
68
+ sku: "990555005",
69
+ },
70
+ {
71
+ id: 2,
72
+ img: "/images/2.jpg",
73
+ name: "BLU Win HD LTE X150Q 8GB",
74
+ description: "Physical",
75
+ sku: "003578948",
76
+ },
77
+ {
78
+ id: 3,
79
+ img: "/images/3.jpg",
80
+ name: "Samsung Galaxy S6 SM-G920F 32GB",
81
+ description: "Physical",
82
+ sku: "334590-095",
83
+ },
84
+ {
85
+ id: 4,
86
+ img: "/images/4.jpg",
87
+ name: "DJI Phantom 3 Professional Quadcopter",
88
+ description: "Physical",
89
+ sku: "000545432",
90
+ },
91
+ {
92
+ id: 5,
93
+ img: "/images/5.jpg",
94
+ name: "3DR X8-M Octocopter for Visual-Spectr",
95
+ description: "Physical",
96
+ sku: "435344443",
97
+ },
98
+ ],
99
+ };