form-driver 0.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/LICENSE +21 -0
- package/README.md +37 -0
- package/dist/m3.css +310 -0
- package/dist/m3.js +1 -0
- package/es/m3.css +310 -0
- package/es/m3.js +20919 -0
- package/lib/m3.css +310 -0
- package/lib/m3.js +20959 -0
- package/package.json +132 -0
- package/src/.DS_Store +0 -0
- package/src/framework/Ajax.ts +96 -0
- package/src/framework/Assembly.tsx +165 -0
- package/src/framework/Init.tsx +196 -0
- package/src/framework/M3.tsx +94 -0
- package/src/framework/MContext.ts +15 -0
- package/src/framework/MFieldViewer.tsx +32 -0
- package/src/framework/MUtil.tsx +653 -0
- package/src/framework/MViewer.less +128 -0
- package/src/framework/MViewer.tsx +180 -0
- package/src/framework/MViewerDebug.tsx +95 -0
- package/src/framework/Persistant.ts +90 -0
- package/src/framework/Schema.ts +386 -0
- package/src/framework/SchemaFunc.ts +30 -0
- package/src/framework/Validator.ts +160 -0
- package/src/framework/editorMap.ts +109 -0
- package/src/index.ts +33 -0
- package/src/types/MArrayType.ts +73 -0
- package/src/types/MCascadeType.ts +35 -0
- package/src/types/MCnAddressType.ts +54 -0
- package/src/types/MDateRangeType.ts +52 -0
- package/src/types/MDateTimeType.ts +53 -0
- package/src/types/MDecorationType.ts +6 -0
- package/src/types/MEnumType.ts +65 -0
- package/src/types/MExperienceType.ts +81 -0
- package/src/types/MFloatType.ts +10 -0
- package/src/types/MGB2260Type.ts +56 -0
- package/src/types/MIntDiffType.ts +6 -0
- package/src/types/MIntType.ts +44 -0
- package/src/types/MKvSetType.ts +50 -0
- package/src/types/MMatrixType.ts +52 -0
- package/src/types/MObjectType.ts +89 -0
- package/src/types/MSetType.ts +220 -0
- package/src/types/MStringType.ts +27 -0
- package/src/types/MTelType.ts +14 -0
- package/src/types/MType.ts +77 -0
- package/src/types/MVLPairType.ts +35 -0
- package/src/types/gb2260.json +1 -0
- package/src/ui/BaseViewer.tsx +110 -0
- package/src/ui/editor/.DS_Store +0 -0
- package/src/ui/editor/basic/.DS_Store +0 -0
- package/src/ui/editor/basic/ACascadePicker.tsx +114 -0
- package/src/ui/editor/basic/ACheckBox.tsx +104 -0
- package/src/ui/editor/basic/ADatetimePicker.tsx +76 -0
- package/src/ui/editor/basic/AGB2260.tsx +52 -0
- package/src/ui/editor/basic/AInputBox.tsx +59 -0
- package/src/ui/editor/basic/AIntBox.tsx +39 -0
- package/src/ui/editor/basic/AKvSet.less +9 -0
- package/src/ui/editor/basic/AKvSet.tsx +90 -0
- package/src/ui/editor/basic/ARadio.tsx +86 -0
- package/src/ui/editor/basic/ARangePicker.tsx +129 -0
- package/src/ui/editor/basic/ARate.less +8 -0
- package/src/ui/editor/basic/ARate.tsx +37 -0
- package/src/ui/editor/basic/ARemoteSelector.tsx +116 -0
- package/src/ui/editor/basic/ASelector.tsx +88 -0
- package/src/ui/editor/basic/ASetSelector.tsx +65 -0
- package/src/ui/editor/basic/ASpecInputBox.tsx +20 -0
- package/src/ui/editor/basic/ATreeSelect.tsx +41 -0
- package/src/ui/editor/basic/AUpload.tsx +119 -0
- package/src/ui/editor/basic/NPS.less +21 -0
- package/src/ui/editor/basic/NPS.tsx +47 -0
- package/src/ui/editor/complex/AArray.less +10 -0
- package/src/ui/editor/complex/AArray.tsx +104 -0
- package/src/ui/editor/complex/AArrayGrid.tsx +115 -0
- package/src/ui/editor/complex/ACnAddress.less +15 -0
- package/src/ui/editor/complex/ACnAddress.tsx +61 -0
- package/src/ui/editor/complex/ADialogForm.tsx +45 -0
- package/src/ui/editor/complex/AExperience.tsx +85 -0
- package/src/ui/editor/complex/AForm.less +35 -0
- package/src/ui/editor/complex/AForm.tsx +340 -0
- package/src/ui/editor/complex/AIntDiff.tsx +77 -0
- package/src/ui/editor/complex/AMatrix.less +18 -0
- package/src/ui/editor/complex/AMatrix.tsx +242 -0
- package/src/ui/editor/complex/ATable.less +4 -0
- package/src/ui/editor/complex/ATable.tsx +33 -0
- package/src/ui/editor/complex/JsonEditor.tsx +37 -0
- package/src/ui/readable/A.tsx +33 -0
- package/src/ui/readable/ArrayViewer.tsx +46 -0
- package/src/ui/readable/DecorationViewer.tsx +76 -0
- package/src/ui/readable/DivViewer.tsx +11 -0
- package/src/ui/widget/Collapsible.tsx +156 -0
- package/src/ui/widget/Segment.less +39 -0
- package/src/ui/widget/Segment.tsx +40 -0
- package/src/ui/widget/SegmentEditSwitch.tsx +46 -0
- package/src/ui/widget/SelectBox.tsx +43 -0
- package/src/ui/widget/UnderlineInputBox.less +47 -0
- package/src/ui/widget/UnderlineInputBox.tsx +10 -0
- package/types/framework/Ajax.d.ts +5 -0
- package/types/framework/Assembly.d.ts +59 -0
- package/types/framework/Init.d.ts +4 -0
- package/types/framework/M3.d.ts +6 -0
- package/types/framework/MContext.d.ts +11 -0
- package/types/framework/MFieldViewer.d.ts +8 -0
- package/types/framework/MUtil.d.ts +180 -0
- package/types/framework/MViewer.d.ts +75 -0
- package/types/framework/MViewerDebug.d.ts +11 -0
- package/types/framework/Persistant.d.ts +17 -0
- package/types/framework/Schema.d.ts +306 -0
- package/types/framework/SchemaFunc.d.ts +14 -0
- package/types/framework/Validator.d.ts +53 -0
- package/types/framework/editorMap.d.ts +107 -0
- package/types/index.d.ts +21 -0
- package/types/types/MArrayType.d.ts +2 -0
- package/types/types/MCascadeType.d.ts +11 -0
- package/types/types/MCnAddressType.d.ts +2 -0
- package/types/types/MDateRangeType.d.ts +7 -0
- package/types/types/MDateTimeType.d.ts +11 -0
- package/types/types/MDecorationType.d.ts +7 -0
- package/types/types/MEnumType.d.ts +2 -0
- package/types/types/MExperienceType.d.ts +5 -0
- package/types/types/MFloatType.d.ts +2 -0
- package/types/types/MGB2260Type.d.ts +9 -0
- package/types/types/MIntDiffType.d.ts +2 -0
- package/types/types/MIntType.d.ts +2 -0
- package/types/types/MKvSetType.d.ts +11 -0
- package/types/types/MMatrixType.d.ts +5 -0
- package/types/types/MObjectType.d.ts +11 -0
- package/types/types/MSetType.d.ts +7 -0
- package/types/types/MStringType.d.ts +2 -0
- package/types/types/MTelType.d.ts +4 -0
- package/types/types/MType.d.ts +46 -0
- package/types/types/MVLPairType.d.ts +5 -0
- package/types/ui/BaseViewer.d.ts +45 -0
- package/types/ui/editor/basic/ACascadePicker.d.ts +11 -0
- package/types/ui/editor/basic/ACheckBox.d.ts +17 -0
- package/types/ui/editor/basic/ADatetimePicker.d.ts +15 -0
- package/types/ui/editor/basic/AGB2260.d.ts +10 -0
- package/types/ui/editor/basic/AInputBox.d.ts +8 -0
- package/types/ui/editor/basic/AIntBox.d.ts +9 -0
- package/types/ui/editor/basic/AKvSet.d.ts +19 -0
- package/types/ui/editor/basic/ARadio.d.ts +14 -0
- package/types/ui/editor/basic/ARangePicker.d.ts +30 -0
- package/types/ui/editor/basic/ARate.d.ts +13 -0
- package/types/ui/editor/basic/ARemoteSelector.d.ts +15 -0
- package/types/ui/editor/basic/ASelector.d.ts +14 -0
- package/types/ui/editor/basic/ASetSelector.d.ts +10 -0
- package/types/ui/editor/basic/ASpecInputBox.d.ts +9 -0
- package/types/ui/editor/basic/ATreeSelect.d.ts +18 -0
- package/types/ui/editor/basic/AUpload.d.ts +33 -0
- package/types/ui/editor/basic/NPS.d.ts +13 -0
- package/types/ui/editor/complex/AArray.d.ts +11 -0
- package/types/ui/editor/complex/AArrayGrid.d.ts +13 -0
- package/types/ui/editor/complex/ACnAddress.d.ts +10 -0
- package/types/ui/editor/complex/ADialogForm.d.ts +11 -0
- package/types/ui/editor/complex/AExperience.d.ts +16 -0
- package/types/ui/editor/complex/AForm.d.ts +46 -0
- package/types/ui/editor/complex/AIntDiff.d.ts +14 -0
- package/types/ui/editor/complex/AMatrix.d.ts +48 -0
- package/types/ui/editor/complex/ATable.d.ts +9 -0
- package/types/ui/editor/complex/JsonEditor.d.ts +9 -0
- package/types/ui/readable/A.d.ts +5 -0
- package/types/ui/readable/ArrayViewer.d.ts +5 -0
- package/types/ui/readable/DecorationViewer.d.ts +3 -0
- package/types/ui/readable/DivViewer.d.ts +5 -0
- package/types/ui/widget/Collapsible.d.ts +46 -0
- package/types/ui/widget/Segment.d.ts +18 -0
- package/types/ui/widget/SegmentEditSwitch.d.ts +20 -0
- package/types/ui/widget/SelectBox.d.ts +13 -0
- package/types/ui/widget/UnderlineInputBox.d.ts +6 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ClassType } from "react";
|
|
2
|
+
import { MFieldSchemaAnonymity, MProp, MValidationFail } from './Schema';
|
|
3
|
+
import { MType, PluginType } from "../types/MType";
|
|
4
|
+
export declare type MORPH = "readable" | "editor";
|
|
5
|
+
export declare type VIEWER = ClassType<MProp, any, any>;
|
|
6
|
+
/** 统一的视觉样式 */
|
|
7
|
+
export interface MTheme {
|
|
8
|
+
/** 数据未知时展示 */
|
|
9
|
+
readonly READABLE_UNKNOWN: string;
|
|
10
|
+
/** 数据为空的时候展示 */
|
|
11
|
+
readonly READABLE_BLANK: string;
|
|
12
|
+
/** 数据有问题时展示 */
|
|
13
|
+
readonly READABLE_INVALID: string;
|
|
14
|
+
/** 代码有问题时展示 */
|
|
15
|
+
readonly READABLE_ERROR: string;
|
|
16
|
+
/** @deprecated theme的名字 */
|
|
17
|
+
readonly themeName: "antMiddle" | string;
|
|
18
|
+
}
|
|
19
|
+
export interface EDITOR {
|
|
20
|
+
editor: string;
|
|
21
|
+
type: string;
|
|
22
|
+
readable: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 注册viewer,type,morph(viewer和type之间的关联)
|
|
26
|
+
*/
|
|
27
|
+
export declare class Assembly {
|
|
28
|
+
types: {
|
|
29
|
+
[name: string]: MType;
|
|
30
|
+
};
|
|
31
|
+
viewers: {
|
|
32
|
+
[name: string]: VIEWER;
|
|
33
|
+
};
|
|
34
|
+
editors: {
|
|
35
|
+
[name: string]: EDITOR;
|
|
36
|
+
};
|
|
37
|
+
morph: {
|
|
38
|
+
[name: string]: {
|
|
39
|
+
[typeName: string]: string | ClassType<MProp, any, any>;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
theme: MTheme;
|
|
43
|
+
toReadable: (s: MFieldSchemaAnonymity, v: any, parent: any) => string;
|
|
44
|
+
/** 根据定义返回View,返回nil表示没有可用的View */
|
|
45
|
+
getViewerOf(f: MFieldSchemaAnonymity, morph: MORPH): ClassType<any, any, any>;
|
|
46
|
+
validate(s: MFieldSchemaAnonymity, v: any, path?: string): MValidationFail | undefined;
|
|
47
|
+
addViewer(name: string, v: VIEWER): void;
|
|
48
|
+
addEditor(name: string, v: EDITOR): void;
|
|
49
|
+
/**
|
|
50
|
+
* 增加一种数据类型
|
|
51
|
+
* 例:
|
|
52
|
+
* const hpOrg = {name: "hpOrg", type: {validators: ..., toReadable: ...}, editor: HPOrgEditor, readable: "DivViewer"}
|
|
53
|
+
* addType(hpOrg)
|
|
54
|
+
* @param typeParam 类型的描述对象
|
|
55
|
+
*/
|
|
56
|
+
addType(typeParam: PluginType): void;
|
|
57
|
+
constructor();
|
|
58
|
+
}
|
|
59
|
+
export declare const assembly: Assembly;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MViewerProp } from './MViewer';
|
|
3
|
+
export interface MContextDef {
|
|
4
|
+
/** 根配置 */
|
|
5
|
+
rootProps: MViewerProp;
|
|
6
|
+
/** 表单是否是强制校验状态 */
|
|
7
|
+
forceValid: boolean;
|
|
8
|
+
/** 将表单设置为强制校验*/
|
|
9
|
+
setForceValid: (b: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const MContext: React.Context<MContextDef>;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import moment from "moment";
|
|
3
|
+
import { M3UISpec, MEnumField, MFieldSchema, MFieldSchemaAnonymity, MValidationFail } from './Schema';
|
|
4
|
+
import { JSONSchema6 } from 'json-schema';
|
|
5
|
+
export declare type HideMap = {
|
|
6
|
+
[fieldName: string]: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare let MUtil: {
|
|
9
|
+
/**
|
|
10
|
+
* 每次调用,返回不一样的数字
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
unique(): number;
|
|
14
|
+
/**
|
|
15
|
+
* 枚举字段可以写成空格分隔的字符串,也能写成MEnumField[],这个函数将两种形式转换成统一的MEnumField[]
|
|
16
|
+
* @deprecated 改成用MUtils.option
|
|
17
|
+
*/
|
|
18
|
+
standardFields: (fs: string | MEnumField[] | undefined) => MEnumField[];
|
|
19
|
+
/**
|
|
20
|
+
* 获取enumFields或者setFields,返回标准的MEnumField[]
|
|
21
|
+
* @param f 如果f是nil,返回[]
|
|
22
|
+
*/
|
|
23
|
+
option: (f: MFieldSchemaAnonymity) => MEnumField[];
|
|
24
|
+
/** 如果出错了,返回这么个元素,可能用在BaseEditor子类或者其他的东西上 */
|
|
25
|
+
error: (msg: string, schema?: MFieldSchema | MFieldSchemaAnonymity) => JSX.Element;
|
|
26
|
+
sign: (v: number | null | undefined) => number | null;
|
|
27
|
+
/**
|
|
28
|
+
* 当前设备是不是个手机(或者类似手机的设备,比如ipad上运行iphone app中的webview)
|
|
29
|
+
*/
|
|
30
|
+
phoneLike: () => boolean;
|
|
31
|
+
/**
|
|
32
|
+
* 计算文字的宽度
|
|
33
|
+
* @param text
|
|
34
|
+
*/
|
|
35
|
+
antdTextWidth(text?: string): number;
|
|
36
|
+
/**
|
|
37
|
+
* 从数组中删掉一个元素
|
|
38
|
+
* @param a 这个数组会被改变的
|
|
39
|
+
* @param element 要删的元素
|
|
40
|
+
* @returns 修改后的数组(如果它不是nil)
|
|
41
|
+
*/
|
|
42
|
+
arrayRemove: (a: any[] | null | undefined, element: any) => any[];
|
|
43
|
+
fieldOfLayout: (fields: MFieldSchema[], spec: M3UISpec) => MFieldSchema[];
|
|
44
|
+
/**
|
|
45
|
+
* 跟lodash的get一样,除了:
|
|
46
|
+
* 1. path是nil时返回undefined
|
|
47
|
+
* 2. path是""时返回原始对象
|
|
48
|
+
* @param a
|
|
49
|
+
* @param path
|
|
50
|
+
*/
|
|
51
|
+
get: (a?: any | null, path?: string | null) => any;
|
|
52
|
+
/**
|
|
53
|
+
* a : database
|
|
54
|
+
* v : newValue
|
|
55
|
+
* 跟lodash的set一样,除了path是""时等效于_.assign(a, v)
|
|
56
|
+
*/
|
|
57
|
+
set: (a: any | null, path: string | null, v: any) => void;
|
|
58
|
+
debug: (d: any, ...optionalParams: any[]) => void;
|
|
59
|
+
/**
|
|
60
|
+
* 填入默认值
|
|
61
|
+
* @param schema 你懂得
|
|
62
|
+
* @param database 数据库,会被修改的
|
|
63
|
+
* @param path 路径
|
|
64
|
+
*/
|
|
65
|
+
applyDefaultValue: (schema: MFieldSchema, database: any, path: string) => void;
|
|
66
|
+
filterHide: (schema: MFieldSchema, database: any[] | object) => any;
|
|
67
|
+
/**
|
|
68
|
+
* 计算哪些field、segment需要隐藏
|
|
69
|
+
* 支持ShowIfFunc里的函数
|
|
70
|
+
* TODO 如果segment隐藏,里面的字段全都要隐藏
|
|
71
|
+
* @returns 示例:
|
|
72
|
+
* let {name,role,gender,alias,birthday,company,position,tel,email,citizenship,politicsCode,companyArch,address,work,edu,assistant,student,mib} = data;
|
|
73
|
+
* return {politicsCode: !(citizenship=='中国大陆'),"segment:学员信息": !(_.intersection(role, ['校友']).length > 0))}
|
|
74
|
+
* @param objectFields
|
|
75
|
+
* @param uispec 用来计算segment是不是要展示,不填就不计算
|
|
76
|
+
*/
|
|
77
|
+
hideMap: (database: any, objectFields: MFieldSchema[], uispec?: M3UISpec) => HideMap;
|
|
78
|
+
/**
|
|
79
|
+
* 计算 showIf 的值
|
|
80
|
+
* @returns Boolean
|
|
81
|
+
* @param database
|
|
82
|
+
* @param objectFields
|
|
83
|
+
*/
|
|
84
|
+
isShow: (database: any, objectFields: MFieldSchema[], showIfExpr: string) => any;
|
|
85
|
+
scoreOf: (f: MFieldSchema, database: any) => number;
|
|
86
|
+
/**
|
|
87
|
+
* 查找fs依赖(通过showIf)的所有字段
|
|
88
|
+
* @param fs
|
|
89
|
+
* @param all
|
|
90
|
+
* @returns fs依赖的所有字段,包含fs。这个数组中下标小的元素,依赖下标大的元素
|
|
91
|
+
*/
|
|
92
|
+
dependency: (fs: MFieldSchema[], all: MFieldSchema[]) => any[];
|
|
93
|
+
/**
|
|
94
|
+
* 用moment格式化
|
|
95
|
+
* @param s 原始数据,参见moment
|
|
96
|
+
* @param srcFormat 原始数据的格式,默认x(时间戳)
|
|
97
|
+
* @param dstFormat 转换成的数据格式,默认YYYY年MM月DD日
|
|
98
|
+
* @param fallback 如果原始数据是nil,返回fallback
|
|
99
|
+
*/
|
|
100
|
+
momentFormat: (s: moment.MomentInput, srcFormat?: string, dstFormat?: string, fallback?: string) => string;
|
|
101
|
+
/**
|
|
102
|
+
* 将标准的json schema转换成m3的schema
|
|
103
|
+
* @param e json schema
|
|
104
|
+
* @param base 如果填了一个对象,转换出的属性会放在这个对象上
|
|
105
|
+
* @param template 如果有子结构,创建子结构的模板
|
|
106
|
+
*/
|
|
107
|
+
jsonSchema2MFieldSchema: (e: JSONSchema6, base?: MFieldSchema, template?: Partial<MFieldSchema>) => MFieldSchema;
|
|
108
|
+
/**
|
|
109
|
+
* 修改一个对象里的key
|
|
110
|
+
* @param object 要修改的对象,
|
|
111
|
+
* @param renameTo
|
|
112
|
+
* @param removeNotExistKey 是否在结果里面去除renameTo里不存在的key
|
|
113
|
+
* @returns 返回一个改过key名字的新对象
|
|
114
|
+
*/
|
|
115
|
+
renameKey: (object: any, renameTo: {
|
|
116
|
+
[oldKey: string]: string;
|
|
117
|
+
}, removeNotExistKey?: boolean) => any;
|
|
118
|
+
/** 啥也不干的空回调 */
|
|
119
|
+
doNothing: () => void;
|
|
120
|
+
/**
|
|
121
|
+
* 去掉arr中的undefined和null,拼出来一个json path
|
|
122
|
+
*/
|
|
123
|
+
jsonPath: (...arr: any[]) => string;
|
|
124
|
+
/**
|
|
125
|
+
* 获取一个json path的父path。
|
|
126
|
+
* @param path 如果path是空的返回也是空的
|
|
127
|
+
*/
|
|
128
|
+
parentPath: (path: string) => string;
|
|
129
|
+
/**
|
|
130
|
+
* 校验一个schema
|
|
131
|
+
* @param s 要校验的schema
|
|
132
|
+
* @returns 空数组表示校验通过,否则返回校验错误信息
|
|
133
|
+
*/
|
|
134
|
+
validateSchema: (s: MFieldSchema, parentPath?: string) => MValidationFail[];
|
|
135
|
+
/**
|
|
136
|
+
* 参考https://stackoverflow.com/questions/3362471/how-can-i-call-a-javascript-constructor-using-call-or-apply
|
|
137
|
+
* 示例: var d = applyToConstructor(Date, [2008, 10, 8, 00, 16, 34, 254]);
|
|
138
|
+
* @param constructor
|
|
139
|
+
* @param argArray
|
|
140
|
+
*/
|
|
141
|
+
applyToConstructor: (constructor: any, argArray: any) => any;
|
|
142
|
+
/**
|
|
143
|
+
* 执行表达式或者回调函数
|
|
144
|
+
* @param exprOrFunction 表达式或者回调函数
|
|
145
|
+
* @param paramName 参数名字
|
|
146
|
+
* @param paramValue 参数值
|
|
147
|
+
* @param fallback 如果exprOrFunction无效,返回fallback
|
|
148
|
+
* @param _this this指针
|
|
149
|
+
*/
|
|
150
|
+
evalExprOrFunction: (exprOrFunction: any, paramName: string[], paramValue: any[], fallback?: any, _this?: any) => any;
|
|
151
|
+
/**
|
|
152
|
+
* 读取url参数,转换成map
|
|
153
|
+
* @param hashPrefix nil表示不读取hash里的参数,字符串表示读取hash里的参数,并加上这个前缀返回。默认是返回,但前缀是空字符串
|
|
154
|
+
*/
|
|
155
|
+
getQuery: (hashPrefix?: string) => any;
|
|
156
|
+
/**
|
|
157
|
+
* 动态创建一个CSS样式
|
|
158
|
+
* @param css css内容,会被写进style标签里
|
|
159
|
+
* @param id <style>的id,可以没有。如果已经存在,会被覆盖掉。
|
|
160
|
+
*/
|
|
161
|
+
setCss: (css: string, id?: string) => void;
|
|
162
|
+
/**
|
|
163
|
+
* escape数值
|
|
164
|
+
* @param str - 字符串
|
|
165
|
+
* @returns 会带上引号,类似"abc",str=nil时会返回""
|
|
166
|
+
*/
|
|
167
|
+
escapeCsv: (str?: string) => string;
|
|
168
|
+
/**
|
|
169
|
+
* 判断两个值是否相同
|
|
170
|
+
* @param v1 一个值
|
|
171
|
+
* @param v2 另一个值
|
|
172
|
+
* @param tolerate true用==判断,false用===判断
|
|
173
|
+
*/
|
|
174
|
+
isEquals: (v1: any, v2: any, tolerate: boolean) => boolean;
|
|
175
|
+
};
|
|
176
|
+
/** 压缩数组,如果只有一个元素时,它是数据本身,多于一个元素时才是数组 */
|
|
177
|
+
export declare type CompactArrayType<T> = T | T[];
|
|
178
|
+
export declare let CompactArray: {
|
|
179
|
+
indexOf: <T>(ca?: CompactArrayType<T>, d?: T) => -1 | number;
|
|
180
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AFTER_CHANGE_CALLBACK, MFieldSchema, M3UISpec } from "../framework/Schema";
|
|
3
|
+
import "./MViewer.less";
|
|
4
|
+
import { MORPH } from './Assembly';
|
|
5
|
+
import { PersistantConf } from "./Persistant";
|
|
6
|
+
export interface MViewerProp {
|
|
7
|
+
schema: MFieldSchema;
|
|
8
|
+
database: any;
|
|
9
|
+
layout?: M3UISpec;
|
|
10
|
+
style?: React.CSSProperties;
|
|
11
|
+
morph: MORPH;
|
|
12
|
+
onSubmit?: (finalData: any) => Promise<any>;
|
|
13
|
+
afterChange?: AFTER_CHANGE_CALLBACK;
|
|
14
|
+
wrapper?: (elem: React.ReactElement, schema: Partial<MFieldSchema>) => React.ReactElement;
|
|
15
|
+
formItemWrapper?: (elem: React.ReactElement, schema: Partial<MFieldSchema>) => React.ReactElement;
|
|
16
|
+
/** 持久存储选项,nil表示不持久存储 */
|
|
17
|
+
persistant?: PersistantConf;
|
|
18
|
+
}
|
|
19
|
+
export interface M3Prop {
|
|
20
|
+
schema: MFieldSchema | MFieldSchema[];
|
|
21
|
+
database: any;
|
|
22
|
+
layout?: M3UISpec;
|
|
23
|
+
style?: React.CSSProperties;
|
|
24
|
+
morph: MORPH;
|
|
25
|
+
onSubmit?: (finalData: any) => Promise<any>;
|
|
26
|
+
afterChange?: AFTER_CHANGE_CALLBACK;
|
|
27
|
+
wrapper?: (elem: React.ReactElement, schema: Partial<MFieldSchema>) => React.ReactElement;
|
|
28
|
+
formItemWrapper?: (elem: React.ReactElement, schema: Partial<MFieldSchema>) => React.ReactElement;
|
|
29
|
+
/** 持久存储选项,nil表示不持久存储 */
|
|
30
|
+
persistant?: PersistantConf;
|
|
31
|
+
}
|
|
32
|
+
interface State {
|
|
33
|
+
forceValid: boolean;
|
|
34
|
+
ctrlVersion: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 一个完整的表单
|
|
38
|
+
*/
|
|
39
|
+
export declare class MViewer extends React.Component<MViewerProp, State> {
|
|
40
|
+
database: any;
|
|
41
|
+
constructor(p: MViewerProp);
|
|
42
|
+
recover(): void;
|
|
43
|
+
render(): JSX.Element;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 提交按钮
|
|
47
|
+
示例1,使用默认的提交样式:
|
|
48
|
+
<MViewer schema={schema} database={database} morph="editor">
|
|
49
|
+
<SubmitBar onSubmit={(d:any) => ...返回一个Promise} />
|
|
50
|
+
</MViewer>
|
|
51
|
+
|
|
52
|
+
示例2,自定义样式:
|
|
53
|
+
<MViewer schema={schema} database={database} morph="editor">
|
|
54
|
+
<SubmitBar onSubmit={(d:any) => ...返回一个Promise} >
|
|
55
|
+
<Button>提交</Button>
|
|
56
|
+
</SubmitBar>
|
|
57
|
+
</MViewer>
|
|
58
|
+
|
|
59
|
+
示例3,提交完成前,禁用提交按钮:
|
|
60
|
+
<MViewer schema={schema} database={database} morph="editor">
|
|
61
|
+
<SubmitBar onSubmit={(d:any) => ...返回一个Promise} >
|
|
62
|
+
{
|
|
63
|
+
loading => <Button loading={loading}>提交</Button>
|
|
64
|
+
}
|
|
65
|
+
</SubmitBar>
|
|
66
|
+
</MViewer>
|
|
67
|
+
* @param props
|
|
68
|
+
*/
|
|
69
|
+
export declare function SubmitBar(props: {
|
|
70
|
+
style?: React.CSSProperties;
|
|
71
|
+
onSubmit?: (finalData: any) => Promise<any>;
|
|
72
|
+
children?: React.ReactNode | ((loading: boolean) => React.ReactNode);
|
|
73
|
+
}): JSX.Element;
|
|
74
|
+
export declare function useM3Database(initValue: any): [any, React.Dispatch<any>];
|
|
75
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MViewerProp } from './MViewer';
|
|
3
|
+
/**
|
|
4
|
+
* 调试和理解MViewer,使用时除了多一个debug props,完全和MViewer一样
|
|
5
|
+
* debug=true时,通过tab同时展示viewer及其database和schema
|
|
6
|
+
* debug=false时,仅展示viewer
|
|
7
|
+
* @param props 用来调试viewer
|
|
8
|
+
*/
|
|
9
|
+
export declare function MViewerDebug(props: React.PropsWithChildren<MViewerProp & {
|
|
10
|
+
debug?: boolean;
|
|
11
|
+
}>): JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AFTER_CHANGE_CALLBACK } from "./Schema";
|
|
2
|
+
/**
|
|
3
|
+
* MViewer的配置
|
|
4
|
+
*/
|
|
5
|
+
export interface PersistantConf {
|
|
6
|
+
/** 持久存储的localStorageKey前缀 */
|
|
7
|
+
localStorageKeyPrefix: string;
|
|
8
|
+
/** 是否询问恢复至缓存 */
|
|
9
|
+
useConfirm?: Boolean;
|
|
10
|
+
/** 如何合并database和persistant数据,默认是local覆盖database */
|
|
11
|
+
override?: (database: any, local: any) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const PersistantTool: {
|
|
14
|
+
load: (database: any, persistant?: PersistantConf, updateViewer?: any) => void;
|
|
15
|
+
patchAfterChange: (afterChange: AFTER_CHANGE_CALLBACK, persistant?: PersistantConf) => AFTER_CHANGE_CALLBACK;
|
|
16
|
+
clear: (persistant?: PersistantConf) => void;
|
|
17
|
+
};
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MORPH, VIEWER, Assembly } from './Assembly';
|
|
3
|
+
export declare type ValueConst = string | boolean | number;
|
|
4
|
+
export interface MEnumField {
|
|
5
|
+
/** 选项文案 */
|
|
6
|
+
label?: string;
|
|
7
|
+
/** 选项html */
|
|
8
|
+
html?: string;
|
|
9
|
+
/** 选项的showIf */
|
|
10
|
+
showIf?: boolean;
|
|
11
|
+
/** 选项html */
|
|
12
|
+
value: ValueConst;
|
|
13
|
+
exclusive?: string;
|
|
14
|
+
score?: number;
|
|
15
|
+
children?: MEnumField[];
|
|
16
|
+
}
|
|
17
|
+
/** 匿名的MFieldSchema,没有name字段 */
|
|
18
|
+
export declare type MFieldSchemaAnonymity = Omit<MFieldSchema, "name">;
|
|
19
|
+
/** JS表达式 */
|
|
20
|
+
export declare type JSEXPR = string;
|
|
21
|
+
/** 如何适配屏幕 */
|
|
22
|
+
export declare type SCREEN_ADAPTION =
|
|
23
|
+
/** 强制使用适应大屏的控件 */
|
|
24
|
+
"big" |
|
|
25
|
+
/** 强制使用适应小屏的控件 */
|
|
26
|
+
"phone";
|
|
27
|
+
/** M3 单元的 schema */
|
|
28
|
+
export interface MFieldSchema {
|
|
29
|
+
type?: string;
|
|
30
|
+
name: string;
|
|
31
|
+
label?: string;
|
|
32
|
+
/** 编辑器,editor:<viewer名字> 是 viewerFor: {morph:"editor", name:<viewer名字>} 的简写 */
|
|
33
|
+
editor?: string | VIEWER;
|
|
34
|
+
/** 查看器,readable:<viewer名字> 是 viewerFor: {morph:"readable", name:<viewer名字>} 的简写 */
|
|
35
|
+
readable?: string | VIEWER;
|
|
36
|
+
/** 选项 */
|
|
37
|
+
option?: MEnumField[] | string;
|
|
38
|
+
/** @deprecated 旧版本字段,新版本用 options */
|
|
39
|
+
enumFields?: string | MEnumField[];
|
|
40
|
+
/** @deprecated 旧版本字段,新版本用 options */
|
|
41
|
+
setFields?: string | MEnumField[];
|
|
42
|
+
/** 如果选项是不完全的,要设置这个值,允许用户自己输入 */
|
|
43
|
+
openOption?: MFieldSchemaAnonymity;
|
|
44
|
+
/** @deprecated 旧版本字段,新版本用 openOption */
|
|
45
|
+
enumOpen?: MFieldSchemaAnonymity;
|
|
46
|
+
/** @deprecated 旧版本字段,新版本用 openOption */
|
|
47
|
+
setOpen?: MFieldSchemaAnonymity;
|
|
48
|
+
/**
|
|
49
|
+
* 默认值
|
|
50
|
+
* object上设置defaultValue后,其字段的defaultValue就无效了
|
|
51
|
+
*/
|
|
52
|
+
defaultValue?: ValueConst;
|
|
53
|
+
/**
|
|
54
|
+
* 表单控件的属性(对应 antd 组件的 api)
|
|
55
|
+
*/
|
|
56
|
+
props?: any;
|
|
57
|
+
/** 最多输入多少行,默认1,表示单行字符串 */
|
|
58
|
+
stringLines?: number;
|
|
59
|
+
/** 最小值/最小长度/至少选几项 (include) */
|
|
60
|
+
min?: number;
|
|
61
|
+
/** 最大值/最大长度/最多选几项 (include) */
|
|
62
|
+
max?: number;
|
|
63
|
+
/** 是否是必选项 */
|
|
64
|
+
required?: boolean;
|
|
65
|
+
/** 当表达式成立时认为表单中有这个字段,不成立时字段不展示,也不会输出数据 */
|
|
66
|
+
showIf?: JSEXPR;
|
|
67
|
+
/** 分栏数 */
|
|
68
|
+
column?: number;
|
|
69
|
+
/** 展示前格式化值。
|
|
70
|
+
* string=js模板字符串,可用变量包括:
|
|
71
|
+
* value是数据值
|
|
72
|
+
* _ 是lodash
|
|
73
|
+
* readable是原来默认的toReadable函数转换后的字符串
|
|
74
|
+
* READABLE_UNKNOWN/READABLE_BLANK/READABLE_INVALID/READABLE_ERROR:这些值参考MTheme
|
|
75
|
+
* 函数=就不用解释了,自己可以随意发挥了
|
|
76
|
+
*/
|
|
77
|
+
toReadable?: string | ((v: any, parent: any, assembly: Assembly) => string);
|
|
78
|
+
/**
|
|
79
|
+
* true表示值不是严格匹配
|
|
80
|
+
* 例如枚举的value是number时,传入字符串也可以匹配
|
|
81
|
+
*/
|
|
82
|
+
tolerate?: boolean;
|
|
83
|
+
/** 是否强制使用大屏或者小屏的控件,默认是自动 */
|
|
84
|
+
screenAdaption?: SCREEN_ADAPTION;
|
|
85
|
+
/** 展示时显示的后缀 */
|
|
86
|
+
postfix?: string;
|
|
87
|
+
/** 会展示为一个问号图标,点击弹出提示 */
|
|
88
|
+
popoverDesc?: React.ReactNode;
|
|
89
|
+
/** undefined表示 这个字段不是必填的,否则表示此字段不填时的提示信息*/
|
|
90
|
+
requiredMessage?: string;
|
|
91
|
+
/** 有的字段是多个框,可能需要多个placeholder */
|
|
92
|
+
placeholder?: string | string[];
|
|
93
|
+
objectFields?: MFieldSchema[];
|
|
94
|
+
/** 对象类型中,哪些字段作为标题展示成readable,默认是第一个字段 */
|
|
95
|
+
objectLabelFields?: string[];
|
|
96
|
+
/** 字符串是不是允许全部填空格/t/n,默认不允许 */
|
|
97
|
+
stringAllowSpaceOnly?: boolean;
|
|
98
|
+
/** 矩阵类型的配置 */
|
|
99
|
+
matrix?: {
|
|
100
|
+
/** 矩阵的横轴选项 */
|
|
101
|
+
x: string | MEnumField[];
|
|
102
|
+
/** 矩阵的纵轴选项 */
|
|
103
|
+
y: string | MEnumField[];
|
|
104
|
+
/** 每行最多选几个,默认1 */
|
|
105
|
+
maxX?: number;
|
|
106
|
+
/** 每行最少选几个,默认1 */
|
|
107
|
+
minX?: number;
|
|
108
|
+
/** 每列最多选几个,默认无限多个 */
|
|
109
|
+
maxY?: number;
|
|
110
|
+
/** 每列最少选几个,默认1 */
|
|
111
|
+
minY?: number;
|
|
112
|
+
/** 开放项的配置,开放项是y轴最后一个选项 */
|
|
113
|
+
open?: {
|
|
114
|
+
label: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
/** 数组成员类型 */
|
|
118
|
+
arrayMember?: MFieldSchemaAnonymity;
|
|
119
|
+
/** 数组增加一项的按钮文案 */
|
|
120
|
+
arrayAddLabel?: string;
|
|
121
|
+
/** experience类型配置 */
|
|
122
|
+
experience?: {
|
|
123
|
+
/** 除了起始时间,至今选项外,还要有什么字段 */
|
|
124
|
+
members: MFieldSchema[];
|
|
125
|
+
/** 允许时间段重叠,默认是不能重叠 */
|
|
126
|
+
overlap?: boolean;
|
|
127
|
+
};
|
|
128
|
+
/** dateRange 类型配置 */
|
|
129
|
+
dateRange?: {
|
|
130
|
+
/** 是否隐藏至今按钮 */
|
|
131
|
+
hideTillNow?: boolean;
|
|
132
|
+
/** 是否能选择时间 */
|
|
133
|
+
showTime?: boolean;
|
|
134
|
+
};
|
|
135
|
+
/** 数据格式 */
|
|
136
|
+
dataFormat?: "x" | "YYYYMMDD" | /** 用于时间日期类型字段的数据格式,参考moment,例如x表示数据是时间戳,YYYYMMDD表示数据是形如19990130的字符串 */ string;
|
|
137
|
+
/**
|
|
138
|
+
* 例如:
|
|
139
|
+
* 4.5 与去年同期(2019 年 1 月初-6 月底)相比,您的收入
|
|
140
|
+
* (1)增长了约___万元 (2)下降了约___万元 (3)基本没有变化
|
|
141
|
+
*/
|
|
142
|
+
intDiff?: {
|
|
143
|
+
incLabel: string;
|
|
144
|
+
incLabelPostfix: string;
|
|
145
|
+
decLabel: string;
|
|
146
|
+
decLabelPostfix: string;
|
|
147
|
+
keep: string;
|
|
148
|
+
};
|
|
149
|
+
/** 可以自己写个样式,会作用于antd元素上 */
|
|
150
|
+
css?: any;
|
|
151
|
+
/** 删除这个字段数据时的提示,不写会直接删除,不提示 */
|
|
152
|
+
removeConfirm?: string;
|
|
153
|
+
/**
|
|
154
|
+
* most case size 字段通常有多少个字符(string)/项(array),或者用css写长度
|
|
155
|
+
* 布局器会尽量让小于mcs的值可以不需要滚动就展示出来
|
|
156
|
+
* string/ 最好配上
|
|
157
|
+
* 不完全enum/不完全set,可以配,默认是最长的候选值的字符数
|
|
158
|
+
* 完全enum/完全set,不用配
|
|
159
|
+
*/
|
|
160
|
+
mcs?: number | string;
|
|
161
|
+
/** ui规约 */
|
|
162
|
+
uispec?: M3UISpec;
|
|
163
|
+
/** 用于hpOrg类型*/
|
|
164
|
+
hpOrg?: {
|
|
165
|
+
/** 空格表示根 */
|
|
166
|
+
rootId: string;
|
|
167
|
+
};
|
|
168
|
+
ossFile?: {
|
|
169
|
+
type: "HP_GO" | "HP_SECOBJ";
|
|
170
|
+
/** 预览大小,单位像素 */
|
|
171
|
+
previewSize?: number;
|
|
172
|
+
arguments: {
|
|
173
|
+
genName: boolean;
|
|
174
|
+
ossKeyPath: string;
|
|
175
|
+
permissionPolicyOr: string;
|
|
176
|
+
} | {
|
|
177
|
+
appName: string;
|
|
178
|
+
} | any;
|
|
179
|
+
};
|
|
180
|
+
/** 装饰物的html */
|
|
181
|
+
decoration?: {
|
|
182
|
+
subType?: "rich" | "segmentLabel" | "submitBar" | "operations";
|
|
183
|
+
HTML?: string;
|
|
184
|
+
submitLabel?: string;
|
|
185
|
+
segmentLabel?: string;
|
|
186
|
+
operations?: {
|
|
187
|
+
label: React.ReactNode;
|
|
188
|
+
handler: (data: any) => void;
|
|
189
|
+
}[];
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* 来自远程的数据,用于下拉搜索框.
|
|
193
|
+
* 例如对于如下远程数据
|
|
194
|
+
* {
|
|
195
|
+
"data": {
|
|
196
|
+
"pagination": {
|
|
197
|
+
...
|
|
198
|
+
},
|
|
199
|
+
"list": [
|
|
200
|
+
{ "id": 33219, "name": "张媛", "brief": "掌阅科技股份有限公司" },
|
|
201
|
+
{ "id": 86576, "name": "张步镇", "brief": "广州速道信息科技有限公司" }
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
remote配置示例:
|
|
206
|
+
remote:{
|
|
207
|
+
url: ... ,
|
|
208
|
+
dataPath: "data.list",
|
|
209
|
+
valuePath: "id",
|
|
210
|
+
labelExpr: "name + '(' + brief + ')'"
|
|
211
|
+
}
|
|
212
|
+
*/
|
|
213
|
+
remote?: {
|
|
214
|
+
/** 数据url,可以用${q}引用用户输入的查询关键字 */
|
|
215
|
+
url: string;
|
|
216
|
+
/** url返回的json中,数据list的路径 */
|
|
217
|
+
dataPath: string;
|
|
218
|
+
/** 在dataPath下,值字段路径 */
|
|
219
|
+
valuePath: JSEXPR;
|
|
220
|
+
/** 在dataPath下,标题字段的表达式 */
|
|
221
|
+
labelExpr: JSEXPR;
|
|
222
|
+
};
|
|
223
|
+
a?: {
|
|
224
|
+
urlExpr?: ((value: any, parent: any) => React.ReactNode) | JSEXPR;
|
|
225
|
+
labelExpr?: ((value: any, parent: any) => React.ReactNode) | JSEXPR;
|
|
226
|
+
onClick?: (value: any, parent: any) => void;
|
|
227
|
+
/** 在当前页面打开 */
|
|
228
|
+
currentPage?: boolean;
|
|
229
|
+
};
|
|
230
|
+
/** 元素的style */
|
|
231
|
+
style?: React.CSSProperties;
|
|
232
|
+
/** 布局方式,垂直(vertical)、水平(horizontal) */
|
|
233
|
+
layoutHint?: "v" | "h";
|
|
234
|
+
/** 其他插件的配置 */
|
|
235
|
+
options?: any;
|
|
236
|
+
/** 业务数据 */
|
|
237
|
+
bizData?: any;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* 数据变化时回调
|
|
241
|
+
* final=true表示回调是因为类似失去焦点导致的,此后不会再有变化回调
|
|
242
|
+
* final=false表示回调是因为用户操作导致的,不处理的话也不会导致最终数据不一致,因为后续会有final=true的回调。
|
|
243
|
+
* 对于暂存表单等比较重的操作,应该仅在final=true时触发,以减少调用次数
|
|
244
|
+
*/
|
|
245
|
+
export declare type AFTER_CHANGE_CALLBACK = (path: string, v: any, final: boolean) => void;
|
|
246
|
+
export interface MProp {
|
|
247
|
+
/** database的数据描述 */
|
|
248
|
+
schema: MFieldSchemaAnonymity;
|
|
249
|
+
/** json格式数据 */
|
|
250
|
+
database: any;
|
|
251
|
+
/** 编辑database中的字段路径 */
|
|
252
|
+
path: string;
|
|
253
|
+
/** 元素形态 */
|
|
254
|
+
morph: MORPH;
|
|
255
|
+
/** database有任何变化时回调 */
|
|
256
|
+
afterChange?: AFTER_CHANGE_CALLBACK;
|
|
257
|
+
/** @deprecated 直接上层。有时parent是谁,会影响渲染字段 */
|
|
258
|
+
parent?: MFieldSchemaAnonymity;
|
|
259
|
+
/** 强制展示校验信息 */
|
|
260
|
+
forceValid?: boolean;
|
|
261
|
+
/**
|
|
262
|
+
* 要求元素展示删除按钮
|
|
263
|
+
* true=父元素是array(或object),要求子元素展示删除按钮
|
|
264
|
+
* false=父元素是array(或object),子元素可以展示删除按钮,但disable
|
|
265
|
+
* undefined=子元素不能展示删除按钮
|
|
266
|
+
*/
|
|
267
|
+
removeButton?: boolean;
|
|
268
|
+
/** 禁用元素 */
|
|
269
|
+
disable?: boolean;
|
|
270
|
+
/** 是否隐藏边框,例如在表格中就不需要边框 */
|
|
271
|
+
hideBorder?: boolean;
|
|
272
|
+
/** 额外的控件,比如AArrayGrid里加个按钮 */
|
|
273
|
+
extra?: JSX.Element;
|
|
274
|
+
style?: React.CSSProperties;
|
|
275
|
+
className?: string;
|
|
276
|
+
}
|
|
277
|
+
export interface M3UISpecSegmentItem {
|
|
278
|
+
label: string;
|
|
279
|
+
fields: string[];
|
|
280
|
+
showIf?: string;
|
|
281
|
+
name?: string;
|
|
282
|
+
/** 如果要支持分段编辑提交,要设置此回调 */
|
|
283
|
+
onSubmit?: (segment: M3UISpecSegmentItem, segmentData: any, done: () => void) => void;
|
|
284
|
+
/** 设置分段根元素的style */
|
|
285
|
+
style?: React.CSSProperties;
|
|
286
|
+
}
|
|
287
|
+
export interface M3UISpec {
|
|
288
|
+
type: "segmentForm" | "stepForm" | "flowForm";
|
|
289
|
+
layout: "horizontal" | "vertical";
|
|
290
|
+
comma?: string;
|
|
291
|
+
labelAlign?: "left" | "right";
|
|
292
|
+
segments?: M3UISpecSegmentItem[];
|
|
293
|
+
}
|
|
294
|
+
export interface MValidationFail {
|
|
295
|
+
/** 错误信息,空字符串表示因为子元素错误导致的,因为子元素已经展示错误了,父元素就不需要再展示了 */
|
|
296
|
+
message: string;
|
|
297
|
+
/** 数据的路径 */
|
|
298
|
+
path: string;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* 校验结果
|
|
302
|
+
* MValidationFail: 校验直接失败,不再经过下一个校验器
|
|
303
|
+
* pass: 直接通过校验,不再经过下一个校验器了(例如 required=false时,数值是nil, 可以直接pass,否则之后的校验器都要处理nil)
|
|
304
|
+
* undefined: 表示让下一个校验器再校验
|
|
305
|
+
*/
|
|
306
|
+
export declare type MValidationResult = MValidationFail | "pass" | undefined;
|