@vc-shell/framework 1.0.56 → 1.0.57
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/framework.mjs +126 -57
- package/dist/index.css +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/shared/app-switcher/components/index.d.ts +1 -1
- package/dist/types/shared/app-switcher/components/index.d.ts.map +1 -1
- package/dist/types/shared/app-switcher/components/vc-app-switcher/index.d.ts +22 -0
- package/dist/types/shared/app-switcher/components/vc-app-switcher/index.d.ts.map +1 -0
- package/dist/types/shared/app-switcher/index.d.ts +6 -0
- package/dist/types/shared/app-switcher/index.d.ts.map +1 -1
- package/dist/types/shared/assets/components/assets-details/index.d.ts +46 -0
- package/dist/types/shared/assets/components/assets-details/index.d.ts.map +1 -0
- package/dist/types/shared/assets/components/index.d.ts +1 -1
- package/dist/types/shared/assets/components/index.d.ts.map +1 -1
- package/dist/types/shared/assets/index.d.ts +6 -0
- package/dist/types/shared/assets/index.d.ts.map +1 -1
- package/dist/types/shared/blade-navigation/components/index.d.ts +1 -1
- package/dist/types/shared/blade-navigation/components/index.d.ts.map +1 -1
- package/dist/types/shared/blade-navigation/components/vc-blade-navigation/index.d.ts +66 -0
- package/dist/types/shared/blade-navigation/components/vc-blade-navigation/index.d.ts.map +1 -0
- package/dist/types/shared/blade-navigation/index.d.ts +6 -0
- package/dist/types/shared/blade-navigation/index.d.ts.map +1 -1
- package/dist/types/ui/components/atoms/vc-badge/index.d.ts +106 -9
- package/dist/types/ui/components/atoms/vc-badge/index.d.ts.map +1 -1
- package/dist/types/ui/components/atoms/vc-button/index.d.ts +153 -6
- package/dist/types/ui/components/atoms/vc-button/index.d.ts.map +1 -1
- package/dist/types/ui/components/atoms/vc-card/index.d.ts +163 -7
- package/dist/types/ui/components/atoms/vc-card/index.d.ts.map +1 -1
- package/dist/types/ui/components/atoms/vc-checkbox/index.d.ts +143 -7
- package/dist/types/ui/components/atoms/vc-checkbox/index.d.ts.map +1 -1
- package/dist/types/ui/components/atoms/vc-col/index.d.ts +81 -6
- package/dist/types/ui/components/atoms/vc-col/index.d.ts.map +1 -1
- package/dist/types/ui/components/atoms/vc-container/index.d.ts +112 -6
- package/dist/types/ui/components/atoms/vc-container/index.d.ts.map +1 -1
- package/dist/types/ui/components/atoms/vc-hint/index.d.ts +51 -6
- package/dist/types/ui/components/atoms/vc-hint/index.d.ts.map +1 -1
- package/dist/types/ui/components/atoms/vc-icon/index.d.ts +26 -7
- package/dist/types/ui/components/atoms/vc-icon/index.d.ts.map +1 -1
- package/dist/types/ui/components/atoms/vc-image/index.d.ts +67 -7
- package/dist/types/ui/components/atoms/vc-image/index.d.ts.map +1 -1
- package/dist/types/ui/components/atoms/vc-info-row/index.d.ts +33 -7
- package/dist/types/ui/components/atoms/vc-info-row/index.d.ts.map +1 -1
- package/dist/types/ui/components/atoms/vc-label/index.d.ts +95 -7
- package/dist/types/ui/components/atoms/vc-label/index.d.ts.map +1 -1
- package/dist/types/ui/components/atoms/vc-link/index.d.ts +103 -6
- package/dist/types/ui/components/atoms/vc-link/index.d.ts.map +1 -1
- package/dist/types/ui/components/atoms/vc-loading/index.d.ts +9 -7
- package/dist/types/ui/components/atoms/vc-loading/index.d.ts.map +1 -1
- package/dist/types/ui/components/atoms/vc-progress/index.d.ts +100 -6
- package/dist/types/ui/components/atoms/vc-progress/index.d.ts.map +1 -1
- package/dist/types/ui/components/atoms/vc-row/index.d.ts +51 -6
- package/dist/types/ui/components/atoms/vc-row/index.d.ts.map +1 -1
- package/dist/types/ui/components/atoms/vc-status/index.d.ts +116 -6
- package/dist/types/ui/components/atoms/vc-status/index.d.ts.map +1 -1
- package/dist/types/ui/components/atoms/vc-status-icon/index.d.ts +9 -7
- package/dist/types/ui/components/atoms/vc-status-icon/index.d.ts.map +1 -1
- package/dist/types/ui/components/atoms/vc-switch/index.d.ts +39 -7
- package/dist/types/ui/components/atoms/vc-switch/index.d.ts.map +1 -1
- package/dist/types/ui/components/atoms/vc-widget/index.d.ts +31 -7
- package/dist/types/ui/components/atoms/vc-widget/index.d.ts.map +1 -1
- package/dist/types/ui/components/index.d.ts +39 -39
- package/dist/types/ui/components/index.d.ts.map +1 -1
- package/dist/types/ui/components/molecules/vc-breadcrumbs/index.d.ts +33 -7
- package/dist/types/ui/components/molecules/vc-breadcrumbs/index.d.ts.map +1 -1
- package/dist/types/ui/components/molecules/vc-code-editor/index.d.ts +188 -6
- package/dist/types/ui/components/molecules/vc-code-editor/index.d.ts.map +1 -1
- package/dist/types/ui/components/molecules/vc-editor/index.d.ts +204 -6
- package/dist/types/ui/components/molecules/vc-editor/index.d.ts.map +1 -1
- package/dist/types/ui/components/molecules/vc-file-upload/index.d.ts +175 -6
- package/dist/types/ui/components/molecules/vc-file-upload/index.d.ts.map +1 -1
- package/dist/types/ui/components/molecules/vc-file-upload/vc-file-upload.vue.d.ts.map +1 -1
- package/dist/types/ui/components/molecules/vc-form/index.d.ts +51 -6
- package/dist/types/ui/components/molecules/vc-form/index.d.ts.map +1 -1
- package/dist/types/ui/components/molecules/vc-input/index.d.ts +375 -46
- package/dist/types/ui/components/molecules/vc-input/index.d.ts.map +1 -1
- package/dist/types/ui/components/molecules/vc-input-currency/index.d.ts +365 -12
- package/dist/types/ui/components/molecules/vc-input-currency/index.d.ts.map +1 -1
- package/dist/types/ui/components/molecules/vc-notification/index.d.ts +101 -6
- package/dist/types/ui/components/molecules/vc-notification/index.d.ts.map +1 -1
- package/dist/types/ui/components/molecules/vc-pagination/index.d.ts +36 -7
- package/dist/types/ui/components/molecules/vc-pagination/index.d.ts.map +1 -1
- package/dist/types/ui/components/molecules/vc-rating/index.d.ts +156 -6
- package/dist/types/ui/components/molecules/vc-rating/index.d.ts.map +1 -1
- package/dist/types/ui/components/molecules/vc-select/index.d.ts +566 -69
- package/dist/types/ui/components/molecules/vc-select/index.d.ts.map +1 -1
- package/dist/types/ui/components/molecules/vc-slider/index.d.ts +159 -10
- package/dist/types/ui/components/molecules/vc-slider/index.d.ts.map +1 -1
- package/dist/types/ui/components/molecules/vc-textarea/index.d.ts +204 -6
- package/dist/types/ui/components/molecules/vc-textarea/index.d.ts.map +1 -1
- package/dist/types/ui/components/organisms/vc-app/index.d.ts +302 -9
- package/dist/types/ui/components/organisms/vc-app/index.d.ts.map +1 -1
- package/dist/types/ui/components/organisms/vc-app/vc-app.vue.d.ts.map +1 -1
- package/dist/types/ui/components/organisms/vc-blade/index.d.ts +201 -7
- package/dist/types/ui/components/organisms/vc-blade/index.d.ts.map +1 -1
- package/dist/types/ui/components/organisms/vc-dynamic-property/index.d.ts +59 -7
- package/dist/types/ui/components/organisms/vc-dynamic-property/index.d.ts.map +1 -1
- package/dist/types/ui/components/organisms/vc-gallery/index.d.ts +157 -7
- package/dist/types/ui/components/organisms/vc-gallery/index.d.ts.map +1 -1
- package/dist/types/ui/components/organisms/vc-login-form/index.d.ts +113 -6
- package/dist/types/ui/components/organisms/vc-login-form/index.d.ts.map +1 -1
- package/dist/types/ui/components/organisms/vc-popup/index.d.ts +129 -6
- package/dist/types/ui/components/organisms/vc-popup/index.d.ts.map +1 -1
- package/dist/types/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue.d.ts +1 -15
- package/dist/types/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue.d.ts.map +1 -1
- package/dist/types/ui/components/organisms/vc-table/index.d.ts +649 -27
- package/dist/types/ui/components/organisms/vc-table/index.d.ts.map +1 -1
- package/dist/types/ui/components/organisms/vc-table/vc-table.stories.d.ts +69 -70
- package/dist/types/ui/components/organisms/vc-table/vc-table.stories.d.ts.map +1 -1
- package/dist/types/ui/components/organisms/vc-table/vc-table.vue.d.ts +31 -25
- package/dist/types/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
- package/dist/types/ui/types/index.d.ts +46 -0
- package/dist/types/ui/types/index.d.ts.map +1 -0
- package/package.json +6 -6
- package/shared/app-switcher/components/index.ts +1 -1
- package/shared/app-switcher/components/vc-app-switcher/index.ts +3 -0
- package/shared/app-switcher/index.ts +7 -0
- package/shared/assets/components/assets-details/index.ts +3 -0
- package/shared/assets/components/index.ts +1 -1
- package/shared/assets/index.ts +7 -0
- package/shared/blade-navigation/components/index.ts +1 -1
- package/shared/blade-navigation/components/vc-blade-navigation/index.ts +3 -0
- package/shared/blade-navigation/index.ts +7 -0
- package/ui/components/atoms/vc-badge/index.ts +10 -9
- package/ui/components/atoms/vc-button/index.ts +7 -6
- package/ui/components/atoms/vc-card/index.ts +8 -7
- package/ui/components/atoms/vc-checkbox/index.ts +8 -7
- package/ui/components/atoms/vc-col/index.ts +7 -6
- package/ui/components/atoms/vc-container/index.ts +7 -6
- package/ui/components/atoms/vc-hint/index.ts +7 -6
- package/ui/components/atoms/vc-icon/index.ts +2 -8
- package/ui/components/atoms/vc-image/index.ts +2 -8
- package/ui/components/atoms/vc-info-row/index.ts +2 -8
- package/ui/components/atoms/vc-label/index.ts +8 -7
- package/ui/components/atoms/vc-link/index.ts +7 -6
- package/ui/components/atoms/vc-loading/index.ts +2 -8
- package/ui/components/atoms/vc-progress/index.ts +7 -6
- package/ui/components/atoms/vc-row/index.ts +7 -6
- package/ui/components/atoms/vc-status/index.ts +7 -6
- package/ui/components/atoms/vc-status-icon/index.ts +2 -8
- package/ui/components/atoms/vc-switch/index.ts +2 -8
- package/ui/components/atoms/vc-widget/index.ts +2 -8
- package/ui/components/index.ts +39 -39
- package/ui/components/molecules/vc-breadcrumbs/index.ts +2 -8
- package/ui/components/molecules/vc-code-editor/index.ts +7 -6
- package/ui/components/molecules/vc-editor/index.ts +7 -6
- package/ui/components/molecules/vc-file-upload/index.ts +7 -6
- package/ui/components/molecules/vc-file-upload/vc-file-upload.vue +18 -4
- package/ui/components/molecules/vc-form/index.ts +7 -6
- package/ui/components/molecules/vc-input/index.ts +57 -56
- package/ui/components/molecules/vc-input-currency/index.ts +15 -14
- package/ui/components/molecules/vc-notification/index.ts +7 -6
- package/ui/components/molecules/vc-pagination/index.ts +2 -8
- package/ui/components/molecules/vc-rating/index.ts +7 -6
- package/ui/components/molecules/vc-select/index.ts +84 -84
- package/ui/components/molecules/vc-slider/index.ts +10 -9
- package/ui/components/molecules/vc-textarea/index.ts +7 -6
- package/ui/components/organisms/vc-app/index.ts +10 -9
- package/ui/components/organisms/vc-app/vc-app.vue +7 -0
- package/ui/components/organisms/vc-blade/index.ts +8 -7
- package/ui/components/organisms/vc-dynamic-property/index.ts +2 -8
- package/ui/components/organisms/vc-gallery/index.ts +2 -8
- package/ui/components/organisms/vc-login-form/index.ts +7 -6
- package/ui/components/organisms/vc-popup/index.ts +7 -6
- package/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue +1 -4
- package/ui/components/organisms/vc-table/index.ts +16 -14
- package/ui/components/organisms/vc-table/vc-table.vue +118 -49
- package/ui/types/index.ts +53 -0
- package/dist/types/ui/services/components.d.ts +0 -2
- package/dist/types/ui/services/components.d.ts.map +0 -1
- package/dist/types/ui/services/types/components.d.ts +0 -14
- package/dist/types/ui/services/types/components.d.ts.map +0 -1
- package/dist/types/ui/services/types/index.d.ts +0 -7
- package/dist/types/ui/services/types/index.d.ts.map +0 -1
- package/dist/types/ui/services/types/ts-helpers.d.ts +0 -8
- package/dist/types/ui/services/types/ts-helpers.d.ts.map +0 -1
- package/ui/services/components.ts +0 -40
- package/ui/services/types/components.ts +0 -14
- package/ui/services/types/index.ts +0 -9
- package/ui/services/types/ts-helpers.ts +0 -18
|
@@ -204,17 +204,24 @@
|
|
|
204
204
|
>
|
|
205
205
|
<tr
|
|
206
206
|
v-for="(item, i) in calculatedItems"
|
|
207
|
-
:key="item.id"
|
|
207
|
+
:key="(typeof item === 'object' && 'id' in item && item.id) || i"
|
|
208
208
|
class="vc-table__body-row tw-h-[60px] tw-bg-white hover:tw-bg-[#dfeef9] tw-cursor-pointer"
|
|
209
209
|
:class="{
|
|
210
210
|
'tw-bg-[#f8f8f8]': i % 2 === 1,
|
|
211
|
-
'!tw-bg-[#dfeef9] hover:tw-bg-[#dfeef9]':
|
|
211
|
+
'!tw-bg-[#dfeef9] hover:tw-bg-[#dfeef9]':
|
|
212
|
+
typeof item === 'object' && 'id' in item && item.id ? selectedItemId === item.id : false,
|
|
212
213
|
}"
|
|
213
214
|
@click="$emit('itemClick', item)"
|
|
214
215
|
@mouseleave="closeActions"
|
|
216
|
+
@mousedown="onRowMouseDown"
|
|
217
|
+
@dragstart="onRowDragStart($event, item)"
|
|
218
|
+
@dragover="onRowDragOver($event, item)"
|
|
219
|
+
@dragleave="onRowDragLeave"
|
|
220
|
+
@dragend="onRowDragEnd"
|
|
221
|
+
@drop="onRowDrop"
|
|
215
222
|
>
|
|
216
223
|
<td
|
|
217
|
-
v-if="multiselect"
|
|
224
|
+
v-if="multiselect && typeof item === 'object'"
|
|
218
225
|
class="tw-w-[50px] tw-max-w-[50px] tw-min-w-[50px]"
|
|
219
226
|
>
|
|
220
227
|
<div class="tw-flex tw-justify-center tw-items-center">
|
|
@@ -227,7 +234,7 @@
|
|
|
227
234
|
</td>
|
|
228
235
|
<td
|
|
229
236
|
class="tw-box-border tw-overflow-visible tw-px-3 tw-w-[44px] tw-max-w-[44px] tw-min-w-[44px]"
|
|
230
|
-
v-if="itemActionBuilder"
|
|
237
|
+
v-if="itemActionBuilder && typeof item === 'object'"
|
|
231
238
|
>
|
|
232
239
|
<div class="vc-table__body-actions-container tw-relative tw-flex tw-justify-center tw-items-center">
|
|
233
240
|
<button
|
|
@@ -281,7 +288,7 @@
|
|
|
281
288
|
</td>
|
|
282
289
|
<td
|
|
283
290
|
v-for="cell in filteredCols"
|
|
284
|
-
:key="`${item.id}_${cell.id}`"
|
|
291
|
+
:key="`${(typeof item === 'object' && 'id' in item && item.id) || i}_${cell.id}`"
|
|
285
292
|
class="tw-box-border tw-overflow-hidden tw-px-3"
|
|
286
293
|
:class="cell.class"
|
|
287
294
|
:style="{ maxWidth: cell.width, width: cell.width }"
|
|
@@ -292,6 +299,7 @@
|
|
|
292
299
|
:cell="cell"
|
|
293
300
|
>
|
|
294
301
|
<VcTableCell
|
|
302
|
+
v-if="typeof item === 'object'"
|
|
295
303
|
:cell="cell"
|
|
296
304
|
:item="item"
|
|
297
305
|
></VcTableCell>
|
|
@@ -397,10 +405,19 @@ export interface StatusImage {
|
|
|
397
405
|
clickHandler?: () => void;
|
|
398
406
|
}
|
|
399
407
|
|
|
408
|
+
export interface TableItem {
|
|
409
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
410
|
+
[x: string]: any;
|
|
411
|
+
id?: string;
|
|
412
|
+
actions?: IActionBuilderResult[];
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export type TableItemType = TableItem | string;
|
|
416
|
+
|
|
400
417
|
export interface Props {
|
|
401
418
|
columns: ITableColumns[];
|
|
402
|
-
items:
|
|
403
|
-
itemActionBuilder?: (item:
|
|
419
|
+
items: TableItemType[];
|
|
420
|
+
itemActionBuilder?: (item: TableItem) => IActionBuilderResult[];
|
|
404
421
|
sort?: string;
|
|
405
422
|
multiselect?: boolean;
|
|
406
423
|
expanded?: boolean;
|
|
@@ -420,6 +437,7 @@ export interface Props {
|
|
|
420
437
|
scrolling?: boolean;
|
|
421
438
|
resizableColumns?: boolean;
|
|
422
439
|
reorderableColumns?: boolean;
|
|
440
|
+
reorderableRows?: boolean;
|
|
423
441
|
stateKey: string;
|
|
424
442
|
}
|
|
425
443
|
|
|
@@ -428,12 +446,12 @@ export interface Emits {
|
|
|
428
446
|
(event: "selectionChanged", values: Record<string, boolean>): void;
|
|
429
447
|
(event: "search:change", value: string): void;
|
|
430
448
|
(event: "headerClick", value: Record<string, unknown>): void;
|
|
431
|
-
(event: "itemClick", item:
|
|
449
|
+
(event: "itemClick", item: TableItem): void;
|
|
432
450
|
(event: "scroll:ptr"): void;
|
|
451
|
+
(event: "row:reorder", args: { dragIndex: number; dropIndex: number; value: TableItemType[] }): void;
|
|
433
452
|
}
|
|
434
453
|
|
|
435
454
|
const props = withDefaults(defineProps<Props>(), {
|
|
436
|
-
columns: () => [],
|
|
437
455
|
items: () => [],
|
|
438
456
|
totalLabel: "Totals:",
|
|
439
457
|
totalCount: 0,
|
|
@@ -477,11 +495,17 @@ const columnResizeListener = ref(null);
|
|
|
477
495
|
const columnResizeEndListener = ref(null);
|
|
478
496
|
const resizer = ref();
|
|
479
497
|
const state = useLocalStorage(props.stateKey, []);
|
|
480
|
-
const
|
|
498
|
+
const defaultColumns: Ref<ITableColumns[]> = ref([]);
|
|
481
499
|
const draggedColumn = ref();
|
|
482
500
|
const dropPosition = ref();
|
|
483
501
|
const calculatedItems = computedAsync(async () => await populateWithActions(props.items), []);
|
|
484
502
|
|
|
503
|
+
// row reordering variables
|
|
504
|
+
const draggedRow = ref<TableItemType>();
|
|
505
|
+
const rowDragged = ref(false);
|
|
506
|
+
const droppedRowIndex = ref<number>();
|
|
507
|
+
const draggedRowIndex = ref<number>();
|
|
508
|
+
|
|
485
509
|
onBeforeUpdate(() => {
|
|
486
510
|
actionToggleRefs.value = [];
|
|
487
511
|
tooltipRefs.value = [];
|
|
@@ -503,7 +527,7 @@ const sortField = computed(() => {
|
|
|
503
527
|
|
|
504
528
|
const toggleCols = computed(() => {
|
|
505
529
|
return props.columns.map((item) => {
|
|
506
|
-
return
|
|
530
|
+
return defaultColumns.value.find((mutatedItem) => item.id === mutatedItem.id);
|
|
507
531
|
});
|
|
508
532
|
});
|
|
509
533
|
|
|
@@ -525,7 +549,7 @@ const headerCheckbox = computed(() => {
|
|
|
525
549
|
});
|
|
526
550
|
|
|
527
551
|
const filteredCols = computed(() => {
|
|
528
|
-
return
|
|
552
|
+
return defaultColumns.value.filter((x) => {
|
|
529
553
|
if (("visible" in x && x.visible) || !("visible" in x)) {
|
|
530
554
|
return props.expanded ? x : x.alwaysVisible;
|
|
531
555
|
}
|
|
@@ -534,10 +558,12 @@ const filteredCols = computed(() => {
|
|
|
534
558
|
|
|
535
559
|
watch(
|
|
536
560
|
() => props.items,
|
|
537
|
-
async (value:
|
|
561
|
+
async (value: TableItemType[]) => {
|
|
538
562
|
checkboxes.value = {};
|
|
539
563
|
value?.forEach((item) => {
|
|
540
|
-
|
|
564
|
+
if (typeof item === "object" && "id" in item) {
|
|
565
|
+
checkboxes.value[item.id] = false;
|
|
566
|
+
}
|
|
541
567
|
});
|
|
542
568
|
scrollContainer.value?.scrollTop();
|
|
543
569
|
},
|
|
@@ -551,14 +577,14 @@ watch(
|
|
|
551
577
|
nextTick(() => restoreState());
|
|
552
578
|
}
|
|
553
579
|
|
|
554
|
-
if (!
|
|
555
|
-
|
|
580
|
+
if (!defaultColumns.value.length) {
|
|
581
|
+
defaultColumns.value = newVal;
|
|
556
582
|
}
|
|
557
583
|
},
|
|
558
584
|
{ deep: true, immediate: true }
|
|
559
585
|
);
|
|
560
586
|
|
|
561
|
-
async function populateWithActions(value:
|
|
587
|
+
async function populateWithActions(value: TableItemType[]): Promise<TableItemType[]> {
|
|
562
588
|
const populatedItems = [];
|
|
563
589
|
|
|
564
590
|
if (value && typeof value === "object") {
|
|
@@ -577,6 +603,8 @@ async function populateWithActions(value: { id?: string }[] | string[]) {
|
|
|
577
603
|
} else {
|
|
578
604
|
return props.items;
|
|
579
605
|
}
|
|
606
|
+
} else {
|
|
607
|
+
return props.items;
|
|
580
608
|
}
|
|
581
609
|
}
|
|
582
610
|
|
|
@@ -609,7 +637,7 @@ function processCheckbox(id: string, state: boolean) {
|
|
|
609
637
|
emit("selectionChanged", checkboxes.value);
|
|
610
638
|
}
|
|
611
639
|
|
|
612
|
-
function showActions(item:
|
|
640
|
+
function showActions(item: TableItem, index: string) {
|
|
613
641
|
selectedRow.value = item.id;
|
|
614
642
|
|
|
615
643
|
const toggleRef = actionToggleRefs.value.find((item) => item.id === index);
|
|
@@ -633,7 +661,7 @@ function showActions(item: { id?: string }, index: string) {
|
|
|
633
661
|
}
|
|
634
662
|
}
|
|
635
663
|
|
|
636
|
-
async function calculateActions(item:
|
|
664
|
+
async function calculateActions(item: TableItem) {
|
|
637
665
|
if (typeof props.itemActionBuilder === "function") {
|
|
638
666
|
return await props.itemActionBuilder(item);
|
|
639
667
|
}
|
|
@@ -803,8 +831,8 @@ function onColumnHeaderDrop(event: DragEvent, item: ITableColumns) {
|
|
|
803
831
|
event.preventDefault();
|
|
804
832
|
|
|
805
833
|
if (draggedColumn.value) {
|
|
806
|
-
let dragIndex =
|
|
807
|
-
let dropIndex =
|
|
834
|
+
let dragIndex = defaultColumns.value.indexOf(draggedColumn.value);
|
|
835
|
+
let dropIndex = defaultColumns.value.indexOf(item);
|
|
808
836
|
|
|
809
837
|
let allowDrop = dragIndex !== dropIndex;
|
|
810
838
|
|
|
@@ -817,7 +845,7 @@ function onColumnHeaderDrop(event: DragEvent, item: ITableColumns) {
|
|
|
817
845
|
}
|
|
818
846
|
|
|
819
847
|
if (allowDrop) {
|
|
820
|
-
reorderArray(
|
|
848
|
+
reorderArray(defaultColumns.value, dragIndex, dropIndex);
|
|
821
849
|
|
|
822
850
|
if (isStateful()) {
|
|
823
851
|
saveState();
|
|
@@ -837,17 +865,17 @@ function isStateful() {
|
|
|
837
865
|
function saveState() {
|
|
838
866
|
console.debug("[@vc-shell/framewok#vc-table.vue] - Save state");
|
|
839
867
|
|
|
840
|
-
state.value =
|
|
868
|
+
state.value = defaultColumns.value;
|
|
841
869
|
}
|
|
842
870
|
|
|
843
871
|
function restoreState() {
|
|
844
872
|
console.debug("[@vc-shell/framewok#vc-table.vue] - Restore state");
|
|
845
873
|
if (Object.keys(state.value).length) {
|
|
846
|
-
|
|
874
|
+
defaultColumns.value = state.value;
|
|
847
875
|
}
|
|
848
876
|
}
|
|
849
877
|
|
|
850
|
-
function reorderArray(value:
|
|
878
|
+
function reorderArray(value: unknown[], from: number, to: number) {
|
|
851
879
|
if (value && from !== to) {
|
|
852
880
|
if (to >= value.length) {
|
|
853
881
|
to %= value.length;
|
|
@@ -866,7 +894,7 @@ function onColumnHeaderMouseDown(event: MouseEvent & { currentTarget?: { draggab
|
|
|
866
894
|
|
|
867
895
|
function toggleColumn(item: ITableColumns) {
|
|
868
896
|
if (item) {
|
|
869
|
-
|
|
897
|
+
defaultColumns.value = defaultColumns.value.map((x) => {
|
|
870
898
|
if (x === item) {
|
|
871
899
|
x = item;
|
|
872
900
|
}
|
|
@@ -879,32 +907,73 @@ function toggleColumn(item: ITableColumns) {
|
|
|
879
907
|
}
|
|
880
908
|
}
|
|
881
909
|
|
|
882
|
-
|
|
883
|
-
|
|
910
|
+
function onRowMouseDown(event: MouseEvent & { currentTarget?: { draggable: boolean } }) {
|
|
911
|
+
if (props.reorderableRows) {
|
|
912
|
+
event.currentTarget.draggable = true;
|
|
913
|
+
}
|
|
914
|
+
}
|
|
884
915
|
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
916
|
+
function onRowDragStart(event: DragEvent, item: TableItem | string) {
|
|
917
|
+
rowDragged.value = true;
|
|
918
|
+
draggedRow.value = item;
|
|
919
|
+
draggedRowIndex.value = calculatedItems.value.indexOf(item);
|
|
920
|
+
event.dataTransfer.setData("text", "row-reorder");
|
|
921
|
+
}
|
|
888
922
|
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
923
|
+
function onRowDragOver(event: DragEvent, item: TableItem | string) {
|
|
924
|
+
const index = calculatedItems.value.indexOf(item);
|
|
925
|
+
|
|
926
|
+
if (rowDragged.value && draggedRow.value !== item) {
|
|
927
|
+
let rowElement = event.currentTarget;
|
|
928
|
+
let rowY = getOffset(rowElement as HTMLElement).top;
|
|
929
|
+
let pageY = event.pageY;
|
|
930
|
+
let rowMidY = rowY + (rowElement as HTMLElement).offsetHeight / 2;
|
|
931
|
+
|
|
932
|
+
if (pageY < rowMidY) {
|
|
933
|
+
droppedRowIndex.value = index;
|
|
934
|
+
} else {
|
|
935
|
+
droppedRowIndex.value = index + 1;
|
|
936
|
+
}
|
|
898
937
|
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
938
|
+
event.preventDefault();
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
function onRowDragLeave(event: DragEvent) {
|
|
943
|
+
event.preventDefault();
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
function onRowDragEnd(event: DragEvent & { currentTarget?: { draggable: boolean } }) {
|
|
947
|
+
rowDragged.value = false;
|
|
948
|
+
draggedRowIndex.value = null;
|
|
949
|
+
droppedRowIndex.value = null;
|
|
950
|
+
event.currentTarget.draggable = false;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
function onRowDrop(event) {
|
|
954
|
+
if (droppedRowIndex.value != null) {
|
|
955
|
+
let dropIndex =
|
|
956
|
+
draggedRowIndex.value > droppedRowIndex.value
|
|
957
|
+
? droppedRowIndex.value
|
|
958
|
+
: droppedRowIndex.value === 0
|
|
959
|
+
? 0
|
|
960
|
+
: droppedRowIndex.value - 1;
|
|
961
|
+
|
|
962
|
+
let processedItems = [...calculatedItems.value];
|
|
963
|
+
|
|
964
|
+
reorderArray(processedItems, draggedRowIndex.value, dropIndex);
|
|
965
|
+
|
|
966
|
+
emit("row:reorder", {
|
|
967
|
+
dragIndex: draggedRowIndex.value,
|
|
968
|
+
dropIndex: dropIndex,
|
|
969
|
+
value: processedItems as TableItemType[],
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
// cleanup
|
|
974
|
+
onRowDragLeave(event);
|
|
975
|
+
onRowDragEnd(event);
|
|
976
|
+
event.preventDefault();
|
|
908
977
|
}
|
|
909
978
|
</script>
|
|
910
979
|
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as VcShellComponents from "./../components";
|
|
2
|
+
|
|
3
|
+
// Declare all components globally
|
|
4
|
+
declare module "@vue/runtime-core" {
|
|
5
|
+
export interface GlobalComponents {
|
|
6
|
+
// atoms
|
|
7
|
+
VcBadge: (typeof VcShellComponents)["VcBadge"];
|
|
8
|
+
VcButton: (typeof VcShellComponents)["VcButton"];
|
|
9
|
+
VcCard: (typeof VcShellComponents)["VcCard"];
|
|
10
|
+
VcCheckbox: (typeof VcShellComponents)["VcCheckbox"];
|
|
11
|
+
VcCol: (typeof VcShellComponents)["VcCol"];
|
|
12
|
+
VcContainer: (typeof VcShellComponents)["VcContainer"];
|
|
13
|
+
VcHint: (typeof VcShellComponents)["VcHint"];
|
|
14
|
+
VcIcon: (typeof VcShellComponents)["VcIcon"];
|
|
15
|
+
VcImage: (typeof VcShellComponents)["VcImage"];
|
|
16
|
+
VcInfoRow: (typeof VcShellComponents)["VcInfoRow"];
|
|
17
|
+
VcLabel: (typeof VcShellComponents)["VcLabel"];
|
|
18
|
+
VcLink: (typeof VcShellComponents)["VcLink"];
|
|
19
|
+
VcLoading: (typeof VcShellComponents)["VcLoading"];
|
|
20
|
+
VcProgress: (typeof VcShellComponents)["VcProgress"];
|
|
21
|
+
VcRow: (typeof VcShellComponents)["VcRow"];
|
|
22
|
+
VcStatus: (typeof VcShellComponents)["VcStatus"];
|
|
23
|
+
VcStatusIcon: (typeof VcShellComponents)["VcStatusIcon"];
|
|
24
|
+
VcSwitch: (typeof VcShellComponents)["VcSwitch"];
|
|
25
|
+
VcWidget: (typeof VcShellComponents)["VcWidget"];
|
|
26
|
+
|
|
27
|
+
// molecules
|
|
28
|
+
VcBreadcrumbs: (typeof VcShellComponents)["VcBreadcrumbs"];
|
|
29
|
+
VcCodeEditor: (typeof VcShellComponents)["VcCodeEditor"];
|
|
30
|
+
VcEditor: (typeof VcShellComponents)["VcEditor"];
|
|
31
|
+
VcFileUpload: (typeof VcShellComponents)["VcFileUpload"];
|
|
32
|
+
VcForm: (typeof VcShellComponents)["VcForm"];
|
|
33
|
+
VcInput: (typeof VcShellComponents)["VcInput"];
|
|
34
|
+
VcInputCurrency: (typeof VcShellComponents)["VcInputCurrency"];
|
|
35
|
+
VcNotification: (typeof VcShellComponents)["VcNotification"];
|
|
36
|
+
VcPagination: (typeof VcShellComponents)["VcPagination"];
|
|
37
|
+
VcRating: (typeof VcShellComponents)["VcRating"];
|
|
38
|
+
VcSelect: (typeof VcShellComponents)["VcSelect"];
|
|
39
|
+
VcSlider: (typeof VcShellComponents)["VcSlider"];
|
|
40
|
+
VcTextarea: (typeof VcShellComponents)["VcTextarea"];
|
|
41
|
+
|
|
42
|
+
// organisms
|
|
43
|
+
VcApp: (typeof VcShellComponents)["VcApp"];
|
|
44
|
+
VcBlade: (typeof VcShellComponents)["VcBlade"];
|
|
45
|
+
VcDynamicProperty: (typeof VcShellComponents)["VcDynamicProperty"];
|
|
46
|
+
VcGallery: (typeof VcShellComponents)["VcGallery"];
|
|
47
|
+
VcLoginForm: (typeof VcShellComponents)["VcLoginForm"];
|
|
48
|
+
VcPopup: (typeof VcShellComponents)["VcPopup"];
|
|
49
|
+
VcTable: (typeof VcShellComponents)["VcTable"];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export {};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { VcBadge, VcButton, VcCard, VcCheckbox, VcCol, VcContainer, VcHint, VcIcon, VcImage, VcInfoRow, VcLabel, VcLink, VcLoading, VcProgress, VcRow, VcStatus, VcStatusIcon, VcSwitch, VcWidget, VcBreadcrumbs, VcEditor, VcFileUpload, VcForm, VcInput, VcInputCurrency, VcNotification, VcPagination, VcRating, VcSelect, VcSlider, VcTextarea, VcApp, VcBlade, VcDynamicProperty, VcGallery, VcLoginForm, VcPopup, VcTable, } from "./../components";
|
|
2
|
-
//# sourceMappingURL=components.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../../ui/services/components.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,UAAU,EACV,KAAK,EACL,WAAW,EACX,MAAM,EACN,MAAM,EACN,OAAO,EACP,SAAS,EACT,OAAO,EACP,MAAM,EACN,SAAS,EACT,UAAU,EACV,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,OAAO,EACP,eAAe,EACf,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,KAAK,EACL,OAAO,EACP,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,OAAO,EACP,OAAO,GACR,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type * as vcShellComponents from "../components";
|
|
2
|
-
type Map<O extends Record<any, any>> = {
|
|
3
|
-
[K in keyof O]: O[K];
|
|
4
|
-
};
|
|
5
|
-
type KeyInObj<O, K> = K extends keyof O ? O[K] : never;
|
|
6
|
-
/** List of all components */
|
|
7
|
-
export type VcShellComponentsMap = Map<typeof vcShellComponents>;
|
|
8
|
-
/** Component names */
|
|
9
|
-
export type VcShellComponentName = keyof VcShellComponentsMap;
|
|
10
|
-
export type VcShellComponents<NAMES extends string = VcShellComponentName> = {
|
|
11
|
-
[name in NAMES]: KeyInObj<VcShellComponentsMap, name>;
|
|
12
|
-
};
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=components.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../../../ui/services/types/components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,iBAAiB,MAAM,eAAe,CAAC;AAGxD,KAAK,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAChE,KAAK,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;AAEvD,6BAA6B;AAC7B,MAAM,MAAM,oBAAoB,GAAG,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC;AACjE,sBAAsB;AACtB,MAAM,MAAM,oBAAoB,GAAG,MAAM,oBAAoB,CAAC;AAE9D,MAAM,MAAM,iBAAiB,CAAC,KAAK,SAAS,MAAM,GAAG,oBAAoB,IAAI;KAC1E,IAAI,IAAI,KAAK,GAAG,QAAQ,CAAC,oBAAoB,EAAE,IAAI,CAAC;CACtD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../ui/services/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,QAAQ,KAAK,CAAC;IAEnB,UAAiB,gBAAiB,SAAQ,iBAAiB;KAAG;CAC/D;AAED,OAAO,EAAE,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ComponentPublicInstance, ComputedOptions, MethodOptions, EmitsOptions, Slots, ComponentOptions } from "vue";
|
|
2
|
-
export type ComponentConstructor<Component extends ComponentPublicInstance<Props, RawBindings, D, C, M, E> = ComponentPublicInstance<any>, Props = any, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, E extends EmitsOptions = EmitsOptions, Slot extends Slots = Slots> = {
|
|
3
|
-
new (): Component & {
|
|
4
|
-
$slots: Slot;
|
|
5
|
-
};
|
|
6
|
-
} & ComponentOptions<Props, RawBindings, D, C, M, E>;
|
|
7
|
-
export type GlobalComponentConstructor<T extends abstract new (...args: any) => any, S extends Slots> = ComponentConstructor<InstanceType<T>, any, any, any, any, any, any, S>;
|
|
8
|
-
//# sourceMappingURL=ts-helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ts-helpers.d.ts","sourceRoot":"","sources":["../../../../../ui/services/types/ts-helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAErH,MAAM,MAAM,oBAAoB,CAC9B,SAAS,SAAS,uBAAuB,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,uBAAuB,CAAC,GAAG,CAAC,EACxG,KAAK,GAAG,GAAG,EACX,WAAW,GAAG,GAAG,EACjB,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,eAAe,GAAG,eAAe,EAC3C,CAAC,SAAS,aAAa,GAAG,aAAa,EACvC,CAAC,SAAS,YAAY,GAAG,YAAY,EACrC,IAAI,SAAS,KAAK,GAAG,KAAK,IACxB;IAAE,QAAQ,SAAS,GAAG;QAAE,MAAM,EAAE,IAAI,CAAA;KAAE,CAAA;CAAE,GAAG,gBAAgB,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAEhG,MAAM,MAAM,0BAA0B,CACpC,CAAC,SAAS,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,EAC5C,CAAC,SAAS,KAAK,IACb,oBAAoB,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
VcBadge,
|
|
3
|
-
VcButton,
|
|
4
|
-
VcCard,
|
|
5
|
-
VcCheckbox,
|
|
6
|
-
VcCol,
|
|
7
|
-
VcContainer,
|
|
8
|
-
VcHint,
|
|
9
|
-
VcIcon,
|
|
10
|
-
VcImage,
|
|
11
|
-
VcInfoRow,
|
|
12
|
-
VcLabel,
|
|
13
|
-
VcLink,
|
|
14
|
-
VcLoading,
|
|
15
|
-
VcProgress,
|
|
16
|
-
VcRow,
|
|
17
|
-
VcStatus,
|
|
18
|
-
VcStatusIcon,
|
|
19
|
-
VcSwitch,
|
|
20
|
-
VcWidget,
|
|
21
|
-
VcBreadcrumbs,
|
|
22
|
-
VcEditor,
|
|
23
|
-
VcFileUpload,
|
|
24
|
-
VcForm,
|
|
25
|
-
VcInput,
|
|
26
|
-
VcInputCurrency,
|
|
27
|
-
VcNotification,
|
|
28
|
-
VcPagination,
|
|
29
|
-
VcRating,
|
|
30
|
-
VcSelect,
|
|
31
|
-
VcSlider,
|
|
32
|
-
VcTextarea,
|
|
33
|
-
VcApp,
|
|
34
|
-
VcBlade,
|
|
35
|
-
VcDynamicProperty,
|
|
36
|
-
VcGallery,
|
|
37
|
-
VcLoginForm,
|
|
38
|
-
VcPopup,
|
|
39
|
-
VcTable,
|
|
40
|
-
} from "./../components";
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type * as vcShellComponents from "../components";
|
|
2
|
-
|
|
3
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
|
-
type Map<O extends Record<any, any>> = { [K in keyof O]: O[K] };
|
|
5
|
-
type KeyInObj<O, K> = K extends keyof O ? O[K] : never;
|
|
6
|
-
|
|
7
|
-
/** List of all components */
|
|
8
|
-
export type VcShellComponentsMap = Map<typeof vcShellComponents>;
|
|
9
|
-
/** Component names */
|
|
10
|
-
export type VcShellComponentName = keyof VcShellComponentsMap;
|
|
11
|
-
|
|
12
|
-
export type VcShellComponents<NAMES extends string = VcShellComponentName> = {
|
|
13
|
-
[name in NAMES]: KeyInObj<VcShellComponentsMap, name>;
|
|
14
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { VcShellComponents } from "./components";
|
|
2
|
-
|
|
3
|
-
// Declare all components globally
|
|
4
|
-
declare module "vue" {
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
6
|
-
export interface GlobalComponents extends VcShellComponents {}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { ComponentPublicInstance, ComputedOptions, MethodOptions, EmitsOptions, Slots, ComponentOptions } from "vue";
|
|
3
|
-
|
|
4
|
-
export type ComponentConstructor<
|
|
5
|
-
Component extends ComponentPublicInstance<Props, RawBindings, D, C, M, E> = ComponentPublicInstance<any>,
|
|
6
|
-
Props = any,
|
|
7
|
-
RawBindings = any,
|
|
8
|
-
D = any,
|
|
9
|
-
C extends ComputedOptions = ComputedOptions,
|
|
10
|
-
M extends MethodOptions = MethodOptions,
|
|
11
|
-
E extends EmitsOptions = EmitsOptions,
|
|
12
|
-
Slot extends Slots = Slots
|
|
13
|
-
> = { new (): Component & { $slots: Slot } } & ComponentOptions<Props, RawBindings, D, C, M, E>;
|
|
14
|
-
|
|
15
|
-
export type GlobalComponentConstructor<
|
|
16
|
-
T extends abstract new (...args: any) => any,
|
|
17
|
-
S extends Slots
|
|
18
|
-
> = ComponentConstructor<InstanceType<T>, any, any, any, any, any, any, S>;
|