@movk/nuxt 1.2.0 → 1.3.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/.nuxt/movk-ui.css +3 -0
- package/README.md +74 -79
- package/dist/module.d.mts +57 -1
- package/dist/module.json +2 -2
- package/dist/module.mjs +120 -126
- package/dist/runtime/components/AutoForm.d.vue.ts +10 -30
- package/dist/runtime/components/AutoForm.vue +119 -125
- package/dist/runtime/components/AutoForm.vue.d.ts +10 -30
- package/dist/runtime/components/ColorChooser.d.vue.ts +21 -22
- package/dist/runtime/components/ColorChooser.vue +304 -27
- package/dist/runtime/components/ColorChooser.vue.d.ts +21 -22
- 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 +20 -33
- package/dist/runtime/components/DatePicker.vue +173 -65
- package/dist/runtime/components/DatePicker.vue.d.ts +20 -33
- 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 +21 -149
- package/dist/runtime/components/SearchForm.vue +211 -153
- package/dist/runtime/components/SearchForm.vue.d.ts +21 -149
- package/dist/runtime/components/SlideVerify.d.vue.ts +31 -70
- package/dist/runtime/components/SlideVerify.vue +117 -90
- package/dist/runtime/components/SlideVerify.vue.d.ts +31 -70
- package/dist/runtime/components/StarRating.d.vue.ts +38 -87
- package/dist/runtime/components/StarRating.vue +118 -74
- package/dist/runtime/components/StarRating.vue.d.ts +38 -87
- package/dist/runtime/components/input/AsPhoneNumberInput.d.vue.ts +11 -15
- package/dist/runtime/components/input/AsPhoneNumberInput.vue +22 -9
- package/dist/runtime/components/input/AsPhoneNumberInput.vue.d.ts +11 -15
- package/dist/runtime/components/input/WithCharacterLimit.d.vue.ts +11 -13
- package/dist/runtime/components/input/WithCharacterLimit.vue +23 -11
- package/dist/runtime/components/input/WithCharacterLimit.vue.d.ts +11 -13
- package/dist/runtime/components/input/WithClear.d.vue.ts +13 -11
- package/dist/runtime/components/input/WithClear.vue +27 -8
- package/dist/runtime/components/input/WithClear.vue.d.ts +13 -11
- package/dist/runtime/components/input/WithCopy.d.vue.ts +13 -13
- package/dist/runtime/components/input/WithCopy.vue +25 -8
- package/dist/runtime/components/input/WithCopy.vue.d.ts +13 -13
- package/dist/runtime/components/input/WithFloatingLabel.d.vue.ts +13 -16
- package/dist/runtime/components/input/WithFloatingLabel.vue +35 -27
- package/dist/runtime/components/input/WithFloatingLabel.vue.d.ts +13 -16
- package/dist/runtime/components/input/WithPasswordToggle.d.vue.ts +11 -7
- package/dist/runtime/components/input/WithPasswordToggle.vue +24 -7
- package/dist/runtime/components/input/WithPasswordToggle.vue.d.ts +11 -7
- package/dist/runtime/components/theme-picker/ThemePicker.d.vue.ts +8 -1
- package/dist/runtime/components/theme-picker/ThemePicker.vue +27 -12
- package/dist/runtime/components/theme-picker/ThemePicker.vue.d.ts +8 -1
- package/dist/runtime/components/theme-picker/ThemePickerButton.d.vue.ts +9 -4
- package/dist/runtime/components/theme-picker/ThemePickerButton.vue +4 -0
- package/dist/runtime/components/theme-picker/ThemePickerButton.vue.d.ts +9 -4
- package/dist/runtime/composables/index.d.ts +9 -8
- package/dist/runtime/composables/index.js +1 -0
- package/dist/runtime/composables/useApiFetch.d.ts +10 -5
- package/dist/runtime/composables/useApiFetch.js +20 -2
- package/dist/runtime/composables/useAutoForm.d.ts +4 -4
- package/dist/runtime/composables/useAutoForm.js +23 -9
- package/dist/runtime/composables/useClientApiFetch.d.ts +3 -2
- package/dist/runtime/composables/useDateFormatter.d.ts +16 -3
- package/dist/runtime/composables/useDateFormatter.js +96 -35
- package/dist/runtime/composables/useDownloadWithProgress.d.ts +26 -27
- package/dist/runtime/composables/useDownloadWithProgress.js +142 -40
- package/dist/runtime/composables/useLazyApiFetch.d.ts +3 -2
- package/dist/runtime/composables/useMessageBox.d.ts +6 -0
- package/dist/runtime/composables/useMessageBox.js +16 -0
- package/dist/runtime/composables/useTheme.d.ts +26 -14
- package/dist/runtime/composables/useTheme.js +98 -71
- package/dist/runtime/composables/useUploadWithProgress.d.ts +23 -29
- package/dist/runtime/composables/useUploadWithProgress.js +78 -67
- 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} +25 -29
- 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/{components/auto-form-renderer/AutoFormRendererChildren.vue → domains/auto-form/components/Children.vue} +18 -18
- 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/{components/auto-form-renderer/AutoFormRendererLayout.vue → domains/auto-form/components/Layout.vue} +24 -25
- 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/{components/auto-form-renderer/AutoFormRendererNested.vue → domains/auto-form/components/Nested.vue} +17 -21
- package/dist/runtime/domains/auto-form/components/Nested.vue.d.ts +11 -0
- package/dist/runtime/domains/auto-form/controls.d.ts +681 -0
- package/dist/runtime/{auto-form → domains/auto-form}/controls.js +28 -24
- package/dist/runtime/{auto-form/field-utils.d.ts → domains/auto-form/fields.d.ts} +3 -1
- package/dist/runtime/{auto-form/field-utils.js → domains/auto-form/fields.js} +18 -2
- package/dist/runtime/{auto-form → domains/auto-form}/metadata.js +1 -1
- package/dist/runtime/domains/auto-form/provider.d.ts +62 -0
- package/dist/runtime/{auto-form → domains/auto-form}/provider.js +9 -5
- package/dist/runtime/{auto-form/reactive-utils.d.ts → domains/auto-form/reactive.d.ts} +5 -5
- package/dist/runtime/{auto-form/reactive-utils.js → domains/auto-form/reactive.js} +1 -1
- package/dist/runtime/{auto-form/schema-introspector.d.ts → domains/auto-form/schema.d.ts} +7 -2
- package/dist/runtime/{auto-form/schema-introspector.js → domains/auto-form/schema.js} +14 -1
- 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 +196 -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 +68 -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 +17 -117
- package/dist/runtime/plugins/theme.js +49 -27
- 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/response.js +0 -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 +11 -10
- 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 +2 -5
- package/dist/runtime/utils/meta.js +1 -3
- 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 +75 -37
- package/vue-plugin.d.ts +5 -0
- package/dist/runtime/auto-form/controls.d.ts +0 -221
- package/dist/runtime/auto-form/provider.d.ts +0 -27
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.d.vue.ts +0 -28
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.vue.d.ts +0 -28
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererChildren.d.vue.ts +0 -26
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererChildren.vue.d.ts +0 -26
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.d.vue.ts +0 -26
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue +0 -55
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue.d.ts +0 -26
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.d.vue.ts +0 -26
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.vue.d.ts +0 -26
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.d.vue.ts +0 -26
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.vue.d.ts +0 -26
- package/dist/runtime/constants/api-defaults.d.ts +0 -9
- package/dist/runtime/constants/api-defaults.js +0 -32
- package/dist/runtime/constants/grid-cols.d.ts +0 -7
- package/dist/runtime/constants/grid-cols.js +0 -44
- package/dist/runtime/style.css +0 -1
- package/dist/runtime/types/api.d.ts +0 -349
- package/dist/runtime/types/auto-form.d.ts +0 -259
- package/dist/runtime/types/module.d.ts +0 -96
- package/dist/runtime/types/theme.d.ts +0 -2
- package/dist/runtime/utils/api-utils.d.ts +0 -58
- package/dist/runtime/utils/api-utils.js +0 -98
- /package/dist/runtime/{constants/auto-form.d.ts → domains/auto-form/constants.d.ts} +0 -0
- /package/dist/runtime/{constants/auto-form.js → domains/auto-form/constants.js} +0 -0
- /package/dist/runtime/{auto-form → domains/auto-form}/metadata.d.ts +0 -0
- /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.js → api/fetch.js} +0 -0
- /package/dist/runtime/types/{module.js → api/index.js} +0 -0
- /package/dist/runtime/types/{theme.js → api/module.js} +0 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { FormError } from '@nuxt/ui';
|
|
3
|
+
import type { ArrayFieldKeys, NonObjectFieldKeys, ObjectFieldKeys } from '@movk/core';
|
|
4
|
+
import type { AutoFormFieldContext, AutoFormFieldSlots } from './fields';
|
|
5
|
+
import type { AutoFormMergeMeta } from './controls';
|
|
6
|
+
import type { VNode } from 'vue';
|
|
7
|
+
export interface AutoFormField {
|
|
8
|
+
path: string;
|
|
9
|
+
schema: z.ZodType;
|
|
10
|
+
meta: AutoFormMergeMeta;
|
|
11
|
+
decorators: {
|
|
12
|
+
isOptional?: boolean;
|
|
13
|
+
isReadonly?: boolean;
|
|
14
|
+
defaultValue?: unknown;
|
|
15
|
+
description?: string;
|
|
16
|
+
};
|
|
17
|
+
children?: AutoFormField[];
|
|
18
|
+
arrayElement?: AutoFormField;
|
|
19
|
+
}
|
|
20
|
+
export interface AutoFormSlotProps<T extends object> {
|
|
21
|
+
errors: FormError[];
|
|
22
|
+
loading: boolean;
|
|
23
|
+
fields: AutoFormField[];
|
|
24
|
+
state: T;
|
|
25
|
+
}
|
|
26
|
+
/** 插槽附加 props 查找表 */
|
|
27
|
+
type SlotExtraPropsMap = {
|
|
28
|
+
label: {
|
|
29
|
+
label?: string;
|
|
30
|
+
};
|
|
31
|
+
hint: {
|
|
32
|
+
hint?: string;
|
|
33
|
+
};
|
|
34
|
+
description: {
|
|
35
|
+
description?: string;
|
|
36
|
+
};
|
|
37
|
+
help: {
|
|
38
|
+
help?: string;
|
|
39
|
+
};
|
|
40
|
+
error: {
|
|
41
|
+
error?: boolean | string;
|
|
42
|
+
};
|
|
43
|
+
default: {
|
|
44
|
+
error?: boolean | string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
type _FormGenericSlots<T> = {
|
|
48
|
+
[K in keyof AutoFormFieldSlots as `field-${K}`]: (props: SlotExtraPropsMap[K] & AutoFormFieldContext<T>) => VNode[];
|
|
49
|
+
};
|
|
50
|
+
type _FieldPath<T> = string & (NonObjectFieldKeys<T> | ObjectFieldKeys<T>);
|
|
51
|
+
type _NestedPath<T> = string & (ObjectFieldKeys<T> | ArrayFieldKeys<T>);
|
|
52
|
+
type _SlotEntry = {
|
|
53
|
+
key: PropertyKey;
|
|
54
|
+
props: unknown;
|
|
55
|
+
};
|
|
56
|
+
type _EntryToSlots<E extends _SlotEntry> = {
|
|
57
|
+
[Entry in E as Entry['key']]: (props: Entry['props']) => VNode[];
|
|
58
|
+
};
|
|
59
|
+
type _FormKeyedSlotEntry<T> = {
|
|
60
|
+
[K in keyof AutoFormFieldSlots]: {
|
|
61
|
+
[P in _FieldPath<T>]: {
|
|
62
|
+
key: `field-${K}:${P}`;
|
|
63
|
+
props: SlotExtraPropsMap[K] & AutoFormFieldContext<T, P>;
|
|
64
|
+
};
|
|
65
|
+
}[_FieldPath<T>];
|
|
66
|
+
}[keyof AutoFormFieldSlots];
|
|
67
|
+
type _NestedSlotName = 'content' | 'before' | 'after';
|
|
68
|
+
type _FormNestedSlotEntry<T> = {
|
|
69
|
+
[P in _NestedPath<T>]: {
|
|
70
|
+
key: `field-${_NestedSlotName}:${P}`;
|
|
71
|
+
props: AutoFormFieldContext<T, P>;
|
|
72
|
+
};
|
|
73
|
+
}[_NestedPath<T>];
|
|
74
|
+
type _FormKeyedSlots<T> = _EntryToSlots<_FormKeyedSlotEntry<T>>;
|
|
75
|
+
type _FormNestedSlots<T> = _EntryToSlots<_FormNestedSlotEntry<T>>;
|
|
76
|
+
/**
|
|
77
|
+
* 动态表单插槽类型
|
|
78
|
+
*
|
|
79
|
+
* 插槽命名:
|
|
80
|
+
* - 通用:`field-{slotType}`
|
|
81
|
+
* - 字段:`field-{slotType}:{fieldKey}` — 精确推导字段类型
|
|
82
|
+
* - 嵌套:`field-{content|before|after}:{objectKey|arrayKey}`
|
|
83
|
+
*/
|
|
84
|
+
export type DynamicFormSlots<T> = _FormGenericSlots<T> & _FormKeyedSlots<T> & _FormNestedSlots<T>;
|
|
85
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { DateRange } from 'reka-ui';
|
|
3
|
+
import type { CalendarDate, DateValue, Time } from '@internationalized/date';
|
|
4
|
+
import type { ComponentProps, ComponentSlots, IsAny, IsComponent, KnownKeys, OmitByKey, Prettify, ReactiveValue, UnionToIntersection, WidenLiteral } from '@movk/core';
|
|
5
|
+
import type { AutoFormFieldContext } from './fields';
|
|
6
|
+
import type { AutoFormControl, AutoFormControls, AutoFormControlsMeta, _Unset, AutoFormLayoutConfig } from './controls';
|
|
7
|
+
import type { AUTOFORM_META } from '../../domains/auto-form/constants';
|
|
8
|
+
interface LayoutFieldMarker<Fields extends Record<string, z.ZodType>> extends z.ZodType<AutoFormLayoutConfig, any, any> {
|
|
9
|
+
__brand: typeof AUTOFORM_META.LAYOUT_KEY;
|
|
10
|
+
fields: Fields;
|
|
11
|
+
}
|
|
12
|
+
type LayoutRestShape<S extends Record<string, any>> = {
|
|
13
|
+
[P in keyof S as S[P] extends LayoutFieldMarker<any> ? never : P]: S[P];
|
|
14
|
+
};
|
|
15
|
+
type LayoutFieldShape<S extends Record<string, any>> = UnionToIntersection<{
|
|
16
|
+
[P in keyof S]: S[P] extends LayoutFieldMarker<infer Fields> ? ExtractLayoutShape<Fields> : {};
|
|
17
|
+
}[keyof S]>;
|
|
18
|
+
type _HasLayoutMarker<S> = {
|
|
19
|
+
[P in keyof S]: S[P] extends LayoutFieldMarker<any> ? true : never;
|
|
20
|
+
}[keyof S] extends never ? false : true;
|
|
21
|
+
type ExtractLayoutShape<S extends Record<string, any>> = _HasLayoutMarker<S> extends true ? LayoutRestShape<S> & LayoutFieldShape<S> : S;
|
|
22
|
+
type StrictComponentProps<C extends IsComponent> = {
|
|
23
|
+
[K in keyof ComponentProps<C> as {} extends Record<K, unknown> ? never : K]: ComponentProps<C>[K];
|
|
24
|
+
};
|
|
25
|
+
type StrictComponentSlots<C extends IsComponent> = IsAny<ComponentSlots<C>> extends true ? {} : ComponentSlots<C>;
|
|
26
|
+
type ControlKey<TControls extends AutoFormControls> = Extract<KnownKeys<TControls>, string>;
|
|
27
|
+
type ControlEntryByKey<TControls extends AutoFormControls, K extends string> = K extends keyof TControls ? TControls[K] : never;
|
|
28
|
+
type _WidenForFactory<T> = {
|
|
29
|
+
[K in keyof T]+?: WidenLiteral<T[K]>;
|
|
30
|
+
};
|
|
31
|
+
type _IsUnsetLike<P> = [P] extends [_Unset] ? true : IsAny<P> extends true ? true : [unknown] extends [P] ? true : [keyof P] extends [never] ? true : false;
|
|
32
|
+
type ResolveControlProps<C extends IsComponent, P> = _IsUnsetLike<P> extends true ? StrictComponentProps<C> : Prettify<_WidenForFactory<P> & {}>;
|
|
33
|
+
type ExtractControlProps<T> = T extends AutoFormControl<infer C, infer P, any> ? ResolveControlProps<C, P> : T extends {
|
|
34
|
+
component: infer C extends IsComponent;
|
|
35
|
+
} ? StrictComponentProps<C> : {};
|
|
36
|
+
type ResolveControlSlots<C extends IsComponent, S> = _IsUnsetLike<S> extends true ? StrictComponentSlots<C> : S;
|
|
37
|
+
type ExtractControlSlots<T> = T extends AutoFormControl<infer C, any, infer S> ? ResolveControlSlots<C, S> : T extends {
|
|
38
|
+
component: infer C extends IsComponent;
|
|
39
|
+
} ? StrictComponentSlots<C> : {};
|
|
40
|
+
type FallbackToRecordIfEmpty<T> = [keyof T] extends [never] ? Record<string, unknown> : Prettify<T & {}>;
|
|
41
|
+
type ControlPropsByKey<TControls extends AutoFormControls, K extends ControlKey<TControls>> = FallbackToRecordIfEmpty<ExtractControlProps<ControlEntryByKey<TControls, K>>>;
|
|
42
|
+
type ControlSlotsByKey<TControls extends AutoFormControls, K extends ControlKey<TControls>> = Partial<ExtractControlSlots<ControlEntryByKey<TControls, K>>>;
|
|
43
|
+
type MetaPropsFor<TControls extends AutoFormControls, K extends ControlKey<TControls>> = {
|
|
44
|
+
controlProps?: ReactiveValue<ControlPropsByKey<TControls, K>, AutoFormFieldContext>;
|
|
45
|
+
controlSlots?: ReactiveValue<ControlSlotsByKey<TControls, K>, AutoFormFieldContext> | Record<string, unknown>;
|
|
46
|
+
error?: string;
|
|
47
|
+
};
|
|
48
|
+
type MetaByControlKey<TControls extends AutoFormControls, K extends ControlKey<TControls>> = {
|
|
49
|
+
type: K;
|
|
50
|
+
component?: never;
|
|
51
|
+
} & MetaPropsFor<TControls, K>;
|
|
52
|
+
type MetaByComponent<C extends IsComponent> = {
|
|
53
|
+
component: C;
|
|
54
|
+
type?: never;
|
|
55
|
+
} & OmitByKey<AutoFormControlsMeta<C>, 'component' | 'type'>;
|
|
56
|
+
type MetaByDefaultIfExists<TControls extends AutoFormControls, TDefaultKey extends string> = TDefaultKey extends ControlKey<TControls> ? {
|
|
57
|
+
component?: never;
|
|
58
|
+
type?: never;
|
|
59
|
+
} & MetaPropsFor<TControls, TDefaultKey> : never;
|
|
60
|
+
type AutoFormFactoryMethod<TControls extends AutoFormControls, TResult, TDefaultKey extends string, TExtraArgs extends unknown[] = []> = _FactoryMetaOverloads<TControls, TResult, TDefaultKey, TExtraArgs> & {
|
|
61
|
+
(...args: [...TExtraArgs, string?]): TResult;
|
|
62
|
+
};
|
|
63
|
+
type _FactoryMetaOverloads<TControls extends AutoFormControls, TResult, TDefaultKey extends string, TExtraArgs extends unknown[] = []> = {
|
|
64
|
+
<K extends ControlKey<TControls>>(...args: [...TExtraArgs, MetaByControlKey<TControls, K>]): TResult;
|
|
65
|
+
(...args: [...TExtraArgs, MetaByDefaultIfExists<TControls, TDefaultKey>]): TResult;
|
|
66
|
+
<C extends IsComponent>(...args: [...TExtraArgs, MetaByComponent<C>]): TResult;
|
|
67
|
+
};
|
|
68
|
+
type EnumValues = readonly string[] | z.core.util.EnumLike;
|
|
69
|
+
type EnumFactoryResult<T extends EnumValues> = T extends readonly [] ? z.ZodString : T extends readonly [string, ...string[]] ? z.ZodEnum<z.core.util.ToEnum<T[number]>> : T extends readonly string[] ? z.ZodEnum<z.core.util.ToEnum<T[number]>> : T extends z.core.util.EnumLike ? z.ZodEnum<T> : z.ZodString;
|
|
70
|
+
type EnumFactory<TControls extends AutoFormControls> = {
|
|
71
|
+
<const T extends EnumValues, K extends ControlKey<TControls>>(values: T, overwrite?: MetaByControlKey<TControls, K>): EnumFactoryResult<T>;
|
|
72
|
+
<const T extends EnumValues>(values: T, overwrite: MetaByDefaultIfExists<TControls, 'enum'>): EnumFactoryResult<T>;
|
|
73
|
+
<const T extends EnumValues, C extends IsComponent>(values: T, overwrite: MetaByComponent<C>): EnumFactoryResult<T>;
|
|
74
|
+
};
|
|
75
|
+
type CalendarDateFactory<TControls extends AutoFormControls> = {
|
|
76
|
+
<T extends DateValue | DateRange | DateValue[] = CalendarDate, K extends ControlKey<TControls> = ControlKey<TControls>>(meta?: MetaByControlKey<TControls, K>): z.ZodType<T>;
|
|
77
|
+
<T extends DateValue | DateRange | DateValue[] = CalendarDate>(meta: MetaByDefaultIfExists<TControls, 'calendarDate'>): z.ZodType<T>;
|
|
78
|
+
<C extends IsComponent, T extends DateValue | DateRange | DateValue[] = CalendarDate>(meta: MetaByComponent<C>): z.ZodType<T>;
|
|
79
|
+
};
|
|
80
|
+
type ArrayFactory<TControls extends AutoFormControls> = {
|
|
81
|
+
<T extends z.ZodType, K extends ControlKey<TControls>>(schema: T, overwrite?: MetaByControlKey<TControls, K>): z.ZodArray<T>;
|
|
82
|
+
<T extends z.ZodType>(schema: T, overwrite: MetaByDefaultIfExists<TControls, 'array'>): z.ZodArray<T>;
|
|
83
|
+
<T extends z.ZodType, C extends IsComponent>(schema: T, overwrite: MetaByComponent<C>): z.ZodArray<T>;
|
|
84
|
+
};
|
|
85
|
+
type TupleFactory<TControls extends AutoFormControls> = {
|
|
86
|
+
<T extends readonly [z.ZodType, ...z.ZodType[]], K extends ControlKey<TControls>>(schemas: T, overwrite?: MetaByControlKey<TControls, K>): z.ZodTuple<T>;
|
|
87
|
+
<T extends readonly [z.ZodType, ...z.ZodType[]]>(schemas: T, overwrite: MetaByDefaultIfExists<TControls, 'tuple'>): z.ZodTuple<T>;
|
|
88
|
+
<T extends readonly [z.ZodType, ...z.ZodType[]], C extends IsComponent>(schemas: T, overwrite: MetaByComponent<C>): z.ZodTuple<T>;
|
|
89
|
+
};
|
|
90
|
+
type ObjectFactoryResult<S extends Record<string, z.ZodType>, Mode extends z.core.$strip | z.core.$loose | z.core.$strict> = z.ZodObject<ExtractLayoutShape<S>, Mode>;
|
|
91
|
+
/** 对象工厂重载 */
|
|
92
|
+
type ObjectFactoryOverloads<TControls extends AutoFormControls, Mode extends z.core.$strip | z.core.$loose | z.core.$strict, TDefaultKey extends string, ShapeConstraint = {}> = {
|
|
93
|
+
<S extends Record<string, z.ZodType>, K extends ControlKey<TControls>>(shape: S & ShapeConstraint, meta?: MetaByControlKey<TControls, K>): ObjectFactoryResult<S, Mode>;
|
|
94
|
+
<S extends Record<string, z.ZodType>>(shape: S & ShapeConstraint, meta: MetaByDefaultIfExists<TControls, TDefaultKey>): ObjectFactoryResult<S, Mode>;
|
|
95
|
+
<S extends Record<string, z.ZodType>, C extends IsComponent>(shape: S & ShapeConstraint, meta: MetaByComponent<C>): ObjectFactoryResult<S, Mode>;
|
|
96
|
+
};
|
|
97
|
+
export interface TypedZodFactory<TControls extends AutoFormControls> {
|
|
98
|
+
string: AutoFormFactoryMethod<TControls, z.ZodString, 'string'>;
|
|
99
|
+
number: AutoFormFactoryMethod<TControls, z.ZodNumber, 'number'>;
|
|
100
|
+
boolean: AutoFormFactoryMethod<TControls, z.ZodBoolean, 'boolean'>;
|
|
101
|
+
file: AutoFormFactoryMethod<TControls, z.ZodType<File>, 'file'>;
|
|
102
|
+
email: AutoFormFactoryMethod<TControls, z.ZodString, 'string'>;
|
|
103
|
+
url: AutoFormFactoryMethod<TControls, z.ZodString, 'string'>;
|
|
104
|
+
uuid: AutoFormFactoryMethod<TControls, z.ZodString, 'string'>;
|
|
105
|
+
enum: EnumFactory<TControls>;
|
|
106
|
+
calendarDate: CalendarDateFactory<TControls>;
|
|
107
|
+
inputDate: AutoFormFactoryMethod<TControls, z.ZodType<CalendarDate>, 'inputDate'>;
|
|
108
|
+
inputTime: AutoFormFactoryMethod<TControls, z.ZodType<Time>, 'inputTime'>;
|
|
109
|
+
isoDatetime: AutoFormFactoryMethod<TControls, z.ZodType<string>, 'string'>;
|
|
110
|
+
isoDate: AutoFormFactoryMethod<TControls, z.ZodType<string>, 'string'>;
|
|
111
|
+
isoTime: AutoFormFactoryMethod<TControls, z.ZodType<string>, 'string'>;
|
|
112
|
+
array: ArrayFactory<TControls>;
|
|
113
|
+
tuple: TupleFactory<TControls>;
|
|
114
|
+
layout: <C extends IsComponent = IsComponent, Fields extends Record<string, z.ZodType> = Record<string, z.ZodType>>(config: Omit<AutoFormLayoutConfig<C>, 'fields'> & {
|
|
115
|
+
fields: Fields;
|
|
116
|
+
}) => LayoutFieldMarker<Fields>;
|
|
117
|
+
object: {
|
|
118
|
+
<T extends object>(): ObjectFactoryOverloads<TControls, z.core.$strip, 'object', Partial<Record<Extract<keyof T, string>, z.ZodType>>>;
|
|
119
|
+
} & ObjectFactoryOverloads<TControls, z.core.$strip, 'object'>;
|
|
120
|
+
looseObject: {
|
|
121
|
+
<T extends object>(): ObjectFactoryOverloads<TControls, z.core.$loose, 'looseObject', Partial<Record<Extract<keyof T, string>, z.ZodType>>>;
|
|
122
|
+
} & ObjectFactoryOverloads<TControls, z.core.$loose, 'looseObject'>;
|
|
123
|
+
strictObject: {
|
|
124
|
+
<T extends object>(): ObjectFactoryOverloads<TControls, z.core.$strict, 'strictObject', Partial<Record<Extract<keyof T, string>, z.ZodType>>>;
|
|
125
|
+
} & ObjectFactoryOverloads<TControls, z.core.$strict, 'strictObject'>;
|
|
126
|
+
}
|
|
127
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { VNode } from 'vue';
|
|
2
|
+
import type { ButtonProps, ColorPickerProps, IconProps, PopoverProps } from '@nuxt/ui';
|
|
3
|
+
import type { OmitByKey } from '@movk/core';
|
|
4
|
+
import type { ClassNameValue } from '../shared';
|
|
5
|
+
type PopoverMode = 'click' | 'hover';
|
|
6
|
+
export type ColorFormat = NonNullable<ColorPickerProps['format']>;
|
|
7
|
+
export type ColorChooserTrigger = 'button' | 'chip' | 'input';
|
|
8
|
+
export interface ColorChooserProps<M extends PopoverMode = PopoverMode> extends /** @vue-ignore */ OmitByKey<PopoverProps<M>, 'open' | 'defaultOpen' | 'ui'> {
|
|
9
|
+
id?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
/**
|
|
12
|
+
* 当前激活的颜色格式。
|
|
13
|
+
* @defaultValue 'hex'
|
|
14
|
+
*/
|
|
15
|
+
format?: ColorFormat;
|
|
16
|
+
/**
|
|
17
|
+
* 启用的颜色格式 tab 列表,长度 >= 2 时在 popover 顶部渲染切换器。
|
|
18
|
+
* 仅一项时不渲染 tab,等价于 `format`。
|
|
19
|
+
* @defaultValue ['hex']
|
|
20
|
+
*/
|
|
21
|
+
formats?: ColorFormat[];
|
|
22
|
+
/**
|
|
23
|
+
* 预设色板。
|
|
24
|
+
* 一维数组渲染为单行,二维数组渲染为多行分组。
|
|
25
|
+
*/
|
|
26
|
+
swatches?: string[] | string[][];
|
|
27
|
+
/**
|
|
28
|
+
* 点击预设色后是否自动关闭弹层。
|
|
29
|
+
* @defaultValue true
|
|
30
|
+
*/
|
|
31
|
+
closeOnSwatch?: boolean;
|
|
32
|
+
/** 是否在底部 actions 区显示清除按钮。 */
|
|
33
|
+
clearable?: boolean;
|
|
34
|
+
/** actions 区显示复制按钮(基于 navigator.clipboard)。 */
|
|
35
|
+
copyable?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 触发器形态。
|
|
38
|
+
* - `button`:色点 + 色值 / label 的常规按钮(默认)
|
|
39
|
+
* - `chip`:仅一个圆形色点
|
|
40
|
+
* - `input`:色点 leading + 可输入色值文本框
|
|
41
|
+
* @defaultValue 'button'
|
|
42
|
+
*/
|
|
43
|
+
trigger?: ColorChooserTrigger;
|
|
44
|
+
/** `trigger='button'` 时按钮上的文本,未传则显示当前色值。 */
|
|
45
|
+
label?: string;
|
|
46
|
+
/**
|
|
47
|
+
* 未选中颜色时的占位文案。
|
|
48
|
+
* @defaultValue '选择颜色'
|
|
49
|
+
*/
|
|
50
|
+
placeholder?: string;
|
|
51
|
+
/**
|
|
52
|
+
* 触发器尺寸,同时驱动主题 size variant。
|
|
53
|
+
* @defaultValue 'md'
|
|
54
|
+
*/
|
|
55
|
+
size?: ButtonProps['size'];
|
|
56
|
+
/** 触发按钮的颜色(trigger=button|chip 生效)。 */
|
|
57
|
+
color?: ButtonProps['color'];
|
|
58
|
+
/**
|
|
59
|
+
* 触发按钮的视觉变体(trigger=button|chip 生效)。
|
|
60
|
+
* @defaultValue 'subtle'
|
|
61
|
+
*/
|
|
62
|
+
variant?: ButtonProps['variant'];
|
|
63
|
+
/** 是否禁用。禁用时弹层不会打开、所有交互失效。 */
|
|
64
|
+
disabled?: boolean;
|
|
65
|
+
/** Highlight the ring color like a focus state. */
|
|
66
|
+
highlight?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* 未选中颜色时占位的图标。
|
|
69
|
+
* @IconifyIcon
|
|
70
|
+
* @defaultValue 'i-lucide-palette'
|
|
71
|
+
*/
|
|
72
|
+
icon?: IconProps['name'];
|
|
73
|
+
/**
|
|
74
|
+
* 透传给 `UColorPicker` 的属性。
|
|
75
|
+
* `modelValue`、`format`、`disabled` 由组件内部托管。
|
|
76
|
+
*/
|
|
77
|
+
colorPickerProps?: Omit<ColorPickerProps, 'modelValue' | 'format' | 'disabled'>;
|
|
78
|
+
ui?: Record<string, ClassNameValue>;
|
|
79
|
+
}
|
|
80
|
+
export interface ColorChooserEmits {
|
|
81
|
+
'update:modelValue': [value: string | undefined];
|
|
82
|
+
'update:open': [open: boolean];
|
|
83
|
+
'change': [value: string | undefined];
|
|
84
|
+
'clear': [];
|
|
85
|
+
'copy': [value: string];
|
|
86
|
+
'format-change': [format: ColorFormat];
|
|
87
|
+
}
|
|
88
|
+
export interface ColorChooserSlots {
|
|
89
|
+
default?(props: {
|
|
90
|
+
open: boolean;
|
|
91
|
+
value: string | undefined;
|
|
92
|
+
}): VNode[];
|
|
93
|
+
leading?(props: {
|
|
94
|
+
value: string | undefined;
|
|
95
|
+
}): VNode[];
|
|
96
|
+
trailing?(props: {
|
|
97
|
+
value: string | undefined;
|
|
98
|
+
}): VNode[];
|
|
99
|
+
swatches?(props: {
|
|
100
|
+
swatches: string[][];
|
|
101
|
+
select: (color: string) => void;
|
|
102
|
+
}): VNode[];
|
|
103
|
+
actions?(props: {
|
|
104
|
+
value: string | undefined;
|
|
105
|
+
copy: () => void;
|
|
106
|
+
clear: () => void;
|
|
107
|
+
}): VNode[];
|
|
108
|
+
}
|
|
109
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ButtonProps, ButtonSlots, CalendarEmits, CalendarProps, CalendarSlots, PopoverEmits, PopoverProps, PopoverSlots } from '@nuxt/ui';
|
|
2
|
+
import type { OmitByKey } from '@movk/core';
|
|
3
|
+
import type { DateValue } from '@internationalized/date';
|
|
4
|
+
import type { DateFormatter, DateFormatterOptions, ValueFormat } from '../../composables/useDateFormatter';
|
|
5
|
+
import type { ClassNameValue } from '../shared';
|
|
6
|
+
export type { ValueFormat } from '../../composables/useDateFormatter';
|
|
7
|
+
export type LabelFormat = 'iso' | 'formatted' | 'date' | 'timestamp' | 'unix';
|
|
8
|
+
export type DatePickerLabelFormatter<R extends boolean, M extends boolean> = (formatter: DateFormatter, modelValue: CalendarProps<R, M>['modelValue']) => string;
|
|
9
|
+
type PopoverMode = 'click' | 'hover';
|
|
10
|
+
type FormattedSingle<V extends ValueFormat> = V extends 'date-value' ? DateValue : V extends 'iso' ? string : V extends 'timestamp' ? number : V extends 'unix' ? number : V extends 'date' ? Date : never;
|
|
11
|
+
export type FormattedValue<R extends boolean, M extends boolean, V extends ValueFormat> = M extends true ? FormattedSingle<V>[] : R extends true ? {
|
|
12
|
+
start: FormattedSingle<V> | undefined;
|
|
13
|
+
end: FormattedSingle<V> | undefined;
|
|
14
|
+
} | undefined : FormattedSingle<V> | undefined;
|
|
15
|
+
export interface DatePickerPreset<R extends boolean, M extends boolean> {
|
|
16
|
+
label: string;
|
|
17
|
+
value: CalendarProps<R, M>['modelValue'] | ((formatter: DateFormatter) => CalendarProps<R, M>['modelValue']);
|
|
18
|
+
}
|
|
19
|
+
export interface DatePickerProps<R extends boolean, M extends boolean, P extends PopoverMode = PopoverMode, V extends ValueFormat = 'date-value'> extends DateFormatterOptions,
|
|
20
|
+
/** @vue-ignore */ OmitByKey<CalendarProps<R, M>, 'modelValue' | 'placeholder' | 'ui'> {
|
|
21
|
+
id?: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
/** @defaultValue '选择日期' */
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
buttonProps?: ButtonProps;
|
|
26
|
+
popoverProps?: PopoverProps<P>;
|
|
27
|
+
labelFormat?: LabelFormat | DatePickerLabelFormatter<R, M>;
|
|
28
|
+
/**
|
|
29
|
+
* v-model 投影输出格式
|
|
30
|
+
* @defaultValue 'date-value'
|
|
31
|
+
*/
|
|
32
|
+
valueFormat?: V;
|
|
33
|
+
clearable?: boolean;
|
|
34
|
+
/** 快捷预设 */
|
|
35
|
+
presets?: DatePickerPreset<R, M>[] | 'default';
|
|
36
|
+
ui?: Record<string, ClassNameValue>;
|
|
37
|
+
}
|
|
38
|
+
export type DatePickerEmits<R extends boolean, M extends boolean, V extends ValueFormat = 'date-value'> = PopoverEmits & Omit<CalendarEmits<R, M>, 'update:modelValue'> & {
|
|
39
|
+
'update:modelValue': [value: FormattedValue<R, M, V>];
|
|
40
|
+
};
|
|
41
|
+
export type DatePickerSlots<P extends PopoverMode = PopoverMode> = OmitByKey<PopoverSlots<P>, 'anchor'> & CalendarSlots & OmitByKey<ButtonSlots, 'default'>;
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { ColorChooserEmits, ColorChooserProps, ColorChooserSlots, ColorChooserTrigger, ColorFormat } from './color-chooser';
|
|
2
|
+
export type { DatePickerEmits, DatePickerLabelFormatter, DatePickerPreset, DatePickerProps, FormattedValue, LabelFormat, ValueFormat } from './date-picker';
|
|
3
|
+
export type { MessageBoxEmits, MessageBoxProps, MessageBoxSlots } from './message-box';
|
|
4
|
+
export type { PopconfirmEmits, PopconfirmProps, PopconfirmSlots } from './popconfirm';
|
|
5
|
+
export type { SlideVerifyEmits, SlideVerifyProps, SlideVerifySlots } from './slide-verify';
|
|
6
|
+
export type { StarRatingEmits, StarRatingProps } from './star-rating';
|
|
7
|
+
export type { PillGroupEmits, PillGroupProps, PillGroupSlots, PillItem, PillGroupValue, PillSelectPayload } from './pill-group';
|
|
8
|
+
export type { AsPhoneNumberInputProps, WithCharacterLimitProps, WithClearEmits, WithClearProps, WithCopyEmits, WithCopyProps, WithFloatingLabelEmits, WithFloatingLabelProps, WithPasswordToggleProps } from './input';
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { InputProps, InputValue } from '@nuxt/ui';
|
|
2
|
+
import type { OmitByKey } from '@movk/core';
|
|
3
|
+
import type { ClassNameValue } from '../../shared';
|
|
4
|
+
export interface AsPhoneNumberInputProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'type' | 'modelValue' | 'ui'> {
|
|
5
|
+
/**
|
|
6
|
+
* 输入掩码格式,`#` 表示一个数字位。
|
|
7
|
+
* @defaultValue '(###) ###-####'
|
|
8
|
+
*/
|
|
9
|
+
mask?: string;
|
|
10
|
+
/**
|
|
11
|
+
* 区号前缀
|
|
12
|
+
* @defaultValue '+86'
|
|
13
|
+
* @example '+1'、'+44'
|
|
14
|
+
*/
|
|
15
|
+
dialCode?: string;
|
|
16
|
+
ui?: Record<string, ClassNameValue>;
|
|
17
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { AsPhoneNumberInputProps } from './as-phone-number-input';
|
|
2
|
+
export type { WithCharacterLimitProps } from './with-character-limit';
|
|
3
|
+
export type { WithClearEmits, WithClearProps } from './with-clear';
|
|
4
|
+
export type { WithCopyEmits, WithCopyProps } from './with-copy';
|
|
5
|
+
export type { WithFloatingLabelEmits, WithFloatingLabelProps } from './with-floating-label';
|
|
6
|
+
export type { WithPasswordToggleProps } from './with-password-toggle';
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { InputProps, InputValue } from '@nuxt/ui';
|
|
2
|
+
import type { OmitByKey } from '@movk/core';
|
|
3
|
+
import type { ClassNameValue } from '../../shared';
|
|
4
|
+
export interface WithCharacterLimitProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'modelValue' | 'ui'> {
|
|
5
|
+
/**
|
|
6
|
+
* 最大允许输入的字符数
|
|
7
|
+
* @defaultValue 50
|
|
8
|
+
*/
|
|
9
|
+
maxLength?: number;
|
|
10
|
+
ui?: Record<string, ClassNameValue>;
|
|
11
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ButtonProps, InputEmits, InputProps, InputValue } from '@nuxt/ui';
|
|
2
|
+
import type { OmitByKey } from '@movk/core';
|
|
3
|
+
import type { ClassNameValue } from '../../shared';
|
|
4
|
+
export interface WithClearProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'modelValue' | 'ui'> {
|
|
5
|
+
buttonProps?: ButtonProps;
|
|
6
|
+
ui?: Record<string, ClassNameValue>;
|
|
7
|
+
}
|
|
8
|
+
export type WithClearEmits<T extends InputValue = InputValue> = InputEmits<T> & {
|
|
9
|
+
clear: [];
|
|
10
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ButtonProps, InputEmits, InputProps, InputValue, TooltipProps } from '@nuxt/ui';
|
|
2
|
+
import type { OmitByKey } from '@movk/core';
|
|
3
|
+
import type { ClassNameValue } from '../../shared';
|
|
4
|
+
export interface WithCopyProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'modelValue' | 'ui'> {
|
|
5
|
+
buttonProps?: ButtonProps;
|
|
6
|
+
tooltipProps?: TooltipProps;
|
|
7
|
+
ui?: Record<string, ClassNameValue>;
|
|
8
|
+
}
|
|
9
|
+
export type WithCopyEmits<T extends InputValue = InputValue> = InputEmits<T> & {
|
|
10
|
+
copy: [value: string];
|
|
11
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ButtonProps, InputEmits, InputProps, InputValue } from '@nuxt/ui';
|
|
2
|
+
import type { OmitByKey } from '@movk/core';
|
|
3
|
+
import type { ClassNameValue } from '../../shared';
|
|
4
|
+
export interface WithFloatingLabelProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'modelValue' | 'size' | 'ui'> {
|
|
5
|
+
label?: string;
|
|
6
|
+
size?: InputProps<T>['size'];
|
|
7
|
+
clearButtonProps?: ButtonProps;
|
|
8
|
+
ui?: Record<string, ClassNameValue>;
|
|
9
|
+
}
|
|
10
|
+
export type WithFloatingLabelEmits<T extends InputValue = InputValue> = InputEmits<T> & {
|
|
11
|
+
clear: [];
|
|
12
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ButtonProps, InputProps, InputValue } from '@nuxt/ui';
|
|
2
|
+
import type { OmitByKey } from '@movk/core';
|
|
3
|
+
import type { ClassNameValue } from '../../shared';
|
|
4
|
+
export interface WithPasswordToggleProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'type' | 'modelValue' | 'ui'> {
|
|
5
|
+
buttonProps?: ButtonProps;
|
|
6
|
+
ui?: Record<string, ClassNameValue>;
|
|
7
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { ButtonProps, IconProps, ModalProps, ModalSlots } from '@nuxt/ui';
|
|
2
|
+
import type { OmitByKey } from '@movk/core';
|
|
3
|
+
import type { ClassNameValue, SemanticColor } from '../shared';
|
|
4
|
+
export interface MessageBoxProps extends /** @vue-ignore */ OmitByKey<ModalProps, 'title' | 'open' | 'defaultOpen' | 'dismissible' | 'ui'> {
|
|
5
|
+
/**
|
|
6
|
+
* 模态框标题文本。
|
|
7
|
+
* @defaultValue '提示'
|
|
8
|
+
*/
|
|
9
|
+
title?: string;
|
|
10
|
+
/**
|
|
11
|
+
* 控制消息框的语义类型。
|
|
12
|
+
* 会影响默认图标与确认按钮颜色。
|
|
13
|
+
* @defaultValue 'primary'
|
|
14
|
+
*/
|
|
15
|
+
type?: SemanticColor;
|
|
16
|
+
/**
|
|
17
|
+
* 标题前展示的图标名称。
|
|
18
|
+
* @IconifyIcon
|
|
19
|
+
* @defaultValue 'i-lucide-circle-question-mark'
|
|
20
|
+
*/
|
|
21
|
+
icon?: IconProps['name'];
|
|
22
|
+
/**
|
|
23
|
+
* 控制消息框的操作模式。
|
|
24
|
+
* `alert` 仅显示确认按钮,`confirm` 显示取消与确认按钮。
|
|
25
|
+
* @defaultValue 'alert'
|
|
26
|
+
*/
|
|
27
|
+
mode?: 'alert' | 'confirm';
|
|
28
|
+
/**
|
|
29
|
+
* 当 `false` 时,点击遮罩层或按下 `Esc` 键将不会关闭模态框。
|
|
30
|
+
* @defaultValue false
|
|
31
|
+
*/
|
|
32
|
+
dismissible?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* alert 模式下的确认按钮文本。
|
|
35
|
+
* @defaultValue '知道了'
|
|
36
|
+
*/
|
|
37
|
+
alertConfirmLabel?: string;
|
|
38
|
+
/**
|
|
39
|
+
* 确认按钮文本。
|
|
40
|
+
* @defaultValue '确认'
|
|
41
|
+
*/
|
|
42
|
+
confirmLabel?: string;
|
|
43
|
+
/**
|
|
44
|
+
* 取消按钮文本。
|
|
45
|
+
* @defaultValue '取消'
|
|
46
|
+
*/
|
|
47
|
+
cancelLabel?: string;
|
|
48
|
+
/**
|
|
49
|
+
* 透传给确认按钮的属性。
|
|
50
|
+
* 未显式指定 `color` 时会默认继承当前 `type`。
|
|
51
|
+
*/
|
|
52
|
+
confirmButton?: ButtonProps;
|
|
53
|
+
/**
|
|
54
|
+
* 透传给取消按钮的属性。
|
|
55
|
+
* 仅在 `mode='confirm'` 时渲染。
|
|
56
|
+
*/
|
|
57
|
+
cancelButton?: ButtonProps;
|
|
58
|
+
ui?: Record<string, ClassNameValue>;
|
|
59
|
+
}
|
|
60
|
+
export interface MessageBoxEmits {
|
|
61
|
+
/**
|
|
62
|
+
* 模态框关闭时触发。
|
|
63
|
+
* - `true`:用户点击了确认
|
|
64
|
+
* - `false`:用户点击了取消或通过其他方式关闭
|
|
65
|
+
*/
|
|
66
|
+
close: [confirmed: boolean];
|
|
67
|
+
}
|
|
68
|
+
export interface MessageBoxSlots extends ModalSlots {
|
|
69
|
+
}
|
|
File without changes
|