@movk/nuxt 1.8.2 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +16 -6
- package/README.md +16 -6
- package/dist/module.d.mts +6 -0
- package/dist/module.json +3 -3
- package/dist/module.mjs +21 -24
- package/dist/runtime/components/AutoForm.d.vue.ts +15 -1
- package/dist/runtime/components/AutoForm.vue +48 -50
- package/dist/runtime/components/AutoForm.vue.d.ts +15 -1
- package/dist/runtime/components/DataTable.d.vue.ts +4 -2
- package/dist/runtime/components/DataTable.vue +166 -174
- package/dist/runtime/components/DataTable.vue.d.ts +4 -2
- package/dist/runtime/components/DatePicker.d.vue.ts +6 -5
- package/dist/runtime/components/DatePicker.vue +96 -43
- package/dist/runtime/components/DatePicker.vue.d.ts +6 -5
- package/dist/runtime/components/MessageBox.d.vue.ts +1 -5
- package/dist/runtime/components/MessageBox.vue +9 -7
- package/dist/runtime/components/MessageBox.vue.d.ts +1 -5
- package/dist/runtime/components/SearchForm.d.vue.ts +12 -4
- package/dist/runtime/components/SearchForm.vue +130 -120
- package/dist/runtime/components/SearchForm.vue.d.ts +12 -4
- package/dist/runtime/components/Tree.d.vue.ts +3 -1
- package/dist/runtime/components/Tree.vue +102 -140
- package/dist/runtime/components/Tree.vue.d.ts +3 -1
- package/dist/runtime/components/theme-picker/ThemePicker.vue +5 -3
- package/dist/runtime/components/theme-picker/ThemePickerButton.vue +15 -6
- package/dist/runtime/composables/index.d.ts +1 -0
- package/dist/runtime/composables/index.js +1 -0
- package/dist/runtime/composables/useApiFetch.d.ts +7 -7
- package/dist/runtime/composables/useApiFetch.js +5 -23
- package/dist/runtime/composables/useAutoForm.js +2 -2
- package/dist/runtime/composables/useClientApiFetch.d.ts +5 -5
- package/dist/runtime/composables/useDateFormatter.d.ts +32 -34
- package/dist/runtime/composables/useDateFormatter.js +75 -232
- package/dist/runtime/composables/useDownloadWithProgress.d.ts +11 -8
- package/dist/runtime/composables/useDownloadWithProgress.js +49 -132
- package/dist/runtime/composables/useMessageBox.js +3 -2
- package/dist/runtime/composables/useMovkLocale.d.ts +16 -0
- package/dist/runtime/composables/useMovkLocale.js +20 -0
- package/dist/runtime/composables/useTheme.js +8 -18
- package/dist/runtime/composables/useUploadWithProgress.d.ts +9 -6
- package/dist/runtime/composables/useUploadWithProgress.js +50 -84
- package/dist/runtime/domains/ai/chat-transport.js +1 -0
- package/dist/runtime/domains/api/adapters/xhr.d.ts +17 -0
- package/dist/runtime/domains/api/adapters/xhr.js +55 -0
- package/dist/runtime/domains/api/auth.d.ts +4 -1
- package/dist/runtime/domains/api/auth.js +9 -13
- package/dist/runtime/domains/api/client.d.ts +13 -0
- package/dist/runtime/domains/api/client.js +35 -0
- package/dist/runtime/domains/api/download.d.ts +10 -0
- package/dist/runtime/domains/api/download.js +28 -0
- package/dist/runtime/domains/api/errors.d.ts +20 -2
- package/dist/runtime/domains/api/errors.js +61 -8
- package/dist/runtime/domains/api/fetch-key.d.ts +2 -2
- package/dist/runtime/domains/api/fetch-key.js +4 -4
- package/dist/runtime/domains/api/interceptors/request.d.ts +2 -6
- package/dist/runtime/domains/api/interceptors/request.js +3 -2
- package/dist/runtime/domains/api/interceptors/response.d.ts +8 -12
- package/dist/runtime/domains/api/interceptors/response.js +34 -20
- package/dist/runtime/domains/api/report.d.ts +25 -0
- package/dist/runtime/domains/api/report.js +51 -0
- package/dist/runtime/domains/api/response.d.ts +29 -4
- package/dist/runtime/domains/api/response.js +27 -6
- package/dist/runtime/domains/api/session.d.ts +12 -0
- package/dist/runtime/domains/api/session.js +9 -0
- package/dist/runtime/domains/api/stream.d.ts +2 -1
- package/dist/runtime/domains/api/stream.js +2 -1
- package/dist/runtime/domains/api/toast.d.ts +6 -3
- package/dist/runtime/domains/api/toast.js +7 -7
- package/dist/runtime/domains/auto-form/actions.d.ts +2 -1
- package/dist/runtime/domains/auto-form/actions.js +6 -4
- package/dist/runtime/domains/auto-form/array-ops.d.ts +3 -0
- package/dist/runtime/domains/auto-form/array-ops.js +9 -0
- package/dist/runtime/domains/auto-form/async-items.d.ts +10 -0
- package/dist/runtime/domains/auto-form/async-items.js +42 -0
- package/dist/runtime/domains/auto-form/components/Array.d.vue.ts +0 -4
- package/dist/runtime/domains/auto-form/components/Array.vue +81 -73
- package/dist/runtime/domains/auto-form/components/Array.vue.d.ts +0 -4
- package/dist/runtime/domains/auto-form/components/Children.d.vue.ts +0 -2
- package/dist/runtime/domains/auto-form/components/Children.vue +0 -5
- package/dist/runtime/domains/auto-form/components/Children.vue.d.ts +0 -2
- package/dist/runtime/domains/auto-form/components/Field.d.vue.ts +0 -2
- package/dist/runtime/domains/auto-form/components/Field.vue +9 -2
- package/dist/runtime/domains/auto-form/components/Field.vue.d.ts +0 -2
- package/dist/runtime/domains/auto-form/components/Layout.d.vue.ts +0 -2
- package/dist/runtime/domains/auto-form/components/Layout.vue +3 -6
- package/dist/runtime/domains/auto-form/components/Layout.vue.d.ts +0 -2
- package/dist/runtime/domains/auto-form/components/Nested.d.vue.ts +0 -2
- package/dist/runtime/domains/auto-form/components/Nested.vue +5 -9
- package/dist/runtime/domains/auto-form/components/Nested.vue.d.ts +0 -2
- package/dist/runtime/domains/auto-form/controls.d.ts +5 -572
- package/dist/runtime/domains/auto-form/controls.js +7 -20
- package/dist/runtime/domains/auto-form/fields.d.ts +21 -4
- package/dist/runtime/domains/auto-form/fields.js +52 -40
- package/dist/runtime/domains/auto-form/provider.d.ts +15 -6
- package/dist/runtime/domains/auto-form/provider.js +24 -10
- package/dist/runtime/domains/auto-form/schema.d.ts +9 -4
- package/dist/runtime/domains/auto-form/schema.js +91 -50
- package/dist/runtime/domains/auto-form/search-query.d.ts +10 -0
- package/dist/runtime/domains/auto-form/search-query.js +57 -0
- package/dist/runtime/domains/auto-form/useAutoFormCore.d.ts +62 -0
- package/dist/runtime/domains/auto-form/useAutoFormCore.js +108 -0
- package/dist/runtime/domains/auto-form/useSearchQuerySync.d.ts +11 -0
- package/dist/runtime/domains/auto-form/useSearchQuerySync.js +64 -0
- package/dist/runtime/domains/data-table/columns/constants.d.ts +2 -0
- package/dist/runtime/domains/data-table/columns/constants.js +1 -1
- package/dist/runtime/domains/data-table/columns/resolve-columns.d.ts +2 -1
- package/dist/runtime/domains/data-table/columns/resolve-columns.js +3 -2
- package/dist/runtime/domains/data-table/columns/resolve-data-column.d.ts +7 -2
- package/dist/runtime/domains/data-table/columns/resolve-data-column.js +10 -5
- package/dist/runtime/domains/data-table/columns/resolve-special-columns.js +14 -8
- package/dist/runtime/domains/data-table/components/ColumnSettings.d.vue.ts +20 -0
- package/dist/runtime/domains/data-table/components/ColumnSettings.vue +63 -0
- package/dist/runtime/domains/data-table/components/ColumnSettings.vue.d.ts +20 -0
- package/dist/runtime/domains/data-table/components/Pagination.d.vue.ts +2 -8
- package/dist/runtime/domains/data-table/components/Pagination.vue +34 -36
- package/dist/runtime/domains/data-table/components/Pagination.vue.d.ts +2 -8
- package/dist/runtime/domains/data-table/export.d.ts +23 -0
- package/dist/runtime/domains/data-table/export.js +43 -0
- package/dist/runtime/domains/data-table/load-more.d.ts +8 -0
- package/dist/runtime/domains/data-table/load-more.js +14 -0
- package/dist/runtime/domains/data-table/pagination.d.ts +29 -0
- package/dist/runtime/domains/data-table/pagination.js +42 -0
- package/dist/runtime/domains/data-table/persist.d.ts +12 -0
- package/dist/runtime/domains/data-table/persist.js +41 -0
- package/dist/runtime/domains/data-table/state/keys.d.ts +11 -0
- package/dist/runtime/domains/data-table/state/keys.js +44 -0
- package/dist/runtime/domains/data-table/state/models.d.ts +5 -0
- package/dist/runtime/domains/data-table/state/models.js +38 -0
- package/dist/runtime/domains/data-table/tree-layout.d.ts +13 -0
- package/dist/runtime/domains/data-table/tree-layout.js +30 -0
- package/dist/runtime/domains/theme/theme-color.d.ts +3 -0
- package/dist/runtime/domains/theme/theme-color.js +16 -0
- package/dist/runtime/domains/theme/theme-fouc.d.ts +5 -0
- package/dist/runtime/domains/theme/theme-fouc.js +43 -0
- package/dist/runtime/domains/tree/components/TreeToolbar.d.vue.ts +7 -5
- package/dist/runtime/domains/tree/components/TreeToolbar.vue +6 -4
- package/dist/runtime/domains/tree/components/TreeToolbar.vue.d.ts +7 -5
- package/dist/runtime/domains/tree/tree-disabled.d.ts +5 -0
- package/dist/runtime/domains/tree/tree-disabled.js +15 -0
- package/dist/runtime/domains/tree/tree-lazy.d.ts +8 -0
- package/dist/runtime/domains/tree/tree-lazy.js +19 -1
- package/dist/runtime/domains/tree/tree-search.d.ts +3 -1
- package/dist/runtime/domains/tree/tree-search.js +4 -0
- package/dist/runtime/domains/tree/useTreeLazy.d.ts +22 -0
- package/dist/runtime/domains/tree/useTreeLazy.js +57 -0
- package/dist/runtime/domains/tree/useTreeSearch.d.ts +27 -0
- package/dist/runtime/domains/tree/useTreeSearch.js +59 -0
- package/dist/runtime/domains/tree/useTreeSelection.d.ts +31 -0
- package/dist/runtime/domains/tree/useTreeSelection.js +89 -0
- package/dist/runtime/domains/zod/apply.d.ts +23 -0
- package/dist/runtime/domains/zod/apply.js +26 -0
- package/dist/runtime/domains/zod/error-map.d.ts +13 -0
- package/dist/runtime/domains/zod/error-map.js +19 -0
- package/dist/runtime/domains/zod/locale-map.d.ts +5 -0
- package/dist/runtime/domains/zod/locale-map.js +17 -0
- package/dist/runtime/domains/zod/sync.d.ts +12 -0
- package/dist/runtime/domains/zod/sync.js +30 -0
- package/dist/runtime/locale/en.d.ts +74 -0
- package/dist/runtime/locale/en.js +73 -0
- package/dist/runtime/locale/index.d.ts +8 -0
- package/dist/runtime/locale/index.js +15 -0
- package/dist/runtime/locale/zh_cn.d.ts +74 -0
- package/dist/runtime/locale/zh_cn.js +73 -0
- package/dist/runtime/plugins/api.factory.js +5 -22
- package/dist/runtime/plugins/theme.js +4 -42
- package/dist/runtime/plugins/zod.d.ts +2 -0
- package/dist/runtime/plugins/zod.js +16 -0
- package/dist/runtime/types/api/config.d.ts +12 -0
- package/dist/runtime/types/api/fetch.d.ts +3 -16
- package/dist/runtime/types/api/index.d.ts +1 -1
- package/dist/runtime/types/api/response.d.ts +33 -19
- package/dist/runtime/types/api/stream.d.ts +2 -3
- package/dist/runtime/types/api/transfer.d.ts +3 -7
- package/dist/runtime/types/auto-form/base.d.ts +9 -1
- package/dist/runtime/types/auto-form/component.d.ts +31 -3
- package/dist/runtime/types/auto-form/fields.d.ts +15 -1
- package/dist/runtime/types/auto-form/index.d.ts +3 -3
- package/dist/runtime/types/auto-form/search-form.d.ts +26 -12
- package/dist/runtime/types/auto-form/zod-factory.d.ts +2 -2
- package/dist/runtime/types/components/date-picker.d.ts +14 -3
- package/dist/runtime/types/components/index.d.ts +1 -6
- package/dist/runtime/types/components/message-box.d.ts +5 -18
- package/dist/runtime/types/components/tree.d.ts +17 -14
- package/dist/runtime/types/data-table/columns.d.ts +6 -14
- package/dist/runtime/types/data-table/component.d.ts +42 -1
- package/dist/runtime/types/data-table/index.d.ts +1 -1
- package/dist/runtime/types/data-table/pagination.d.ts +7 -8
- package/dist/runtime/types/index.d.ts +2 -0
- package/dist/runtime/types/locale.d.ts +82 -0
- package/dist/runtime/types/shared.d.ts +13 -0
- package/dist/runtime/types/zod-config.d.ts +38 -0
- package/dist/runtime/types/zod.d.ts +9 -1
- package/dist/runtime/utils/date/convert.d.ts +29 -0
- package/dist/runtime/utils/date/convert.js +93 -0
- package/dist/runtime/utils/date/guards.d.ts +10 -0
- package/dist/runtime/utils/date/guards.js +18 -0
- package/dist/runtime/utils/extend-theme.js +2 -1
- package/dist/runtime/utils/form-control.d.ts +0 -12
- package/dist/runtime/utils/form-control.js +3 -39
- package/dist/runtime/utils/interpolate.d.ts +2 -0
- package/dist/runtime/utils/interpolate.js +4 -0
- package/dist/runtime/utils/theme-defaults.d.ts +10 -0
- package/dist/runtime/utils/theme-defaults.js +9 -0
- package/dist/runtime/utils/tree-selection.d.ts +2 -15
- package/dist/runtime/utils/tv.d.ts +1 -1
- package/dist/runtime/vue/plugins/zod.d.ts +7 -0
- package/dist/runtime/vue/plugins/zod.js +12 -0
- package/dist/shared/{nuxt.C7xx2FPO.mjs → nuxt.CbmfnBRt.mjs} +92 -236
- package/dist/unplugin.d.mts +3 -2
- package/dist/unplugin.mjs +22 -22
- package/dist/vite.d.mts +1 -0
- package/dist/vite.mjs +2 -1
- package/package.json +40 -34
- package/vue-plugin.d.ts +7 -1
- package/dist/runtime/components/ColorChooser.d.vue.ts +0 -36
- package/dist/runtime/components/ColorChooser.vue +0 -328
- package/dist/runtime/components/ColorChooser.vue.d.ts +0 -36
- package/dist/runtime/components/PillGroup.d.vue.ts +0 -33
- package/dist/runtime/components/PillGroup.vue +0 -291
- package/dist/runtime/components/PillGroup.vue.d.ts +0 -33
- package/dist/runtime/components/Popconfirm.d.vue.ts +0 -30
- package/dist/runtime/components/Popconfirm.vue +0 -143
- package/dist/runtime/components/Popconfirm.vue.d.ts +0 -30
- package/dist/runtime/components/SlideVerify.d.vue.ts +0 -41
- package/dist/runtime/components/SlideVerify.vue +0 -174
- package/dist/runtime/components/SlideVerify.vue.d.ts +0 -41
- package/dist/runtime/components/input/AsPhoneNumberInput.d.vue.ts +0 -32
- package/dist/runtime/components/input/AsPhoneNumberInput.vue +0 -48
- package/dist/runtime/components/input/AsPhoneNumberInput.vue.d.ts +0 -32
- package/dist/runtime/components/input/WithCharacterLimit.d.vue.ts +0 -32
- package/dist/runtime/components/input/WithCharacterLimit.vue +0 -54
- package/dist/runtime/components/input/WithCharacterLimit.vue.d.ts +0 -32
- package/dist/runtime/components/input/WithClear.d.vue.ts +0 -33
- package/dist/runtime/components/input/WithClear.vue +0 -60
- package/dist/runtime/components/input/WithClear.vue.d.ts +0 -33
- package/dist/runtime/components/input/WithCopy.d.vue.ts +0 -33
- package/dist/runtime/components/input/WithCopy.vue +0 -66
- package/dist/runtime/components/input/WithCopy.vue.d.ts +0 -33
- package/dist/runtime/components/input/WithFloatingLabel.d.vue.ts +0 -33
- package/dist/runtime/components/input/WithFloatingLabel.vue +0 -75
- package/dist/runtime/components/input/WithFloatingLabel.vue.d.ts +0 -33
- package/dist/runtime/components/input/WithPasswordToggle.d.vue.ts +0 -32
- package/dist/runtime/components/input/WithPasswordToggle.vue +0 -61
- package/dist/runtime/components/input/WithPasswordToggle.vue.d.ts +0 -32
- package/dist/runtime/domains/api/interceptors/compose.d.ts +0 -24
- package/dist/runtime/domains/api/interceptors/compose.js +0 -18
- package/dist/runtime/domains/api/interceptors/error.d.ts +0 -13
- package/dist/runtime/domains/api/interceptors/error.js +0 -49
- package/dist/runtime/domains/api/transfer.d.ts +0 -69
- package/dist/runtime/domains/api/transfer.js +0 -82
- package/dist/runtime/types/components/color-chooser.d.ts +0 -109
- package/dist/runtime/types/components/input/as-phone-number-input.d.ts +0 -17
- package/dist/runtime/types/components/input/index.d.ts +0 -6
- package/dist/runtime/types/components/input/index.js +0 -0
- package/dist/runtime/types/components/input/with-character-limit.d.ts +0 -11
- package/dist/runtime/types/components/input/with-character-limit.js +0 -0
- package/dist/runtime/types/components/input/with-clear.d.ts +0 -10
- package/dist/runtime/types/components/input/with-clear.js +0 -0
- package/dist/runtime/types/components/input/with-copy.d.ts +0 -11
- package/dist/runtime/types/components/input/with-copy.js +0 -0
- package/dist/runtime/types/components/input/with-floating-label.d.ts +0 -12
- package/dist/runtime/types/components/input/with-floating-label.js +0 -0
- package/dist/runtime/types/components/input/with-password-toggle.d.ts +0 -7
- package/dist/runtime/types/components/input/with-password-toggle.js +0 -0
- package/dist/runtime/types/components/pill-group.d.ts +0 -103
- package/dist/runtime/types/components/pill-group.js +0 -0
- package/dist/runtime/types/components/popconfirm.d.ts +0 -74
- package/dist/runtime/types/components/popconfirm.js +0 -0
- package/dist/runtime/types/components/slide-verify.d.ts +0 -54
- package/dist/runtime/types/components/slide-verify.js +0 -0
- /package/dist/runtime/types/{components/color-chooser.js → locale.js} +0 -0
- /package/dist/runtime/types/{components/input/as-phone-number-input.js → zod-config.js} +0 -0
package/README.en.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
English | [简体中文](./README.md)
|
|
4
4
|
|
|
5
|
-
>
|
|
5
|
+
> An application toolkit for Nuxt and Vue. Generate forms from Zod schemas with AutoForm, build tables from column definitions with DataTable, and add standalone components and composables as needed. Nuxt projects can also integrate API requests, authentication, and file transfers.
|
|
6
6
|
|
|
7
7
|
[](https://nuxt.mhaibaraai.cn/mcp/deeplink)
|
|
8
8
|
[](https://nuxt.mhaibaraai.cn/mcp/deeplink?ide=vscode)
|
|
@@ -18,11 +18,11 @@ English | [简体中文](./README.md)
|
|
|
18
18
|
|
|
19
19
|
## ✨ Features
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Forms, tables, components, and theming build on Nuxt UI. Use them in **Nuxt 4** or with the plugins for **Vue + Vite**. API integration is available in **Nuxt 4**.
|
|
22
22
|
|
|
23
23
|
- **AutoForm — Schema-driven forms** (✅ Nuxt | ✅ Vue + Vite) - Built on Zod v4 with a "define-is-render" model: a single Schema declares the data structure, validation rules, and UI configuration at once, automatically generating a complete form interface.
|
|
24
24
|
- **DataTable — Data table** (✅ Nuxt | ✅ Vue + Vite) - Wraps TanStack Table, covering data columns, special columns (selection / index / expand / actions), tree-structured data, row interactions, appearance customization, pagination, and load-more.
|
|
25
|
-
- **Standalone component library** (✅ Nuxt | ✅ Vue + Vite) - General-purpose UI components such as DatePicker,
|
|
25
|
+
- **Standalone component library** (✅ Nuxt | ✅ Vue + Vite) - General-purpose UI components such as DatePicker, SearchForm, Tree, MessageBox, and ThemePicker, usable on their own without AutoForm.
|
|
26
26
|
- **Theming and Composables** (✅ Nuxt | ✅ Vue + Vite) - Non-server composition functions such as useTheme (theme read/write and export), useMessageBox (imperative dialogs), and useDateFormatter (i18n dates).
|
|
27
27
|
- **API integration system** (✅ Nuxt | ❌ Vue + Vite) - The useApiFetch / useLazyApiFetch / useClientApiFetch trio plus useUploadWithProgress / useDownloadWithProgress, providing multi-endpoint support, automatic authentication, business status-code checks, data unwrapping, Toast notifications, and progress monitoring; **depends on the Nuxt server runtime and is available in Nuxt mode only**.
|
|
28
28
|
- **Type safety** - Full TypeScript type inference, from Schema to form data, with component prop callbacks and event handler types derivable via indexed access.
|
|
@@ -30,8 +30,18 @@ Movk Nuxt is a UI engineering toolkit built on top of Nuxt UI, offering two ways
|
|
|
30
30
|
|
|
31
31
|
## 🚀 Getting Started
|
|
32
32
|
|
|
33
|
+
### Use a Template
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm create nuxt@latest -- -t gh:mhaibaraai/movk-nuxt-starter
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or create a repository from the [Movk Nuxt Starter](https://github.com/mhaibaraai/movk-nuxt-starter) template on GitHub.
|
|
40
|
+
|
|
33
41
|
### Installation
|
|
34
42
|
|
|
43
|
+
Requires `@nuxt/ui >=4.13.0`.
|
|
44
|
+
|
|
35
45
|
```bash
|
|
36
46
|
# pnpm
|
|
37
47
|
pnpm add @movk/nuxt @nuxt/ui zod
|
|
@@ -113,7 +123,7 @@ const schema = afz.object({
|
|
|
113
123
|
})
|
|
114
124
|
|
|
115
125
|
// Type inference
|
|
116
|
-
type Schema = z.
|
|
126
|
+
type Schema = z.input<typeof schema>
|
|
117
127
|
|
|
118
128
|
// Form state
|
|
119
129
|
const form = ref<Partial<Schema>>({})
|
|
@@ -125,7 +135,7 @@ async function onSubmit(event: FormSubmitEvent<Schema>) {
|
|
|
125
135
|
</script>
|
|
126
136
|
|
|
127
137
|
<template>
|
|
128
|
-
<MAutoForm :schema="schema"
|
|
138
|
+
<MAutoForm :schema="schema" v-model="form" @submit="onSubmit" />
|
|
129
139
|
</template>
|
|
130
140
|
```
|
|
131
141
|
|
|
@@ -276,7 +286,7 @@ Movk Nuxt adopts a clear layered architecture:
|
|
|
276
286
|
|
|
277
287
|
- **Core Systems** - AutoForm (Schema-driven forms), DataTable (data table)
|
|
278
288
|
- **API System** - useApiFetch / useLazyApiFetch / useClientApiFetch, useUploadWithProgress, useDownloadWithProgress, providing a complete API request solution
|
|
279
|
-
- **Standalone Components** - Standalone UI components such as DatePicker,
|
|
289
|
+
- **Standalone Components** - Standalone UI components such as DatePicker, SearchForm, Tree, MessageBox, and ThemePicker
|
|
280
290
|
- **Composables** - General-purpose composition functions such as useDateFormatter, useTheme, useMessageBox, and useAutoForm
|
|
281
291
|
- **Foundation** - Built on [Nuxt UI](https://ui.nuxt.com), [Zod v4](https://zod.dev), [VueUse](https://vueuse.org), and [TanStack Table](https://tanstack.com/table)
|
|
282
292
|
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
简体中文 | [English](./README.en.md)
|
|
4
4
|
|
|
5
|
-
>
|
|
5
|
+
> 面向 Nuxt 与 Vue 的应用开发工具包。用 AutoForm 从 Zod Schema 生成表单,用 DataTable 的列配置构建表格,再按需加入独立组件和组合式函数。Nuxt 项目还可统一处理 API 请求、认证和文件传输。
|
|
6
6
|
|
|
7
7
|
[](https://nuxt.mhaibaraai.cn/mcp/deeplink)
|
|
8
8
|
[](https://nuxt.mhaibaraai.cn/mcp/deeplink?ide=vscode)
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
|
|
19
19
|
## ✨ 特性
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
表单、表格、组件和主题基于 Nuxt UI,可在 **Nuxt 4** 中使用,也可通过插件接入 **Vue + Vite**。API 集成适用于 **Nuxt 4**。
|
|
22
22
|
|
|
23
23
|
- **AutoForm — Schema 驱动表单**(✅ Nuxt | ✅ Vue + Vite)- 基于 Zod v4 的「定义即渲染」,一份 Schema 同时声明数据结构、验证规则和 UI 配置,自动生成完整表单界面。
|
|
24
24
|
- **DataTable — 数据表格**(✅ Nuxt | ✅ Vue + Vite)- 基于 TanStack Table 封装,覆盖数据列、特殊列(选择/索引/展开/操作)、树形数据、行交互、外观定制、分页与加载更多。
|
|
25
|
-
- **独立组件库**(✅ Nuxt | ✅ Vue + Vite)- DatePicker、
|
|
25
|
+
- **独立组件库**(✅ Nuxt | ✅ Vue + Vite)- DatePicker、SearchForm、Tree、MessageBox、ThemePicker 等通用 UI 组件,无需依赖 AutoForm 即可独立使用。
|
|
26
26
|
- **主题与 Composables**(✅ Nuxt | ✅ Vue + Vite)- useTheme(主题读写与导出)、useMessageBox(命令式弹窗)、useDateFormatter(国际化日期)等非服务端组合式函数。
|
|
27
27
|
- **API 集成系统**(✅ Nuxt | ❌ Vue + Vite)- useApiFetch / useLazyApiFetch / useClientApiFetch 三件套 + useUploadWithProgress / useDownloadWithProgress,提供多端点、自动认证、业务状态码检查、数据解包、Toast 提示和进度监控;**依赖 Nuxt 服务端运行时,仅 Nuxt 模式可用**。
|
|
28
28
|
- **类型安全** - 完整的 TypeScript 类型推断,从 Schema 到表单数据,组件 prop 回调与事件处理类型可索引访问派生。
|
|
@@ -30,8 +30,18 @@ Movk Nuxt 是构建在 Nuxt UI 之上的 UI 工程套件,提供两种使用方
|
|
|
30
30
|
|
|
31
31
|
## 🚀 快速开始
|
|
32
32
|
|
|
33
|
+
### 使用模版
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm create nuxt@latest -- -t gh:mhaibaraai/movk-nuxt-starter
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
或在 GitHub 上使用 [Movk Nuxt Starter](https://github.com/mhaibaraai/movk-nuxt-starter) 模版创建仓库。
|
|
40
|
+
|
|
33
41
|
### 安装
|
|
34
42
|
|
|
43
|
+
需要 `@nuxt/ui >=4.13.0`。
|
|
44
|
+
|
|
35
45
|
```bash
|
|
36
46
|
# pnpm
|
|
37
47
|
pnpm add @movk/nuxt @nuxt/ui zod
|
|
@@ -113,7 +123,7 @@ const schema = afz.object({
|
|
|
113
123
|
})
|
|
114
124
|
|
|
115
125
|
// 类型推导
|
|
116
|
-
type Schema = z.
|
|
126
|
+
type Schema = z.input<typeof schema>
|
|
117
127
|
|
|
118
128
|
// 表单状态
|
|
119
129
|
const form = ref<Partial<Schema>>({})
|
|
@@ -125,7 +135,7 @@ async function onSubmit(event: FormSubmitEvent<Schema>) {
|
|
|
125
135
|
</script>
|
|
126
136
|
|
|
127
137
|
<template>
|
|
128
|
-
<MAutoForm :schema="schema"
|
|
138
|
+
<MAutoForm :schema="schema" v-model="form" @submit="onSubmit" />
|
|
129
139
|
</template>
|
|
130
140
|
```
|
|
131
141
|
|
|
@@ -276,7 +286,7 @@ Movk Nuxt 采用清晰的分层架构:
|
|
|
276
286
|
|
|
277
287
|
- **Core Systems** - AutoForm(Schema 驱动表单)、DataTable(数据表格)
|
|
278
288
|
- **API System** - useApiFetch / useLazyApiFetch / useClientApiFetch、useUploadWithProgress、useDownloadWithProgress,提供完整的 API 请求方案
|
|
279
|
-
- **Standalone Components** - DatePicker、
|
|
289
|
+
- **Standalone Components** - DatePicker、SearchForm、Tree、MessageBox、ThemePicker 等独立 UI 组件
|
|
280
290
|
- **Composables** - useDateFormatter、useTheme、useMessageBox、useAutoForm 等通用组合式函数
|
|
281
291
|
- **Foundation** - 基于 [Nuxt UI](https://ui.nuxt.com)、[Zod v4](https://zod.dev)、[VueUse](https://vueuse.org)、[TanStack Table](https://tanstack.com/table)
|
|
282
292
|
|
package/dist/module.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MovkApiFullConfig } from '../dist/runtime/types/api/module.js';
|
|
2
|
+
import { MovkZodOptions } from '../dist/runtime/types/zod-config.js';
|
|
2
3
|
import { MovkFontFamily, ThemeFontOption } from '../dist/runtime/domains/theme/theme-font.js';
|
|
3
4
|
import { ModuleOptions as ModuleOptions$1 } from '@nuxt/ui';
|
|
4
5
|
import { NuxtModule } from 'nuxt/schema';
|
|
@@ -15,6 +16,11 @@ interface ModuleOptions {
|
|
|
15
16
|
prefix?: string;
|
|
16
17
|
/** API 模块配置 */
|
|
17
18
|
api?: MovkApiFullConfig;
|
|
19
|
+
/**
|
|
20
|
+
* zod 校验文案本地化。全局配置使用固定语言或 fallback,当前应用的表单可另外覆盖错误映射
|
|
21
|
+
* @defaultValue false
|
|
22
|
+
*/
|
|
23
|
+
zod?: MovkZodOptions | false;
|
|
18
24
|
/** 图标模块配置 */
|
|
19
25
|
icon?: {
|
|
20
26
|
/**
|
package/dist/module.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@movk/nuxt",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
4
|
"configKey": "movk",
|
|
5
5
|
"compatibility": {
|
|
6
|
-
"nuxt": "
|
|
6
|
+
"nuxt": "^4.6.4"
|
|
7
7
|
},
|
|
8
8
|
"builder": {
|
|
9
|
-
"@nuxt/module-builder": "1.0.
|
|
9
|
+
"@nuxt/module-builder": "1.0.4",
|
|
10
10
|
"unbuild": "3.6.1"
|
|
11
11
|
}
|
|
12
12
|
}
|
package/dist/module.mjs
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import { resolveAlias, useLogger, addPlugin, defineNuxtModule, createResolver, addComponentsDir, addImportsDir } from '@nuxt/kit';
|
|
2
2
|
import defu, { defu as defu$1 } from 'defu';
|
|
3
|
-
import {
|
|
3
|
+
import { i as includeMovkUiComponents, r as resolveMovkIcons, f as formatMissingCollections, a as addTemplates } from './shared/nuxt.CbmfnBRt.mjs';
|
|
4
4
|
import { getPackageJsonMetadata } from '../dist/runtime/utils/meta.js';
|
|
5
5
|
import { kebabCase } from 'scule';
|
|
6
6
|
import { updateSiteConfig } from 'nuxt-site-config/kit';
|
|
7
7
|
import { readFile } from 'node:fs/promises';
|
|
8
|
-
import { getDefaultConfig } from '../dist/runtime/utils/theme-defaults.js';
|
|
8
|
+
import { getDefaultConfig, UI_COLOR_DEFAULTS } from '../dist/runtime/utils/theme-defaults.js';
|
|
9
9
|
import { resolveFontSource, resolveFontLinks, resolveFontWarning } from '../dist/runtime/domains/theme/theme-font.js';
|
|
10
10
|
export * from '../dist/runtime/types/index.js';
|
|
11
11
|
import 'node:url';
|
|
12
|
+
import '../dist/runtime/domains/zod/locale-map.js';
|
|
12
13
|
import 'node:fs';
|
|
13
14
|
import 'node:module';
|
|
14
15
|
import 'pathe';
|
|
15
16
|
import 'tinyglobby';
|
|
16
17
|
|
|
17
18
|
const name = "@movk/nuxt";
|
|
18
|
-
const version = "
|
|
19
|
+
const version = "2.0.0-beta.1";
|
|
20
|
+
const peerDependencies = {
|
|
21
|
+
"@nuxt/ui": ">=4.13.0"};
|
|
19
22
|
|
|
20
23
|
const MOVK_CSS_IMPORT = /@import\s+["']@movk\/nuxt["']/;
|
|
21
24
|
async function checkMovkCss(nuxt) {
|
|
@@ -118,17 +121,7 @@ function addTheme(nuxt, resolve, theme) {
|
|
|
118
121
|
getDefaultConfig(theme)
|
|
119
122
|
);
|
|
120
123
|
nuxt.options.appConfig.ui = defu(
|
|
121
|
-
{
|
|
122
|
-
colors: {
|
|
123
|
-
primary: "blue",
|
|
124
|
-
secondary: "blue",
|
|
125
|
-
success: "green",
|
|
126
|
-
info: "blue",
|
|
127
|
-
warning: "yellow",
|
|
128
|
-
error: "red",
|
|
129
|
-
neutral: "slate"
|
|
130
|
-
}
|
|
131
|
-
},
|
|
124
|
+
{ colors: { ...UI_COLOR_DEFAULTS } },
|
|
132
125
|
nuxt.options.appConfig.ui || {}
|
|
133
126
|
);
|
|
134
127
|
addPlugin({
|
|
@@ -149,22 +142,26 @@ function addFontLinks(nuxt, font) {
|
|
|
149
142
|
}
|
|
150
143
|
|
|
151
144
|
function resolveModuleDependencies(nuxt) {
|
|
152
|
-
const
|
|
145
|
+
const { options } = nuxt;
|
|
146
|
+
const ui = options.ui ??= {};
|
|
153
147
|
ui.fonts ??= false;
|
|
154
148
|
return {
|
|
155
149
|
"@nuxt/image": { version: ">=2.0.0" },
|
|
156
|
-
"@nuxt/ui": { version: "
|
|
150
|
+
"@nuxt/ui": { version: peerDependencies["@nuxt/ui"] },
|
|
157
151
|
"@vueuse/nuxt": { version: ">=14.2.1" },
|
|
158
|
-
"nuxt-auth-utils": { version: ">=0.5.29" },
|
|
159
|
-
"nuxt-site-config": { version: "
|
|
152
|
+
...usesSessionAuth(options.movk?.api) && { "nuxt-auth-utils": { version: ">=0.5.29" } },
|
|
153
|
+
"nuxt-site-config": { version: "^5.0.3" }
|
|
160
154
|
};
|
|
161
155
|
}
|
|
156
|
+
function usesSessionAuth(api) {
|
|
157
|
+
return api?.enabled !== false && api?.auth?.enabled === true && (api.auth.tokenSource ?? "session") === "session";
|
|
158
|
+
}
|
|
162
159
|
const movkModule = defineNuxtModule({
|
|
163
160
|
meta: {
|
|
164
161
|
name,
|
|
165
162
|
version,
|
|
166
163
|
configKey: "movk",
|
|
167
|
-
compatibility: { nuxt: "
|
|
164
|
+
compatibility: { nuxt: "^4.6.4" }
|
|
168
165
|
},
|
|
169
166
|
defaults: defaultOptions,
|
|
170
167
|
moduleDependencies: resolveModuleDependencies,
|
|
@@ -172,15 +169,12 @@ const movkModule = defineNuxtModule({
|
|
|
172
169
|
const { resolve } = createResolver(import.meta.url);
|
|
173
170
|
nuxt.options.movk = options;
|
|
174
171
|
nuxt.options.alias["#movk"] = resolve("./runtime");
|
|
175
|
-
const movkUiDeps = UI_COMPONENTS.map((name2) => name2.slice(1));
|
|
176
172
|
const uiOptions = nuxt.options;
|
|
177
173
|
const ui = uiOptions.ui ??= {};
|
|
178
174
|
const experimental = ui.experimental ??= {};
|
|
179
175
|
const detection = experimental.componentDetection;
|
|
180
|
-
if (detection
|
|
181
|
-
experimental.componentDetection =
|
|
182
|
-
} else if (Array.isArray(detection)) {
|
|
183
|
-
experimental.componentDetection = [.../* @__PURE__ */ new Set([...detection, ...movkUiDeps])];
|
|
176
|
+
if (detection) {
|
|
177
|
+
experimental.componentDetection = includeMovkUiComponents(detection);
|
|
184
178
|
}
|
|
185
179
|
const componentIgnore = [];
|
|
186
180
|
if (options.theme?.enabled === false) {
|
|
@@ -215,6 +209,9 @@ const movkModule = defineNuxtModule({
|
|
|
215
209
|
nuxt.options.runtimeConfig.public.movkApi = publicConfig;
|
|
216
210
|
addPlugin({ src: resolve("runtime/plugins/api.factory"), mode: "all" });
|
|
217
211
|
}
|
|
212
|
+
if (options.zod) {
|
|
213
|
+
addPlugin({ src: resolve("runtime/plugins/zod"), mode: "all" });
|
|
214
|
+
}
|
|
218
215
|
const meta = await getPackageJsonMetadata(nuxt.options.rootDir);
|
|
219
216
|
nuxt.hook("modules:done", async () => {
|
|
220
217
|
const site = defu$1(nuxt.options.site, {
|
|
@@ -6,19 +6,33 @@ import type { AppConfig } from 'nuxt/schema';
|
|
|
6
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<{
|
|
7
7
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<(AutoFormProps<S, T, N> & {
|
|
8
8
|
ui?: ComponentConfig<typeof theme, AppConfig, "autoForm">["slots"];
|
|
9
|
+
} & {
|
|
10
|
+
modelValue?: N extends false ? Partial<InferInput<S>> : never;
|
|
9
11
|
}) & {
|
|
10
12
|
onError?: ((args_0: import("@nuxt/ui").FormErrorEvent) => any) | undefined;
|
|
13
|
+
onClear?: ((state: Partial<z.core.input<S>>) => any) | undefined;
|
|
14
|
+
onReset?: ((state: Partial<z.core.input<S>>) => any) | undefined;
|
|
15
|
+
"onUpdate:modelValue"?: ((value: (N extends false ? Partial<InferInput<S>> : never) | undefined) => any) | undefined;
|
|
11
16
|
}> & (typeof globalThis extends {
|
|
12
17
|
__VLS_PROPS_FALLBACK: infer P;
|
|
13
18
|
} ? P : {});
|
|
14
19
|
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
15
20
|
formRef: Readonly<import("vue").ShallowRef<any, any>>;
|
|
21
|
+
submit: () => Promise<any>;
|
|
22
|
+
validate: any;
|
|
16
23
|
reset: () => void;
|
|
17
24
|
clear: () => void;
|
|
25
|
+
setBaseline: (value?: {
|
|
26
|
+
[x: string]: any;
|
|
27
|
+
}) => void;
|
|
28
|
+
isDirty: import("vue").ComputedRef<boolean>;
|
|
29
|
+
dirtyFields: import("vue").ComputedRef<string[]>;
|
|
30
|
+
getFieldValue: (path: string) => unknown;
|
|
31
|
+
setFieldValue: (path: string, value: unknown) => void;
|
|
18
32
|
}>) => void;
|
|
19
33
|
attrs: any;
|
|
20
34
|
slots: AutoFormSlots<N extends false ? Partial<InferInput<S>> : never>;
|
|
21
|
-
emit: (evt: "error", args_0: import("@nuxt/ui").FormErrorEvent) => void;
|
|
35
|
+
emit: (((evt: "error", args_0: import("@nuxt/ui").FormErrorEvent) => void) & ((evt: "clear", state: Partial<z.core.input<S>>) => void) & ((evt: "reset", state: Partial<z.core.input<S>>) => void)) & ((event: "update:modelValue", value: (N extends false ? Partial<InferInput<S>> : never) | undefined) => void);
|
|
22
36
|
}>) => import("vue").VNode & {
|
|
23
37
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
24
38
|
};
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { UForm } from "#components";
|
|
3
|
-
import { computed,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { applyFieldDefaults, classifyFields } from "../domains/auto-form/fields";
|
|
7
|
-
import { extractPureSchema, introspectSchema, omitFields } from "../domains/auto-form/schema";
|
|
8
|
-
import { DEFAULT_CONTROLS } from "../domains/auto-form/controls";
|
|
3
|
+
import { computed, ref, useAttrs, useTemplateRef } from "vue";
|
|
4
|
+
import { classifyFields } from "../domains/auto-form/fields";
|
|
5
|
+
import { useAutoFormCore } from "../domains/auto-form/useAutoFormCore";
|
|
9
6
|
import AutoFormRendererChildren from "../domains/auto-form/components/Children.vue";
|
|
10
7
|
import AutoFormRendererField from "../domains/auto-form/components/Field.vue";
|
|
11
8
|
import { useExtendedTv } from "../utils/extend-theme";
|
|
9
|
+
import { useMovkLocale } from "../composables/useMovkLocale";
|
|
12
10
|
import theme from "#build/movk-ui/auto-form";
|
|
13
11
|
import { useAppConfig } from "#imports";
|
|
14
12
|
const props = defineProps({
|
|
15
13
|
state: { type: null, required: false },
|
|
14
|
+
loading: { type: Boolean, required: false },
|
|
16
15
|
submit: { type: Boolean, required: false, default: true },
|
|
17
16
|
submitButtonProps: { type: Object, required: false },
|
|
18
17
|
addButtonProps: { type: Object, required: false },
|
|
@@ -21,38 +20,35 @@ const props = defineProps({
|
|
|
21
20
|
globalMeta: { type: Object, required: false },
|
|
22
21
|
loadingAuto: { type: Boolean, required: false, default: true },
|
|
23
22
|
validateOn: { type: Array, required: false, default: () => [] },
|
|
23
|
+
hiddenValue: { type: String, required: false },
|
|
24
|
+
onSubmit: { type: Function, required: false },
|
|
24
25
|
class: { type: [Array, String, null, Number, Boolean], required: false, skipCheck: true },
|
|
25
26
|
ui: { type: Object, required: false }
|
|
26
27
|
});
|
|
27
|
-
const
|
|
28
|
+
const modelValue = defineModel({ type: null });
|
|
29
|
+
const emits = defineEmits(["error", "reset", "clear"]);
|
|
28
30
|
const slots = defineSlots();
|
|
29
31
|
defineOptions({ inheritAttrs: false });
|
|
30
32
|
const attrs = useAttrs();
|
|
33
|
+
const { t } = useMovkLocale();
|
|
31
34
|
const appConfig = useAppConfig();
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
if (import.meta.dev && props.state !== void 0) {
|
|
36
|
+
console.warn("[AutoForm] The `state` prop is deprecated, use `v-model` instead.");
|
|
37
|
+
}
|
|
38
|
+
const localState = ref({});
|
|
39
|
+
const stateModel = computed(() => modelValue.value ?? props.state ?? localState.value);
|
|
34
40
|
const formRef = useTemplateRef("formRef");
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const visibleFields = computed(
|
|
44
|
-
() => fields.value.filter(
|
|
45
|
-
(field) => field && (field.meta?.if === void 0 || resolveFieldProp(field, "if") === true)
|
|
46
|
-
)
|
|
47
|
-
);
|
|
48
|
-
const pureSchema = computed(() => {
|
|
49
|
-
if (!props.schema) return props.schema;
|
|
50
|
-
const base = extractPureSchema(props.schema);
|
|
51
|
-
const hiddenKeys = fields.value.filter((field) => field?.meta?.if !== void 0 && resolveFieldProp(field, "if") !== true).map((field) => field.path);
|
|
52
|
-
return omitFields(base, hiddenKeys);
|
|
41
|
+
const core = useAutoFormCore({
|
|
42
|
+
schema: () => props.schema,
|
|
43
|
+
controls: () => props.controls,
|
|
44
|
+
globalMeta: () => props.globalMeta,
|
|
45
|
+
hiddenValue: () => props.hiddenValue,
|
|
46
|
+
model: stateModel,
|
|
47
|
+
slots,
|
|
48
|
+
addButtonProps: () => props.addButtonProps
|
|
53
49
|
});
|
|
50
|
+
const { visibleFields, validationSchema, resolvedButtonSize } = core;
|
|
54
51
|
const renderData = computed(() => {
|
|
55
|
-
if (!fields.value.length) return null;
|
|
56
52
|
const classified = classifyFields(visibleFields.value);
|
|
57
53
|
return {
|
|
58
54
|
...classified,
|
|
@@ -72,24 +68,28 @@ const { extendUi } = useExtendedTv(
|
|
|
72
68
|
})
|
|
73
69
|
);
|
|
74
70
|
function reset() {
|
|
75
|
-
const
|
|
76
|
-
for (const key of Object.keys(target)) Reflect.deleteProperty(target, key);
|
|
77
|
-
Object.assign(target, deepClone(initialState));
|
|
78
|
-
applyFieldDefaults(fields.value, target);
|
|
71
|
+
const next = core.reset();
|
|
79
72
|
formRef.value?.clear();
|
|
73
|
+
emits("reset", next);
|
|
80
74
|
}
|
|
81
75
|
function clear() {
|
|
82
|
-
const
|
|
83
|
-
for (const key of Object.keys(target)) Reflect.deleteProperty(target, key);
|
|
76
|
+
const next = core.clear();
|
|
84
77
|
formRef.value?.clear();
|
|
78
|
+
emits("clear", next);
|
|
85
79
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
});
|
|
80
|
+
const submit = async () => formRef.value?.submit();
|
|
81
|
+
const validate = ((...args) => formRef.value?.validate(...args));
|
|
89
82
|
defineExpose({
|
|
90
83
|
formRef,
|
|
84
|
+
submit,
|
|
85
|
+
validate,
|
|
91
86
|
reset,
|
|
92
|
-
clear
|
|
87
|
+
clear,
|
|
88
|
+
setBaseline: core.setBaseline,
|
|
89
|
+
isDirty: core.isDirty,
|
|
90
|
+
dirtyFields: core.dirtyFields,
|
|
91
|
+
getFieldValue: core.getFieldValue,
|
|
92
|
+
setFieldValue: core.setFieldValue
|
|
93
93
|
});
|
|
94
94
|
</script>
|
|
95
95
|
|
|
@@ -101,29 +101,28 @@ defineExpose({
|
|
|
101
101
|
}"
|
|
102
102
|
>
|
|
103
103
|
<UForm
|
|
104
|
-
v-if="renderData"
|
|
105
104
|
ref="formRef"
|
|
106
105
|
:state="stateModel"
|
|
107
|
-
:schema="
|
|
106
|
+
:schema="validationSchema"
|
|
108
107
|
:loading-auto="props.loadingAuto"
|
|
109
108
|
:validate-on="props.validateOn"
|
|
110
109
|
data-slot="form"
|
|
111
110
|
v-bind="attrs"
|
|
111
|
+
:on-submit="props.onSubmit"
|
|
112
112
|
:ui="{
|
|
113
113
|
base: extendUi.base
|
|
114
114
|
}"
|
|
115
115
|
@error="emits('error', $event)"
|
|
116
116
|
>
|
|
117
|
-
<template #default="{ errors, loading }">
|
|
117
|
+
<template #default="{ errors, loading: submitting }">
|
|
118
118
|
<div v-if="$slots.header" :class="extendUi.header" data-slot="header">
|
|
119
|
-
<slot name="header" v-bind="{ errors, loading, fields: visibleFields, state: stateModel }" />
|
|
119
|
+
<slot name="header" v-bind="{ errors, loading: props.loading || submitting, fields: visibleFields, state: stateModel }" />
|
|
120
120
|
</div>
|
|
121
121
|
|
|
122
122
|
<template v-if="renderData.hasComplexFields">
|
|
123
123
|
<AutoFormRendererChildren
|
|
124
124
|
:fields="renderData.allFields"
|
|
125
|
-
:
|
|
126
|
-
:extra-props="{ errors, loading }"
|
|
125
|
+
:extra-props="{ errors, loading: props.loading || submitting }"
|
|
127
126
|
/>
|
|
128
127
|
</template>
|
|
129
128
|
|
|
@@ -132,22 +131,21 @@ defineExpose({
|
|
|
132
131
|
v-for="field in renderData.flatFields"
|
|
133
132
|
:key="field.path"
|
|
134
133
|
:field="field"
|
|
135
|
-
:
|
|
136
|
-
:extra-props="{ errors, loading }"
|
|
134
|
+
:extra-props="{ errors, loading: props.loading || submitting }"
|
|
137
135
|
/>
|
|
138
136
|
</template>
|
|
139
137
|
|
|
140
138
|
<div v-if="$slots.footer" :class="extendUi.footer" data-slot="footer">
|
|
141
|
-
<slot name="footer" v-bind="{ errors, loading, fields: visibleFields, state: stateModel }" />
|
|
139
|
+
<slot name="footer" v-bind="{ errors, loading: props.loading || submitting, fields: visibleFields, state: stateModel }" />
|
|
142
140
|
</div>
|
|
143
141
|
|
|
144
142
|
<div v-if="props.submit" :class="extendUi.actions" data-slot="submit">
|
|
145
|
-
<slot name="submit" v-bind="{ errors, loading, fields: visibleFields, state: stateModel }">
|
|
143
|
+
<slot name="submit" v-bind="{ errors, loading: props.loading || submitting, fields: visibleFields, state: stateModel }">
|
|
146
144
|
<UButton
|
|
147
145
|
type="submit"
|
|
148
|
-
label="
|
|
146
|
+
:label="t('autoForm.submit')"
|
|
149
147
|
block
|
|
150
|
-
:loading="loading"
|
|
148
|
+
:loading="props.loading || submitting"
|
|
151
149
|
:loading-auto="props.loadingAuto"
|
|
152
150
|
:size="resolvedButtonSize"
|
|
153
151
|
:disabled="attrs.disabled"
|
|
@@ -6,19 +6,33 @@ import type { AppConfig } from 'nuxt/schema';
|
|
|
6
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<{
|
|
7
7
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<(AutoFormProps<S, T, N> & {
|
|
8
8
|
ui?: ComponentConfig<typeof theme, AppConfig, "autoForm">["slots"];
|
|
9
|
+
} & {
|
|
10
|
+
modelValue?: N extends false ? Partial<InferInput<S>> : never;
|
|
9
11
|
}) & {
|
|
10
12
|
onError?: ((args_0: import("@nuxt/ui").FormErrorEvent) => any) | undefined;
|
|
13
|
+
onClear?: ((state: Partial<z.core.input<S>>) => any) | undefined;
|
|
14
|
+
onReset?: ((state: Partial<z.core.input<S>>) => any) | undefined;
|
|
15
|
+
"onUpdate:modelValue"?: ((value: (N extends false ? Partial<InferInput<S>> : never) | undefined) => any) | undefined;
|
|
11
16
|
}> & (typeof globalThis extends {
|
|
12
17
|
__VLS_PROPS_FALLBACK: infer P;
|
|
13
18
|
} ? P : {});
|
|
14
19
|
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
15
20
|
formRef: Readonly<import("vue").ShallowRef<any, any>>;
|
|
21
|
+
submit: () => Promise<any>;
|
|
22
|
+
validate: any;
|
|
16
23
|
reset: () => void;
|
|
17
24
|
clear: () => void;
|
|
25
|
+
setBaseline: (value?: {
|
|
26
|
+
[x: string]: any;
|
|
27
|
+
}) => void;
|
|
28
|
+
isDirty: import("vue").ComputedRef<boolean>;
|
|
29
|
+
dirtyFields: import("vue").ComputedRef<string[]>;
|
|
30
|
+
getFieldValue: (path: string) => unknown;
|
|
31
|
+
setFieldValue: (path: string, value: unknown) => void;
|
|
18
32
|
}>) => void;
|
|
19
33
|
attrs: any;
|
|
20
34
|
slots: AutoFormSlots<N extends false ? Partial<InferInput<S>> : never>;
|
|
21
|
-
emit: (evt: "error", args_0: import("@nuxt/ui").FormErrorEvent) => void;
|
|
35
|
+
emit: (((evt: "error", args_0: import("@nuxt/ui").FormErrorEvent) => void) & ((evt: "clear", state: Partial<z.core.input<S>>) => void) & ((evt: "reset", state: Partial<z.core.input<S>>) => void)) & ((event: "update:modelValue", value: (N extends false ? Partial<InferInput<S>> : never) | undefined) => void);
|
|
22
36
|
}>) => import("vue").VNode & {
|
|
23
37
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
24
38
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ColumnPinningState, ColumnSizingState, ExpandedState, PaginationState, RowPinningState, RowSelectionState, SortingState, VisibilityState } from '@tanstack/vue-table';
|
|
1
|
+
import type { ColumnOrderState, ColumnPinningState, ColumnSizingState, ExpandedState, PaginationState, RowPinningState, RowSelectionState, SortingState, VisibilityState } from '@tanstack/vue-table';
|
|
2
2
|
import type { TableData } from '@nuxt/ui';
|
|
3
3
|
import type { DataTableExposed, DataTableProps, DataTableSlots } from '../types/data-table/component';
|
|
4
4
|
import type { DataTablePaginationUi } from '../types/data-table/pagination';
|
|
@@ -20,6 +20,7 @@ declare const __VLS_export: <T extends TableData>(__VLS_props: NonNullable<Await
|
|
|
20
20
|
rowSelection?: RowSelectionState;
|
|
21
21
|
rowPinning?: RowPinningState;
|
|
22
22
|
sorting?: SortingState;
|
|
23
|
+
columnOrder?: ColumnOrderState;
|
|
23
24
|
expanded?: ExpandedState;
|
|
24
25
|
columnVisibilityKeys?: string[];
|
|
25
26
|
columnVisibilityExcludeKeys?: string[];
|
|
@@ -33,6 +34,7 @@ declare const __VLS_export: <T extends TableData>(__VLS_props: NonNullable<Await
|
|
|
33
34
|
"onUpdate:rowSelection"?: ((value: RowSelectionState | undefined) => any) | undefined;
|
|
34
35
|
"onUpdate:rowPinning"?: ((value: RowPinningState) => any) | undefined;
|
|
35
36
|
"onUpdate:sorting"?: ((value: SortingState) => any) | undefined;
|
|
37
|
+
"onUpdate:columnOrder"?: ((value: ColumnOrderState | undefined) => any) | undefined;
|
|
36
38
|
"onUpdate:expanded"?: ((value: ExpandedState | undefined) => any) | undefined;
|
|
37
39
|
"onUpdate:columnVisibilityKeys"?: ((value: string[] | undefined) => any) | undefined;
|
|
38
40
|
"onUpdate:columnVisibilityExcludeKeys"?: ((value: string[] | undefined) => any) | undefined;
|
|
@@ -44,7 +46,7 @@ declare const __VLS_export: <T extends TableData>(__VLS_props: NonNullable<Await
|
|
|
44
46
|
expose: (exposed: import("vue").ShallowUnwrapRef<DataTableExposed<T>>) => void;
|
|
45
47
|
attrs: any;
|
|
46
48
|
slots: DataTableSlots<T>;
|
|
47
|
-
emit: ((event: "update:pagination", value: PaginationState | undefined) => void) & ((event: "update:columnVisibility", value: VisibilityState | undefined) => void) & ((event: "update:columnPinning", value: ColumnPinningState | undefined) => void) & ((event: "update:columnSizing", value: ColumnSizingState | undefined) => void) & ((event: "update:rowSelection", value: RowSelectionState | undefined) => void) & ((event: "update:rowPinning", value: RowPinningState) => void) & ((event: "update:sorting", value: SortingState) => void) & ((event: "update:expanded", value: ExpandedState | undefined) => void) & ((event: "update:columnVisibilityKeys", value: string[] | undefined) => void) & ((event: "update:columnVisibilityExcludeKeys", value: string[] | undefined) => void) & ((event: "update:rowSelectionKeys", value: string[] | undefined) => void) & ((event: "update:expandedKeys", value: string[] | undefined) => void);
|
|
49
|
+
emit: ((event: "update:pagination", value: PaginationState | undefined) => void) & ((event: "update:columnVisibility", value: VisibilityState | undefined) => void) & ((event: "update:columnPinning", value: ColumnPinningState | undefined) => void) & ((event: "update:columnSizing", value: ColumnSizingState | undefined) => void) & ((event: "update:rowSelection", value: RowSelectionState | undefined) => void) & ((event: "update:rowPinning", value: RowPinningState) => void) & ((event: "update:sorting", value: SortingState) => void) & ((event: "update:columnOrder", value: ColumnOrderState | undefined) => void) & ((event: "update:expanded", value: ExpandedState | undefined) => void) & ((event: "update:columnVisibilityKeys", value: string[] | undefined) => void) & ((event: "update:columnVisibilityExcludeKeys", value: string[] | undefined) => void) & ((event: "update:rowSelectionKeys", value: string[] | undefined) => void) & ((event: "update:expandedKeys", value: string[] | undefined) => void);
|
|
48
50
|
}>) => import("vue").VNode & {
|
|
49
51
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
50
52
|
};
|