@vc-shell/framework 1.0.222 → 1.0.224
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 +34 -0
- package/core/types/index.ts +2 -1
- package/dist/core/plugins/modularity/index.d.ts +3 -3
- package/dist/core/plugins/modularity/index.d.ts.map +1 -1
- package/dist/core/types/index.d.ts +2 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/framework.js +22280 -22124
- package/dist/index.css +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/locales/en.json +2 -1
- package/dist/shared/components/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue.d.ts.map +1 -1
- package/dist/shared/components/blade-navigation/composables/useBladeNavigation/index.d.ts.map +1 -1
- package/dist/shared/components/error-interceptor/index.d.ts.map +1 -1
- package/dist/shared/components/notifications/components/notification-container/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/SchemaRender.d.ts +6 -0
- package/dist/shared/modules/dynamic/components/SchemaRender.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Button.d.ts +2 -0
- package/dist/shared/modules/dynamic/components/fields/Button.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Card.d.ts +2 -0
- package/dist/shared/modules/dynamic/components/fields/Card.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Checkbox.d.ts +2 -0
- package/dist/shared/modules/dynamic/components/fields/Checkbox.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/ContentField.d.ts +2 -0
- package/dist/shared/modules/dynamic/components/fields/ContentField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/CustomComponent.d.ts +2 -0
- package/dist/shared/modules/dynamic/components/fields/CustomComponent.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts +2 -0
- package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts +2 -0
- package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Fieldset.d.ts +2 -0
- package/dist/shared/modules/dynamic/components/fields/Fieldset.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/GalleryField.d.ts +2 -0
- package/dist/shared/modules/dynamic/components/fields/GalleryField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/ImageField.d.ts +2 -0
- package/dist/shared/modules/dynamic/components/fields/ImageField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/InputCurrency.d.ts +2 -0
- package/dist/shared/modules/dynamic/components/fields/InputCurrency.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/InputField.d.ts +2 -0
- package/dist/shared/modules/dynamic/components/fields/InputField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/MultivalueField.d.ts +2 -0
- package/dist/shared/modules/dynamic/components/fields/MultivalueField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/RadioButtonGroup.d.ts +2 -0
- package/dist/shared/modules/dynamic/components/fields/RadioButtonGroup.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/RatingField.d.ts +2 -0
- package/dist/shared/modules/dynamic/components/fields/RatingField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/SelectField.d.ts +2 -0
- package/dist/shared/modules/dynamic/components/fields/SelectField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/StatusField.d.ts +2 -0
- package/dist/shared/modules/dynamic/components/fields/StatusField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/SwitchField.d.ts +2 -0
- package/dist/shared/modules/dynamic/components/fields/SwitchField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Table.d.ts +10 -8
- package/dist/shared/modules/dynamic/components/fields/Table.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/TextareaField.d.ts +2 -0
- package/dist/shared/modules/dynamic/components/fields/TextareaField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/VideoField.d.ts +2 -0
- package/dist/shared/modules/dynamic/components/fields/VideoField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/props.d.ts +2 -0
- package/dist/shared/modules/dynamic/components/fields/props.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/Button.stories.d.ts +15 -9
- package/dist/shared/modules/dynamic/components/fields/storybook/Button.stories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/Card.stories.d.ts +19 -3
- package/dist/shared/modules/dynamic/components/fields/storybook/Card.stories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/Checkbox.stories.d.ts +6 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/Checkbox.stories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/ContentField.stories.d.ts +10 -4
- package/dist/shared/modules/dynamic/components/fields/storybook/ContentField.stories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/EditorField.stories.d.ts +7 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/EditorField.stories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.d.ts +9 -3
- package/dist/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/GalleryField.stories.d.ts +8 -2
- package/dist/shared/modules/dynamic/components/fields/storybook/GalleryField.stories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/ImageField.stories.d.ts +11 -5
- package/dist/shared/modules/dynamic/components/fields/storybook/ImageField.stories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/InputCurrency.stories.d.ts +6 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/InputCurrency.stories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/InputField.stories.d.ts +9 -3
- package/dist/shared/modules/dynamic/components/fields/storybook/InputField.stories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/MultivalueField.stories.d.ts +10 -4
- package/dist/shared/modules/dynamic/components/fields/storybook/MultivalueField.stories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/RadioButtonGroup.stories.d.ts +6 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/RadioButtonGroup.stories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/RatingField.stories.d.ts +8 -2
- package/dist/shared/modules/dynamic/components/fields/storybook/RatingField.stories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/SelectField.stories.d.ts +13 -7
- package/dist/shared/modules/dynamic/components/fields/storybook/SelectField.stories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/StatusField.stories.d.ts +9 -3
- package/dist/shared/modules/dynamic/components/fields/storybook/StatusField.stories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/TextareaField.stories.d.ts +7 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/TextareaField.stories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/VideoField.stories.d.ts +6 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/VideoField.stories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.d.ts +6 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/composables/useFilterBuilder/index.d.ts +1 -1
- package/dist/shared/modules/dynamic/composables/useFilterBuilder/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/composables/useToolbarReducer/index.d.ts +0 -1
- package/dist/shared/modules/dynamic/composables/useToolbarReducer/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/factories/base/useDetailsFactory.d.ts +3 -1
- package/dist/shared/modules/dynamic/factories/base/useDetailsFactory.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/factories/base/useListFactory.d.ts +1 -1
- package/dist/shared/modules/dynamic/factories/base/useListFactory.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/factories/types/index.d.ts +14 -2
- package/dist/shared/modules/dynamic/factories/types/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/nodeBuilder.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/override.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/visibilityHandler.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/index.d.ts +4 -4
- package/dist/shared/modules/dynamic/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts +2 -0
- package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/types/index.d.ts +6 -17
- package/dist/shared/modules/dynamic/types/index.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/components/atoms/vc-badge/vc-badge.stories.d.ts +4 -4
- package/dist/ui/components/atoms/vc-button/vc-button.stories.d.ts +11 -11
- package/dist/ui/components/atoms/vc-card/vc-card.stories.d.ts +7 -7
- package/dist/ui/components/atoms/vc-container/vc-container.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-hint/vc-hint.stories.d.ts +1 -1
- package/dist/ui/components/atoms/vc-icon/vc-icon.stories.d.ts +3 -3
- package/dist/ui/components/atoms/vc-image/vc-image.stories.d.ts +3 -3
- package/dist/ui/components/atoms/vc-label/vc-label.stories.d.ts +2 -2
- package/dist/ui/components/atoms/vc-link/vc-link.stories.d.ts +1 -1
- package/dist/ui/components/atoms/vc-progress/vc-progress.stories.d.ts +2 -2
- package/dist/ui/components/atoms/vc-status/vc-status.stories.d.ts +4 -4
- package/dist/ui/components/atoms/vc-switch/vc-switch.stories.d.ts +1 -1
- package/dist/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.d.ts +1 -1
- package/dist/ui/components/molecules/vc-checkbox/vc-checkbox.stories.d.ts +10 -10
- package/dist/ui/components/molecules/vc-editor/vc-editor.stories.d.ts +1 -1
- package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-field/vc-field.stories.d.ts +95 -2
- package/dist/ui/components/molecules/vc-field/vc-field.stories.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.stories.d.ts +2 -2
- package/dist/ui/components/molecules/vc-input/vc-input.stories.d.ts +2 -2
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.stories.d.ts +2 -2
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-radio-button/vc-radio-button.stories.d.ts +8 -8
- package/dist/ui/components/molecules/vc-rating/vc-rating.stories.d.ts +1 -1
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-slider/index.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-slider/vc-slider.stories.d.ts +3 -3
- package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-gallery/vc-gallery.stories.d.ts +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-add-new/vc-table-add-new.vue.d.ts.map +1 -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 +1 -0
- 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/_internal/vc-table-empty/vc-table-empty.vue.d.ts +42 -0
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-empty/vc-table-empty.vue.d.ts.map +1 -0
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-mobile-item/vc-table-mobile-item.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/vc-table.stories.d.ts +15 -105
- 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 +3 -21
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
- package/package.json +4 -4
- package/shared/components/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue +1 -0
- package/shared/components/blade-navigation/composables/useBladeNavigation/index.ts +20 -9
- package/shared/modules/dynamic/components/fields/Card.ts +1 -0
- package/shared/modules/dynamic/components/fields/GalleryField.ts +3 -2
- package/shared/modules/dynamic/components/fields/InputCurrency.ts +1 -4
- package/shared/modules/dynamic/components/fields/InputField.ts +1 -5
- package/shared/modules/dynamic/components/fields/MultivalueField.ts +1 -4
- package/shared/modules/dynamic/components/fields/SelectField.ts +1 -4
- package/shared/modules/dynamic/components/fields/Table.ts +61 -21
- package/shared/modules/dynamic/components/fields/storybook/Card.stories.ts +10 -0
- package/shared/modules/dynamic/components/fields/storybook/ContentField.stories.ts +1 -1
- package/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.ts +1 -1
- package/shared/modules/dynamic/components/fields/storybook/InputField.stories.ts +1 -1
- package/shared/modules/dynamic/components/fields/storybook/SelectField.stories.ts +4 -4
- package/shared/modules/dynamic/composables/useFilterBuilder/index.ts +1 -1
- package/shared/modules/dynamic/composables/useToolbarReducer/index.ts +0 -14
- package/shared/modules/dynamic/factories/base/useDetailsFactory.ts +12 -1
- package/shared/modules/dynamic/factories/types/index.ts +20 -2
- package/shared/modules/dynamic/helpers/nodeBuilder.ts +11 -3
- package/shared/modules/dynamic/pages/dynamic-blade-form.vue +16 -11
- package/shared/modules/dynamic/pages/dynamic-blade-list.vue +37 -29
- package/shared/modules/dynamic/types/index.ts +6 -16
- package/ui/components/atoms/vc-card/vc-card.vue +2 -2
- package/ui/components/atoms/vc-container/vc-container.vue +71 -128
- package/ui/components/atoms/vc-progress/vc-progress.stories.ts +1 -1
- package/ui/components/atoms/vc-status/vc-status.stories.ts +1 -1
- package/ui/components/molecules/vc-editor/vc-editor.vue +3 -0
- package/ui/components/molecules/vc-field/vc-field.stories.ts +2 -2
- package/ui/components/molecules/vc-input/vc-input.stories.ts +1 -1
- package/ui/components/molecules/vc-select/vc-select.vue +3 -3
- package/ui/components/organisms/vc-app/vc-app.vue +2 -2
- package/ui/components/organisms/vc-table/_internal/vc-table-add-new/vc-table-add-new.vue +18 -20
- package/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue +23 -16
- package/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue +8 -1
- package/ui/components/organisms/vc-table/_internal/vc-table-empty/vc-table-empty.vue +76 -0
- package/ui/components/organisms/vc-table/_internal/vc-table-mobile-item/vc-table-mobile-item.vue +9 -7
- package/ui/components/organisms/vc-table/vc-table.vue +188 -358
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
>
|
|
67
67
|
<!-- Mobile table view -->
|
|
68
68
|
<template v-if="$isMobile.value">
|
|
69
|
-
<div>
|
|
69
|
+
<div v-if="items && items.length && !columnsInit">
|
|
70
70
|
<VcTableMobileItem
|
|
71
71
|
v-for="(item, i) in items"
|
|
72
72
|
:key="i"
|
|
@@ -82,33 +82,56 @@
|
|
|
82
82
|
name="mobile-item"
|
|
83
83
|
:item="item"
|
|
84
84
|
>
|
|
85
|
-
<mobileTemplateRenderer
|
|
85
|
+
<mobileTemplateRenderer
|
|
86
|
+
:item="item"
|
|
87
|
+
:index="i"
|
|
88
|
+
/>
|
|
86
89
|
</slot>
|
|
87
90
|
</VcTableMobileItem>
|
|
88
91
|
</div>
|
|
92
|
+
<div
|
|
93
|
+
v-else
|
|
94
|
+
class="tw-overflow-auto tw-flex tw-flex-col tw-h-full"
|
|
95
|
+
>
|
|
96
|
+
<!-- Empty table view -->
|
|
97
|
+
<VcTableEmpty
|
|
98
|
+
:items="items"
|
|
99
|
+
:columns-init="columnsInit"
|
|
100
|
+
:search-value="searchValue"
|
|
101
|
+
:active-filter-count="activeFilterCount"
|
|
102
|
+
:notfound="notfound"
|
|
103
|
+
:empty="empty"
|
|
104
|
+
>
|
|
105
|
+
<template #notfound>
|
|
106
|
+
<slot name="notfound"></slot>
|
|
107
|
+
</template>
|
|
108
|
+
<template #empty>
|
|
109
|
+
<slot name="empty"></slot>
|
|
110
|
+
</template>
|
|
111
|
+
</VcTableEmpty>
|
|
112
|
+
</div>
|
|
89
113
|
</template>
|
|
90
114
|
|
|
91
115
|
<!-- Desktop table view -->
|
|
92
|
-
<
|
|
116
|
+
<div
|
|
93
117
|
v-else
|
|
94
118
|
ref="tableRef"
|
|
95
|
-
class="
|
|
119
|
+
class="tw-relative tw-box-border tw-w-full tw-h-full tw-flex tw-flex-col"
|
|
96
120
|
:class="{
|
|
97
121
|
'vc-table_empty': !items || !items.length,
|
|
98
122
|
'vc-table_multiselect': multiselect,
|
|
99
123
|
}"
|
|
100
124
|
>
|
|
101
|
-
<
|
|
125
|
+
<div
|
|
102
126
|
v-if="filteredCols.length"
|
|
103
|
-
class="vc-table__header tw-sticky tw-top-0 tw-bg-[#f9f9f9] tw-z-[1] tw-box-border"
|
|
127
|
+
class="vc-table__header tw-flex tw-flex-col tw-sticky tw-top-0 tw-bg-[#f9f9f9] tw-z-[1] tw-box-border"
|
|
104
128
|
@mouseenter="handleHeaderMouseOver(true)"
|
|
105
129
|
@mouseleave="handleHeaderMouseOver(false)"
|
|
106
130
|
>
|
|
107
|
-
<
|
|
108
|
-
<
|
|
131
|
+
<div class="vc-table__header-row tw-flex tw-flex-row">
|
|
132
|
+
<div
|
|
109
133
|
v-if="multiselect"
|
|
110
|
-
|
|
111
|
-
class="tw-h-[42px] tw-w-[28px] tw-max-w-[28px] tw-min-w-[28px] 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]"
|
|
134
|
+
class="tw-flex-1 tw-flex tw-items-center tw-justify-center tw-w-[28px] tw-max-w-[28px] tw-min-w-[28px] 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]"
|
|
112
135
|
>
|
|
113
136
|
<div class="tw-flex tw-justify-center tw-items-center">
|
|
114
137
|
<VcCheckbox
|
|
@@ -119,25 +142,19 @@
|
|
|
119
142
|
<div class="tw-top-0 tw-bottom-0 tw-absolute tw-right-0 tw-flex tw-justify-end">
|
|
120
143
|
<div class="tw-w-px tw-bg-[#e5e7eb] tw-h-full"></div>
|
|
121
144
|
</div>
|
|
122
|
-
</
|
|
123
|
-
<
|
|
124
|
-
v-if="enableItemActions && itemActionBuilder"
|
|
125
|
-
width="21px"
|
|
126
|
-
class="tw-h-[42px] tw-w-[21px] tw-max-w-[21px] tw-min-w-[21px] tw-bg-[#f9f9f9] tw-m-w-[70px] !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-z-[1]"
|
|
127
|
-
>
|
|
128
|
-
<div class="tw-top-0 tw-bottom-0 tw-absolute tw-right-0 tw-flex tw-justify-end">
|
|
129
|
-
<div class="tw-w-px tw-bg-[#e5e7eb] tw-h-full"></div>
|
|
130
|
-
</div>
|
|
131
|
-
</th>
|
|
132
|
-
<th
|
|
145
|
+
</div>
|
|
146
|
+
<div
|
|
133
147
|
v-for="(item, index) in filteredCols"
|
|
134
148
|
:id="item.id"
|
|
135
149
|
:key="item.id"
|
|
136
|
-
class="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]"
|
|
137
|
-
:class="
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
150
|
+
class="tw-flex-1 tw-flex tw-items-center 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]"
|
|
151
|
+
:class="[
|
|
152
|
+
{
|
|
153
|
+
'tw-cursor-pointer tw-group': item.sortable,
|
|
154
|
+
'tw-p-r-[35px]': index === filteredCols.length - 1,
|
|
155
|
+
},
|
|
156
|
+
item.align ? tableAlignment[item.align as keyof typeof tableAlignment] : '',
|
|
157
|
+
]"
|
|
141
158
|
:style="{ maxWidth: item.width, width: item.width }"
|
|
142
159
|
@mousedown="onColumnHeaderMouseDown"
|
|
143
160
|
@dragstart="onColumnHeaderDragStart($event, item)"
|
|
@@ -146,10 +163,7 @@
|
|
|
146
163
|
@drop="onColumnHeaderDrop($event, item)"
|
|
147
164
|
@click="handleHeaderClick(item)"
|
|
148
165
|
>
|
|
149
|
-
<div
|
|
150
|
-
class="tw-flex tw-items-center tw-flex-nowrap tw-truncate tw-px-3"
|
|
151
|
-
:class="item.align ? tableAlignment[item.align as keyof typeof tableAlignment] : ''"
|
|
152
|
-
>
|
|
166
|
+
<div class="tw-flex tw-items-center tw-flex-nowrap tw-truncate tw-px-3 tw-font-bold">
|
|
153
167
|
<div class="tw-truncate">
|
|
154
168
|
<span
|
|
155
169
|
v-if="editing && item.rules?.required"
|
|
@@ -183,33 +197,26 @@
|
|
|
183
197
|
</div>
|
|
184
198
|
<div
|
|
185
199
|
v-if="index !== filteredCols.length - 1"
|
|
186
|
-
class="tw-w-
|
|
200
|
+
class="tw-w-[5px] tw-mr-[3px] tw-border-r tw-border-r-[#e5e7eb] tw-border-solid tw-h-full tw-top-0 tw-bottom-0 tw-absolute tw-right-0 tw-flex tw-justify-end"
|
|
187
201
|
:class="{
|
|
188
202
|
'tw-cursor-col-resize': props.resizableColumns,
|
|
189
203
|
}"
|
|
190
204
|
@mousedown="handleMouseDown($event, item)"
|
|
191
|
-
>
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
</th>
|
|
205
|
+
></div>
|
|
206
|
+
</div>
|
|
207
|
+
|
|
195
208
|
<div
|
|
196
209
|
v-if="isHeaderHover && props.expanded"
|
|
197
|
-
class="tw-
|
|
210
|
+
class="tw-absolute tw-h-[42px] tw-z-[1] tw-right-0 tw-flex tw-items-center"
|
|
198
211
|
>
|
|
199
212
|
<VcTableColumnSwitcher
|
|
200
213
|
:items="internalColumnsSorted"
|
|
214
|
+
:state-key="stateKey"
|
|
201
215
|
@change="toggleColumn"
|
|
202
216
|
@on-active="handleColumnSwitcher"
|
|
203
217
|
></VcTableColumnSwitcher>
|
|
204
218
|
</div>
|
|
205
|
-
|
|
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>
|
|
212
|
-
</tr>
|
|
219
|
+
</div>
|
|
213
220
|
|
|
214
221
|
<div
|
|
215
222
|
ref="resizer"
|
|
@@ -219,10 +226,10 @@
|
|
|
219
226
|
ref="reorderRef"
|
|
220
227
|
class="tw-w-0.5 tw-bg-[#41afe6] tw-h-full tw-absolute tw-top-0 tw-bottom-0 tw-z-[2] tw-hidden"
|
|
221
228
|
></div>
|
|
222
|
-
</
|
|
229
|
+
</div>
|
|
223
230
|
<div
|
|
224
231
|
v-if="selectAll && showSelectionChoice"
|
|
225
|
-
class="tw-h-[60px] tw-bg-[#dfeef9] tw-w-full tw-
|
|
232
|
+
class="tw-h-[60px] tw-min-h-[60px] tw-bg-[#dfeef9] tw-w-full tw-flex"
|
|
226
233
|
>
|
|
227
234
|
<div class="tw-w-full tw-flex tw-items-center tw-justify-center">
|
|
228
235
|
<div>
|
|
@@ -244,16 +251,16 @@
|
|
|
244
251
|
</div>
|
|
245
252
|
</div>
|
|
246
253
|
</div>
|
|
247
|
-
<
|
|
254
|
+
<div
|
|
248
255
|
v-if="items && items.length && !columnsInit"
|
|
249
|
-
class="
|
|
250
|
-
:class="{ 'tw-translate-y-[60px]': selectAll && showSelectionChoice }"
|
|
256
|
+
class="tw-flex tw-flex-col tw-overflow-auto"
|
|
251
257
|
>
|
|
252
|
-
<
|
|
258
|
+
<div
|
|
253
259
|
v-for="(item, itemIndex) in items"
|
|
254
260
|
:key="(typeof item === 'object' && 'id' in item && item.id) || itemIndex"
|
|
255
|
-
class="vc-table__body-row tw-h-[60px] tw-
|
|
261
|
+
class="vc-table__body-row tw-flex tw-w-full tw-h-[60px] tw-min-h-[60px] tw-bg-white tw-relative tw-group"
|
|
256
262
|
:class="{
|
|
263
|
+
'hover:!tw-bg-[#dfeef9] tw-cursor-pointer': hasClickListener,
|
|
257
264
|
'!tw-bg-[#F9F9F9]': itemIndex % 2 === 1,
|
|
258
265
|
'!tw-bg-[#dfeef9] hover:!tw-bg-[#dfeef9]':
|
|
259
266
|
typeof item === 'object' && 'id' in item && item.id ? selectedItemId === item.id : false,
|
|
@@ -266,11 +273,11 @@
|
|
|
266
273
|
@dragleave="onRowDragLeave"
|
|
267
274
|
@dragend="onRowDragEnd"
|
|
268
275
|
@drop="onRowDrop"
|
|
276
|
+
@mouseover="showActions(itemIndex)"
|
|
269
277
|
>
|
|
270
|
-
<
|
|
278
|
+
<div
|
|
271
279
|
v-if="multiselect && typeof item === 'object'"
|
|
272
|
-
class="tw-w-[28px] tw-max-w-[28px] tw-min-w-[28px] tw-relative"
|
|
273
|
-
width="28px"
|
|
280
|
+
class="tw-w-[28px] tw-max-w-[28px] tw-min-w-[28px] tw-relative tw-flex-1 tw-flex tw-items-center tw-justify-center"
|
|
274
281
|
@click.stop
|
|
275
282
|
>
|
|
276
283
|
<div class="tw-flex tw-justify-center tw-items-center">
|
|
@@ -280,204 +287,105 @@
|
|
|
280
287
|
></VcCheckbox>
|
|
281
288
|
</div>
|
|
282
289
|
<div class="tw-w-px tw-top-0 tw-bottom-0 tw-absolute tw-right-0 tw-bg-[#e5e7eb]"></div>
|
|
283
|
-
</
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
class="tw-box-border tw-overflow-visible tw-w-[21px] tw-max-w-[21px] tw-min-w-[21px] tw-relative"
|
|
287
|
-
width="21px"
|
|
288
|
-
@click.stop
|
|
289
|
-
>
|
|
290
|
-
<div
|
|
291
|
-
class="vc-table__body-actions-container tw-relative tw-flex tw-justify-center tw-items-center tw-group"
|
|
292
|
-
>
|
|
293
|
-
<button
|
|
294
|
-
:ref="(el) => setActionToggleRefs(el, item.id)"
|
|
295
|
-
class="tw-text-[#41afe6] tw-cursor-pointer tw-border-none tw-bg-transparent disabled:tw-text-[gray] tw-w-full"
|
|
296
|
-
:class="{
|
|
297
|
-
'group-hover:tw-text-[#319ed4]': itemActions[itemIndex] && itemActions[itemIndex].length,
|
|
298
|
-
}"
|
|
299
|
-
:disabled="!(itemActions[itemIndex] && itemActions[itemIndex].length)"
|
|
300
|
-
@click.stop="showActions(item, item.id)"
|
|
301
|
-
>
|
|
302
|
-
<VcIcon
|
|
303
|
-
icon="fas fa-ellipsis-v"
|
|
304
|
-
size="m"
|
|
305
|
-
/>
|
|
306
|
-
</button>
|
|
307
|
-
<div
|
|
308
|
-
v-show="selectedRow === item.id"
|
|
309
|
-
:ref="(el) => setTooltipRefs(el, item.id)"
|
|
310
|
-
class="vc-table__body-tooltip tw-bg-white tw-rounded-[4px] tw-p-[15px] tw-z-[1] tw-absolute tw-right-0 tw-drop-shadow-[1px_3px_14px_rgba(111,122,131,0.25)] tw-w-max"
|
|
311
|
-
:style="tooltipStyle"
|
|
312
|
-
@mouseleave="closeActions"
|
|
313
|
-
>
|
|
314
|
-
<div
|
|
315
|
-
class="tw-flex tw-items-start tw-flex-col tw-text-[#3f3f3f] tw-font-normal not-italic tw-text-base tw-leading-[20px] tw-gap-[25px]"
|
|
316
|
-
>
|
|
317
|
-
<div
|
|
318
|
-
v-for="(itemAction, i) in itemActions[itemIndex]"
|
|
319
|
-
:key="i"
|
|
320
|
-
:class="[
|
|
321
|
-
'tw-flex tw-flex-row tw-items-center tw-text-[#319ed4] tw-cursor-pointer',
|
|
322
|
-
`vc-table__body-actions-item_${itemAction.type}`,
|
|
323
|
-
]"
|
|
324
|
-
@click.stop="itemAction.clickHandler(item)"
|
|
325
|
-
>
|
|
326
|
-
<VcIcon
|
|
327
|
-
:icon="itemAction.icon"
|
|
328
|
-
size="m"
|
|
329
|
-
/>
|
|
330
|
-
<div
|
|
331
|
-
class="tw-not-italic tw-font-normal tw-text-base tw-leading-[20px] tw-text-[#3f3f3f] tw-ml-[7px]"
|
|
332
|
-
>
|
|
333
|
-
{{ itemAction.title }}
|
|
334
|
-
</div>
|
|
335
|
-
</div>
|
|
336
|
-
</div>
|
|
337
|
-
<div
|
|
338
|
-
:ref="(el) => setTooltipArrowRefs(el, item.id)"
|
|
339
|
-
class="vc-table__body-tooltip-arrow"
|
|
340
|
-
:style="arrowStyle"
|
|
341
|
-
></div>
|
|
342
|
-
</div>
|
|
343
|
-
</div>
|
|
344
|
-
<div class="tw-w-px tw-top-0 tw-bottom-0 tw-absolute tw-right-0 tw-bg-[#e5e7eb]"></div>
|
|
345
|
-
</td>
|
|
346
|
-
<td
|
|
290
|
+
</div>
|
|
291
|
+
|
|
292
|
+
<div
|
|
347
293
|
v-for="cell in filteredCols"
|
|
348
294
|
:id="`${(typeof item === 'object' && 'id' in item && item.id) || itemIndex}_${cell.id}`"
|
|
349
295
|
:key="`${(typeof item === 'object' && 'id' in item && item.id) || itemIndex}_${cell.id}`"
|
|
350
|
-
class="tw-box-border tw-overflow-hidden tw-px-3"
|
|
351
|
-
:class="[
|
|
352
|
-
cell.class,
|
|
353
|
-
{
|
|
354
|
-
// 'last:tw-w-full': cell.id === filteredCols[filteredCols.length - 1].id,
|
|
355
|
-
},
|
|
356
|
-
]"
|
|
296
|
+
class="tw-box-border tw-overflow-hidden tw-px-3 tw-flex-1 tw-flex tw-items-center"
|
|
297
|
+
:class="[cell.class]"
|
|
357
298
|
:style="{ maxWidth: cell.width, width: cell.width }"
|
|
358
299
|
>
|
|
359
|
-
<
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
:cell="cell"
|
|
363
|
-
:index="itemIndex"
|
|
364
|
-
>
|
|
365
|
-
<VcTableCell
|
|
366
|
-
v-if="typeof item === 'object'"
|
|
367
|
-
:cell="cell"
|
|
300
|
+
<div class="tw-truncate">
|
|
301
|
+
<slot
|
|
302
|
+
:name="`item_${cell.id}`"
|
|
368
303
|
:item="item"
|
|
369
|
-
:
|
|
304
|
+
:cell="cell"
|
|
370
305
|
:index="itemIndex"
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
306
|
+
>
|
|
307
|
+
<VcTableCell
|
|
308
|
+
v-if="typeof item === 'object'"
|
|
309
|
+
class="tw-flex-1"
|
|
310
|
+
:cell="cell"
|
|
311
|
+
:item="item"
|
|
312
|
+
:editing="editing"
|
|
313
|
+
:index="itemIndex"
|
|
314
|
+
:width="
|
|
315
|
+
calculateElWidth(
|
|
316
|
+
`${(typeof item === 'object' && 'id' in item && item.id) || itemIndex}_${cell.id}`,
|
|
317
|
+
)
|
|
318
|
+
"
|
|
319
|
+
@update="$emit('onEditComplete', { event: $event, index: itemIndex })"
|
|
320
|
+
@blur="$emit('onCellBlur', $event)"
|
|
321
|
+
></VcTableCell>
|
|
322
|
+
</slot>
|
|
323
|
+
</div>
|
|
324
|
+
</div>
|
|
325
|
+
<div
|
|
326
|
+
v-if="
|
|
327
|
+
enableItemActions && itemActionBuilder && typeof item === 'object' && selectedRowIndex === itemIndex
|
|
328
|
+
"
|
|
329
|
+
class="tw-absolute tw-flex tw-right-0 actions tw-h-full tw-bg-[#f4f8fb]"
|
|
330
|
+
:class="{
|
|
331
|
+
'group-hover:!tw-bg-[#dfeef9]': hasClickListener,
|
|
332
|
+
}"
|
|
333
|
+
@click.stop
|
|
385
334
|
>
|
|
386
|
-
<div
|
|
335
|
+
<div
|
|
336
|
+
class="tw-flex tw-flex-row tw-items-center tw-text-[#3f3f3f] tw-font-normal not-italic tw-text-base tw-leading-[20px] tw-gap-[10px]"
|
|
337
|
+
>
|
|
387
338
|
<div
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
"
|
|
339
|
+
v-for="(itemAction, i) in itemActions[itemIndex]"
|
|
340
|
+
:key="i"
|
|
341
|
+
:class="[
|
|
342
|
+
'tw-text-[#319ed4] tw-cursor-pointer tw-w-[22px] tw-h-[22px] tw-flex tw-items-center tw-justify-center',
|
|
343
|
+
]"
|
|
344
|
+
@click.stop="itemAction.clickHandler(item, itemIndex)"
|
|
394
345
|
>
|
|
395
|
-
<
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
fill="none"
|
|
400
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
401
|
-
>
|
|
402
|
-
<path
|
|
403
|
-
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"
|
|
404
|
-
fill="#6E8BA5"
|
|
346
|
+
<VcTooltip>
|
|
347
|
+
<VcIcon
|
|
348
|
+
:icon="itemAction.icon"
|
|
349
|
+
size="m"
|
|
405
350
|
/>
|
|
406
|
-
|
|
351
|
+
<template #tooltip>
|
|
352
|
+
<div class="tw-not-italic tw-font-normal tw-text-base tw-leading-[20px] tw-text-[#3f3f3f]">
|
|
353
|
+
{{ itemAction.title }}
|
|
354
|
+
</div>
|
|
355
|
+
</template>
|
|
356
|
+
</VcTooltip>
|
|
407
357
|
</div>
|
|
408
358
|
</div>
|
|
409
|
-
</
|
|
410
|
-
</
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
:add-new-row-button="addNewRowButton"
|
|
414
|
-
@on-add-new-row="$emit('onAddNewRow')"
|
|
415
|
-
/>
|
|
416
|
-
</tbody>
|
|
417
|
-
<tbody
|
|
359
|
+
</div>
|
|
360
|
+
</div>
|
|
361
|
+
</div>
|
|
362
|
+
<div
|
|
418
363
|
v-else
|
|
419
|
-
class="tw-
|
|
364
|
+
class="tw-overflow-auto tw-flex tw-flex-col tw-flex-auto"
|
|
420
365
|
>
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
{{ notfound.action }}
|
|
445
|
-
</VcButton>
|
|
446
|
-
</div>
|
|
447
|
-
</slot>
|
|
448
|
-
<slot
|
|
449
|
-
v-else
|
|
450
|
-
name="empty"
|
|
451
|
-
>
|
|
452
|
-
<div
|
|
453
|
-
class="tw-w-full tw-h-full tw-box-border tw-flex tw-flex-col tw-items-center tw-justify-center"
|
|
454
|
-
>
|
|
455
|
-
<img
|
|
456
|
-
v-if="empty?.image"
|
|
457
|
-
:src="empty.image"
|
|
458
|
-
/>
|
|
459
|
-
<div class="tw-m-4 tw-text-xl tw-font-medium">
|
|
460
|
-
{{ empty?.text || t("COMPONENTS.ORGANISMS.VC_TABLE.EMPTY") }}
|
|
461
|
-
</div>
|
|
462
|
-
<VcButton
|
|
463
|
-
v-if="empty?.action"
|
|
464
|
-
@click="empty?.clickHandler"
|
|
465
|
-
>
|
|
466
|
-
{{ empty.action }}
|
|
467
|
-
</VcButton>
|
|
468
|
-
</div>
|
|
469
|
-
</slot>
|
|
470
|
-
</div>
|
|
471
|
-
</template>
|
|
472
|
-
</th>
|
|
473
|
-
</tr>
|
|
474
|
-
<VcTableAddNew
|
|
475
|
-
:editing="editing"
|
|
476
|
-
:add-new-row-button="addNewRowButton"
|
|
477
|
-
@on-add-new-row="$emit('onAddNewRow')"
|
|
478
|
-
/>
|
|
479
|
-
</tbody>
|
|
480
|
-
</table>
|
|
366
|
+
<!-- Empty table view -->
|
|
367
|
+
<VcTableEmpty
|
|
368
|
+
:items="items"
|
|
369
|
+
:columns-init="columnsInit"
|
|
370
|
+
:search-value="searchValue"
|
|
371
|
+
:active-filter-count="activeFilterCount"
|
|
372
|
+
:notfound="notfound"
|
|
373
|
+
:empty="empty"
|
|
374
|
+
>
|
|
375
|
+
<template #notfound>
|
|
376
|
+
<slot name="notfound"></slot>
|
|
377
|
+
</template>
|
|
378
|
+
<template #empty>
|
|
379
|
+
<slot name="empty"></slot>
|
|
380
|
+
</template>
|
|
381
|
+
</VcTableEmpty>
|
|
382
|
+
</div>
|
|
383
|
+
</div>
|
|
384
|
+
<VcTableAddNew
|
|
385
|
+
:editing="editing"
|
|
386
|
+
:add-new-row-button="addNewRowButton"
|
|
387
|
+
@on-add-new-row="$emit('onAddNewRow')"
|
|
388
|
+
/>
|
|
481
389
|
</VcContainer>
|
|
482
390
|
</div>
|
|
483
391
|
|
|
@@ -508,24 +416,23 @@
|
|
|
508
416
|
</template>
|
|
509
417
|
<!-- eslint-disable @typescript-eslint/no-explicit-any -->
|
|
510
418
|
<script lang="ts" setup generic="T extends TableItem | string">
|
|
511
|
-
import {
|
|
512
|
-
import { reactiveComputed, useCurrentElement, useLocalStorage } from "@vueuse/core";
|
|
419
|
+
import { useCurrentElement, useLocalStorage } from "@vueuse/core";
|
|
513
420
|
import {
|
|
514
|
-
ComponentPublicInstance,
|
|
515
421
|
MaybeRef,
|
|
516
422
|
Ref,
|
|
517
423
|
computed,
|
|
518
424
|
h,
|
|
519
|
-
nextTick,
|
|
520
425
|
onBeforeUnmount,
|
|
521
|
-
onBeforeUpdate,
|
|
522
426
|
ref,
|
|
523
427
|
toValue,
|
|
524
428
|
unref,
|
|
525
429
|
watch,
|
|
430
|
+
getCurrentInstance,
|
|
431
|
+
shallowRef,
|
|
432
|
+
useSlots,
|
|
526
433
|
} from "vue";
|
|
527
434
|
import { useI18n } from "vue-i18n";
|
|
528
|
-
import { VcButton, VcCheckbox, VcContainer, VcIcon, VcInput, VcPagination,
|
|
435
|
+
import { VcButton, VcCheckbox, VcContainer, VcIcon, VcInput, VcPagination, VcLabel } from "./../../";
|
|
529
436
|
import { IActionBuilderResult, ITableColumns } from "./../../../../core/types";
|
|
530
437
|
import VcTableCell from "./_internal/vc-table-cell/vc-table-cell.vue";
|
|
531
438
|
import VcTableColumnSwitcher from "./_internal/vc-table-column-switcher/vc-table-column-switcher.vue";
|
|
@@ -536,6 +443,7 @@ import * as _ from "lodash-es";
|
|
|
536
443
|
import "core-js/actual/array/to-spliced";
|
|
537
444
|
import "core-js/actual/array/to-sorted";
|
|
538
445
|
import VcTableAddNew from "./_internal/vc-table-add-new/vc-table-add-new.vue";
|
|
446
|
+
import VcTableEmpty from "./_internal/vc-table-empty/vc-table-empty.vue";
|
|
539
447
|
|
|
540
448
|
export interface StatusImage {
|
|
541
449
|
image?: string;
|
|
@@ -593,7 +501,6 @@ const props = withDefaults(
|
|
|
593
501
|
show: boolean;
|
|
594
502
|
title: string;
|
|
595
503
|
};
|
|
596
|
-
removeRowButton?: boolean;
|
|
597
504
|
}>(),
|
|
598
505
|
{
|
|
599
506
|
items: () => [],
|
|
@@ -609,11 +516,6 @@ const props = withDefaults(
|
|
|
609
516
|
},
|
|
610
517
|
);
|
|
611
518
|
|
|
612
|
-
interface ITableItemRef {
|
|
613
|
-
element: Element | ComponentPublicInstance;
|
|
614
|
-
id: string;
|
|
615
|
-
}
|
|
616
|
-
|
|
617
519
|
const emit = defineEmits<{
|
|
618
520
|
paginationClick: [page: number];
|
|
619
521
|
selectionChanged: [values: T[]];
|
|
@@ -625,15 +527,14 @@ const emit = defineEmits<{
|
|
|
625
527
|
"select:all": [values: boolean];
|
|
626
528
|
onEditComplete: [args: { event: { field: string; value: string | number }; index: number }];
|
|
627
529
|
onAddNewRow: [];
|
|
628
|
-
onRowRemove: [args: { index: number }];
|
|
629
530
|
onCellBlur: [args: { row: number | undefined; field: string }];
|
|
630
531
|
}>();
|
|
631
532
|
|
|
632
533
|
const { t } = useI18n({ useScope: "global" });
|
|
534
|
+
const instance = getCurrentInstance();
|
|
535
|
+
const slots = useSlots();
|
|
633
536
|
|
|
634
537
|
// template refs
|
|
635
|
-
const tooltipRefs = ref<ITableItemRef[]>([]);
|
|
636
|
-
const tooltipArrowRefs = ref<ITableItemRef[] | null>([]);
|
|
637
538
|
const reorderRef = ref<HTMLElement | null>();
|
|
638
539
|
const tableRef = ref<HTMLElement | null>();
|
|
639
540
|
|
|
@@ -644,10 +545,9 @@ let columnResizeEndListener: ((...args: any[]) => any) | null = null;
|
|
|
644
545
|
const selection = ref<T[]>([]) as Ref<T[]>;
|
|
645
546
|
const allSelected = ref(false);
|
|
646
547
|
|
|
647
|
-
const
|
|
648
|
-
|
|
548
|
+
const selectedRowIndex = shallowRef();
|
|
549
|
+
|
|
649
550
|
const scrollContainer = ref<typeof VcContainer>();
|
|
650
|
-
const actionToggleRefs = ref<ITableItemRef[]>([]);
|
|
651
551
|
|
|
652
552
|
const itemActions: Ref<IActionBuilderResult[][]> = ref([]);
|
|
653
553
|
const mobileSwipeItem = ref<string>();
|
|
@@ -679,15 +579,6 @@ onBeforeUnmount(() => {
|
|
|
679
579
|
unbindColumnResizeEvents();
|
|
680
580
|
});
|
|
681
581
|
|
|
682
|
-
onBeforeUpdate(() => {
|
|
683
|
-
actionToggleRefs.value = [];
|
|
684
|
-
tooltipRefs.value = [];
|
|
685
|
-
});
|
|
686
|
-
|
|
687
|
-
const colspan = computed(() => {
|
|
688
|
-
return filteredCols.value.length + (props.multiselect ? 1 : 0) + (props.enableItemActions ? 1 : 0);
|
|
689
|
-
});
|
|
690
|
-
|
|
691
582
|
const sortDirection = computed(() => {
|
|
692
583
|
const entry = props.sort?.split(":");
|
|
693
584
|
return entry && entry.length === 2 && entry[1];
|
|
@@ -698,6 +589,8 @@ const sortField = computed(() => {
|
|
|
698
589
|
return entry && entry.length === 2 && entry[0];
|
|
699
590
|
});
|
|
700
591
|
|
|
592
|
+
const hasClickListener = typeof instance?.vnode.props?.["onItemClick"] === "function";
|
|
593
|
+
|
|
701
594
|
const calculateElWidth = (id: string) => {
|
|
702
595
|
const el = document.getElementById(id);
|
|
703
596
|
return el ? el.offsetWidth : 0;
|
|
@@ -705,18 +598,30 @@ const calculateElWidth = (id: string) => {
|
|
|
705
598
|
|
|
706
599
|
const allColumns = ref([]) as Ref<ITableColumns[]>;
|
|
707
600
|
|
|
708
|
-
const mobileTemplateRenderer = ({ item }: { item: TableItem }) => {
|
|
709
|
-
return
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
601
|
+
const mobileTemplateRenderer = ({ item, index }: { item: TableItem | string; index: number }) => {
|
|
602
|
+
return h(
|
|
603
|
+
"div",
|
|
604
|
+
{ class: "tw-border-b tw-border-solid tw-border-b-[#e3e7ec] tw-p-3 tw-gap-2 tw-flex tw-flex-wrap" },
|
|
605
|
+
props.columns.map((x) => {
|
|
606
|
+
return h("div", { class: "tw-grow tw-w-[33%] tw-ml-3 tw-truncate" }, [
|
|
607
|
+
h(VcLabel, { class: "tw-mb-1 tw-truncate", required: x?.rules?.required }, () => toValue(x.title)),
|
|
608
|
+
slots[`item_${x.id}`]
|
|
609
|
+
? slots[`item_${x.id}`]({ item, cell: x, index })
|
|
610
|
+
: [
|
|
611
|
+
h(VcTableCell, {
|
|
612
|
+
cell: { ...x, class: "!tw-justify-start" },
|
|
613
|
+
item,
|
|
614
|
+
class: "",
|
|
615
|
+
editing: props.editing,
|
|
616
|
+
index,
|
|
617
|
+
onUpdate: (event) => {
|
|
618
|
+
emit("onEditComplete", { event: event, index });
|
|
619
|
+
},
|
|
620
|
+
onBlur: (event) => emit("onCellBlur", event),
|
|
621
|
+
}),
|
|
622
|
+
],
|
|
623
|
+
]);
|
|
624
|
+
}),
|
|
720
625
|
);
|
|
721
626
|
};
|
|
722
627
|
|
|
@@ -864,83 +769,12 @@ function rowCheckbox(item: T) {
|
|
|
864
769
|
}
|
|
865
770
|
}
|
|
866
771
|
|
|
867
|
-
function
|
|
868
|
-
if (
|
|
869
|
-
|
|
870
|
-
if (!isExists) {
|
|
871
|
-
tooltipRefs.value.push({ element: el, id });
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
function setActionToggleRefs(el: Element | ComponentPublicInstance | null, id: string) {
|
|
877
|
-
if (el) {
|
|
878
|
-
const isExists = actionToggleRefs.value.some((item) => item.id === id);
|
|
879
|
-
if (!isExists) {
|
|
880
|
-
actionToggleRefs.value.push({ element: el, id });
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
function setTooltipArrowRefs(el: Element | ComponentPublicInstance | null, id: string) {
|
|
886
|
-
if (el) {
|
|
887
|
-
const isExists = tooltipArrowRefs.value?.some((item) => item.id === id);
|
|
888
|
-
if (!isExists) {
|
|
889
|
-
tooltipArrowRefs.value?.push({ element: el, id });
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
function showActions(item: T, index: string) {
|
|
895
|
-
if (typeof item !== "string") {
|
|
896
|
-
if (selectedRow.value) {
|
|
897
|
-
closeActions();
|
|
898
|
-
return;
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
selectedRow.value = item.id;
|
|
902
|
-
|
|
903
|
-
const toggleRef = actionToggleRefs.value.find((item) => item.id === index)?.element;
|
|
904
|
-
const tooltipRef = tooltipRefs.value.find((item) => item.id === index)?.element;
|
|
905
|
-
const tooltipArrowRef = tooltipArrowRefs.value?.find((item) => item.id === index)?.element;
|
|
906
|
-
|
|
907
|
-
if (toggleRef && tooltipRef && tooltipArrowRef) {
|
|
908
|
-
nextTick(() => {
|
|
909
|
-
computePosition(toggleRef as ReferenceElement, tooltipRef as HTMLElement, {
|
|
910
|
-
placement: "bottom",
|
|
911
|
-
middleware: [
|
|
912
|
-
flip({ fallbackPlacements: ["top", "bottom"] }),
|
|
913
|
-
offset({ crossAxis: 35, mainAxis: 15 }),
|
|
914
|
-
arrow({ element: tooltipArrowRef as HTMLElement }),
|
|
915
|
-
],
|
|
916
|
-
}).then((item) => (tooltip.value = item));
|
|
917
|
-
});
|
|
918
|
-
}
|
|
772
|
+
function showActions(index: number) {
|
|
773
|
+
if (props.enableItemActions && props.itemActionBuilder && typeof props.items[index] === "object") {
|
|
774
|
+
selectedRowIndex.value = index;
|
|
919
775
|
}
|
|
920
776
|
}
|
|
921
777
|
|
|
922
|
-
const tooltipStyle = computed(() => {
|
|
923
|
-
return {
|
|
924
|
-
top: `${tooltip.value?.y ?? 0}px`,
|
|
925
|
-
left: `${tooltip.value?.x ?? 0}px`,
|
|
926
|
-
};
|
|
927
|
-
});
|
|
928
|
-
|
|
929
|
-
const arrowStyle = computed(() => {
|
|
930
|
-
if (tooltip.value && tooltip.value.middlewareData.arrow) {
|
|
931
|
-
const { x } = tooltip.value && tooltip.value.middlewareData.arrow;
|
|
932
|
-
return {
|
|
933
|
-
top: (tooltip.value.placement === "bottom" && "-4px") || undefined,
|
|
934
|
-
bottom: (tooltip.value.placement === "top" && "-4px") || undefined,
|
|
935
|
-
left: `${x ?? 0}px`,
|
|
936
|
-
};
|
|
937
|
-
}
|
|
938
|
-
return {
|
|
939
|
-
top: "0px",
|
|
940
|
-
left: "0px",
|
|
941
|
-
};
|
|
942
|
-
});
|
|
943
|
-
|
|
944
778
|
async function calculateActions(items: T[]) {
|
|
945
779
|
if (props.enableItemActions && typeof props.itemActionBuilder === "function") {
|
|
946
780
|
const populatedItems: IActionBuilderResult[][] = [];
|
|
@@ -957,7 +791,7 @@ async function calculateActions(items: T[]) {
|
|
|
957
791
|
}
|
|
958
792
|
|
|
959
793
|
function closeActions() {
|
|
960
|
-
|
|
794
|
+
selectedRowIndex.value = undefined;
|
|
961
795
|
}
|
|
962
796
|
|
|
963
797
|
function handleSwipe(id: string) {
|
|
@@ -1360,6 +1194,9 @@ $variants: (
|
|
|
1360
1194
|
|
|
1361
1195
|
.vc-table {
|
|
1362
1196
|
&__body {
|
|
1197
|
+
&-row:hover .actions {
|
|
1198
|
+
display: flex;
|
|
1199
|
+
}
|
|
1363
1200
|
&-actions-item {
|
|
1364
1201
|
@each $name, $variant in $variants {
|
|
1365
1202
|
&_#{$name} {
|
|
@@ -1394,11 +1231,4 @@ $variants: (
|
|
|
1394
1231
|
@apply tw-shadow-[inset_0_2px_0_0_var(--row-drag-color)];
|
|
1395
1232
|
}
|
|
1396
1233
|
}
|
|
1397
|
-
|
|
1398
|
-
thead,
|
|
1399
|
-
tbody tr {
|
|
1400
|
-
display: table;
|
|
1401
|
-
width: 100%;
|
|
1402
|
-
table-layout: fixed;
|
|
1403
|
-
}
|
|
1404
1234
|
</style>
|