sprintify-ui 0.8.57 → 0.8.59
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 +13266 -13177
- package/dist/types/components/BaseDataIterator.vue.d.ts +3 -0
- package/dist/types/components/BaseDataIteratorSectionColumns.vue.d.ts +10 -0
- package/dist/types/components/BaseDataTable.vue.d.ts +22 -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/BaseDataIterator.vue +7 -0
- package/src/components/BaseDataIteratorSectionColumns.vue +66 -20
- package/src/components/BaseDataTable.stories.js +3 -1
- package/src/components/BaseDataTable.vue +55 -6
- 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
|
@@ -263,14 +263,17 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
|
|
|
263
263
|
query: DataTableQuery;
|
|
264
264
|
updateQuery: (newQuery: DataTableQuery) => void;
|
|
265
265
|
updateQueryValue: (key: string, value: any) => void;
|
|
266
|
+
updateQueryValueDebounce: import("lodash").DebouncedFunc<(key: string, value: any) => void>;
|
|
266
267
|
}) => any>> & Partial<Record<string, (_: {
|
|
267
268
|
query: DataTableQuery;
|
|
268
269
|
updateQuery: (newQuery: DataTableQuery) => void;
|
|
269
270
|
updateQueryValue: (key: string, value: any) => void;
|
|
271
|
+
updateQueryValueDebounce: import("lodash").DebouncedFunc<(key: string, value: any) => void>;
|
|
270
272
|
}) => any>> & Partial<Record<string, (_: {
|
|
271
273
|
query: DataTableQuery;
|
|
272
274
|
updateQuery: (newQuery: DataTableQuery) => void;
|
|
273
275
|
updateQueryValue: (key: string, value: any) => void;
|
|
276
|
+
updateQueryValueDebounce: import("lodash").DebouncedFunc<(key: string, value: any) => void>;
|
|
274
277
|
}) => any>> & {
|
|
275
278
|
default?(_: {
|
|
276
279
|
items: Collection;
|
|
@@ -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;
|
|
@@ -17,6 +17,7 @@ declare function __VLS_template(): {
|
|
|
17
17
|
query: DataTableQuery;
|
|
18
18
|
updateQuery: (newQuery: DataTableQuery) => void;
|
|
19
19
|
updateQueryValue: (key: string, value: any) => void;
|
|
20
|
+
updateQueryValueDebounce: import("lodash").DebouncedFunc<(key: string, value: any) => void>;
|
|
20
21
|
}): any;
|
|
21
22
|
sidebarTop?(_: {
|
|
22
23
|
paginationMetadata: import("@/types").PaginationMetadata | null;
|
|
@@ -382,14 +383,17 @@ declare function __VLS_template(): {
|
|
|
382
383
|
query: DataTableQuery;
|
|
383
384
|
updateQuery: (newQuery: DataTableQuery) => void;
|
|
384
385
|
updateQueryValue: (key: string, value: any) => void;
|
|
386
|
+
updateQueryValueDebounce: import("lodash").DebouncedFunc<(key: string, value: any) => void>;
|
|
385
387
|
}) => any>> & Partial<Record<string, (_: {
|
|
386
388
|
query: DataTableQuery;
|
|
387
389
|
updateQuery: (newQuery: DataTableQuery) => void;
|
|
388
390
|
updateQueryValue: (key: string, value: any) => void;
|
|
391
|
+
updateQueryValueDebounce: import("lodash").DebouncedFunc<(key: string, value: any) => void>;
|
|
389
392
|
}) => any>> & Partial<Record<string, (_: {
|
|
390
393
|
query: DataTableQuery;
|
|
391
394
|
updateQuery: (newQuery: DataTableQuery) => void;
|
|
392
395
|
updateQueryValue: (key: string, value: any) => void;
|
|
396
|
+
updateQueryValueDebounce: import("lodash").DebouncedFunc<(key: string, value: any) => void>;
|
|
393
397
|
}) => any>> & {
|
|
394
398
|
default?(_: {
|
|
395
399
|
items: Collection;
|
|
@@ -422,6 +426,7 @@ declare function __VLS_template(): {
|
|
|
422
426
|
maxHeight: number;
|
|
423
427
|
virtualScrolling: boolean;
|
|
424
428
|
visibleColumns: string[];
|
|
429
|
+
columnOrder: string[];
|
|
425
430
|
detailed: boolean;
|
|
426
431
|
checkable: boolean;
|
|
427
432
|
isRowCheckable: Function;
|
|
@@ -445,6 +450,7 @@ declare function __VLS_template(): {
|
|
|
445
450
|
readonly hasDetailedVisible: Function;
|
|
446
451
|
readonly maxHeight?: number | undefined;
|
|
447
452
|
readonly visibleColumns?: string[] | undefined;
|
|
453
|
+
readonly columnOrder?: string[] | undefined;
|
|
448
454
|
readonly rowTo?: ((row: CollectionItem) => RouteLocationRaw) | undefined;
|
|
449
455
|
readonly rowHref?: ((row: CollectionItem) => string) | undefined;
|
|
450
456
|
readonly onRowClick?: ((row: CollectionItem, index: number, event: MouseEvent) => void) | undefined;
|
|
@@ -471,6 +477,10 @@ declare function __VLS_template(): {
|
|
|
471
477
|
default: undefined;
|
|
472
478
|
type: PropType<string[]>;
|
|
473
479
|
};
|
|
480
|
+
columnOrder: {
|
|
481
|
+
default: undefined;
|
|
482
|
+
type: PropType<string[]>;
|
|
483
|
+
};
|
|
474
484
|
detailed: {
|
|
475
485
|
default: boolean;
|
|
476
486
|
type: BooleanConstructor;
|
|
@@ -537,7 +547,7 @@ declare function __VLS_template(): {
|
|
|
537
547
|
"onUpdate:openedDetailed"?: ((...args: any[]) => any) | undefined;
|
|
538
548
|
"onCell-click"?: ((...args: any[]) => any) | undefined;
|
|
539
549
|
"onRow-click"?: ((...args: any[]) => any) | undefined;
|
|
540
|
-
}>, "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">;
|
|
541
551
|
$attrs: {
|
|
542
552
|
[x: string]: unknown;
|
|
543
553
|
};
|
|
@@ -565,6 +575,10 @@ declare function __VLS_template(): {
|
|
|
565
575
|
default: undefined;
|
|
566
576
|
type: PropType<string[]>;
|
|
567
577
|
};
|
|
578
|
+
columnOrder: {
|
|
579
|
+
default: undefined;
|
|
580
|
+
type: PropType<string[]>;
|
|
581
|
+
};
|
|
568
582
|
detailed: {
|
|
569
583
|
default: boolean;
|
|
570
584
|
type: BooleanConstructor;
|
|
@@ -676,6 +690,7 @@ declare function __VLS_template(): {
|
|
|
676
690
|
maxHeight: number;
|
|
677
691
|
virtualScrolling: boolean;
|
|
678
692
|
visibleColumns: string[];
|
|
693
|
+
columnOrder: string[];
|
|
679
694
|
detailed: boolean;
|
|
680
695
|
checkable: boolean;
|
|
681
696
|
isRowCheckable: Function;
|
|
@@ -714,6 +729,7 @@ declare function __VLS_template(): {
|
|
|
714
729
|
maxHeight: number;
|
|
715
730
|
virtualScrolling: boolean;
|
|
716
731
|
visibleColumns: string[];
|
|
732
|
+
columnOrder: string[];
|
|
717
733
|
detailed: boolean;
|
|
718
734
|
checkable: boolean;
|
|
719
735
|
isRowCheckable: Function;
|
|
@@ -736,6 +752,10 @@ declare function __VLS_template(): {
|
|
|
736
752
|
default: undefined;
|
|
737
753
|
type: PropType<string[]>;
|
|
738
754
|
};
|
|
755
|
+
columnOrder: {
|
|
756
|
+
default: undefined;
|
|
757
|
+
type: PropType<string[]>;
|
|
758
|
+
};
|
|
739
759
|
detailed: {
|
|
740
760
|
default: boolean;
|
|
741
761
|
type: BooleanConstructor;
|
|
@@ -802,7 +822,7 @@ declare function __VLS_template(): {
|
|
|
802
822
|
"onUpdate:openedDetailed"?: ((...args: any[]) => any) | undefined;
|
|
803
823
|
"onCell-click"?: ((...args: any[]) => any) | undefined;
|
|
804
824
|
"onRow-click"?: ((...args: any[]) => any) | undefined;
|
|
805
|
-
}>, "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<{
|
|
806
826
|
newColumns: import("vue").ComputedRef<{
|
|
807
827
|
id: string;
|
|
808
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
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
:query="query"
|
|
81
81
|
:update-query="updateFilterQuery"
|
|
82
82
|
:update-query-value="updateFilterQueryValue"
|
|
83
|
+
:update-query-value-debounce="updateFilterQueryValueDebounce"
|
|
83
84
|
/>
|
|
84
85
|
</BaseDataIteratorSectionBox>
|
|
85
86
|
</div>
|
|
@@ -146,6 +147,7 @@
|
|
|
146
147
|
:query="query"
|
|
147
148
|
:update-query="updateFilterQuery"
|
|
148
149
|
:update-query-value="updateFilterQueryValue"
|
|
150
|
+
:update-query-value-debounce="updateFilterQueryValueDebounce"
|
|
149
151
|
/>
|
|
150
152
|
</BaseDataIteratorSectionBox>
|
|
151
153
|
</template>
|
|
@@ -171,6 +173,7 @@
|
|
|
171
173
|
:query="query"
|
|
172
174
|
:update-query="updateFilterQuery"
|
|
173
175
|
:update-query-value="updateFilterQueryValue"
|
|
176
|
+
:update-query-value-debounce="updateFilterQueryValueDebounce"
|
|
174
177
|
/>
|
|
175
178
|
</BaseDataIteratorSectionModal>
|
|
176
179
|
</template>
|
|
@@ -453,6 +456,10 @@ function updateFilterQueryValue(key: string, value: any) {
|
|
|
453
456
|
updateQuery(newQuery);
|
|
454
457
|
}
|
|
455
458
|
|
|
459
|
+
const updateFilterQueryValueDebounce = debounce((key: string, value: any) => {
|
|
460
|
+
updateFilterQueryValue(key, value);
|
|
461
|
+
}, 350);
|
|
462
|
+
|
|
456
463
|
function updateFilterQuery(newQuery: DataTableQuery) {
|
|
457
464
|
newQuery = set(newQuery, 'page', 1);
|
|
458
465
|
updateQuery(newQuery);
|
|
@@ -1,29 +1,54 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<div class="-mx-4 -my-2">
|
|
3
|
+
<BaseDraggable
|
|
4
|
+
:model-value="columns"
|
|
5
|
+
item-key="newKey"
|
|
6
|
+
handle=".handle"
|
|
7
|
+
@update:model-value="onDragUpdate"
|
|
6
8
|
>
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
<template #item="{ element }">
|
|
10
|
+
<div class="flex items-center border-b">
|
|
11
|
+
|
|
12
|
+
<div class="handle shrink-0 cursor-move relative py-1 pl-4 pr-1 -left-1">
|
|
13
|
+
<BaseIcon
|
|
14
|
+
icon="mdi:drag"
|
|
15
|
+
class="text-slate-400 w-5 h-5"
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<div class="grow py-1.5 pr-4">
|
|
20
|
+
<label class="flex items-center gap-1" :class="[element.toggle ? 'cursor-pointer' : 'cursor-not-allowed']">
|
|
21
|
+
<input
|
|
22
|
+
:checked="visibleColumns.includes(element.newKey)"
|
|
23
|
+
type="checkbox"
|
|
24
|
+
:disabled="!element.toggle"
|
|
25
|
+
class="mr-2 shrink-0 h-3.5 w-3.5 rounded focus:ring-1 focus:ring-primary-300 focus:ring-offset-1"
|
|
26
|
+
:class="[element.toggle ? 'cursor-pointer' : 'cursor-not-allowed border-slate-300 bg-slate-100']"
|
|
27
|
+
:value="element.newKey"
|
|
28
|
+
@change="onVisibleColumnChange($event, element.newKey)"
|
|
29
|
+
>
|
|
30
|
+
<span
|
|
31
|
+
class="text-xs grow leading-tight"
|
|
32
|
+
:class="[element.toggle ? 'text-slate-700' : 'text-slate-400']"
|
|
33
|
+
>
|
|
34
|
+
{{ element.label }}
|
|
35
|
+
</span>
|
|
36
|
+
</label>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
</BaseDraggable>
|
|
41
|
+
</div>
|
|
21
42
|
</template>
|
|
22
43
|
|
|
23
44
|
<script lang="ts" setup>
|
|
24
45
|
import { cloneDeep } from 'lodash';
|
|
25
46
|
import { PropType } from 'vue';
|
|
26
47
|
import BaseDataTableTemplate from './BaseDataTableTemplate.vue';
|
|
48
|
+
import BaseDraggable from './BaseDraggable.vue';
|
|
49
|
+
import { BaseIcon } from '.';
|
|
50
|
+
import { BaseTableColumnData } from '@/types';
|
|
51
|
+
import { customKeyActions } from '@/services/table/customKeyActions';
|
|
27
52
|
|
|
28
53
|
const props = defineProps({
|
|
29
54
|
table: {
|
|
@@ -34,9 +59,16 @@ const props = defineProps({
|
|
|
34
59
|
required: true,
|
|
35
60
|
type: Array as PropType<string[]>,
|
|
36
61
|
},
|
|
62
|
+
columnOrder: {
|
|
63
|
+
required: true,
|
|
64
|
+
type: Array as PropType<string[]>,
|
|
65
|
+
},
|
|
37
66
|
});
|
|
38
67
|
|
|
39
|
-
const emit = defineEmits([
|
|
68
|
+
const emit = defineEmits([
|
|
69
|
+
'update:visibleColumns',
|
|
70
|
+
'update:columnOrder'
|
|
71
|
+
]);
|
|
40
72
|
|
|
41
73
|
const toggleableColumns = computed(() => {
|
|
42
74
|
const tableVue = props.table;
|
|
@@ -49,9 +81,19 @@ const toggleableColumns = computed(() => {
|
|
|
49
81
|
return [];
|
|
50
82
|
}
|
|
51
83
|
|
|
52
|
-
return tableVue.newColumns.filter((
|
|
84
|
+
return tableVue.newColumns.filter((col) => col.newKey != customKeyActions);
|
|
53
85
|
});
|
|
54
86
|
|
|
87
|
+
const columns = ref([] as BaseTableColumnData[]);
|
|
88
|
+
|
|
89
|
+
watch(
|
|
90
|
+
toggleableColumns,
|
|
91
|
+
(newVal) => {
|
|
92
|
+
columns.value = newVal;
|
|
93
|
+
},
|
|
94
|
+
{ immediate: true }
|
|
95
|
+
);
|
|
96
|
+
|
|
55
97
|
function onVisibleColumnChange(event: any, newKey: string) {
|
|
56
98
|
const checked = event.target.checked as boolean;
|
|
57
99
|
|
|
@@ -67,4 +109,8 @@ function onVisibleColumnChange(event: any, newKey: string) {
|
|
|
67
109
|
|
|
68
110
|
emit('update:visibleColumns', newVisibleColumns);
|
|
69
111
|
}
|
|
112
|
+
|
|
113
|
+
function onDragUpdate(value: BaseTableColumnData[]) {
|
|
114
|
+
emit('update:columnOrder', value.map((v) => v.newKey));
|
|
115
|
+
}
|
|
70
116
|
</script>
|
|
@@ -2,6 +2,7 @@ import BaseDataTable from "./BaseDataTable.vue";
|
|
|
2
2
|
import BaseTableColumn from "./BaseTableColumn.vue";
|
|
3
3
|
import BaseBoolean from "./BaseBoolean.vue";
|
|
4
4
|
import BaseSelect from "./BaseSelect.vue";
|
|
5
|
+
import BaseInput from "./BaseInput.vue";
|
|
5
6
|
import BaseBadge from "./BaseBadge.vue";
|
|
6
7
|
import BaseAppSnackbars from "./BaseAppSnackbars.vue";
|
|
7
8
|
import BaseAppDialogs from "./BaseAppDialogs.vue";
|
|
@@ -30,7 +31,7 @@ export default {
|
|
|
30
31
|
args: {
|
|
31
32
|
url: "https://effettandem.com/api/content/articles",
|
|
32
33
|
urlQuery: {
|
|
33
|
-
per_page:
|
|
34
|
+
per_page: 32,
|
|
34
35
|
},
|
|
35
36
|
historyMode: false,
|
|
36
37
|
},
|
|
@@ -44,6 +45,7 @@ const templateComponents = {
|
|
|
44
45
|
BaseBadge,
|
|
45
46
|
BaseAppSnackbars,
|
|
46
47
|
BaseAppDialogs,
|
|
48
|
+
BaseInput,
|
|
47
49
|
};
|
|
48
50
|
|
|
49
51
|
const componentProps = {
|
|
@@ -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">
|
|
@@ -176,13 +177,14 @@
|
|
|
176
177
|
|
|
177
178
|
<template
|
|
178
179
|
v-if="$slots.filters"
|
|
179
|
-
#filters="{ query, updateQuery, updateQueryValue }"
|
|
180
|
+
#filters="{ query, updateQuery, updateQueryValue, updateQueryValueDebounce }"
|
|
180
181
|
>
|
|
181
182
|
<slot
|
|
182
183
|
name="filters"
|
|
183
184
|
:query="query"
|
|
184
185
|
:update-query="updateQuery"
|
|
185
186
|
:update-query-value="updateQueryValue"
|
|
187
|
+
:update-query-value-debounce="updateQueryValueDebounce"
|
|
186
188
|
/>
|
|
187
189
|
</template>
|
|
188
190
|
|
|
@@ -205,9 +207,11 @@
|
|
|
205
207
|
#columns
|
|
206
208
|
>
|
|
207
209
|
<BaseDataIteratorSectionColumns
|
|
208
|
-
v-model:visibleColumns="visibleColumns"
|
|
209
210
|
:table="table"
|
|
211
|
+
:visibleColumns="visibleColumns"
|
|
212
|
+
:column-order="columnOrder"
|
|
210
213
|
@update:visible-columns="onUpdateVisibleColumn"
|
|
214
|
+
@update:column-order="onUpdateColumnOrder"
|
|
211
215
|
/>
|
|
212
216
|
</template>
|
|
213
217
|
|
|
@@ -251,6 +255,7 @@ import { Size } from '@/utils/sizes';
|
|
|
251
255
|
import { useInputSize } from '@/composables/inputSize';
|
|
252
256
|
import BaseButton from './BaseButton.vue';
|
|
253
257
|
import BaseDataTableTemplate from './BaseDataTableTemplate.vue';
|
|
258
|
+
import { customKeyActions } from '@/services/table/customKeyActions';
|
|
254
259
|
|
|
255
260
|
const http = config.http;
|
|
256
261
|
|
|
@@ -652,8 +657,7 @@ const visibleColumns = ref<string[]>([]);
|
|
|
652
657
|
|
|
653
658
|
// Find visible columns in local storage
|
|
654
659
|
const VISIBLE_COLUMNS_LOCAL_STORAGE = 'sprintify.visible_columns.';
|
|
655
|
-
const VISIBLE_COLUMNS_LOCAL_STORAGE_KEY =
|
|
656
|
-
VISIBLE_COLUMNS_LOCAL_STORAGE + window.location.pathname;
|
|
660
|
+
const VISIBLE_COLUMNS_LOCAL_STORAGE_KEY = VISIBLE_COLUMNS_LOCAL_STORAGE + window.location.pathname;
|
|
657
661
|
|
|
658
662
|
const visibleColumnsFromStorage = JSON.parse(
|
|
659
663
|
localStorage.getItem(VISIBLE_COLUMNS_LOCAL_STORAGE_KEY) + ''
|
|
@@ -690,13 +694,58 @@ const unWatchTable = watch(
|
|
|
690
694
|
/**
|
|
691
695
|
* Update local storage when check input update
|
|
692
696
|
*/
|
|
693
|
-
function onUpdateVisibleColumn() {
|
|
697
|
+
function onUpdateVisibleColumn(columns: string[]) {
|
|
698
|
+
|
|
699
|
+
visibleColumns.value = columns;
|
|
700
|
+
|
|
694
701
|
localStorage.setItem(
|
|
695
702
|
VISIBLE_COLUMNS_LOCAL_STORAGE_KEY,
|
|
696
703
|
JSON.stringify(visibleColumns.value)
|
|
697
704
|
);
|
|
698
705
|
}
|
|
699
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
|
+
|
|
700
749
|
/*
|
|
701
750
|
|--------------------------------------------------------------------------
|
|
702
751
|
| Row Actions
|