@movk/nuxt 0.1.1 → 1.1.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/README.md +84 -9
- package/dist/module.d.mts +19 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +77 -8
- package/dist/runtime/components/AutoForm.d.vue.ts +12 -6
- package/dist/runtime/components/AutoForm.vue +4 -1
- package/dist/runtime/components/AutoForm.vue.d.ts +12 -6
- package/dist/runtime/components/ColorChooser.d.vue.ts +11 -5
- package/dist/runtime/components/ColorChooser.vue.d.ts +11 -5
- package/dist/runtime/components/DatePicker.d.vue.ts +14 -5
- package/dist/runtime/components/DatePicker.vue.d.ts +14 -5
- package/dist/runtime/components/SlideVerify.d.vue.ts +107 -0
- package/dist/runtime/components/SlideVerify.vue +147 -0
- package/dist/runtime/components/SlideVerify.vue.d.ts +107 -0
- package/dist/runtime/components/StarRating.d.vue.ts +7 -7
- package/dist/runtime/components/StarRating.vue +1 -0
- package/dist/runtime/components/StarRating.vue.d.ts +7 -7
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.d.vue.ts +6 -4
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.vue +1 -1
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.vue.d.ts +6 -4
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.d.vue.ts +6 -4
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue.d.ts +6 -4
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.d.vue.ts +6 -4
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.vue.d.ts +6 -4
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.d.vue.ts +6 -4
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.vue.d.ts +6 -4
- package/dist/runtime/components/input/WithCharacterLimit.d.vue.ts +11 -5
- package/dist/runtime/components/input/WithCharacterLimit.vue.d.ts +11 -5
- package/dist/runtime/components/input/WithClear.d.vue.ts +12 -5
- package/dist/runtime/components/input/WithClear.vue.d.ts +12 -5
- package/dist/runtime/components/input/WithCopy.d.vue.ts +12 -5
- package/dist/runtime/components/input/WithCopy.vue.d.ts +12 -5
- package/dist/runtime/components/input/WithPasswordToggle.d.vue.ts +11 -5
- package/dist/runtime/components/input/WithPasswordToggle.vue.d.ts +11 -5
- package/dist/runtime/components/theme-picker/ThemePicker.d.vue.ts +3 -0
- package/dist/runtime/components/theme-picker/ThemePicker.vue +235 -0
- package/dist/runtime/components/theme-picker/ThemePicker.vue.d.ts +3 -0
- package/dist/runtime/components/theme-picker/ThemePickerButton.d.vue.ts +18 -0
- package/dist/runtime/components/theme-picker/ThemePickerButton.vue +34 -0
- package/dist/runtime/components/theme-picker/ThemePickerButton.vue.d.ts +18 -0
- package/dist/runtime/composables/useApiAuth.d.ts +47 -0
- package/dist/runtime/composables/useApiAuth.js +66 -0
- package/dist/runtime/composables/useApiFetch.d.ts +42 -0
- package/dist/runtime/composables/useApiFetch.js +41 -0
- package/dist/runtime/composables/useAutoForm.d.ts +81 -605
- package/dist/runtime/composables/useAutoForm.js +3 -1
- package/dist/runtime/composables/useClientApiFetch.d.ts +24 -0
- package/dist/runtime/composables/useClientApiFetch.js +8 -0
- package/dist/runtime/composables/useDateFormatter.d.ts +21 -7
- package/dist/runtime/composables/useDateFormatter.js +92 -57
- package/dist/runtime/composables/useDownloadWithProgress.d.ts +48 -0
- package/dist/runtime/composables/useDownloadWithProgress.js +85 -0
- package/dist/runtime/composables/useTheme.d.ts +21 -0
- package/dist/runtime/composables/useTheme.js +143 -0
- package/dist/runtime/composables/useUploadWithProgress.d.ts +52 -0
- package/dist/runtime/composables/useUploadWithProgress.js +117 -0
- package/dist/runtime/internal/useAutoFormProvider.js +2 -2
- package/dist/runtime/plugins/api.factory.d.ts +2 -0
- package/dist/runtime/plugins/api.factory.js +186 -0
- package/dist/runtime/plugins/theme.d.ts +2 -0
- package/dist/runtime/plugins/theme.js +89 -0
- package/dist/runtime/schemas/api.d.ts +590 -0
- package/dist/runtime/schemas/api.js +228 -0
- package/dist/runtime/server/api/_movk/session.post.d.ts +10 -0
- package/dist/runtime/server/api/_movk/session.post.js +18 -0
- package/dist/runtime/style.css +1 -0
- package/dist/runtime/types/api.d.ts +218 -0
- package/dist/runtime/types/api.js +0 -0
- package/dist/runtime/types/auth.d.ts +34 -0
- package/dist/runtime/types/auto-form-renderer.d.ts +14 -22
- package/dist/runtime/types/auto-form-renderer.js +0 -0
- package/dist/runtime/types/components.d.ts +29 -41
- package/dist/runtime/types/components.js +0 -0
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +3 -2
- package/dist/runtime/utils/api-utils.d.ts +79 -0
- package/dist/runtime/utils/api-utils.js +127 -0
- package/package.json +38 -31
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[](https://nuxt.mhaibaraai.cn/)
|
|
2
2
|
|
|
3
|
-
> `@movk/nuxt` 是一个为 Nuxt 4
|
|
3
|
+
> `@movk/nuxt` 是一个为 Nuxt 4 设计的模块化工程套件,提供 Schema 驱动的自动表单生成、API 集成系统、独立 UI 组件和通用工具函数。
|
|
4
4
|
|
|
5
5
|
[](https://www.typescriptlang.org/)
|
|
6
6
|
[](https://nuxt.com/)
|
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
|
|
14
14
|
## ✨ 特性
|
|
15
15
|
|
|
16
|
-
- **Schema 驱动** - 基于 Zod v4
|
|
17
|
-
- **自动化系统** - AutoForm 通过 Schema
|
|
18
|
-
-
|
|
16
|
+
- **Schema 驱动** - 基于 Zod v4 的声明式表单定义,一份 Schema 同时定义数据结构、验证规则和 UI 配置。
|
|
17
|
+
- **自动化系统** - AutoForm 通过 Schema 自动生成完整表单界面,支持 15+ 种控件类型。
|
|
18
|
+
- **API 集成** - 内置 useApiFetch、useApiAuth、useUploadWithProgress、useDownloadWithProgress,提供多端点支持、自动认证、业务状态码检查、Toast 提示和进度监控。
|
|
19
|
+
- **模块化设计** - 采用分层架构,按需使用 UI 组件、工具函数或全套自动化系统。
|
|
19
20
|
- **独立组件库** - 内置 DatePicker、StarRating、WithCopy 等 10+ 个通用 UI 组件。
|
|
20
|
-
- **类型安全** - 完整的 TypeScript
|
|
21
|
+
- **类型安全** - 完整的 TypeScript 类型推断,从 Schema 到表单数据。
|
|
21
22
|
- **可扩展** - 支持自定义控件、布局系统、条件渲染等高级特性。
|
|
22
23
|
|
|
23
24
|
## 🚀 快速开始
|
|
@@ -214,11 +215,82 @@ const customControl = defineControl({
|
|
|
214
215
|
const meta = getAutoFormMetadata(schema)
|
|
215
216
|
```
|
|
216
217
|
|
|
218
|
+
#### useApiFetch
|
|
219
|
+
|
|
220
|
+
基于 Nuxt useFetch 封装的 API 请求:
|
|
221
|
+
|
|
222
|
+
```ts
|
|
223
|
+
// 基础用法
|
|
224
|
+
const { data, pending, error } = await useApiFetch<User[]>('/users')
|
|
225
|
+
|
|
226
|
+
// POST 请求
|
|
227
|
+
const { data } = await useApiFetch<User>('/users', {
|
|
228
|
+
method: 'POST',
|
|
229
|
+
body: { name: 'test' },
|
|
230
|
+
toast: { successMessage: '创建成功' }
|
|
231
|
+
})
|
|
232
|
+
|
|
233
|
+
// 使用其他端点
|
|
234
|
+
const { data } = await useApiFetch('/users', { endpoint: 'v2' })
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
#### useApiAuth
|
|
238
|
+
|
|
239
|
+
与 nuxt-auth-utils 集成的认证管理:
|
|
240
|
+
|
|
241
|
+
```ts
|
|
242
|
+
const { login, clear, loggedIn, user } = useApiAuth()
|
|
243
|
+
|
|
244
|
+
// 登录
|
|
245
|
+
await login({
|
|
246
|
+
loginPath: '/auth/login',
|
|
247
|
+
credentials: { username: 'admin', password: '123456' },
|
|
248
|
+
userInfoPath: '/auth/me' // 可选,登录后获取用户信息
|
|
249
|
+
})
|
|
250
|
+
|
|
251
|
+
// 登出
|
|
252
|
+
await clear()
|
|
253
|
+
|
|
254
|
+
// 响应式状态
|
|
255
|
+
if (loggedIn.value) {
|
|
256
|
+
console.log('当前用户:', user.value)
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
#### useUploadWithProgress
|
|
261
|
+
|
|
262
|
+
带进度监控的文件上传:
|
|
263
|
+
|
|
264
|
+
```ts
|
|
265
|
+
const { progress, uploading, upload, abort } = useUploadWithProgress()
|
|
266
|
+
|
|
267
|
+
// 上传文件
|
|
268
|
+
await upload('/api/upload', file, {
|
|
269
|
+
fieldName: 'avatar',
|
|
270
|
+
onSuccess: (response) => console.log('上传成功:', response)
|
|
271
|
+
})
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
#### useDownloadWithProgress
|
|
275
|
+
|
|
276
|
+
带进度监控的文件下载:
|
|
277
|
+
|
|
278
|
+
```ts
|
|
279
|
+
const { progress, downloading, download, abort } = useDownloadWithProgress()
|
|
280
|
+
|
|
281
|
+
// 下载文件
|
|
282
|
+
await download('/api/export/report', {
|
|
283
|
+
filename: 'report.pdf',
|
|
284
|
+
onSuccess: (filename) => console.log('下载完成:', filename)
|
|
285
|
+
})
|
|
286
|
+
```
|
|
287
|
+
|
|
217
288
|
## 🏗️ 架构分层
|
|
218
289
|
|
|
219
290
|
Movk Nuxt 采用清晰的分层架构:
|
|
220
291
|
|
|
221
|
-
- **Core Systems** - AutoForm(已发布)
|
|
292
|
+
- **Core Systems** - AutoForm(已发布)
|
|
293
|
+
- **API System** - useApiFetch、useApiAuth,提供完整的 API 请求和认证方案
|
|
222
294
|
- **Standalone Components** - DatePicker、StarRating、WithCopy 等独立 UI 组件
|
|
223
295
|
- **Composables** - useDateFormatter、useAutoForm 等通用组合式函数
|
|
224
296
|
- **Foundation** - 基于 [Nuxt UI](https://ui.nuxt.com)、[Zod v4](https://zod.dev)、[VueUse](https://vueuse.org)
|
|
@@ -234,9 +306,12 @@ Movk Nuxt 采用清晰的分层架构:
|
|
|
234
306
|
|
|
235
307
|
## 🗺️ 开发路线图
|
|
236
308
|
|
|
237
|
-
- ✅ **AutoForm** - Schema
|
|
238
|
-
-
|
|
239
|
-
-
|
|
309
|
+
- ✅ **AutoForm** - Schema 驱动的表单系统(已发布)
|
|
310
|
+
- ✅ **API System** - API 请求封装和认证管理(已发布)
|
|
311
|
+
- useApiFetch、useClientApiFetch - API 请求
|
|
312
|
+
- useApiAuth - 认证管理
|
|
313
|
+
- useUploadWithProgress、useDownloadWithProgress - 进度监控
|
|
314
|
+
- ✅ **独立组件库** - DatePicker、StarRating、WithCopy 等组件(已发布)
|
|
240
315
|
|
|
241
316
|
## 📄 许可证
|
|
242
317
|
|
package/dist/module.d.mts
CHANGED
|
@@ -1,14 +1,33 @@
|
|
|
1
1
|
import { z } from 'zod/v4';
|
|
2
|
+
import { ApiClient, MovkApiPublicConfig, MovkApiPrivateConfig } from '../dist/runtime/types/index.js';
|
|
2
3
|
export * from '../dist/runtime/types/index.js';
|
|
3
4
|
|
|
4
5
|
declare const moduleOptionsSchema: any;
|
|
5
6
|
type ModuleOptions = z.input<typeof moduleOptionsSchema>;
|
|
6
7
|
declare const _default: any;
|
|
7
8
|
|
|
9
|
+
declare module 'nuxt/app' {
|
|
10
|
+
interface NuxtApp {
|
|
11
|
+
$api: ApiClient;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
8
14
|
declare module 'nuxt/schema' {
|
|
9
15
|
interface NuxtOptions {
|
|
10
16
|
['movk']: ModuleOptions;
|
|
11
17
|
}
|
|
18
|
+
interface PublicRuntimeConfig {
|
|
19
|
+
movkApi: MovkApiPublicConfig;
|
|
20
|
+
}
|
|
21
|
+
interface RuntimeConfig {
|
|
22
|
+
movkApi: MovkApiPrivateConfig;
|
|
23
|
+
}
|
|
24
|
+
interface AppConfig {
|
|
25
|
+
theme: {
|
|
26
|
+
radius: number;
|
|
27
|
+
blackAsPrimary: boolean;
|
|
28
|
+
font: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
12
31
|
}
|
|
13
32
|
|
|
14
33
|
export { _default as default };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,16 +1,39 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addComponentsDir, addImportsDir, addTypeTemplate } from '@nuxt/kit';
|
|
2
|
-
import defu from 'defu';
|
|
1
|
+
import { addPlugin, defineNuxtModule, createResolver, addComponentsDir, addImportsDir, addServerHandler, addTypeTemplate } from '@nuxt/kit';
|
|
3
2
|
import { z } from 'zod/v4';
|
|
3
|
+
import { movkApiFullConfigSchema, apiToastConfigSchema, apiAuthConfigSchema, apiResponseConfigSchema } from '../dist/runtime/schemas/api.js';
|
|
4
|
+
import defu from 'defu';
|
|
5
|
+
export * from '../dist/runtime/types/index.js';
|
|
4
6
|
|
|
5
7
|
const name = "@movk/nuxt";
|
|
6
|
-
const version = "
|
|
8
|
+
const version = "1.1.0";
|
|
9
|
+
|
|
10
|
+
function setupTheme(nuxt, resolve) {
|
|
11
|
+
nuxt.options.appConfig.theme = defu(nuxt.options.appConfig.theme || {}, {
|
|
12
|
+
radius: 0.25,
|
|
13
|
+
blackAsPrimary: false,
|
|
14
|
+
font: "Public Sans"
|
|
15
|
+
});
|
|
16
|
+
nuxt.options.app.head.meta = nuxt.options.app.head.meta || [];
|
|
17
|
+
nuxt.options.app.head.meta.push(
|
|
18
|
+
{ charset: "utf-8" },
|
|
19
|
+
{ name: "viewport", content: "width=device-width, initial-scale=1" }
|
|
20
|
+
);
|
|
21
|
+
addPlugin({
|
|
22
|
+
src: resolve("runtime/plugins/theme"),
|
|
23
|
+
mode: "all"
|
|
24
|
+
});
|
|
25
|
+
}
|
|
7
26
|
|
|
8
27
|
const moduleOptionsSchema = z.object({
|
|
9
28
|
/**
|
|
10
29
|
* 组件前缀
|
|
11
30
|
* @default 'M'
|
|
12
31
|
*/
|
|
13
|
-
prefix: z.string().default("M")
|
|
32
|
+
prefix: z.string().default("M"),
|
|
33
|
+
/**
|
|
34
|
+
* API 模块配置
|
|
35
|
+
*/
|
|
36
|
+
api: movkApiFullConfigSchema.optional()
|
|
14
37
|
});
|
|
15
38
|
const module$1 = defineNuxtModule({
|
|
16
39
|
meta: {
|
|
@@ -27,29 +50,75 @@ const module$1 = defineNuxtModule({
|
|
|
27
50
|
version: ">=2.0.0"
|
|
28
51
|
},
|
|
29
52
|
"@nuxt/ui": {
|
|
30
|
-
version: ">=4.
|
|
53
|
+
version: ">=4.3.0"
|
|
31
54
|
},
|
|
32
55
|
"@vueuse/nuxt": {
|
|
33
56
|
version: ">=14.1.0"
|
|
57
|
+
},
|
|
58
|
+
"nuxt-og-image": {
|
|
59
|
+
version: ">=5.1.13"
|
|
60
|
+
},
|
|
61
|
+
"nuxt-auth-utils": {
|
|
62
|
+
version: ">=0.5.26"
|
|
34
63
|
}
|
|
35
64
|
},
|
|
36
65
|
async setup(options, nuxt) {
|
|
37
66
|
const { resolve } = createResolver(import.meta.url);
|
|
38
|
-
nuxt
|
|
67
|
+
setupTheme(nuxt, resolve);
|
|
39
68
|
nuxt.options.alias["#movk"] = resolve("./runtime");
|
|
40
|
-
|
|
69
|
+
const apiConfig = options.api || {};
|
|
41
70
|
addComponentsDir({
|
|
42
71
|
path: resolve("runtime/components"),
|
|
43
72
|
prefix: options.prefix,
|
|
44
73
|
pathPrefix: false,
|
|
45
|
-
ignore: ["auto-form-renderer/**"]
|
|
74
|
+
ignore: ["auto-form-renderer/**", "theme-picker/ThemePickerButton.vue"]
|
|
46
75
|
});
|
|
76
|
+
nuxt.options.css.push(resolve("runtime/style.css"));
|
|
47
77
|
addImportsDir(resolve("runtime/composables"));
|
|
48
78
|
addImportsDir(resolve("runtime/shared"));
|
|
79
|
+
if (apiConfig.enabled !== false) {
|
|
80
|
+
const publicEndpoints = {};
|
|
81
|
+
const privateEndpoints = {};
|
|
82
|
+
if (apiConfig.endpoints) {
|
|
83
|
+
for (const [endpointName, endpoint] of Object.entries(apiConfig.endpoints)) {
|
|
84
|
+
const { headers, ...publicConfig2 } = endpoint;
|
|
85
|
+
publicEndpoints[endpointName] = publicConfig2;
|
|
86
|
+
if (headers) {
|
|
87
|
+
privateEndpoints[endpointName] = { headers };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const publicConfig = {
|
|
92
|
+
defaultEndpoint: apiConfig.defaultEndpoint ?? "default",
|
|
93
|
+
debug: apiConfig.debug ?? false,
|
|
94
|
+
endpoints: Object.keys(publicEndpoints).length > 0 ? publicEndpoints : { default: { baseURL: "/api" } },
|
|
95
|
+
response: apiResponseConfigSchema.parse(apiConfig.response ?? {}),
|
|
96
|
+
auth: apiAuthConfigSchema.parse(apiConfig.auth ?? {}),
|
|
97
|
+
toast: apiToastConfigSchema.parse(apiConfig.toast ?? {})
|
|
98
|
+
};
|
|
99
|
+
const privateConfig = {
|
|
100
|
+
endpoints: Object.keys(privateEndpoints).length > 0 ? privateEndpoints : void 0
|
|
101
|
+
};
|
|
102
|
+
nuxt.options.runtimeConfig.movkApi = privateConfig;
|
|
103
|
+
nuxt.options.runtimeConfig.public.movkApi = publicConfig;
|
|
104
|
+
addPlugin({
|
|
105
|
+
src: resolve("runtime/plugins/api.factory"),
|
|
106
|
+
mode: "all"
|
|
107
|
+
});
|
|
108
|
+
addServerHandler({
|
|
109
|
+
route: "/api/_movk/session",
|
|
110
|
+
method: "post",
|
|
111
|
+
handler: resolve("runtime/server/api/_movk/session.post")
|
|
112
|
+
});
|
|
113
|
+
}
|
|
49
114
|
addTypeTemplate({
|
|
50
115
|
filename: "runtime/types/auto-form-zod.d.ts",
|
|
51
116
|
src: resolve("runtime/types/zod.d.ts")
|
|
52
117
|
});
|
|
118
|
+
addTypeTemplate({
|
|
119
|
+
filename: "runtime/types/auth.d.ts",
|
|
120
|
+
src: resolve("runtime/types/auth.d.ts")
|
|
121
|
+
});
|
|
53
122
|
}
|
|
54
123
|
});
|
|
55
124
|
|
|
@@ -5,7 +5,7 @@ import type { AutoFormControls, AutoFormSlotProps, DynamicFormSlots } from '../t
|
|
|
5
5
|
export interface AutoFormProps<S extends z.ZodObject, T extends boolean = true, N extends boolean = false> extends FormProps<S, T, N> {
|
|
6
6
|
/**
|
|
7
7
|
* 是否显示默认提交按钮
|
|
8
|
-
* @
|
|
8
|
+
* @defaultValue true
|
|
9
9
|
*/
|
|
10
10
|
submitButton?: boolean;
|
|
11
11
|
/** 提交按钮属性 */
|
|
@@ -16,6 +16,7 @@ export interface AutoFormProps<S extends z.ZodObject, T extends boolean = true,
|
|
|
16
16
|
globalMeta?: ZodAutoFormFieldMeta;
|
|
17
17
|
/** 数组字段添加按钮属性 */
|
|
18
18
|
addButtonProps?: ButtonProps;
|
|
19
|
+
loadingAuto?: boolean;
|
|
19
20
|
}
|
|
20
21
|
export interface AutoFormEmits<S extends z.ZodObject, T extends boolean = true> extends FormEmits<S, T> {
|
|
21
22
|
}
|
|
@@ -24,12 +25,15 @@ export type AutoFormSlots<T extends object> = {
|
|
|
24
25
|
footer: (props: AutoFormSlotProps<T>) => any;
|
|
25
26
|
submit: (props: AutoFormSlotProps<T>) => any;
|
|
26
27
|
} & DynamicFormSlots<T>;
|
|
27
|
-
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">>,
|
|
28
|
-
props:
|
|
28
|
+
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
|
+
onError?: ((event: import("@nuxt/ui/.").FormErrorEvent) => any) | undefined;
|
|
31
|
+
onSubmit?: ((event: import("@nuxt/ui/.").FormSubmitEvent<import("@nuxt/ui/.").FormData<S, T>>) => any) | undefined;
|
|
32
|
+
}> & (typeof globalThis extends {
|
|
29
33
|
__VLS_PROPS_FALLBACK: infer P;
|
|
30
34
|
} ? P : {});
|
|
31
35
|
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
32
|
-
formRef: Readonly<import("vue").ShallowRef<any>>;
|
|
36
|
+
formRef: Readonly<import("vue").ShallowRef<any, any>>;
|
|
33
37
|
reset: () => void;
|
|
34
38
|
clear: () => void;
|
|
35
39
|
}>) => void;
|
|
@@ -41,6 +45,8 @@ declare const __VLS_export: <S extends z.ZodObject, T extends boolean = true, N
|
|
|
41
45
|
};
|
|
42
46
|
declare const _default: typeof __VLS_export;
|
|
43
47
|
export default _default;
|
|
44
|
-
type __VLS_PrettifyLocal<T> = {
|
|
48
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
49
|
+
[K in keyof T]: T[K];
|
|
50
|
+
} : {
|
|
45
51
|
[K in keyof T as K]: T[K];
|
|
46
|
-
} & {};
|
|
52
|
+
}) & {};
|
|
@@ -17,6 +17,7 @@ const {
|
|
|
17
17
|
submitButtonProps,
|
|
18
18
|
addButtonProps,
|
|
19
19
|
state: _state,
|
|
20
|
+
loadingAuto = true,
|
|
20
21
|
...restProps
|
|
21
22
|
} = defineProps({
|
|
22
23
|
submitButton: { type: Boolean, required: false },
|
|
@@ -24,6 +25,7 @@ const {
|
|
|
24
25
|
controls: { type: Object, required: false },
|
|
25
26
|
globalMeta: { type: Object, required: false },
|
|
26
27
|
addButtonProps: { type: Object, required: false },
|
|
28
|
+
loadingAuto: { type: Boolean, required: false },
|
|
27
29
|
id: { type: [String, Number], required: false },
|
|
28
30
|
schema: { type: null, required: false },
|
|
29
31
|
state: { type: null, required: false },
|
|
@@ -34,7 +36,6 @@ const {
|
|
|
34
36
|
validateOnInputDelay: { type: Number, required: false },
|
|
35
37
|
transform: { type: null, required: false },
|
|
36
38
|
nested: { type: Boolean, required: false },
|
|
37
|
-
loadingAuto: { type: Boolean, required: false },
|
|
38
39
|
class: { type: null, required: false },
|
|
39
40
|
onSubmit: { type: Function, required: false }
|
|
40
41
|
});
|
|
@@ -126,6 +127,7 @@ defineExpose({
|
|
|
126
127
|
ref="formRef"
|
|
127
128
|
:state="state"
|
|
128
129
|
:schema="pureSchema"
|
|
130
|
+
:loading-auto="loadingAuto"
|
|
129
131
|
v-bind="restProps"
|
|
130
132
|
>
|
|
131
133
|
<template #default="{ errors, loading }">
|
|
@@ -180,6 +182,7 @@ defineExpose({
|
|
|
180
182
|
:loading="loading"
|
|
181
183
|
label="提交"
|
|
182
184
|
loading-auto
|
|
185
|
+
block
|
|
183
186
|
v-bind="submitButtonProps"
|
|
184
187
|
/>
|
|
185
188
|
</slot>
|
|
@@ -5,7 +5,7 @@ import type { AutoFormControls, AutoFormSlotProps, DynamicFormSlots } from '../t
|
|
|
5
5
|
export interface AutoFormProps<S extends z.ZodObject, T extends boolean = true, N extends boolean = false> extends FormProps<S, T, N> {
|
|
6
6
|
/**
|
|
7
7
|
* 是否显示默认提交按钮
|
|
8
|
-
* @
|
|
8
|
+
* @defaultValue true
|
|
9
9
|
*/
|
|
10
10
|
submitButton?: boolean;
|
|
11
11
|
/** 提交按钮属性 */
|
|
@@ -16,6 +16,7 @@ export interface AutoFormProps<S extends z.ZodObject, T extends boolean = true,
|
|
|
16
16
|
globalMeta?: ZodAutoFormFieldMeta;
|
|
17
17
|
/** 数组字段添加按钮属性 */
|
|
18
18
|
addButtonProps?: ButtonProps;
|
|
19
|
+
loadingAuto?: boolean;
|
|
19
20
|
}
|
|
20
21
|
export interface AutoFormEmits<S extends z.ZodObject, T extends boolean = true> extends FormEmits<S, T> {
|
|
21
22
|
}
|
|
@@ -24,12 +25,15 @@ export type AutoFormSlots<T extends object> = {
|
|
|
24
25
|
footer: (props: AutoFormSlotProps<T>) => any;
|
|
25
26
|
submit: (props: AutoFormSlotProps<T>) => any;
|
|
26
27
|
} & DynamicFormSlots<T>;
|
|
27
|
-
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">>,
|
|
28
|
-
props:
|
|
28
|
+
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
|
+
onError?: ((event: import("@nuxt/ui/.").FormErrorEvent) => any) | undefined;
|
|
31
|
+
onSubmit?: ((event: import("@nuxt/ui/.").FormSubmitEvent<import("@nuxt/ui/.").FormData<S, T>>) => any) | undefined;
|
|
32
|
+
}> & (typeof globalThis extends {
|
|
29
33
|
__VLS_PROPS_FALLBACK: infer P;
|
|
30
34
|
} ? P : {});
|
|
31
35
|
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
32
|
-
formRef: Readonly<import("vue").ShallowRef<any>>;
|
|
36
|
+
formRef: Readonly<import("vue").ShallowRef<any, any>>;
|
|
33
37
|
reset: () => void;
|
|
34
38
|
clear: () => void;
|
|
35
39
|
}>) => void;
|
|
@@ -41,6 +45,8 @@ declare const __VLS_export: <S extends z.ZodObject, T extends boolean = true, N
|
|
|
41
45
|
};
|
|
42
46
|
declare const _default: typeof __VLS_export;
|
|
43
47
|
export default _default;
|
|
44
|
-
type __VLS_PrettifyLocal<T> = {
|
|
48
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
49
|
+
[K in keyof T]: T[K];
|
|
50
|
+
} : {
|
|
45
51
|
[K in keyof T as K]: T[K];
|
|
46
|
-
} & {};
|
|
52
|
+
}) & {};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import type { ColorChooserProps } from '../types/components.js';
|
|
2
|
-
declare const __VLS_export: <P extends "click" | "hover" = "click">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>,
|
|
3
|
-
props: __VLS_PrettifyLocal<(ColorChooserProps<"click"> & {
|
|
2
|
+
declare const __VLS_export: <P extends "click" | "hover" = "click">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(ColorChooserProps<"click"> & {
|
|
4
4
|
modelValue?: string;
|
|
5
|
-
}) &
|
|
5
|
+
}) & {
|
|
6
|
+
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
7
|
+
"onClose:prevent"?: (() => any) | undefined;
|
|
8
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
9
|
+
}> & (typeof globalThis extends {
|
|
6
10
|
__VLS_PROPS_FALLBACK: infer P_1;
|
|
7
11
|
} ? P_1 : {});
|
|
8
12
|
expose: (exposed: {}) => void;
|
|
@@ -22,6 +26,8 @@ declare const __VLS_export: <P extends "click" | "hover" = "click">(__VLS_props:
|
|
|
22
26
|
};
|
|
23
27
|
declare const _default: typeof __VLS_export;
|
|
24
28
|
export default _default;
|
|
25
|
-
type __VLS_PrettifyLocal<T> = {
|
|
29
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
30
|
+
[K in keyof T]: T[K];
|
|
31
|
+
} : {
|
|
26
32
|
[K in keyof T as K]: T[K];
|
|
27
|
-
} & {};
|
|
33
|
+
}) & {};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import type { ColorChooserProps } from '../types/components.js';
|
|
2
|
-
declare const __VLS_export: <P extends "click" | "hover" = "click">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>,
|
|
3
|
-
props: __VLS_PrettifyLocal<(ColorChooserProps<"click"> & {
|
|
2
|
+
declare const __VLS_export: <P extends "click" | "hover" = "click">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(ColorChooserProps<"click"> & {
|
|
4
4
|
modelValue?: string;
|
|
5
|
-
}) &
|
|
5
|
+
}) & {
|
|
6
|
+
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
7
|
+
"onClose:prevent"?: (() => any) | undefined;
|
|
8
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
9
|
+
}> & (typeof globalThis extends {
|
|
6
10
|
__VLS_PROPS_FALLBACK: infer P_1;
|
|
7
11
|
} ? P_1 : {});
|
|
8
12
|
expose: (exposed: {}) => void;
|
|
@@ -22,6 +26,8 @@ declare const __VLS_export: <P extends "click" | "hover" = "click">(__VLS_props:
|
|
|
22
26
|
};
|
|
23
27
|
declare const _default: typeof __VLS_export;
|
|
24
28
|
export default _default;
|
|
25
|
-
type __VLS_PrettifyLocal<T> = {
|
|
29
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
30
|
+
[K in keyof T]: T[K];
|
|
31
|
+
} : {
|
|
26
32
|
[K in keyof T as K]: T[K];
|
|
27
|
-
} & {};
|
|
33
|
+
}) & {};
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import type { DateValue } from '@internationalized/date';
|
|
2
2
|
import type { DatePickerProps, ValueType } from '../types/components.js';
|
|
3
|
-
declare const __VLS_export: <R extends boolean, M extends boolean, P extends "click" | "hover" = "click">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>,
|
|
4
|
-
props: __VLS_PrettifyLocal<(DatePickerProps<R, M, P> & {
|
|
3
|
+
declare const __VLS_export: <R extends boolean, M extends boolean, P extends "click" | "hover" = "click">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(DatePickerProps<R, M, P> & {
|
|
5
5
|
modelValue?: ValueType<R, M>;
|
|
6
|
-
}) &
|
|
6
|
+
}) & {
|
|
7
|
+
"onUpdate:modelValue"?: ((value: ValueType<R, M>) => any) | undefined;
|
|
8
|
+
"onUpdate:placeholder"?: ((...args: DateValue[]) => any) | undefined;
|
|
9
|
+
"onUpdate:validModelValue"?: ((date: import("reka-ui").DateRange) => any) | undefined;
|
|
10
|
+
"onUpdate:startValue"?: ((date: DateValue | undefined) => any) | undefined;
|
|
11
|
+
"onClose:prevent"?: (() => any) | undefined;
|
|
12
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
13
|
+
}> & (typeof globalThis extends {
|
|
7
14
|
__VLS_PROPS_FALLBACK: infer P_1;
|
|
8
15
|
} ? P_1 : {});
|
|
9
16
|
expose: (exposed: {}) => void;
|
|
@@ -29,6 +36,8 @@ declare const __VLS_export: <R extends boolean, M extends boolean, P extends "cl
|
|
|
29
36
|
};
|
|
30
37
|
declare const _default: typeof __VLS_export;
|
|
31
38
|
export default _default;
|
|
32
|
-
type __VLS_PrettifyLocal<T> = {
|
|
39
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
40
|
+
[K in keyof T]: T[K];
|
|
41
|
+
} : {
|
|
33
42
|
[K in keyof T as K]: T[K];
|
|
34
|
-
} & {};
|
|
43
|
+
}) & {};
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import type { DateValue } from '@internationalized/date';
|
|
2
2
|
import type { DatePickerProps, ValueType } from '../types/components.js';
|
|
3
|
-
declare const __VLS_export: <R extends boolean, M extends boolean, P extends "click" | "hover" = "click">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>,
|
|
4
|
-
props: __VLS_PrettifyLocal<(DatePickerProps<R, M, P> & {
|
|
3
|
+
declare const __VLS_export: <R extends boolean, M extends boolean, P extends "click" | "hover" = "click">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(DatePickerProps<R, M, P> & {
|
|
5
5
|
modelValue?: ValueType<R, M>;
|
|
6
|
-
}) &
|
|
6
|
+
}) & {
|
|
7
|
+
"onUpdate:modelValue"?: ((value: ValueType<R, M>) => any) | undefined;
|
|
8
|
+
"onUpdate:placeholder"?: ((...args: DateValue[]) => any) | undefined;
|
|
9
|
+
"onUpdate:validModelValue"?: ((date: import("reka-ui").DateRange) => any) | undefined;
|
|
10
|
+
"onUpdate:startValue"?: ((date: DateValue | undefined) => any) | undefined;
|
|
11
|
+
"onClose:prevent"?: (() => any) | undefined;
|
|
12
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
13
|
+
}> & (typeof globalThis extends {
|
|
7
14
|
__VLS_PROPS_FALLBACK: infer P_1;
|
|
8
15
|
} ? P_1 : {});
|
|
9
16
|
expose: (exposed: {}) => void;
|
|
@@ -29,6 +36,8 @@ declare const __VLS_export: <R extends boolean, M extends boolean, P extends "cl
|
|
|
29
36
|
};
|
|
30
37
|
declare const _default: typeof __VLS_export;
|
|
31
38
|
export default _default;
|
|
32
|
-
type __VLS_PrettifyLocal<T> = {
|
|
39
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
40
|
+
[K in keyof T]: T[K];
|
|
41
|
+
} : {
|
|
33
42
|
[K in keyof T as K]: T[K];
|
|
34
|
-
} & {};
|
|
43
|
+
}) & {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
2
|
+
export interface SlideVerifyProps {
|
|
3
|
+
/**
|
|
4
|
+
* 滑块宽度
|
|
5
|
+
* @defaultValue 50
|
|
6
|
+
*/
|
|
7
|
+
sliderWidth?: number;
|
|
8
|
+
/**
|
|
9
|
+
* 滑块高度
|
|
10
|
+
* @defaultValue 44
|
|
11
|
+
*/
|
|
12
|
+
height?: number;
|
|
13
|
+
/**
|
|
14
|
+
* 是否禁用
|
|
15
|
+
* @defaultValue false
|
|
16
|
+
*/
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* 待滑动时的提示文本
|
|
20
|
+
* @defaultValue '请向右滑动验证'
|
|
21
|
+
*/
|
|
22
|
+
text?: string;
|
|
23
|
+
/**
|
|
24
|
+
* 验证成功时的提示文本
|
|
25
|
+
* @defaultValue '验证成功'
|
|
26
|
+
*/
|
|
27
|
+
successText?: string;
|
|
28
|
+
/**
|
|
29
|
+
* 滑块图标
|
|
30
|
+
* @defaultValue 'i-lucide-chevrons-right'
|
|
31
|
+
*/
|
|
32
|
+
icon?: string;
|
|
33
|
+
/**
|
|
34
|
+
* 验证成功时的图标
|
|
35
|
+
* @defaultValue 'i-lucide-check'
|
|
36
|
+
*/
|
|
37
|
+
successIcon?: string;
|
|
38
|
+
/**
|
|
39
|
+
* 完成验证所需的阈值百分比(0-1)
|
|
40
|
+
* @defaultValue 0.9
|
|
41
|
+
*/
|
|
42
|
+
threshold?: number;
|
|
43
|
+
/**
|
|
44
|
+
* 自定义轨道样式
|
|
45
|
+
*/
|
|
46
|
+
trackClass?: ClassNameValue;
|
|
47
|
+
/**
|
|
48
|
+
* 自定义滑块样式
|
|
49
|
+
*/
|
|
50
|
+
sliderClass?: ClassNameValue;
|
|
51
|
+
/**
|
|
52
|
+
* 自定义文本样式
|
|
53
|
+
*/
|
|
54
|
+
textClass?: ClassNameValue;
|
|
55
|
+
/**
|
|
56
|
+
* 自定义根元素样式
|
|
57
|
+
*/
|
|
58
|
+
class?: ClassNameValue;
|
|
59
|
+
}
|
|
60
|
+
export interface SlideVerifyEmits {
|
|
61
|
+
success: [];
|
|
62
|
+
dragStart: [];
|
|
63
|
+
dragEnd: [success: boolean];
|
|
64
|
+
}
|
|
65
|
+
type __VLS_Props = SlideVerifyProps;
|
|
66
|
+
declare function reset(): void;
|
|
67
|
+
type __VLS_ModelProps = {
|
|
68
|
+
modelValue?: boolean;
|
|
69
|
+
};
|
|
70
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
71
|
+
declare var __VLS_22: {
|
|
72
|
+
verified: boolean;
|
|
73
|
+
progress: number;
|
|
74
|
+
};
|
|
75
|
+
type __VLS_Slots = {} & {
|
|
76
|
+
slider?: (props: typeof __VLS_22) => any;
|
|
77
|
+
};
|
|
78
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
79
|
+
reset: typeof reset;
|
|
80
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
81
|
+
"update:modelValue": (value: boolean) => any;
|
|
82
|
+
success: () => any;
|
|
83
|
+
dragStart: () => any;
|
|
84
|
+
dragEnd: (success: boolean) => any;
|
|
85
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
86
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
87
|
+
onSuccess?: (() => any) | undefined;
|
|
88
|
+
onDragStart?: (() => any) | undefined;
|
|
89
|
+
onDragEnd?: ((success: boolean) => any) | undefined;
|
|
90
|
+
}>, {
|
|
91
|
+
disabled: boolean;
|
|
92
|
+
icon: string;
|
|
93
|
+
text: string;
|
|
94
|
+
height: number;
|
|
95
|
+
sliderWidth: number;
|
|
96
|
+
successText: string;
|
|
97
|
+
successIcon: string;
|
|
98
|
+
threshold: number;
|
|
99
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
100
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
101
|
+
declare const _default: typeof __VLS_export;
|
|
102
|
+
export default _default;
|
|
103
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
104
|
+
new (): {
|
|
105
|
+
$slots: S;
|
|
106
|
+
};
|
|
107
|
+
};
|