@movk/nuxt 1.8.3 → 2.0.0-beta.1
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/README.en.md +16 -6
- package/README.md +16 -6
- package/dist/module.d.mts +6 -0
- package/dist/module.json +3 -3
- package/dist/module.mjs +15 -22
- package/dist/runtime/components/AutoForm.d.vue.ts +15 -1
- package/dist/runtime/components/AutoForm.vue +48 -50
- package/dist/runtime/components/AutoForm.vue.d.ts +15 -1
- package/dist/runtime/components/DataTable.d.vue.ts +4 -2
- package/dist/runtime/components/DataTable.vue +166 -174
- package/dist/runtime/components/DataTable.vue.d.ts +4 -2
- package/dist/runtime/components/DatePicker.d.vue.ts +6 -5
- package/dist/runtime/components/DatePicker.vue +96 -43
- package/dist/runtime/components/DatePicker.vue.d.ts +6 -5
- package/dist/runtime/components/MessageBox.d.vue.ts +1 -5
- package/dist/runtime/components/MessageBox.vue +9 -7
- package/dist/runtime/components/MessageBox.vue.d.ts +1 -5
- package/dist/runtime/components/SearchForm.d.vue.ts +12 -4
- package/dist/runtime/components/SearchForm.vue +130 -120
- package/dist/runtime/components/SearchForm.vue.d.ts +12 -4
- package/dist/runtime/components/Tree.d.vue.ts +3 -1
- package/dist/runtime/components/Tree.vue +102 -140
- package/dist/runtime/components/Tree.vue.d.ts +3 -1
- package/dist/runtime/components/theme-picker/ThemePicker.vue +5 -3
- package/dist/runtime/components/theme-picker/ThemePickerButton.vue +15 -6
- package/dist/runtime/composables/index.d.ts +1 -0
- package/dist/runtime/composables/index.js +1 -0
- package/dist/runtime/composables/useApiFetch.d.ts +7 -7
- package/dist/runtime/composables/useApiFetch.js +5 -23
- package/dist/runtime/composables/useAutoForm.js +2 -2
- package/dist/runtime/composables/useClientApiFetch.d.ts +5 -5
- package/dist/runtime/composables/useDateFormatter.d.ts +32 -34
- package/dist/runtime/composables/useDateFormatter.js +75 -232
- package/dist/runtime/composables/useDownloadWithProgress.d.ts +11 -8
- package/dist/runtime/composables/useDownloadWithProgress.js +49 -132
- package/dist/runtime/composables/useMessageBox.js +3 -2
- package/dist/runtime/composables/useMovkLocale.d.ts +16 -0
- package/dist/runtime/composables/useMovkLocale.js +20 -0
- package/dist/runtime/composables/useTheme.js +8 -18
- package/dist/runtime/composables/useUploadWithProgress.d.ts +9 -6
- package/dist/runtime/composables/useUploadWithProgress.js +50 -84
- package/dist/runtime/domains/ai/chat-transport.js +1 -0
- package/dist/runtime/domains/api/adapters/xhr.d.ts +17 -0
- package/dist/runtime/domains/api/adapters/xhr.js +55 -0
- package/dist/runtime/domains/api/auth.d.ts +4 -1
- package/dist/runtime/domains/api/auth.js +6 -7
- package/dist/runtime/domains/api/client.d.ts +13 -0
- package/dist/runtime/domains/api/client.js +35 -0
- package/dist/runtime/domains/api/download.d.ts +10 -0
- package/dist/runtime/domains/api/download.js +28 -0
- package/dist/runtime/domains/api/errors.d.ts +20 -2
- package/dist/runtime/domains/api/errors.js +61 -8
- package/dist/runtime/domains/api/fetch-key.d.ts +2 -2
- package/dist/runtime/domains/api/fetch-key.js +4 -4
- package/dist/runtime/domains/api/interceptors/request.d.ts +2 -6
- package/dist/runtime/domains/api/interceptors/request.js +3 -2
- package/dist/runtime/domains/api/interceptors/response.d.ts +8 -14
- package/dist/runtime/domains/api/interceptors/response.js +34 -25
- package/dist/runtime/domains/api/report.d.ts +25 -0
- package/dist/runtime/domains/api/report.js +51 -0
- package/dist/runtime/domains/api/response.d.ts +29 -4
- package/dist/runtime/domains/api/response.js +27 -6
- package/dist/runtime/domains/api/session.d.ts +1 -1
- package/dist/runtime/domains/api/session.js +1 -1
- package/dist/runtime/domains/api/stream.d.ts +2 -1
- package/dist/runtime/domains/api/stream.js +2 -1
- package/dist/runtime/domains/api/toast.d.ts +6 -3
- package/dist/runtime/domains/api/toast.js +7 -7
- package/dist/runtime/domains/auto-form/actions.d.ts +2 -1
- package/dist/runtime/domains/auto-form/actions.js +6 -4
- package/dist/runtime/domains/auto-form/array-ops.d.ts +3 -0
- package/dist/runtime/domains/auto-form/array-ops.js +9 -0
- package/dist/runtime/domains/auto-form/async-items.d.ts +10 -0
- package/dist/runtime/domains/auto-form/async-items.js +42 -0
- package/dist/runtime/domains/auto-form/components/Array.d.vue.ts +0 -4
- package/dist/runtime/domains/auto-form/components/Array.vue +81 -73
- package/dist/runtime/domains/auto-form/components/Array.vue.d.ts +0 -4
- package/dist/runtime/domains/auto-form/components/Children.d.vue.ts +0 -2
- package/dist/runtime/domains/auto-form/components/Children.vue +0 -5
- package/dist/runtime/domains/auto-form/components/Children.vue.d.ts +0 -2
- package/dist/runtime/domains/auto-form/components/Field.d.vue.ts +0 -2
- package/dist/runtime/domains/auto-form/components/Field.vue +9 -2
- package/dist/runtime/domains/auto-form/components/Field.vue.d.ts +0 -2
- package/dist/runtime/domains/auto-form/components/Layout.d.vue.ts +0 -2
- package/dist/runtime/domains/auto-form/components/Layout.vue +3 -6
- package/dist/runtime/domains/auto-form/components/Layout.vue.d.ts +0 -2
- package/dist/runtime/domains/auto-form/components/Nested.d.vue.ts +0 -2
- package/dist/runtime/domains/auto-form/components/Nested.vue +5 -9
- package/dist/runtime/domains/auto-form/components/Nested.vue.d.ts +0 -2
- package/dist/runtime/domains/auto-form/controls.d.ts +5 -572
- package/dist/runtime/domains/auto-form/controls.js +7 -20
- package/dist/runtime/domains/auto-form/fields.d.ts +21 -4
- package/dist/runtime/domains/auto-form/fields.js +52 -40
- package/dist/runtime/domains/auto-form/provider.d.ts +15 -6
- package/dist/runtime/domains/auto-form/provider.js +24 -10
- package/dist/runtime/domains/auto-form/schema.d.ts +9 -4
- package/dist/runtime/domains/auto-form/schema.js +91 -50
- package/dist/runtime/domains/auto-form/search-query.d.ts +10 -0
- package/dist/runtime/domains/auto-form/search-query.js +57 -0
- package/dist/runtime/domains/auto-form/useAutoFormCore.d.ts +62 -0
- package/dist/runtime/domains/auto-form/useAutoFormCore.js +108 -0
- package/dist/runtime/domains/auto-form/useSearchQuerySync.d.ts +11 -0
- package/dist/runtime/domains/auto-form/useSearchQuerySync.js +64 -0
- package/dist/runtime/domains/data-table/columns/constants.d.ts +2 -0
- package/dist/runtime/domains/data-table/columns/constants.js +1 -1
- package/dist/runtime/domains/data-table/columns/resolve-columns.d.ts +2 -1
- package/dist/runtime/domains/data-table/columns/resolve-columns.js +3 -2
- package/dist/runtime/domains/data-table/columns/resolve-data-column.d.ts +7 -2
- package/dist/runtime/domains/data-table/columns/resolve-data-column.js +10 -5
- package/dist/runtime/domains/data-table/columns/resolve-special-columns.js +14 -8
- package/dist/runtime/domains/data-table/components/ColumnSettings.d.vue.ts +20 -0
- package/dist/runtime/domains/data-table/components/ColumnSettings.vue +63 -0
- package/dist/runtime/domains/data-table/components/ColumnSettings.vue.d.ts +20 -0
- package/dist/runtime/domains/data-table/components/Pagination.d.vue.ts +2 -8
- package/dist/runtime/domains/data-table/components/Pagination.vue +34 -36
- package/dist/runtime/domains/data-table/components/Pagination.vue.d.ts +2 -8
- package/dist/runtime/domains/data-table/export.d.ts +23 -0
- package/dist/runtime/domains/data-table/export.js +43 -0
- package/dist/runtime/domains/data-table/load-more.d.ts +8 -0
- package/dist/runtime/domains/data-table/load-more.js +14 -0
- package/dist/runtime/domains/data-table/pagination.d.ts +29 -0
- package/dist/runtime/domains/data-table/pagination.js +42 -0
- package/dist/runtime/domains/data-table/persist.d.ts +12 -0
- package/dist/runtime/domains/data-table/persist.js +41 -0
- package/dist/runtime/domains/data-table/state/keys.d.ts +11 -0
- package/dist/runtime/domains/data-table/state/keys.js +44 -0
- package/dist/runtime/domains/data-table/state/models.d.ts +5 -0
- package/dist/runtime/domains/data-table/state/models.js +38 -0
- package/dist/runtime/domains/data-table/tree-layout.d.ts +13 -0
- package/dist/runtime/domains/data-table/tree-layout.js +30 -0
- package/dist/runtime/domains/theme/theme-color.d.ts +3 -0
- package/dist/runtime/domains/theme/theme-color.js +16 -0
- package/dist/runtime/domains/theme/theme-fouc.d.ts +5 -0
- package/dist/runtime/domains/theme/theme-fouc.js +43 -0
- package/dist/runtime/domains/tree/components/TreeToolbar.d.vue.ts +7 -5
- package/dist/runtime/domains/tree/components/TreeToolbar.vue +6 -4
- package/dist/runtime/domains/tree/components/TreeToolbar.vue.d.ts +7 -5
- package/dist/runtime/domains/tree/tree-disabled.d.ts +5 -0
- package/dist/runtime/domains/tree/tree-disabled.js +15 -0
- package/dist/runtime/domains/tree/tree-lazy.d.ts +8 -0
- package/dist/runtime/domains/tree/tree-lazy.js +19 -1
- package/dist/runtime/domains/tree/tree-search.d.ts +3 -1
- package/dist/runtime/domains/tree/tree-search.js +4 -0
- package/dist/runtime/domains/tree/useTreeLazy.d.ts +22 -0
- package/dist/runtime/domains/tree/useTreeLazy.js +57 -0
- package/dist/runtime/domains/tree/useTreeSearch.d.ts +27 -0
- package/dist/runtime/domains/tree/useTreeSearch.js +59 -0
- package/dist/runtime/domains/tree/useTreeSelection.d.ts +31 -0
- package/dist/runtime/domains/tree/useTreeSelection.js +89 -0
- package/dist/runtime/domains/zod/apply.d.ts +23 -0
- package/dist/runtime/domains/zod/apply.js +26 -0
- package/dist/runtime/domains/zod/error-map.d.ts +13 -0
- package/dist/runtime/domains/zod/error-map.js +19 -0
- package/dist/runtime/domains/zod/locale-map.d.ts +5 -0
- package/dist/runtime/domains/zod/locale-map.js +17 -0
- package/dist/runtime/domains/zod/sync.d.ts +12 -0
- package/dist/runtime/domains/zod/sync.js +30 -0
- package/dist/runtime/locale/en.d.ts +74 -0
- package/dist/runtime/locale/en.js +73 -0
- package/dist/runtime/locale/index.d.ts +8 -0
- package/dist/runtime/locale/index.js +15 -0
- package/dist/runtime/locale/zh_cn.d.ts +74 -0
- package/dist/runtime/locale/zh_cn.js +73 -0
- package/dist/runtime/plugins/api.factory.js +5 -22
- package/dist/runtime/plugins/theme.js +4 -42
- package/dist/runtime/plugins/zod.d.ts +2 -0
- package/dist/runtime/plugins/zod.js +16 -0
- package/dist/runtime/types/api/config.d.ts +12 -0
- package/dist/runtime/types/api/fetch.d.ts +3 -16
- package/dist/runtime/types/api/index.d.ts +1 -1
- package/dist/runtime/types/api/response.d.ts +33 -19
- package/dist/runtime/types/api/stream.d.ts +2 -3
- package/dist/runtime/types/api/transfer.d.ts +3 -7
- package/dist/runtime/types/auto-form/base.d.ts +9 -1
- package/dist/runtime/types/auto-form/component.d.ts +31 -3
- package/dist/runtime/types/auto-form/fields.d.ts +15 -1
- package/dist/runtime/types/auto-form/index.d.ts +3 -3
- package/dist/runtime/types/auto-form/search-form.d.ts +26 -12
- package/dist/runtime/types/auto-form/zod-factory.d.ts +2 -2
- package/dist/runtime/types/components/date-picker.d.ts +14 -3
- package/dist/runtime/types/components/index.d.ts +1 -6
- package/dist/runtime/types/components/message-box.d.ts +5 -18
- package/dist/runtime/types/components/tree.d.ts +17 -14
- package/dist/runtime/types/data-table/columns.d.ts +6 -14
- package/dist/runtime/types/data-table/component.d.ts +42 -1
- package/dist/runtime/types/data-table/index.d.ts +1 -1
- package/dist/runtime/types/data-table/pagination.d.ts +7 -8
- package/dist/runtime/types/index.d.ts +2 -0
- package/dist/runtime/types/locale.d.ts +82 -0
- package/dist/runtime/types/shared.d.ts +13 -0
- package/dist/runtime/types/zod-config.d.ts +38 -0
- package/dist/runtime/types/zod.d.ts +9 -1
- package/dist/runtime/utils/date/convert.d.ts +29 -0
- package/dist/runtime/utils/date/convert.js +93 -0
- package/dist/runtime/utils/date/guards.d.ts +10 -0
- package/dist/runtime/utils/date/guards.js +18 -0
- package/dist/runtime/utils/extend-theme.js +2 -1
- package/dist/runtime/utils/form-control.d.ts +0 -12
- package/dist/runtime/utils/form-control.js +3 -39
- package/dist/runtime/utils/interpolate.d.ts +2 -0
- package/dist/runtime/utils/interpolate.js +4 -0
- package/dist/runtime/utils/theme-defaults.d.ts +10 -0
- package/dist/runtime/utils/theme-defaults.js +9 -0
- package/dist/runtime/utils/tree-selection.d.ts +2 -15
- package/dist/runtime/utils/tv.d.ts +1 -1
- package/dist/runtime/vue/plugins/zod.d.ts +7 -0
- package/dist/runtime/vue/plugins/zod.js +12 -0
- package/dist/shared/{nuxt.DfVF6ZZv.mjs → nuxt.CbmfnBRt.mjs} +82 -236
- package/dist/unplugin.d.mts +3 -2
- package/dist/unplugin.mjs +22 -22
- package/dist/vite.d.mts +1 -0
- package/dist/vite.mjs +2 -1
- package/package.json +39 -34
- package/vue-plugin.d.ts +7 -1
- package/dist/runtime/components/ColorChooser.d.vue.ts +0 -36
- package/dist/runtime/components/ColorChooser.vue +0 -328
- package/dist/runtime/components/ColorChooser.vue.d.ts +0 -36
- package/dist/runtime/components/PillGroup.d.vue.ts +0 -33
- package/dist/runtime/components/PillGroup.vue +0 -291
- package/dist/runtime/components/PillGroup.vue.d.ts +0 -33
- package/dist/runtime/components/Popconfirm.d.vue.ts +0 -30
- package/dist/runtime/components/Popconfirm.vue +0 -143
- package/dist/runtime/components/Popconfirm.vue.d.ts +0 -30
- package/dist/runtime/components/SlideVerify.d.vue.ts +0 -41
- package/dist/runtime/components/SlideVerify.vue +0 -174
- package/dist/runtime/components/SlideVerify.vue.d.ts +0 -41
- package/dist/runtime/components/input/AsPhoneNumberInput.d.vue.ts +0 -32
- package/dist/runtime/components/input/AsPhoneNumberInput.vue +0 -48
- package/dist/runtime/components/input/AsPhoneNumberInput.vue.d.ts +0 -32
- package/dist/runtime/components/input/WithCharacterLimit.d.vue.ts +0 -32
- package/dist/runtime/components/input/WithCharacterLimit.vue +0 -54
- package/dist/runtime/components/input/WithCharacterLimit.vue.d.ts +0 -32
- package/dist/runtime/components/input/WithClear.d.vue.ts +0 -33
- package/dist/runtime/components/input/WithClear.vue +0 -60
- package/dist/runtime/components/input/WithClear.vue.d.ts +0 -33
- package/dist/runtime/components/input/WithCopy.d.vue.ts +0 -33
- package/dist/runtime/components/input/WithCopy.vue +0 -66
- package/dist/runtime/components/input/WithCopy.vue.d.ts +0 -33
- package/dist/runtime/components/input/WithFloatingLabel.d.vue.ts +0 -33
- package/dist/runtime/components/input/WithFloatingLabel.vue +0 -75
- package/dist/runtime/components/input/WithFloatingLabel.vue.d.ts +0 -33
- package/dist/runtime/components/input/WithPasswordToggle.d.vue.ts +0 -32
- package/dist/runtime/components/input/WithPasswordToggle.vue +0 -61
- package/dist/runtime/components/input/WithPasswordToggle.vue.d.ts +0 -32
- package/dist/runtime/domains/api/interceptors/compose.d.ts +0 -24
- package/dist/runtime/domains/api/interceptors/compose.js +0 -18
- package/dist/runtime/domains/api/interceptors/error.d.ts +0 -13
- package/dist/runtime/domains/api/interceptors/error.js +0 -26
- package/dist/runtime/domains/api/interceptors/unauthorized.d.ts +0 -12
- package/dist/runtime/domains/api/interceptors/unauthorized.js +0 -34
- package/dist/runtime/domains/api/transfer.d.ts +0 -69
- package/dist/runtime/domains/api/transfer.js +0 -87
- package/dist/runtime/types/components/color-chooser.d.ts +0 -109
- package/dist/runtime/types/components/input/as-phone-number-input.d.ts +0 -17
- package/dist/runtime/types/components/input/index.d.ts +0 -6
- package/dist/runtime/types/components/input/index.js +0 -0
- package/dist/runtime/types/components/input/with-character-limit.d.ts +0 -11
- package/dist/runtime/types/components/input/with-character-limit.js +0 -0
- package/dist/runtime/types/components/input/with-clear.d.ts +0 -10
- package/dist/runtime/types/components/input/with-clear.js +0 -0
- package/dist/runtime/types/components/input/with-copy.d.ts +0 -11
- package/dist/runtime/types/components/input/with-copy.js +0 -0
- package/dist/runtime/types/components/input/with-floating-label.d.ts +0 -12
- package/dist/runtime/types/components/input/with-floating-label.js +0 -0
- package/dist/runtime/types/components/input/with-password-toggle.d.ts +0 -7
- package/dist/runtime/types/components/input/with-password-toggle.js +0 -0
- package/dist/runtime/types/components/pill-group.d.ts +0 -103
- package/dist/runtime/types/components/pill-group.js +0 -0
- package/dist/runtime/types/components/popconfirm.d.ts +0 -74
- package/dist/runtime/types/components/popconfirm.js +0 -0
- package/dist/runtime/types/components/slide-verify.d.ts +0 -54
- package/dist/runtime/types/components/slide-verify.js +0 -0
- /package/dist/runtime/types/{components/color-chooser.js → locale.js} +0 -0
- /package/dist/runtime/types/{components/input/as-phone-number-input.js → zod-config.js} +0 -0
|
@@ -1,25 +1,48 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { getPaginationRowModel } from "@tanstack/vue-table";
|
|
3
|
-
import { UTable } from "#components";
|
|
3
|
+
import { USkeleton, UTable } from "#components";
|
|
4
4
|
import { useAppConfig } from "#imports";
|
|
5
|
-
import { computed,
|
|
5
|
+
import { computed, ref, toRaw, useAttrs, useTemplateRef, watch } from "vue";
|
|
6
6
|
import { useResizeObserver, useScroll } from "@vueuse/core";
|
|
7
7
|
import { useExtendedTv } from "../utils/extend-theme";
|
|
8
|
+
import { useMovkLocale } from "../composables/useMovkLocale";
|
|
8
9
|
import { resolveColumns } from "../domains/data-table/columns/resolve-columns";
|
|
10
|
+
import {
|
|
11
|
+
areSameKeys,
|
|
12
|
+
hasEntries,
|
|
13
|
+
keysToExpanded,
|
|
14
|
+
keysToRowSelection,
|
|
15
|
+
keysToVisibility,
|
|
16
|
+
keysToVisibilityExclude,
|
|
17
|
+
rowSelectionToKeys,
|
|
18
|
+
expandedToKeys,
|
|
19
|
+
visibilityToExcludeKeys,
|
|
20
|
+
visibilityToKeys
|
|
21
|
+
} from "../domains/data-table/state/keys";
|
|
22
|
+
import { useEffectiveModel, useSyncKeys } from "../domains/data-table/state/models";
|
|
23
|
+
import { buildPaginationView } from "../domains/data-table/pagination";
|
|
24
|
+
import { useExpandColumnAutoSize } from "../domains/data-table/tree-layout";
|
|
25
|
+
import { runLoadMore } from "../domains/data-table/load-more";
|
|
26
|
+
import { useTablePersistence } from "../domains/data-table/persist";
|
|
27
|
+
import { downloadCsv, resolveCsvColumns } from "../domains/data-table/export";
|
|
28
|
+
import ColumnSettings from "../domains/data-table/components/ColumnSettings.vue";
|
|
9
29
|
import { resolveCallbackValue } from "../domains/data-table/columns/utils";
|
|
10
30
|
import { computeTreeSelection } from "../utils/tree-selection";
|
|
11
31
|
import { resolveDefaultExpandedKeys } from "../utils/tree-expand";
|
|
12
|
-
import {
|
|
13
|
-
import { Tree, useInfiniteScrollBinding, separate } from "@movk/core";
|
|
32
|
+
import { useInfiniteScrollBinding, separate } from "@movk/core";
|
|
14
33
|
import theme from "#build/movk-ui/data-table";
|
|
15
34
|
import tableTheme from "#build/ui/table";
|
|
16
35
|
import DataTablePagination from "../domains/data-table/components/Pagination.vue";
|
|
17
36
|
const HEADER_SLOT_SUFFIX = "-header";
|
|
18
|
-
const PAGINATION_SLOTS = ["pagination", "pagination-summary", "pagination-actions"];
|
|
37
|
+
const PAGINATION_SLOTS = ["pagination", "pagination-summary", "pagination-actions", "toolbar"];
|
|
19
38
|
const props = defineProps({
|
|
20
39
|
rowKey: { type: [String, Object], required: false },
|
|
21
40
|
columns: { type: Array, required: false },
|
|
22
41
|
loading: { type: Boolean, required: false },
|
|
42
|
+
skeletonRows: { type: Number, required: false, default: 5 },
|
|
43
|
+
columnSettings: { type: Boolean, required: false },
|
|
44
|
+
persistKey: { type: String, required: false },
|
|
45
|
+
serverCsvExport: { type: Function, required: false },
|
|
23
46
|
stripe: { type: Boolean, required: false },
|
|
24
47
|
bordered: { type: [Boolean, Object], required: false },
|
|
25
48
|
fitContent: { type: Boolean, required: false },
|
|
@@ -38,7 +61,7 @@ const props = defineProps({
|
|
|
38
61
|
rowClass: { type: [String, Function], required: false },
|
|
39
62
|
rowStyle: { type: [String, Object, Function], required: false },
|
|
40
63
|
tooltip: { type: [Boolean, Number, Function], required: false },
|
|
41
|
-
tooltipProps: { type:
|
|
64
|
+
tooltipProps: { type: Object, required: false },
|
|
42
65
|
truncate: { type: [Boolean, Number, Function], required: false, default: true },
|
|
43
66
|
sortingOptions: { type: Object, required: false },
|
|
44
67
|
columnSizingOptions: { type: Object, required: false },
|
|
@@ -61,8 +84,9 @@ const props = defineProps({
|
|
|
61
84
|
sticky: { type: [Boolean, String], required: false, default: true },
|
|
62
85
|
paginationUi: { type: Object, required: false },
|
|
63
86
|
loadMore: { type: Function, required: false },
|
|
64
|
-
|
|
65
|
-
|
|
87
|
+
onLoadMoreError: { type: Function, required: false },
|
|
88
|
+
canLoadMore: { type: Boolean, required: false, default: true },
|
|
89
|
+
loadMoreDistance: { type: Number, required: false, default: 100 },
|
|
66
90
|
class: { type: [Array, String, null, Number, Boolean], required: false, skipCheck: true },
|
|
67
91
|
ui: { type: Object, required: false }
|
|
68
92
|
});
|
|
@@ -73,6 +97,7 @@ const columnSizingState = defineModel("columnSizing", { type: Object });
|
|
|
73
97
|
const rowSelectionState = defineModel("rowSelection", { type: Object });
|
|
74
98
|
const rowPinningState = defineModel("rowPinning", { type: Object, ...{ default: () => ({ top: [], bottom: [] }) } });
|
|
75
99
|
const sortingState = defineModel("sorting", { type: Array, ...{ default: () => [] } });
|
|
100
|
+
const columnOrderState = defineModel("columnOrder", { type: Array });
|
|
76
101
|
const expandedState = defineModel("expanded", { type: [Boolean, Object] });
|
|
77
102
|
const columnVisibilityKeysState = defineModel("columnVisibilityKeys", { type: Array });
|
|
78
103
|
const columnVisibilityExcludeKeysState = defineModel("columnVisibilityExcludeKeys", { type: Array });
|
|
@@ -83,92 +108,13 @@ const slotRecord = slots;
|
|
|
83
108
|
const headerSlots = Object.fromEntries(
|
|
84
109
|
Object.keys(slots).filter((name) => name.endsWith(HEADER_SLOT_SUFFIX)).map((name) => [name, (ctx) => slotRecord[name]?.(ctx) ?? []])
|
|
85
110
|
);
|
|
86
|
-
const
|
|
111
|
+
const { t } = useMovkLocale();
|
|
112
|
+
const resolved = computed(() => resolveColumns(props.columns || [], props, t, headerSlots));
|
|
87
113
|
const forwardSlots = computed(() => Object.keys(slots).filter((name) => {
|
|
88
114
|
if (PAGINATION_SLOTS.includes(name)) return false;
|
|
89
115
|
if (!name.endsWith(HEADER_SLOT_SUFFIX)) return true;
|
|
90
116
|
return !resolved.value.allColumnIds.includes(name.slice(0, -HEADER_SLOT_SUFFIX.length));
|
|
91
117
|
}));
|
|
92
|
-
function hasEntries(v) {
|
|
93
|
-
return typeof v === "object" && v !== null && Object.keys(v).length > 0;
|
|
94
|
-
}
|
|
95
|
-
function keysToVisibility(keys, allColumnIds) {
|
|
96
|
-
const set = new Set(keys);
|
|
97
|
-
const state = {};
|
|
98
|
-
for (const id of allColumnIds) state[id] = set.has(id);
|
|
99
|
-
return state;
|
|
100
|
-
}
|
|
101
|
-
function visibilityToKeys(state, allColumnIds) {
|
|
102
|
-
return allColumnIds.filter((id) => state[id] !== false);
|
|
103
|
-
}
|
|
104
|
-
function keysToVisibilityExclude(excludeKeys, allColumnIds) {
|
|
105
|
-
const set = new Set(excludeKeys);
|
|
106
|
-
const state = {};
|
|
107
|
-
for (const id of allColumnIds) state[id] = !set.has(id);
|
|
108
|
-
return state;
|
|
109
|
-
}
|
|
110
|
-
function visibilityToExcludeKeys(state, allColumnIds) {
|
|
111
|
-
return allColumnIds.filter((id) => state[id] === false);
|
|
112
|
-
}
|
|
113
|
-
function keysToRowSelection(keys) {
|
|
114
|
-
const state = {};
|
|
115
|
-
for (const key of keys) state[key] = true;
|
|
116
|
-
return state;
|
|
117
|
-
}
|
|
118
|
-
function rowSelectionToKeys(state) {
|
|
119
|
-
return Object.entries(state).filter(([, s]) => s).map(([k]) => k);
|
|
120
|
-
}
|
|
121
|
-
function keysToExpanded(keys) {
|
|
122
|
-
const state = {};
|
|
123
|
-
for (const key of keys) state[key] = true;
|
|
124
|
-
return state;
|
|
125
|
-
}
|
|
126
|
-
function expandedToKeys(state) {
|
|
127
|
-
if (state === true) return [];
|
|
128
|
-
return Object.entries(state).filter(([, e]) => e).map(([k]) => k);
|
|
129
|
-
}
|
|
130
|
-
function areSameKeys(a, b) {
|
|
131
|
-
if (a.length !== b.length) return false;
|
|
132
|
-
const set = new Set(a.map(String));
|
|
133
|
-
for (const key of b) if (!set.has(String(key))) return false;
|
|
134
|
-
return true;
|
|
135
|
-
}
|
|
136
|
-
function useEffectiveModel(model, getDefault, syncBack, isUnset = (value) => value === void 0) {
|
|
137
|
-
const effective = computed({
|
|
138
|
-
get: () => isUnset(model.value) ? getDefault() : model.value,
|
|
139
|
-
set: (value) => {
|
|
140
|
-
model.value = value;
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
if (syncBack !== void 0) {
|
|
144
|
-
onMounted(() => {
|
|
145
|
-
if (!isUnset(model.value)) return;
|
|
146
|
-
const defaults = getDefault();
|
|
147
|
-
if (syncBack(defaults)) model.value = defaults;
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
return effective;
|
|
151
|
-
}
|
|
152
|
-
function useSyncKeys(keys, record, toRecord, toKeys) {
|
|
153
|
-
let updating = false;
|
|
154
|
-
watch(keys, (next) => {
|
|
155
|
-
if (updating) return;
|
|
156
|
-
const current = record.value !== void 0 ? toKeys(record.value) : [];
|
|
157
|
-
if (areSameKeys(current, next ?? [])) return;
|
|
158
|
-
updating = true;
|
|
159
|
-
record.value = toRecord(next ?? []);
|
|
160
|
-
updating = false;
|
|
161
|
-
}, { deep: true });
|
|
162
|
-
watch(record, (next) => {
|
|
163
|
-
if (updating) return;
|
|
164
|
-
if (next === void 0) return;
|
|
165
|
-
const derived = toKeys(next);
|
|
166
|
-
if (areSameKeys(derived, keys.value ?? [])) return;
|
|
167
|
-
updating = true;
|
|
168
|
-
keys.value = derived;
|
|
169
|
-
updating = false;
|
|
170
|
-
}, { deep: true });
|
|
171
|
-
}
|
|
172
118
|
const effectiveVisibility = useEffectiveModel(
|
|
173
119
|
columnVisibilityState,
|
|
174
120
|
() => {
|
|
@@ -195,6 +141,7 @@ const effectiveSizing = useEffectiveModel(
|
|
|
195
141
|
() => ({ ...resolved.value.initialSizing }),
|
|
196
142
|
hasEntries
|
|
197
143
|
);
|
|
144
|
+
const effectiveColumnOrder = useEffectiveModel(columnOrderState, () => []);
|
|
198
145
|
const effectiveRowSelection = useEffectiveModel(
|
|
199
146
|
rowSelectionState,
|
|
200
147
|
() => rowSelectionKeysState.value !== void 0 ? keysToRowSelection(rowSelectionKeysState.value) : {},
|
|
@@ -218,6 +165,14 @@ const effectiveExpanded = useEffectiveModel(
|
|
|
218
165
|
// 运行时 Vue 把未绑定的布尔型 expanded 模型降级为 false,类型层不体现,故断言比较
|
|
219
166
|
(value) => value === void 0 || value === false
|
|
220
167
|
);
|
|
168
|
+
watch(() => resolved.value.allColumnIds, (ids, previous) => {
|
|
169
|
+
if (!previous || areSameKeys(ids, previous)) return;
|
|
170
|
+
if (columnVisibilityKeysState.value !== void 0) {
|
|
171
|
+
columnVisibilityState.value = keysToVisibility(columnVisibilityKeysState.value, ids);
|
|
172
|
+
} else if (columnVisibilityExcludeKeysState.value !== void 0) {
|
|
173
|
+
columnVisibilityState.value = keysToVisibilityExclude(columnVisibilityExcludeKeysState.value, ids);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
221
176
|
useSyncKeys(
|
|
222
177
|
columnVisibilityKeysState,
|
|
223
178
|
columnVisibilityState,
|
|
@@ -252,22 +207,18 @@ const pinStart = computed(() => !arrivedState.left);
|
|
|
252
207
|
const pinEnd = computed(() => !arrivedState.right);
|
|
253
208
|
useResizeObserver(scrollTarget, () => measure());
|
|
254
209
|
const internalLoading = ref(false);
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
} finally {
|
|
263
|
-
internalLoading.value = false;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
210
|
+
function invokeLoadMore() {
|
|
211
|
+
return runLoadMore(props.loadMore, {
|
|
212
|
+
setLoading: (value) => {
|
|
213
|
+
internalLoading.value = value;
|
|
214
|
+
},
|
|
215
|
+
onError: props.onLoadMoreError
|
|
216
|
+
});
|
|
266
217
|
}
|
|
267
218
|
useInfiniteScrollBinding(
|
|
268
219
|
() => tableRef.value?.$el ?? null,
|
|
269
220
|
{
|
|
270
|
-
distance: () => props.loadMoreDistance
|
|
221
|
+
distance: () => props.loadMoreDistance,
|
|
271
222
|
canLoadMore: () => !!props.loadMore && props.canLoadMore !== false && !internalLoading.value,
|
|
272
223
|
onLoadMore: invokeLoadMore
|
|
273
224
|
}
|
|
@@ -278,31 +229,13 @@ function scrollToTop(options = { top: 0, behavior: "smooth" }) {
|
|
|
278
229
|
const tableApi = computed(() => tableRef.value?.tableApi ?? null);
|
|
279
230
|
const isColumnResizing = computed(() => Boolean(tableApi.value?.getState().columnSizingInfo.isResizingColumn));
|
|
280
231
|
const isTreeMode = computed(() => Boolean(props.childrenKey));
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
const EXPAND_DEFAULT_SIZE = 60;
|
|
288
|
-
const EXPAND_BUTTON_SLOT = 60;
|
|
289
|
-
const expandColumnSize = computed(() => {
|
|
290
|
-
if (!isTreeMode.value || !resolved.value.hasExpandColumn) return null;
|
|
291
|
-
const maxButtonDepth = Math.max(0, treeMaxDepth.value - 1);
|
|
292
|
-
if (maxButtonDepth === 0) return null;
|
|
293
|
-
const indentPx = resolveMaxIndentPx(props.indentSize, maxButtonDepth);
|
|
294
|
-
return Math.max(EXPAND_DEFAULT_SIZE, EXPAND_BUTTON_SLOT + indentPx * 2);
|
|
232
|
+
useExpandColumnAutoSize({
|
|
233
|
+
data: () => attrs.data ?? [],
|
|
234
|
+
childrenKey: () => props.childrenKey,
|
|
235
|
+
hasExpandColumn: () => resolved.value.hasExpandColumn,
|
|
236
|
+
indentSize: () => props.indentSize,
|
|
237
|
+
sizing: effectiveSizing
|
|
295
238
|
});
|
|
296
|
-
let autoExpandSize = null;
|
|
297
|
-
watch(expandColumnSize, (target) => {
|
|
298
|
-
if (target == null) return;
|
|
299
|
-
const state = effectiveSizing.value;
|
|
300
|
-
const current = state.__expand;
|
|
301
|
-
const canOverride = current == null || current === EXPAND_DEFAULT_SIZE || current === autoExpandSize;
|
|
302
|
-
if (!canOverride || current === target) return;
|
|
303
|
-
effectiveSizing.value = { ...state, __expand: target };
|
|
304
|
-
autoExpandSize = target;
|
|
305
|
-
}, { immediate: true });
|
|
306
239
|
const isManualPagination = computed(() => props.paginationOptions?.manualPagination === true);
|
|
307
240
|
const hasPaginationIntent = computed(
|
|
308
241
|
() => !props.loadMore && (props.paginationOptions !== void 0 || paginationState.value !== void 0 || (props.paginationUi?.pageSizes?.length ?? 0) > 0 || props.paginationUi?.show === true)
|
|
@@ -416,55 +349,17 @@ const uTableProps = computed(() => {
|
|
|
416
349
|
...props.onRowContextmenu && { onContextmenu: props.onRowContextmenu }
|
|
417
350
|
};
|
|
418
351
|
});
|
|
419
|
-
const selectedCount = computed(() =>
|
|
420
|
-
if (rowSelectionKeysState.value !== void 0) return rowSelectionKeysState.value.length;
|
|
421
|
-
return Object.keys(rowSelectionState.value ?? {}).length;
|
|
422
|
-
});
|
|
352
|
+
const selectedCount = computed(() => rowSelectionToKeys(effectiveRowSelection.value).length);
|
|
423
353
|
const paginationView = computed(() => {
|
|
424
354
|
const api = tableApi.value;
|
|
425
355
|
if (!api || !hasPaginationIntent.value) return null;
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
const currentPageRowCount = api.getRowModel().rows.length;
|
|
434
|
-
const fallbackManualPageCount = explicitRowCount !== void 0 ? Math.ceil(Math.max(0, explicitRowCount) / pageSize) : api.getPageCount();
|
|
435
|
-
const pageCount = manual ? Math.max(0, explicitPageCount ?? fallbackManualPageCount) : api.getPageCount();
|
|
436
|
-
const rowCount = rowCountKnown ? manual ? Math.max(0, explicitRowCount) : api.getRowCount() : 0;
|
|
437
|
-
const referenceCount = rowCountKnown ? rowCount : pageCount * pageSize;
|
|
438
|
-
const from = referenceCount > 0 && currentPageRowCount > 0 ? pageIndex * pageSize + 1 : 0;
|
|
439
|
-
const to = referenceCount > 0 && currentPageRowCount > 0 ? Math.min(referenceCount, from + currentPageRowCount - 1) : 0;
|
|
440
|
-
const show = props.paginationUi?.show ?? (pageCount > 1 || (props.paginationUi?.pageSizes?.length ?? 0) > 1);
|
|
441
|
-
const setPage = (value) => {
|
|
442
|
-
const nextPage = Math.floor(Number(value));
|
|
443
|
-
if (!Number.isFinite(nextPage) || nextPage < 1) return;
|
|
444
|
-
const maxPage = Math.max(1, pageCount);
|
|
445
|
-
const nextIndex = Math.min(maxPage, nextPage) - 1;
|
|
446
|
-
api.setPagination((prev) => ({ ...prev, pageIndex: nextIndex }));
|
|
447
|
-
};
|
|
448
|
-
const setPageSize = (value) => {
|
|
449
|
-
if (value === "" || value == null) return;
|
|
450
|
-
const nextPageSize = Math.floor(Number(value));
|
|
451
|
-
if (!Number.isFinite(nextPageSize) || nextPageSize <= 0) return;
|
|
452
|
-
api.setPagination((prev) => ({ ...prev, pageSize: nextPageSize }));
|
|
453
|
-
};
|
|
454
|
-
return {
|
|
455
|
-
tableApi: api,
|
|
456
|
-
pagination: { pageIndex, pageSize },
|
|
457
|
-
page: pageIndex + 1,
|
|
458
|
-
rowCount,
|
|
459
|
-
rowCountKnown,
|
|
460
|
-
pageCount,
|
|
461
|
-
currentPageRowCount,
|
|
462
|
-
from,
|
|
463
|
-
to,
|
|
464
|
-
show,
|
|
465
|
-
setPage,
|
|
466
|
-
setPageSize
|
|
467
|
-
};
|
|
356
|
+
return buildPaginationView(api, {
|
|
357
|
+
manual: isManualPagination.value,
|
|
358
|
+
rowCount: props.paginationOptions?.rowCount,
|
|
359
|
+
pageCount: props.paginationOptions?.pageCount,
|
|
360
|
+
show: props.paginationUi?.show,
|
|
361
|
+
pageSizes: props.paginationUi?.pageSizes
|
|
362
|
+
});
|
|
468
363
|
});
|
|
469
364
|
const paginationRendererProps = computed(() => {
|
|
470
365
|
const v = paginationView.value;
|
|
@@ -487,10 +382,11 @@ const showPagination = computed(() => paginationView.value?.show ?? false);
|
|
|
487
382
|
const treeSelection = computed(() => {
|
|
488
383
|
const data = attrs.data ?? [];
|
|
489
384
|
const keys = rowSelectionKeysState.value ?? Object.keys(effectiveRowSelection.value).filter((k) => effectiveRowSelection.value[k]);
|
|
490
|
-
const rowKey = props.rowKey
|
|
385
|
+
const rowKey = props.rowKey;
|
|
491
386
|
const childrenKey = props.childrenKey;
|
|
387
|
+
const rowIds = rowKey === void 0 ? new Map((tableApi.value?.getCoreRowModel().flatRows ?? []).map((row) => [toRaw(row.original), row.id])) : void 0;
|
|
492
388
|
return computeTreeSelection(data, keys, {
|
|
493
|
-
getKey: (row) => String(row[rowKey]),
|
|
389
|
+
getKey: (row) => rowIds ? rowIds.get(toRaw(row)) ?? "" : String(row[rowKey]),
|
|
494
390
|
getChildren: childrenKey ? (row) => row[childrenKey] : () => void 0,
|
|
495
391
|
strategy: resolved.value.selectionStrategy
|
|
496
392
|
});
|
|
@@ -511,6 +407,78 @@ function expandToDepth(depth) {
|
|
|
511
407
|
function collapseAll() {
|
|
512
408
|
effectiveExpanded.value = {};
|
|
513
409
|
}
|
|
410
|
+
function expandAll() {
|
|
411
|
+
effectiveExpanded.value = true;
|
|
412
|
+
}
|
|
413
|
+
function selectAll() {
|
|
414
|
+
const api = tableApi.value;
|
|
415
|
+
if (resolved.value.selectionMode === "single" || api?.options.enableMultiRowSelection === false) return;
|
|
416
|
+
api?.toggleAllRowsSelected(true);
|
|
417
|
+
}
|
|
418
|
+
function getSelectedRows() {
|
|
419
|
+
return tableApi.value?.getSelectedRowModel().flatRows.map((row) => row.original) ?? [];
|
|
420
|
+
}
|
|
421
|
+
const pageSize = computed({
|
|
422
|
+
get: () => paginationState.value?.pageSize,
|
|
423
|
+
set: (size) => {
|
|
424
|
+
if (size) paginationState.value = { pageIndex: 0, pageSize: size };
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
const persistence = useTablePersistence(() => props.persistKey, {
|
|
428
|
+
columnVisibility: effectiveVisibility,
|
|
429
|
+
columnOrder: effectiveColumnOrder,
|
|
430
|
+
columnSizing: effectiveSizing,
|
|
431
|
+
columnPinning: effectivePinning,
|
|
432
|
+
pageSize
|
|
433
|
+
});
|
|
434
|
+
function resetColumns() {
|
|
435
|
+
const { initialVisibility, initialPinning, initialSizing, allColumnIds } = resolved.value;
|
|
436
|
+
effectiveVisibility.value = columnVisibilityKeysState.value !== void 0 ? keysToVisibility(columnVisibilityKeysState.value, allColumnIds) : { ...initialVisibility };
|
|
437
|
+
effectiveColumnOrder.value = [];
|
|
438
|
+
effectiveSizing.value = { ...initialSizing };
|
|
439
|
+
effectivePinning.value = { left: [...initialPinning.left ?? []], right: [...initialPinning.right ?? []] };
|
|
440
|
+
persistence.clear();
|
|
441
|
+
}
|
|
442
|
+
function exportCsv(options) {
|
|
443
|
+
if (tableApi.value) downloadCsv(tableApi.value, options);
|
|
444
|
+
}
|
|
445
|
+
const exportServerCsv = async (options) => {
|
|
446
|
+
const api = tableApi.value;
|
|
447
|
+
if (!props.serverCsvExport || !api) throw new Error("DataTable server CSV export is not configured.");
|
|
448
|
+
const { sorting, columnFilters, globalFilter } = api.getState();
|
|
449
|
+
await props.serverCsvExport({
|
|
450
|
+
columns: resolveCsvColumns(api, options?.columns).map((column) => column.id),
|
|
451
|
+
filename: options?.filename,
|
|
452
|
+
sorting: sorting.map((sort) => ({ ...sort })),
|
|
453
|
+
columnFilters: columnFilters.map((filter) => ({ ...filter })),
|
|
454
|
+
globalFilter
|
|
455
|
+
});
|
|
456
|
+
};
|
|
457
|
+
const settingsItems = computed(() => {
|
|
458
|
+
const api = tableApi.value;
|
|
459
|
+
if (!api) return [];
|
|
460
|
+
void effectiveVisibility.value;
|
|
461
|
+
void effectiveColumnOrder.value;
|
|
462
|
+
return api.getAllLeafColumns().filter((column) => !column.id.startsWith("__")).map((column) => ({
|
|
463
|
+
id: column.id,
|
|
464
|
+
label: typeof column.columnDef.header === "string" ? column.columnDef.header : column.id,
|
|
465
|
+
visible: column.getIsVisible(),
|
|
466
|
+
hideable: column.getCanHide()
|
|
467
|
+
}));
|
|
468
|
+
});
|
|
469
|
+
function toggleColumn(id, visible) {
|
|
470
|
+
effectiveVisibility.value = { ...effectiveVisibility.value, [id]: visible };
|
|
471
|
+
}
|
|
472
|
+
function moveColumn(from, to) {
|
|
473
|
+
const ids = settingsItems.value.map((item) => item.id);
|
|
474
|
+
const [moved] = ids.splice(from, 1);
|
|
475
|
+
if (moved === void 0) return;
|
|
476
|
+
ids.splice(to, 0, moved);
|
|
477
|
+
const special = resolved.value.allColumnIds.filter((id) => id.startsWith("__"));
|
|
478
|
+
const leading = special.filter((id) => id !== "__actions");
|
|
479
|
+
effectiveColumnOrder.value = [...leading, ...ids, ...special.filter((id) => id === "__actions")];
|
|
480
|
+
}
|
|
481
|
+
const showToolbar = computed(() => props.columnSettings || !!slots.toolbar);
|
|
514
482
|
const tableResetKey = computed(() => {
|
|
515
483
|
const flags = [
|
|
516
484
|
!!props.resizable,
|
|
@@ -539,6 +507,12 @@ defineExpose({
|
|
|
539
507
|
clearSelection,
|
|
540
508
|
expandToDepth,
|
|
541
509
|
collapseAll,
|
|
510
|
+
expandAll,
|
|
511
|
+
selectAll,
|
|
512
|
+
getSelectedRows,
|
|
513
|
+
resetColumns,
|
|
514
|
+
exportCsv,
|
|
515
|
+
exportServerCsv,
|
|
542
516
|
get treeSelection() {
|
|
543
517
|
return treeSelection.value;
|
|
544
518
|
}
|
|
@@ -552,6 +526,18 @@ defineExpose({
|
|
|
552
526
|
:data-pin-start="pinStart || void 0"
|
|
553
527
|
:data-pin-end="pinEnd || void 0"
|
|
554
528
|
>
|
|
529
|
+
<div v-if="showToolbar" :class="extraUi.toolbar" data-slot="toolbar">
|
|
530
|
+
<slot name="toolbar" :table-api="tableApi" :reset-columns="resetColumns">
|
|
531
|
+
<ColumnSettings
|
|
532
|
+
v-if="props.columnSettings"
|
|
533
|
+
:items="settingsItems"
|
|
534
|
+
@toggle="toggleColumn"
|
|
535
|
+
@move="moveColumn"
|
|
536
|
+
@reset="resetColumns"
|
|
537
|
+
/>
|
|
538
|
+
</slot>
|
|
539
|
+
</div>
|
|
540
|
+
|
|
555
541
|
<UTable
|
|
556
542
|
:key="tableResetKey"
|
|
557
543
|
ref="tableRef"
|
|
@@ -563,14 +549,20 @@ defineExpose({
|
|
|
563
549
|
v-model:row-pinning="rowPinningState"
|
|
564
550
|
v-model:sorting="sortingState"
|
|
565
551
|
v-model:expanded="effectiveExpanded"
|
|
552
|
+
v-model:column-order="effectiveColumnOrder"
|
|
566
553
|
data-slot="table"
|
|
567
554
|
:style="borderedStyle"
|
|
568
555
|
v-bind="uTableProps"
|
|
569
556
|
>
|
|
570
|
-
<!-- 插槽名是联合类型,vue-tsc 会把作用域参数收敛成全部插槽 props 的交叉类型,转发时只能绕过 -->
|
|
571
557
|
<template v-for="name in forwardSlots" #[name]="slotProps" :key="name">
|
|
572
558
|
<slot :name="name" v-bind="slotProps ?? {}" />
|
|
573
559
|
</template>
|
|
560
|
+
|
|
561
|
+
<template v-if="!$slots.loading && props.skeletonRows > 0" #loading>
|
|
562
|
+
<div :class="extraUi.skeleton" data-slot="skeleton">
|
|
563
|
+
<USkeleton v-for="index in props.skeletonRows" :key="index" :class="extraUi.skeletonRow" />
|
|
564
|
+
</div>
|
|
565
|
+
</template>
|
|
574
566
|
</UTable>
|
|
575
567
|
|
|
576
568
|
<template v-if="showPagination && paginationView && paginationRendererProps">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ColumnPinningState, ColumnSizingState, ExpandedState, PaginationState, RowPinningState, RowSelectionState, SortingState, VisibilityState } from '@tanstack/vue-table';
|
|
1
|
+
import type { ColumnOrderState, ColumnPinningState, ColumnSizingState, ExpandedState, PaginationState, RowPinningState, RowSelectionState, SortingState, VisibilityState } from '@tanstack/vue-table';
|
|
2
2
|
import type { TableData } from '@nuxt/ui';
|
|
3
3
|
import type { DataTableExposed, DataTableProps, DataTableSlots } from '../types/data-table/component';
|
|
4
4
|
import type { DataTablePaginationUi } from '../types/data-table/pagination';
|
|
@@ -20,6 +20,7 @@ declare const __VLS_export: <T extends TableData>(__VLS_props: NonNullable<Await
|
|
|
20
20
|
rowSelection?: RowSelectionState;
|
|
21
21
|
rowPinning?: RowPinningState;
|
|
22
22
|
sorting?: SortingState;
|
|
23
|
+
columnOrder?: ColumnOrderState;
|
|
23
24
|
expanded?: ExpandedState;
|
|
24
25
|
columnVisibilityKeys?: string[];
|
|
25
26
|
columnVisibilityExcludeKeys?: string[];
|
|
@@ -33,6 +34,7 @@ declare const __VLS_export: <T extends TableData>(__VLS_props: NonNullable<Await
|
|
|
33
34
|
"onUpdate:rowSelection"?: ((value: RowSelectionState | undefined) => any) | undefined;
|
|
34
35
|
"onUpdate:rowPinning"?: ((value: RowPinningState) => any) | undefined;
|
|
35
36
|
"onUpdate:sorting"?: ((value: SortingState) => any) | undefined;
|
|
37
|
+
"onUpdate:columnOrder"?: ((value: ColumnOrderState | undefined) => any) | undefined;
|
|
36
38
|
"onUpdate:expanded"?: ((value: ExpandedState | undefined) => any) | undefined;
|
|
37
39
|
"onUpdate:columnVisibilityKeys"?: ((value: string[] | undefined) => any) | undefined;
|
|
38
40
|
"onUpdate:columnVisibilityExcludeKeys"?: ((value: string[] | undefined) => any) | undefined;
|
|
@@ -44,7 +46,7 @@ declare const __VLS_export: <T extends TableData>(__VLS_props: NonNullable<Await
|
|
|
44
46
|
expose: (exposed: import("vue").ShallowUnwrapRef<DataTableExposed<T>>) => void;
|
|
45
47
|
attrs: any;
|
|
46
48
|
slots: DataTableSlots<T>;
|
|
47
|
-
emit: ((event: "update:pagination", value: PaginationState | undefined) => void) & ((event: "update:columnVisibility", value: VisibilityState | undefined) => void) & ((event: "update:columnPinning", value: ColumnPinningState | undefined) => void) & ((event: "update:columnSizing", value: ColumnSizingState | undefined) => void) & ((event: "update:rowSelection", value: RowSelectionState | undefined) => void) & ((event: "update:rowPinning", value: RowPinningState) => void) & ((event: "update:sorting", value: SortingState) => void) & ((event: "update:expanded", value: ExpandedState | undefined) => void) & ((event: "update:columnVisibilityKeys", value: string[] | undefined) => void) & ((event: "update:columnVisibilityExcludeKeys", value: string[] | undefined) => void) & ((event: "update:rowSelectionKeys", value: string[] | undefined) => void) & ((event: "update:expandedKeys", value: string[] | undefined) => void);
|
|
49
|
+
emit: ((event: "update:pagination", value: PaginationState | undefined) => void) & ((event: "update:columnVisibility", value: VisibilityState | undefined) => void) & ((event: "update:columnPinning", value: ColumnPinningState | undefined) => void) & ((event: "update:columnSizing", value: ColumnSizingState | undefined) => void) & ((event: "update:rowSelection", value: RowSelectionState | undefined) => void) & ((event: "update:rowPinning", value: RowPinningState) => void) & ((event: "update:sorting", value: SortingState) => void) & ((event: "update:columnOrder", value: ColumnOrderState | undefined) => void) & ((event: "update:expanded", value: ExpandedState | undefined) => void) & ((event: "update:columnVisibilityKeys", value: string[] | undefined) => void) & ((event: "update:columnVisibilityExcludeKeys", value: string[] | undefined) => void) & ((event: "update:rowSelectionKeys", value: string[] | undefined) => void) & ((event: "update:expandedKeys", value: string[] | undefined) => void);
|
|
48
50
|
}>) => import("vue").VNode & {
|
|
49
51
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
50
52
|
};
|
|
@@ -4,26 +4,27 @@ import type { DateValue } from '@internationalized/date';
|
|
|
4
4
|
import type { ValueFormat } from '../composables/useDateFormatter';
|
|
5
5
|
import theme from '#build/movk-ui/date-picker';
|
|
6
6
|
import popoverTheme from '#build/ui/popover';
|
|
7
|
-
import type { DatePickerProps, DatePickerSlots, FormattedValue } from '../types/components/date-picker';
|
|
7
|
+
import type { DatePickerExposed, DatePickerProps, DatePickerSlots, FormattedValue } from '../types/components/date-picker';
|
|
8
8
|
declare const __VLS_export: <R extends boolean, M extends boolean, P extends "click" | "hover", V extends ValueFormat = "date-value">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
9
9
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<(DatePickerProps<R, M, P, V> & {
|
|
10
10
|
ui?: ComponentConfig<typeof popoverTheme & typeof theme, AppConfig, "datePicker">["slots"];
|
|
11
11
|
} & {
|
|
12
12
|
modelValue?: FormattedValue<R, M, V>;
|
|
13
|
+
open?: boolean | undefined;
|
|
13
14
|
}) & {
|
|
15
|
+
"onUpdate:open"?: ((value: boolean | undefined) => any) | undefined;
|
|
16
|
+
"onClose:prevent"?: (() => any) | undefined;
|
|
14
17
|
"onUpdate:modelValue"?: ((value: FormattedValue<R, M, V> | undefined) => any) | undefined;
|
|
15
18
|
"onUpdate:placeholder"?: ((date: DateValue) => any) | undefined;
|
|
16
19
|
"onUpdate:validModelValue"?: ((date: import("reka-ui").DateRange) => any) | undefined;
|
|
17
20
|
"onUpdate:startValue"?: ((date: DateValue | undefined) => any) | undefined;
|
|
18
|
-
"onClose:prevent"?: (() => any) | undefined;
|
|
19
|
-
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
20
21
|
}> & (typeof globalThis extends {
|
|
21
22
|
__VLS_PROPS_FALLBACK: infer P_1;
|
|
22
23
|
} ? P_1 : {});
|
|
23
|
-
expose: (exposed:
|
|
24
|
+
expose: (exposed: import("vue").ShallowUnwrapRef<DatePickerExposed>) => void;
|
|
24
25
|
attrs: any;
|
|
25
26
|
slots: DatePickerSlots<P>;
|
|
26
|
-
emit: (((evt: "update:modelValue", value: FormattedValue<R, M, V>) => void) & ((evt: "update:placeholder", date: DateValue) => void) & ((evt: "update:validModelValue", date: import("reka-ui").DateRange) => void) & ((evt: "update:startValue", date: DateValue | undefined) => void) & ((
|
|
27
|
+
emit: (((evt: "close:prevent") => void) & ((evt: "update:modelValue", value: FormattedValue<R, M, V>) => void) & ((evt: "update:placeholder", date: DateValue) => void) & ((evt: "update:validModelValue", date: import("reka-ui").DateRange) => void) & ((evt: "update:startValue", date: DateValue | undefined) => void)) & (((event: "update:open", value: boolean | undefined) => void) & ((event: "update:modelValue", value: FormattedValue<R, M, V> | undefined) => void));
|
|
27
28
|
}>) => import("vue").VNode & {
|
|
28
29
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
29
30
|
};
|