sprintify-ui 0.8.59 → 0.8.61
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 +5359 -5337
- package/dist/types/components/BaseDataTable.vue.d.ts +17 -0
- package/dist/types/utils/storage.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/BaseDataIteratorSectionColumns.vue +37 -3
- package/src/components/BaseDataTable.vue +14 -4
- package/src/utils/storage.ts +3 -0
|
@@ -1101,6 +1101,14 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
1101
1101
|
default: boolean;
|
|
1102
1102
|
type: BooleanConstructor;
|
|
1103
1103
|
};
|
|
1104
|
+
/**
|
|
1105
|
+
* Storage key to save visible columns and order settings.
|
|
1106
|
+
* By default, it uses the current URL path, without query params.
|
|
1107
|
+
*/
|
|
1108
|
+
storageKey: {
|
|
1109
|
+
type: StringConstructor;
|
|
1110
|
+
default: string;
|
|
1111
|
+
};
|
|
1104
1112
|
}>, {
|
|
1105
1113
|
fetch: typeof fetch;
|
|
1106
1114
|
fetchWithoutLoading: typeof fetchWithoutLoading;
|
|
@@ -1349,6 +1357,14 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
1349
1357
|
default: boolean;
|
|
1350
1358
|
type: BooleanConstructor;
|
|
1351
1359
|
};
|
|
1360
|
+
/**
|
|
1361
|
+
* Storage key to save visible columns and order settings.
|
|
1362
|
+
* By default, it uses the current URL path, without query params.
|
|
1363
|
+
*/
|
|
1364
|
+
storageKey: {
|
|
1365
|
+
type: StringConstructor;
|
|
1366
|
+
default: string;
|
|
1367
|
+
};
|
|
1352
1368
|
}>> & Readonly<{
|
|
1353
1369
|
onDelete?: ((...args: any[]) => any) | undefined;
|
|
1354
1370
|
"onUpdate:checked-rows"?: ((...args: any[]) => any) | undefined;
|
|
@@ -1389,6 +1405,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
1389
1405
|
toggleable: boolean;
|
|
1390
1406
|
rowActions: RowAction[];
|
|
1391
1407
|
numberOfVisibleRowActions: number;
|
|
1408
|
+
storageKey: string;
|
|
1392
1409
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
1393
1410
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
1394
1411
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,15 +1,30 @@
|
|
|
1
1
|
<template>
|
|
2
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
|
+
icon-left="heroicons:magnifying-glass"
|
|
9
|
+
class="w-full mb-3"
|
|
10
|
+
:placeholder="t('sui.search')"
|
|
11
|
+
/>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
3
14
|
<BaseDraggable
|
|
4
|
-
:model-value="
|
|
15
|
+
:model-value="filteredColumns"
|
|
5
16
|
item-key="newKey"
|
|
6
17
|
handle=".handle"
|
|
18
|
+
:disabled="dragDisabled"
|
|
7
19
|
@update:model-value="onDragUpdate"
|
|
8
20
|
>
|
|
9
21
|
<template #item="{ element }">
|
|
10
|
-
<div class="flex items-center border-
|
|
22
|
+
<div class="flex items-center border-t">
|
|
11
23
|
|
|
12
|
-
<div
|
|
24
|
+
<div
|
|
25
|
+
class="handle shrink-0 relative py-1 pl-4 pr-1 -left-1"
|
|
26
|
+
:class="[dragDisabled ? 'cursor-not-allowed opacity-50' : 'cursor-move']"
|
|
27
|
+
>
|
|
13
28
|
<BaseIcon
|
|
14
29
|
icon="mdi:drag"
|
|
15
30
|
class="text-slate-400 w-5 h-5"
|
|
@@ -49,6 +64,8 @@ import BaseDraggable from './BaseDraggable.vue';
|
|
|
49
64
|
import { BaseIcon } from '.';
|
|
50
65
|
import { BaseTableColumnData } from '@/types';
|
|
51
66
|
import { customKeyActions } from '@/services/table/customKeyActions';
|
|
67
|
+
import BaseInput from './BaseInput.vue';
|
|
68
|
+
import { t } from '@/i18n';
|
|
52
69
|
|
|
53
70
|
const props = defineProps({
|
|
54
71
|
table: {
|
|
@@ -94,6 +111,20 @@ watch(
|
|
|
94
111
|
{ immediate: true }
|
|
95
112
|
);
|
|
96
113
|
|
|
114
|
+
// Search
|
|
115
|
+
|
|
116
|
+
const search = ref('');
|
|
117
|
+
|
|
118
|
+
const filteredColumns = computed(() => {
|
|
119
|
+
return columns.value.filter((col) => col.label.toLowerCase().includes(search.value.toLowerCase()));
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
const dragDisabled = computed(() => {
|
|
123
|
+
return filteredColumns.value.length != columns.value.length;
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
// Visible columns
|
|
127
|
+
|
|
97
128
|
function onVisibleColumnChange(event: any, newKey: string) {
|
|
98
129
|
const checked = event.target.checked as boolean;
|
|
99
130
|
|
|
@@ -110,7 +141,10 @@ function onVisibleColumnChange(event: any, newKey: string) {
|
|
|
110
141
|
emit('update:visibleColumns', newVisibleColumns);
|
|
111
142
|
}
|
|
112
143
|
|
|
144
|
+
// Drag
|
|
145
|
+
|
|
113
146
|
function onDragUpdate(value: BaseTableColumnData[]) {
|
|
114
147
|
emit('update:columnOrder', value.map((v) => v.newKey));
|
|
115
148
|
}
|
|
149
|
+
|
|
116
150
|
</script>
|
|
@@ -256,6 +256,7 @@ import { useInputSize } from '@/composables/inputSize';
|
|
|
256
256
|
import BaseButton from './BaseButton.vue';
|
|
257
257
|
import BaseDataTableTemplate from './BaseDataTableTemplate.vue';
|
|
258
258
|
import { customKeyActions } from '@/services/table/customKeyActions';
|
|
259
|
+
import { storageKeyPrefix } from '@/utils/storage';
|
|
259
260
|
|
|
260
261
|
const http = config.http;
|
|
261
262
|
|
|
@@ -555,6 +556,15 @@ const props = defineProps({
|
|
|
555
556
|
default: false,
|
|
556
557
|
type: Boolean,
|
|
557
558
|
},
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Storage key to save visible columns and order settings.
|
|
562
|
+
* By default, it uses the current URL path, without query params.
|
|
563
|
+
*/
|
|
564
|
+
storageKey: {
|
|
565
|
+
type: String,
|
|
566
|
+
default: window.location.pathname,
|
|
567
|
+
},
|
|
558
568
|
});
|
|
559
569
|
|
|
560
570
|
const sizeInternal = useInputSize(props.size);
|
|
@@ -647,6 +657,8 @@ const onDelete = (row: CollectionItem) => {
|
|
|
647
657
|
});
|
|
648
658
|
};
|
|
649
659
|
|
|
660
|
+
const componentStorageKey = 'base_data_table.';
|
|
661
|
+
|
|
650
662
|
/*
|
|
651
663
|
|--------------------------------------------------------------------------
|
|
652
664
|
| Toggle columns
|
|
@@ -656,8 +668,7 @@ const onDelete = (row: CollectionItem) => {
|
|
|
656
668
|
const visibleColumns = ref<string[]>([]);
|
|
657
669
|
|
|
658
670
|
// Find visible columns in local storage
|
|
659
|
-
const
|
|
660
|
-
const VISIBLE_COLUMNS_LOCAL_STORAGE_KEY = VISIBLE_COLUMNS_LOCAL_STORAGE + window.location.pathname;
|
|
671
|
+
const VISIBLE_COLUMNS_LOCAL_STORAGE_KEY = storageKeyPrefix + componentStorageKey + props.storageKey + '.visible_columns';
|
|
661
672
|
|
|
662
673
|
const visibleColumnsFromStorage = JSON.parse(
|
|
663
674
|
localStorage.getItem(VISIBLE_COLUMNS_LOCAL_STORAGE_KEY) + ''
|
|
@@ -712,8 +723,7 @@ function onUpdateVisibleColumn(columns: string[]) {
|
|
|
712
723
|
|
|
713
724
|
const columnOrder = ref<string[]>([]);
|
|
714
725
|
|
|
715
|
-
const
|
|
716
|
-
const COLUMN_ORDER_LOCAL_STORAGE_KEY = COLUMN_ORDER_LOCAL_STORAGE + window.location.pathname;
|
|
726
|
+
const COLUMN_ORDER_LOCAL_STORAGE_KEY = storageKeyPrefix + componentStorageKey + props.storageKey + '.column_order';
|
|
717
727
|
|
|
718
728
|
onMounted(() => {
|
|
719
729
|
const columnOrderFromStorage = JSON.parse(
|