@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,42 +1,29 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
declare const __VLS_export: <R extends boolean, M extends boolean, P extends "click" | "hover" = "click">(__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<{
|
|
15
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<(DatePickerProps<R, M, P> & {
|
|
16
|
-
modelValue?: CalendarProps<R, M>["modelValue"];
|
|
1
|
+
import type { ComponentConfig } from '@nuxt/ui';
|
|
2
|
+
import type { AppConfig } from 'nuxt/schema';
|
|
3
|
+
import type { DateValue } from '@internationalized/date';
|
|
4
|
+
import type { ValueFormat } from '../composables/useDateFormatter';
|
|
5
|
+
import theme from '#build/movk-ui/date-picker';
|
|
6
|
+
import popoverTheme from '#build/ui/popover';
|
|
7
|
+
import type { DatePickerProps, DatePickerSlots, FormattedValue } from '../types/components/date-picker';
|
|
8
|
+
declare const __VLS_export: <R extends boolean, M extends boolean, P extends "click" | "hover", V extends ValueFormat = "date-value">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
9
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(DatePickerProps<R, M, P, V> & {
|
|
10
|
+
ui?: ComponentConfig<typeof popoverTheme & typeof theme, AppConfig, "datePicker">["slots"];
|
|
11
|
+
} & {
|
|
12
|
+
modelValue?: FormattedValue<R, M, V>;
|
|
17
13
|
}) & {
|
|
18
|
-
|
|
14
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
15
|
+
"onUpdate:modelValue"?: ((value: FormattedValue<R, M, V> | undefined) => any) | undefined;
|
|
16
|
+
"onUpdate:placeholder"?: ((...args: DateValue[]) => any) | undefined;
|
|
17
|
+
"onUpdate:validModelValue"?: ((date: import("reka-ui").DateRange) => any) | undefined;
|
|
18
|
+
"onUpdate:startValue"?: ((date: DateValue | undefined) => any) | undefined;
|
|
19
|
+
"onClose:prevent"?: (() => any) | undefined;
|
|
19
20
|
}> & (typeof globalThis extends {
|
|
20
21
|
__VLS_PROPS_FALLBACK: infer P_1;
|
|
21
22
|
} ? P_1 : {});
|
|
22
23
|
expose: (exposed: {}) => void;
|
|
23
24
|
attrs: any;
|
|
24
|
-
slots:
|
|
25
|
-
|
|
26
|
-
} & {
|
|
27
|
-
leading?: (props: any) => any;
|
|
28
|
-
} & {
|
|
29
|
-
trailing?: (props: any) => any;
|
|
30
|
-
} & {
|
|
31
|
-
anchor?: (props: any) => any;
|
|
32
|
-
} & {
|
|
33
|
-
day?: (props: any) => any;
|
|
34
|
-
} & {
|
|
35
|
-
heading?: (props: any) => any;
|
|
36
|
-
} & {
|
|
37
|
-
'week-day'?: (props: any) => any;
|
|
38
|
-
};
|
|
39
|
-
emit: any;
|
|
25
|
+
slots: DatePickerSlots<P>;
|
|
26
|
+
emit: (((evt: "update:open", value: boolean) => void) & ((evt: "update:modelValue", value: FormattedValue<R, M, V>) => void) & ((evt: "update:placeholder", ...args: [date: DateValue] & [date: DateValue]) => void) & ((evt: "update:validModelValue", date: import("reka-ui").DateRange) => void) & ((evt: "update:startValue", date: DateValue | undefined) => void) & ((evt: "close:prevent") => void)) & ((event: "update:modelValue", value: FormattedValue<R, M, V> | undefined) => void);
|
|
40
27
|
}>) => import("vue").VNode & {
|
|
41
28
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
42
29
|
};
|
|
@@ -1,101 +1,209 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { UPopover, UButton, UCalendar } from "#components";
|
|
3
|
-
import { computed } from "vue";
|
|
2
|
+
import { UPopover, UButton, UCalendar, UIcon } from "#components";
|
|
3
|
+
import { computed, useAttrs } from "vue";
|
|
4
|
+
import { useAppConfig } from "#imports";
|
|
4
5
|
import { useDateFormatter } from "../composables/useDateFormatter";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
import { useExtendedTv } from "../utils/extend-theme";
|
|
7
|
+
import { useFieldControl } from "../utils/form-control";
|
|
8
|
+
import theme from "#build/movk-ui/date-picker";
|
|
9
|
+
import popoverTheme from "#build/ui/popover";
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
id: { type: String, required: false },
|
|
12
|
+
name: { type: String, required: false },
|
|
13
|
+
placeholder: { type: String, required: false, default: "\u9009\u62E9\u65E5\u671F" },
|
|
13
14
|
buttonProps: { type: Object, required: false },
|
|
14
15
|
popoverProps: { type: Object, required: false },
|
|
15
|
-
labelFormat: { type: [String, Function], required: false },
|
|
16
|
+
labelFormat: { type: [String, Function], required: false, default: "formatted" },
|
|
17
|
+
valueFormat: { type: null, required: false },
|
|
18
|
+
clearable: { type: Boolean, required: false },
|
|
19
|
+
presets: { type: [Array, String], required: false },
|
|
20
|
+
ui: { type: Object, required: false },
|
|
16
21
|
locale: { type: String, required: false },
|
|
17
22
|
formatOptions: { type: null, required: false },
|
|
18
23
|
timeZone: { type: String, required: false }
|
|
19
24
|
});
|
|
20
|
-
const
|
|
25
|
+
const emits = defineEmits(["close:prevent", "update:open", "update:placeholder", "update:validModelValue", "update:startValue", "update:modelValue"]);
|
|
26
|
+
defineSlots();
|
|
21
27
|
defineOptions({ inheritAttrs: false });
|
|
28
|
+
const attrs = useAttrs();
|
|
22
29
|
const modelValue = defineModel({ type: null });
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
const appConfig = useAppConfig();
|
|
31
|
+
const {
|
|
32
|
+
id,
|
|
33
|
+
name,
|
|
34
|
+
size: effectiveSize,
|
|
35
|
+
color,
|
|
36
|
+
disabled: effectiveDisabled,
|
|
37
|
+
ariaAttrs,
|
|
38
|
+
emitFormBlur,
|
|
39
|
+
emitFormChange,
|
|
40
|
+
emitFormFocus,
|
|
41
|
+
emitFormInput
|
|
42
|
+
} = useFieldControl(props);
|
|
43
|
+
const formatter = useDateFormatter({
|
|
44
|
+
locale: props.locale,
|
|
45
|
+
formatOptions: props.formatOptions,
|
|
46
|
+
timeZone: props.timeZone
|
|
47
|
+
});
|
|
48
|
+
const asModel = (v) => v;
|
|
49
|
+
const isOn = (v) => v === "" || v === true || v === "true";
|
|
50
|
+
const valueFormat = computed(() => props.valueFormat ?? "date-value");
|
|
51
|
+
const isRange = computed(() => isOn(attrs.range));
|
|
52
|
+
const isMultiple = computed(() => isOn(attrs.multiple));
|
|
53
|
+
const calendarValue = computed({
|
|
54
|
+
get: () => formatter.convertFromFormat(modelValue.value, valueFormat.value),
|
|
55
|
+
set: (next) => {
|
|
56
|
+
modelValue.value = formatter.convertToFormat(next, valueFormat.value);
|
|
57
|
+
emitFormInput();
|
|
58
|
+
emitFormChange();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const emptyLabel = computed(() => props.placeholder || props.buttonProps?.label || "");
|
|
62
|
+
const fromNumber = (n) => n === null ? "" : String(n);
|
|
63
|
+
const converters = {
|
|
64
|
+
iso: formatter.toISO,
|
|
65
|
+
formatted: formatter.format,
|
|
66
|
+
date: (d) => formatter.toDate(d)?.toLocaleDateString() ?? "",
|
|
67
|
+
timestamp: (d) => fromNumber(formatter.toTimestamp(d)),
|
|
68
|
+
unix: (d) => fromNumber(formatter.toUnixTimestamp(d))
|
|
36
69
|
};
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
70
|
+
const formattedDate = computed(() => {
|
|
71
|
+
const value = calendarValue.value;
|
|
72
|
+
if (typeof props.labelFormat === "function") return props.labelFormat(formatter, value);
|
|
73
|
+
if (!value) return emptyLabel.value;
|
|
74
|
+
const convert = converters[props.labelFormat] ?? formatter.format;
|
|
40
75
|
if (Array.isArray(value)) {
|
|
41
|
-
return value.length
|
|
76
|
+
return value.length === 0 ? emptyLabel.value : value.map(convert).join(", ");
|
|
42
77
|
}
|
|
43
|
-
if (
|
|
44
|
-
|
|
78
|
+
if (formatter.isDateRange(value)) {
|
|
79
|
+
if (!value.start || !value.end) return emptyLabel.value;
|
|
80
|
+
return `${convert(value.start)} - ${convert(value.end)}`;
|
|
45
81
|
}
|
|
46
|
-
return
|
|
47
|
-
};
|
|
48
|
-
const formattedDate = computed(() => {
|
|
49
|
-
if (typeof labelFormat === "function") return labelFormat(formatter, modelValue.value);
|
|
50
|
-
return convertToLabel(modelValue.value);
|
|
82
|
+
return convert(value);
|
|
51
83
|
});
|
|
84
|
+
const hasValue = computed(() => {
|
|
85
|
+
const value = calendarValue.value;
|
|
86
|
+
if (value === void 0 || value === null) return false;
|
|
87
|
+
if (Array.isArray(value)) return value.length > 0;
|
|
88
|
+
if (formatter.isDateRange(value)) return !!value.start || !!value.end;
|
|
89
|
+
return true;
|
|
90
|
+
});
|
|
91
|
+
const triggerButtonAttrs = computed(() => ({
|
|
92
|
+
color: color.value === "error" ? "error" : "neutral",
|
|
93
|
+
variant: "subtle",
|
|
94
|
+
icon: "i-lucide-calendar",
|
|
95
|
+
size: effectiveSize.value,
|
|
96
|
+
label: formattedDate.value,
|
|
97
|
+
disabled: effectiveDisabled.value,
|
|
98
|
+
class: "w-full",
|
|
99
|
+
...props.buttonProps
|
|
100
|
+
}));
|
|
101
|
+
function handleClear(event) {
|
|
102
|
+
event.stopPropagation();
|
|
103
|
+
if (isRange.value) calendarValue.value = asModel({ start: void 0, end: void 0 });
|
|
104
|
+
else if (isMultiple.value) calendarValue.value = asModel([]);
|
|
105
|
+
else calendarValue.value = asModel(void 0);
|
|
106
|
+
}
|
|
107
|
+
function buildDefaultPresets() {
|
|
108
|
+
const today = formatter.getToday();
|
|
109
|
+
const range = (start, end) => asModel({ start, end });
|
|
110
|
+
if (isRange.value) return [
|
|
111
|
+
{ label: "\u4ECA\u5929", value: () => range(today, today) },
|
|
112
|
+
{ label: "\u672C\u5468", value: (f) => range(f.getStartOfWeek(today), f.getEndOfWeek(today)) },
|
|
113
|
+
{ label: "\u672C\u6708", value: (f) => range(f.getStartOfMonth(today), f.getEndOfMonth(today)) },
|
|
114
|
+
{ label: "\u6700\u8FD1 7 \u5929", value: () => range(today.subtract({ days: 6 }), today) },
|
|
115
|
+
{ label: "\u6700\u8FD1 30 \u5929", value: () => range(today.subtract({ days: 29 }), today) }
|
|
116
|
+
];
|
|
117
|
+
if (isMultiple.value) return [];
|
|
118
|
+
return [
|
|
119
|
+
{ label: "\u4ECA\u5929", value: () => asModel(today) },
|
|
120
|
+
{ label: "\u6628\u5929", value: () => asModel(today.subtract({ days: 1 })) },
|
|
121
|
+
{ label: "\u660E\u5929", value: () => asModel(today.add({ days: 1 })) }
|
|
122
|
+
];
|
|
123
|
+
}
|
|
124
|
+
const resolvedPresets = computed(() => {
|
|
125
|
+
if (!props.presets) return [];
|
|
126
|
+
if (props.presets === "default") return buildDefaultPresets();
|
|
127
|
+
return props.presets;
|
|
128
|
+
});
|
|
129
|
+
function applyPreset(preset) {
|
|
130
|
+
const value = typeof preset.value === "function" ? preset.value(formatter) : preset.value;
|
|
131
|
+
calendarValue.value = value;
|
|
132
|
+
}
|
|
133
|
+
const { baseUi, extraUi } = useExtendedTv(
|
|
134
|
+
popoverTheme,
|
|
135
|
+
theme,
|
|
136
|
+
() => appConfig.movk?.datePicker,
|
|
137
|
+
() => ({
|
|
138
|
+
ui: props.ui,
|
|
139
|
+
variants: { withPresets: resolvedPresets.value.length > 0 }
|
|
140
|
+
})
|
|
141
|
+
);
|
|
52
142
|
</script>
|
|
53
143
|
|
|
54
144
|
<template>
|
|
55
|
-
<UPopover
|
|
145
|
+
<UPopover
|
|
146
|
+
v-bind="popoverProps"
|
|
147
|
+
:ui="baseUi"
|
|
148
|
+
@close:prevent="emits('close:prevent')"
|
|
149
|
+
@update:open="emits('update:open', $event)"
|
|
150
|
+
>
|
|
56
151
|
<template #default="defaultSlotProps">
|
|
57
152
|
<slot v-bind="defaultSlotProps">
|
|
58
153
|
<UButton
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
154
|
+
:id="id"
|
|
155
|
+
:name="name"
|
|
156
|
+
v-bind="{ ...triggerButtonAttrs, ...ariaAttrs }"
|
|
157
|
+
@blur="emitFormBlur"
|
|
158
|
+
@focus="emitFormFocus"
|
|
64
159
|
>
|
|
65
|
-
{{ formattedDate }}
|
|
66
160
|
<template v-if="$slots.leading" #leading="leading">
|
|
67
161
|
<slot name="leading" v-bind="leading" />
|
|
68
162
|
</template>
|
|
69
163
|
<template v-if="$slots.trailing" #trailing="trailing">
|
|
70
164
|
<slot name="trailing" v-bind="trailing" />
|
|
71
165
|
</template>
|
|
166
|
+
<template v-else-if="clearable && hasValue" #trailing>
|
|
167
|
+
<UIcon name="i-lucide-x" :class="extraUi.clearIcon" @click="handleClear" />
|
|
168
|
+
</template>
|
|
72
169
|
</UButton>
|
|
73
170
|
</slot>
|
|
74
171
|
</template>
|
|
75
172
|
|
|
76
|
-
<template v-if="$slots.anchor" #anchor="anchor">
|
|
77
|
-
<slot name="anchor" v-bind="anchor" />
|
|
78
|
-
</template>
|
|
79
|
-
|
|
80
173
|
<template #content>
|
|
81
|
-
<
|
|
82
|
-
v-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
174
|
+
<div :class="extraUi.wrapper">
|
|
175
|
+
<div v-if="resolvedPresets.length" :class="extraUi.presets">
|
|
176
|
+
<UButton
|
|
177
|
+
v-for="preset in resolvedPresets"
|
|
178
|
+
:key="preset.label"
|
|
179
|
+
:label="preset.label"
|
|
180
|
+
size="sm"
|
|
181
|
+
color="neutral"
|
|
182
|
+
variant="ghost"
|
|
183
|
+
:class="extraUi.presetButton"
|
|
184
|
+
@click="applyPreset(preset)"
|
|
185
|
+
/>
|
|
186
|
+
</div>
|
|
187
|
+
<UCalendar
|
|
188
|
+
v-model="calendarValue"
|
|
189
|
+
:class="extraUi.calendar"
|
|
190
|
+
v-bind="attrs"
|
|
191
|
+
:disabled="effectiveDisabled"
|
|
192
|
+
@update:placeholder="(e) => emits('update:placeholder', e)"
|
|
193
|
+
@update:start-value="emits('update:startValue', $event)"
|
|
194
|
+
@update:valid-model-value="emits('update:validModelValue', $event)"
|
|
195
|
+
>
|
|
196
|
+
<template v-if="$slots.day" #day="day">
|
|
197
|
+
<slot name="day" v-bind="day" />
|
|
198
|
+
</template>
|
|
199
|
+
<template v-if="$slots.heading" #heading="heading">
|
|
200
|
+
<slot name="heading" v-bind="heading" />
|
|
201
|
+
</template>
|
|
202
|
+
<template v-if="$slots['week-day']" #week-day="weekDay">
|
|
203
|
+
<slot name="week-day" v-bind="weekDay" />
|
|
204
|
+
</template>
|
|
205
|
+
</UCalendar>
|
|
206
|
+
</div>
|
|
99
207
|
</template>
|
|
100
208
|
</UPopover>
|
|
101
209
|
</template>
|
|
@@ -1,42 +1,29 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
declare const __VLS_export: <R extends boolean, M extends boolean, P extends "click" | "hover" = "click">(__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<{
|
|
15
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<(DatePickerProps<R, M, P> & {
|
|
16
|
-
modelValue?: CalendarProps<R, M>["modelValue"];
|
|
1
|
+
import type { ComponentConfig } from '@nuxt/ui';
|
|
2
|
+
import type { AppConfig } from 'nuxt/schema';
|
|
3
|
+
import type { DateValue } from '@internationalized/date';
|
|
4
|
+
import type { ValueFormat } from '../composables/useDateFormatter';
|
|
5
|
+
import theme from '#build/movk-ui/date-picker';
|
|
6
|
+
import popoverTheme from '#build/ui/popover';
|
|
7
|
+
import type { DatePickerProps, DatePickerSlots, FormattedValue } from '../types/components/date-picker';
|
|
8
|
+
declare const __VLS_export: <R extends boolean, M extends boolean, P extends "click" | "hover", V extends ValueFormat = "date-value">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
9
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(DatePickerProps<R, M, P, V> & {
|
|
10
|
+
ui?: ComponentConfig<typeof popoverTheme & typeof theme, AppConfig, "datePicker">["slots"];
|
|
11
|
+
} & {
|
|
12
|
+
modelValue?: FormattedValue<R, M, V>;
|
|
17
13
|
}) & {
|
|
18
|
-
|
|
14
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
15
|
+
"onUpdate:modelValue"?: ((value: FormattedValue<R, M, V> | undefined) => any) | undefined;
|
|
16
|
+
"onUpdate:placeholder"?: ((...args: DateValue[]) => any) | undefined;
|
|
17
|
+
"onUpdate:validModelValue"?: ((date: import("reka-ui").DateRange) => any) | undefined;
|
|
18
|
+
"onUpdate:startValue"?: ((date: DateValue | undefined) => any) | undefined;
|
|
19
|
+
"onClose:prevent"?: (() => any) | undefined;
|
|
19
20
|
}> & (typeof globalThis extends {
|
|
20
21
|
__VLS_PROPS_FALLBACK: infer P_1;
|
|
21
22
|
} ? P_1 : {});
|
|
22
23
|
expose: (exposed: {}) => void;
|
|
23
24
|
attrs: any;
|
|
24
|
-
slots:
|
|
25
|
-
|
|
26
|
-
} & {
|
|
27
|
-
leading?: (props: any) => any;
|
|
28
|
-
} & {
|
|
29
|
-
trailing?: (props: any) => any;
|
|
30
|
-
} & {
|
|
31
|
-
anchor?: (props: any) => any;
|
|
32
|
-
} & {
|
|
33
|
-
day?: (props: any) => any;
|
|
34
|
-
} & {
|
|
35
|
-
heading?: (props: any) => any;
|
|
36
|
-
} & {
|
|
37
|
-
'week-day'?: (props: any) => any;
|
|
38
|
-
};
|
|
39
|
-
emit: any;
|
|
25
|
+
slots: DatePickerSlots<P>;
|
|
26
|
+
emit: (((evt: "update:open", value: boolean) => void) & ((evt: "update:modelValue", value: FormattedValue<R, M, V>) => void) & ((evt: "update:placeholder", ...args: [date: DateValue] & [date: DateValue]) => void) & ((evt: "update:validModelValue", date: import("reka-ui").DateRange) => void) & ((evt: "update:startValue", date: DateValue | undefined) => void) & ((evt: "close:prevent") => void)) & ((event: "update:modelValue", value: FormattedValue<R, M, V> | undefined) => void);
|
|
40
27
|
}>) => import("vue").VNode & {
|
|
41
28
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
42
29
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ComponentConfig } from '@nuxt/ui';
|
|
2
|
+
import theme from '#build/movk-ui/message-box';
|
|
3
|
+
import modalTheme from '#build/ui/modal';
|
|
4
|
+
import type { AppConfig } from 'nuxt/schema';
|
|
5
|
+
import type { MessageBoxProps, MessageBoxSlots } from '../types/components/message-box';
|
|
6
|
+
type __VLS_Props = MessageBoxProps & {
|
|
7
|
+
type?: ComponentConfig<typeof modalTheme & typeof theme, AppConfig, 'messageBox'>['variants']['type'];
|
|
8
|
+
ui?: ComponentConfig<typeof modalTheme & typeof theme, AppConfig, 'messageBox'>['slots'];
|
|
9
|
+
};
|
|
10
|
+
type __VLS_Slots = MessageBoxSlots;
|
|
11
|
+
type __VLS_ModelProps = {
|
|
12
|
+
'open'?: boolean;
|
|
13
|
+
};
|
|
14
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
15
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
|
+
close: (confirmed: boolean) => any;
|
|
17
|
+
"update:open": (value: boolean | undefined) => any;
|
|
18
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
19
|
+
onClose?: ((confirmed: boolean) => any) | undefined;
|
|
20
|
+
"onUpdate:open"?: ((value: boolean | undefined) => any) | undefined;
|
|
21
|
+
}>, {
|
|
22
|
+
type: "primary" | "info" | "success" | "warning" | "error" | "neutral";
|
|
23
|
+
title: string;
|
|
24
|
+
mode: "alert" | "confirm";
|
|
25
|
+
alertConfirmLabel: string;
|
|
26
|
+
confirmLabel: string;
|
|
27
|
+
cancelLabel: string;
|
|
28
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
29
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
30
|
+
declare const _default: typeof __VLS_export;
|
|
31
|
+
export default _default;
|
|
32
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
33
|
+
new (): {
|
|
34
|
+
$slots: S;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref, useAttrs } from "vue";
|
|
3
|
+
import { UModal, UButton, UIcon } from "#components";
|
|
4
|
+
import { useAppConfig } from "#imports";
|
|
5
|
+
import { useExtendedTv } from "../utils/extend-theme";
|
|
6
|
+
import theme from "#build/movk-ui/message-box";
|
|
7
|
+
import modalTheme from "#build/ui/modal";
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
title: { type: String, required: false, default: "\u63D0\u793A" },
|
|
10
|
+
type: { type: String, required: false, default: "primary" },
|
|
11
|
+
icon: { type: null, required: false },
|
|
12
|
+
mode: { type: String, required: false, default: "alert" },
|
|
13
|
+
dismissible: { type: Boolean, required: false },
|
|
14
|
+
alertConfirmLabel: { type: String, required: false, default: "\u77E5\u9053\u4E86" },
|
|
15
|
+
confirmLabel: { type: String, required: false, default: "\u786E\u8BA4" },
|
|
16
|
+
cancelLabel: { type: String, required: false, default: "\u53D6\u6D88" },
|
|
17
|
+
confirmButton: { type: Object, required: false },
|
|
18
|
+
cancelButton: { type: Object, required: false },
|
|
19
|
+
ui: { type: Object, required: false }
|
|
20
|
+
});
|
|
21
|
+
const open = defineModel("open", { type: Boolean });
|
|
22
|
+
const emits = defineEmits(["close"]);
|
|
23
|
+
defineSlots();
|
|
24
|
+
defineOptions({ inheritAttrs: false });
|
|
25
|
+
const attrs = useAttrs();
|
|
26
|
+
const appConfig = useAppConfig();
|
|
27
|
+
const iconMap = {
|
|
28
|
+
primary: "i-lucide-bell",
|
|
29
|
+
info: "i-lucide-info",
|
|
30
|
+
success: "i-lucide-circle-check",
|
|
31
|
+
warning: "i-lucide-triangle-alert",
|
|
32
|
+
error: "i-lucide-circle-x",
|
|
33
|
+
neutral: "i-lucide-circle-question-mark"
|
|
34
|
+
};
|
|
35
|
+
const resolvedIcon = computed(() => props.icon ?? iconMap[props.type]);
|
|
36
|
+
const cancelButtonAttrs = computed(() => ({
|
|
37
|
+
color: "neutral",
|
|
38
|
+
variant: "outline",
|
|
39
|
+
label: props.cancelLabel,
|
|
40
|
+
...props.cancelButton ?? {}
|
|
41
|
+
}));
|
|
42
|
+
const confirmButtonAttrs = computed(() => ({
|
|
43
|
+
color: props.type,
|
|
44
|
+
label: props.mode === "alert" ? props.alertConfirmLabel : props.confirmLabel,
|
|
45
|
+
...props.confirmButton ?? {}
|
|
46
|
+
}));
|
|
47
|
+
const closingFromButton = ref(false);
|
|
48
|
+
function handleClose(confirmed) {
|
|
49
|
+
closingFromButton.value = true;
|
|
50
|
+
emits("close", confirmed);
|
|
51
|
+
open.value = false;
|
|
52
|
+
}
|
|
53
|
+
function handleUpdateOpen(val) {
|
|
54
|
+
if (val) return;
|
|
55
|
+
if (closingFromButton.value) {
|
|
56
|
+
closingFromButton.value = false;
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
emits("close", false);
|
|
60
|
+
}
|
|
61
|
+
const { baseUi, extraUi } = useExtendedTv(
|
|
62
|
+
modalTheme,
|
|
63
|
+
theme,
|
|
64
|
+
() => appConfig.movk?.messageBox,
|
|
65
|
+
() => ({ ui: props.ui, variants: { type: props.type } })
|
|
66
|
+
);
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<template>
|
|
70
|
+
<UModal v-model:open="open" :dismissible="props.dismissible" :ui="baseUi" v-bind="attrs" @update:open="handleUpdateOpen">
|
|
71
|
+
<template v-if="$slots.default" #default="slotProps">
|
|
72
|
+
<slot v-bind="slotProps" />
|
|
73
|
+
</template>
|
|
74
|
+
|
|
75
|
+
<template v-if="$slots.content" #content="slotProps">
|
|
76
|
+
<slot name="content" v-bind="slotProps" />
|
|
77
|
+
</template>
|
|
78
|
+
|
|
79
|
+
<template v-if="$slots.header" #header="slotProps">
|
|
80
|
+
<slot name="header" v-bind="slotProps" />
|
|
81
|
+
</template>
|
|
82
|
+
|
|
83
|
+
<template #title="slotProps">
|
|
84
|
+
<slot name="title" v-bind="slotProps">
|
|
85
|
+
<UIcon :name="resolvedIcon" :class="extraUi.icon" />
|
|
86
|
+
<span>{{ props.title }}</span>
|
|
87
|
+
</slot>
|
|
88
|
+
</template>
|
|
89
|
+
|
|
90
|
+
<template v-if="$slots.description" #description="slotProps">
|
|
91
|
+
<slot name="description" v-bind="slotProps" />
|
|
92
|
+
</template>
|
|
93
|
+
|
|
94
|
+
<template v-if="$slots.body" #body="slotProps">
|
|
95
|
+
<slot name="body" v-bind="slotProps" />
|
|
96
|
+
</template>
|
|
97
|
+
|
|
98
|
+
<template v-if="$slots.actions" #actions="slotProps">
|
|
99
|
+
<slot name="actions" v-bind="slotProps" />
|
|
100
|
+
</template>
|
|
101
|
+
|
|
102
|
+
<template v-if="$slots.close" #close="slotProps">
|
|
103
|
+
<slot name="close" v-bind="slotProps" />
|
|
104
|
+
</template>
|
|
105
|
+
|
|
106
|
+
<template #footer="slotProps">
|
|
107
|
+
<slot name="footer" v-bind="slotProps">
|
|
108
|
+
<UButton v-if="props.mode === 'confirm'" v-bind="cancelButtonAttrs" @click="handleClose(false)" />
|
|
109
|
+
<UButton v-bind="confirmButtonAttrs" @click="handleClose(true)" />
|
|
110
|
+
</slot>
|
|
111
|
+
</template>
|
|
112
|
+
</UModal>
|
|
113
|
+
</template>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ComponentConfig } from '@nuxt/ui';
|
|
2
|
+
import theme from '#build/movk-ui/message-box';
|
|
3
|
+
import modalTheme from '#build/ui/modal';
|
|
4
|
+
import type { AppConfig } from 'nuxt/schema';
|
|
5
|
+
import type { MessageBoxProps, MessageBoxSlots } from '../types/components/message-box';
|
|
6
|
+
type __VLS_Props = MessageBoxProps & {
|
|
7
|
+
type?: ComponentConfig<typeof modalTheme & typeof theme, AppConfig, 'messageBox'>['variants']['type'];
|
|
8
|
+
ui?: ComponentConfig<typeof modalTheme & typeof theme, AppConfig, 'messageBox'>['slots'];
|
|
9
|
+
};
|
|
10
|
+
type __VLS_Slots = MessageBoxSlots;
|
|
11
|
+
type __VLS_ModelProps = {
|
|
12
|
+
'open'?: boolean;
|
|
13
|
+
};
|
|
14
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
15
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
|
+
close: (confirmed: boolean) => any;
|
|
17
|
+
"update:open": (value: boolean | undefined) => any;
|
|
18
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
19
|
+
onClose?: ((confirmed: boolean) => any) | undefined;
|
|
20
|
+
"onUpdate:open"?: ((value: boolean | undefined) => any) | undefined;
|
|
21
|
+
}>, {
|
|
22
|
+
type: "primary" | "info" | "success" | "warning" | "error" | "neutral";
|
|
23
|
+
title: string;
|
|
24
|
+
mode: "alert" | "confirm";
|
|
25
|
+
alertConfirmLabel: string;
|
|
26
|
+
confirmLabel: string;
|
|
27
|
+
cancelLabel: string;
|
|
28
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
29
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
30
|
+
declare const _default: typeof __VLS_export;
|
|
31
|
+
export default _default;
|
|
32
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
33
|
+
new (): {
|
|
34
|
+
$slots: S;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { GetItemKeys, GetModelValue } from '@nuxt/ui';
|
|
2
|
+
import type { PillGroupProps, PillGroupSlots, PillItem } from '../types/components/pill-group';
|
|
3
|
+
declare const __VLS_export: <T extends PillItem, VK extends GetItemKeys<T> | undefined = undefined, M extends boolean = false>(__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<{
|
|
4
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(PillGroupProps<T, VK, M> & {
|
|
5
|
+
orientation?: string | number | symbol;
|
|
6
|
+
ui?: {
|
|
7
|
+
[x: string]: import("tailwind-variants").ClassValue;
|
|
8
|
+
};
|
|
9
|
+
} & {
|
|
10
|
+
modelValue?: GetModelValue<T, VK, M>;
|
|
11
|
+
}) & {
|
|
12
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
13
|
+
onChange?: ((value: GetModelValue<T, VK, M, undefined>) => any) | undefined;
|
|
14
|
+
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
15
|
+
onSelect?: ((payload: import("../types").PillSelectPayload<T>) => any) | undefined;
|
|
16
|
+
"onUpdate:modelValue"?: ((value: GetModelValue<T, VK, M, undefined> | undefined) => any) | undefined;
|
|
17
|
+
}> & (typeof globalThis extends {
|
|
18
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
19
|
+
} ? P : {});
|
|
20
|
+
expose: (exposed: {}) => void;
|
|
21
|
+
attrs: any;
|
|
22
|
+
slots: PillGroupSlots<T, VK, M>;
|
|
23
|
+
emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", value: GetModelValue<T, VK, M, undefined>) => void) & ((evt: "focus", event: FocusEvent) => void) & ((evt: "select", payload: import("../types").PillSelectPayload<T>) => void) & ((evt: "update:modelValue", value: GetModelValue<T, VK, M, undefined>) => void)) & ((event: "update:modelValue", value: GetModelValue<T, VK, M> | undefined) => void);
|
|
24
|
+
}>) => import("vue").VNode & {
|
|
25
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
26
|
+
};
|
|
27
|
+
declare const _default: typeof __VLS_export;
|
|
28
|
+
export default _default;
|
|
29
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
30
|
+
[K in keyof T]: T[K];
|
|
31
|
+
} : {
|
|
32
|
+
[K in keyof T as K]: T[K];
|
|
33
|
+
}) & {};
|