@movk/nuxt 1.1.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nuxt/movk-ui.css +3 -0
- package/README.md +75 -104
- package/dist/module.d.mts +59 -1
- package/dist/module.json +2 -2
- package/dist/module.mjs +136 -56
- package/dist/runtime/components/AutoForm.d.vue.ts +10 -31
- package/dist/runtime/components/AutoForm.vue +114 -148
- package/dist/runtime/components/AutoForm.vue.d.ts +10 -31
- package/dist/runtime/components/ColorChooser.d.vue.ts +20 -17
- package/dist/runtime/components/ColorChooser.vue +305 -31
- package/dist/runtime/components/ColorChooser.vue.d.ts +20 -17
- package/dist/runtime/components/DataTable.d.vue.ts +57 -0
- package/dist/runtime/components/DataTable.vue +584 -0
- package/dist/runtime/components/DataTable.vue.d.ts +57 -0
- package/dist/runtime/components/DatePicker.d.vue.ts +15 -22
- package/dist/runtime/components/DatePicker.vue +173 -65
- package/dist/runtime/components/DatePicker.vue.d.ts +15 -22
- package/dist/runtime/components/MessageBox.d.vue.ts +36 -0
- package/dist/runtime/components/MessageBox.vue +113 -0
- package/dist/runtime/components/MessageBox.vue.d.ts +36 -0
- package/dist/runtime/components/PillGroup.d.vue.ts +33 -0
- package/dist/runtime/components/PillGroup.vue +291 -0
- package/dist/runtime/components/PillGroup.vue.d.ts +33 -0
- package/dist/runtime/components/Popconfirm.d.vue.ts +30 -0
- package/dist/runtime/components/Popconfirm.vue +143 -0
- package/dist/runtime/components/Popconfirm.vue.d.ts +30 -0
- package/dist/runtime/components/SearchForm.d.vue.ts +43 -0
- package/dist/runtime/components/SearchForm.vue +274 -0
- package/dist/runtime/components/SearchForm.vue.d.ts +43 -0
- package/dist/runtime/components/SlideVerify.d.vue.ts +13 -79
- package/dist/runtime/components/SlideVerify.vue +117 -90
- package/dist/runtime/components/SlideVerify.vue.d.ts +13 -79
- package/dist/runtime/components/StarRating.d.vue.ts +25 -82
- package/dist/runtime/components/StarRating.vue +128 -99
- package/dist/runtime/components/StarRating.vue.d.ts +25 -82
- package/dist/runtime/components/input/AsPhoneNumberInput.d.vue.ts +32 -0
- package/dist/runtime/components/input/AsPhoneNumberInput.vue +48 -0
- package/dist/runtime/components/input/AsPhoneNumberInput.vue.d.ts +32 -0
- package/dist/runtime/components/input/WithCharacterLimit.d.vue.ts +13 -7
- package/dist/runtime/components/input/WithCharacterLimit.vue +27 -15
- package/dist/runtime/components/input/WithCharacterLimit.vue.d.ts +13 -7
- package/dist/runtime/components/input/WithClear.d.vue.ts +11 -5
- package/dist/runtime/components/input/WithClear.vue +29 -10
- package/dist/runtime/components/input/WithClear.vue.d.ts +11 -5
- package/dist/runtime/components/input/WithCopy.d.vue.ts +13 -7
- package/dist/runtime/components/input/WithCopy.vue +28 -11
- package/dist/runtime/components/input/WithCopy.vue.d.ts +13 -7
- package/dist/runtime/components/input/WithFloatingLabel.d.vue.ts +33 -0
- package/dist/runtime/components/input/WithFloatingLabel.vue +75 -0
- package/dist/runtime/components/input/WithFloatingLabel.vue.d.ts +33 -0
- package/dist/runtime/components/input/WithPasswordToggle.d.vue.ts +13 -7
- package/dist/runtime/components/input/WithPasswordToggle.vue +27 -10
- package/dist/runtime/components/input/WithPasswordToggle.vue.d.ts +13 -7
- package/dist/runtime/components/theme-picker/ThemePicker.d.vue.ts +8 -1
- package/dist/runtime/components/theme-picker/ThemePicker.vue +37 -28
- package/dist/runtime/components/theme-picker/ThemePicker.vue.d.ts +8 -1
- package/dist/runtime/components/theme-picker/ThemePickerButton.d.vue.ts +5 -6
- package/dist/runtime/components/theme-picker/ThemePickerButton.vue +4 -0
- package/dist/runtime/components/theme-picker/ThemePickerButton.vue.d.ts +5 -6
- package/dist/runtime/composables/index.d.ts +9 -8
- package/dist/runtime/composables/index.js +2 -1
- package/dist/runtime/composables/useApiFetch.d.ts +23 -15
- package/dist/runtime/composables/useApiFetch.js +21 -28
- package/dist/runtime/composables/useAutoForm.d.ts +14 -98
- package/dist/runtime/composables/useAutoForm.js +55 -161
- package/dist/runtime/composables/useClientApiFetch.d.ts +7 -7
- package/dist/runtime/composables/useDateFormatter.d.ts +16 -3
- package/dist/runtime/composables/useDateFormatter.js +89 -30
- package/dist/runtime/composables/useDownloadWithProgress.d.ts +26 -27
- package/dist/runtime/composables/useDownloadWithProgress.js +143 -42
- package/dist/runtime/composables/useLazyApiFetch.d.ts +19 -0
- package/dist/runtime/composables/useLazyApiFetch.js +4 -0
- package/dist/runtime/composables/useMessageBox.d.ts +6 -0
- package/dist/runtime/composables/useMessageBox.js +16 -0
- package/dist/runtime/composables/useTheme.d.ts +21 -8
- package/dist/runtime/composables/useTheme.js +109 -86
- package/dist/runtime/composables/useUploadWithProgress.d.ts +22 -28
- package/dist/runtime/composables/useUploadWithProgress.js +79 -68
- package/dist/runtime/domains/api/auth.d.ts +2 -0
- package/dist/runtime/domains/api/auth.js +31 -0
- package/dist/runtime/domains/api/endpoint-config.d.ts +11 -0
- package/dist/runtime/domains/api/endpoint-config.js +17 -0
- package/dist/runtime/domains/api/errors.d.ts +2 -0
- package/dist/runtime/domains/api/errors.js +10 -0
- package/dist/runtime/domains/api/fetch-key.d.ts +20 -0
- package/dist/runtime/domains/api/fetch-key.js +23 -0
- package/dist/runtime/domains/api/interceptors/error.d.ts +13 -0
- package/dist/runtime/domains/api/interceptors/error.js +49 -0
- package/dist/runtime/domains/api/interceptors/request.d.ts +12 -0
- package/dist/runtime/domains/api/interceptors/request.js +46 -0
- package/dist/runtime/domains/api/interceptors/response.d.ts +17 -0
- package/dist/runtime/domains/api/interceptors/response.js +27 -0
- package/dist/runtime/domains/api/response.d.ts +4 -0
- package/dist/runtime/domains/api/response.js +14 -0
- package/dist/runtime/domains/api/toast.d.ts +15 -0
- package/dist/runtime/domains/api/toast.js +46 -0
- package/dist/runtime/domains/api/transfer.d.ts +69 -0
- package/dist/runtime/domains/api/transfer.js +81 -0
- package/dist/runtime/domains/auto-form/actions.d.ts +2 -0
- package/dist/runtime/domains/auto-form/actions.js +4 -0
- package/dist/runtime/domains/auto-form/components/Array.d.vue.ts +13 -0
- package/dist/runtime/{components/auto-form-renderer/AutoFormRendererArray.vue → domains/auto-form/components/Array.vue} +37 -48
- package/dist/runtime/domains/auto-form/components/Array.vue.d.ts +13 -0
- package/dist/runtime/domains/auto-form/components/Children.d.vue.ts +11 -0
- package/dist/runtime/domains/auto-form/components/Children.vue +50 -0
- package/dist/runtime/domains/auto-form/components/Children.vue.d.ts +11 -0
- package/dist/runtime/domains/auto-form/components/Field.d.vue.ts +11 -0
- package/dist/runtime/domains/auto-form/components/Field.vue +56 -0
- package/dist/runtime/domains/auto-form/components/Field.vue.d.ts +11 -0
- package/dist/runtime/domains/auto-form/components/Layout.d.vue.ts +11 -0
- package/dist/runtime/domains/auto-form/components/Layout.vue +89 -0
- package/dist/runtime/domains/auto-form/components/Layout.vue.d.ts +11 -0
- package/dist/runtime/domains/auto-form/components/Nested.d.vue.ts +11 -0
- package/dist/runtime/domains/auto-form/components/Nested.vue +47 -0
- package/dist/runtime/domains/auto-form/components/Nested.vue.d.ts +11 -0
- package/dist/runtime/{constants/auto-form.d.ts → domains/auto-form/constants.d.ts} +0 -2
- package/dist/runtime/{constants/auto-form.js → domains/auto-form/constants.js} +0 -25
- package/dist/runtime/domains/auto-form/controls.d.ts +41 -0
- package/dist/runtime/domains/auto-form/controls.js +73 -0
- package/dist/runtime/{utils/field-utils.d.ts → domains/auto-form/fields.d.ts} +7 -21
- package/dist/runtime/{utils/field-utils.js → domains/auto-form/fields.js} +19 -4
- package/dist/runtime/domains/auto-form/metadata.d.ts +22 -0
- package/dist/runtime/domains/auto-form/metadata.js +53 -0
- package/dist/runtime/domains/auto-form/provider.d.ts +62 -0
- package/dist/runtime/{internal/useAutoFormProvider.js → domains/auto-form/provider.js} +6 -3
- package/dist/runtime/domains/auto-form/reactive.d.ts +12 -0
- package/dist/runtime/{utils/reactive-utils.js → domains/auto-form/reactive.js} +1 -1
- package/dist/runtime/domains/auto-form/schema.d.ts +7 -0
- package/dist/runtime/{utils/schema-introspector.js → domains/auto-form/schema.js} +12 -10
- package/dist/runtime/domains/data-table/columns/constants.d.ts +50 -0
- package/dist/runtime/domains/data-table/columns/constants.js +19 -0
- package/dist/runtime/domains/data-table/columns/resolve-columns.d.ts +4 -0
- package/dist/runtime/domains/data-table/columns/resolve-columns.js +59 -0
- package/dist/runtime/domains/data-table/columns/resolve-data-column.d.ts +9 -0
- package/dist/runtime/domains/data-table/columns/resolve-data-column.js +164 -0
- package/dist/runtime/domains/data-table/columns/resolve-group-column.d.ts +4 -0
- package/dist/runtime/domains/data-table/columns/resolve-group-column.js +19 -0
- package/dist/runtime/domains/data-table/columns/resolve-special-columns.d.ts +8 -0
- package/dist/runtime/domains/data-table/columns/resolve-special-columns.js +232 -0
- package/dist/runtime/domains/data-table/columns/style.d.ts +11 -0
- package/dist/runtime/domains/data-table/columns/style.js +67 -0
- package/dist/runtime/domains/data-table/columns/utils.d.ts +6 -0
- package/dist/runtime/domains/data-table/columns/utils.js +16 -0
- package/dist/runtime/domains/data-table/components/ActionConfirm.d.vue.ts +10 -0
- package/dist/runtime/domains/data-table/components/ActionConfirm.vue +39 -0
- package/dist/runtime/domains/data-table/components/ActionConfirm.vue.d.ts +10 -0
- package/dist/runtime/domains/data-table/components/ActionsCell.d.vue.ts +11 -0
- package/dist/runtime/domains/data-table/components/ActionsCell.vue +91 -0
- package/dist/runtime/domains/data-table/components/ActionsCell.vue.d.ts +11 -0
- package/dist/runtime/domains/data-table/components/CellTooltip.d.vue.ts +9 -0
- package/dist/runtime/domains/data-table/components/CellTooltip.vue +40 -0
- package/dist/runtime/domains/data-table/components/CellTooltip.vue.d.ts +9 -0
- package/dist/runtime/domains/data-table/components/Pagination.d.vue.ts +26 -0
- package/dist/runtime/domains/data-table/components/Pagination.vue +132 -0
- package/dist/runtime/domains/data-table/components/Pagination.vue.d.ts +26 -0
- package/dist/runtime/domains/data-table/indent.d.ts +8 -0
- package/dist/runtime/domains/data-table/indent.js +19 -0
- package/dist/runtime/domains/data-table/tree-selection.d.ts +9 -0
- package/dist/runtime/domains/data-table/tree-selection.js +76 -0
- package/dist/runtime/{utils/theme.d.ts → domains/theme/theme-icons.d.ts} +0 -1
- package/dist/runtime/index.css +1 -0
- package/dist/runtime/plugins/api.factory.js +28 -171
- package/dist/runtime/plugins/theme.js +72 -70
- package/dist/runtime/types/api/config.d.ts +127 -0
- package/dist/runtime/types/api/fetch.d.ts +50 -0
- package/dist/runtime/types/api/index.d.ts +5 -0
- package/dist/runtime/types/api/module.d.ts +94 -0
- package/dist/runtime/types/api/response.d.ts +62 -0
- package/dist/runtime/types/api/transfer.d.ts +32 -0
- package/dist/runtime/types/api/transfer.js +0 -0
- package/dist/runtime/types/app.config.d.ts +6 -0
- package/dist/runtime/types/auto-form/base.d.ts +26 -0
- package/dist/runtime/types/auto-form/base.js +0 -0
- package/dist/runtime/types/auto-form/component.d.ts +28 -0
- package/dist/runtime/types/auto-form/component.js +0 -0
- package/dist/runtime/types/auto-form/controls.d.ts +45 -0
- package/dist/runtime/types/auto-form/controls.js +0 -0
- package/dist/runtime/types/auto-form/fields.d.ts +68 -0
- package/dist/runtime/types/auto-form/fields.js +0 -0
- package/dist/runtime/types/auto-form/index.d.ts +7 -0
- package/dist/runtime/types/auto-form/index.js +0 -0
- package/dist/runtime/types/auto-form/search-form.d.ts +84 -0
- package/dist/runtime/types/auto-form/search-form.js +0 -0
- package/dist/runtime/types/auto-form/slots.d.ts +85 -0
- package/dist/runtime/types/auto-form/slots.js +0 -0
- package/dist/runtime/types/auto-form/zod-factory.d.ts +127 -0
- package/dist/runtime/types/auto-form/zod-factory.js +0 -0
- package/dist/runtime/types/components/color-chooser.d.ts +109 -0
- package/dist/runtime/types/components/color-chooser.js +0 -0
- package/dist/runtime/types/components/date-picker.d.ts +41 -0
- package/dist/runtime/types/components/date-picker.js +0 -0
- package/dist/runtime/types/components/index.d.ts +8 -0
- package/dist/runtime/types/components/index.js +0 -0
- package/dist/runtime/types/components/input/as-phone-number-input.d.ts +17 -0
- package/dist/runtime/types/components/input/as-phone-number-input.js +0 -0
- package/dist/runtime/types/components/input/index.d.ts +6 -0
- package/dist/runtime/types/components/input/index.js +0 -0
- package/dist/runtime/types/components/input/with-character-limit.d.ts +11 -0
- package/dist/runtime/types/components/input/with-character-limit.js +0 -0
- package/dist/runtime/types/components/input/with-clear.d.ts +10 -0
- package/dist/runtime/types/components/input/with-clear.js +0 -0
- package/dist/runtime/types/components/input/with-copy.d.ts +11 -0
- package/dist/runtime/types/components/input/with-copy.js +0 -0
- package/dist/runtime/types/components/input/with-floating-label.d.ts +12 -0
- package/dist/runtime/types/components/input/with-floating-label.js +0 -0
- package/dist/runtime/types/components/input/with-password-toggle.d.ts +7 -0
- package/dist/runtime/types/components/input/with-password-toggle.js +0 -0
- package/dist/runtime/types/components/message-box.d.ts +69 -0
- package/dist/runtime/types/components/message-box.js +0 -0
- package/dist/runtime/types/components/pill-group.d.ts +103 -0
- package/dist/runtime/types/components/pill-group.js +0 -0
- package/dist/runtime/types/components/popconfirm.d.ts +74 -0
- package/dist/runtime/types/components/popconfirm.js +0 -0
- package/dist/runtime/types/components/slide-verify.d.ts +54 -0
- package/dist/runtime/types/components/slide-verify.js +0 -0
- package/dist/runtime/types/components/star-rating.d.ts +55 -0
- package/dist/runtime/types/components/star-rating.js +0 -0
- package/dist/runtime/types/data-table/columns.d.ts +236 -0
- package/dist/runtime/types/data-table/columns.js +6 -0
- package/dist/runtime/types/data-table/component.d.ts +190 -0
- package/dist/runtime/types/data-table/component.js +0 -0
- package/dist/runtime/types/data-table/contexts.d.ts +44 -0
- package/dist/runtime/types/data-table/contexts.js +0 -0
- package/dist/runtime/types/data-table/index.d.ts +6 -0
- package/dist/runtime/types/data-table/index.js +1 -0
- package/dist/runtime/types/data-table/pagination.d.ts +87 -0
- package/dist/runtime/types/data-table/pagination.js +0 -0
- package/dist/runtime/types/index.d.ts +6 -5
- package/dist/runtime/types/index.js +5 -5
- package/dist/runtime/types/shared.d.ts +5 -0
- package/dist/runtime/types/shared.js +0 -0
- package/dist/runtime/types/zod.d.ts +19 -17
- package/dist/runtime/utils/extend-theme.d.ts +19 -0
- package/dist/runtime/utils/extend-theme.js +44 -0
- package/dist/runtime/utils/form-control.d.ts +33 -0
- package/dist/runtime/utils/form-control.js +54 -0
- package/dist/runtime/utils/meta.d.ts +4 -0
- package/dist/runtime/utils/meta.js +14 -0
- package/dist/runtime/utils/theme-defaults.d.ts +27 -0
- package/dist/runtime/utils/theme-defaults.js +28 -0
- package/dist/runtime/utils/tv.d.ts +1 -0
- package/dist/runtime/utils/tv.js +4 -0
- package/dist/runtime/vue/composables/useSiteConfig.d.ts +13 -0
- package/dist/runtime/vue/composables/useSiteConfig.js +11 -0
- package/dist/runtime/vue/plugins/theme.d.ts +6 -0
- package/dist/runtime/vue/plugins/theme.js +14 -0
- package/dist/runtime/vue/stubs/base.d.ts +2 -0
- package/dist/runtime/vue/stubs/base.js +2 -0
- package/dist/runtime/vue/stubs/inertia.d.ts +2 -0
- package/dist/runtime/vue/stubs/inertia.js +2 -0
- package/dist/runtime/vue/stubs/movk-extra.d.ts +2 -0
- package/dist/runtime/vue/stubs/movk-extra.js +2 -0
- package/dist/runtime/vue/stubs/none.d.ts +2 -0
- package/dist/runtime/vue/stubs/none.js +2 -0
- package/dist/runtime/vue/stubs/vue-router.d.ts +2 -0
- package/dist/runtime/vue/stubs/vue-router.js +2 -0
- package/dist/shared/nuxt.DfBEyjld.mjs +667 -0
- package/dist/types.d.mts +2 -6
- package/dist/unplugin.d.mts +28 -0
- package/dist/unplugin.mjs +292 -0
- package/dist/vite.d.mts +12 -0
- package/dist/vite.mjs +20 -0
- package/package.json +82 -42
- package/vue-plugin.d.ts +5 -0
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.d.vue.ts +0 -20
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.vue.d.ts +0 -20
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.d.vue.ts +0 -20
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue +0 -55
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue.d.ts +0 -20
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.d.vue.ts +0 -20
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.vue +0 -125
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.vue.d.ts +0 -20
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.d.vue.ts +0 -20
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.vue +0 -105
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.vue.d.ts +0 -20
- package/dist/runtime/composables/useApiAuth.d.ts +0 -47
- package/dist/runtime/composables/useApiAuth.js +0 -66
- package/dist/runtime/internal/useAutoFormProvider.d.ts +0 -50
- package/dist/runtime/schemas/api.d.ts +0 -590
- package/dist/runtime/schemas/api.js +0 -228
- package/dist/runtime/server/api/_movk/session.post.d.ts +0 -10
- package/dist/runtime/server/api/_movk/session.post.js +0 -18
- package/dist/runtime/style.css +0 -1
- package/dist/runtime/types/api.d.ts +0 -218
- package/dist/runtime/types/auth.d.ts +0 -34
- package/dist/runtime/types/auto-form-renderer.d.ts +0 -22
- package/dist/runtime/types/auto-form.d.ts +0 -548
- package/dist/runtime/types/components.d.ts +0 -43
- package/dist/runtime/types/module.d.ts +0 -39
- package/dist/runtime/utils/api-utils.d.ts +0 -79
- package/dist/runtime/utils/api-utils.js +0 -127
- package/dist/runtime/utils/auto-form.d.ts +0 -3
- package/dist/runtime/utils/auto-form.js +0 -18
- package/dist/runtime/utils/reactive-utils.d.ts +0 -30
- package/dist/runtime/utils/schema-introspector.d.ts +0 -13
- /package/dist/runtime/{utils/theme.js → domains/theme/theme-icons.js} +0 -0
- /package/dist/runtime/types/{api.js → api/config.js} +0 -0
- /package/dist/runtime/types/{auto-form-renderer.js → api/fetch.js} +0 -0
- /package/dist/runtime/types/{auto-form.js → api/index.js} +0 -0
- /package/dist/runtime/types/{module.js → api/module.js} +0 -0
- /package/dist/runtime/types/{components.js → api/response.js} +0 -0
|
@@ -1,42 +1,73 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { UButton, UBadge } from "#components";
|
|
3
3
|
import { computed, ref } from "vue";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
halfIcon = "i-lucide-star-half",
|
|
14
|
-
color = "warning",
|
|
15
|
-
size = "sm",
|
|
16
|
-
allowHalf = false,
|
|
17
|
-
clearable = false
|
|
18
|
-
} = defineProps({
|
|
19
|
-
modelValue: { type: Number, required: false },
|
|
20
|
-
max: { type: Number, required: false },
|
|
4
|
+
import { FieldGroupReset } from "@nuxt/ui/composables/useFieldGroup";
|
|
5
|
+
import { useAppConfig } from "#imports";
|
|
6
|
+
import theme from "#build/movk-ui/star-rating";
|
|
7
|
+
import { useExtendedTv } from "../utils/extend-theme";
|
|
8
|
+
import { useFieldControl } from "../utils/form-control";
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
id: { type: String, required: false },
|
|
11
|
+
name: { type: String, required: false },
|
|
12
|
+
max: { type: Number, required: false, default: 5 },
|
|
21
13
|
disabled: { type: Boolean, required: false },
|
|
14
|
+
highlight: { type: Boolean, required: false },
|
|
22
15
|
readonly: { type: Boolean, required: false },
|
|
23
|
-
showBadge: { type: Boolean, required: false },
|
|
16
|
+
showBadge: { type: Boolean, required: false, default: true },
|
|
24
17
|
buttonProps: { type: Object, required: false },
|
|
25
|
-
emptyIcon: { type:
|
|
26
|
-
filledIcon: { type:
|
|
27
|
-
halfIcon: { type:
|
|
18
|
+
emptyIcon: { type: null, required: false, default: "i-lucide-star" },
|
|
19
|
+
filledIcon: { type: null, required: false, default: "i-lucide-star" },
|
|
20
|
+
halfIcon: { type: null, required: false, default: "i-lucide-star-half" },
|
|
28
21
|
color: { type: null, required: false },
|
|
29
22
|
size: { type: null, required: false },
|
|
30
23
|
allowHalf: { type: Boolean, required: false },
|
|
31
|
-
clearable: { type: Boolean, required: false }
|
|
24
|
+
clearable: { type: Boolean, required: false },
|
|
25
|
+
class: { type: null, required: false },
|
|
26
|
+
ui: { type: Object, required: false }
|
|
32
27
|
});
|
|
33
|
-
const
|
|
28
|
+
const modelValue = defineModel({ type: Number, ...{ default: 0 } });
|
|
29
|
+
const emits = defineEmits(["change", "hover"]);
|
|
34
30
|
defineOptions({ inheritAttrs: false });
|
|
31
|
+
const {
|
|
32
|
+
id,
|
|
33
|
+
name,
|
|
34
|
+
size: effectiveSize,
|
|
35
|
+
color: effectiveColor,
|
|
36
|
+
disabled: effectiveDisabled,
|
|
37
|
+
fieldGroupOrientation,
|
|
38
|
+
ariaAttrs,
|
|
39
|
+
emitFormBlur,
|
|
40
|
+
emitFormChange,
|
|
41
|
+
emitFormFocus,
|
|
42
|
+
emitFormInput
|
|
43
|
+
} = useFieldControl(props);
|
|
35
44
|
const hoveredStar = ref(null);
|
|
36
45
|
const focusedIndex = ref(0);
|
|
37
|
-
const isInteractive = computed(() => !
|
|
46
|
+
const isInteractive = computed(() => !effectiveDisabled.value && !props.readonly);
|
|
47
|
+
const appConfig = useAppConfig();
|
|
48
|
+
const { extendUi } = useExtendedTv(
|
|
49
|
+
{ slots: {} },
|
|
50
|
+
theme,
|
|
51
|
+
() => appConfig.movk?.starRating,
|
|
52
|
+
() => ({
|
|
53
|
+
ui: {
|
|
54
|
+
...props.ui,
|
|
55
|
+
root: [props.ui?.root, props.class]
|
|
56
|
+
},
|
|
57
|
+
variants: {
|
|
58
|
+
interactive: isInteractive.value,
|
|
59
|
+
disabled: effectiveDisabled.value,
|
|
60
|
+
readonly: props.readonly && !effectiveDisabled.value,
|
|
61
|
+
fieldGroup: fieldGroupOrientation.value
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
);
|
|
65
|
+
function emitFormValueChange() {
|
|
66
|
+
emitFormInput();
|
|
67
|
+
emitFormChange();
|
|
68
|
+
}
|
|
38
69
|
function calculateHalfStarValue(index, event) {
|
|
39
|
-
if (!allowHalf) return index + 1;
|
|
70
|
+
if (!props.allowHalf) return index + 1;
|
|
40
71
|
const target = event.currentTarget;
|
|
41
72
|
const rect = target.getBoundingClientRect();
|
|
42
73
|
const posX = event.clientX - rect.left;
|
|
@@ -44,13 +75,10 @@ function calculateHalfStarValue(index, event) {
|
|
|
44
75
|
return posX < halfWidth ? index + 0.5 : index + 1;
|
|
45
76
|
}
|
|
46
77
|
function updateValue(newValue) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
emit("update:modelValue", newValue);
|
|
53
|
-
emit("change", newValue);
|
|
78
|
+
const finalValue = props.clearable && newValue === modelValue.value ? 0 : newValue;
|
|
79
|
+
modelValue.value = finalValue;
|
|
80
|
+
emits("change", finalValue);
|
|
81
|
+
emitFormValueChange();
|
|
54
82
|
}
|
|
55
83
|
function handleClick(index, event) {
|
|
56
84
|
if (!isInteractive.value || !event) return;
|
|
@@ -61,40 +89,40 @@ function handleMouseEnter(index, event) {
|
|
|
61
89
|
if (!isInteractive.value || !event) return;
|
|
62
90
|
const hoverValue = calculateHalfStarValue(index, event);
|
|
63
91
|
hoveredStar.value = hoverValue - 1;
|
|
64
|
-
|
|
92
|
+
emits("hover", hoverValue);
|
|
65
93
|
}
|
|
66
94
|
function handleMouseMove(index, event) {
|
|
67
|
-
if (!isInteractive.value || !allowHalf) return;
|
|
95
|
+
if (!isInteractive.value || !props.allowHalf) return;
|
|
68
96
|
const hoverValue = calculateHalfStarValue(index, event);
|
|
69
97
|
const currentHover = hoveredStar.value !== null ? hoveredStar.value + 1 : null;
|
|
70
98
|
if (currentHover !== hoverValue) {
|
|
71
99
|
hoveredStar.value = hoverValue - 1;
|
|
72
|
-
|
|
100
|
+
emits("hover", hoverValue);
|
|
73
101
|
}
|
|
74
102
|
}
|
|
75
103
|
function handleMouseLeave() {
|
|
76
104
|
if (!isInteractive.value) return;
|
|
77
105
|
hoveredStar.value = null;
|
|
78
|
-
|
|
106
|
+
emits("hover", null);
|
|
79
107
|
}
|
|
80
108
|
function handleKeyDown(event) {
|
|
81
109
|
if (!isInteractive.value) return;
|
|
82
|
-
const step = allowHalf ? 0.5 : 1;
|
|
110
|
+
const step = props.allowHalf ? 0.5 : 1;
|
|
83
111
|
switch (event.key) {
|
|
84
112
|
case "ArrowRight":
|
|
85
113
|
case "ArrowUp":
|
|
86
114
|
event.preventDefault();
|
|
87
|
-
if (modelValue < max) {
|
|
88
|
-
updateValue(Math.min(modelValue + step, max));
|
|
89
|
-
focusedIndex.value = Math.min(Math.floor(modelValue + step), max - 1);
|
|
115
|
+
if (modelValue.value < props.max) {
|
|
116
|
+
updateValue(Math.min(modelValue.value + step, props.max));
|
|
117
|
+
focusedIndex.value = Math.min(Math.floor(modelValue.value + step), props.max - 1);
|
|
90
118
|
}
|
|
91
119
|
break;
|
|
92
120
|
case "ArrowLeft":
|
|
93
121
|
case "ArrowDown":
|
|
94
122
|
event.preventDefault();
|
|
95
|
-
if (modelValue > 0) {
|
|
96
|
-
updateValue(Math.max(modelValue - step, 0));
|
|
97
|
-
focusedIndex.value = Math.max(Math.floor(modelValue - step) - 1, 0);
|
|
123
|
+
if (modelValue.value > 0) {
|
|
124
|
+
updateValue(Math.max(modelValue.value - step, 0));
|
|
125
|
+
focusedIndex.value = Math.max(Math.floor(modelValue.value - step) - 1, 0);
|
|
98
126
|
}
|
|
99
127
|
break;
|
|
100
128
|
case "Home":
|
|
@@ -104,12 +132,12 @@ function handleKeyDown(event) {
|
|
|
104
132
|
break;
|
|
105
133
|
case "End":
|
|
106
134
|
event.preventDefault();
|
|
107
|
-
updateValue(max);
|
|
108
|
-
focusedIndex.value = max - 1;
|
|
135
|
+
updateValue(props.max);
|
|
136
|
+
focusedIndex.value = props.max - 1;
|
|
109
137
|
break;
|
|
110
138
|
case "Backspace":
|
|
111
139
|
case "Delete":
|
|
112
|
-
if (clearable) {
|
|
140
|
+
if (props.clearable) {
|
|
113
141
|
event.preventDefault();
|
|
114
142
|
updateValue(0);
|
|
115
143
|
focusedIndex.value = 0;
|
|
@@ -118,7 +146,7 @@ function handleKeyDown(event) {
|
|
|
118
146
|
default:
|
|
119
147
|
if (event.key >= "0" && event.key <= "9") {
|
|
120
148
|
const numValue = Number.parseInt(event.key);
|
|
121
|
-
if (numValue <= max) {
|
|
149
|
+
if (numValue <= props.max) {
|
|
122
150
|
event.preventDefault();
|
|
123
151
|
updateValue(numValue);
|
|
124
152
|
focusedIndex.value = Math.max(numValue - 1, 0);
|
|
@@ -127,83 +155,84 @@ function handleKeyDown(event) {
|
|
|
127
155
|
}
|
|
128
156
|
}
|
|
129
157
|
function getStarState(index) {
|
|
130
|
-
const displayValue = hoveredStar.value !== null ? hoveredStar.value + 1 : modelValue;
|
|
158
|
+
const displayValue = hoveredStar.value !== null ? hoveredStar.value + 1 : modelValue.value;
|
|
131
159
|
if (index < Math.floor(displayValue)) {
|
|
132
160
|
return "full";
|
|
133
161
|
}
|
|
134
|
-
if (allowHalf && index === Math.floor(displayValue) && displayValue % 1 !== 0) {
|
|
162
|
+
if (props.allowHalf && index === Math.floor(displayValue) && displayValue % 1 !== 0) {
|
|
135
163
|
return "half";
|
|
136
164
|
}
|
|
137
165
|
return "empty";
|
|
138
166
|
}
|
|
139
167
|
function getStarIcon(index) {
|
|
140
168
|
const state = getStarState(index);
|
|
141
|
-
if (state === "full") return filledIcon;
|
|
142
|
-
if (state === "half") return halfIcon;
|
|
143
|
-
return emptyIcon;
|
|
169
|
+
if (state === "full") return props.filledIcon;
|
|
170
|
+
if (state === "half") return props.halfIcon;
|
|
171
|
+
return props.emptyIcon;
|
|
144
172
|
}
|
|
145
173
|
function getStarColor(index) {
|
|
146
174
|
const state = getStarState(index);
|
|
147
|
-
return state !== "empty" ?
|
|
175
|
+
return state !== "empty" ? effectiveColor.value : "neutral";
|
|
148
176
|
}
|
|
149
|
-
const badgeLabel = computed(() => `${modelValue}/${max}`);
|
|
177
|
+
const badgeLabel = computed(() => `${modelValue.value}/${props.max}`);
|
|
150
178
|
</script>
|
|
151
179
|
|
|
152
180
|
<template>
|
|
153
181
|
<div
|
|
154
|
-
|
|
182
|
+
:id="id"
|
|
183
|
+
:name="name"
|
|
184
|
+
:class="extendUi.root"
|
|
155
185
|
role="slider"
|
|
156
|
-
:aria-label="`\u8BC4\u5206 ${modelValue} / ${max}`"
|
|
186
|
+
:aria-label="`\u8BC4\u5206 ${modelValue} / ${props.max}`"
|
|
157
187
|
:aria-valuenow="modelValue"
|
|
158
188
|
:aria-valuemin="0"
|
|
159
|
-
:aria-valuemax="max"
|
|
160
|
-
:aria-disabled="
|
|
161
|
-
:aria-readonly="readonly"
|
|
189
|
+
:aria-valuemax="props.max"
|
|
190
|
+
:aria-disabled="effectiveDisabled"
|
|
191
|
+
:aria-readonly="props.readonly"
|
|
162
192
|
:tabindex="isInteractive ? 0 : -1"
|
|
193
|
+
v-bind="ariaAttrs"
|
|
194
|
+
@blur="emitFormBlur"
|
|
195
|
+
@focus="emitFormFocus"
|
|
163
196
|
@keydown="handleKeyDown"
|
|
164
197
|
>
|
|
165
|
-
<
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
@mouseenter="handleMouseEnter(index - 1, $event)"
|
|
187
|
-
@mousemove="handleMouseMove(index - 1, $event)"
|
|
188
|
-
@mouseleave="handleMouseLeave"
|
|
189
|
-
/>
|
|
190
|
-
</div>
|
|
198
|
+
<FieldGroupReset>
|
|
199
|
+
<slot name="prefix" :value="modelValue" :max="props.max" />
|
|
200
|
+
<div :class="extendUi.stars">
|
|
201
|
+
<UButton
|
|
202
|
+
v-for="index in props.max"
|
|
203
|
+
:key="index"
|
|
204
|
+
:icon="getStarIcon(index - 1)"
|
|
205
|
+
:color="getStarColor(index - 1)"
|
|
206
|
+
variant="ghost"
|
|
207
|
+
:size="effectiveSize"
|
|
208
|
+
:disabled="effectiveDisabled"
|
|
209
|
+
:aria-label="`${index} \u661F`"
|
|
210
|
+
:tabindex="-1"
|
|
211
|
+
v-bind="buttonProps"
|
|
212
|
+
:class="extendUi.star"
|
|
213
|
+
@click="handleClick(index - 1, $event)"
|
|
214
|
+
@mouseenter="handleMouseEnter(index - 1, $event)"
|
|
215
|
+
@mousemove="handleMouseMove(index - 1, $event)"
|
|
216
|
+
@mouseleave="handleMouseLeave"
|
|
217
|
+
/>
|
|
218
|
+
</div>
|
|
191
219
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
:label="badgeLabel"
|
|
197
|
-
>
|
|
198
|
-
<UBadge
|
|
199
|
-
v-if="showBadge && modelValue > 0"
|
|
220
|
+
<slot
|
|
221
|
+
name="badge"
|
|
222
|
+
:value="modelValue"
|
|
223
|
+
:max="props.max"
|
|
200
224
|
:label="badgeLabel"
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
225
|
+
>
|
|
226
|
+
<UBadge
|
|
227
|
+
v-if="showBadge && modelValue > 0"
|
|
228
|
+
:label="badgeLabel"
|
|
229
|
+
color="primary"
|
|
230
|
+
variant="subtle"
|
|
231
|
+
:size="effectiveSize"
|
|
232
|
+
/>
|
|
233
|
+
</slot>
|
|
206
234
|
|
|
207
|
-
|
|
235
|
+
<slot name="suffix" :value="modelValue" :max="props.max" />
|
|
236
|
+
</FieldGroupReset>
|
|
208
237
|
</div>
|
|
209
238
|
</template>
|
|
@@ -1,104 +1,47 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import type { ComponentConfig } from '@nuxt/ui';
|
|
2
|
+
import theme from '#build/movk-ui/star-rating';
|
|
3
|
+
import type { AppConfig } from 'nuxt/schema';
|
|
4
|
+
import type { StarRatingProps } from '../types/components/star-rating';
|
|
5
|
+
type __VLS_Props = StarRatingProps & {
|
|
6
|
+
ui?: ComponentConfig<typeof theme, AppConfig, 'starRating'>['slots'];
|
|
7
|
+
};
|
|
8
|
+
type __VLS_ModelProps = {
|
|
7
9
|
modelValue?: number;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
max?: number;
|
|
13
|
-
/**
|
|
14
|
-
* 是否禁用
|
|
15
|
-
* @defaultValue false
|
|
16
|
-
*/
|
|
17
|
-
disabled?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* 是否只读
|
|
20
|
-
* @defaultValue false
|
|
21
|
-
*/
|
|
22
|
-
readonly?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* 是否显示评分徽章
|
|
25
|
-
* @defaultValue true
|
|
26
|
-
*/
|
|
27
|
-
showBadge?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* 自定义星星按钮属性
|
|
30
|
-
*/
|
|
31
|
-
buttonProps?: Partial<ButtonProps>;
|
|
32
|
-
/**
|
|
33
|
-
* 未选中星星的图标
|
|
34
|
-
* @defaultValue 'i-lucide-star'
|
|
35
|
-
*/
|
|
36
|
-
emptyIcon?: string;
|
|
37
|
-
/**
|
|
38
|
-
* 选中星星的图标
|
|
39
|
-
* @defaultValue 'i-lucide-star'
|
|
40
|
-
*/
|
|
41
|
-
filledIcon?: string;
|
|
42
|
-
/**
|
|
43
|
-
* 半星图标
|
|
44
|
-
* @defaultValue 'i-lucide-star-half'
|
|
45
|
-
*/
|
|
46
|
-
halfIcon?: string;
|
|
47
|
-
/**
|
|
48
|
-
* 选中星星的颜色
|
|
49
|
-
* @defaultValue 'warning'
|
|
50
|
-
*/
|
|
51
|
-
color?: ButtonProps['color'];
|
|
52
|
-
/**
|
|
53
|
-
* 星星大小
|
|
54
|
-
* @defaultValue 'sm'
|
|
55
|
-
*/
|
|
56
|
-
size?: ButtonProps['size'];
|
|
57
|
-
/**
|
|
58
|
-
* 是否允许半星
|
|
59
|
-
* @defaultValue false
|
|
60
|
-
*/
|
|
61
|
-
allowHalf?: boolean;
|
|
62
|
-
/**
|
|
63
|
-
* 是否允许清除评分
|
|
64
|
-
* @defaultValue false
|
|
65
|
-
*/
|
|
66
|
-
clearable?: boolean;
|
|
67
|
-
}
|
|
68
|
-
export interface StarRatingEmits {
|
|
69
|
-
'update:modelValue': [value: number];
|
|
70
|
-
/** 评分改变事件 */
|
|
71
|
-
'change': [value: number];
|
|
72
|
-
/** 悬停事件 */
|
|
73
|
-
'hover': [value: number | null];
|
|
74
|
-
}
|
|
75
|
-
declare var __VLS_1: {
|
|
10
|
+
};
|
|
11
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
12
|
+
declare var __VLS_7: {
|
|
76
13
|
value: number;
|
|
77
14
|
max: number;
|
|
78
|
-
},
|
|
15
|
+
}, __VLS_19: {
|
|
79
16
|
value: number;
|
|
80
17
|
max: number;
|
|
81
18
|
label: string;
|
|
82
|
-
},
|
|
19
|
+
}, __VLS_26: {
|
|
83
20
|
value: number;
|
|
84
21
|
max: number;
|
|
85
22
|
};
|
|
86
23
|
type __VLS_Slots = {} & {
|
|
87
|
-
prefix?: (props: typeof
|
|
24
|
+
prefix?: (props: typeof __VLS_7) => any;
|
|
88
25
|
} & {
|
|
89
|
-
badge?: (props: typeof
|
|
26
|
+
badge?: (props: typeof __VLS_19) => any;
|
|
90
27
|
} & {
|
|
91
|
-
suffix?: (props: typeof
|
|
28
|
+
suffix?: (props: typeof __VLS_26) => any;
|
|
92
29
|
};
|
|
93
|
-
declare const __VLS_base: import("vue").DefineComponent<
|
|
30
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
94
31
|
change: (value: number) => any;
|
|
95
32
|
hover: (value: number | null) => any;
|
|
96
33
|
"update:modelValue": (value: number) => any;
|
|
97
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
34
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
98
35
|
onChange?: ((value: number) => any) | undefined;
|
|
99
36
|
onHover?: ((value: number | null) => any) | undefined;
|
|
100
37
|
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
101
|
-
}>, {
|
|
38
|
+
}>, {
|
|
39
|
+
max: number;
|
|
40
|
+
showBadge: boolean;
|
|
41
|
+
emptyIcon: import("@nuxt/ui").IconProps["name"];
|
|
42
|
+
filledIcon: import("@nuxt/ui").IconProps["name"];
|
|
43
|
+
halfIcon: import("@nuxt/ui").IconProps["name"];
|
|
44
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
102
45
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
103
46
|
declare const _default: typeof __VLS_export;
|
|
104
47
|
export default _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ComponentConfig, InputSlots, InputValue } from '@nuxt/ui';
|
|
2
|
+
import type { OmitByKey } from '@movk/core';
|
|
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';
|
|
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<{
|
|
8
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(AsPhoneNumberInputProps<T> & {
|
|
9
|
+
ui?: ComponentConfig<typeof inputTheme & typeof theme, AppConfig, "asPhoneNumberInput">["slots"];
|
|
10
|
+
} & {
|
|
11
|
+
modelValue?: T;
|
|
12
|
+
}) & {
|
|
13
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
14
|
+
onChange?: ((event: Event) => any) | undefined;
|
|
15
|
+
"onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
|
|
16
|
+
}> & (typeof globalThis extends {
|
|
17
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
18
|
+
} ? P : {});
|
|
19
|
+
expose: (exposed: {}) => void;
|
|
20
|
+
attrs: any;
|
|
21
|
+
slots: OmitByKey<InputSlots, "leading">;
|
|
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);
|
|
23
|
+
}>) => import("vue").VNode & {
|
|
24
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
25
|
+
};
|
|
26
|
+
declare const _default: typeof __VLS_export;
|
|
27
|
+
export default _default;
|
|
28
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
29
|
+
[K in keyof T]: T[K];
|
|
30
|
+
} : {
|
|
31
|
+
[K in keyof T as K]: T[K];
|
|
32
|
+
}) & {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { UInput } from "#components";
|
|
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";
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
mask: { type: String, required: false, default: "(###) ###-####" },
|
|
11
|
+
dialCode: { type: String, required: false, default: "+86" },
|
|
12
|
+
ui: { type: Object, required: false }
|
|
13
|
+
});
|
|
14
|
+
const modelValue = defineModel({ type: null });
|
|
15
|
+
const emits = defineEmits(["update:modelValue", "blur", "change"]);
|
|
16
|
+
const slots = defineSlots();
|
|
17
|
+
defineOptions({ inheritAttrs: false });
|
|
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
|
+
);
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<UInput
|
|
30
|
+
v-model="modelValue"
|
|
31
|
+
v-maska="props.mask"
|
|
32
|
+
type="tel"
|
|
33
|
+
:placeholder="props.placeholder ?? props.mask.replaceAll('#', '_')"
|
|
34
|
+
:style="props.dialCode ? { '--dial-code-length': `${props.dialCode.length + 1.5}ch` } : void 0"
|
|
35
|
+
:ui="baseUi"
|
|
36
|
+
v-bind="{ ...inputProps, ...$attrs }"
|
|
37
|
+
@blur="emits('blur', $event)"
|
|
38
|
+
@change="emits('change', $event)"
|
|
39
|
+
>
|
|
40
|
+
<template v-for="(_, slotName) in slots" :key="slotName" #[slotName]="slotProps">
|
|
41
|
+
<slot :name="slotName" v-bind="slotProps ?? {}" />
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<template v-if="props.dialCode" #leading>
|
|
45
|
+
<span :class="extraUi.dialCode">{{ props.dialCode }}</span>
|
|
46
|
+
</template>
|
|
47
|
+
</UInput>
|
|
48
|
+
</template>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ComponentConfig, InputSlots, InputValue } from '@nuxt/ui';
|
|
2
|
+
import type { OmitByKey } from '@movk/core';
|
|
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';
|
|
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<{
|
|
8
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(AsPhoneNumberInputProps<T> & {
|
|
9
|
+
ui?: ComponentConfig<typeof inputTheme & typeof theme, AppConfig, "asPhoneNumberInput">["slots"];
|
|
10
|
+
} & {
|
|
11
|
+
modelValue?: T;
|
|
12
|
+
}) & {
|
|
13
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
14
|
+
onChange?: ((event: Event) => any) | undefined;
|
|
15
|
+
"onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
|
|
16
|
+
}> & (typeof globalThis extends {
|
|
17
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
18
|
+
} ? P : {});
|
|
19
|
+
expose: (exposed: {}) => void;
|
|
20
|
+
attrs: any;
|
|
21
|
+
slots: OmitByKey<InputSlots, "leading">;
|
|
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);
|
|
23
|
+
}>) => import("vue").VNode & {
|
|
24
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
25
|
+
};
|
|
26
|
+
declare const _default: typeof __VLS_export;
|
|
27
|
+
export default _default;
|
|
28
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
29
|
+
[K in keyof T]: T[K];
|
|
30
|
+
} : {
|
|
31
|
+
[K in keyof T as K]: T[K];
|
|
32
|
+
}) & {};
|
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { ComponentConfig, InputSlots, InputValue } from '@nuxt/ui';
|
|
2
|
+
import type { OmitByKey } from '@movk/core';
|
|
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';
|
|
3
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<{
|
|
4
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithCharacterLimitProps<
|
|
5
|
-
|
|
8
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithCharacterLimitProps<T> & {
|
|
9
|
+
ui?: ComponentConfig<typeof inputTheme & typeof theme, AppConfig, "withCharacterLimit">["slots"];
|
|
10
|
+
} & {
|
|
11
|
+
modelValue?: T;
|
|
6
12
|
}) & {
|
|
7
13
|
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
8
14
|
onChange?: ((event: Event) => any) | undefined;
|
|
9
|
-
"onUpdate:modelValue"?: ((value:
|
|
15
|
+
"onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
|
|
10
16
|
}> & (typeof globalThis extends {
|
|
11
17
|
__VLS_PROPS_FALLBACK: infer P;
|
|
12
18
|
} ? P : {});
|
|
13
19
|
expose: (exposed: {}) => void;
|
|
14
20
|
attrs: any;
|
|
15
|
-
slots:
|
|
16
|
-
emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value:
|
|
21
|
+
slots: OmitByKey<InputSlots, "trailing">;
|
|
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);
|
|
17
23
|
}>) => import("vue").VNode & {
|
|
18
24
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
19
25
|
};
|