@movk/nuxt 1.2.0 → 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 +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 +114 -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 +89 -30
- 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 -16
- 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 +41 -0
- package/dist/runtime/{auto-form → domains/auto-form}/controls.js +27 -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 +6 -3
- 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} +2 -2
- package/dist/runtime/{auto-form/schema-introspector.js → domains/auto-form/schema.js} +1 -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 +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 +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 -36
- 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
|
@@ -1,29 +1,25 @@
|
|
|
1
|
+
import type { ComponentConfig, InputSlots, InputValue } from '@nuxt/ui';
|
|
1
2
|
import type { OmitByKey } from '@movk/core';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* 输入掩码格式,`#` 表示一个数字位。
|
|
7
|
-
* @defaultValue '(###) ###-####'
|
|
8
|
-
*/
|
|
9
|
-
mask?: string;
|
|
10
|
-
/** 区号前缀,例如 `+86`。 */
|
|
11
|
-
dialCode?: string;
|
|
12
|
-
/** 区号前缀的自定义样式类。 */
|
|
13
|
-
dialCodeClass?: ClassNameValue;
|
|
14
|
-
}
|
|
3
|
+
import theme from '#build/movk-ui/as-phone-number-input';
|
|
4
|
+
import inputTheme from '#build/ui/input';
|
|
5
|
+
import type { AsPhoneNumberInputProps } from '../../types/components/input/as-phone-number-input';
|
|
6
|
+
import type { AppConfig } from 'nuxt/schema';
|
|
15
7
|
declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
16
8
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<(AsPhoneNumberInputProps<T> & {
|
|
9
|
+
ui?: ComponentConfig<typeof inputTheme & typeof theme, AppConfig, "asPhoneNumberInput">["slots"];
|
|
10
|
+
} & {
|
|
17
11
|
modelValue?: T;
|
|
18
12
|
}) & {
|
|
19
|
-
|
|
13
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
14
|
+
onChange?: ((event: Event) => any) | undefined;
|
|
15
|
+
"onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
|
|
20
16
|
}> & (typeof globalThis extends {
|
|
21
17
|
__VLS_PROPS_FALLBACK: infer P;
|
|
22
18
|
} ? P : {});
|
|
23
19
|
expose: (exposed: {}) => void;
|
|
24
20
|
attrs: any;
|
|
25
21
|
slots: OmitByKey<InputSlots, "leading">;
|
|
26
|
-
emit:
|
|
22
|
+
emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: T) => void)) & ((event: "update:modelValue", value: T | undefined) => void);
|
|
27
23
|
}>) => import("vue").VNode & {
|
|
28
24
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
29
25
|
};
|
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { UInput } from "#components";
|
|
3
3
|
import { vMaska } from "maska/vue";
|
|
4
|
+
import { useAppConfig } from "#imports";
|
|
5
|
+
import theme from "#build/movk-ui/as-phone-number-input";
|
|
6
|
+
import inputTheme from "#build/ui/input";
|
|
7
|
+
import { useExtendedTv } from "../../utils/extend-theme";
|
|
8
|
+
import { useForwardedProps } from "../../utils/form-control";
|
|
4
9
|
const props = defineProps({
|
|
5
10
|
mask: { type: String, required: false, default: "(###) ###-####" },
|
|
6
|
-
dialCode: { type: String, required: false },
|
|
7
|
-
|
|
11
|
+
dialCode: { type: String, required: false, default: "+86" },
|
|
12
|
+
ui: { type: Object, required: false }
|
|
8
13
|
});
|
|
9
|
-
const
|
|
14
|
+
const modelValue = defineModel({ type: null });
|
|
15
|
+
const emits = defineEmits(["update:modelValue", "blur", "change"]);
|
|
10
16
|
const slots = defineSlots();
|
|
11
17
|
defineOptions({ inheritAttrs: false });
|
|
12
|
-
const
|
|
18
|
+
const appConfig = useAppConfig();
|
|
19
|
+
const inputProps = useForwardedProps(props, ["ui", "mask", "dialCode", "placeholder", "defaultValue", "modelModifiers"]);
|
|
20
|
+
const { baseUi, extraUi } = useExtendedTv(
|
|
21
|
+
inputTheme,
|
|
22
|
+
theme,
|
|
23
|
+
() => appConfig.movk?.asPhoneNumberInput,
|
|
24
|
+
() => ({ ui: props.ui, variants: { dialCode: !!props.dialCode } })
|
|
25
|
+
);
|
|
13
26
|
</script>
|
|
14
27
|
|
|
15
28
|
<template>
|
|
@@ -19,17 +32,17 @@ const modelValue = defineModel({ type: null });
|
|
|
19
32
|
type="tel"
|
|
20
33
|
:placeholder="props.placeholder ?? props.mask.replaceAll('#', '_')"
|
|
21
34
|
:style="props.dialCode ? { '--dial-code-length': `${props.dialCode.length + 1.5}ch` } : void 0"
|
|
22
|
-
:ui="
|
|
23
|
-
v-bind="
|
|
24
|
-
@blur="
|
|
25
|
-
@change="
|
|
35
|
+
:ui="baseUi"
|
|
36
|
+
v-bind="{ ...inputProps, ...$attrs }"
|
|
37
|
+
@blur="emits('blur', $event)"
|
|
38
|
+
@change="emits('change', $event)"
|
|
26
39
|
>
|
|
27
40
|
<template v-for="(_, slotName) in slots" :key="slotName" #[slotName]="slotProps">
|
|
28
41
|
<slot :name="slotName" v-bind="slotProps ?? {}" />
|
|
29
42
|
</template>
|
|
30
43
|
|
|
31
44
|
<template v-if="props.dialCode" #leading>
|
|
32
|
-
<span :class="
|
|
45
|
+
<span :class="extraUi.dialCode">{{ props.dialCode }}</span>
|
|
33
46
|
</template>
|
|
34
47
|
</UInput>
|
|
35
48
|
</template>
|
|
@@ -1,29 +1,25 @@
|
|
|
1
|
+
import type { ComponentConfig, InputSlots, InputValue } from '@nuxt/ui';
|
|
1
2
|
import type { OmitByKey } from '@movk/core';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* 输入掩码格式,`#` 表示一个数字位。
|
|
7
|
-
* @defaultValue '(###) ###-####'
|
|
8
|
-
*/
|
|
9
|
-
mask?: string;
|
|
10
|
-
/** 区号前缀,例如 `+86`。 */
|
|
11
|
-
dialCode?: string;
|
|
12
|
-
/** 区号前缀的自定义样式类。 */
|
|
13
|
-
dialCodeClass?: ClassNameValue;
|
|
14
|
-
}
|
|
3
|
+
import theme from '#build/movk-ui/as-phone-number-input';
|
|
4
|
+
import inputTheme from '#build/ui/input';
|
|
5
|
+
import type { AsPhoneNumberInputProps } from '../../types/components/input/as-phone-number-input';
|
|
6
|
+
import type { AppConfig } from 'nuxt/schema';
|
|
15
7
|
declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
16
8
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<(AsPhoneNumberInputProps<T> & {
|
|
9
|
+
ui?: ComponentConfig<typeof inputTheme & typeof theme, AppConfig, "asPhoneNumberInput">["slots"];
|
|
10
|
+
} & {
|
|
17
11
|
modelValue?: T;
|
|
18
12
|
}) & {
|
|
19
|
-
|
|
13
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
14
|
+
onChange?: ((event: Event) => any) | undefined;
|
|
15
|
+
"onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
|
|
20
16
|
}> & (typeof globalThis extends {
|
|
21
17
|
__VLS_PROPS_FALLBACK: infer P;
|
|
22
18
|
} ? P : {});
|
|
23
19
|
expose: (exposed: {}) => void;
|
|
24
20
|
attrs: any;
|
|
25
21
|
slots: OmitByKey<InputSlots, "leading">;
|
|
26
|
-
emit:
|
|
22
|
+
emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: T) => void)) & ((event: "update:modelValue", value: T | undefined) => void);
|
|
27
23
|
}>) => import("vue").VNode & {
|
|
28
24
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
29
25
|
};
|
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentConfig, InputSlots, InputValue } from '@nuxt/ui';
|
|
2
2
|
import type { OmitByKey } from '@movk/core';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* @defaultValue 50
|
|
8
|
-
*/
|
|
9
|
-
maxLength?: number;
|
|
10
|
-
/** 字符计数器的自定义样式类 */
|
|
11
|
-
counterClass?: ClassNameValue;
|
|
12
|
-
}
|
|
3
|
+
import theme from '#build/movk-ui/with-character-limit';
|
|
4
|
+
import inputTheme from '#build/ui/input';
|
|
5
|
+
import type { WithCharacterLimitProps } from '../../types/components/input/with-character-limit';
|
|
6
|
+
import type { AppConfig } from 'nuxt/schema';
|
|
13
7
|
declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
14
8
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithCharacterLimitProps<T> & {
|
|
9
|
+
ui?: ComponentConfig<typeof inputTheme & typeof theme, AppConfig, "withCharacterLimit">["slots"];
|
|
10
|
+
} & {
|
|
15
11
|
modelValue?: T;
|
|
16
12
|
}) & {
|
|
17
|
-
|
|
13
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
14
|
+
onChange?: ((event: Event) => any) | undefined;
|
|
15
|
+
"onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
|
|
18
16
|
}> & (typeof globalThis extends {
|
|
19
17
|
__VLS_PROPS_FALLBACK: infer P;
|
|
20
18
|
} ? P : {});
|
|
21
19
|
expose: (exposed: {}) => void;
|
|
22
20
|
attrs: any;
|
|
23
21
|
slots: OmitByKey<InputSlots, "trailing">;
|
|
24
|
-
emit:
|
|
22
|
+
emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: T) => void)) & ((event: "update:modelValue", value: T | undefined) => void);
|
|
25
23
|
}>) => import("vue").VNode & {
|
|
26
24
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
27
25
|
};
|
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { computed, useAttrs } from "vue";
|
|
2
3
|
import { UInput } from "#components";
|
|
3
|
-
import {
|
|
4
|
+
import { useAppConfig } from "#imports";
|
|
5
|
+
import theme from "#build/movk-ui/with-character-limit";
|
|
6
|
+
import inputTheme from "#build/ui/input";
|
|
7
|
+
import { useExtendedTv } from "../../utils/extend-theme";
|
|
8
|
+
import { useForwardedProps } from "../../utils/form-control";
|
|
4
9
|
const props = defineProps({
|
|
5
10
|
maxLength: { type: Number, required: false, default: 50 },
|
|
6
|
-
|
|
11
|
+
ui: { type: Object, required: false }
|
|
7
12
|
});
|
|
8
|
-
const
|
|
13
|
+
const emits = defineEmits(["update:modelValue", "blur", "change"]);
|
|
9
14
|
const slots = defineSlots();
|
|
10
15
|
defineOptions({ inheritAttrs: false });
|
|
16
|
+
const attrs = useAttrs();
|
|
17
|
+
const appConfig = useAppConfig();
|
|
11
18
|
const modelValue = defineModel({ type: null });
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
const inputProps = useForwardedProps(props, ["ui", "maxLength", "maxlength", "defaultValue", "modelModifiers"]);
|
|
20
|
+
const { baseUi, extraUi } = useExtendedTv(
|
|
21
|
+
inputTheme,
|
|
22
|
+
theme,
|
|
23
|
+
() => appConfig.movk?.withCharacterLimit,
|
|
24
|
+
() => ({ ui: props.ui })
|
|
25
|
+
);
|
|
26
|
+
const currentLength = computed(() => String(modelValue.value ?? "").length);
|
|
15
27
|
</script>
|
|
16
28
|
|
|
17
29
|
<template>
|
|
@@ -19,10 +31,10 @@ const currentLength = computed(() => {
|
|
|
19
31
|
v-model="modelValue"
|
|
20
32
|
:maxlength="props.maxLength"
|
|
21
33
|
aria-describedby="character-count"
|
|
22
|
-
:ui="
|
|
23
|
-
v-bind="
|
|
24
|
-
@blur="
|
|
25
|
-
@change="
|
|
34
|
+
:ui="baseUi"
|
|
35
|
+
v-bind="{ ...inputProps, ...attrs }"
|
|
36
|
+
@blur="emits('blur', $event)"
|
|
37
|
+
@change="emits('change', $event)"
|
|
26
38
|
>
|
|
27
39
|
<template v-for="(_, slotName) in slots" :key="slotName" #[slotName]="slotProps">
|
|
28
40
|
<slot :name="slotName" v-bind="slotProps ?? {}" />
|
|
@@ -31,7 +43,7 @@ const currentLength = computed(() => {
|
|
|
31
43
|
<template #trailing>
|
|
32
44
|
<div
|
|
33
45
|
id="character-count"
|
|
34
|
-
:class="
|
|
46
|
+
:class="extraUi.counter"
|
|
35
47
|
aria-live="polite"
|
|
36
48
|
role="status"
|
|
37
49
|
>
|
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentConfig, InputSlots, InputValue } from '@nuxt/ui';
|
|
2
2
|
import type { OmitByKey } from '@movk/core';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* @defaultValue 50
|
|
8
|
-
*/
|
|
9
|
-
maxLength?: number;
|
|
10
|
-
/** 字符计数器的自定义样式类 */
|
|
11
|
-
counterClass?: ClassNameValue;
|
|
12
|
-
}
|
|
3
|
+
import theme from '#build/movk-ui/with-character-limit';
|
|
4
|
+
import inputTheme from '#build/ui/input';
|
|
5
|
+
import type { WithCharacterLimitProps } from '../../types/components/input/with-character-limit';
|
|
6
|
+
import type { AppConfig } from 'nuxt/schema';
|
|
13
7
|
declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
14
8
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithCharacterLimitProps<T> & {
|
|
9
|
+
ui?: ComponentConfig<typeof inputTheme & typeof theme, AppConfig, "withCharacterLimit">["slots"];
|
|
10
|
+
} & {
|
|
15
11
|
modelValue?: T;
|
|
16
12
|
}) & {
|
|
17
|
-
|
|
13
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
14
|
+
onChange?: ((event: Event) => any) | undefined;
|
|
15
|
+
"onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
|
|
18
16
|
}> & (typeof globalThis extends {
|
|
19
17
|
__VLS_PROPS_FALLBACK: infer P;
|
|
20
18
|
} ? P : {});
|
|
21
19
|
expose: (exposed: {}) => void;
|
|
22
20
|
attrs: any;
|
|
23
21
|
slots: OmitByKey<InputSlots, "trailing">;
|
|
24
|
-
emit:
|
|
22
|
+
emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: T) => void)) & ((event: "update:modelValue", value: T | undefined) => void);
|
|
25
23
|
}>) => import("vue").VNode & {
|
|
26
24
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
27
25
|
};
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
export type WithClearEmits<T extends InputValue = InputValue> = InputEmits<T> & {
|
|
8
|
-
clear: [];
|
|
9
|
-
};
|
|
1
|
+
import type { InputProps, InputSlots, InputValue, ComponentConfig } from '@nuxt/ui';
|
|
2
|
+
import type { OmitByKey } from '@movk/core';
|
|
3
|
+
import theme from '#build/movk-ui/with-clear';
|
|
4
|
+
import inputTheme from '#build/ui/input';
|
|
5
|
+
import type { AppConfig } from 'nuxt/schema';
|
|
6
|
+
import type { WithClearProps } from '../../types/components/input/with-clear';
|
|
10
7
|
declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
11
8
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithClearProps<T> & {
|
|
9
|
+
ui?: ComponentConfig<typeof inputTheme & typeof theme, AppConfig, "withCharacterLimit">["slots"];
|
|
10
|
+
} & {
|
|
12
11
|
modelValue?: InputProps<T>["modelValue"];
|
|
13
12
|
}) & {
|
|
14
|
-
|
|
13
|
+
onClear?: (() => any) | undefined;
|
|
14
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
15
|
+
onChange?: ((event: Event) => any) | undefined;
|
|
16
|
+
"onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
|
|
15
17
|
}> & (typeof globalThis extends {
|
|
16
18
|
__VLS_PROPS_FALLBACK: infer P;
|
|
17
19
|
} ? P : {});
|
|
18
20
|
expose: (exposed: {}) => void;
|
|
19
21
|
attrs: any;
|
|
20
22
|
slots: OmitByKey<InputSlots, "trailing">;
|
|
21
|
-
emit:
|
|
23
|
+
emit: (((evt: "clear") => void) & ((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: T) => void)) & ((event: "update:modelValue", value: T | undefined) => void);
|
|
22
24
|
}>) => import("vue").VNode & {
|
|
23
25
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
24
26
|
};
|
|
@@ -1,26 +1,45 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { useAttrs } from "vue";
|
|
2
3
|
import { UInput, UButton } from "#components";
|
|
3
4
|
import { isEmpty } from "@movk/core";
|
|
5
|
+
import { useAppConfig } from "#imports";
|
|
6
|
+
import theme from "#build/movk-ui/with-clear";
|
|
7
|
+
import inputTheme from "#build/ui/input";
|
|
8
|
+
import { useExtendedTv } from "../../utils/extend-theme";
|
|
9
|
+
import { useFormFieldBridge, useForwardedProps } from "../../utils/form-control";
|
|
4
10
|
const props = defineProps({
|
|
5
|
-
buttonProps: { type: Object, required: false }
|
|
11
|
+
buttonProps: { type: Object, required: false },
|
|
12
|
+
ui: { type: Object, required: false }
|
|
6
13
|
});
|
|
7
|
-
const
|
|
14
|
+
const emits = defineEmits(["update:modelValue", "blur", "change", "clear"]);
|
|
8
15
|
const slots = defineSlots();
|
|
9
16
|
defineOptions({ inheritAttrs: false });
|
|
17
|
+
const attrs = useAttrs();
|
|
18
|
+
const appConfig = useAppConfig();
|
|
10
19
|
const modelValue = defineModel({ type: null });
|
|
20
|
+
const inputProps = useForwardedProps(props, ["ui", "buttonProps", "defaultValue", "modelModifiers"]);
|
|
21
|
+
const { size: buttonSize, emitFormChange, emitFormInput } = useFormFieldBridge(props);
|
|
22
|
+
const { baseUi } = useExtendedTv(
|
|
23
|
+
inputTheme,
|
|
24
|
+
theme,
|
|
25
|
+
() => appConfig.movk?.withClear,
|
|
26
|
+
() => ({ ui: props.ui })
|
|
27
|
+
);
|
|
11
28
|
function handleClear() {
|
|
12
29
|
modelValue.value = void 0;
|
|
13
|
-
|
|
30
|
+
emitFormInput();
|
|
31
|
+
emitFormChange();
|
|
32
|
+
emits("clear");
|
|
14
33
|
}
|
|
15
34
|
</script>
|
|
16
35
|
|
|
17
36
|
<template>
|
|
18
37
|
<UInput
|
|
19
38
|
v-model="modelValue"
|
|
20
|
-
:ui="
|
|
21
|
-
v-bind="
|
|
22
|
-
@blur="
|
|
23
|
-
@change="
|
|
39
|
+
:ui="baseUi"
|
|
40
|
+
v-bind="{ ...inputProps, ...attrs }"
|
|
41
|
+
@blur="emits('blur', $event)"
|
|
42
|
+
@change="emits('change', $event)"
|
|
24
43
|
>
|
|
25
44
|
<template v-for="(_, slotName) in slots" :key="slotName" #[slotName]="slotProps">
|
|
26
45
|
<slot :name="slotName" v-bind="slotProps ?? {}" />
|
|
@@ -30,7 +49,7 @@ function handleClear() {
|
|
|
30
49
|
<UButton
|
|
31
50
|
color="neutral"
|
|
32
51
|
variant="link"
|
|
33
|
-
size="
|
|
52
|
+
:size="buttonSize"
|
|
34
53
|
icon="i-lucide-circle-x"
|
|
35
54
|
aria-label="Clear input"
|
|
36
55
|
v-bind="props.buttonProps"
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
export type WithClearEmits<T extends InputValue = InputValue> = InputEmits<T> & {
|
|
8
|
-
clear: [];
|
|
9
|
-
};
|
|
1
|
+
import type { InputProps, InputSlots, InputValue, ComponentConfig } from '@nuxt/ui';
|
|
2
|
+
import type { OmitByKey } from '@movk/core';
|
|
3
|
+
import theme from '#build/movk-ui/with-clear';
|
|
4
|
+
import inputTheme from '#build/ui/input';
|
|
5
|
+
import type { AppConfig } from 'nuxt/schema';
|
|
6
|
+
import type { WithClearProps } from '../../types/components/input/with-clear';
|
|
10
7
|
declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
11
8
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithClearProps<T> & {
|
|
9
|
+
ui?: ComponentConfig<typeof inputTheme & typeof theme, AppConfig, "withCharacterLimit">["slots"];
|
|
10
|
+
} & {
|
|
12
11
|
modelValue?: InputProps<T>["modelValue"];
|
|
13
12
|
}) & {
|
|
14
|
-
|
|
13
|
+
onClear?: (() => any) | undefined;
|
|
14
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
15
|
+
onChange?: ((event: Event) => any) | undefined;
|
|
16
|
+
"onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
|
|
15
17
|
}> & (typeof globalThis extends {
|
|
16
18
|
__VLS_PROPS_FALLBACK: infer P;
|
|
17
19
|
} ? P : {});
|
|
18
20
|
expose: (exposed: {}) => void;
|
|
19
21
|
attrs: any;
|
|
20
22
|
slots: OmitByKey<InputSlots, "trailing">;
|
|
21
|
-
emit:
|
|
23
|
+
emit: (((evt: "clear") => void) & ((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: T) => void)) & ((event: "update:modelValue", value: T | undefined) => void);
|
|
22
24
|
}>) => import("vue").VNode & {
|
|
23
25
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
24
26
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
tooltipProps?: TooltipProps;
|
|
8
|
-
}
|
|
9
|
-
export type WithCopyEmits<T extends InputValue = InputValue> = InputEmits<T> & {
|
|
10
|
-
copy: [value: string];
|
|
11
|
-
};
|
|
1
|
+
import type { ComponentConfig, InputSlots, InputValue } from '@nuxt/ui';
|
|
2
|
+
import type { OmitByKey } from '@movk/core';
|
|
3
|
+
import theme from '#build/movk-ui/with-copy';
|
|
4
|
+
import inputTheme from '#build/ui/input';
|
|
5
|
+
import type { WithCopyProps } from '../../types/components/input/with-copy';
|
|
6
|
+
import type { AppConfig } from 'nuxt/schema';
|
|
12
7
|
declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
13
8
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithCopyProps<T> & {
|
|
9
|
+
ui?: ComponentConfig<typeof inputTheme & typeof theme, AppConfig, "withCopy">["slots"];
|
|
10
|
+
} & {
|
|
14
11
|
modelValue?: T;
|
|
15
12
|
}) & {
|
|
16
|
-
|
|
13
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
14
|
+
onChange?: ((event: Event) => any) | undefined;
|
|
15
|
+
onCopy?: ((value: string) => any) | undefined;
|
|
16
|
+
"onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
|
|
17
17
|
}> & (typeof globalThis extends {
|
|
18
18
|
__VLS_PROPS_FALLBACK: infer P;
|
|
19
19
|
} ? P : {});
|
|
20
20
|
expose: (exposed: {}) => void;
|
|
21
21
|
attrs: any;
|
|
22
22
|
slots: OmitByKey<InputSlots, "trailing">;
|
|
23
|
-
emit:
|
|
23
|
+
emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "copy", value: string) => void) & ((evt: "update:modelValue", value: T) => void)) & ((event: "update:modelValue", value: T | undefined) => void);
|
|
24
24
|
}>) => import("vue").VNode & {
|
|
25
25
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
26
26
|
};
|
|
@@ -1,21 +1,38 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { useAttrs } from "vue";
|
|
2
3
|
import { UInput, UButton, UTooltip } from "#components";
|
|
3
4
|
import { useClipboard } from "@vueuse/core";
|
|
4
5
|
import { isEmpty } from "@movk/core";
|
|
6
|
+
import { useAppConfig } from "#imports";
|
|
7
|
+
import theme from "#build/movk-ui/with-copy";
|
|
8
|
+
import inputTheme from "#build/ui/input";
|
|
9
|
+
import { useExtendedTv } from "../../utils/extend-theme";
|
|
10
|
+
import { useFormFieldBridge, useForwardedProps } from "../../utils/form-control";
|
|
5
11
|
const props = defineProps({
|
|
6
12
|
buttonProps: { type: Object, required: false },
|
|
7
|
-
tooltipProps: { type: Object, required: false }
|
|
13
|
+
tooltipProps: { type: Object, required: false },
|
|
14
|
+
ui: { type: Object, required: false }
|
|
8
15
|
});
|
|
9
|
-
const
|
|
16
|
+
const emits = defineEmits(["update:modelValue", "blur", "change", "copy"]);
|
|
10
17
|
const slots = defineSlots();
|
|
11
18
|
defineOptions({ inheritAttrs: false });
|
|
19
|
+
const attrs = useAttrs();
|
|
20
|
+
const appConfig = useAppConfig();
|
|
12
21
|
const modelValue = defineModel({ type: null });
|
|
22
|
+
const inputProps = useForwardedProps(props, ["ui", "buttonProps", "tooltipProps", "defaultValue", "modelModifiers"]);
|
|
23
|
+
const { size: buttonSize } = useFormFieldBridge(props);
|
|
24
|
+
const { baseUi } = useExtendedTv(
|
|
25
|
+
inputTheme,
|
|
26
|
+
theme,
|
|
27
|
+
() => appConfig.movk?.withCopy,
|
|
28
|
+
() => ({ ui: props.ui })
|
|
29
|
+
);
|
|
13
30
|
const { copy, copied } = useClipboard();
|
|
14
31
|
function handleCopy() {
|
|
15
32
|
if (modelValue.value) {
|
|
16
33
|
const stringValue = String(modelValue.value);
|
|
17
34
|
copy(stringValue);
|
|
18
|
-
|
|
35
|
+
emits("copy", stringValue);
|
|
19
36
|
}
|
|
20
37
|
}
|
|
21
38
|
</script>
|
|
@@ -23,10 +40,10 @@ function handleCopy() {
|
|
|
23
40
|
<template>
|
|
24
41
|
<UInput
|
|
25
42
|
v-model="modelValue"
|
|
26
|
-
:ui="
|
|
27
|
-
v-bind="
|
|
28
|
-
@blur="
|
|
29
|
-
@change="
|
|
43
|
+
:ui="baseUi"
|
|
44
|
+
v-bind="{ ...inputProps, ...attrs }"
|
|
45
|
+
@blur="emits('blur', $event)"
|
|
46
|
+
@change="emits('change', $event)"
|
|
30
47
|
>
|
|
31
48
|
<template v-for="(_, slotName) in slots" :key="slotName" #[slotName]="slotProps">
|
|
32
49
|
<slot :name="slotName" v-bind="slotProps ?? {}" />
|
|
@@ -37,7 +54,7 @@ function handleCopy() {
|
|
|
37
54
|
<UButton
|
|
38
55
|
:color="copied ? 'success' : 'neutral'"
|
|
39
56
|
variant="link"
|
|
40
|
-
size="
|
|
57
|
+
:size="buttonSize"
|
|
41
58
|
:icon="copied ? 'i-lucide-copy-check' : 'i-lucide-copy'"
|
|
42
59
|
aria-label="Copy to clipboard"
|
|
43
60
|
v-bind="props.buttonProps"
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
tooltipProps?: TooltipProps;
|
|
8
|
-
}
|
|
9
|
-
export type WithCopyEmits<T extends InputValue = InputValue> = InputEmits<T> & {
|
|
10
|
-
copy: [value: string];
|
|
11
|
-
};
|
|
1
|
+
import type { ComponentConfig, InputSlots, InputValue } from '@nuxt/ui';
|
|
2
|
+
import type { OmitByKey } from '@movk/core';
|
|
3
|
+
import theme from '#build/movk-ui/with-copy';
|
|
4
|
+
import inputTheme from '#build/ui/input';
|
|
5
|
+
import type { WithCopyProps } from '../../types/components/input/with-copy';
|
|
6
|
+
import type { AppConfig } from 'nuxt/schema';
|
|
12
7
|
declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
13
8
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithCopyProps<T> & {
|
|
9
|
+
ui?: ComponentConfig<typeof inputTheme & typeof theme, AppConfig, "withCopy">["slots"];
|
|
10
|
+
} & {
|
|
14
11
|
modelValue?: T;
|
|
15
12
|
}) & {
|
|
16
|
-
|
|
13
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
14
|
+
onChange?: ((event: Event) => any) | undefined;
|
|
15
|
+
onCopy?: ((value: string) => any) | undefined;
|
|
16
|
+
"onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
|
|
17
17
|
}> & (typeof globalThis extends {
|
|
18
18
|
__VLS_PROPS_FALLBACK: infer P;
|
|
19
19
|
} ? P : {});
|
|
20
20
|
expose: (exposed: {}) => void;
|
|
21
21
|
attrs: any;
|
|
22
22
|
slots: OmitByKey<InputSlots, "trailing">;
|
|
23
|
-
emit:
|
|
23
|
+
emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "copy", value: string) => void) & ((evt: "update:modelValue", value: T) => void)) & ((event: "update:modelValue", value: T | undefined) => void);
|
|
24
24
|
}>) => import("vue").VNode & {
|
|
25
25
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
26
26
|
};
|
|
@@ -1,29 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/** 浮动标签的自定义样式类 */
|
|
8
|
-
labelClass?: ClassNameValue;
|
|
9
|
-
/** 清除按钮的自定义属性 */
|
|
10
|
-
clearButtonProps?: ButtonProps;
|
|
11
|
-
}
|
|
12
|
-
export type WithFloatingLabelEmits<T extends InputValue = InputValue> = InputEmits<T> & {
|
|
13
|
-
clear: [];
|
|
14
|
-
};
|
|
1
|
+
import type { InputSlots, InputValue, ComponentConfig } from '@nuxt/ui';
|
|
2
|
+
import type { OmitByKey } from '@movk/core';
|
|
3
|
+
import theme from '#build/movk-ui/with-floating-label';
|
|
4
|
+
import inputTheme from '#build/ui/input';
|
|
5
|
+
import type { AppConfig } from 'nuxt/schema';
|
|
6
|
+
import type { WithFloatingLabelProps } from '../../types/components/input/with-floating-label';
|
|
15
7
|
declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
16
8
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithFloatingLabelProps<T> & {
|
|
9
|
+
ui?: ComponentConfig<typeof inputTheme & typeof theme, AppConfig, "withFloatingLabel">["slots"];
|
|
10
|
+
} & {
|
|
17
11
|
modelValue?: T;
|
|
18
12
|
}) & {
|
|
19
|
-
|
|
13
|
+
onClear?: (() => any) | undefined;
|
|
14
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
15
|
+
onChange?: ((event: Event) => any) | undefined;
|
|
16
|
+
"onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
|
|
20
17
|
}> & (typeof globalThis extends {
|
|
21
18
|
__VLS_PROPS_FALLBACK: infer P;
|
|
22
19
|
} ? P : {});
|
|
23
20
|
expose: (exposed: {}) => void;
|
|
24
21
|
attrs: any;
|
|
25
22
|
slots: OmitByKey<InputSlots, "default" | "trailing">;
|
|
26
|
-
emit:
|
|
23
|
+
emit: (((evt: "clear") => void) & ((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: T) => void)) & ((event: "update:modelValue", value: T | undefined) => void);
|
|
27
24
|
}>) => import("vue").VNode & {
|
|
28
25
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
29
26
|
};
|