sprintify-ui 0.8.58 → 0.8.60
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/dist/sprintify-ui.es.js +15189 -15094
- package/dist/types/components/BaseDataIteratorSectionColumns.vue.d.ts +10 -0
- package/dist/types/components/BaseDataTable.vue.d.ts +18 -2
- package/dist/types/components/BaseDataTableTemplate.vue.d.ts +9 -0
- package/dist/types/components/BaseDraggable.vue.d.ts +2 -2
- package/dist/types/components/BaseMediaGallery.vue.d.ts +1 -1
- package/dist/types/components/BaseMediaGalleryItem.vue.d.ts +1 -1
- package/dist/types/components/BaseMediaLibrary.vue.d.ts +1 -1
- package/dist/types/components/BaseMediaList.vue.d.ts +1 -1
- package/dist/types/components/BaseMediaListItem.vue.d.ts +1 -1
- package/dist/types/components/BaseMediaPictures.vue.d.ts +1 -1
- package/dist/types/components/BaseMediaPicturesItem.vue.d.ts +1 -1
- package/dist/types/components/BaseTableColumn.vue.d.ts +0 -1
- package/dist/types/services/table/customKeyActions.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/BaseDataIteratorSectionColumns.vue +99 -20
- package/src/components/BaseDataTable.stories.js +1 -1
- package/src/components/BaseDataTable.vue +53 -5
- package/src/components/BaseDataTableTemplate.vue +101 -24
- package/src/components/BaseDraggable.vue +5 -5
- package/src/components/BaseTableColumn.vue +8 -9
- package/src/services/table/customKeyActions.ts +3 -0
|
@@ -9,8 +9,13 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
9
9
|
required: true;
|
|
10
10
|
type: PropType<string[]>;
|
|
11
11
|
};
|
|
12
|
+
columnOrder: {
|
|
13
|
+
required: true;
|
|
14
|
+
type: PropType<string[]>;
|
|
15
|
+
};
|
|
12
16
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
17
|
"update:visibleColumns": (...args: any[]) => void;
|
|
18
|
+
"update:columnOrder": (...args: any[]) => void;
|
|
14
19
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
15
20
|
table: {
|
|
16
21
|
required: true;
|
|
@@ -20,7 +25,12 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
20
25
|
required: true;
|
|
21
26
|
type: PropType<string[]>;
|
|
22
27
|
};
|
|
28
|
+
columnOrder: {
|
|
29
|
+
required: true;
|
|
30
|
+
type: PropType<string[]>;
|
|
31
|
+
};
|
|
23
32
|
}>> & Readonly<{
|
|
24
33
|
"onUpdate:visibleColumns"?: ((...args: any[]) => any) | undefined;
|
|
34
|
+
"onUpdate:columnOrder"?: ((...args: any[]) => any) | undefined;
|
|
25
35
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
26
36
|
export default _default;
|
|
@@ -426,6 +426,7 @@ declare function __VLS_template(): {
|
|
|
426
426
|
maxHeight: number;
|
|
427
427
|
virtualScrolling: boolean;
|
|
428
428
|
visibleColumns: string[];
|
|
429
|
+
columnOrder: string[];
|
|
429
430
|
detailed: boolean;
|
|
430
431
|
checkable: boolean;
|
|
431
432
|
isRowCheckable: Function;
|
|
@@ -449,6 +450,7 @@ declare function __VLS_template(): {
|
|
|
449
450
|
readonly hasDetailedVisible: Function;
|
|
450
451
|
readonly maxHeight?: number | undefined;
|
|
451
452
|
readonly visibleColumns?: string[] | undefined;
|
|
453
|
+
readonly columnOrder?: string[] | undefined;
|
|
452
454
|
readonly rowTo?: ((row: CollectionItem) => RouteLocationRaw) | undefined;
|
|
453
455
|
readonly rowHref?: ((row: CollectionItem) => string) | undefined;
|
|
454
456
|
readonly onRowClick?: ((row: CollectionItem, index: number, event: MouseEvent) => void) | undefined;
|
|
@@ -475,6 +477,10 @@ declare function __VLS_template(): {
|
|
|
475
477
|
default: undefined;
|
|
476
478
|
type: PropType<string[]>;
|
|
477
479
|
};
|
|
480
|
+
columnOrder: {
|
|
481
|
+
default: undefined;
|
|
482
|
+
type: PropType<string[]>;
|
|
483
|
+
};
|
|
478
484
|
detailed: {
|
|
479
485
|
default: boolean;
|
|
480
486
|
type: BooleanConstructor;
|
|
@@ -541,7 +547,7 @@ declare function __VLS_template(): {
|
|
|
541
547
|
"onUpdate:openedDetailed"?: ((...args: any[]) => any) | undefined;
|
|
542
548
|
"onCell-click"?: ((...args: any[]) => any) | undefined;
|
|
543
549
|
"onRow-click"?: ((...args: any[]) => any) | undefined;
|
|
544
|
-
}>, "data" | "size" | "loading" | "sortField" | "sortDirection" | "maxHeight" | "virtualScrolling" | "visibleColumns" | "detailed" | "checkable" | "isRowCheckable" | "checkedRows" | "hasDetailedVisible" | "rowTo" | "rowHref" | "onRowClick" | "rowKey">;
|
|
550
|
+
}>, "data" | "size" | "loading" | "sortField" | "sortDirection" | "maxHeight" | "virtualScrolling" | "visibleColumns" | "columnOrder" | "detailed" | "checkable" | "isRowCheckable" | "checkedRows" | "hasDetailedVisible" | "rowTo" | "rowHref" | "onRowClick" | "rowKey">;
|
|
545
551
|
$attrs: {
|
|
546
552
|
[x: string]: unknown;
|
|
547
553
|
};
|
|
@@ -569,6 +575,10 @@ declare function __VLS_template(): {
|
|
|
569
575
|
default: undefined;
|
|
570
576
|
type: PropType<string[]>;
|
|
571
577
|
};
|
|
578
|
+
columnOrder: {
|
|
579
|
+
default: undefined;
|
|
580
|
+
type: PropType<string[]>;
|
|
581
|
+
};
|
|
572
582
|
detailed: {
|
|
573
583
|
default: boolean;
|
|
574
584
|
type: BooleanConstructor;
|
|
@@ -680,6 +690,7 @@ declare function __VLS_template(): {
|
|
|
680
690
|
maxHeight: number;
|
|
681
691
|
virtualScrolling: boolean;
|
|
682
692
|
visibleColumns: string[];
|
|
693
|
+
columnOrder: string[];
|
|
683
694
|
detailed: boolean;
|
|
684
695
|
checkable: boolean;
|
|
685
696
|
isRowCheckable: Function;
|
|
@@ -718,6 +729,7 @@ declare function __VLS_template(): {
|
|
|
718
729
|
maxHeight: number;
|
|
719
730
|
virtualScrolling: boolean;
|
|
720
731
|
visibleColumns: string[];
|
|
732
|
+
columnOrder: string[];
|
|
721
733
|
detailed: boolean;
|
|
722
734
|
checkable: boolean;
|
|
723
735
|
isRowCheckable: Function;
|
|
@@ -740,6 +752,10 @@ declare function __VLS_template(): {
|
|
|
740
752
|
default: undefined;
|
|
741
753
|
type: PropType<string[]>;
|
|
742
754
|
};
|
|
755
|
+
columnOrder: {
|
|
756
|
+
default: undefined;
|
|
757
|
+
type: PropType<string[]>;
|
|
758
|
+
};
|
|
743
759
|
detailed: {
|
|
744
760
|
default: boolean;
|
|
745
761
|
type: BooleanConstructor;
|
|
@@ -806,7 +822,7 @@ declare function __VLS_template(): {
|
|
|
806
822
|
"onUpdate:openedDetailed"?: ((...args: any[]) => any) | undefined;
|
|
807
823
|
"onCell-click"?: ((...args: any[]) => any) | undefined;
|
|
808
824
|
"onRow-click"?: ((...args: any[]) => any) | undefined;
|
|
809
|
-
}>, "scrollTop" | "newColumns" | "uncheckAll" | ("data" | "size" | "loading" | "sortField" | "sortDirection" | "maxHeight" | "virtualScrolling" | "visibleColumns" | "detailed" | "checkable" | "isRowCheckable" | "checkedRows" | "hasDetailedVisible" | "rowTo" | "rowHref" | "onRowClick" | "rowKey")> & import("vue").ShallowUnwrapRef<{
|
|
825
|
+
}>, "scrollTop" | "newColumns" | "uncheckAll" | ("data" | "size" | "loading" | "sortField" | "sortDirection" | "maxHeight" | "virtualScrolling" | "visibleColumns" | "columnOrder" | "detailed" | "checkable" | "isRowCheckable" | "checkedRows" | "hasDetailedVisible" | "rowTo" | "rowHref" | "onRowClick" | "rowKey")> & import("vue").ShallowUnwrapRef<{
|
|
810
826
|
newColumns: import("vue").ComputedRef<{
|
|
811
827
|
id: string;
|
|
812
828
|
label: string;
|
|
@@ -144,6 +144,10 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
144
144
|
default: undefined;
|
|
145
145
|
type: PropType<string[]>;
|
|
146
146
|
};
|
|
147
|
+
columnOrder: {
|
|
148
|
+
default: undefined;
|
|
149
|
+
type: PropType<string[]>;
|
|
150
|
+
};
|
|
147
151
|
/** Allow row details */
|
|
148
152
|
detailed: {
|
|
149
153
|
default: boolean;
|
|
@@ -261,6 +265,10 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
261
265
|
default: undefined;
|
|
262
266
|
type: PropType<string[]>;
|
|
263
267
|
};
|
|
268
|
+
columnOrder: {
|
|
269
|
+
default: undefined;
|
|
270
|
+
type: PropType<string[]>;
|
|
271
|
+
};
|
|
264
272
|
/** Allow row details */
|
|
265
273
|
detailed: {
|
|
266
274
|
default: boolean;
|
|
@@ -346,6 +354,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
346
354
|
maxHeight: number;
|
|
347
355
|
virtualScrolling: boolean;
|
|
348
356
|
visibleColumns: string[];
|
|
357
|
+
columnOrder: string[];
|
|
349
358
|
detailed: boolean;
|
|
350
359
|
checkable: boolean;
|
|
351
360
|
isRowCheckable: Function;
|
|
@@ -16,14 +16,14 @@ declare const __VLS_component: import("vue").DefineComponent<{
|
|
|
16
16
|
modelValue: any[];
|
|
17
17
|
itemKey: string;
|
|
18
18
|
handle: string;
|
|
19
|
-
disabled
|
|
19
|
+
disabled?: boolean;
|
|
20
20
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
21
21
|
"update:modelValue": (...args: any[]) => void;
|
|
22
22
|
}, string, import("vue").PublicProps, Readonly<{
|
|
23
23
|
modelValue: any[];
|
|
24
24
|
itemKey: string;
|
|
25
25
|
handle: string;
|
|
26
|
-
disabled
|
|
26
|
+
disabled?: boolean;
|
|
27
27
|
}> & Readonly<{
|
|
28
28
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
29
29
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -60,8 +60,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
60
60
|
}>, {
|
|
61
61
|
size: number;
|
|
62
62
|
disabled: boolean;
|
|
63
|
-
showRemove: boolean;
|
|
64
63
|
draggable: boolean;
|
|
64
|
+
showRemove: boolean;
|
|
65
65
|
itemMaxWidth: number;
|
|
66
66
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
67
67
|
export default _default;
|
|
@@ -41,7 +41,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
41
41
|
onRemove?: ((...args: any[]) => any) | undefined;
|
|
42
42
|
}>, {
|
|
43
43
|
disabled: boolean;
|
|
44
|
-
showRemove: boolean;
|
|
45
44
|
draggable: boolean;
|
|
45
|
+
showRemove: boolean;
|
|
46
46
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
47
47
|
export default _default;
|
|
@@ -193,10 +193,10 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
193
193
|
cropper: boolean | BaseCropperConfig | null;
|
|
194
194
|
multiple: boolean;
|
|
195
195
|
layout: "list" | "gallery" | "images";
|
|
196
|
+
draggable: boolean;
|
|
196
197
|
maxSize: number;
|
|
197
198
|
accept: string;
|
|
198
199
|
acceptedExtensions: string[];
|
|
199
|
-
draggable: boolean;
|
|
200
200
|
currentMedia: Media[];
|
|
201
201
|
uploadUrl: string;
|
|
202
202
|
pickerComponent: "BaseFilePicker" | "BaseFilePickerCrop";
|
|
@@ -43,7 +43,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
43
43
|
onRemove?: ((...args: any[]) => any) | undefined;
|
|
44
44
|
}>, {
|
|
45
45
|
disabled: boolean;
|
|
46
|
-
showRemove: boolean;
|
|
47
46
|
draggable: boolean;
|
|
47
|
+
showRemove: boolean;
|
|
48
48
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
49
49
|
export default _default;
|
|
@@ -43,7 +43,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
43
43
|
onUpdate?: ((...args: any[]) => any) | undefined;
|
|
44
44
|
}>, {
|
|
45
45
|
disabled: boolean;
|
|
46
|
-
showRemove: boolean;
|
|
47
46
|
draggable: boolean;
|
|
47
|
+
showRemove: boolean;
|
|
48
48
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
49
49
|
export default _default;
|
|
@@ -52,7 +52,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
52
52
|
}>, {
|
|
53
53
|
size: number;
|
|
54
54
|
disabled: boolean;
|
|
55
|
-
showRemove: boolean;
|
|
56
55
|
draggable: boolean;
|
|
56
|
+
showRemove: boolean;
|
|
57
57
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
58
58
|
export default _default;
|
|
@@ -50,7 +50,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
50
50
|
}>, {
|
|
51
51
|
size: number;
|
|
52
52
|
disabled: boolean;
|
|
53
|
-
showRemove: boolean;
|
|
54
53
|
draggable: boolean;
|
|
54
|
+
showRemove: boolean;
|
|
55
55
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
56
56
|
export default _default;
|
|
@@ -83,7 +83,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
83
83
|
type: PropType<(row: CollectionItem, index: number, column: BaseTableColumnData, colIndex: number, event: MouseEvent) => void>;
|
|
84
84
|
};
|
|
85
85
|
}>, {
|
|
86
|
-
nextSequence: any;
|
|
87
86
|
addColumn: any;
|
|
88
87
|
removeColumn: any;
|
|
89
88
|
}, {
|
package/package.json
CHANGED
|
@@ -1,29 +1,70 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<div class="-mx-4 -my-2">
|
|
3
|
+
|
|
4
|
+
<div class="px-4 w-full">
|
|
5
|
+
<BaseInput
|
|
6
|
+
v-model="search"
|
|
7
|
+
size="sm"
|
|
8
|
+
class="w-full mb-2"
|
|
9
|
+
:placeholder="t('sui.search')"
|
|
10
|
+
/>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<BaseDraggable
|
|
14
|
+
:model-value="filteredColumns"
|
|
15
|
+
item-key="newKey"
|
|
16
|
+
handle=".handle"
|
|
17
|
+
:disabled="dragDisabled"
|
|
18
|
+
@update:model-value="onDragUpdate"
|
|
6
19
|
>
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
<template #item="{ element }">
|
|
21
|
+
<div class="flex items-center border-b">
|
|
22
|
+
|
|
23
|
+
<div
|
|
24
|
+
class="handle shrink-0 relative py-1 pl-4 pr-1 -left-1"
|
|
25
|
+
:class="[dragDisabled ? 'cursor-not-allowed opacity-50' : 'cursor-move']"
|
|
26
|
+
>
|
|
27
|
+
<BaseIcon
|
|
28
|
+
icon="mdi:drag"
|
|
29
|
+
class="text-slate-400 w-5 h-5"
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<div class="grow py-1.5 pr-4">
|
|
34
|
+
<label class="flex items-center gap-1" :class="[element.toggle ? 'cursor-pointer' : 'cursor-not-allowed']">
|
|
35
|
+
<input
|
|
36
|
+
:checked="visibleColumns.includes(element.newKey)"
|
|
37
|
+
type="checkbox"
|
|
38
|
+
:disabled="!element.toggle"
|
|
39
|
+
class="mr-2 shrink-0 h-3.5 w-3.5 rounded focus:ring-1 focus:ring-primary-300 focus:ring-offset-1"
|
|
40
|
+
:class="[element.toggle ? 'cursor-pointer' : 'cursor-not-allowed border-slate-300 bg-slate-100']"
|
|
41
|
+
:value="element.newKey"
|
|
42
|
+
@change="onVisibleColumnChange($event, element.newKey)"
|
|
43
|
+
>
|
|
44
|
+
<span
|
|
45
|
+
class="text-xs grow leading-tight"
|
|
46
|
+
:class="[element.toggle ? 'text-slate-700' : 'text-slate-400']"
|
|
47
|
+
>
|
|
48
|
+
{{ element.label }}
|
|
49
|
+
</span>
|
|
50
|
+
</label>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
</BaseDraggable>
|
|
55
|
+
</div>
|
|
21
56
|
</template>
|
|
22
57
|
|
|
23
58
|
<script lang="ts" setup>
|
|
24
59
|
import { cloneDeep } from 'lodash';
|
|
25
60
|
import { PropType } from 'vue';
|
|
26
61
|
import BaseDataTableTemplate from './BaseDataTableTemplate.vue';
|
|
62
|
+
import BaseDraggable from './BaseDraggable.vue';
|
|
63
|
+
import { BaseIcon } from '.';
|
|
64
|
+
import { BaseTableColumnData } from '@/types';
|
|
65
|
+
import { customKeyActions } from '@/services/table/customKeyActions';
|
|
66
|
+
import BaseInput from './BaseInput.vue';
|
|
67
|
+
import { t } from '@/i18n';
|
|
27
68
|
|
|
28
69
|
const props = defineProps({
|
|
29
70
|
table: {
|
|
@@ -34,9 +75,16 @@ const props = defineProps({
|
|
|
34
75
|
required: true,
|
|
35
76
|
type: Array as PropType<string[]>,
|
|
36
77
|
},
|
|
78
|
+
columnOrder: {
|
|
79
|
+
required: true,
|
|
80
|
+
type: Array as PropType<string[]>,
|
|
81
|
+
},
|
|
37
82
|
});
|
|
38
83
|
|
|
39
|
-
const emit = defineEmits([
|
|
84
|
+
const emit = defineEmits([
|
|
85
|
+
'update:visibleColumns',
|
|
86
|
+
'update:columnOrder'
|
|
87
|
+
]);
|
|
40
88
|
|
|
41
89
|
const toggleableColumns = computed(() => {
|
|
42
90
|
const tableVue = props.table;
|
|
@@ -49,9 +97,33 @@ const toggleableColumns = computed(() => {
|
|
|
49
97
|
return [];
|
|
50
98
|
}
|
|
51
99
|
|
|
52
|
-
return tableVue.newColumns.filter((
|
|
100
|
+
return tableVue.newColumns.filter((col) => col.newKey != customKeyActions);
|
|
53
101
|
});
|
|
54
102
|
|
|
103
|
+
const columns = ref([] as BaseTableColumnData[]);
|
|
104
|
+
|
|
105
|
+
watch(
|
|
106
|
+
toggleableColumns,
|
|
107
|
+
(newVal) => {
|
|
108
|
+
columns.value = newVal;
|
|
109
|
+
},
|
|
110
|
+
{ immediate: true }
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
// Search
|
|
114
|
+
|
|
115
|
+
const search = ref('');
|
|
116
|
+
|
|
117
|
+
const filteredColumns = computed(() => {
|
|
118
|
+
return columns.value.filter((col) => col.label.toLowerCase().includes(search.value.toLowerCase()));
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const dragDisabled = computed(() => {
|
|
122
|
+
return filteredColumns.value.length != columns.value.length;
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// Visible columns
|
|
126
|
+
|
|
55
127
|
function onVisibleColumnChange(event: any, newKey: string) {
|
|
56
128
|
const checked = event.target.checked as boolean;
|
|
57
129
|
|
|
@@ -67,4 +139,11 @@ function onVisibleColumnChange(event: any, newKey: string) {
|
|
|
67
139
|
|
|
68
140
|
emit('update:visibleColumns', newVisibleColumns);
|
|
69
141
|
}
|
|
142
|
+
|
|
143
|
+
// Drag
|
|
144
|
+
|
|
145
|
+
function onDragUpdate(value: BaseTableColumnData[]) {
|
|
146
|
+
emit('update:columnOrder', value.map((v) => v.newKey));
|
|
147
|
+
}
|
|
148
|
+
|
|
70
149
|
</script>
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
:sort-direction="dataIteratorProps.sortDirection"
|
|
79
79
|
:max-height="maxHeight"
|
|
80
80
|
:visible-columns="visibleColumns"
|
|
81
|
+
:column-order="columnOrder"
|
|
81
82
|
:size="sizeInternal.size.value"
|
|
82
83
|
:row-to="rowToInternal"
|
|
83
84
|
:row-href="rowHref"
|
|
@@ -95,7 +96,7 @@
|
|
|
95
96
|
:visible="rowActionsInternal.length > 0"
|
|
96
97
|
:toggle="false"
|
|
97
98
|
ignore-row-interactions
|
|
98
|
-
custom-key="
|
|
99
|
+
:custom-key="customKeyActions"
|
|
99
100
|
class="overflow-hidden"
|
|
100
101
|
>
|
|
101
102
|
<div class="flex justify-end gap-1 text-right w-full">
|
|
@@ -206,9 +207,11 @@
|
|
|
206
207
|
#columns
|
|
207
208
|
>
|
|
208
209
|
<BaseDataIteratorSectionColumns
|
|
209
|
-
v-model:visibleColumns="visibleColumns"
|
|
210
210
|
:table="table"
|
|
211
|
+
:visibleColumns="visibleColumns"
|
|
212
|
+
:column-order="columnOrder"
|
|
211
213
|
@update:visible-columns="onUpdateVisibleColumn"
|
|
214
|
+
@update:column-order="onUpdateColumnOrder"
|
|
212
215
|
/>
|
|
213
216
|
</template>
|
|
214
217
|
|
|
@@ -252,6 +255,7 @@ import { Size } from '@/utils/sizes';
|
|
|
252
255
|
import { useInputSize } from '@/composables/inputSize';
|
|
253
256
|
import BaseButton from './BaseButton.vue';
|
|
254
257
|
import BaseDataTableTemplate from './BaseDataTableTemplate.vue';
|
|
258
|
+
import { customKeyActions } from '@/services/table/customKeyActions';
|
|
255
259
|
|
|
256
260
|
const http = config.http;
|
|
257
261
|
|
|
@@ -653,8 +657,7 @@ const visibleColumns = ref<string[]>([]);
|
|
|
653
657
|
|
|
654
658
|
// Find visible columns in local storage
|
|
655
659
|
const VISIBLE_COLUMNS_LOCAL_STORAGE = 'sprintify.visible_columns.';
|
|
656
|
-
const VISIBLE_COLUMNS_LOCAL_STORAGE_KEY =
|
|
657
|
-
VISIBLE_COLUMNS_LOCAL_STORAGE + window.location.pathname;
|
|
660
|
+
const VISIBLE_COLUMNS_LOCAL_STORAGE_KEY = VISIBLE_COLUMNS_LOCAL_STORAGE + window.location.pathname;
|
|
658
661
|
|
|
659
662
|
const visibleColumnsFromStorage = JSON.parse(
|
|
660
663
|
localStorage.getItem(VISIBLE_COLUMNS_LOCAL_STORAGE_KEY) + ''
|
|
@@ -691,13 +694,58 @@ const unWatchTable = watch(
|
|
|
691
694
|
/**
|
|
692
695
|
* Update local storage when check input update
|
|
693
696
|
*/
|
|
694
|
-
function onUpdateVisibleColumn() {
|
|
697
|
+
function onUpdateVisibleColumn(columns: string[]) {
|
|
698
|
+
|
|
699
|
+
visibleColumns.value = columns;
|
|
700
|
+
|
|
695
701
|
localStorage.setItem(
|
|
696
702
|
VISIBLE_COLUMNS_LOCAL_STORAGE_KEY,
|
|
697
703
|
JSON.stringify(visibleColumns.value)
|
|
698
704
|
);
|
|
699
705
|
}
|
|
700
706
|
|
|
707
|
+
/*
|
|
708
|
+
|--------------------------------------------------------------------------
|
|
709
|
+
| Order columns
|
|
710
|
+
|--------------------------------------------------------------------------
|
|
711
|
+
*/
|
|
712
|
+
|
|
713
|
+
const columnOrder = ref<string[]>([]);
|
|
714
|
+
|
|
715
|
+
const COLUMN_ORDER_LOCAL_STORAGE = 'sprintify.column_order.';
|
|
716
|
+
const COLUMN_ORDER_LOCAL_STORAGE_KEY = COLUMN_ORDER_LOCAL_STORAGE + window.location.pathname;
|
|
717
|
+
|
|
718
|
+
onMounted(() => {
|
|
719
|
+
const columnOrderFromStorage = JSON.parse(
|
|
720
|
+
localStorage.getItem(COLUMN_ORDER_LOCAL_STORAGE_KEY) + ''
|
|
721
|
+
) as string[];
|
|
722
|
+
|
|
723
|
+
// If found, set columnOrder
|
|
724
|
+
if (
|
|
725
|
+
columnOrderFromStorage &&
|
|
726
|
+
isArray(columnOrderFromStorage) &&
|
|
727
|
+
columnOrderFromStorage.length > 0
|
|
728
|
+
) {
|
|
729
|
+
|
|
730
|
+
const colKeys = table.value?.newColumns.map((c) => c.newKey) ?? [];
|
|
731
|
+
|
|
732
|
+
columnOrder.value = columnOrderFromStorage.filter((c) => {
|
|
733
|
+
return colKeys.includes(c);
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
function onUpdateColumnOrder(value: string[]) {
|
|
739
|
+
|
|
740
|
+
columnOrder.value = value;
|
|
741
|
+
|
|
742
|
+
localStorage.setItem(
|
|
743
|
+
COLUMN_ORDER_LOCAL_STORAGE_KEY,
|
|
744
|
+
JSON.stringify(value)
|
|
745
|
+
);
|
|
746
|
+
|
|
747
|
+
}
|
|
748
|
+
|
|
701
749
|
/*
|
|
702
750
|
|--------------------------------------------------------------------------
|
|
703
751
|
| Row Actions
|