@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,85 +1,46 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { UForm } from "#components";
|
|
3
|
-
import { computed, onMounted, ref, useTemplateRef } from "vue";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { classifyFields } from "../auto-form/
|
|
7
|
-
import { extractPureSchema, introspectSchema } from "../auto-form/schema
|
|
8
|
-
import {
|
|
9
|
-
import AutoFormRendererChildren from "
|
|
10
|
-
import AutoFormRendererField from "
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
addButtonProps,
|
|
18
|
-
state: _state,
|
|
19
|
-
loadingAuto = true,
|
|
20
|
-
...restProps
|
|
21
|
-
} = defineProps({
|
|
22
|
-
submitButton: { type: Boolean, required: false },
|
|
3
|
+
import { computed, onMounted, ref, toRaw, unref, useAttrs, useTemplateRef } from "vue";
|
|
4
|
+
import { deepClone, isFunction } from "@movk/core";
|
|
5
|
+
import { useAutoFormProvider } from "../domains/auto-form/provider";
|
|
6
|
+
import { applyFieldDefaults, classifyFields } from "../domains/auto-form/fields";
|
|
7
|
+
import { extractPureSchema, introspectSchema } from "../domains/auto-form/schema";
|
|
8
|
+
import { DEFAULT_CONTROLS } from "../domains/auto-form/controls";
|
|
9
|
+
import AutoFormRendererChildren from "../domains/auto-form/components/Children.vue";
|
|
10
|
+
import AutoFormRendererField from "../domains/auto-form/components/Field.vue";
|
|
11
|
+
import { useExtendedTv } from "../utils/extend-theme";
|
|
12
|
+
import theme from "#build/movk-ui/auto-form";
|
|
13
|
+
import { useAppConfig } from "#imports";
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
state: { type: null, required: false },
|
|
16
|
+
submit: { type: Boolean, required: false, default: true },
|
|
23
17
|
submitButtonProps: { type: Object, required: false },
|
|
18
|
+
addButtonProps: { type: Object, required: false },
|
|
19
|
+
schema: { type: null, required: true },
|
|
24
20
|
controls: { type: Object, required: false },
|
|
25
21
|
globalMeta: { type: Object, required: false },
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
id: { type: [String, Number], required: false },
|
|
29
|
-
schema: { type: null, required: false },
|
|
30
|
-
state: { type: null, required: false },
|
|
31
|
-
validate: { type: Function, required: false },
|
|
32
|
-
validateOn: { type: Array, required: false },
|
|
33
|
-
disabled: { type: Boolean, required: false },
|
|
34
|
-
name: { type: null, required: false },
|
|
35
|
-
validateOnInputDelay: { type: Number, required: false },
|
|
36
|
-
transform: { type: null, required: false },
|
|
37
|
-
nested: { type: Boolean, required: false },
|
|
22
|
+
loadingAuto: { type: Boolean, required: false, default: true },
|
|
23
|
+
validateOn: { type: Array, required: false, default: () => [] },
|
|
38
24
|
class: { type: null, required: false },
|
|
39
|
-
ui: { type: Object, required: false }
|
|
40
|
-
onSubmit: { type: Function, required: false }
|
|
25
|
+
ui: { type: Object, required: false }
|
|
41
26
|
});
|
|
42
|
-
defineEmits(["
|
|
43
|
-
const
|
|
27
|
+
const emits = defineEmits(["error"]);
|
|
28
|
+
const slots = defineSlots();
|
|
44
29
|
defineOptions({ inheritAttrs: false });
|
|
45
|
-
const
|
|
30
|
+
const attrs = useAttrs();
|
|
31
|
+
const appConfig = useAppConfig();
|
|
32
|
+
const initialState = deepClone(toRaw(props.state ?? {}));
|
|
33
|
+
const stateModel = ref(props.state ?? {});
|
|
46
34
|
const formRef = useTemplateRef("formRef");
|
|
47
|
-
const {
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
...controls
|
|
53
|
-
}));
|
|
54
|
-
const fields = computed(() => {
|
|
55
|
-
if (!schema)
|
|
56
|
-
return [];
|
|
57
|
-
return introspectSchema(schema, controlsMapping.value, "", globalMeta);
|
|
35
|
+
const { resolveFieldProp } = useAutoFormProvider(stateModel, slots);
|
|
36
|
+
const resolvedButtonSize = computed(() => {
|
|
37
|
+
const size = props.globalMeta?.size;
|
|
38
|
+
if (size === void 0 || isFunction(size)) return void 0;
|
|
39
|
+
return unref(size);
|
|
58
40
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const updates = [];
|
|
63
|
-
function collectDefaultValues(fieldList) {
|
|
64
|
-
for (const field of fieldList) {
|
|
65
|
-
if (field?.decorators?.defaultValue !== void 0 && getPath(stateValue, field.path) === void 0) {
|
|
66
|
-
updates.push({
|
|
67
|
-
path: field.path,
|
|
68
|
-
value: field.decorators.defaultValue
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
if (field?.children && Array.isArray(field.children) && field.children.length > 0) {
|
|
72
|
-
collectDefaultValues(field.children);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
collectDefaultValues(fields2);
|
|
77
|
-
if (updates.length > 0) {
|
|
78
|
-
for (const { path, value } of updates) {
|
|
79
|
-
setPath(stateValue, path, value);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
41
|
+
const pureSchema = computed(() => props.schema ? extractPureSchema(props.schema) : props.schema);
|
|
42
|
+
const controlsMapping = computed(() => ({ ...DEFAULT_CONTROLS, ...props.controls }));
|
|
43
|
+
const fields = computed(() => props.schema ? introspectSchema(props.schema, controlsMapping.value, "", props.globalMeta) : []);
|
|
83
44
|
const visibleFields = computed(
|
|
84
45
|
() => fields.value.filter(
|
|
85
46
|
(field) => field && (field.meta?.if === void 0 || resolveFieldProp(field, "if") === true)
|
|
@@ -94,25 +55,32 @@ const renderData = computed(() => {
|
|
|
94
55
|
allFields: visibleFields.value
|
|
95
56
|
};
|
|
96
57
|
});
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
58
|
+
const { extendUi } = useExtendedTv(
|
|
59
|
+
{ slots: {} },
|
|
60
|
+
theme,
|
|
61
|
+
() => appConfig.movk?.autoForm,
|
|
62
|
+
() => ({
|
|
63
|
+
ui: {
|
|
64
|
+
...props.ui,
|
|
65
|
+
root: [props.ui?.root, props.class]
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
);
|
|
100
69
|
function reset() {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
Object.assign(state.value, _state);
|
|
106
|
-
}
|
|
107
|
-
resolveDefaultValue(fields.value, state.value);
|
|
70
|
+
const target = stateModel.value;
|
|
71
|
+
for (const key of Object.keys(target)) Reflect.deleteProperty(target, key);
|
|
72
|
+
Object.assign(target, deepClone(initialState));
|
|
73
|
+
applyFieldDefaults(fields.value, target);
|
|
108
74
|
formRef.value?.clear();
|
|
109
75
|
}
|
|
110
76
|
function clear() {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
});
|
|
77
|
+
const target = stateModel.value;
|
|
78
|
+
for (const key of Object.keys(target)) Reflect.deleteProperty(target, key);
|
|
114
79
|
formRef.value?.clear();
|
|
115
80
|
}
|
|
81
|
+
onMounted(() => {
|
|
82
|
+
applyFieldDefaults(fields.value, stateModel.value);
|
|
83
|
+
});
|
|
116
84
|
defineExpose({
|
|
117
85
|
formRef,
|
|
118
86
|
reset,
|
|
@@ -121,48 +89,69 @@ defineExpose({
|
|
|
121
89
|
</script>
|
|
122
90
|
|
|
123
91
|
<template>
|
|
124
|
-
<
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
92
|
+
<div :class="extendUi.root" data-slot="root">
|
|
93
|
+
<UTheme
|
|
94
|
+
:ui="{
|
|
95
|
+
collapsible: { content: extendUi.collapsible }
|
|
96
|
+
}"
|
|
97
|
+
>
|
|
98
|
+
<UForm
|
|
99
|
+
v-if="renderData"
|
|
100
|
+
ref="formRef"
|
|
101
|
+
:state="stateModel"
|
|
102
|
+
:schema="pureSchema"
|
|
103
|
+
:loading-auto="props.loadingAuto"
|
|
104
|
+
:validate-on="props.validateOn"
|
|
105
|
+
data-slot="form"
|
|
106
|
+
v-bind="attrs"
|
|
107
|
+
:ui="{
|
|
108
|
+
base: extendUi.base
|
|
109
|
+
}"
|
|
110
|
+
@error="emits('error', $event)"
|
|
111
|
+
>
|
|
112
|
+
<template #default="{ errors, loading }">
|
|
113
|
+
<div v-if="$slots.header" :class="extendUi.header" data-slot="header">
|
|
114
|
+
<slot name="header" v-bind="{ errors, loading, fields: visibleFields, state: stateModel }" />
|
|
115
|
+
</div>
|
|
134
116
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
117
|
+
<template v-if="renderData.hasComplexFields">
|
|
118
|
+
<AutoFormRendererChildren
|
|
119
|
+
:fields="renderData.allFields"
|
|
120
|
+
:schema="schema"
|
|
121
|
+
:extra-props="{ errors, loading }"
|
|
122
|
+
/>
|
|
123
|
+
</template>
|
|
142
124
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
125
|
+
<template v-else>
|
|
126
|
+
<AutoFormRendererField
|
|
127
|
+
v-for="field in renderData.flatFields"
|
|
128
|
+
:key="field.path"
|
|
129
|
+
:field="field"
|
|
130
|
+
:schema="schema"
|
|
131
|
+
:extra-props="{ errors, loading }"
|
|
132
|
+
/>
|
|
133
|
+
</template>
|
|
152
134
|
|
|
153
|
-
|
|
135
|
+
<div v-if="$slots.footer" :class="extendUi.footer" data-slot="footer">
|
|
136
|
+
<slot name="footer" v-bind="{ errors, loading, fields: visibleFields, state: stateModel }" />
|
|
137
|
+
</div>
|
|
154
138
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
139
|
+
<div v-if="props.submit" :class="extendUi.actions" data-slot="submit">
|
|
140
|
+
<slot name="submit" v-bind="{ errors, loading, fields: visibleFields, state: stateModel }">
|
|
141
|
+
<UButton
|
|
142
|
+
type="submit"
|
|
143
|
+
label="提交"
|
|
144
|
+
block
|
|
145
|
+
:loading="loading"
|
|
146
|
+
:loading-auto="props.loadingAuto"
|
|
147
|
+
:size="resolvedButtonSize"
|
|
148
|
+
:disabled="attrs.disabled"
|
|
149
|
+
v-bind="props.submitButtonProps"
|
|
150
|
+
/>
|
|
151
|
+
</slot>
|
|
152
|
+
</div>
|
|
153
|
+
</template>
|
|
154
|
+
</UForm>
|
|
155
|
+
</UTheme>
|
|
156
|
+
</div>
|
|
168
157
|
</template>
|
|
@@ -1,44 +1,24 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentConfig, InferInput } from '@nuxt/ui';
|
|
2
2
|
import type { z } from 'zod';
|
|
3
|
-
import type {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 是否显示默认提交按钮
|
|
8
|
-
* @defaultValue true
|
|
9
|
-
*/
|
|
10
|
-
submitButton?: boolean;
|
|
11
|
-
/** 提交按钮属性 */
|
|
12
|
-
submitButtonProps?: ButtonProps;
|
|
13
|
-
/** 自定义控件映射 */
|
|
14
|
-
controls?: AutoFormControls;
|
|
15
|
-
/** 全局字段元数据配置 */
|
|
16
|
-
globalMeta?: ZodAutoFormFieldMeta;
|
|
17
|
-
/** 数组字段添加按钮属性 */
|
|
18
|
-
addButtonProps?: ButtonProps;
|
|
19
|
-
loadingAuto?: boolean;
|
|
20
|
-
}
|
|
21
|
-
export interface AutoFormEmits<S extends z.ZodObject, T extends boolean = true> extends FormEmits<S, T> {
|
|
22
|
-
}
|
|
23
|
-
export type AutoFormSlots<T extends object> = {
|
|
24
|
-
header: (props: AutoFormSlotProps<T>) => any;
|
|
25
|
-
footer: (props: AutoFormSlotProps<T>) => any;
|
|
26
|
-
submit: (props: AutoFormSlotProps<T>) => any;
|
|
27
|
-
} & DynamicFormSlots<T>;
|
|
3
|
+
import type { AutoFormProps, AutoFormSlots } from '../types/auto-form/component';
|
|
4
|
+
import theme from '#build/movk-ui/auto-form';
|
|
5
|
+
import type { AppConfig } from 'nuxt/schema';
|
|
28
6
|
declare const __VLS_export: <S extends z.ZodObject, T extends boolean = true, N 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<{
|
|
29
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<AutoFormProps<S, T, N> & {
|
|
30
|
-
|
|
7
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(AutoFormProps<S, T, N> & {
|
|
8
|
+
ui?: ComponentConfig<typeof theme, AppConfig, "autoForm">["slots"];
|
|
9
|
+
}) & {
|
|
10
|
+
onError?: ((args_0: import("@nuxt/ui").FormErrorEvent) => any) | undefined;
|
|
31
11
|
}> & (typeof globalThis extends {
|
|
32
12
|
__VLS_PROPS_FALLBACK: infer P;
|
|
33
13
|
} ? P : {});
|
|
34
14
|
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
35
|
-
formRef: any
|
|
15
|
+
formRef: Readonly<import("vue").ShallowRef<any, any>>;
|
|
36
16
|
reset: () => void;
|
|
37
17
|
clear: () => void;
|
|
38
18
|
}>) => void;
|
|
39
19
|
attrs: any;
|
|
40
20
|
slots: AutoFormSlots<N extends false ? Partial<InferInput<S>> : never>;
|
|
41
|
-
emit:
|
|
21
|
+
emit: (evt: "error", args_0: import("@nuxt/ui").FormErrorEvent) => void;
|
|
42
22
|
}>) => import("vue").VNode & {
|
|
43
23
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
44
24
|
};
|
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import type { ComponentConfig } from '@nuxt/ui';
|
|
2
|
+
import type { AppConfig } from 'nuxt/schema';
|
|
3
|
+
import theme from '#build/movk-ui/color-chooser';
|
|
4
|
+
import popoverTheme from '#build/ui/popover';
|
|
5
|
+
import type { ColorChooserProps, ColorChooserSlots, ColorFormat } from '../types/components/color-chooser';
|
|
6
|
+
declare const __VLS_export: <M extends "click" | "hover">(__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<{
|
|
7
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(ColorChooserProps<M> & {
|
|
8
|
+
size?: ComponentConfig<typeof popoverTheme & typeof theme, AppConfig, "colorChooser">["variants"]["size"];
|
|
9
|
+
trigger?: ComponentConfig<typeof popoverTheme & typeof theme, AppConfig, "colorChooser">["variants"]["trigger"];
|
|
10
|
+
ui?: ComponentConfig<typeof popoverTheme & typeof theme, AppConfig, "colorChooser">["slots"];
|
|
11
|
+
} & {
|
|
10
12
|
modelValue?: string;
|
|
11
13
|
}) & {
|
|
12
|
-
|
|
14
|
+
onClear?: (() => any) | undefined;
|
|
15
|
+
onChange?: ((value: string | undefined) => any) | undefined;
|
|
16
|
+
onCopy?: ((value: string) => any) | undefined;
|
|
17
|
+
"onUpdate:open"?: ((open: boolean) => any) | undefined;
|
|
18
|
+
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
19
|
+
"onFormat-change"?: ((format: ColorFormat) => any) | undefined;
|
|
13
20
|
}> & (typeof globalThis extends {
|
|
14
|
-
__VLS_PROPS_FALLBACK: infer
|
|
15
|
-
} ?
|
|
21
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
22
|
+
} ? P : {});
|
|
16
23
|
expose: (exposed: {}) => void;
|
|
17
24
|
attrs: any;
|
|
18
|
-
slots:
|
|
19
|
-
|
|
20
|
-
} & {
|
|
21
|
-
leading?: (props: any) => any;
|
|
22
|
-
} & {
|
|
23
|
-
trailing?: (props: any) => any;
|
|
24
|
-
} & {
|
|
25
|
-
anchor?: (props: any) => any;
|
|
26
|
-
};
|
|
27
|
-
emit: any & ((event: "update:modelValue", value: string | undefined) => void);
|
|
25
|
+
slots: ColorChooserSlots;
|
|
26
|
+
emit: (((evt: "clear") => void) & ((evt: "change", value: string | undefined) => void) & ((evt: "copy", value: string) => void) & ((evt: "update:open", open: boolean) => void) & ((evt: "update:modelValue", value: string | undefined) => void) & ((evt: "format-change", format: ColorFormat) => void)) & ((event: "update:modelValue", value: string | undefined) => void);
|
|
28
27
|
}>) => import("vue").VNode & {
|
|
29
28
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
30
29
|
};
|