@vc-shell/framework 1.0.219 → 1.0.220
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/core/types/index.ts +5 -0
- package/dist/core/types/index.d.ts +5 -0
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/framework.js +12015 -11760
- package/dist/index.css +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/locales/en.json +2 -1
- package/dist/shared/components/app-switcher/composables/useAppSwitcher/index.d.ts.map +1 -1
- package/dist/shared/components/blade-navigation/composables/useBladeNavigation/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Button.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Fieldset.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/InputCurrency.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Table.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.d.ts +0 -12
- package/dist/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/composables/useTableTemplates/index.d.ts +1 -0
- package/dist/shared/modules/dynamic/composables/useTableTemplates/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/factories/types/index.d.ts +1 -1
- package/dist/shared/modules/dynamic/factories/types/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/types/index.d.ts +43 -17
- package/dist/shared/modules/dynamic/types/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/types/models.d.ts +1 -1
- package/dist/shared/modules/dynamic/types/models.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/components/atoms/index.d.ts +1 -0
- package/dist/ui/components/atoms/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-label/vc-label.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-status/vc-status.stories.d.ts +7 -7
- package/dist/ui/components/atoms/vc-status/vc-status.vue.d.ts +2 -2
- package/dist/ui/components/atoms/vc-status/vc-status.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-tooltip/index.d.ts +2 -0
- package/dist/ui/components/atoms/vc-tooltip/index.d.ts.map +1 -0
- package/dist/ui/components/atoms/vc-tooltip/vc-tooltip.vue.d.ts +41 -0
- package/dist/ui/components/atoms/vc-tooltip/vc-tooltip.vue.d.ts.map +1 -0
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.stories.d.ts +24 -16
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.stories.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts +32 -0
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.stories.d.ts +21 -21
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts +3 -3
- package/dist/ui/components/molecules/vc-select/vc-select.stories.d.ts +30 -30
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts +3 -3
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-add-new/vc-table-add-new.vue.d.ts +26 -0
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-add-new/vc-table-add-new.vue.d.ts.map +1 -0
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue.d.ts +2 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/vc-table.stories.d.ts +210 -15
- package/dist/ui/components/organisms/vc-table/vc-table.stories.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts +42 -3
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
- package/package.json +4 -4
- package/shared/components/app-switcher/composables/useAppSwitcher/index.ts +0 -2
- package/shared/components/blade-navigation/composables/useBladeNavigation/index.ts +1 -2
- package/shared/modules/dynamic/components/fields/Button.ts +5 -3
- package/shared/modules/dynamic/components/fields/Fieldset.ts +2 -19
- package/shared/modules/dynamic/components/fields/InputCurrency.ts +14 -1
- package/shared/modules/dynamic/components/fields/Table.ts +39 -6
- package/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.ts +1 -63
- package/shared/modules/dynamic/composables/useTableTemplates/index.ts +2 -0
- package/shared/modules/dynamic/factories/types/index.ts +1 -1
- package/shared/modules/dynamic/pages/dynamic-blade-form.vue +1 -1
- package/shared/modules/dynamic/types/index.ts +44 -17
- package/shared/modules/dynamic/types/models.ts +3 -1
- package/ui/components/atoms/index.ts +1 -0
- package/ui/components/atoms/vc-label/vc-label.vue +10 -29
- package/ui/components/atoms/vc-status/vc-status.vue +6 -3
- package/ui/components/atoms/vc-tooltip/index.ts +1 -0
- package/ui/components/atoms/vc-tooltip/vc-tooltip.vue +57 -0
- package/ui/components/molecules/vc-input-currency/vc-input-currency.vue +46 -1
- package/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +1 -0
- package/ui/components/organisms/vc-table/_internal/vc-table-add-new/vc-table-add-new.vue +46 -0
- package/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue +94 -21
- package/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue +6 -2
- package/ui/components/organisms/vc-table/vc-table.vue +153 -69
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
v-loading="unref(loading) || columnsInit"
|
|
4
|
-
class="tw-relative tw-overflow-hidden tw-flex tw-flex-col tw-grow"
|
|
4
|
+
class="tw-relative tw-overflow-hidden tw-flex tw-flex-col tw-grow tw-basis-0 tw-border tw-border-[color:#eef0f2] tw-border-solid tw-border-t-0"
|
|
5
5
|
>
|
|
6
6
|
<!-- Header slot with filter and searchbar -->
|
|
7
7
|
<slot
|
|
8
|
-
v-if="
|
|
9
|
-
($slots['header'] || header) &&
|
|
10
|
-
((items && items.length && !columnsInit) || searchValue || searchValue === '' || activeFilterCount)
|
|
11
|
-
"
|
|
8
|
+
v-if="($slots['header'] || header) && (!columnsInit || searchValue || searchValue === '' || activeFilterCount)"
|
|
12
9
|
name="header"
|
|
13
10
|
>
|
|
14
11
|
<div class="tw-shrink-0 tw-flex tw-items-center tw-justify-between tw-p-4">
|
|
@@ -61,7 +58,6 @@
|
|
|
61
58
|
<div class="tw-flex tw-relative tw-overflow-hidden tw-grow">
|
|
62
59
|
<!-- Table scroll container -->
|
|
63
60
|
<VcContainer
|
|
64
|
-
v-if="items && items.length && !columnsInit"
|
|
65
61
|
ref="scrollContainer"
|
|
66
62
|
:no-padding="true"
|
|
67
63
|
class="tw-grow tw-basis-0 tw-relative"
|
|
@@ -96,15 +92,15 @@
|
|
|
96
92
|
<table
|
|
97
93
|
v-else
|
|
98
94
|
ref="tableRef"
|
|
99
|
-
class="[border-spacing:0] tw-border-collapse tw-relative tw-pt-[43px] tw-table-fixed tw-box-border tw-w-full"
|
|
95
|
+
class="[border-spacing:0] tw-border-collapse tw-relative tw-pt-[43px] tw-table-fixed tw-box-border tw-w-full tw-h-full"
|
|
100
96
|
:class="{
|
|
101
97
|
'vc-table_empty': !items || !items.length,
|
|
102
98
|
'vc-table_multiselect': multiselect,
|
|
103
99
|
}"
|
|
104
100
|
>
|
|
105
101
|
<thead
|
|
106
|
-
v-if="filteredCols"
|
|
107
|
-
class="vc-table__header tw-
|
|
102
|
+
v-if="filteredCols.length"
|
|
103
|
+
class="vc-table__header tw-sticky tw-top-0 tw-bg-[#f9f9f9] tw-z-[1] tw-box-border"
|
|
108
104
|
@mouseenter="handleHeaderMouseOver(true)"
|
|
109
105
|
@mouseleave="handleHeaderMouseOver(false)"
|
|
110
106
|
>
|
|
@@ -155,6 +151,11 @@
|
|
|
155
151
|
:class="item.align ? tableAlignment[item.align as keyof typeof tableAlignment] : ''"
|
|
156
152
|
>
|
|
157
153
|
<div class="tw-truncate">
|
|
154
|
+
<span
|
|
155
|
+
v-if="editing && item.rules?.required"
|
|
156
|
+
class="tw-text-[color:var(--label-required-color)] tw-mr-1"
|
|
157
|
+
>*</span
|
|
158
|
+
>
|
|
158
159
|
<slot :name="`header_${item.id}`">{{ item.title }}</slot>
|
|
159
160
|
</div>
|
|
160
161
|
<div
|
|
@@ -201,7 +202,15 @@
|
|
|
201
202
|
@on-active="handleColumnSwitcher"
|
|
202
203
|
></VcTableColumnSwitcher>
|
|
203
204
|
</div>
|
|
205
|
+
<th
|
|
206
|
+
v-if="editing && removeRowButton"
|
|
207
|
+
width="90px"
|
|
208
|
+
class="tw-w-[90px] tw-h-[42px] tw-bg-[#f9f9f9] !tw-border-0 tw-shadow-[inset_0px_1px_0px_#eaedf3,_inset_0px_-1px_0px_#eaedf3] tw-box-border tw-sticky tw-top-0 tw-select-none tw-overflow-hidden tw-z-[1]"
|
|
209
|
+
>
|
|
210
|
+
{{ $t("COMPONENTS.ORGANISMS.VC_TABLE.ACTIONS") }}
|
|
211
|
+
</th>
|
|
204
212
|
</tr>
|
|
213
|
+
|
|
205
214
|
<div
|
|
206
215
|
ref="resizer"
|
|
207
216
|
class="tw-w-px tw-absolute tw-z-10 tw-hidden tw-h-full tw-bg-[#e5e7eb] tw-cursor-col-resize"
|
|
@@ -236,8 +245,8 @@
|
|
|
236
245
|
</div>
|
|
237
246
|
</div>
|
|
238
247
|
<tbody
|
|
239
|
-
v-if="items"
|
|
240
|
-
class="vc-table__body"
|
|
248
|
+
v-if="items && items.length && !columnsInit"
|
|
249
|
+
class="vc-table__body tw-block tw-overflow-auto"
|
|
241
250
|
:class="{ 'tw-translate-y-[60px]': selectAll && showSelectionChoice }"
|
|
242
251
|
>
|
|
243
252
|
<tr
|
|
@@ -342,7 +351,7 @@
|
|
|
342
351
|
:class="[
|
|
343
352
|
cell.class,
|
|
344
353
|
{
|
|
345
|
-
'last:tw-w-full': cell.id === filteredCols[filteredCols.length - 1].id,
|
|
354
|
+
// 'last:tw-w-full': cell.id === filteredCols[filteredCols.length - 1].id,
|
|
346
355
|
},
|
|
347
356
|
]"
|
|
348
357
|
:style="{ maxWidth: cell.width, width: cell.width }"
|
|
@@ -351,12 +360,14 @@
|
|
|
351
360
|
:name="`item_${cell.id}`"
|
|
352
361
|
:item="item"
|
|
353
362
|
:cell="cell"
|
|
363
|
+
:index="itemIndex"
|
|
354
364
|
>
|
|
355
365
|
<VcTableCell
|
|
356
366
|
v-if="typeof item === 'object'"
|
|
357
367
|
:cell="cell"
|
|
358
368
|
:item="item"
|
|
359
|
-
:
|
|
369
|
+
:editing="editing"
|
|
370
|
+
:index="itemIndex"
|
|
360
371
|
:width="
|
|
361
372
|
calculateElWidth(
|
|
362
373
|
`${(typeof item === 'object' && 'id' in item && item.id) || itemIndex}_${cell.id}`,
|
|
@@ -366,54 +377,107 @@
|
|
|
366
377
|
></VcTableCell>
|
|
367
378
|
</slot>
|
|
368
379
|
</td>
|
|
380
|
+
<td
|
|
381
|
+
v-if="editing && removeRowButton"
|
|
382
|
+
class="tw-box-border tw-overflow-hidden tw-px-3 tw-w-[90px]"
|
|
383
|
+
width="90px"
|
|
384
|
+
>
|
|
385
|
+
<div class="tw-w-full tw-flex tw-justify-center tw-items-center">
|
|
386
|
+
<div
|
|
387
|
+
class="tw-h-[26px] tw-w-[26px] tw-inline-flex tw-items-center tw-justify-center tw-outline-none"
|
|
388
|
+
@click="
|
|
389
|
+
$emit('onRowRemove', {
|
|
390
|
+
index: itemIndex,
|
|
391
|
+
})
|
|
392
|
+
"
|
|
393
|
+
>
|
|
394
|
+
<svg
|
|
395
|
+
width="12"
|
|
396
|
+
height="12"
|
|
397
|
+
viewBox="0 0 12 12"
|
|
398
|
+
fill="none"
|
|
399
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
400
|
+
>
|
|
401
|
+
<path
|
|
402
|
+
d="M7.27173 5.99939L11.1499 2.12967C11.3198 1.95981 11.4152 1.72943 11.4152 1.48922C11.4152 1.24901 11.3198 1.01863 11.1499 0.848777C10.9801 0.67892 10.7497 0.583496 10.5096 0.583496C10.2694 0.583496 10.0391 0.67892 9.86922 0.848777L6.00004 4.72752L2.13086 0.848777C1.96103 0.67892 1.73069 0.583496 1.49051 0.583496C1.25033 0.583496 1.01999 0.67892 0.850156 0.848777C0.680324 1.01863 0.584913 1.24901 0.584913 1.48922C0.584913 1.72943 0.680324 1.95981 0.850156 2.12967L4.72835 5.99939L0.850156 9.86912C0.765622 9.95298 0.698526 10.0527 0.652737 10.1627C0.606948 10.2726 0.583374 10.3905 0.583374 10.5096C0.583374 10.6286 0.606948 10.7465 0.652737 10.8565C0.698526 10.9664 0.765622 11.0662 0.850156 11.15C0.934 11.2346 1.03375 11.3017 1.14366 11.3475C1.25356 11.3933 1.37145 11.4168 1.49051 11.4168C1.60957 11.4168 1.72746 11.3933 1.83736 11.3475C1.94727 11.3017 2.04702 11.2346 2.13086 11.15L6.00004 7.27126L9.86922 11.15C9.95306 11.2346 10.0528 11.3017 10.1627 11.3475C10.2726 11.3933 10.3905 11.4168 10.5096 11.4168C10.6286 11.4168 10.7465 11.3933 10.8564 11.3475C10.9663 11.3017 11.0661 11.2346 11.1499 11.15C11.2345 11.0662 11.3016 10.9664 11.3473 10.8565C11.3931 10.7465 11.4167 10.6286 11.4167 10.5096C11.4167 10.3905 11.3931 10.2726 11.3473 10.1627C11.3016 10.0527 11.2345 9.95298 11.1499 9.86912L7.27173 5.99939Z"
|
|
403
|
+
fill="#6E8BA5"
|
|
404
|
+
/>
|
|
405
|
+
</svg>
|
|
406
|
+
</div>
|
|
407
|
+
</div>
|
|
408
|
+
</td>
|
|
369
409
|
</tr>
|
|
410
|
+
<VcTableAddNew
|
|
411
|
+
:editing="editing"
|
|
412
|
+
:add-new-row-button="addNewRowButton"
|
|
413
|
+
@on-add-new-row="$emit('onAddNewRow')"
|
|
414
|
+
/>
|
|
415
|
+
</tbody>
|
|
416
|
+
<tbody
|
|
417
|
+
v-else
|
|
418
|
+
class="tw-table tw-overflow-auto tw-h-[calc(100%-42px)]"
|
|
419
|
+
>
|
|
420
|
+
<tr class="tw-h-full">
|
|
421
|
+
<th :colspan="colspan">
|
|
422
|
+
<!-- Empty table view -->
|
|
423
|
+
<template v-if="!(items && items.length && !columnsInit)">
|
|
424
|
+
<div>
|
|
425
|
+
<slot
|
|
426
|
+
v-if="searchValue || searchValue === '' || activeFilterCount"
|
|
427
|
+
name="notfound"
|
|
428
|
+
>
|
|
429
|
+
<div
|
|
430
|
+
class="tw-w-full tw-h-full tw-box-border tw-flex tw-flex-col tw-items-center tw-justify-center"
|
|
431
|
+
>
|
|
432
|
+
<img
|
|
433
|
+
v-if="notfound?.image"
|
|
434
|
+
:src="notfound.image"
|
|
435
|
+
/>
|
|
436
|
+
<div class="tw-m-4 vc-table__empty-text">
|
|
437
|
+
{{ notfound?.text || t("COMPONENTS.ORGANISMS.VC_TABLE.NOT_FOUND") }}
|
|
438
|
+
</div>
|
|
439
|
+
<VcButton
|
|
440
|
+
v-if="notfound?.action"
|
|
441
|
+
@click="notfound?.clickHandler"
|
|
442
|
+
>
|
|
443
|
+
{{ notfound.action }}
|
|
444
|
+
</VcButton>
|
|
445
|
+
</div>
|
|
446
|
+
</slot>
|
|
447
|
+
<slot
|
|
448
|
+
v-else
|
|
449
|
+
name="empty"
|
|
450
|
+
>
|
|
451
|
+
<div
|
|
452
|
+
class="tw-w-full tw-h-full tw-box-border tw-flex tw-flex-col tw-items-center tw-justify-center"
|
|
453
|
+
>
|
|
454
|
+
<img
|
|
455
|
+
v-if="empty?.image"
|
|
456
|
+
:src="empty.image"
|
|
457
|
+
/>
|
|
458
|
+
<div class="tw-m-4 tw-text-xl tw-font-medium">
|
|
459
|
+
{{ empty?.text || t("COMPONENTS.ORGANISMS.VC_TABLE.EMPTY") }}
|
|
460
|
+
</div>
|
|
461
|
+
<VcButton
|
|
462
|
+
v-if="empty?.action"
|
|
463
|
+
@click="empty?.clickHandler"
|
|
464
|
+
>
|
|
465
|
+
{{ empty.action }}
|
|
466
|
+
</VcButton>
|
|
467
|
+
</div>
|
|
468
|
+
</slot>
|
|
469
|
+
</div>
|
|
470
|
+
</template>
|
|
471
|
+
</th>
|
|
472
|
+
</tr>
|
|
473
|
+
<VcTableAddNew
|
|
474
|
+
:editing="editing"
|
|
475
|
+
:add-new-row-button="addNewRowButton"
|
|
476
|
+
@on-add-new-row="$emit('onAddNewRow')"
|
|
477
|
+
/>
|
|
370
478
|
</tbody>
|
|
371
479
|
</table>
|
|
372
480
|
</VcContainer>
|
|
373
|
-
|
|
374
|
-
<!-- Empty table view -->
|
|
375
|
-
<template v-else>
|
|
376
|
-
<slot
|
|
377
|
-
v-if="searchValue || searchValue === '' || activeFilterCount"
|
|
378
|
-
name="notfound"
|
|
379
|
-
>
|
|
380
|
-
<div class="tw-w-full tw-h-full tw-box-border tw-flex tw-flex-col tw-items-center tw-justify-center">
|
|
381
|
-
<img
|
|
382
|
-
v-if="notfound?.image"
|
|
383
|
-
:src="notfound.image"
|
|
384
|
-
/>
|
|
385
|
-
<div class="tw-m-4 vc-table__empty-text">
|
|
386
|
-
{{ notfound?.text || t("COMPONENTS.ORGANISMS.VC_TABLE.NOT_FOUND") }}
|
|
387
|
-
</div>
|
|
388
|
-
<VcButton
|
|
389
|
-
v-if="notfound?.action"
|
|
390
|
-
@click="notfound?.clickHandler"
|
|
391
|
-
>
|
|
392
|
-
{{ notfound.action }}
|
|
393
|
-
</VcButton>
|
|
394
|
-
</div>
|
|
395
|
-
</slot>
|
|
396
|
-
<slot
|
|
397
|
-
v-else
|
|
398
|
-
name="empty"
|
|
399
|
-
>
|
|
400
|
-
<div class="tw-w-full tw-h-full tw-box-border tw-flex tw-flex-col tw-items-center tw-justify-center">
|
|
401
|
-
<img
|
|
402
|
-
v-if="empty?.image"
|
|
403
|
-
:src="empty.image"
|
|
404
|
-
/>
|
|
405
|
-
<div class="tw-m-4 tw-text-xl tw-font-medium">
|
|
406
|
-
{{ empty?.text || t("COMPONENTS.ORGANISMS.VC_TABLE.EMPTY") }}
|
|
407
|
-
</div>
|
|
408
|
-
<VcButton
|
|
409
|
-
v-if="empty?.action"
|
|
410
|
-
@click="empty?.clickHandler"
|
|
411
|
-
>
|
|
412
|
-
{{ empty.action }}
|
|
413
|
-
</VcButton>
|
|
414
|
-
</div>
|
|
415
|
-
</slot>
|
|
416
|
-
</template>
|
|
417
481
|
</div>
|
|
418
482
|
|
|
419
483
|
<!-- Table footer -->
|
|
@@ -470,6 +534,7 @@ import VcTableMobileItem from "./_internal/vc-table-mobile-item/vc-table-mobile-
|
|
|
470
534
|
import * as _ from "lodash-es";
|
|
471
535
|
import "core-js/actual/array/to-spliced";
|
|
472
536
|
import "core-js/actual/array/to-sorted";
|
|
537
|
+
import VcTableAddNew from "./_internal/vc-table-add-new/vc-table-add-new.vue";
|
|
473
538
|
|
|
474
539
|
export interface StatusImage {
|
|
475
540
|
image?: string;
|
|
@@ -488,7 +553,7 @@ defineSlots<{
|
|
|
488
553
|
filters: (args: { closePanel: () => void }) => any;
|
|
489
554
|
"mobile-item": (args: { item: T }) => any;
|
|
490
555
|
[key: `header_${string}`]: (props: any) => any;
|
|
491
|
-
[key: `item_${string}`]: (args: { item: T; cell: ITableColumns }) => any;
|
|
556
|
+
[key: `item_${string}`]: (args: { item: T; cell: ITableColumns; index: number }) => any;
|
|
492
557
|
notfound: (props: any) => any;
|
|
493
558
|
empty: (props: any) => any;
|
|
494
559
|
footer: (props: any) => any;
|
|
@@ -522,7 +587,12 @@ const props = withDefaults(
|
|
|
522
587
|
stateKey: string;
|
|
523
588
|
selectAll?: boolean;
|
|
524
589
|
enableItemActions?: boolean;
|
|
525
|
-
|
|
590
|
+
editing?: boolean;
|
|
591
|
+
addNewRowButton?: {
|
|
592
|
+
show: boolean;
|
|
593
|
+
title: string;
|
|
594
|
+
};
|
|
595
|
+
removeRowButton?: boolean;
|
|
526
596
|
}>(),
|
|
527
597
|
{
|
|
528
598
|
items: () => [],
|
|
@@ -553,6 +623,8 @@ const emit = defineEmits<{
|
|
|
553
623
|
"row:reorder": [args: { dragIndex: number; dropIndex: number; value: T[] }];
|
|
554
624
|
"select:all": [values: boolean];
|
|
555
625
|
onEditComplete: [args: { event: { field: string; value: string | number }; index: number }];
|
|
626
|
+
onAddNewRow: [];
|
|
627
|
+
onRowRemove: [args: { index: number }];
|
|
556
628
|
}>();
|
|
557
629
|
|
|
558
630
|
const { t } = useI18n({ useScope: "global" });
|
|
@@ -610,6 +682,10 @@ onBeforeUpdate(() => {
|
|
|
610
682
|
tooltipRefs.value = [];
|
|
611
683
|
});
|
|
612
684
|
|
|
685
|
+
const colspan = computed(() => {
|
|
686
|
+
return filteredCols.value.length + (props.multiselect ? 1 : 0) + (props.enableItemActions ? 1 : 0);
|
|
687
|
+
});
|
|
688
|
+
|
|
613
689
|
const sortDirection = computed(() => {
|
|
614
690
|
const entry = props.sort?.split(":");
|
|
615
691
|
return entry && entry.length === 2 && entry[1];
|
|
@@ -645,8 +721,9 @@ const mobileTemplateRenderer = ({ item }: { item: TableItem }) => {
|
|
|
645
721
|
watch(
|
|
646
722
|
() => props.items,
|
|
647
723
|
(newVal) => {
|
|
724
|
+
let cols: ITableColumns[] = [];
|
|
648
725
|
if (newVal && newVal.length) {
|
|
649
|
-
|
|
726
|
+
cols = Object.keys(newVal[0]).map((key) => {
|
|
650
727
|
return {
|
|
651
728
|
id: key,
|
|
652
729
|
// From camelCase to human readable with first letter capitalized
|
|
@@ -655,16 +732,16 @@ watch(
|
|
|
655
732
|
predefined: false,
|
|
656
733
|
};
|
|
657
734
|
});
|
|
735
|
+
}
|
|
658
736
|
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
737
|
+
const predefined = props.columns.map((item) => ({
|
|
738
|
+
...item,
|
|
739
|
+
predefined: true,
|
|
740
|
+
visible: typeof item.visible !== "undefined" ? item.visible : true,
|
|
741
|
+
}));
|
|
742
|
+
allColumns.value = _.unionBy(predefined, cols, "id");
|
|
665
743
|
|
|
666
|
-
|
|
667
|
-
}
|
|
744
|
+
restoreState();
|
|
668
745
|
columnsInit.value = false;
|
|
669
746
|
},
|
|
670
747
|
{ deep: true, immediate: true },
|
|
@@ -692,7 +769,7 @@ const tableAlignment = {
|
|
|
692
769
|
|
|
693
770
|
const headerCheckbox = computed({
|
|
694
771
|
get() {
|
|
695
|
-
return props.items ? selection.value.length === props.items.length : false;
|
|
772
|
+
return props.items && props.items.length ? selection.value.length === props.items.length : false;
|
|
696
773
|
},
|
|
697
774
|
set(checked: boolean) {
|
|
698
775
|
let _selected: T[] = [];
|
|
@@ -1315,4 +1392,11 @@ $variants: (
|
|
|
1315
1392
|
@apply tw-shadow-[inset_0_2px_0_0_var(--row-drag-color)];
|
|
1316
1393
|
}
|
|
1317
1394
|
}
|
|
1395
|
+
|
|
1396
|
+
thead,
|
|
1397
|
+
tbody tr {
|
|
1398
|
+
display: table;
|
|
1399
|
+
width: 100%;
|
|
1400
|
+
table-layout: fixed;
|
|
1401
|
+
}
|
|
1318
1402
|
</style>
|