@movk/nuxt 1.1.2 → 1.3.0
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/.nuxt/movk-ui.css +3 -0
- package/README.md +75 -104
- package/dist/module.d.mts +59 -1
- package/dist/module.json +2 -2
- package/dist/module.mjs +136 -56
- package/dist/runtime/components/AutoForm.d.vue.ts +10 -31
- package/dist/runtime/components/AutoForm.vue +114 -148
- package/dist/runtime/components/AutoForm.vue.d.ts +10 -31
- package/dist/runtime/components/ColorChooser.d.vue.ts +20 -17
- package/dist/runtime/components/ColorChooser.vue +305 -31
- package/dist/runtime/components/ColorChooser.vue.d.ts +20 -17
- package/dist/runtime/components/DataTable.d.vue.ts +57 -0
- package/dist/runtime/components/DataTable.vue +584 -0
- package/dist/runtime/components/DataTable.vue.d.ts +57 -0
- package/dist/runtime/components/DatePicker.d.vue.ts +15 -22
- package/dist/runtime/components/DatePicker.vue +173 -65
- package/dist/runtime/components/DatePicker.vue.d.ts +15 -22
- package/dist/runtime/components/MessageBox.d.vue.ts +36 -0
- package/dist/runtime/components/MessageBox.vue +113 -0
- package/dist/runtime/components/MessageBox.vue.d.ts +36 -0
- package/dist/runtime/components/PillGroup.d.vue.ts +33 -0
- package/dist/runtime/components/PillGroup.vue +291 -0
- package/dist/runtime/components/PillGroup.vue.d.ts +33 -0
- package/dist/runtime/components/Popconfirm.d.vue.ts +30 -0
- package/dist/runtime/components/Popconfirm.vue +143 -0
- package/dist/runtime/components/Popconfirm.vue.d.ts +30 -0
- package/dist/runtime/components/SearchForm.d.vue.ts +43 -0
- package/dist/runtime/components/SearchForm.vue +274 -0
- package/dist/runtime/components/SearchForm.vue.d.ts +43 -0
- package/dist/runtime/components/SlideVerify.d.vue.ts +13 -79
- package/dist/runtime/components/SlideVerify.vue +117 -90
- package/dist/runtime/components/SlideVerify.vue.d.ts +13 -79
- package/dist/runtime/components/StarRating.d.vue.ts +25 -82
- package/dist/runtime/components/StarRating.vue +128 -99
- package/dist/runtime/components/StarRating.vue.d.ts +25 -82
- package/dist/runtime/components/input/AsPhoneNumberInput.d.vue.ts +32 -0
- package/dist/runtime/components/input/AsPhoneNumberInput.vue +48 -0
- package/dist/runtime/components/input/AsPhoneNumberInput.vue.d.ts +32 -0
- package/dist/runtime/components/input/WithCharacterLimit.d.vue.ts +13 -7
- package/dist/runtime/components/input/WithCharacterLimit.vue +27 -15
- package/dist/runtime/components/input/WithCharacterLimit.vue.d.ts +13 -7
- package/dist/runtime/components/input/WithClear.d.vue.ts +11 -5
- package/dist/runtime/components/input/WithClear.vue +29 -10
- package/dist/runtime/components/input/WithClear.vue.d.ts +11 -5
- package/dist/runtime/components/input/WithCopy.d.vue.ts +13 -7
- package/dist/runtime/components/input/WithCopy.vue +28 -11
- package/dist/runtime/components/input/WithCopy.vue.d.ts +13 -7
- package/dist/runtime/components/input/WithFloatingLabel.d.vue.ts +33 -0
- package/dist/runtime/components/input/WithFloatingLabel.vue +75 -0
- package/dist/runtime/components/input/WithFloatingLabel.vue.d.ts +33 -0
- package/dist/runtime/components/input/WithPasswordToggle.d.vue.ts +13 -7
- package/dist/runtime/components/input/WithPasswordToggle.vue +27 -10
- package/dist/runtime/components/input/WithPasswordToggle.vue.d.ts +13 -7
- package/dist/runtime/components/theme-picker/ThemePicker.d.vue.ts +8 -1
- package/dist/runtime/components/theme-picker/ThemePicker.vue +37 -28
- package/dist/runtime/components/theme-picker/ThemePicker.vue.d.ts +8 -1
- package/dist/runtime/components/theme-picker/ThemePickerButton.d.vue.ts +5 -6
- package/dist/runtime/components/theme-picker/ThemePickerButton.vue +4 -0
- package/dist/runtime/components/theme-picker/ThemePickerButton.vue.d.ts +5 -6
- package/dist/runtime/composables/index.d.ts +9 -8
- package/dist/runtime/composables/index.js +2 -1
- package/dist/runtime/composables/useApiFetch.d.ts +23 -15
- package/dist/runtime/composables/useApiFetch.js +21 -28
- package/dist/runtime/composables/useAutoForm.d.ts +14 -98
- package/dist/runtime/composables/useAutoForm.js +55 -161
- package/dist/runtime/composables/useClientApiFetch.d.ts +7 -7
- package/dist/runtime/composables/useDateFormatter.d.ts +16 -3
- package/dist/runtime/composables/useDateFormatter.js +89 -30
- package/dist/runtime/composables/useDownloadWithProgress.d.ts +26 -27
- package/dist/runtime/composables/useDownloadWithProgress.js +143 -42
- package/dist/runtime/composables/useLazyApiFetch.d.ts +19 -0
- package/dist/runtime/composables/useLazyApiFetch.js +4 -0
- package/dist/runtime/composables/useMessageBox.d.ts +6 -0
- package/dist/runtime/composables/useMessageBox.js +16 -0
- package/dist/runtime/composables/useTheme.d.ts +21 -8
- package/dist/runtime/composables/useTheme.js +109 -86
- package/dist/runtime/composables/useUploadWithProgress.d.ts +22 -28
- package/dist/runtime/composables/useUploadWithProgress.js +79 -68
- package/dist/runtime/domains/api/auth.d.ts +2 -0
- package/dist/runtime/domains/api/auth.js +31 -0
- package/dist/runtime/domains/api/endpoint-config.d.ts +11 -0
- package/dist/runtime/domains/api/endpoint-config.js +17 -0
- package/dist/runtime/domains/api/errors.d.ts +2 -0
- package/dist/runtime/domains/api/errors.js +10 -0
- package/dist/runtime/domains/api/fetch-key.d.ts +20 -0
- package/dist/runtime/domains/api/fetch-key.js +23 -0
- package/dist/runtime/domains/api/interceptors/error.d.ts +13 -0
- package/dist/runtime/domains/api/interceptors/error.js +49 -0
- package/dist/runtime/domains/api/interceptors/request.d.ts +12 -0
- package/dist/runtime/domains/api/interceptors/request.js +46 -0
- package/dist/runtime/domains/api/interceptors/response.d.ts +17 -0
- package/dist/runtime/domains/api/interceptors/response.js +27 -0
- package/dist/runtime/domains/api/response.d.ts +4 -0
- package/dist/runtime/domains/api/response.js +14 -0
- package/dist/runtime/domains/api/toast.d.ts +15 -0
- package/dist/runtime/domains/api/toast.js +46 -0
- package/dist/runtime/domains/api/transfer.d.ts +69 -0
- package/dist/runtime/domains/api/transfer.js +81 -0
- package/dist/runtime/domains/auto-form/actions.d.ts +2 -0
- package/dist/runtime/domains/auto-form/actions.js +4 -0
- package/dist/runtime/domains/auto-form/components/Array.d.vue.ts +13 -0
- package/dist/runtime/{components/auto-form-renderer/AutoFormRendererArray.vue → domains/auto-form/components/Array.vue} +37 -48
- package/dist/runtime/domains/auto-form/components/Array.vue.d.ts +13 -0
- package/dist/runtime/domains/auto-form/components/Children.d.vue.ts +11 -0
- package/dist/runtime/domains/auto-form/components/Children.vue +50 -0
- package/dist/runtime/domains/auto-form/components/Children.vue.d.ts +11 -0
- package/dist/runtime/domains/auto-form/components/Field.d.vue.ts +11 -0
- package/dist/runtime/domains/auto-form/components/Field.vue +56 -0
- package/dist/runtime/domains/auto-form/components/Field.vue.d.ts +11 -0
- package/dist/runtime/domains/auto-form/components/Layout.d.vue.ts +11 -0
- package/dist/runtime/domains/auto-form/components/Layout.vue +89 -0
- package/dist/runtime/domains/auto-form/components/Layout.vue.d.ts +11 -0
- package/dist/runtime/domains/auto-form/components/Nested.d.vue.ts +11 -0
- package/dist/runtime/domains/auto-form/components/Nested.vue +47 -0
- package/dist/runtime/domains/auto-form/components/Nested.vue.d.ts +11 -0
- package/dist/runtime/{constants/auto-form.d.ts → domains/auto-form/constants.d.ts} +0 -2
- package/dist/runtime/{constants/auto-form.js → domains/auto-form/constants.js} +0 -25
- package/dist/runtime/domains/auto-form/controls.d.ts +41 -0
- package/dist/runtime/domains/auto-form/controls.js +73 -0
- package/dist/runtime/{utils/field-utils.d.ts → domains/auto-form/fields.d.ts} +7 -21
- package/dist/runtime/{utils/field-utils.js → domains/auto-form/fields.js} +19 -4
- package/dist/runtime/domains/auto-form/metadata.d.ts +22 -0
- package/dist/runtime/domains/auto-form/metadata.js +53 -0
- package/dist/runtime/domains/auto-form/provider.d.ts +62 -0
- package/dist/runtime/{internal/useAutoFormProvider.js → domains/auto-form/provider.js} +6 -3
- package/dist/runtime/domains/auto-form/reactive.d.ts +12 -0
- package/dist/runtime/{utils/reactive-utils.js → domains/auto-form/reactive.js} +1 -1
- package/dist/runtime/domains/auto-form/schema.d.ts +7 -0
- package/dist/runtime/{utils/schema-introspector.js → domains/auto-form/schema.js} +12 -10
- package/dist/runtime/domains/data-table/columns/constants.d.ts +50 -0
- package/dist/runtime/domains/data-table/columns/constants.js +19 -0
- package/dist/runtime/domains/data-table/columns/resolve-columns.d.ts +4 -0
- package/dist/runtime/domains/data-table/columns/resolve-columns.js +59 -0
- package/dist/runtime/domains/data-table/columns/resolve-data-column.d.ts +9 -0
- package/dist/runtime/domains/data-table/columns/resolve-data-column.js +164 -0
- package/dist/runtime/domains/data-table/columns/resolve-group-column.d.ts +4 -0
- package/dist/runtime/domains/data-table/columns/resolve-group-column.js +19 -0
- package/dist/runtime/domains/data-table/columns/resolve-special-columns.d.ts +8 -0
- package/dist/runtime/domains/data-table/columns/resolve-special-columns.js +232 -0
- package/dist/runtime/domains/data-table/columns/style.d.ts +11 -0
- package/dist/runtime/domains/data-table/columns/style.js +67 -0
- package/dist/runtime/domains/data-table/columns/utils.d.ts +6 -0
- package/dist/runtime/domains/data-table/columns/utils.js +16 -0
- package/dist/runtime/domains/data-table/components/ActionConfirm.d.vue.ts +10 -0
- package/dist/runtime/domains/data-table/components/ActionConfirm.vue +39 -0
- package/dist/runtime/domains/data-table/components/ActionConfirm.vue.d.ts +10 -0
- package/dist/runtime/domains/data-table/components/ActionsCell.d.vue.ts +11 -0
- package/dist/runtime/domains/data-table/components/ActionsCell.vue +91 -0
- package/dist/runtime/domains/data-table/components/ActionsCell.vue.d.ts +11 -0
- package/dist/runtime/domains/data-table/components/CellTooltip.d.vue.ts +9 -0
- package/dist/runtime/domains/data-table/components/CellTooltip.vue +40 -0
- package/dist/runtime/domains/data-table/components/CellTooltip.vue.d.ts +9 -0
- package/dist/runtime/domains/data-table/components/Pagination.d.vue.ts +26 -0
- package/dist/runtime/domains/data-table/components/Pagination.vue +132 -0
- package/dist/runtime/domains/data-table/components/Pagination.vue.d.ts +26 -0
- package/dist/runtime/domains/data-table/indent.d.ts +8 -0
- package/dist/runtime/domains/data-table/indent.js +19 -0
- package/dist/runtime/domains/data-table/tree-selection.d.ts +9 -0
- package/dist/runtime/domains/data-table/tree-selection.js +76 -0
- package/dist/runtime/{utils/theme.d.ts → domains/theme/theme-icons.d.ts} +0 -1
- package/dist/runtime/index.css +1 -0
- package/dist/runtime/plugins/api.factory.js +28 -171
- package/dist/runtime/plugins/theme.js +72 -70
- package/dist/runtime/types/api/config.d.ts +127 -0
- package/dist/runtime/types/api/fetch.d.ts +50 -0
- package/dist/runtime/types/api/index.d.ts +5 -0
- package/dist/runtime/types/api/module.d.ts +94 -0
- package/dist/runtime/types/api/response.d.ts +62 -0
- package/dist/runtime/types/api/transfer.d.ts +32 -0
- package/dist/runtime/types/api/transfer.js +0 -0
- package/dist/runtime/types/app.config.d.ts +6 -0
- package/dist/runtime/types/auto-form/base.d.ts +26 -0
- package/dist/runtime/types/auto-form/base.js +0 -0
- package/dist/runtime/types/auto-form/component.d.ts +28 -0
- package/dist/runtime/types/auto-form/component.js +0 -0
- package/dist/runtime/types/auto-form/controls.d.ts +45 -0
- package/dist/runtime/types/auto-form/controls.js +0 -0
- package/dist/runtime/types/auto-form/fields.d.ts +68 -0
- package/dist/runtime/types/auto-form/fields.js +0 -0
- package/dist/runtime/types/auto-form/index.d.ts +7 -0
- package/dist/runtime/types/auto-form/index.js +0 -0
- package/dist/runtime/types/auto-form/search-form.d.ts +84 -0
- package/dist/runtime/types/auto-form/search-form.js +0 -0
- package/dist/runtime/types/auto-form/slots.d.ts +85 -0
- package/dist/runtime/types/auto-form/slots.js +0 -0
- package/dist/runtime/types/auto-form/zod-factory.d.ts +127 -0
- package/dist/runtime/types/auto-form/zod-factory.js +0 -0
- package/dist/runtime/types/components/color-chooser.d.ts +109 -0
- package/dist/runtime/types/components/color-chooser.js +0 -0
- package/dist/runtime/types/components/date-picker.d.ts +41 -0
- package/dist/runtime/types/components/date-picker.js +0 -0
- package/dist/runtime/types/components/index.d.ts +8 -0
- package/dist/runtime/types/components/index.js +0 -0
- package/dist/runtime/types/components/input/as-phone-number-input.d.ts +17 -0
- package/dist/runtime/types/components/input/as-phone-number-input.js +0 -0
- package/dist/runtime/types/components/input/index.d.ts +6 -0
- package/dist/runtime/types/components/input/index.js +0 -0
- package/dist/runtime/types/components/input/with-character-limit.d.ts +11 -0
- package/dist/runtime/types/components/input/with-character-limit.js +0 -0
- package/dist/runtime/types/components/input/with-clear.d.ts +10 -0
- package/dist/runtime/types/components/input/with-clear.js +0 -0
- package/dist/runtime/types/components/input/with-copy.d.ts +11 -0
- package/dist/runtime/types/components/input/with-copy.js +0 -0
- package/dist/runtime/types/components/input/with-floating-label.d.ts +12 -0
- package/dist/runtime/types/components/input/with-floating-label.js +0 -0
- package/dist/runtime/types/components/input/with-password-toggle.d.ts +7 -0
- package/dist/runtime/types/components/input/with-password-toggle.js +0 -0
- package/dist/runtime/types/components/message-box.d.ts +69 -0
- package/dist/runtime/types/components/message-box.js +0 -0
- package/dist/runtime/types/components/pill-group.d.ts +103 -0
- package/dist/runtime/types/components/pill-group.js +0 -0
- package/dist/runtime/types/components/popconfirm.d.ts +74 -0
- package/dist/runtime/types/components/popconfirm.js +0 -0
- package/dist/runtime/types/components/slide-verify.d.ts +54 -0
- package/dist/runtime/types/components/slide-verify.js +0 -0
- package/dist/runtime/types/components/star-rating.d.ts +55 -0
- package/dist/runtime/types/components/star-rating.js +0 -0
- package/dist/runtime/types/data-table/columns.d.ts +236 -0
- package/dist/runtime/types/data-table/columns.js +6 -0
- package/dist/runtime/types/data-table/component.d.ts +190 -0
- package/dist/runtime/types/data-table/component.js +0 -0
- package/dist/runtime/types/data-table/contexts.d.ts +44 -0
- package/dist/runtime/types/data-table/contexts.js +0 -0
- package/dist/runtime/types/data-table/index.d.ts +6 -0
- package/dist/runtime/types/data-table/index.js +1 -0
- package/dist/runtime/types/data-table/pagination.d.ts +87 -0
- package/dist/runtime/types/data-table/pagination.js +0 -0
- package/dist/runtime/types/index.d.ts +6 -5
- package/dist/runtime/types/index.js +5 -5
- package/dist/runtime/types/shared.d.ts +5 -0
- package/dist/runtime/types/shared.js +0 -0
- package/dist/runtime/types/zod.d.ts +19 -17
- package/dist/runtime/utils/extend-theme.d.ts +19 -0
- package/dist/runtime/utils/extend-theme.js +44 -0
- package/dist/runtime/utils/form-control.d.ts +33 -0
- package/dist/runtime/utils/form-control.js +54 -0
- package/dist/runtime/utils/meta.d.ts +4 -0
- package/dist/runtime/utils/meta.js +14 -0
- package/dist/runtime/utils/theme-defaults.d.ts +27 -0
- package/dist/runtime/utils/theme-defaults.js +28 -0
- package/dist/runtime/utils/tv.d.ts +1 -0
- package/dist/runtime/utils/tv.js +4 -0
- package/dist/runtime/vue/composables/useSiteConfig.d.ts +13 -0
- package/dist/runtime/vue/composables/useSiteConfig.js +11 -0
- package/dist/runtime/vue/plugins/theme.d.ts +6 -0
- package/dist/runtime/vue/plugins/theme.js +14 -0
- package/dist/runtime/vue/stubs/base.d.ts +2 -0
- package/dist/runtime/vue/stubs/base.js +2 -0
- package/dist/runtime/vue/stubs/inertia.d.ts +2 -0
- package/dist/runtime/vue/stubs/inertia.js +2 -0
- package/dist/runtime/vue/stubs/movk-extra.d.ts +2 -0
- package/dist/runtime/vue/stubs/movk-extra.js +2 -0
- package/dist/runtime/vue/stubs/none.d.ts +2 -0
- package/dist/runtime/vue/stubs/none.js +2 -0
- package/dist/runtime/vue/stubs/vue-router.d.ts +2 -0
- package/dist/runtime/vue/stubs/vue-router.js +2 -0
- package/dist/shared/nuxt.DfBEyjld.mjs +667 -0
- package/dist/types.d.mts +2 -6
- package/dist/unplugin.d.mts +28 -0
- package/dist/unplugin.mjs +292 -0
- package/dist/vite.d.mts +12 -0
- package/dist/vite.mjs +20 -0
- package/package.json +82 -42
- package/vue-plugin.d.ts +5 -0
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.d.vue.ts +0 -20
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.vue.d.ts +0 -20
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.d.vue.ts +0 -20
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue +0 -55
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue.d.ts +0 -20
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.d.vue.ts +0 -20
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.vue +0 -125
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.vue.d.ts +0 -20
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.d.vue.ts +0 -20
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.vue +0 -105
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.vue.d.ts +0 -20
- package/dist/runtime/composables/useApiAuth.d.ts +0 -47
- package/dist/runtime/composables/useApiAuth.js +0 -66
- package/dist/runtime/internal/useAutoFormProvider.d.ts +0 -50
- package/dist/runtime/schemas/api.d.ts +0 -590
- package/dist/runtime/schemas/api.js +0 -228
- package/dist/runtime/server/api/_movk/session.post.d.ts +0 -10
- package/dist/runtime/server/api/_movk/session.post.js +0 -18
- package/dist/runtime/style.css +0 -1
- package/dist/runtime/types/api.d.ts +0 -218
- package/dist/runtime/types/auth.d.ts +0 -34
- package/dist/runtime/types/auto-form-renderer.d.ts +0 -22
- package/dist/runtime/types/auto-form.d.ts +0 -548
- package/dist/runtime/types/components.d.ts +0 -43
- package/dist/runtime/types/module.d.ts +0 -39
- package/dist/runtime/utils/api-utils.d.ts +0 -79
- package/dist/runtime/utils/api-utils.js +0 -127
- package/dist/runtime/utils/auto-form.d.ts +0 -3
- package/dist/runtime/utils/auto-form.js +0 -18
- package/dist/runtime/utils/reactive-utils.d.ts +0 -30
- package/dist/runtime/utils/schema-introspector.d.ts +0 -13
- /package/dist/runtime/{utils/theme.js → domains/theme/theme-icons.js} +0 -0
- /package/dist/runtime/types/{api.js → api/config.js} +0 -0
- /package/dist/runtime/types/{auto-form-renderer.js → api/fetch.js} +0 -0
- /package/dist/runtime/types/{auto-form.js → api/index.js} +0 -0
- /package/dist/runtime/types/{module.js → api/module.js} +0 -0
- /package/dist/runtime/types/{components.js → api/response.js} +0 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import type { ButtonProps, CheckboxProps, DropdownMenuProps, IconProps, ModalProps, TableColumn, TooltipProps } from '@nuxt/ui';
|
|
2
|
+
import type { OmitByKey } from '@movk/core';
|
|
3
|
+
import type { CellContext, ColumnDef, ColumnDefTemplate } from '@tanstack/vue-table';
|
|
4
|
+
import type { SemanticColor } from '../shared';
|
|
5
|
+
import type { DataTableCheckboxContext, DataTableExpandButtonContext, DataTableExpandToggleAllContext, DataTablePinButtonContext, DataTableRowPinningButtonContext, DataTableSortButtonContext } from './contexts';
|
|
6
|
+
export type DataTableDensityPreset = 'compact' | 'normal' | 'comfortable';
|
|
7
|
+
export type DataTableTreeSelectionStrategy = 'cascade' | 'isolated' | 'leaf';
|
|
8
|
+
export type DataTableSizePreset = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
+
export type DataTableDynamic<V, Ctx> = V | ((ctx: Ctx) => V);
|
|
10
|
+
interface DataTableBaseColumn {
|
|
11
|
+
/** 列头文本 */
|
|
12
|
+
header: string;
|
|
13
|
+
/** 固定到左/右侧 */
|
|
14
|
+
fixed?: 'left' | 'right';
|
|
15
|
+
/** 对齐方式 */
|
|
16
|
+
align?: 'left' | 'center' | 'right';
|
|
17
|
+
/** 列宽,支持数值或预设 */
|
|
18
|
+
size?: number | DataTableSizePreset;
|
|
19
|
+
/** 最小宽度 */
|
|
20
|
+
minSize?: number;
|
|
21
|
+
/** 最大宽度 */
|
|
22
|
+
maxSize?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface DataTableDataColumn<T> extends DataTableBaseColumn {
|
|
25
|
+
/** 数据字段键 */
|
|
26
|
+
accessorKey: keyof T & string | (string & {});
|
|
27
|
+
/**
|
|
28
|
+
* 默认是否可见
|
|
29
|
+
* @defaultValue true
|
|
30
|
+
*/
|
|
31
|
+
visibility?: boolean;
|
|
32
|
+
/** 允许通过表头交互切换列固定(left -> right -> none),优先级高于全局 pinable */
|
|
33
|
+
pinable?: boolean;
|
|
34
|
+
/** 固定列按钮 props 透传,列级可覆盖全局 pinButtonProps */
|
|
35
|
+
pinButtonProps?: DataTableDynamic<ButtonProps, DataTablePinButtonContext<T>>;
|
|
36
|
+
/** 启用排序,优先级高于全局 sortable */
|
|
37
|
+
sortable?: boolean;
|
|
38
|
+
/** 排序按钮 props 透传,列级可覆盖全局 sortButtonProps */
|
|
39
|
+
sortButtonProps?: DataTableDynamic<ButtonProps, DataTableSortButtonContext<T>>;
|
|
40
|
+
/** 是否可拖拽调整宽度,优先级高于全局 resizable */
|
|
41
|
+
resizable?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* 单元格文本溢出截断,优先级高于全局 truncate
|
|
44
|
+
* - true = 单行截断
|
|
45
|
+
* - number > 1 = 多行截断行数
|
|
46
|
+
* - false = 禁用截断
|
|
47
|
+
* - 函数 = 按 cell 上下文动态决定
|
|
48
|
+
*/
|
|
49
|
+
truncate?: boolean | number | ((ctx: CellContext<T, unknown>) => boolean | number);
|
|
50
|
+
/**
|
|
51
|
+
* 空值占位,false 禁用,函数接收 CellContext 动态渲染
|
|
52
|
+
* @defaultValue 继承全局 emptyCell
|
|
53
|
+
*/
|
|
54
|
+
emptyCell?: string | false | ColumnDefTemplate<CellContext<T, unknown>>;
|
|
55
|
+
/**
|
|
56
|
+
* 溢出 Tooltip,优先级高于全局 tooltip
|
|
57
|
+
* - true = 溢出时单行显示
|
|
58
|
+
* - number = 溢出时多行显示(行数)
|
|
59
|
+
* - false = 禁用
|
|
60
|
+
* - 函数 = 按 cell 上下文动态决定
|
|
61
|
+
*/
|
|
62
|
+
tooltip?: boolean | number | ((ctx: CellContext<T, unknown>) => boolean | number);
|
|
63
|
+
/** UTooltip 额外 props 透传(tooltip 启用时生效) */
|
|
64
|
+
tooltipProps?: TooltipProps;
|
|
65
|
+
/** 单元格自定义渲染,string 直接显示,函数接收 CellContext */
|
|
66
|
+
cell?: TableColumn<T>['cell'];
|
|
67
|
+
/** TanStack ColumnDef 透传(逃生舱) */
|
|
68
|
+
_raw?: Partial<ColumnDef<T, unknown>>;
|
|
69
|
+
}
|
|
70
|
+
export interface DataTableGroupColumn<T> extends DataTableBaseColumn {
|
|
71
|
+
/** 分组子列,设置后作为分组表头 */
|
|
72
|
+
children: (DataTableDataColumn<T> | DataTableGroupColumn<T>)[];
|
|
73
|
+
}
|
|
74
|
+
export interface DataTableSpecialColumnBase<T = unknown> extends Omit<DataTableBaseColumn, 'header' | 'truncate'> {
|
|
75
|
+
/**
|
|
76
|
+
* 默认是否可见
|
|
77
|
+
* @defaultValue true
|
|
78
|
+
*/
|
|
79
|
+
visibility?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* 允许通过表头交互切换列固定位置(left -> right -> none)
|
|
82
|
+
* @defaultValue false
|
|
83
|
+
*/
|
|
84
|
+
pinable?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* 是否可拖拽调整宽度
|
|
87
|
+
* @defaultValue false
|
|
88
|
+
*/
|
|
89
|
+
resizable?: boolean;
|
|
90
|
+
/** 固定列按钮 props 透传,列级可覆盖全局 pinButtonProps */
|
|
91
|
+
pinButtonProps?: DataTableDynamic<ButtonProps, DataTablePinButtonContext<T>>;
|
|
92
|
+
/** TanStack ColumnDef 透传(逃生舱) */
|
|
93
|
+
_raw?: Partial<ColumnDef<any, unknown>>;
|
|
94
|
+
}
|
|
95
|
+
/** @defaultValue size=48, fixed='left', align='center' */
|
|
96
|
+
export interface DataTableSelectionColumn<T = unknown> extends DataTableSpecialColumnBase<T> {
|
|
97
|
+
/** 选择列,显示复选框/单选框用于行选择 */
|
|
98
|
+
type: 'selection';
|
|
99
|
+
/**
|
|
100
|
+
* 单选/多选
|
|
101
|
+
* @defaultValue 'multiple'
|
|
102
|
+
*/
|
|
103
|
+
mode?: 'single' | 'multiple';
|
|
104
|
+
/**
|
|
105
|
+
* 树形勾选策略,仅在 childrenKey 启用时生效
|
|
106
|
+
* - 'cascade' 父子级联(默认,=TanStack enableSubRowSelection: true)
|
|
107
|
+
* - 'isolated' 父子独立勾选(=enableSubRowSelection: false)
|
|
108
|
+
* - 'leaf' 仅叶子节点可勾选,父节点展示为子孙派生态(只读)
|
|
109
|
+
* @defaultValue 'cascade'
|
|
110
|
+
*/
|
|
111
|
+
strategy?: DataTableTreeSelectionStrategy;
|
|
112
|
+
/** 单选模式下的表头文本 */
|
|
113
|
+
header?: string;
|
|
114
|
+
/** UCheckbox props 透传 */
|
|
115
|
+
checkboxProps?: DataTableDynamic<CheckboxProps, DataTableCheckboxContext<T>>;
|
|
116
|
+
}
|
|
117
|
+
/** @defaultValue size=60, align='center' */
|
|
118
|
+
export interface DataTableIndexColumn<T = unknown> extends DataTableSpecialColumnBase<T> {
|
|
119
|
+
/** 索引列,显示行索引 */
|
|
120
|
+
type: 'index';
|
|
121
|
+
/**
|
|
122
|
+
* 表头文本
|
|
123
|
+
* @defaultValue '#'
|
|
124
|
+
*/
|
|
125
|
+
header?: string;
|
|
126
|
+
}
|
|
127
|
+
/** @defaultValue size=48 */
|
|
128
|
+
export interface DataTableExpandColumn<T = unknown> extends DataTableSpecialColumnBase<T> {
|
|
129
|
+
/** 展开列,显示展开图标用于树形表格 */
|
|
130
|
+
type: 'expand';
|
|
131
|
+
/** 展开/折叠按钮 props 透传 */
|
|
132
|
+
buttonProps?: DataTableDynamic<ButtonProps, DataTableExpandButtonContext<T>>;
|
|
133
|
+
/**
|
|
134
|
+
* 表头是否渲染「全部展开/收起」按钮,树形与行详情展开模式均生效
|
|
135
|
+
* @defaultValue true
|
|
136
|
+
*/
|
|
137
|
+
toggleAll?: boolean;
|
|
138
|
+
/** 表头「全部展开/收起」按钮 props 透传 */
|
|
139
|
+
toggleAllButtonProps?: DataTableDynamic<ButtonProps, DataTableExpandToggleAllContext<T>>;
|
|
140
|
+
}
|
|
141
|
+
/** @defaultValue size=48, fixed='left', align='center' */
|
|
142
|
+
export interface DataTableRowPinningColumn<T = unknown> extends DataTableSpecialColumnBase<T> {
|
|
143
|
+
/** 行固定列,显示图标用于行固定 */
|
|
144
|
+
type: 'row-pinning';
|
|
145
|
+
/**
|
|
146
|
+
* 行固定位置
|
|
147
|
+
* @defaultValue 'top'
|
|
148
|
+
*/
|
|
149
|
+
position?: 'top' | 'bottom';
|
|
150
|
+
/**
|
|
151
|
+
* 表头文本
|
|
152
|
+
* @defaultValue '#'
|
|
153
|
+
*/
|
|
154
|
+
header?: string;
|
|
155
|
+
/** 行固定/取消固定按钮 props 透传 */
|
|
156
|
+
buttonProps?: DataTableDynamic<ButtonProps, DataTableRowPinningButtonContext<T>>;
|
|
157
|
+
}
|
|
158
|
+
/** 操作按钮回调上下文 */
|
|
159
|
+
export interface DataTableActionButtonContext<T> {
|
|
160
|
+
cellContext: CellContext<T, unknown>;
|
|
161
|
+
row: T;
|
|
162
|
+
index: number;
|
|
163
|
+
action: DataTableAction<T>;
|
|
164
|
+
}
|
|
165
|
+
interface DataTableActionConfirmProps extends OmitByKey<ModalProps, 'title' | 'open' | 'defaultOpen' | 'dismissible'> {
|
|
166
|
+
title?: string;
|
|
167
|
+
type?: SemanticColor;
|
|
168
|
+
icon?: IconProps['name'];
|
|
169
|
+
dismissible?: boolean;
|
|
170
|
+
description?: string;
|
|
171
|
+
confirmText?: string;
|
|
172
|
+
cancelText?: string;
|
|
173
|
+
confirmButtonProps?: ButtonProps;
|
|
174
|
+
cancelButtonProps?: ButtonProps;
|
|
175
|
+
}
|
|
176
|
+
export interface DataTableAction<T> {
|
|
177
|
+
/** 唯一 key,用于渲染稳定性与溢出菜单定位;未提供时回退到数组下标 */
|
|
178
|
+
key?: string | number;
|
|
179
|
+
/** 按钮 props,支持整体回调按行动态计算 */
|
|
180
|
+
buttonProps?: DataTableDynamic<ButtonProps, DataTableActionButtonContext<T>>;
|
|
181
|
+
/** 是否可见 */
|
|
182
|
+
visibility?: boolean | ((ctx: DataTableActionButtonContext<T>) => boolean);
|
|
183
|
+
/** 是否禁用(loading 中自动叠加) */
|
|
184
|
+
disabled?: boolean | ((ctx: DataTableActionButtonContext<T>) => boolean);
|
|
185
|
+
/** 点击回调,支持 async;返回 Promise 时自动维护 loading 状态 */
|
|
186
|
+
onClick: (ctx: DataTableActionButtonContext<T>) => void | Promise<void>;
|
|
187
|
+
/** 触发前需要 MessageBox 确认 */
|
|
188
|
+
confirm?: boolean;
|
|
189
|
+
/** 确认弹窗 props,支持回调 */
|
|
190
|
+
confirmProps?: DataTableDynamic<DataTableActionConfirmProps, DataTableActionButtonContext<T>>;
|
|
191
|
+
/** 溢出菜单内在该项之前插入分隔线(仅 overflow 模式生效) */
|
|
192
|
+
divider?: boolean;
|
|
193
|
+
}
|
|
194
|
+
/** @defaultValue fixed='right' */
|
|
195
|
+
export interface DataTableActionsColumn<T = unknown> extends DataTableSpecialColumnBase<T> {
|
|
196
|
+
/** 操作列,显示操作按钮 */
|
|
197
|
+
type: 'actions';
|
|
198
|
+
/**
|
|
199
|
+
* 表头文本
|
|
200
|
+
* @defaultValue '操作'
|
|
201
|
+
*/
|
|
202
|
+
header?: string;
|
|
203
|
+
/** 操作按钮列表,支持整体回调 */
|
|
204
|
+
actions: DataTableAction<T>[] | ((ctx: CellContext<T, unknown>) => DataTableAction<T>[]);
|
|
205
|
+
/**
|
|
206
|
+
* 最多平铺的 action 数;超出部分收纳到 UDropdownMenu
|
|
207
|
+
* @defaultValue 3
|
|
208
|
+
*/
|
|
209
|
+
maxInline?: number;
|
|
210
|
+
/** 溢出触发按钮 props */
|
|
211
|
+
overflowTrigger?: DataTableDynamic<ButtonProps, CellContext<T, unknown>>;
|
|
212
|
+
/** 溢出菜单透传 props(UDropdownMenu) */
|
|
213
|
+
dropdownProps?: DataTableDynamic<Partial<DropdownMenuProps>, CellContext<T, unknown>>;
|
|
214
|
+
/** 容器 class,默认 'flex items-center gap-1' */
|
|
215
|
+
wrapperClass?: string | ((ctx: CellContext<T, unknown>) => string);
|
|
216
|
+
}
|
|
217
|
+
export type DataTableColumn<T> = DataTableDataColumn<T> | DataTableGroupColumn<T> | DataTableSelectionColumn<T> | DataTableIndexColumn<T> | DataTableExpandColumn<T> | DataTableRowPinningColumn<T> | DataTableActionsColumn<T> | TableColumn<T>;
|
|
218
|
+
export declare function isDataColumn<T>(col: DataTableColumn<T>): col is DataTableDataColumn<T>;
|
|
219
|
+
export declare function isGroupColumn<T>(col: DataTableColumn<T>): col is DataTableGroupColumn<T>;
|
|
220
|
+
export interface TreeSelectionResult<T> {
|
|
221
|
+
/** TanStack 原生语义:所有 selected=true 的行对象 */
|
|
222
|
+
selected: T[];
|
|
223
|
+
/** 只包含叶子节点(无子节点)且被勾选的行 */
|
|
224
|
+
leaves: T[];
|
|
225
|
+
/** 父节点且所有子孙叶子均已选中(「全选」的父) */
|
|
226
|
+
parents: T[];
|
|
227
|
+
/** 父节点且子孙叶子部分选中(indeterminate) */
|
|
228
|
+
halfSelected: T[];
|
|
229
|
+
/**
|
|
230
|
+
* 严格被用户勾选:排除因父级联而带上的子节点。
|
|
231
|
+
* - 'isolated' / 'leaf':等价于 `selected`
|
|
232
|
+
* - 'cascade':若自身被选且父节点也在 selected 中,视为级联产物,剔除
|
|
233
|
+
*/
|
|
234
|
+
strictlyChecked: T[];
|
|
235
|
+
}
|
|
236
|
+
export {};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import type { CellContext, ColumnDefTemplate, ColumnMeta, PaginationState, Row, Table, TableMeta } from '@tanstack/vue-table';
|
|
2
|
+
import type { ButtonProps, TableData, TableProps, TableRow, TooltipProps } from '@nuxt/ui';
|
|
3
|
+
import type { FirstParameter, OmitByKey } from '@movk/core';
|
|
4
|
+
import type { VNode } from 'vue';
|
|
5
|
+
import type { DataTableActionButtonContext, DataTableColumn, DataTableDataColumn, DataTableDensityPreset, DataTableDynamic, TreeSelectionResult } from './columns';
|
|
6
|
+
import type { DataTablePinButtonContext, DataTableSortButtonContext } from './contexts';
|
|
7
|
+
import type { DataTablePaginationSlots, DataTablePaginationUi } from './pagination';
|
|
8
|
+
import type { ClassNameValue } from '../shared';
|
|
9
|
+
export type DataTableSelectHandler<T extends TableData> = (e: Event, row: TableRow<T>) => void;
|
|
10
|
+
export type DataTableHoverHandler<T extends TableData> = (e: Event, row: TableRow<T> | null) => void;
|
|
11
|
+
export type DataTableContextmenuHandler<T extends TableData> = ((e: Event, row: TableRow<T>) => void) | ((e: Event, row: TableRow<T>) => void)[];
|
|
12
|
+
export interface DataTableExposed<T extends TableData> {
|
|
13
|
+
tableRef: HTMLTableElement | null;
|
|
14
|
+
tableApi: Table<T> | null;
|
|
15
|
+
/** UTable 根元素,即滚动容器 */
|
|
16
|
+
el: HTMLElement | null;
|
|
17
|
+
scrollToTop: (options?: ScrollToOptions) => void;
|
|
18
|
+
clearSelection: () => void;
|
|
19
|
+
/** 展开到指定层级(depth < n 的可展开行展开,其余收起);depth=0 等价收起全部 */
|
|
20
|
+
expandToDepth: (depth: number) => void;
|
|
21
|
+
/** 收起全部行 */
|
|
22
|
+
collapseAll: () => void;
|
|
23
|
+
treeSelection: TreeSelectionResult<T>;
|
|
24
|
+
}
|
|
25
|
+
export interface DataTableProps<T extends TableData> extends /* @vue-ignore */ OmitByKey<TableProps<T>, 'columns' | 'meta' | 'sticky' | 'loading' | 'ui' | 'columnSizingOptions' | 'columnPinningOptions' | 'rowSelectionOptions' | 'sortingOptions' | 'expandedOptions' | 'paginationOptions' | 'onSelect' | 'onHover' | 'onContextmenu'> {
|
|
26
|
+
/**
|
|
27
|
+
* 行唯一标识字段,自动派生 getRowId;与 getRowId 同传时后者优先
|
|
28
|
+
* @example 'id'
|
|
29
|
+
*/
|
|
30
|
+
rowKey?: keyof T & string | (string & {});
|
|
31
|
+
columns?: DataTableColumn<T>[];
|
|
32
|
+
loading?: TableProps<T>['loading'];
|
|
33
|
+
/**
|
|
34
|
+
* 斑马纹
|
|
35
|
+
* @defaultValue false
|
|
36
|
+
*/
|
|
37
|
+
stripe?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* 纵向边框,传对象可定制 color/width/style
|
|
40
|
+
* @defaultValue false
|
|
41
|
+
*/
|
|
42
|
+
bordered?: boolean | {
|
|
43
|
+
color?: string;
|
|
44
|
+
width?: string;
|
|
45
|
+
style?: 'solid' | 'dashed' | 'dotted' | 'double';
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* 表格宽度由列宽内容决定(w-fit)
|
|
49
|
+
* @defaultValue false
|
|
50
|
+
*/
|
|
51
|
+
fitContent?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* 空值占位符
|
|
54
|
+
* @defaultValue '-'
|
|
55
|
+
*/
|
|
56
|
+
emptyCell?: false | string | ColumnDefTemplate<CellContext<T, unknown>>;
|
|
57
|
+
/**
|
|
58
|
+
* 启用列固定按钮,传函数可按列动态决定
|
|
59
|
+
* @defaultValue false
|
|
60
|
+
*/
|
|
61
|
+
pinable?: boolean | ((col: DataTableDataColumn<T>) => boolean);
|
|
62
|
+
pinButtonProps?: DataTableDynamic<ButtonProps, DataTablePinButtonContext<T>>;
|
|
63
|
+
/**
|
|
64
|
+
* 启用列排序,传函数可按列动态决定
|
|
65
|
+
* @defaultValue false
|
|
66
|
+
*/
|
|
67
|
+
sortable?: boolean | ((col: DataTableDataColumn<T>) => boolean);
|
|
68
|
+
sortButtonProps?: DataTableDynamic<ButtonProps, DataTableSortButtonContext<T>>;
|
|
69
|
+
/** 全局 action 按钮 props,与列级 action.buttonProps 深度合并,列级优先 */
|
|
70
|
+
actionButtonProps?: DataTableDynamic<ButtonProps, DataTableActionButtonContext<T>>;
|
|
71
|
+
/**
|
|
72
|
+
* 行内最多展示多少 action 按钮,超出折叠到 overflow
|
|
73
|
+
* @defaultValue 3
|
|
74
|
+
*/
|
|
75
|
+
actionsMaxInline?: number;
|
|
76
|
+
actionsOverflowTrigger?: DataTableDynamic<ButtonProps, CellContext<T, unknown>>;
|
|
77
|
+
/**
|
|
78
|
+
* 启用列宽拖拽,传函数可按列动态决定
|
|
79
|
+
* @defaultValue false
|
|
80
|
+
*/
|
|
81
|
+
resizable?: boolean | ((col: DataTableDataColumn<T>) => boolean);
|
|
82
|
+
/**
|
|
83
|
+
* - 'onChange' 拖动中实时重排
|
|
84
|
+
* - 'onEnd' 释放后才更新
|
|
85
|
+
* @defaultValue 'onChange'
|
|
86
|
+
*/
|
|
87
|
+
columnResizeMode?: 'onChange' | 'onEnd';
|
|
88
|
+
/** 单元格内边距密度 */
|
|
89
|
+
density?: DataTableDensityPreset | ColumnMeta<T, unknown>['class'];
|
|
90
|
+
meta?: TableMeta<T>;
|
|
91
|
+
rowClass?: string | ((row: T) => string);
|
|
92
|
+
rowStyle?: string | Record<string, string> | ((row: T) => string | Record<string, string>);
|
|
93
|
+
/**
|
|
94
|
+
* 单元格溢出 Tooltip:true 单行 / number 多行 / false 禁用 / 函数 动态
|
|
95
|
+
* @defaultValue false
|
|
96
|
+
*/
|
|
97
|
+
tooltip?: boolean | number | ((ctx: CellContext<T, unknown>) => boolean | number);
|
|
98
|
+
tooltipProps?: OmitByKey<TooltipProps, 'text'>;
|
|
99
|
+
/**
|
|
100
|
+
* 单元格文本截断:true 单行 / number 多行 / false 禁用 / 函数 动态
|
|
101
|
+
* @defaultValue true
|
|
102
|
+
*/
|
|
103
|
+
truncate?: boolean | number | ((ctx: CellContext<T, unknown>) => boolean | number);
|
|
104
|
+
sortingOptions?: TableProps<T>['sortingOptions'];
|
|
105
|
+
columnSizingOptions?: TableProps<T>['columnSizingOptions'];
|
|
106
|
+
columnPinningOptions?: TableProps<T>['columnPinningOptions'];
|
|
107
|
+
rowSelectionOptions?: TableProps<T>['rowSelectionOptions'];
|
|
108
|
+
/**
|
|
109
|
+
* 子行字段名,设置后启用树形模式
|
|
110
|
+
* @example 'children'
|
|
111
|
+
*/
|
|
112
|
+
childrenKey?: keyof T & string | (string & {});
|
|
113
|
+
/**
|
|
114
|
+
* 树形缩进:number 每层缩进 px / string CSS 值 / 函数 动态返回 CSS
|
|
115
|
+
* @defaultValue '1rem'
|
|
116
|
+
*/
|
|
117
|
+
indentSize?: number | string | ((ctx: CellContext<T, unknown>) => string);
|
|
118
|
+
expandedOptions?: TableProps<T>['expandedOptions'];
|
|
119
|
+
/** @defaultValue false */
|
|
120
|
+
expandOnRowClick?: boolean;
|
|
121
|
+
/** @defaultValue false */
|
|
122
|
+
selectOnRowClick?: boolean;
|
|
123
|
+
/** 可见列白名单(数组形) */
|
|
124
|
+
columnVisibilityKeys?: string[];
|
|
125
|
+
/** 隐藏列黑名单(数组形),与 columnVisibilityKeys 互斥,同传时白名单优先 */
|
|
126
|
+
columnVisibilityExcludeKeys?: string[];
|
|
127
|
+
/** 选中行 id 列表(数组形) */
|
|
128
|
+
rowSelectionKeys?: string[];
|
|
129
|
+
/** 展开行 id 列表(数组形) */
|
|
130
|
+
expandedKeys?: string[];
|
|
131
|
+
onSelect?: DataTableSelectHandler<T>;
|
|
132
|
+
onHover?: DataTableHoverHandler<T>;
|
|
133
|
+
onRowContextmenu?: DataTableContextmenuHandler<T>;
|
|
134
|
+
/**
|
|
135
|
+
* 分页配置,透传给 TanStack / UTable
|
|
136
|
+
* - 客户端分页:传入即启用,自动注入 getPaginationRowModel
|
|
137
|
+
* - 服务端分页:manualPagination=true 并提供 rowCount 或 pageCount
|
|
138
|
+
*/
|
|
139
|
+
paginationOptions?: TableProps<T>['paginationOptions'];
|
|
140
|
+
/**
|
|
141
|
+
* 粘性表头
|
|
142
|
+
* @defaultValue true
|
|
143
|
+
*/
|
|
144
|
+
sticky?: TableProps<T>['sticky'];
|
|
145
|
+
paginationUi?: DataTablePaginationUi;
|
|
146
|
+
/**
|
|
147
|
+
* 触底加载回调,传入即启用无限滚动模式(自动隐藏内置分页、async 期间派生 loading)
|
|
148
|
+
*/
|
|
149
|
+
loadMore?: () => void | Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* 是否还能加载更多
|
|
152
|
+
* @defaultValue true
|
|
153
|
+
*/
|
|
154
|
+
canLoadMore?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* 触发 loadMore 的距底像素阈值
|
|
157
|
+
* @defaultValue 100
|
|
158
|
+
*/
|
|
159
|
+
loadMoreDistance?: number;
|
|
160
|
+
class?: ClassNameValue;
|
|
161
|
+
ui?: Record<string, ClassNameValue>;
|
|
162
|
+
}
|
|
163
|
+
export interface DataTablePaginationSlotProps<T extends TableData> {
|
|
164
|
+
tableApi: Table<T>;
|
|
165
|
+
pagination: PaginationState;
|
|
166
|
+
page: number;
|
|
167
|
+
rowCount: number;
|
|
168
|
+
rowCountKnown: boolean;
|
|
169
|
+
pageCount: number;
|
|
170
|
+
currentPageRowCount: number;
|
|
171
|
+
from: number;
|
|
172
|
+
to: number;
|
|
173
|
+
show: boolean;
|
|
174
|
+
selectedCount: number;
|
|
175
|
+
setPage: (page: number) => void;
|
|
176
|
+
setPageSize: (pageSize: unknown) => void;
|
|
177
|
+
}
|
|
178
|
+
export interface DataTableSlots<T extends TableData> {
|
|
179
|
+
'expanded'(props: {
|
|
180
|
+
row: Row<T>;
|
|
181
|
+
}): VNode[];
|
|
182
|
+
'empty'(): VNode[];
|
|
183
|
+
'loading'(): VNode[];
|
|
184
|
+
'caption'(): VNode[];
|
|
185
|
+
'body-top'(): VNode[];
|
|
186
|
+
'body-bottom'(): VNode[];
|
|
187
|
+
'pagination'(props: DataTablePaginationSlotProps<T>): VNode[];
|
|
188
|
+
'pagination-summary'(props: FirstParameter<DataTablePaginationSlots<T>['summary']>): VNode[];
|
|
189
|
+
'pagination-actions'(props: FirstParameter<DataTablePaginationSlots<T>['actions']>): VNode[];
|
|
190
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { CellContext, HeaderContext } from '@tanstack/vue-table';
|
|
2
|
+
/** 排序按钮回调上下文 */
|
|
3
|
+
export interface DataTableSortButtonContext<T> {
|
|
4
|
+
isSorted: 'asc' | 'desc' | false;
|
|
5
|
+
headerContext: HeaderContext<T, unknown>;
|
|
6
|
+
}
|
|
7
|
+
/** 列固定按钮回调上下文 */
|
|
8
|
+
export interface DataTablePinButtonContext<T> {
|
|
9
|
+
pinned: 'left' | 'right' | false;
|
|
10
|
+
headerContext: HeaderContext<T, unknown>;
|
|
11
|
+
}
|
|
12
|
+
/** 选择列复选框回调上下文(表头 / 单元格共用,用 scope 区分) */
|
|
13
|
+
export type DataTableCheckboxContext<T> = {
|
|
14
|
+
scope: 'header';
|
|
15
|
+
headerContext: HeaderContext<T, unknown>;
|
|
16
|
+
isAllSelected: boolean;
|
|
17
|
+
isIndeterminate: boolean;
|
|
18
|
+
} | {
|
|
19
|
+
scope: 'cell';
|
|
20
|
+
cellContext: CellContext<T, unknown>;
|
|
21
|
+
isSelected: boolean;
|
|
22
|
+
isIndeterminate: boolean;
|
|
23
|
+
/** 是否为 leaf 策略下派生态的只读父行 */
|
|
24
|
+
isLeafAggregate: boolean;
|
|
25
|
+
};
|
|
26
|
+
/** 展开列按钮回调上下文 */
|
|
27
|
+
export interface DataTableExpandButtonContext<T> {
|
|
28
|
+
cellContext: CellContext<T, unknown>;
|
|
29
|
+
isExpanded: boolean;
|
|
30
|
+
depth: number;
|
|
31
|
+
canExpand: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** 展开列表头「全部展开/收起」按钮回调上下文 */
|
|
34
|
+
export interface DataTableExpandToggleAllContext<T> {
|
|
35
|
+
headerContext: HeaderContext<T, unknown>;
|
|
36
|
+
isAllExpanded: boolean;
|
|
37
|
+
isSomeExpanded: boolean;
|
|
38
|
+
}
|
|
39
|
+
/** 行固定列按钮回调上下文 */
|
|
40
|
+
export interface DataTableRowPinningButtonContext<T> {
|
|
41
|
+
cellContext: CellContext<T, unknown>;
|
|
42
|
+
pinned: 'top' | 'bottom' | false;
|
|
43
|
+
position: 'top' | 'bottom';
|
|
44
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { DataTableCheckboxContext, DataTableExpandButtonContext, DataTableExpandToggleAllContext, DataTablePinButtonContext, DataTableRowPinningButtonContext, DataTableSortButtonContext } from './contexts';
|
|
2
|
+
export type { DataTableAction, DataTableActionButtonContext, DataTableActionsColumn, DataTableColumn, DataTableDataColumn, DataTableDensityPreset, DataTableDynamic, DataTableExpandColumn, DataTableGroupColumn, DataTableIndexColumn, DataTableRowPinningColumn, DataTableSelectionColumn, DataTableSizePreset, DataTableSpecialColumnBase, DataTableTreeSelectionStrategy, TreeSelectionResult } from './columns';
|
|
3
|
+
export { isDataColumn, isGroupColumn } from './columns';
|
|
4
|
+
export type { DataTablePaginationUi, DataTablePaginationProps, DataTablePaginationSlots } from './pagination';
|
|
5
|
+
export type { DataTableContextmenuHandler, DataTableExposed, DataTableHoverHandler, DataTablePaginationSlotProps, DataTableProps, DataTableSelectHandler, DataTableSlots } from './component';
|
|
6
|
+
export type { ExpandedState, PaginationState, RowPinningState, RowSelectionState, SortingState } from '@tanstack/vue-table';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { isDataColumn, isGroupColumn } from "./columns.js";
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { PaginationProps, SelectProps, TableData } from '@nuxt/ui';
|
|
2
|
+
import type { PaginationState, RowData, Table } from '@tanstack/vue-table';
|
|
3
|
+
import type { VNode } from 'vue';
|
|
4
|
+
import type { ClassNameValue } from '../shared';
|
|
5
|
+
type DataTablePageSizeSelectProps = Omit<SelectProps<Array<{
|
|
6
|
+
label: string;
|
|
7
|
+
value: number;
|
|
8
|
+
}>>, 'items' | 'modelValue' | 'defaultValue' | 'multiple' | 'valueKey' | 'labelKey' | 'descriptionKey' | 'onUpdate:modelValue'>;
|
|
9
|
+
interface DataTablePaginationUiText {
|
|
10
|
+
total?: string;
|
|
11
|
+
item?: string;
|
|
12
|
+
range?: string;
|
|
13
|
+
selected?: string;
|
|
14
|
+
page?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface DataTablePaginationUi {
|
|
17
|
+
/**
|
|
18
|
+
* 分页栏 UI 是否显示(仅在分页已启用时生效)。
|
|
19
|
+
* 仅控 UI 显隐,不影响数据切片;
|
|
20
|
+
* 若要完全关闭分页,请不要传入 `paginationOptions` / `v-model:pagination` / `pageSizes`。
|
|
21
|
+
* @defaultValue 分页启用时为 `pageCount > 1 || pageSizes.length > 1`,否则为 `false`
|
|
22
|
+
*/
|
|
23
|
+
show?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* 可选每页条数列表,长度大于 1 时显示切换器
|
|
26
|
+
* @defaultValue []
|
|
27
|
+
*/
|
|
28
|
+
pageSizes?: number[];
|
|
29
|
+
/**
|
|
30
|
+
* 是否显示已选行数
|
|
31
|
+
* @defaultValue true
|
|
32
|
+
*/
|
|
33
|
+
showSelectedCount?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* 是否显示当前页区间
|
|
36
|
+
* @defaultValue true
|
|
37
|
+
*/
|
|
38
|
+
showRowRange?: boolean;
|
|
39
|
+
paginationProps?: Omit<PaginationProps, 'page' | 'total' | 'itemsPerPage'>;
|
|
40
|
+
pageSizeSelectProps?: DataTablePageSizeSelectProps;
|
|
41
|
+
text?: DataTablePaginationUiText;
|
|
42
|
+
ui?: Record<string, ClassNameValue>;
|
|
43
|
+
}
|
|
44
|
+
export interface DataTablePaginationProps<TData extends RowData> {
|
|
45
|
+
tableApi: Table<TData>;
|
|
46
|
+
pagination: PaginationState;
|
|
47
|
+
page: number;
|
|
48
|
+
rowCount: number;
|
|
49
|
+
rowCountKnown: boolean;
|
|
50
|
+
pageCount: number;
|
|
51
|
+
from: number;
|
|
52
|
+
to: number;
|
|
53
|
+
selectedCount: number;
|
|
54
|
+
setPage: (page: number) => void;
|
|
55
|
+
setPageSize: (pageSize: unknown) => void;
|
|
56
|
+
uiConfig?: DataTablePaginationUi;
|
|
57
|
+
}
|
|
58
|
+
export interface DataTablePaginationSlots<TData extends RowData = RowData> {
|
|
59
|
+
summary(props: {
|
|
60
|
+
summaryText: string;
|
|
61
|
+
selectedText: string;
|
|
62
|
+
selectedCount: number;
|
|
63
|
+
rowCount: number;
|
|
64
|
+
rowCountKnown: boolean;
|
|
65
|
+
from: number;
|
|
66
|
+
to: number;
|
|
67
|
+
page: number;
|
|
68
|
+
pageCount: number;
|
|
69
|
+
showSelectedCount: boolean;
|
|
70
|
+
}): VNode[];
|
|
71
|
+
actions(props: {
|
|
72
|
+
tableApi: Table<TData>;
|
|
73
|
+
page: number;
|
|
74
|
+
pageCount: number;
|
|
75
|
+
pageSize: number;
|
|
76
|
+
rowCount: number;
|
|
77
|
+
pageSizes: number[];
|
|
78
|
+
pageSizeOptions: {
|
|
79
|
+
label: string;
|
|
80
|
+
value: number;
|
|
81
|
+
}[];
|
|
82
|
+
showPageSizeSelect: boolean;
|
|
83
|
+
setPage: (page: number) => void;
|
|
84
|
+
setPageSize: (pageSize: unknown) => void;
|
|
85
|
+
}): VNode[];
|
|
86
|
+
}
|
|
87
|
+
export type { TableData };
|
|
File without changes
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
1
|
+
export * from './api';
|
|
2
|
+
export * from './auto-form';
|
|
3
|
+
export * from './components';
|
|
4
|
+
export * from './data-table';
|
|
5
|
+
export * from './shared';
|
|
6
|
+
export type { AnyCalendarDate, Calendar, CalendarDate, CalendarDateTime, DateDuration, DateFields, DateFormatter, DateFormatterOptions, DateRange, DateValue, Time, ZonedDateTime } from '../composables/useDateFormatter';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
1
|
+
export * from "./api/index.js";
|
|
2
|
+
export * from "./auto-form/index.js";
|
|
3
|
+
export * from "./components/index.js";
|
|
4
|
+
export * from "./data-table/index.js";
|
|
5
|
+
export * from "./shared.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ClassValue } from 'tailwind-variants';
|
|
2
|
+
export type ClassNameValue = ClassValue;
|
|
3
|
+
export type ClassNameArray = ClassNameValue[];
|
|
4
|
+
export type SemanticSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
5
|
+
export type SemanticColor = 'primary' | 'info' | 'success' | 'warning' | 'error' | 'neutral';
|
|
File without changes
|