@tmagic/form 1.8.0-beta.0 → 1.8.0-beta.2
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 +97 -24
- package/dist/es/containers/Container.vue_vue_type_script_setup_true_lang.js +193 -77
- package/dist/es/containers/GroupList.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/containers/GroupListItem.vue_vue_type_script_setup_true_lang.js +9 -8
- package/dist/es/containers/Tabs.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/containers/table/Table.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/index.js +2 -1
- package/dist/es/schema.js +4 -0
- package/dist/es/style.css +4 -1
- package/dist/style.css +4 -1
- package/dist/tmagic-form.umd.cjs +311 -113
- package/package.json +4 -4
- package/src/Form.vue +139 -23
- package/src/containers/Container.vue +174 -52
- package/src/containers/GroupList.vue +1 -1
- package/src/containers/GroupListItem.vue +4 -3
- package/src/containers/Tabs.vue +10 -2
- package/src/containers/table/Table.vue +9 -3
- package/src/schema.ts +47 -0
- package/src/theme/container.scss +4 -1
- package/types/index.d.ts +932 -418
package/src/schema.ts
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
|
+
import type { InjectionKey } from 'vue';
|
|
2
|
+
|
|
3
|
+
import type { FormItemConfig } from '@tmagic/form-schema';
|
|
4
|
+
|
|
1
5
|
export * from '@tmagic/form-schema';
|
|
2
6
|
|
|
7
|
+
/**
|
|
8
|
+
* 对比模式相关配置,由 `MForm` 通过 `provide` 注入,
|
|
9
|
+
* 所有层级的 Container(含嵌套在 fieldset / panel 等容器组件内部的 Container)通过 `inject` 获取,
|
|
10
|
+
* 无需逐层透传 prop。
|
|
11
|
+
*/
|
|
12
|
+
export interface FormDiffConfig {
|
|
13
|
+
/**
|
|
14
|
+
* 自定义"是否展示对比内容"的判断函数(仅在对比模式下生效)。
|
|
15
|
+
*
|
|
16
|
+
* - 不传:使用默认逻辑 `!isEqual(curValue, lastValue)`;
|
|
17
|
+
* - 传函数:完全以函数返回值为准,返回 `true` 才展示前后两份对比内容。
|
|
18
|
+
*/
|
|
19
|
+
showDiff?: (_data: { curValue: any; lastValue: any; config: FormItemConfig }) => boolean;
|
|
20
|
+
/**
|
|
21
|
+
* 自定义「自接管对比」的字段类型(仅在对比模式下生效)。
|
|
22
|
+
*
|
|
23
|
+
* - 传数组:在内置类型基础上「追加」这些类型;
|
|
24
|
+
* - 传函数:入参为内置类型数组,返回值作为「最终」完整类型列表(可完全替换内置项)。
|
|
25
|
+
*/
|
|
26
|
+
selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const FORM_DIFF_CONFIG_KEY: InjectionKey<FormDiffConfig> = Symbol('mFormDiffConfig');
|
|
30
|
+
|
|
3
31
|
export interface ValidateError {
|
|
4
32
|
message: string;
|
|
5
33
|
field: string;
|
|
@@ -14,3 +42,22 @@ export interface ContainerChangeEventData {
|
|
|
14
42
|
modifyKey?: string;
|
|
15
43
|
changeRecords?: ChangeRecord[];
|
|
16
44
|
}
|
|
45
|
+
|
|
46
|
+
/** 自定义 label slot 的作用域参数 */
|
|
47
|
+
export interface FormLabelSlotProps {
|
|
48
|
+
/** 当前表单项配置 */
|
|
49
|
+
config: FormItemConfig;
|
|
50
|
+
/** 经处理后的类型 */
|
|
51
|
+
type: string;
|
|
52
|
+
/** 经 filterFunction 处理后的 label 文案 */
|
|
53
|
+
text?: string;
|
|
54
|
+
/** 完整字段路径(包含父级前缀) */
|
|
55
|
+
prop: string;
|
|
56
|
+
/** 经 filterFunction 处理后的最终禁用状态 */
|
|
57
|
+
disabled?: boolean;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Form / Container 暴露的具名 slot 定义 */
|
|
61
|
+
export interface FormSlots {
|
|
62
|
+
label(_props: FormLabelSlotProps): any;
|
|
63
|
+
}
|