@vc-shell/framework 1.0.283 → 1.0.285
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 +13 -0
- package/core/composables/useUser/index.ts +2 -1
- package/dist/core/composables/useUser/index.d.ts.map +1 -1
- package/dist/framework.js +19361 -19359
- package/dist/index.css +1 -1
- package/dist/shared/modules/dynamic/components/SchemaRender.d.ts +2 -2
- package/dist/shared/modules/dynamic/components/fields/Button.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/Card.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/Checkbox.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/ContentField.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/CustomComponent.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/Fieldset.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/GalleryField.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/ImageField.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/InputCurrency.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/InputField.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/MultivalueField.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/RadioButtonGroup.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/RatingField.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/SelectField.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/StatusField.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/SwitchField.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/Table.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/TextareaField.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/VideoField.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/props.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/Button.stories.d.ts +2 -2
- package/dist/shared/modules/dynamic/components/fields/storybook/Card.stories.d.ts +2 -2
- package/dist/shared/modules/dynamic/components/fields/storybook/Checkbox.stories.d.ts +2 -2
- package/dist/shared/modules/dynamic/components/fields/storybook/ContentField.stories.d.ts +2 -2
- package/dist/shared/modules/dynamic/components/fields/storybook/EditorField.stories.d.ts +2 -2
- package/dist/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.d.ts +2 -2
- package/dist/shared/modules/dynamic/components/fields/storybook/GalleryField.stories.d.ts +2 -2
- package/dist/shared/modules/dynamic/components/fields/storybook/ImageField.stories.d.ts +2 -2
- package/dist/shared/modules/dynamic/components/fields/storybook/InputCurrency.stories.d.ts +2 -2
- package/dist/shared/modules/dynamic/components/fields/storybook/InputField.stories.d.ts +2 -2
- package/dist/shared/modules/dynamic/components/fields/storybook/MultivalueField.stories.d.ts +2 -2
- package/dist/shared/modules/dynamic/components/fields/storybook/RadioButtonGroup.stories.d.ts +2 -2
- package/dist/shared/modules/dynamic/components/fields/storybook/RatingField.stories.d.ts +2 -2
- package/dist/shared/modules/dynamic/components/fields/storybook/SelectField.stories.d.ts +2 -2
- package/dist/shared/modules/dynamic/components/fields/storybook/StatusField.stories.d.ts +2 -2
- package/dist/shared/modules/dynamic/components/fields/storybook/TextareaField.stories.d.ts +2 -2
- package/dist/shared/modules/dynamic/components/fields/storybook/VideoField.stories.d.ts +2 -2
- package/dist/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.d.ts +2 -2
- package/dist/shared/modules/dynamic/factories/types/index.d.ts +51 -5
- package/dist/shared/modules/dynamic/factories/types/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts +226 -1
- package/dist/shared/modules/dynamic/pages/dynamic-blade-list.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 +6 -3
- 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.stories.d.ts +390 -195
- package/dist/ui/components/organisms/vc-table/vc-table.stories.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts +78 -39
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
- package/package.json +4 -4
- package/shared/modules/dynamic/factories/types/index.ts +52 -5
- package/shared/modules/dynamic/helpers/override.ts +8 -4
- package/shared/modules/dynamic/pages/dynamic-blade-list.vue +75 -49
- package/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue +4 -1
- package/ui/components/organisms/vc-table/_internal/vc-table-mobile-item/vc-table-mobile-item.vue +98 -117
- package/ui/components/organisms/vc-table/vc-table.vue +70 -29
package/ui/components/organisms/vc-table/_internal/vc-table-mobile-item/vc-table-mobile-item.vue
CHANGED
|
@@ -3,15 +3,14 @@
|
|
|
3
3
|
ref="container"
|
|
4
4
|
v-on-click-outside="reset"
|
|
5
5
|
v-touch:hold="handleHold"
|
|
6
|
-
class="tw-select-none tw-
|
|
6
|
+
class="vc-table-mobile tw-select-none tw-block tw-overflow-visible"
|
|
7
7
|
@click="handleClick"
|
|
8
8
|
@contextmenu.prevent
|
|
9
9
|
>
|
|
10
10
|
<div
|
|
11
11
|
ref="target"
|
|
12
|
-
class="tw-
|
|
12
|
+
class="tw-w-full tw-h-full tw-flex-shrink-0 tw-bg-white tw-flex tw-flex-row"
|
|
13
13
|
:class="{ animated: !isSwiping, 'vc-table-mobile__item_selected': isSelected }"
|
|
14
|
-
:style="{ left }"
|
|
15
14
|
>
|
|
16
15
|
<div
|
|
17
16
|
v-if="anySelected"
|
|
@@ -19,119 +18,122 @@
|
|
|
19
18
|
>
|
|
20
19
|
<VcCheckbox
|
|
21
20
|
:model-value="unref(isSelected ?? false)"
|
|
21
|
+
:disabled="disabledSelection?.includes(items[index])"
|
|
22
22
|
size="m"
|
|
23
23
|
></VcCheckbox>
|
|
24
24
|
</div>
|
|
25
|
-
<div class="tw-flex-
|
|
26
|
-
|
|
27
|
-
<slot></slot>
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
<div class="tw-flex tw-justify-between tw-flex-auto">
|
|
32
|
-
<!-- Left swipe actions -->
|
|
33
|
-
<div
|
|
34
|
-
v-if="leftSwipeActions && leftSwipeActions.length && direction === 'right'"
|
|
35
|
-
class="tw-flex-shrink-0 tw-flex tw-flex-col [justify-content:stretch] tw-bg-[#a9bfd2]"
|
|
36
|
-
:style="{
|
|
37
|
-
width: actionsWidth,
|
|
38
|
-
}"
|
|
39
|
-
>
|
|
25
|
+
<div class="tw-flex-auto tw-flex tw-flex-row tw-relative">
|
|
26
|
+
<!-- Left swipe actions -->
|
|
40
27
|
<div
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
28
|
+
v-if="leftSwipeActions && leftSwipeActions.length && direction === 'right'"
|
|
29
|
+
class="tw-flex-shrink-0 tw-flex tw-flex-col [justify-content:stretch] tw-bg-[#a9bfd2] tw-absolute tw-top-0 tw-bottom-0"
|
|
30
|
+
:style="{
|
|
31
|
+
width: actionsWidth,
|
|
32
|
+
}"
|
|
44
33
|
>
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
{
|
|
34
|
+
<div
|
|
35
|
+
class="tw-flex tw-grow tw-basis-[1] tw-flex-col tw-justify-center tw-items-center tw-text-white"
|
|
36
|
+
:class="[`vc-table-mobile__item-action_${leftSwipeActions[0].type}`]"
|
|
37
|
+
@click.stop="leftSwipeActions?.[0].clickHandler(items[index] as T, index)"
|
|
38
|
+
>
|
|
39
|
+
<VcIcon :icon="leftSwipeActions[0].icon" />
|
|
40
|
+
<div class="tw-mt-1 tw-text-lg tw-text-center">
|
|
41
|
+
{{ leftSwipeActions[0].title }}
|
|
42
|
+
</div>
|
|
48
43
|
</div>
|
|
49
44
|
</div>
|
|
50
|
-
</div>
|
|
51
|
-
<!-- Item actions -->
|
|
52
|
-
<div
|
|
53
|
-
v-if="rightSwipeActions && rightSwipeActions.length && direction === 'left'"
|
|
54
|
-
class="tw-flex-shrink-0 tw-flex tw-flex-col [justify-content:stretch] tw-bg-[#a9bfd2] tw-ml-auto"
|
|
55
|
-
:style="{
|
|
56
|
-
width: actionsWidth,
|
|
57
|
-
}"
|
|
58
|
-
>
|
|
59
45
|
<div
|
|
60
|
-
|
|
61
|
-
:
|
|
62
|
-
class="tw-flex tw-grow tw-basis-[1] tw-flex-col tw-justify-center tw-items-center tw-text-white"
|
|
63
|
-
:class="[`vc-table-mobile__item-action_${action.type}`]"
|
|
64
|
-
@click.stop="action.clickHandler(items[index] as T, index)"
|
|
46
|
+
class="tw-flex tw-flex-col tw-border-b tw-border-solid tw-border-b-[#e3e7ec] tw-grow"
|
|
47
|
+
:style="{ transform: `translateX(${left})` }"
|
|
65
48
|
>
|
|
66
|
-
<
|
|
67
|
-
<div class="tw-mt-1 tw-text-lg tw-text-center">
|
|
68
|
-
{{ action.title }}
|
|
69
|
-
</div>
|
|
49
|
+
<slot></slot>
|
|
70
50
|
</div>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
51
|
+
<!-- Item actions -->
|
|
52
|
+
<div
|
|
53
|
+
v-if="rightSwipeActions && rightSwipeActions.length && direction === 'left'"
|
|
54
|
+
class="tw-flex-shrink-0 tw-flex tw-flex-col [justify-content:stretch] tw-bg-[#a9bfd2] tw-absolute tw-top-0 tw-bottom-0 tw-right-0"
|
|
55
|
+
:style="{
|
|
56
|
+
width: actionsWidth,
|
|
57
|
+
}"
|
|
58
|
+
>
|
|
74
59
|
<div
|
|
60
|
+
v-for="(action, index) in rightSwipeActions.slice(0, rightSwipeActions.length > 2 ? 1 : 2)"
|
|
61
|
+
:key="`rightSwipeAction-${index}`"
|
|
75
62
|
class="tw-flex tw-grow tw-basis-[1] tw-flex-col tw-justify-center tw-items-center tw-text-white"
|
|
76
|
-
|
|
63
|
+
:class="[`vc-table-mobile__item-action_${action.type}`]"
|
|
64
|
+
@click.stop="action.clickHandler(items[index] as T, index)"
|
|
77
65
|
>
|
|
78
|
-
<VcIcon icon="
|
|
79
|
-
<div class="tw-mt-1 tw-text-lg
|
|
66
|
+
<VcIcon :icon="action.icon" />
|
|
67
|
+
<div class="tw-mt-1 tw-text-lg tw-text-center">
|
|
68
|
+
{{ action.title }}
|
|
69
|
+
</div>
|
|
80
70
|
</div>
|
|
81
71
|
|
|
82
|
-
<!--
|
|
83
|
-
<
|
|
84
|
-
v-if="isActionsPopupVisible"
|
|
85
|
-
to="body"
|
|
86
|
-
>
|
|
72
|
+
<!-- Other available actions -->
|
|
73
|
+
<template v-if="rightSwipeActions.length > 2">
|
|
87
74
|
<div
|
|
88
|
-
class="tw-
|
|
75
|
+
class="tw-flex tw-grow tw-basis-[1] tw-flex-col tw-justify-center tw-items-center tw-text-white"
|
|
76
|
+
@click.stop="isActionsPopupVisible = true"
|
|
77
|
+
>
|
|
78
|
+
<VcIcon icon="fas fa-ellipsis-h" />
|
|
79
|
+
<div class="tw-mt-1 tw-text-lg">{{ $t("COMPONENTS.ORGANISMS.VC_TABLE.MORE") }}</div>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<!-- Actions popup -->
|
|
83
|
+
<teleport
|
|
84
|
+
v-if="isActionsPopupVisible"
|
|
85
|
+
to="body"
|
|
89
86
|
>
|
|
90
87
|
<div
|
|
91
|
-
class="tw-
|
|
88
|
+
class="tw-absolute tw-left-0 tw-top-0 tw-right-0 tw-bottom-0 tw-bg-[rgba(107,121,135,0.15)] tw-flex tw-items-center tw-justify-center tw-z-[99]"
|
|
92
89
|
>
|
|
93
|
-
<div
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
size="xl"
|
|
101
|
-
@click="isActionsPopupVisible = false"
|
|
102
|
-
></VcIcon>
|
|
103
|
-
</div>
|
|
104
|
-
|
|
105
|
-
<div class="tw-flex tw-flex-wrap tw-my-5 tw-justify-between">
|
|
106
|
-
<div
|
|
107
|
-
v-for="(itemAction, i) in itemActions"
|
|
108
|
-
:key="i"
|
|
109
|
-
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]"
|
|
110
|
-
@click="itemAction.clickHandler(items[index] as T, index)"
|
|
111
|
-
>
|
|
90
|
+
<div
|
|
91
|
+
class="tw-bg-white tw-rounded-[6px] tw-overflow-hidden tw-p-5 tw-max-w-[80%] tw-w-[350px] tw-border tw-border-solid tw-border-[#eef0f2] tw-box-border tw-shadow-[1px_1px_22px_rgba(126,142,157,0.2)]"
|
|
92
|
+
>
|
|
93
|
+
<div class="tw-flex tw-w-full tw-items-center">
|
|
94
|
+
<span class="tw-grow tw-text-[#2e3d4e] tw-text-[19px] tw-font-semibold tw-tracking-[-0.01em]">
|
|
95
|
+
{{ t("COMPONENTS.ORGANISMS.VC_TABLE.ALL_ACTIONS") }}
|
|
96
|
+
</span>
|
|
112
97
|
<VcIcon
|
|
113
|
-
|
|
98
|
+
class="tw-text-[#c2d7e4]"
|
|
99
|
+
icon="fas fa-times-circle"
|
|
114
100
|
size="xl"
|
|
101
|
+
@click="isActionsPopupVisible = false"
|
|
115
102
|
></VcIcon>
|
|
116
|
-
|
|
117
|
-
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<div class="tw-flex tw-flex-wrap tw-my-5 tw-justify-between">
|
|
106
|
+
<div
|
|
107
|
+
v-for="(itemAction, i) in itemActions"
|
|
108
|
+
:key="i"
|
|
109
|
+
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]"
|
|
110
|
+
@click="itemAction.clickHandler(items[index] as T, index)"
|
|
111
|
+
>
|
|
112
|
+
<VcIcon
|
|
113
|
+
:icon="itemAction.icon"
|
|
114
|
+
size="xl"
|
|
115
|
+
></VcIcon>
|
|
116
|
+
<div class="tw-text-base tw-mt-2 tw-text-center">
|
|
117
|
+
{{ itemAction.title }}
|
|
118
|
+
</div>
|
|
118
119
|
</div>
|
|
119
120
|
</div>
|
|
120
121
|
</div>
|
|
121
122
|
</div>
|
|
122
|
-
</
|
|
123
|
-
</
|
|
124
|
-
</
|
|
123
|
+
</teleport>
|
|
124
|
+
</template>
|
|
125
|
+
</div>
|
|
125
126
|
</div>
|
|
126
127
|
</div>
|
|
128
|
+
<div class="tw-flex tw-justify-between tw-flex-auto"></div>
|
|
127
129
|
</div>
|
|
128
130
|
</template>
|
|
129
131
|
|
|
130
132
|
<script lang="ts" setup generic="T extends TableItem | string">
|
|
131
|
-
import { Ref, computed, ref,
|
|
133
|
+
import { Ref, computed, ref, watch, unref } from "vue";
|
|
132
134
|
import { IActionBuilderResult } from "../../../../../../core/types";
|
|
133
135
|
import { useI18n } from "vue-i18n";
|
|
134
|
-
import {
|
|
136
|
+
import { useSwipe } from "@vueuse/core";
|
|
135
137
|
import { vOnClickOutside } from "@vueuse/components";
|
|
136
138
|
|
|
137
139
|
export interface Emits {
|
|
@@ -152,6 +154,7 @@ const props = defineProps<{
|
|
|
152
154
|
isSelected?: boolean;
|
|
153
155
|
index: number;
|
|
154
156
|
selection?: T[];
|
|
157
|
+
disabledSelection?: (TableItem | string)[];
|
|
155
158
|
}>();
|
|
156
159
|
|
|
157
160
|
const emit = defineEmits<Emits>();
|
|
@@ -164,7 +167,6 @@ const container = ref<HTMLElement | null>(null);
|
|
|
164
167
|
const containerWidth = computed(() => container.value?.offsetWidth);
|
|
165
168
|
const left = ref("0");
|
|
166
169
|
const anySelected = computed(() => props.selection && props.selection.length > 0);
|
|
167
|
-
const targetIsVisible = useElementVisibility(container);
|
|
168
170
|
|
|
169
171
|
const actionsWidth = ref("0");
|
|
170
172
|
|
|
@@ -234,35 +236,11 @@ watch(
|
|
|
234
236
|
},
|
|
235
237
|
);
|
|
236
238
|
|
|
237
|
-
onMounted(() => {
|
|
238
|
-
adjustHeight();
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
onUpdated(() => {
|
|
242
|
-
adjustHeight();
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
watchDebounced(
|
|
246
|
-
() => props.items,
|
|
247
|
-
() => {
|
|
248
|
-
adjustHeight();
|
|
249
|
-
},
|
|
250
|
-
{ deep: true, debounce: 450 },
|
|
251
|
-
);
|
|
252
|
-
|
|
253
|
-
watch(() => targetIsVisible.value, adjustHeight);
|
|
254
|
-
|
|
255
239
|
function reset() {
|
|
256
240
|
left.value = "0";
|
|
257
241
|
actionsWidth.value = "0";
|
|
258
242
|
}
|
|
259
243
|
|
|
260
|
-
function adjustHeight() {
|
|
261
|
-
if (container.value && target.value) {
|
|
262
|
-
container.value.style.height = target.value.scrollHeight + "px";
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
244
|
const direction = computed(() => {
|
|
267
245
|
if (lengthX.value < 0) {
|
|
268
246
|
return "right";
|
|
@@ -292,19 +270,22 @@ function handleClick() {
|
|
|
292
270
|
</script>
|
|
293
271
|
|
|
294
272
|
<style lang="scss">
|
|
295
|
-
.vc-table-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
273
|
+
.vc-table-mobile {
|
|
274
|
+
// height: -webkit-fill-available;
|
|
275
|
+
&__item {
|
|
276
|
+
&-action {
|
|
277
|
+
&_success {
|
|
278
|
+
@apply tw-bg-[#87b563];
|
|
279
|
+
}
|
|
300
280
|
|
|
301
|
-
|
|
302
|
-
|
|
281
|
+
&_danger {
|
|
282
|
+
@apply tw-bg-[#ff4a4a];
|
|
283
|
+
}
|
|
303
284
|
}
|
|
304
|
-
}
|
|
305
285
|
|
|
306
|
-
|
|
307
|
-
|
|
286
|
+
&_selected {
|
|
287
|
+
@apply tw-bg-[#dfeef9] #{!important};
|
|
288
|
+
}
|
|
308
289
|
}
|
|
309
290
|
}
|
|
310
291
|
</style>
|
|
@@ -74,19 +74,23 @@
|
|
|
74
74
|
<VcContainer
|
|
75
75
|
ref="scrollContainer"
|
|
76
76
|
:no-padding="true"
|
|
77
|
-
class="tw-grow tw-basis-0 tw-relative"
|
|
77
|
+
class="vc-table__mobile-view tw-grow tw-basis-0 tw-relative"
|
|
78
78
|
:use-ptr="selection.length === 0 ? pullToReload : undefined"
|
|
79
79
|
@scroll:ptr="$emit('scroll:ptr')"
|
|
80
80
|
>
|
|
81
81
|
<!-- Mobile table view -->
|
|
82
82
|
<template v-if="$isMobile.value">
|
|
83
|
-
<div
|
|
83
|
+
<div
|
|
84
|
+
v-if="items && items.length && !columnsInit"
|
|
85
|
+
class="tw-flex-grow tw-flex tw-flex-col tw-h-max"
|
|
86
|
+
>
|
|
84
87
|
<VcTableMobileItem
|
|
85
88
|
v-for="(item, i) in items"
|
|
86
89
|
:key="i"
|
|
87
90
|
:index="i"
|
|
88
91
|
:items="items"
|
|
89
92
|
:action-builder="itemActionBuilder"
|
|
93
|
+
:disabled-selection="disabledSelection"
|
|
90
94
|
:swiping-item="mobileSwipeItem"
|
|
91
95
|
:selection="selection"
|
|
92
96
|
:is-selected="isSelected(item)"
|
|
@@ -107,7 +111,7 @@
|
|
|
107
111
|
</div>
|
|
108
112
|
<div
|
|
109
113
|
v-else
|
|
110
|
-
class="tw-overflow-auto tw-flex tw-flex-col tw-h-full"
|
|
114
|
+
class="tw-overflow-auto tw-flex tw-flex-col tw-h-full tw-flex-grow"
|
|
111
115
|
>
|
|
112
116
|
<!-- Empty table view -->
|
|
113
117
|
<VcTableEmpty
|
|
@@ -314,6 +318,7 @@
|
|
|
314
318
|
<VcCheckbox
|
|
315
319
|
:model-value="isSelected(item)"
|
|
316
320
|
size="m"
|
|
321
|
+
:disabled="disabledSelection.includes(item)"
|
|
317
322
|
@update:model-value="rowCheckbox(item)"
|
|
318
323
|
></VcCheckbox>
|
|
319
324
|
</div>
|
|
@@ -517,6 +522,7 @@ const props = withDefaults(
|
|
|
517
522
|
itemActionBuilder?: (item: T) => IActionBuilderResult[] | undefined;
|
|
518
523
|
sort?: string;
|
|
519
524
|
multiselect?: boolean;
|
|
525
|
+
disableItemCheckbox?: (item: T) => boolean;
|
|
520
526
|
expanded?: boolean;
|
|
521
527
|
totalLabel?: string;
|
|
522
528
|
totalCount?: number;
|
|
@@ -562,17 +568,17 @@ const props = withDefaults(
|
|
|
562
568
|
);
|
|
563
569
|
|
|
564
570
|
const emit = defineEmits<{
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
"search:change"
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
"scroll:ptr":
|
|
571
|
-
"row:reorder"
|
|
572
|
-
"select:all"
|
|
573
|
-
|
|
574
|
-
onAddNewRow:
|
|
575
|
-
|
|
571
|
+
(e: "paginationClick", page: number): void;
|
|
572
|
+
(e: "selectionChanged", values: T[]): void;
|
|
573
|
+
(e: "search:change", value: string | undefined): void;
|
|
574
|
+
(e: "headerClick", item: ITableColumns): void;
|
|
575
|
+
(e: "itemClick", item: T): void;
|
|
576
|
+
(e: "scroll:ptr"): void;
|
|
577
|
+
(e: "row:reorder", args: { dragIndex: number; dropIndex: number; value: T[] }): void;
|
|
578
|
+
(e: "select:all", values: boolean): void;
|
|
579
|
+
(e: "onEditComplete", args: { event: { field: string; value: string | number }; index: number }): void;
|
|
580
|
+
(e: "onAddNewRow"): void;
|
|
581
|
+
(e: "onCellBlur", args: { row: number | undefined; field: string }): void;
|
|
576
582
|
}>();
|
|
577
583
|
|
|
578
584
|
const { t } = useI18n({ useScope: "global" });
|
|
@@ -596,6 +602,7 @@ const selectedRowIndex = shallowRef();
|
|
|
596
602
|
const scrollContainer = ref<typeof VcContainer>();
|
|
597
603
|
|
|
598
604
|
const itemActions: Ref<IActionBuilderResult[][]> = ref([]);
|
|
605
|
+
const disabledSelection: Ref<T[]> = ref([]);
|
|
599
606
|
const mobileSwipeItem = ref<string>();
|
|
600
607
|
const columnResizing = ref(false);
|
|
601
608
|
const resizeColumnElement = ref<ITableColumns>();
|
|
@@ -703,20 +710,22 @@ const hasClickListener = typeof instance?.vnode.props?.["onItemClick"] === "func
|
|
|
703
710
|
// return el ? el.offsetWidth : 0;
|
|
704
711
|
// };
|
|
705
712
|
|
|
706
|
-
const headerComponent =
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
filters: () => {
|
|
716
|
-
return slots.filters?.({ closePanel: () => {} });
|
|
713
|
+
const headerComponent = () =>
|
|
714
|
+
h(
|
|
715
|
+
VcTableBaseHeader,
|
|
716
|
+
{
|
|
717
|
+
searchValue: props.searchValue,
|
|
718
|
+
searchPlaceholder: props.searchPlaceholder,
|
|
719
|
+
activeFilterCount: props.activeFilterCount,
|
|
720
|
+
expanded: props.expanded,
|
|
721
|
+
"onSearch:change": (value: string) => emit("search:change", value),
|
|
717
722
|
},
|
|
718
|
-
|
|
719
|
-
)
|
|
723
|
+
{
|
|
724
|
+
filters: () => {
|
|
725
|
+
return slots.filters?.({ closePanel: () => {} });
|
|
726
|
+
},
|
|
727
|
+
},
|
|
728
|
+
);
|
|
720
729
|
|
|
721
730
|
const allColumns = ref([]) as Ref<ITableColumns[]>;
|
|
722
731
|
|
|
@@ -814,13 +823,15 @@ const tableAlignment = {
|
|
|
814
823
|
|
|
815
824
|
const headerCheckbox = computed({
|
|
816
825
|
get() {
|
|
817
|
-
return props.items && props.items.length
|
|
826
|
+
return props.items && props.items.length
|
|
827
|
+
? selection.value.length === props.items.length - disabledSelection.value.length
|
|
828
|
+
: false;
|
|
818
829
|
},
|
|
819
830
|
set(checked: boolean) {
|
|
820
831
|
let _selected: T[] = [];
|
|
821
832
|
|
|
822
833
|
if (checked) {
|
|
823
|
-
_selected = props.items;
|
|
834
|
+
_selected = props.items.filter((x) => !disabledSelection.value.includes(x));
|
|
824
835
|
}
|
|
825
836
|
|
|
826
837
|
selection.value = _selected;
|
|
@@ -848,6 +859,7 @@ watch(
|
|
|
848
859
|
scrollContainer.value?.scrollTop();
|
|
849
860
|
|
|
850
861
|
calculateActions(newVal);
|
|
862
|
+
handleMultiselect(newVal);
|
|
851
863
|
|
|
852
864
|
selection.value = selection.value.filter((selection) => newVal.includes(selection));
|
|
853
865
|
},
|
|
@@ -899,6 +911,13 @@ function isSelected(item: T) {
|
|
|
899
911
|
|
|
900
912
|
function rowCheckbox(item: T) {
|
|
901
913
|
const clear = item;
|
|
914
|
+
|
|
915
|
+
// const index = props.items.findIndex((x) => _.isEqual(x, clear));
|
|
916
|
+
|
|
917
|
+
if (disabledSelection.value.includes(item)) {
|
|
918
|
+
return;
|
|
919
|
+
}
|
|
920
|
+
|
|
902
921
|
const isExist = selection.value.find((x) => _.isEqual(x, clear));
|
|
903
922
|
|
|
904
923
|
if (isExist) {
|
|
@@ -929,6 +948,22 @@ async function calculateActions(items: T[]) {
|
|
|
929
948
|
}
|
|
930
949
|
}
|
|
931
950
|
|
|
951
|
+
async function handleMultiselect(items: T[]) {
|
|
952
|
+
if (props.multiselect && props.disableItemCheckbox && typeof props.disableItemCheckbox === "function") {
|
|
953
|
+
const disabledMultiselect = [];
|
|
954
|
+
for (let index = 0; index < items.length; index++) {
|
|
955
|
+
if (typeof items[index] === "object") {
|
|
956
|
+
const element = await props.disableItemCheckbox(items[index]);
|
|
957
|
+
|
|
958
|
+
if (element) {
|
|
959
|
+
disabledMultiselect.push(items[index]);
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
disabledSelection.value = disabledMultiselect as T[];
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
|
|
932
967
|
function closeActions() {
|
|
933
968
|
selectedRowIndex.value = undefined;
|
|
934
969
|
}
|
|
@@ -1339,6 +1374,12 @@ $variants: (
|
|
|
1339
1374
|
);
|
|
1340
1375
|
|
|
1341
1376
|
.vc-table {
|
|
1377
|
+
&__mobile-view {
|
|
1378
|
+
.vc-container__inner {
|
|
1379
|
+
display: flex;
|
|
1380
|
+
flex-grow: 1;
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1342
1383
|
&__body {
|
|
1343
1384
|
&-row:hover .actions {
|
|
1344
1385
|
display: flex;
|