@vc-shell/framework 1.0.118 → 1.0.120
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -5770
- package/dist/framework.mjs +11063 -10935
- package/dist/index.css +1 -1
- package/dist/shared/modules/dynamic/components/factories.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/factories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Button.d.ts +8 -4
- package/dist/shared/modules/dynamic/components/fields/Button.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Card.d.ts +8 -4
- package/dist/shared/modules/dynamic/components/fields/Card.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Checkbox.d.ts +8 -4
- package/dist/shared/modules/dynamic/components/fields/Checkbox.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/ContentField.d.ts +8 -4
- package/dist/shared/modules/dynamic/components/fields/ContentField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts +8 -4
- package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts +8 -4
- package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Fieldset.d.ts +8 -4
- package/dist/shared/modules/dynamic/components/fields/Fieldset.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/GalleryField.d.ts +8 -4
- package/dist/shared/modules/dynamic/components/fields/GalleryField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/ImageField.d.ts +8 -4
- package/dist/shared/modules/dynamic/components/fields/ImageField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/InputCurrency.d.ts +8 -4
- package/dist/shared/modules/dynamic/components/fields/InputCurrency.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/InputField.d.ts +13 -9
- package/dist/shared/modules/dynamic/components/fields/InputField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/SelectField.d.ts +8 -4
- package/dist/shared/modules/dynamic/components/fields/SelectField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/StatusField.d.ts +8 -4
- package/dist/shared/modules/dynamic/components/fields/StatusField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/VideoField.d.ts +8 -4
- package/dist/shared/modules/dynamic/components/fields/VideoField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/props.d.ts +9 -5
- package/dist/shared/modules/dynamic/components/fields/props.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/nodeBuilder.d.ts +1 -1
- package/dist/shared/modules/dynamic/helpers/nodeBuilder.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/types/index.d.ts +120 -19
- package/dist/shared/modules/dynamic/types/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/types/models.d.ts +1 -0
- package/dist/shared/modules/dynamic/types/models.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/components/atoms/vc-checkbox/index.d.ts +13 -0
- package/dist/ui/components/atoms/vc-checkbox/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-checkbox/vc-checkbox.vue.d.ts +1 -0
- package/dist/ui/components/atoms/vc-checkbox/vc-checkbox.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-col/index.d.ts +1 -80
- package/dist/ui/components/atoms/vc-col/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-col/vc-col.vue.d.ts +3 -3
- package/dist/ui/components/atoms/vc-col/vc-col.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-row/index.d.ts +1 -52
- package/dist/ui/components/atoms/vc-row/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-row/vc-row.vue.d.ts +3 -3
- package/dist/ui/components/atoms/vc-row/vc-row.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-field/vc-field.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-multivalue/index.d.ts +3 -3
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts +3 -3
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts +3 -3
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-textarea/index.d.ts +13 -13
- package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts +3 -3
- package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-gallery/index.d.ts +6 -6
- package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-notification-dropdown/_internal/notification/notification.vue.d.ts +3 -14
- package/dist/ui/components/organisms/vc-notification-dropdown/_internal/notification/notification.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-mobile-item/vc-table-mobile-item.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
- package/package.json +4 -4
- package/shared/modules/dynamic/components/factories.ts +2 -1
- package/shared/modules/dynamic/components/fields/EditorField.ts +3 -6
- package/shared/modules/dynamic/components/fields/Fieldset.ts +12 -5
- package/shared/modules/dynamic/components/fields/GalleryField.ts +8 -5
- package/shared/modules/dynamic/components/fields/InputField.ts +25 -3
- package/shared/modules/dynamic/components/fields/props.ts +5 -5
- package/shared/modules/dynamic/helpers/nodeBuilder.ts +75 -34
- package/shared/modules/dynamic/types/index.ts +120 -19
- package/shared/modules/dynamic/types/models.ts +1 -0
- package/ui/components/atoms/vc-checkbox/vc-checkbox.vue +6 -0
- package/ui/components/atoms/vc-col/index.ts +1 -10
- package/ui/components/atoms/vc-col/vc-col.vue +10 -5
- package/ui/components/atoms/vc-image/vc-image.vue +1 -1
- package/ui/components/atoms/vc-label/vc-label.vue +1 -1
- package/ui/components/atoms/vc-row/index.ts +1 -10
- package/ui/components/atoms/vc-row/vc-row.vue +8 -1
- package/ui/components/molecules/vc-field/vc-field.vue +15 -15
- package/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue +1 -1
- package/ui/components/organisms/vc-gallery/vc-gallery.vue +24 -20
- package/ui/components/organisms/vc-notification-dropdown/_internal/notification/notification.vue +2 -4
- package/ui/components/organisms/vc-notification-dropdown/vc-notification-dropdown.vue +1 -1
- package/ui/components/organisms/vc-popup/vc-popup.vue +5 -0
- package/ui/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue +7 -5
- package/ui/components/organisms/vc-table/_internal/vc-table-mobile-item/vc-table-mobile-item.vue +11 -16
- package/ui/components/organisms/vc-table/vc-table.vue +33 -31
|
@@ -95,6 +95,7 @@ export type IStatusField = {
|
|
|
95
95
|
export type IInputField = {
|
|
96
96
|
props: ComponentProps<typeof VcInput> | IControlBaseProps;
|
|
97
97
|
options: IControlBaseOptions;
|
|
98
|
+
slots?: Partial<Pick<ComponentSlots<typeof VcInput>, "append" | "prepend" | "append-inner" | "prepend-inner">>;
|
|
98
99
|
} & FieldOpts<typeof VcInput>;
|
|
99
100
|
|
|
100
101
|
export type IContentField = {
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
:required="required"
|
|
11
11
|
>
|
|
12
12
|
<span>{{ label }}</span>
|
|
13
|
+
<template
|
|
14
|
+
v-if="tooltip"
|
|
15
|
+
#tooltip
|
|
16
|
+
>{{ tooltip }}</template
|
|
17
|
+
>
|
|
13
18
|
</VcLabel>
|
|
14
19
|
<label class="vc-checkbox__label">
|
|
15
20
|
<input
|
|
@@ -57,6 +62,7 @@ export interface Props {
|
|
|
57
62
|
trueValue?: boolean;
|
|
58
63
|
falseValue?: boolean;
|
|
59
64
|
label?: string;
|
|
65
|
+
tooltip?: string;
|
|
60
66
|
}
|
|
61
67
|
|
|
62
68
|
export interface Emits {
|
|
@@ -15,12 +15,17 @@ export interface Props {
|
|
|
15
15
|
withDefaults(defineProps<Props>(), {
|
|
16
16
|
size: "1",
|
|
17
17
|
});
|
|
18
|
+
|
|
19
|
+
defineSlots<{
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
+
default: (props: any) => any;
|
|
22
|
+
}>();
|
|
18
23
|
</script>
|
|
19
24
|
|
|
20
25
|
<style lang="scss">
|
|
21
|
-
.vc-col {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
+
// .vc-col {
|
|
27
|
+
// .vc-app_mobile & {
|
|
28
|
+
// @apply tw-grow #{!important};
|
|
29
|
+
// }
|
|
30
|
+
// }
|
|
26
31
|
</style>
|
|
@@ -4,10 +4,17 @@
|
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
defineSlots<{
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
default: (props: any) => any;
|
|
11
|
+
}>();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
7
14
|
<style lang="scss">
|
|
8
15
|
.vc-row {
|
|
9
16
|
.vc-app_mobile & {
|
|
10
|
-
display:
|
|
17
|
+
display: grid;
|
|
11
18
|
}
|
|
12
19
|
}
|
|
13
20
|
</style>
|
|
@@ -9,22 +9,22 @@
|
|
|
9
9
|
>{{ tooltip }}</template
|
|
10
10
|
></VcLabel
|
|
11
11
|
>
|
|
12
|
-
<div>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
</div>
|
|
12
|
+
<!-- <div> -->
|
|
13
|
+
<VcFieldType
|
|
14
|
+
:value="modelValue"
|
|
15
|
+
:type="type"
|
|
16
|
+
>
|
|
17
|
+
<VcButton
|
|
18
|
+
v-if="copyable"
|
|
19
|
+
icon="far fa-copy"
|
|
20
|
+
size="m"
|
|
21
|
+
class="tw-ml-2"
|
|
22
|
+
text
|
|
23
|
+
@click="copy(modelValue)"
|
|
24
|
+
></VcButton>
|
|
25
|
+
</VcFieldType>
|
|
27
26
|
</div>
|
|
27
|
+
<!-- </div> -->
|
|
28
28
|
</template>
|
|
29
29
|
|
|
30
30
|
<script lang="ts" setup>
|
package/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<template #title>
|
|
8
8
|
<div>
|
|
9
9
|
<span>{{ currentImage.name }} (</span>
|
|
10
|
-
<VcLink @click="copyLink(currentImage.url)">{{
|
|
10
|
+
<VcLink @click="copyLink(currentImage.url ?? '')">{{
|
|
11
11
|
t("COMPONENTS.ORGANISMS.VC_GALLERY.INTERNAL.VC_GALLERY_PREVIEW.COPY_IMAGE_LINK")
|
|
12
12
|
}}</VcLink>
|
|
13
13
|
<span>)</span>
|
|
@@ -175,7 +175,7 @@ function onItemDragStart(event: DragEvent, item: IImage) {
|
|
|
175
175
|
if (!props.disableDrag && !props.disabled) {
|
|
176
176
|
draggedItem.value = item;
|
|
177
177
|
draggedElement.value = event.target as HTMLElement;
|
|
178
|
-
event.dataTransfer
|
|
178
|
+
event.dataTransfer?.setData("text", "gallery_reorder");
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
|
|
@@ -185,33 +185,35 @@ function onItemDragOver(event: DragEvent) {
|
|
|
185
185
|
if (!props.disableDrag && !props.disabled && draggedItem.value && dropItem) {
|
|
186
186
|
event.preventDefault();
|
|
187
187
|
|
|
188
|
-
const containerOffset = galleryRef.value
|
|
188
|
+
const containerOffset = galleryRef.value?.getBoundingClientRect();
|
|
189
189
|
const dropItemOffset = dropItem.getBoundingClientRect();
|
|
190
190
|
|
|
191
|
-
if (draggedElement.value !== dropItem) {
|
|
191
|
+
if (draggedElement.value !== dropItem && containerOffset) {
|
|
192
192
|
const elementStyle = getComputedStyle(dropItem);
|
|
193
193
|
const dropItemOffsetWidth = dropItem.offsetWidth + parseFloat(elementStyle.marginLeft);
|
|
194
194
|
const targetLeft = dropItemOffset.left - containerOffset.left;
|
|
195
195
|
const columnCenter = dropItemOffset.left + dropItemOffsetWidth / 2;
|
|
196
196
|
|
|
197
|
-
reorderGalleryRef.value
|
|
198
|
-
|
|
197
|
+
if (reorderGalleryRef.value) {
|
|
198
|
+
reorderGalleryRef.value.style.top = dropItemOffset.top - containerOffset.top + "px";
|
|
199
|
+
reorderGalleryRef.value.style.height = dropItem.offsetHeight + "px";
|
|
199
200
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
201
|
+
if (event.pageX > columnCenter) {
|
|
202
|
+
reorderGalleryRef.value.style.left = targetLeft + dropItemOffsetWidth + "px";
|
|
203
|
+
dropPosition.value = 1;
|
|
204
|
+
} else {
|
|
205
|
+
reorderGalleryRef.value.style.left = targetLeft - parseFloat(elementStyle.marginLeft) + "px";
|
|
206
|
+
dropPosition.value = -1;
|
|
207
|
+
}
|
|
207
208
|
|
|
208
|
-
|
|
209
|
+
reorderGalleryRef.value.style.display = "block";
|
|
210
|
+
}
|
|
209
211
|
}
|
|
210
212
|
}
|
|
211
213
|
}
|
|
212
214
|
|
|
213
215
|
function onItemDragLeave(event: DragEvent) {
|
|
214
|
-
if (!props.disableDrag && !props.disabled && draggedItem.value) {
|
|
216
|
+
if (!props.disableDrag && !props.disabled && draggedItem.value && reorderGalleryRef.value) {
|
|
215
217
|
event.preventDefault();
|
|
216
218
|
|
|
217
219
|
reorderGalleryRef.value.style.display = "none";
|
|
@@ -241,10 +243,12 @@ function onItemDrop(event: DragEvent, item: IImage) {
|
|
|
241
243
|
updateOrder();
|
|
242
244
|
}
|
|
243
245
|
|
|
244
|
-
reorderGalleryRef.value.
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
if (reorderGalleryRef.value && draggedElement.value) {
|
|
247
|
+
reorderGalleryRef.value.style.display = "none";
|
|
248
|
+
draggedElement.value.draggable = false;
|
|
249
|
+
draggedItem.value = undefined;
|
|
250
|
+
dropPosition.value = undefined;
|
|
251
|
+
}
|
|
248
252
|
}
|
|
249
253
|
}
|
|
250
254
|
|
|
@@ -265,8 +269,8 @@ function findParentElement(element: HTMLElement) {
|
|
|
265
269
|
} else {
|
|
266
270
|
let parent = element.parentElement;
|
|
267
271
|
|
|
268
|
-
while (!parent.classList.contains("vc-gallery__item")) {
|
|
269
|
-
parent = parent
|
|
272
|
+
while (!(parent && parent.classList.contains("vc-gallery__item"))) {
|
|
273
|
+
parent = parent?.parentElement || null;
|
|
270
274
|
if (!parent) break;
|
|
271
275
|
}
|
|
272
276
|
return parent;
|
package/ui/components/organisms/vc-notification-dropdown/_internal/notification/notification.vue
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<template v-else>
|
|
8
8
|
<VcNotificationTemplate
|
|
9
9
|
:color="notificationStyle.color"
|
|
10
|
-
:title="notification.title"
|
|
10
|
+
:title="notification.title ?? ''"
|
|
11
11
|
:icon="notificationStyle.icon"
|
|
12
12
|
>
|
|
13
13
|
<VcHint
|
|
@@ -42,9 +42,7 @@ export interface Emits {
|
|
|
42
42
|
(event: "onClick"): void;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
const props =
|
|
46
|
-
notification: undefined,
|
|
47
|
-
});
|
|
45
|
+
const props = defineProps<Props>();
|
|
48
46
|
|
|
49
47
|
const emit = defineEmits<Emits>();
|
|
50
48
|
|
|
@@ -47,6 +47,11 @@ import VcPopupError from "./_internal/vc-popup-error/vc-popup-error.vue";
|
|
|
47
47
|
import { defineComponent, PropType } from "vue";
|
|
48
48
|
|
|
49
49
|
export default defineComponent({
|
|
50
|
+
components: {
|
|
51
|
+
VcIcon,
|
|
52
|
+
VcPopupWarning,
|
|
53
|
+
VcPopupError,
|
|
54
|
+
},
|
|
50
55
|
props: {
|
|
51
56
|
title: {
|
|
52
57
|
type: String,
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
|
|
59
59
|
<script lang="ts" setup>
|
|
60
60
|
import { ref, watch, computed, nextTick } from "vue";
|
|
61
|
-
import { offset, computePosition, ComputePositionReturn } from "@floating-ui/vue";
|
|
61
|
+
import { offset, computePosition, ComputePositionReturn, ReferenceElement } from "@floating-ui/vue";
|
|
62
62
|
|
|
63
63
|
export interface Props {
|
|
64
64
|
title?: string;
|
|
@@ -100,10 +100,12 @@ function openPanel(isMobile: boolean) {
|
|
|
100
100
|
if (!isMobile) {
|
|
101
101
|
if (isPanelVisible.value) {
|
|
102
102
|
nextTick(() => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
if (filterToggle.value && filterPanel.value) {
|
|
104
|
+
computePosition(filterToggle.value as ReferenceElement, filterPanel.value, {
|
|
105
|
+
placement: "bottom-end",
|
|
106
|
+
middleware: [offset(10)],
|
|
107
|
+
}).then((item) => (popper.value = item));
|
|
108
|
+
}
|
|
107
109
|
});
|
|
108
110
|
}
|
|
109
111
|
}
|
package/ui/components/organisms/vc-table/_internal/vc-table-mobile-item/vc-table-mobile-item.vue
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<div
|
|
18
18
|
class="tw-flex tw-grow tw-basis-[1] tw-flex-col tw-justify-center tw-items-center tw-text-white"
|
|
19
19
|
:class="[`vc-table-mobile__item-action_${leftSwipeActions[0].variant}`]"
|
|
20
|
-
@click.stop="leftSwipeActions[0].clickHandler(item)"
|
|
20
|
+
@click.stop="leftSwipeActions[0].clickHandler(item as T)"
|
|
21
21
|
>
|
|
22
22
|
<VcIcon :icon="leftSwipeActions[0].icon"></VcIcon>
|
|
23
23
|
<div class="tw-mt-1 tw-text-lg">
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
<div
|
|
41
41
|
class="tw-flex tw-grow tw-basis-[1] tw-flex-col tw-justify-center tw-items-center tw-text-white"
|
|
42
42
|
:class="[`vc-table-mobile__item-action_${rightSwipeActions[0].variant}`]"
|
|
43
|
-
@click.stop="rightSwipeActions[0].clickHandler(item)"
|
|
43
|
+
@click.stop="rightSwipeActions[0].clickHandler(item as T)"
|
|
44
44
|
>
|
|
45
45
|
<VcIcon :icon="rightSwipeActions[0].icon"></VcIcon>
|
|
46
46
|
<div class="vc-table-mobile__item-action-text">
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
v-if="rightSwipeActions.length === 2"
|
|
54
54
|
class="tw-flex tw-grow tw-basis-[1] tw-flex-col tw-justify-center tw-items-center tw-text-white"
|
|
55
55
|
:class="[`vc-table-mobile__item-action_${rightSwipeActions[1].variant}`]"
|
|
56
|
-
@click.stop="rightSwipeActions[1].clickHandler(item)"
|
|
56
|
+
@click.stop="rightSwipeActions[1].clickHandler(item as T)"
|
|
57
57
|
>
|
|
58
58
|
<VcIcon :icon="rightSwipeActions[1].icon"></VcIcon>
|
|
59
59
|
<div class="tw-mt-1 tw-text-lg">
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
v-for="(itemAction, i) in itemActions"
|
|
100
100
|
:key="i"
|
|
101
101
|
class="tw-flex tw-grow tw-shrink-0 tw-flex-col tw-items-center tw-text-[#319ed4] tw-my-2 tw-box-border tw-p-1 tw-max-w-[80px]"
|
|
102
|
-
@click="itemAction.clickHandler(item)"
|
|
102
|
+
@click="itemAction.clickHandler(item as T)"
|
|
103
103
|
>
|
|
104
104
|
<VcIcon
|
|
105
105
|
:icon="itemAction.icon"
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
</template>
|
|
120
120
|
|
|
121
121
|
<script lang="ts" setup generic="T extends TableItem | string">
|
|
122
|
-
import { computed, ref, watch } from "vue";
|
|
122
|
+
import { Ref, computed, ref, watch } from "vue";
|
|
123
123
|
import { IActionBuilderResult } from "./../../../../../../core/types";
|
|
124
124
|
import { useI18n } from "vue-i18n";
|
|
125
125
|
|
|
@@ -133,16 +133,11 @@ export interface TableItem {
|
|
|
133
133
|
actions?: IActionBuilderResult[];
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
const props =
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}>(),
|
|
142
|
-
{
|
|
143
|
-
swipingItem: null,
|
|
144
|
-
}
|
|
145
|
-
);
|
|
136
|
+
const props = defineProps<{
|
|
137
|
+
item: T;
|
|
138
|
+
actionBuilder?: (item: T) => IActionBuilderResult[];
|
|
139
|
+
swipingItem?: string;
|
|
140
|
+
}>();
|
|
146
141
|
|
|
147
142
|
const emit = defineEmits<Emits>();
|
|
148
143
|
const { t } = useI18n({ useScope: "global" });
|
|
@@ -154,7 +149,7 @@ const isMoving = ref(false);
|
|
|
154
149
|
const threshold = 10;
|
|
155
150
|
const maxWidth = 80;
|
|
156
151
|
const isActionsPopupVisible = ref(false);
|
|
157
|
-
const itemActions = ref([]);
|
|
152
|
+
const itemActions: Ref<IActionBuilderResult<T>[]> = ref([]);
|
|
158
153
|
|
|
159
154
|
watch(
|
|
160
155
|
() => props.swipingItem,
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
>
|
|
144
144
|
<div
|
|
145
145
|
class="tw-flex tw-items-center tw-flex-nowrap tw-truncate tw-px-3"
|
|
146
|
-
:class="tableAlignment[item.align]"
|
|
146
|
+
:class="item.align ? tableAlignment[item.align as keyof typeof tableAlignment] : ''"
|
|
147
147
|
>
|
|
148
148
|
<div class="tw-truncate">
|
|
149
149
|
<slot :name="`header_${item.id}`">{{ item.title }}</slot>
|
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
class="tw-sticky tw-h-[42px] tw-z-[1] tw-right-0 tw-top-0 tw-table-cell tw-align-middle tw-w-0"
|
|
188
188
|
>
|
|
189
189
|
<VcTableColumnSwitcher
|
|
190
|
-
:items="toggleCols"
|
|
190
|
+
:items="toggleCols.filter((col): col is ITableColumns => col !== undefined)"
|
|
191
191
|
@change="toggleColumn"
|
|
192
192
|
></VcTableColumnSwitcher>
|
|
193
193
|
</div>
|
|
@@ -547,8 +547,8 @@ const reorderRef = ref<HTMLElement | null>();
|
|
|
547
547
|
const tableRef = ref<HTMLElement | null>();
|
|
548
548
|
|
|
549
549
|
// event listeners
|
|
550
|
-
let columnResizeListener: (...args: any[]) => any = null;
|
|
551
|
-
let columnResizeEndListener: (...args: any[]) => any = null;
|
|
550
|
+
let columnResizeListener: ((...args: any[]) => any) | null = null;
|
|
551
|
+
let columnResizeEndListener: ((...args: any[]) => any) | null = null;
|
|
552
552
|
|
|
553
553
|
const selection = ref<T[]>([]) as Ref<T[]>;
|
|
554
554
|
const allSelected = ref(false);
|
|
@@ -732,9 +732,9 @@ function setActionToggleRefs(el: Element, id: string) {
|
|
|
732
732
|
|
|
733
733
|
function setTooltipArrowRefs(el: Element, id: string) {
|
|
734
734
|
if (el) {
|
|
735
|
-
const isExists = tooltipArrowRefs.value
|
|
735
|
+
const isExists = tooltipArrowRefs.value?.some((item) => item.id === id);
|
|
736
736
|
if (!isExists) {
|
|
737
|
-
tooltipArrowRefs.value
|
|
737
|
+
tooltipArrowRefs.value?.push({ element: el, id });
|
|
738
738
|
}
|
|
739
739
|
}
|
|
740
740
|
}
|
|
@@ -748,9 +748,9 @@ function showActions(item: T, index: string) {
|
|
|
748
748
|
|
|
749
749
|
selectedRow.value = item.id;
|
|
750
750
|
|
|
751
|
-
const toggleRef = actionToggleRefs.value.find((item) => item.id === index)
|
|
752
|
-
const tooltipRef = tooltipRefs.value.find((item) => item.id === index)
|
|
753
|
-
const tooltipArrowRef = tooltipArrowRefs.value
|
|
751
|
+
const toggleRef = actionToggleRefs.value.find((item) => item.id === index)?.element;
|
|
752
|
+
const tooltipRef = tooltipRefs.value.find((item) => item.id === index)?.element;
|
|
753
|
+
const tooltipArrowRef = tooltipArrowRefs.value?.find((item) => item.id === index)?.element;
|
|
754
754
|
|
|
755
755
|
if (toggleRef && tooltipRef && tooltipArrowRef) {
|
|
756
756
|
nextTick(() => {
|
|
@@ -868,42 +868,44 @@ function getOffset(element: HTMLElement) {
|
|
|
868
868
|
const rect = element.getBoundingClientRect();
|
|
869
869
|
const win = element.ownerDocument.defaultView;
|
|
870
870
|
return {
|
|
871
|
-
top: rect.top + win.
|
|
872
|
-
left: rect.left + win.
|
|
871
|
+
top: rect.top + ((win && win.scrollY) ?? 0),
|
|
872
|
+
left: rect.left + ((win && win.scrollX) ?? 0),
|
|
873
873
|
};
|
|
874
874
|
}
|
|
875
875
|
|
|
876
876
|
function onColumnResizeEnd() {
|
|
877
|
-
const delta = resizer.value.offsetLeft - lastResize.value;
|
|
877
|
+
const delta = resizer.value.offsetLeft - (lastResize.value ?? 0);
|
|
878
878
|
|
|
879
|
-
const columnElement: HTMLElement = table.value.querySelector(`#${resizeColumnElement.value
|
|
879
|
+
const columnElement: HTMLElement | null = table.value.querySelector(`#${resizeColumnElement.value?.id}`);
|
|
880
880
|
|
|
881
|
-
|
|
882
|
-
|
|
881
|
+
if (columnElement) {
|
|
882
|
+
const columnWidth = columnElement.offsetWidth;
|
|
883
|
+
const newColumnWidth = columnWidth + delta;
|
|
883
884
|
|
|
884
|
-
|
|
885
|
+
const minWidth = 15;
|
|
885
886
|
|
|
886
|
-
|
|
887
|
-
|
|
887
|
+
if (columnWidth + delta > parseInt(minWidth.toString(), 10) && resizeColumnElement.value) {
|
|
888
|
+
nextColumn.value = filteredCols.value[filteredCols.value.indexOf(resizeColumnElement.value) + 1];
|
|
888
889
|
|
|
889
|
-
|
|
890
|
-
|
|
890
|
+
if (nextColumn.value) {
|
|
891
|
+
const nextColElement = table.value.querySelector(`#${nextColumn.value.id}`);
|
|
891
892
|
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
893
|
+
const nextColumnWidth = (nextColElement as HTMLElement).offsetWidth - delta;
|
|
894
|
+
if (newColumnWidth > 15 && nextColumnWidth > 15) {
|
|
895
|
+
resizeTableCells(newColumnWidth, nextColumnWidth);
|
|
896
|
+
}
|
|
897
|
+
} else {
|
|
898
|
+
if (newColumnWidth > 15) {
|
|
899
|
+
resizeColumnElement.value.width = newColumnWidth + "px";
|
|
900
|
+
}
|
|
899
901
|
}
|
|
900
902
|
}
|
|
901
|
-
|
|
902
|
-
resizer.value.style.display = "none";
|
|
903
|
+
resizer.value.style.display = "none";
|
|
903
904
|
|
|
904
|
-
|
|
905
|
+
unbindColumnResizeEvents();
|
|
905
906
|
|
|
906
|
-
|
|
907
|
+
saveState();
|
|
908
|
+
}
|
|
907
909
|
}
|
|
908
910
|
|
|
909
911
|
function resizeTableCells(newColumnWidth: number, nextColumnWidth: number) {
|