@vc-shell/framework 1.0.231 → 1.0.233
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 +36 -0
- package/core/types/index.ts +14 -1
- package/dist/core/types/index.d.ts +12 -2
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/framework.js +14875 -14580
- package/dist/index.css +1 -1
- package/dist/locales/en.json +8 -2
- package/dist/shared/components/notifications/components/notification-container/index.d.ts +1 -1
- package/dist/shared/components/user-dropdown-button/user-dropdown-button.vue.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/SchemaRender.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/GalleryField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/StatusField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/types/index.d.ts +10 -5
- package/dist/shared/modules/dynamic/types/index.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/components/atoms/vc-badge/vc-badge.stories.d.ts +187 -17
- package/dist/ui/components/atoms/vc-badge/vc-badge.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-badge/vc-badge.vue.d.ts +19 -3
- package/dist/ui/components/atoms/vc-badge/vc-badge.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-button/vc-button.stories.d.ts +91 -91
- package/dist/ui/components/atoms/vc-button/vc-button.vue.d.ts +1 -1
- package/dist/ui/components/atoms/vc-icon/vc-icon.stories.d.ts +9 -9
- package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts +1 -1
- package/dist/ui/components/atoms/vc-image/index.d.ts +12 -3
- package/dist/ui/components/atoms/vc-image/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-image/vc-image.stories.d.ts +12 -3
- package/dist/ui/components/atoms/vc-image/vc-image.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-image/vc-image.vue.d.ts +5 -1
- package/dist/ui/components/atoms/vc-image/vc-image.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-status/vc-status.stories.d.ts +7 -7
- package/dist/ui/components/atoms/vc-status/vc-status.vue.d.ts +2 -2
- package/dist/ui/components/atoms/vc-status/vc-status.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-widget/index.d.ts +6 -0
- package/dist/ui/components/atoms/vc-widget/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-widget/vc-widget.stories.d.ts +6 -0
- package/dist/ui/components/atoms/vc-widget/vc-widget.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-widget/vc-widget.vue.d.ts +1 -0
- package/dist/ui/components/atoms/vc-widget/vc-widget.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.d.ts +3 -3
- package/dist/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.vue.d.ts +1 -1
- package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-input/vc-input.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue.d.ts +1 -0
- package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue.d.ts +1 -0
- package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-app/vc-app.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue.d.ts +1 -1
- package/dist/ui/components/organisms/vc-blade/vc-blade.stories.d.ts +2 -0
- package/dist/ui/components/organisms/vc-blade/vc-blade.stories.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts +2 -0
- package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.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 +3 -0
- 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/components/app-switcher/components/vc-app-switcher/vc-app-switcher.vue +1 -1
- package/shared/components/user-dropdown-button/user-dropdown-button.vue +11 -3
- package/shared/modules/dynamic/components/SchemaRender.ts +0 -2
- package/shared/modules/dynamic/components/fields/Card.ts +1 -1
- package/shared/modules/dynamic/components/fields/GalleryField.ts +1 -0
- package/shared/modules/dynamic/components/fields/StatusField.ts +39 -3
- package/shared/modules/dynamic/pages/dynamic-blade-form.vue +17 -22
- package/shared/modules/dynamic/types/index.ts +15 -7
- package/ui/components/atoms/vc-badge/vc-badge.stories.ts +3 -3
- package/ui/components/atoms/vc-badge/vc-badge.vue +58 -10
- package/ui/components/atoms/vc-container/vc-container.vue +2 -2
- package/ui/components/atoms/vc-image/vc-image.vue +3 -1
- package/ui/components/atoms/vc-status/vc-status.vue +5 -2
- package/ui/components/atoms/vc-tooltip/vc-tooltip.vue +1 -1
- package/ui/components/atoms/vc-widget/vc-widget.vue +42 -22
- package/ui/components/molecules/vc-editor/vc-editor.vue +5 -1
- package/ui/components/molecules/vc-input/vc-input.vue +17 -2
- package/ui/components/molecules/vc-input-currency/vc-input-currency.vue +20 -0
- package/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue +1 -1
- package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue +21 -10
- package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue +3 -0
- package/ui/components/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue +59 -9
- package/ui/components/organisms/vc-app/vc-app.vue +0 -1
- package/ui/components/organisms/vc-blade/vc-blade.vue +89 -2
- package/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue +72 -56
- package/ui/components/organisms/vc-table/_internal/vc-table-mobile-item/vc-table-mobile-item.vue +27 -7
- package/ui/components/organisms/vc-table/vc-table.stories.ts +1 -1
- package/ui/components/organisms/vc-table/vc-table.vue +138 -62
package/ui/components/organisms/vc-table/_internal/vc-table-mobile-item/vc-table-mobile-item.vue
CHANGED
|
@@ -9,12 +9,21 @@
|
|
|
9
9
|
>
|
|
10
10
|
<div
|
|
11
11
|
ref="target"
|
|
12
|
-
class="tw-top-0 tw-left-0 tw-bottom-0 tw-right-0 tw-w-full tw-h-full tw-absolute tw-flex-shrink-0 tw-bg-white"
|
|
12
|
+
class="tw-top-0 tw-left-0 tw-bottom-0 tw-right-0 tw-w-full tw-h-full tw-absolute tw-flex-shrink-0 tw-bg-white tw-flex tw-flex-row"
|
|
13
13
|
:class="{ animated: !isSwiping, 'vc-table-mobile__item_selected': isSelected }"
|
|
14
14
|
:style="{ left }"
|
|
15
15
|
>
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
<div
|
|
17
|
+
v-if="anySelected"
|
|
18
|
+
class="tw-pl-4 tw-flex tw-items-center tw-justify-center tw-border-b tw-border-solid tw-border-b-[#e3e7ec]"
|
|
19
|
+
>
|
|
20
|
+
<VcCheckbox :model-value="unref(isSelected ?? false)"></VcCheckbox>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="tw-flex-1 tw-w-full">
|
|
23
|
+
<div class="tw-flex tw-flex-col tw-h-full tw-border-b tw-border-solid tw-border-b-[#e3e7ec]">
|
|
24
|
+
<slot></slot>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
18
27
|
</div>
|
|
19
28
|
<div class="tw-flex tw-justify-between tw-flex-auto">
|
|
20
29
|
<!-- Left swipe actions -->
|
|
@@ -116,10 +125,10 @@
|
|
|
116
125
|
</template>
|
|
117
126
|
|
|
118
127
|
<script lang="ts" setup generic="T extends TableItem | string">
|
|
119
|
-
import { Ref, computed, ref, onMounted, watch, onUpdated,
|
|
128
|
+
import { Ref, computed, ref, onMounted, watch, onUpdated, unref } from "vue";
|
|
120
129
|
import { IActionBuilderResult } from "../../../../../../core/types";
|
|
121
130
|
import { useI18n } from "vue-i18n";
|
|
122
|
-
import { useSwipe, watchDebounced } from "@vueuse/core";
|
|
131
|
+
import { useElementVisibility, useSwipe, watchDebounced } from "@vueuse/core";
|
|
123
132
|
import { vOnClickOutside } from "@vueuse/components";
|
|
124
133
|
|
|
125
134
|
export interface Emits {
|
|
@@ -139,6 +148,7 @@ const props = defineProps<{
|
|
|
139
148
|
swipingItem?: string;
|
|
140
149
|
isSelected?: boolean;
|
|
141
150
|
index: number;
|
|
151
|
+
selection?: T[];
|
|
142
152
|
}>();
|
|
143
153
|
|
|
144
154
|
const emit = defineEmits<Emits>();
|
|
@@ -150,6 +160,8 @@ const target = ref<HTMLElement | null>(null);
|
|
|
150
160
|
const container = ref<HTMLElement | null>(null);
|
|
151
161
|
const containerWidth = computed(() => container.value?.offsetWidth);
|
|
152
162
|
const left = ref("0");
|
|
163
|
+
const anySelected = computed(() => props.selection && props.selection.length > 0);
|
|
164
|
+
const targetIsVisible = useElementVisibility(container);
|
|
153
165
|
|
|
154
166
|
const actionsWidth = ref("0");
|
|
155
167
|
|
|
@@ -193,14 +205,16 @@ const { isSwiping, lengthX } = useSwipe(target, {
|
|
|
193
205
|
|
|
194
206
|
const rightSwipeActions = computed(
|
|
195
207
|
() =>
|
|
196
|
-
(
|
|
208
|
+
(props.selection?.length === 0 &&
|
|
209
|
+
itemActions.value &&
|
|
197
210
|
itemActions.value.length &&
|
|
198
211
|
itemActions.value.filter((actions: IActionBuilderResult) => actions.position === "right")) ||
|
|
199
212
|
undefined,
|
|
200
213
|
);
|
|
201
214
|
const leftSwipeActions = computed(
|
|
202
215
|
() =>
|
|
203
|
-
(
|
|
216
|
+
(props.selection?.length === 0 &&
|
|
217
|
+
itemActions.value &&
|
|
204
218
|
itemActions.value.length &&
|
|
205
219
|
itemActions.value.filter((actions: IActionBuilderResult) => actions.position === "left")) ||
|
|
206
220
|
undefined,
|
|
@@ -233,6 +247,8 @@ watchDebounced(
|
|
|
233
247
|
{ deep: true, debounce: 450 },
|
|
234
248
|
);
|
|
235
249
|
|
|
250
|
+
watch(() => targetIsVisible.value, adjustHeight);
|
|
251
|
+
|
|
236
252
|
function reset() {
|
|
237
253
|
left.value = "0";
|
|
238
254
|
actionsWidth.value = "0";
|
|
@@ -264,6 +280,10 @@ function handleHold() {
|
|
|
264
280
|
}
|
|
265
281
|
|
|
266
282
|
function handleClick() {
|
|
283
|
+
if (anySelected.value) {
|
|
284
|
+
emit("select");
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
267
287
|
emit("click");
|
|
268
288
|
}
|
|
269
289
|
</script>
|
|
@@ -1,14 +1,71 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
v-loading="unref(loading) || columnsInit"
|
|
4
|
-
class="tw-relative tw-overflow-hidden tw-flex tw-flex-col tw-grow tw-basis-0 tw-border
|
|
4
|
+
class="tw-relative tw-overflow-hidden tw-flex tw-flex-col tw-grow tw-basis-0 tw-border-[color:#eef0f2] tw-border-solid tw-border-t-0"
|
|
5
5
|
>
|
|
6
|
+
<div
|
|
7
|
+
v-if="$isMobile.value && selection.length > 0"
|
|
8
|
+
class="tw-flex tw-flex-col"
|
|
9
|
+
>
|
|
10
|
+
<div
|
|
11
|
+
class="tw-flex tw-flex-row tw-items-center tw-justify-between tw-px-4 tw-py-2 tw-min-h-[56px] tw-font-bold tw-text-lg tw-border-[color:#eef0f2] tw-border-b tw-border-solid tw-box-border"
|
|
12
|
+
>
|
|
13
|
+
<div class="tw-flex tw-flex-row tw-w-full tw-justify-between">
|
|
14
|
+
<div class="tw-flex tw-flex-row tw-items-center tw-justify-center tw-gap-3">
|
|
15
|
+
<VcCheckbox
|
|
16
|
+
v-model="headerCheckbox"
|
|
17
|
+
class="tw-font-normal tw-self-center tw-flex"
|
|
18
|
+
@click.stop
|
|
19
|
+
>{{ $t("COMPONENTS.ORGANISMS.VC_TABLE.SELECT_ALL_TRUNCATED") }}</VcCheckbox
|
|
20
|
+
>
|
|
21
|
+
{{ $t("COMPONENTS.ORGANISMS.VC_TABLE.SELECTED") }}: {{ selection.length }}
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<VcButton
|
|
25
|
+
text
|
|
26
|
+
@click="() => (selection = [])"
|
|
27
|
+
>{{ $t("COMPONENTS.ORGANISMS.VC_TABLE.CANCEL") }}</VcButton
|
|
28
|
+
>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
<div
|
|
32
|
+
v-if="selectAll && showSelectionChoice"
|
|
33
|
+
class="tw-w-full tw-flex tw-py-2"
|
|
34
|
+
>
|
|
35
|
+
<div class="tw-w-full tw-flex tw-items-center tw-justify-center">
|
|
36
|
+
<div>
|
|
37
|
+
{{
|
|
38
|
+
allSelected
|
|
39
|
+
? t("COMPONENTS.ORGANISMS.VC_TABLE.ALL_SELECTED")
|
|
40
|
+
: t("COMPONENTS.ORGANISMS.VC_TABLE.CURRENT_PAGE_SELECTED")
|
|
41
|
+
}}
|
|
42
|
+
<VcButton
|
|
43
|
+
text
|
|
44
|
+
class="tw-text-[13px]"
|
|
45
|
+
@click="handleSelectAll"
|
|
46
|
+
>{{
|
|
47
|
+
allSelected ? t("COMPONENTS.ORGANISMS.VC_TABLE.CANCEL") : t("COMPONENTS.ORGANISMS.VC_TABLE.SELECT_ALL")
|
|
48
|
+
}}</VcButton
|
|
49
|
+
>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
6
55
|
<!-- Header slot with filter and searchbar -->
|
|
7
56
|
<slot
|
|
8
|
-
v-if="
|
|
57
|
+
v-else-if="
|
|
58
|
+
($slots['header'] || header) && (!columnsInit || searchValue || searchValue === '' || activeFilterCount)
|
|
59
|
+
"
|
|
9
60
|
name="header"
|
|
10
61
|
>
|
|
11
|
-
<div
|
|
62
|
+
<div
|
|
63
|
+
class="tw-shrink-0 tw-flex tw-items-center tw-justify-between tw-box-border"
|
|
64
|
+
:class="{
|
|
65
|
+
'tw-px-4 tw-py-2 tw-border-[color:#eef0f2] tw-border-solid tw-border-b ': $isMobile.value,
|
|
66
|
+
'tw-p-4': $isDesktop.value,
|
|
67
|
+
}"
|
|
68
|
+
>
|
|
12
69
|
<!-- Table filter mobile button -->
|
|
13
70
|
<div
|
|
14
71
|
v-if="$isMobile.value && $slots['filters']"
|
|
@@ -32,7 +89,14 @@
|
|
|
32
89
|
name="table_search"
|
|
33
90
|
:model-value="searchValue"
|
|
34
91
|
@update:model-value="$emit('search:change', $event)"
|
|
35
|
-
|
|
92
|
+
>
|
|
93
|
+
<template #prepend-inner>
|
|
94
|
+
<VcIcon
|
|
95
|
+
icon="fas fa-search"
|
|
96
|
+
class="tw-text-[color:#a5a5a5]"
|
|
97
|
+
></VcIcon>
|
|
98
|
+
</template>
|
|
99
|
+
</VcInput>
|
|
36
100
|
|
|
37
101
|
<!-- Table filter desktop button -->
|
|
38
102
|
<div
|
|
@@ -61,7 +125,7 @@
|
|
|
61
125
|
ref="scrollContainer"
|
|
62
126
|
:no-padding="true"
|
|
63
127
|
class="tw-grow tw-basis-0 tw-relative"
|
|
64
|
-
:use-ptr="pullToReload"
|
|
128
|
+
:use-ptr="selection.length === 0 ? pullToReload : undefined"
|
|
65
129
|
@scroll:ptr="$emit('scroll:ptr')"
|
|
66
130
|
>
|
|
67
131
|
<!-- Mobile table view -->
|
|
@@ -74,6 +138,7 @@
|
|
|
74
138
|
:items="items"
|
|
75
139
|
:action-builder="itemActionBuilder"
|
|
76
140
|
:swiping-item="mobileSwipeItem"
|
|
141
|
+
:selection="selection"
|
|
77
142
|
:is-selected="isSelected(item)"
|
|
78
143
|
@click="$emit('itemClick', item)"
|
|
79
144
|
@swipe-start="handleSwipe"
|
|
@@ -130,20 +195,6 @@
|
|
|
130
195
|
@mouseleave="handleHeaderMouseOver(false)"
|
|
131
196
|
>
|
|
132
197
|
<div class="vc-table__header-row tw-flex tw-flex-row">
|
|
133
|
-
<div
|
|
134
|
-
v-if="multiselect"
|
|
135
|
-
class="tw-flex-1 tw-flex tw-items-center tw-justify-center tw-w-[28px] tw-max-w-[28px] tw-min-w-[28px] tw-bg-[#f9f9f9] !tw-border-0 tw-shadow-[inset_0px_1px_0px_#eaedf3,_inset_0px_-1px_0px_#eaedf3] tw-box-border tw-sticky tw-top-0 tw-select-none tw-overflow-hidden tw-z-[1]"
|
|
136
|
-
>
|
|
137
|
-
<div class="tw-flex tw-justify-center tw-items-center">
|
|
138
|
-
<VcCheckbox
|
|
139
|
-
v-model="headerCheckbox"
|
|
140
|
-
@click.stop
|
|
141
|
-
></VcCheckbox>
|
|
142
|
-
</div>
|
|
143
|
-
<div class="tw-top-0 tw-bottom-0 tw-absolute tw-right-0 tw-flex tw-justify-end">
|
|
144
|
-
<div class="tw-w-px tw-bg-[#e5e7eb] tw-h-full"></div>
|
|
145
|
-
</div>
|
|
146
|
-
</div>
|
|
147
198
|
<div
|
|
148
199
|
v-for="(item, index) in filteredCols"
|
|
149
200
|
:id="item.id"
|
|
@@ -164,6 +215,17 @@
|
|
|
164
215
|
@drop="onColumnHeaderDrop($event, item)"
|
|
165
216
|
@click="handleHeaderClick(item)"
|
|
166
217
|
>
|
|
218
|
+
<div
|
|
219
|
+
v-if="multiselect && index === 0 && isHeaderHover"
|
|
220
|
+
class="tw-flex tw-pl-3 tw-items-center tw-justify-center tw-w-auto tw-bg-[#f9f9f9] tw-box-border tw-select-none tw-overflow-hidden tw-z-[1]"
|
|
221
|
+
>
|
|
222
|
+
<div class="tw-flex tw-justify-center tw-items-center">
|
|
223
|
+
<VcCheckbox
|
|
224
|
+
v-model="headerCheckbox"
|
|
225
|
+
@click.stop
|
|
226
|
+
></VcCheckbox>
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
167
229
|
<div class="tw-flex tw-items-center tw-flex-nowrap tw-truncate tw-px-3 tw-font-bold">
|
|
168
230
|
<div class="tw-truncate">
|
|
169
231
|
<span
|
|
@@ -275,20 +337,6 @@
|
|
|
275
337
|
@drop="onRowDrop"
|
|
276
338
|
@mouseover="showActions(itemIndex)"
|
|
277
339
|
>
|
|
278
|
-
<div
|
|
279
|
-
v-if="multiselect && typeof item === 'object'"
|
|
280
|
-
class="tw-w-[28px] tw-max-w-[28px] tw-min-w-[28px] tw-relative tw-flex-1 tw-flex tw-items-center tw-justify-center"
|
|
281
|
-
@click.stop
|
|
282
|
-
>
|
|
283
|
-
<div class="tw-flex tw-justify-center tw-items-center">
|
|
284
|
-
<VcCheckbox
|
|
285
|
-
:model-value="isSelected(item)"
|
|
286
|
-
@update:model-value="rowCheckbox(item)"
|
|
287
|
-
></VcCheckbox>
|
|
288
|
-
</div>
|
|
289
|
-
<div class="tw-w-px tw-top-0 tw-bottom-0 tw-absolute tw-right-0 tw-bg-[#e5e7eb]"></div>
|
|
290
|
-
</div>
|
|
291
|
-
|
|
292
340
|
<div
|
|
293
341
|
v-for="cell in filteredCols"
|
|
294
342
|
:id="`${(typeof item === 'object' && 'id' in item && item.id) || itemIndex}_${cell.id}`"
|
|
@@ -298,35 +346,18 @@
|
|
|
298
346
|
:style="{ maxWidth: cell.width, width: cell.width }"
|
|
299
347
|
>
|
|
300
348
|
<div class="tw-truncate">
|
|
301
|
-
<
|
|
302
|
-
:name="`item_${cell.id}`"
|
|
349
|
+
<renderCellSlot
|
|
303
350
|
:item="item"
|
|
304
351
|
:cell="cell"
|
|
305
352
|
:index="itemIndex"
|
|
306
|
-
|
|
307
|
-
<VcTableCell
|
|
308
|
-
v-if="typeof item === 'object'"
|
|
309
|
-
class="tw-flex-1"
|
|
310
|
-
:cell="cell"
|
|
311
|
-
:item="item"
|
|
312
|
-
:editing="editing"
|
|
313
|
-
:index="itemIndex"
|
|
314
|
-
:width="
|
|
315
|
-
calculateElWidth(
|
|
316
|
-
`${(typeof item === 'object' && 'id' in item && item.id) || itemIndex}_${cell.id}`,
|
|
317
|
-
)
|
|
318
|
-
"
|
|
319
|
-
@update="$emit('onEditComplete', { event: $event, index: itemIndex })"
|
|
320
|
-
@blur="$emit('onCellBlur', $event)"
|
|
321
|
-
></VcTableCell>
|
|
322
|
-
</slot>
|
|
353
|
+
/>
|
|
323
354
|
</div>
|
|
324
355
|
</div>
|
|
325
356
|
<div
|
|
326
357
|
v-if="
|
|
327
358
|
enableItemActions && itemActionBuilder && typeof item === 'object' && selectedRowIndex === itemIndex
|
|
328
359
|
"
|
|
329
|
-
class="tw-absolute tw-flex tw-right-[10px] actions tw-h-full tw-bg-[#f4f8fb]"
|
|
360
|
+
class="tw-absolute tw-flex tw-right-0 tw-px-[10px] actions tw-h-full tw-bg-[#f4f8fb]"
|
|
330
361
|
:class="{
|
|
331
362
|
'group-hover:!tw-bg-[#dfeef9]': hasClickListener,
|
|
332
363
|
}"
|
|
@@ -400,7 +431,11 @@
|
|
|
400
431
|
name="footer"
|
|
401
432
|
>
|
|
402
433
|
<div
|
|
403
|
-
class="tw-bg-[#fbfdfe] tw-border-t tw-border-solid tw-border-[#eaedf3] tw-flex-shrink-0 tw-flex tw-items-center tw-justify-between
|
|
434
|
+
class="tw-bg-[#fbfdfe] tw-border-t tw-border-solid tw-border-[#eaedf3] tw-flex-shrink-0 tw-flex tw-items-center tw-justify-between"
|
|
435
|
+
:class="{
|
|
436
|
+
'tw-py-2 tw-px-4': $isMobile.value,
|
|
437
|
+
'tw-p-4': $isDesktop.value,
|
|
438
|
+
}"
|
|
404
439
|
>
|
|
405
440
|
<!-- Table pagination -->
|
|
406
441
|
<VcPagination
|
|
@@ -596,6 +631,41 @@ const sortField = computed(() => {
|
|
|
596
631
|
|
|
597
632
|
const hasClickListener = typeof instance?.vnode.props?.["onItemClick"] === "function";
|
|
598
633
|
|
|
634
|
+
const renderCellSlot = ({ item, cell, index }: { item: T; cell: ITableColumns; index: number }) => {
|
|
635
|
+
const isSlotExist = slots[`item_${cell.id}`];
|
|
636
|
+
|
|
637
|
+
const isFirstCell = filteredCols.value.indexOf(cell) === 0;
|
|
638
|
+
|
|
639
|
+
const isRowSelected = selection.value.includes(item);
|
|
640
|
+
|
|
641
|
+
if ((isFirstCell && selectedRowIndex.value === index) || (isRowSelected && isFirstCell)) {
|
|
642
|
+
return h(
|
|
643
|
+
"div",
|
|
644
|
+
{ onClick: (e) => e.stopPropagation() },
|
|
645
|
+
h(VcCheckbox, {
|
|
646
|
+
modelValue: selection.value.includes(item),
|
|
647
|
+
"onUpdate:modelValue": (value: boolean) => {
|
|
648
|
+
rowCheckbox(item);
|
|
649
|
+
},
|
|
650
|
+
}),
|
|
651
|
+
);
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
if (!isSlotExist) {
|
|
655
|
+
return h(VcTableCell, {
|
|
656
|
+
cell,
|
|
657
|
+
item: item as TableItem,
|
|
658
|
+
index,
|
|
659
|
+
editing: props.editing,
|
|
660
|
+
onUpdate: (event) => {
|
|
661
|
+
emit("onEditComplete", { event, index });
|
|
662
|
+
},
|
|
663
|
+
onBlur: (event) => emit("onCellBlur", event),
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
return slots[`item_${cell.id}`]?.({ item, cell, index });
|
|
667
|
+
};
|
|
668
|
+
|
|
599
669
|
const calculateElWidth = (id: string) => {
|
|
600
670
|
const el = document.getElementById(id);
|
|
601
671
|
return el ? el.offsetWidth : 0;
|
|
@@ -936,12 +1006,12 @@ function onColumnHeaderDragStart(event: DragEvent, item: ITableColumns) {
|
|
|
936
1006
|
}
|
|
937
1007
|
|
|
938
1008
|
function findParentHeader(element: HTMLElement) {
|
|
939
|
-
if (element.
|
|
1009
|
+
if (element.classList.contains("vc-table__header")) {
|
|
940
1010
|
return element;
|
|
941
1011
|
} else {
|
|
942
1012
|
let parent = element.parentElement;
|
|
943
1013
|
|
|
944
|
-
while (parent && parent.
|
|
1014
|
+
while (parent && !parent.classList.contains("vc-table__header")) {
|
|
945
1015
|
parent = parent.parentElement;
|
|
946
1016
|
if (!parent) break;
|
|
947
1017
|
}
|
|
@@ -965,11 +1035,11 @@ function onColumnHeaderDragOver(event: DragEvent) {
|
|
|
965
1035
|
reorderRef.value.style.top = dropHeaderOffset.top - getOffset(tableRef.value).top + "px";
|
|
966
1036
|
|
|
967
1037
|
if (event.pageX > columnCenter) {
|
|
968
|
-
reorderRef.value.style.left = targetLeft + dropHeader.offsetWidth + "px";
|
|
1038
|
+
reorderRef.value.style.left = targetLeft + dropHeader.offsetWidth - 5 + "px";
|
|
969
1039
|
|
|
970
1040
|
dropPosition.value = 1;
|
|
971
1041
|
} else {
|
|
972
|
-
reorderRef.value.style.left = targetLeft + "px";
|
|
1042
|
+
reorderRef.value.style.left = targetLeft - 5 + "px";
|
|
973
1043
|
dropPosition.value = -1;
|
|
974
1044
|
}
|
|
975
1045
|
|
|
@@ -1024,7 +1094,8 @@ function onColumnHeaderDrop(event: DragEvent, item: ITableColumns) {
|
|
|
1024
1094
|
function saveState() {
|
|
1025
1095
|
console.debug("[@vc-shell/framework#vc-table.vue] - Save state");
|
|
1026
1096
|
|
|
1027
|
-
|
|
1097
|
+
const colsClone = _.cloneDeep(internalColumns.value);
|
|
1098
|
+
state.value = colsClone.map((col) => _.pick(col, "id", "visible", "width", "predefined"));
|
|
1028
1099
|
}
|
|
1029
1100
|
|
|
1030
1101
|
function restoreState() {
|
|
@@ -1045,9 +1116,14 @@ function restoreState() {
|
|
|
1045
1116
|
}
|
|
1046
1117
|
}
|
|
1047
1118
|
// Merge the updated columns with the remaining state columns
|
|
1048
|
-
internalColumns.value =
|
|
1049
|
-
|
|
1050
|
-
|
|
1119
|
+
internalColumns.value = state.value.map((stateItem) => {
|
|
1120
|
+
const id = stateItem.id;
|
|
1121
|
+
|
|
1122
|
+
const propsColumn = _.find(props.columns, { id });
|
|
1123
|
+
const allColumn = _.find(allColumns.value, { id });
|
|
1124
|
+
|
|
1125
|
+
return _.merge({}, propsColumn, allColumn, stateItem);
|
|
1126
|
+
});
|
|
1051
1127
|
} else {
|
|
1052
1128
|
internalColumns.value = allColumns.value;
|
|
1053
1129
|
}
|