@tmagic/form 1.7.14-beta.2 → 1.8.0-beta.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/dist/es/Form.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/FormBox.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/FormDialog.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/FormDrawer.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/containers/Container.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/containers/table-group-list/useAdd.js +1 -1
- package/dist/es/fields/Cascader.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/CheckboxGroup.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/Date.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/DateTime.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/Daterange.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/Display.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/Select.vue_vue_type_script_setup_true_lang.js +26 -9
- package/dist/es/fields/Text.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/Timerange.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/index.js +3 -2
- package/dist/es/submitForm.js +87 -0
- package/dist/es/utils/form.js +2 -2
- package/dist/tmagic-form.umd.cjs +177 -66
- package/package.json +4 -4
- package/src/FormBox.vue +3 -1
- package/src/FormDialog.vue +4 -1
- package/src/FormDrawer.vue +4 -1
- package/src/containers/table-group-list/useAdd.ts +1 -1
- package/src/fields/Select.vue +35 -8
- package/src/index.ts +1 -0
- package/src/submitForm.ts +161 -0
- package/types/index.d.ts +91 -29
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Tencent is pleased to support the open source community by making TMagicEditor available.
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Tencent. All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { type AppContext, type Component, createApp, defineComponent, h, nextTick, ref, watch } from 'vue';
|
|
20
|
+
|
|
21
|
+
import Form from './Form.vue';
|
|
22
|
+
import type { FormConfig, FormState } from './schema';
|
|
23
|
+
|
|
24
|
+
// #region SubmitFormOptions
|
|
25
|
+
/**
|
|
26
|
+
* submitForm 函数参数(与 Form.vue 组件 props 对齐)
|
|
27
|
+
*/
|
|
28
|
+
export interface SubmitFormOptions {
|
|
29
|
+
/** 表单配置 */
|
|
30
|
+
config: FormConfig;
|
|
31
|
+
/** 表单初始值 */
|
|
32
|
+
initValues?: Record<string, any>;
|
|
33
|
+
/** 需对比的值(开启对比模式时传入) */
|
|
34
|
+
lastValues?: Record<string, any>;
|
|
35
|
+
/** 是否开启对比模式 */
|
|
36
|
+
isCompare?: boolean;
|
|
37
|
+
parentValues?: Record<string, any>;
|
|
38
|
+
labelWidth?: string;
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
height?: string;
|
|
41
|
+
stepActive?: string | number;
|
|
42
|
+
size?: 'small' | 'default' | 'large';
|
|
43
|
+
inline?: boolean;
|
|
44
|
+
labelPosition?: string;
|
|
45
|
+
keyProp?: string;
|
|
46
|
+
popperClass?: string;
|
|
47
|
+
preventSubmitDefault?: boolean;
|
|
48
|
+
extendState?: (_state: FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
49
|
+
/** 透传给 Form.submitForm 的参数:是否直接返回原始响应式 values */
|
|
50
|
+
native?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* 父级应用上下文,用于继承全局组件、指令、provide 等。
|
|
53
|
+
* 通常通过 `app._context` 或 `getCurrentInstance()?.appContext` 获取。
|
|
54
|
+
*/
|
|
55
|
+
appContext?: AppContext | null;
|
|
56
|
+
/** 等待表单初始化的最长时间(毫秒),超时将以错误 reject。默认 10000ms */
|
|
57
|
+
timeout?: number;
|
|
58
|
+
}
|
|
59
|
+
// #endregion SubmitFormOptions
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 以命令式方式调用 Form.vue 完成一次表单校验/提交。
|
|
63
|
+
*
|
|
64
|
+
* 类似 ElMessage 的用法:传入 props(包含 `config`/`initValues` 等),函数内部会临时挂载
|
|
65
|
+
* 一个不可见的 Form 组件实例,等待初始化完成后调用其 `submitForm` 方法,
|
|
66
|
+
* 校验通过则 resolve 表单值,校验失败则 reject 错误信息,最后自动卸载实例。
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* import { submitForm } from '@tmagic/form';
|
|
71
|
+
*
|
|
72
|
+
* try {
|
|
73
|
+
* const values = await submitForm({
|
|
74
|
+
* config: [...],
|
|
75
|
+
* initValues: { name: 'foo' },
|
|
76
|
+
* });
|
|
77
|
+
* console.log(values);
|
|
78
|
+
* } catch (e) {
|
|
79
|
+
* console.error(e);
|
|
80
|
+
* }
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export const submitForm = (options: SubmitFormOptions): Promise<any> => {
|
|
84
|
+
const { native, appContext, timeout = 10000, ...formProps } = options;
|
|
85
|
+
|
|
86
|
+
return new Promise((resolve, reject) => {
|
|
87
|
+
const container = document.createElement('div');
|
|
88
|
+
container.style.display = 'none';
|
|
89
|
+
document.body.appendChild(container);
|
|
90
|
+
|
|
91
|
+
let cleaned = false;
|
|
92
|
+
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
93
|
+
|
|
94
|
+
const wrapperComponent = defineComponent({
|
|
95
|
+
name: 'MFormSubmitWrapper',
|
|
96
|
+
setup() {
|
|
97
|
+
const formRef = ref<any>(null);
|
|
98
|
+
|
|
99
|
+
const stop = watch(
|
|
100
|
+
() => formRef.value?.initialized,
|
|
101
|
+
async (initialized) => {
|
|
102
|
+
if (!initialized) return;
|
|
103
|
+
stop();
|
|
104
|
+
|
|
105
|
+
try {
|
|
106
|
+
// 等待子组件(FormItem 等)完成首次渲染,确保 validate 能拿到所有字段
|
|
107
|
+
await nextTick();
|
|
108
|
+
const result = await formRef.value.submitForm(native);
|
|
109
|
+
resolve(result);
|
|
110
|
+
} catch (err) {
|
|
111
|
+
reject(err);
|
|
112
|
+
} finally {
|
|
113
|
+
cleanup();
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
{ flush: 'post', immediate: true },
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
return () => h(Form as Component, { ...formProps, ref: formRef });
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const app = createApp(wrapperComponent);
|
|
124
|
+
|
|
125
|
+
// 继承父级应用上下文(components / directives / provides / config 等)
|
|
126
|
+
if (appContext) {
|
|
127
|
+
Object.assign(app._context, appContext);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const cleanup = () => {
|
|
131
|
+
if (cleaned) return;
|
|
132
|
+
cleaned = true;
|
|
133
|
+
if (timer) {
|
|
134
|
+
clearTimeout(timer);
|
|
135
|
+
timer = null;
|
|
136
|
+
}
|
|
137
|
+
try {
|
|
138
|
+
app.unmount();
|
|
139
|
+
} catch {
|
|
140
|
+
// ignore
|
|
141
|
+
}
|
|
142
|
+
container.parentNode?.removeChild(container);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
if (timeout > 0) {
|
|
146
|
+
timer = setTimeout(() => {
|
|
147
|
+
if (!cleaned) {
|
|
148
|
+
reject(new Error(`submitForm timeout after ${timeout}ms: form is not initialized.`));
|
|
149
|
+
cleanup();
|
|
150
|
+
}
|
|
151
|
+
}, timeout);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
try {
|
|
155
|
+
app.mount(container);
|
|
156
|
+
} catch (err) {
|
|
157
|
+
reject(err);
|
|
158
|
+
cleanup();
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
};
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FlexLayoutConfig, GroupListConfig, TableConfig } from "@tmagic/form-schema";
|
|
2
|
-
import { App, Component } from "vue";
|
|
2
|
+
import { App, AppContext, Component } from "vue";
|
|
3
3
|
export * from "@tmagic/form-schema";
|
|
4
4
|
|
|
5
5
|
//#region \0rolldown/runtime.js
|
|
@@ -20,6 +20,65 @@ interface ContainerChangeEventData {
|
|
|
20
20
|
changeRecords?: ChangeRecord[];
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
|
+
//#region temp/packages/form/src/submitForm.d.ts
|
|
24
|
+
/**
|
|
25
|
+
* submitForm 函数参数(与 Form.vue 组件 props 对齐)
|
|
26
|
+
*/
|
|
27
|
+
interface SubmitFormOptions {
|
|
28
|
+
/** 表单配置 */
|
|
29
|
+
config: schema_d_exports.FormConfig;
|
|
30
|
+
/** 表单初始值 */
|
|
31
|
+
initValues?: Record<string, any>;
|
|
32
|
+
/** 需对比的值(开启对比模式时传入) */
|
|
33
|
+
lastValues?: Record<string, any>;
|
|
34
|
+
/** 是否开启对比模式 */
|
|
35
|
+
isCompare?: boolean;
|
|
36
|
+
parentValues?: Record<string, any>;
|
|
37
|
+
labelWidth?: string;
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
height?: string;
|
|
40
|
+
stepActive?: string | number;
|
|
41
|
+
size?: 'small' | 'default' | 'large';
|
|
42
|
+
inline?: boolean;
|
|
43
|
+
labelPosition?: string;
|
|
44
|
+
keyProp?: string;
|
|
45
|
+
popperClass?: string;
|
|
46
|
+
preventSubmitDefault?: boolean;
|
|
47
|
+
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
48
|
+
/** 透传给 Form.submitForm 的参数:是否直接返回原始响应式 values */
|
|
49
|
+
native?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* 父级应用上下文,用于继承全局组件、指令、provide 等。
|
|
52
|
+
* 通常通过 `app._context` 或 `getCurrentInstance()?.appContext` 获取。
|
|
53
|
+
*/
|
|
54
|
+
appContext?: AppContext | null;
|
|
55
|
+
/** 等待表单初始化的最长时间(毫秒),超时将以错误 reject。默认 10000ms */
|
|
56
|
+
timeout?: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 以命令式方式调用 Form.vue 完成一次表单校验/提交。
|
|
60
|
+
*
|
|
61
|
+
* 类似 ElMessage 的用法:传入 props(包含 `config`/`initValues` 等),函数内部会临时挂载
|
|
62
|
+
* 一个不可见的 Form 组件实例,等待初始化完成后调用其 `submitForm` 方法,
|
|
63
|
+
* 校验通过则 resolve 表单值,校验失败则 reject 错误信息,最后自动卸载实例。
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* import { submitForm } from '@tmagic/form';
|
|
68
|
+
*
|
|
69
|
+
* try {
|
|
70
|
+
* const values = await submitForm({
|
|
71
|
+
* config: [...],
|
|
72
|
+
* initValues: { name: 'foo' },
|
|
73
|
+
* });
|
|
74
|
+
* console.log(values);
|
|
75
|
+
* } catch (e) {
|
|
76
|
+
* console.error(e);
|
|
77
|
+
* }
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
declare const submitForm: (options: SubmitFormOptions) => Promise<any>;
|
|
81
|
+
//#endregion
|
|
23
82
|
//#region temp/packages/form/src/utils/form.d.ts
|
|
24
83
|
declare const createValues: (mForm: schema_d_exports.FormState | undefined, config?: schema_d_exports.FormConfig | schema_d_exports.TabPaneConfig[], initValue?: schema_d_exports.FormValue, value?: schema_d_exports.FormValue) => schema_d_exports.FormValue;
|
|
25
84
|
declare const filterFunction: <T = any>(mForm: schema_d_exports.FormState | undefined, config: T | schema_d_exports.FilterFunction<T> | undefined, props: any) => T | undefined;
|
|
@@ -121,7 +180,8 @@ type __VLS_Props$29 = {
|
|
|
121
180
|
closeOnPressEscape?: boolean;
|
|
122
181
|
destroyOnClose?: boolean;
|
|
123
182
|
showClose?: boolean;
|
|
124
|
-
showCancel?: boolean;
|
|
183
|
+
showCancel?: boolean; /** 透传给内部 `MForm`,用于扩展 `formState`(如注入 `$message` / `$store` 等) */
|
|
184
|
+
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
125
185
|
};
|
|
126
186
|
declare var __VLS_19: {}, __VLS_34: {}, __VLS_42: {};
|
|
127
187
|
type __VLS_Slots$3 = {} & {
|
|
@@ -148,7 +208,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
148
208
|
keyProp?: string;
|
|
149
209
|
popperClass?: string;
|
|
150
210
|
preventSubmitDefault?: boolean;
|
|
151
|
-
extendState?: (_state:
|
|
211
|
+
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
152
212
|
}> & Readonly<{
|
|
153
213
|
onError?: ((...args: any[]) => any) | undefined;
|
|
154
214
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -158,7 +218,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
158
218
|
}>, {
|
|
159
219
|
values: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
160
220
|
lastValuesProcessed: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
161
|
-
formState:
|
|
221
|
+
formState: schema_d_exports.FormState;
|
|
162
222
|
initialized: import("@vue/reactivity").Ref<boolean, boolean>;
|
|
163
223
|
changeRecords: import("@vue/reactivity").ShallowRef<import("@tmagic/editor").ChangeRecord[], import("@tmagic/editor").ChangeRecord[]>;
|
|
164
224
|
changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
|
|
@@ -207,7 +267,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
207
267
|
keyProp?: string;
|
|
208
268
|
popperClass?: string;
|
|
209
269
|
preventSubmitDefault?: boolean;
|
|
210
|
-
extendState?: (_state:
|
|
270
|
+
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
211
271
|
}> & Readonly<{
|
|
212
272
|
onError?: ((...args: any[]) => any) | undefined;
|
|
213
273
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -217,7 +277,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
217
277
|
}>, {
|
|
218
278
|
values: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
219
279
|
lastValuesProcessed: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
220
|
-
formState:
|
|
280
|
+
formState: schema_d_exports.FormState;
|
|
221
281
|
initialized: import("@vue/reactivity").Ref<boolean, boolean>;
|
|
222
282
|
changeRecords: import("@vue/reactivity").ShallowRef<import("@tmagic/editor").ChangeRecord[], import("@tmagic/editor").ChangeRecord[]>;
|
|
223
283
|
changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
|
|
@@ -253,7 +313,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
253
313
|
keyProp?: string;
|
|
254
314
|
popperClass?: string;
|
|
255
315
|
preventSubmitDefault?: boolean;
|
|
256
|
-
extendState?: (_state:
|
|
316
|
+
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
257
317
|
}> & Readonly<{
|
|
258
318
|
onError?: ((...args: any[]) => any) | undefined;
|
|
259
319
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -263,7 +323,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
263
323
|
}>, {
|
|
264
324
|
values: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
265
325
|
lastValuesProcessed: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
266
|
-
formState:
|
|
326
|
+
formState: schema_d_exports.FormState;
|
|
267
327
|
initialized: import("@vue/reactivity").Ref<boolean, boolean>;
|
|
268
328
|
changeRecords: import("@vue/reactivity").ShallowRef<import("@tmagic/editor").ChangeRecord[], import("@tmagic/editor").ChangeRecord[]>;
|
|
269
329
|
changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
|
|
@@ -312,7 +372,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
312
372
|
keyProp?: string;
|
|
313
373
|
popperClass?: string;
|
|
314
374
|
preventSubmitDefault?: boolean;
|
|
315
|
-
extendState?: (_state:
|
|
375
|
+
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
316
376
|
}> & Readonly<{
|
|
317
377
|
onError?: ((...args: any[]) => any) | undefined;
|
|
318
378
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -322,7 +382,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
322
382
|
}>, {
|
|
323
383
|
values: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
324
384
|
lastValuesProcessed: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
325
|
-
formState:
|
|
385
|
+
formState: schema_d_exports.FormState;
|
|
326
386
|
initialized: import("@vue/reactivity").Ref<boolean, boolean>;
|
|
327
387
|
changeRecords: import("@vue/reactivity").ShallowRef<import("@tmagic/editor").ChangeRecord[], import("@tmagic/editor").ChangeRecord[]>;
|
|
328
388
|
changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
|
|
@@ -393,7 +453,8 @@ type __VLS_Props$28 = {
|
|
|
393
453
|
inline?: boolean;
|
|
394
454
|
labelPosition?: string;
|
|
395
455
|
preventSubmitDefault?: boolean; /** 关闭前的回调,会暂停 Drawer 的关闭; done 是个 function type 接受一个 boolean 参数, 执行 done 使用 true 参数或不提供参数将会终止关闭 */
|
|
396
|
-
beforeClose?: (_done: (_cancel?: boolean) => void) => void;
|
|
456
|
+
beforeClose?: (_done: (_cancel?: boolean) => void) => void; /** 透传给内部 `MForm`,用于扩展 `formState`(如注入 `$message` / `$store` 等) */
|
|
457
|
+
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
397
458
|
};
|
|
398
459
|
declare var __VLS_23: {}, __VLS_38: {}, __VLS_46: {};
|
|
399
460
|
type __VLS_Slots$2 = {} & {
|
|
@@ -420,7 +481,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
420
481
|
keyProp?: string;
|
|
421
482
|
popperClass?: string;
|
|
422
483
|
preventSubmitDefault?: boolean;
|
|
423
|
-
extendState?: (_state:
|
|
484
|
+
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
424
485
|
}> & Readonly<{
|
|
425
486
|
onError?: ((...args: any[]) => any) | undefined;
|
|
426
487
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -430,7 +491,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
430
491
|
}>, {
|
|
431
492
|
values: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
432
493
|
lastValuesProcessed: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
433
|
-
formState:
|
|
494
|
+
formState: schema_d_exports.FormState;
|
|
434
495
|
initialized: import("@vue/reactivity").Ref<boolean, boolean>;
|
|
435
496
|
changeRecords: import("@vue/reactivity").ShallowRef<import("@tmagic/editor").ChangeRecord[], import("@tmagic/editor").ChangeRecord[]>;
|
|
436
497
|
changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
|
|
@@ -479,7 +540,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
479
540
|
keyProp?: string;
|
|
480
541
|
popperClass?: string;
|
|
481
542
|
preventSubmitDefault?: boolean;
|
|
482
|
-
extendState?: (_state:
|
|
543
|
+
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
483
544
|
}> & Readonly<{
|
|
484
545
|
onError?: ((...args: any[]) => any) | undefined;
|
|
485
546
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -489,7 +550,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
489
550
|
}>, {
|
|
490
551
|
values: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
491
552
|
lastValuesProcessed: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
492
|
-
formState:
|
|
553
|
+
formState: schema_d_exports.FormState;
|
|
493
554
|
initialized: import("@vue/reactivity").Ref<boolean, boolean>;
|
|
494
555
|
changeRecords: import("@vue/reactivity").ShallowRef<import("@tmagic/editor").ChangeRecord[], import("@tmagic/editor").ChangeRecord[]>;
|
|
495
556
|
changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
|
|
@@ -525,7 +586,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
525
586
|
keyProp?: string;
|
|
526
587
|
popperClass?: string;
|
|
527
588
|
preventSubmitDefault?: boolean;
|
|
528
|
-
extendState?: (_state:
|
|
589
|
+
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
529
590
|
}> & Readonly<{
|
|
530
591
|
onError?: ((...args: any[]) => any) | undefined;
|
|
531
592
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -535,7 +596,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
535
596
|
}>, {
|
|
536
597
|
values: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
537
598
|
lastValuesProcessed: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
538
|
-
formState:
|
|
599
|
+
formState: schema_d_exports.FormState;
|
|
539
600
|
initialized: import("@vue/reactivity").Ref<boolean, boolean>;
|
|
540
601
|
changeRecords: import("@vue/reactivity").ShallowRef<import("@tmagic/editor").ChangeRecord[], import("@tmagic/editor").ChangeRecord[]>;
|
|
541
602
|
changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
|
|
@@ -584,7 +645,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
584
645
|
keyProp?: string;
|
|
585
646
|
popperClass?: string;
|
|
586
647
|
preventSubmitDefault?: boolean;
|
|
587
|
-
extendState?: (_state:
|
|
648
|
+
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
588
649
|
}> & Readonly<{
|
|
589
650
|
onError?: ((...args: any[]) => any) | undefined;
|
|
590
651
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -594,7 +655,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
594
655
|
}>, {
|
|
595
656
|
values: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
596
657
|
lastValuesProcessed: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
597
|
-
formState:
|
|
658
|
+
formState: schema_d_exports.FormState;
|
|
598
659
|
initialized: import("@vue/reactivity").Ref<boolean, boolean>;
|
|
599
660
|
changeRecords: import("@vue/reactivity").ShallowRef<import("@tmagic/editor").ChangeRecord[], import("@tmagic/editor").ChangeRecord[]>;
|
|
600
661
|
changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
|
|
@@ -664,6 +725,7 @@ type __VLS_Props$27 = {
|
|
|
664
725
|
inline?: boolean;
|
|
665
726
|
labelPosition?: string;
|
|
666
727
|
preventSubmitDefault?: boolean;
|
|
728
|
+
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
667
729
|
};
|
|
668
730
|
declare var __VLS_16$1: {}, __VLS_18$1: {}, __VLS_20: {};
|
|
669
731
|
type __VLS_Slots$1 = {} & {
|
|
@@ -690,7 +752,7 @@ declare const __VLS_base$1: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
690
752
|
keyProp?: string;
|
|
691
753
|
popperClass?: string;
|
|
692
754
|
preventSubmitDefault?: boolean;
|
|
693
|
-
extendState?: (_state:
|
|
755
|
+
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
694
756
|
}> & Readonly<{
|
|
695
757
|
onError?: ((...args: any[]) => any) | undefined;
|
|
696
758
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -700,7 +762,7 @@ declare const __VLS_base$1: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
700
762
|
}>, {
|
|
701
763
|
values: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
702
764
|
lastValuesProcessed: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
703
|
-
formState:
|
|
765
|
+
formState: schema_d_exports.FormState;
|
|
704
766
|
initialized: import("@vue/reactivity").Ref<boolean, boolean>;
|
|
705
767
|
changeRecords: import("@vue/reactivity").ShallowRef<import("@tmagic/editor").ChangeRecord[], import("@tmagic/editor").ChangeRecord[]>;
|
|
706
768
|
changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
|
|
@@ -749,7 +811,7 @@ declare const __VLS_base$1: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
749
811
|
keyProp?: string;
|
|
750
812
|
popperClass?: string;
|
|
751
813
|
preventSubmitDefault?: boolean;
|
|
752
|
-
extendState?: (_state:
|
|
814
|
+
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
753
815
|
}> & Readonly<{
|
|
754
816
|
onError?: ((...args: any[]) => any) | undefined;
|
|
755
817
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -759,7 +821,7 @@ declare const __VLS_base$1: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
759
821
|
}>, {
|
|
760
822
|
values: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
761
823
|
lastValuesProcessed: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
762
|
-
formState:
|
|
824
|
+
formState: schema_d_exports.FormState;
|
|
763
825
|
initialized: import("@vue/reactivity").Ref<boolean, boolean>;
|
|
764
826
|
changeRecords: import("@vue/reactivity").ShallowRef<import("@tmagic/editor").ChangeRecord[], import("@tmagic/editor").ChangeRecord[]>;
|
|
765
827
|
changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
|
|
@@ -795,7 +857,7 @@ declare const __VLS_base$1: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
795
857
|
keyProp?: string;
|
|
796
858
|
popperClass?: string;
|
|
797
859
|
preventSubmitDefault?: boolean;
|
|
798
|
-
extendState?: (_state:
|
|
860
|
+
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
799
861
|
}> & Readonly<{
|
|
800
862
|
onError?: ((...args: any[]) => any) | undefined;
|
|
801
863
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -805,7 +867,7 @@ declare const __VLS_base$1: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
805
867
|
}>, {
|
|
806
868
|
values: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
807
869
|
lastValuesProcessed: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
808
|
-
formState:
|
|
870
|
+
formState: schema_d_exports.FormState;
|
|
809
871
|
initialized: import("@vue/reactivity").Ref<boolean, boolean>;
|
|
810
872
|
changeRecords: import("@vue/reactivity").ShallowRef<import("@tmagic/editor").ChangeRecord[], import("@tmagic/editor").ChangeRecord[]>;
|
|
811
873
|
changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
|
|
@@ -854,7 +916,7 @@ declare const __VLS_base$1: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
854
916
|
keyProp?: string;
|
|
855
917
|
popperClass?: string;
|
|
856
918
|
preventSubmitDefault?: boolean;
|
|
857
|
-
extendState?: (_state:
|
|
919
|
+
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
858
920
|
}> & Readonly<{
|
|
859
921
|
onError?: ((...args: any[]) => any) | undefined;
|
|
860
922
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -864,7 +926,7 @@ declare const __VLS_base$1: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
864
926
|
}>, {
|
|
865
927
|
values: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
866
928
|
lastValuesProcessed: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
|
|
867
|
-
formState:
|
|
929
|
+
formState: schema_d_exports.FormState;
|
|
868
930
|
initialized: import("@vue/reactivity").Ref<boolean, boolean>;
|
|
869
931
|
changeRecords: import("@vue/reactivity").ShallowRef<import("@tmagic/editor").ChangeRecord[], import("@tmagic/editor").ChangeRecord[]>;
|
|
870
932
|
changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
|
|
@@ -1321,8 +1383,8 @@ declare const _default$31: {
|
|
|
1321
1383
|
install(app: App, opt?: FormInstallOptions): void;
|
|
1322
1384
|
};
|
|
1323
1385
|
declare namespace index_d_exports {
|
|
1324
|
-
export { ChangeRecord, ContainerChangeEventData, FormInstallOptions, _default as MCascader, _default$1 as MCheckbox, _default$2 as MCheckboxGroup, _default$3 as MColorPicker, _default$4 as MContainer, _default$5 as MDate, _default$6 as MDateTime, _default$7 as MDaterange, _default$8 as MDisplay, _default$9 as MDynamicField, _default$10 as MFieldset, _default$11 as MFlexLayout, _default$12 as MForm, _default$13 as MFormBox, _default$14 as MFormDialog, _default$15 as MFormDrawer, _default$16 as MGroupList, _default$17 as MHidden, _default$18 as MLink, _default$19 as MNumber, _default$20 as MNumberRange, _default$21 as MPanel, _default$22 as MRadioGroup, _default$23 as MRow, _default$24 as MSelect, _default$25 as MSwitch, _default$16 as MTable, _default$16 as MTableGroupList, _default$26 as MTabs, _default$27 as MText, _default$28 as MTextarea, _default$29 as MTime, _default$30 as MTimerange, ValidateError, createForm, createObjectProp, createValues, datetimeFormatter, _default$31 as default, deleteField as deleteFormField, display, filterFunction, getDataByPage, getField as getFormField, getRules, initValue, registerField as registerFormField, sortArray, sortChange, useAddField };
|
|
1386
|
+
export { ChangeRecord, ContainerChangeEventData, FormInstallOptions, _default as MCascader, _default$1 as MCheckbox, _default$2 as MCheckboxGroup, _default$3 as MColorPicker, _default$4 as MContainer, _default$5 as MDate, _default$6 as MDateTime, _default$7 as MDaterange, _default$8 as MDisplay, _default$9 as MDynamicField, _default$10 as MFieldset, _default$11 as MFlexLayout, _default$12 as MForm, _default$13 as MFormBox, _default$14 as MFormDialog, _default$15 as MFormDrawer, _default$16 as MGroupList, _default$17 as MHidden, _default$18 as MLink, _default$19 as MNumber, _default$20 as MNumberRange, _default$21 as MPanel, _default$22 as MRadioGroup, _default$23 as MRow, _default$24 as MSelect, _default$25 as MSwitch, _default$16 as MTable, _default$16 as MTableGroupList, _default$26 as MTabs, _default$27 as MText, _default$28 as MTextarea, _default$29 as MTime, _default$30 as MTimerange, SubmitFormOptions, ValidateError, createForm, createObjectProp, createValues, datetimeFormatter, _default$31 as default, deleteField as deleteFormField, display, filterFunction, getDataByPage, getField as getFormField, getRules, initValue, registerField as registerFormField, sortArray, sortChange, submitForm, useAddField };
|
|
1325
1387
|
}
|
|
1326
1388
|
declare const createForm: <T extends [] = []>(config: schema_d_exports.FormConfig | T) => schema_d_exports.FormConfig | T;
|
|
1327
1389
|
//#endregion
|
|
1328
|
-
export { ChangeRecord, ContainerChangeEventData, type FormInstallOptions, _default as MCascader, _default$1 as MCheckbox, _default$2 as MCheckboxGroup, _default$3 as MColorPicker, _default$4 as MContainer, _default$5 as MDate, _default$6 as MDateTime, _default$7 as MDaterange, _default$8 as MDisplay, _default$9 as MDynamicField, _default$10 as MFieldset, _default$11 as MFlexLayout, _default$12 as MForm, _default$13 as MFormBox, _default$14 as MFormDialog, _default$15 as MFormDrawer, _default$16 as MGroupList, _default$16 as MTable, _default$16 as MTableGroupList, _default$17 as MHidden, _default$18 as MLink, _default$19 as MNumber, _default$20 as MNumberRange, _default$21 as MPanel, _default$22 as MRadioGroup, _default$23 as MRow, _default$24 as MSelect, _default$25 as MSwitch, _default$26 as MTabs, _default$27 as MText, _default$28 as MTextarea, _default$29 as MTime, _default$30 as MTimerange, ValidateError, createForm, createObjectProp, createValues, datetimeFormatter, _default$31 as default, deleteField as deleteFormField, display, filterFunction, getDataByPage, getField as getFormField, getRules, initValue, registerField as registerFormField, sortArray, sortChange, useAddField };
|
|
1390
|
+
export { ChangeRecord, ContainerChangeEventData, type FormInstallOptions, _default as MCascader, _default$1 as MCheckbox, _default$2 as MCheckboxGroup, _default$3 as MColorPicker, _default$4 as MContainer, _default$5 as MDate, _default$6 as MDateTime, _default$7 as MDaterange, _default$8 as MDisplay, _default$9 as MDynamicField, _default$10 as MFieldset, _default$11 as MFlexLayout, _default$12 as MForm, _default$13 as MFormBox, _default$14 as MFormDialog, _default$15 as MFormDrawer, _default$16 as MGroupList, _default$16 as MTable, _default$16 as MTableGroupList, _default$17 as MHidden, _default$18 as MLink, _default$19 as MNumber, _default$20 as MNumberRange, _default$21 as MPanel, _default$22 as MRadioGroup, _default$23 as MRow, _default$24 as MSelect, _default$25 as MSwitch, _default$26 as MTabs, _default$27 as MText, _default$28 as MTextarea, _default$29 as MTime, _default$30 as MTimerange, SubmitFormOptions, ValidateError, createForm, createObjectProp, createValues, datetimeFormatter, _default$31 as default, deleteField as deleteFormField, display, filterFunction, getDataByPage, getField as getFormField, getRules, initValue, registerField as registerFormField, sortArray, sortChange, submitForm, useAddField };
|