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,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseViewer } from "../../BaseViewer";
|
|
3
|
+
/**
|
|
4
|
+
* antd 的树型选择控件 https://ant.design/components/tree-select-cn/
|
|
5
|
+
* {
|
|
6
|
+
* "type": "array", arrayMember: {type: 'vl'}, toReadable: 'value.map(i=>i.label).join(",")',
|
|
7
|
+
* "editor": "ATreeSelect", "name": "tree1", "label": "多选树选择", props: {
|
|
8
|
+
* treeData: treeData,
|
|
9
|
+
* labelInValue: true,
|
|
10
|
+
* multiple: true
|
|
11
|
+
* }
|
|
12
|
+
* }
|
|
13
|
+
*/
|
|
14
|
+
export declare class ATreeSelect extends BaseViewer {
|
|
15
|
+
value: string;
|
|
16
|
+
constructor(p: any);
|
|
17
|
+
element(): JSX.Element;
|
|
18
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseViewer } from "../../BaseViewer";
|
|
3
|
+
/**
|
|
4
|
+
* antd 的上传组件 https://ant.design/components/upload-cn/
|
|
5
|
+
* {
|
|
6
|
+
"type": "array", arrayMember: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
readable: 'A',
|
|
9
|
+
style: {display: 'block'},
|
|
10
|
+
a: {
|
|
11
|
+
urlExpr: "value.url",
|
|
12
|
+
labelExpr: "value.name",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
"editor": "AUpload", "name": "upload_sec", "label": "文件上传_HP_SECOBJ",
|
|
16
|
+
ossFile: {
|
|
17
|
+
type: "HP_SECOBJ",
|
|
18
|
+
arguments: { genName: true, ossKeyPath: "course/" }
|
|
19
|
+
}, props: {
|
|
20
|
+
beforeUpload(file) {
|
|
21
|
+
const isLt200M = file.size / 1024 / 1024 < 200;
|
|
22
|
+
if (!isLt200M) {
|
|
23
|
+
message.error('File must smaller than 200MB!');
|
|
24
|
+
}
|
|
25
|
+
return isLt200M;
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
*/
|
|
30
|
+
export declare class AUpload extends BaseViewer {
|
|
31
|
+
loading?: number;
|
|
32
|
+
element(): JSX.Element;
|
|
33
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseViewer } from "../../BaseViewer";
|
|
3
|
+
import "./NPS.less";
|
|
4
|
+
import { MProp } from "../../../framework/Schema";
|
|
5
|
+
/**
|
|
6
|
+
* NPS 打分组件,基于 antd 的评分组件 https://ant.design/components/rate-cn/
|
|
7
|
+
* 定义示例:{ editor: 'NPS', name: 'possibility', label: "您向朋友或同事推荐本堂课程的可能性有多大?", required: true },
|
|
8
|
+
*/
|
|
9
|
+
export declare class NPS extends BaseViewer {
|
|
10
|
+
value: string;
|
|
11
|
+
constructor(p: MProp);
|
|
12
|
+
element(): JSX.Element;
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "./AArray.less";
|
|
3
|
+
import { BaseViewer } from '../../BaseViewer';
|
|
4
|
+
import { MFieldSchemaAnonymity } from "../../../framework/Schema";
|
|
5
|
+
/** @deprecated Ant的list,也不好看 */
|
|
6
|
+
export declare class AArray extends BaseViewer {
|
|
7
|
+
_removeClicked(index: number): void;
|
|
8
|
+
/** 不同的数组成员类型,有不同的渲染方式 */
|
|
9
|
+
_renderItem(memberSchema: MFieldSchemaAnonymity, itemData: any, index: number, removeButton?: boolean): JSX.Element[];
|
|
10
|
+
element(): any[] | JSX.Element;
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseViewer } from '../../BaseViewer';
|
|
3
|
+
/**
|
|
4
|
+
* 数据表格
|
|
5
|
+
* 数据是这样的数组:
|
|
6
|
+
* [
|
|
7
|
+
* {from:"1606997544611",to:"", tillNow:true, company:"阿里巴巴", position:"CEO"},
|
|
8
|
+
* {from:"1606997544611",to:"", tillNow:true, company:"阿里巴巴", position:"CEO"},
|
|
9
|
+
* ]
|
|
10
|
+
*/
|
|
11
|
+
export declare class AArrayGrid extends BaseViewer {
|
|
12
|
+
element(): JSX.Element;
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import './ACnAddress.less';
|
|
3
|
+
import { BaseViewer } from '../../BaseViewer';
|
|
4
|
+
/**
|
|
5
|
+
* 国内地址,用以编辑省市区和详细地址
|
|
6
|
+
* 数据类似{province:"陕西省",city:"西安市",district:"长安区", address:"紫薇田园都市A区", code:610116}
|
|
7
|
+
*/
|
|
8
|
+
export declare class ACnAddress extends BaseViewer {
|
|
9
|
+
element(): JSX.Element;
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseViewer } from '../../BaseViewer';
|
|
3
|
+
/**
|
|
4
|
+
* 经历,可以用于教育经历、工作经历等
|
|
5
|
+
* 数据类似以下数组:
|
|
6
|
+
* [
|
|
7
|
+
* {from:"1606997544611",to:"", tillNow:true, company:"阿里巴巴", position:"CEO"},
|
|
8
|
+
* {from:"1606997544611",to:"", tillNow:true, company:"阿里巴巴", position:"CEO"},
|
|
9
|
+
* ...
|
|
10
|
+
* ]
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export declare class AExperience extends BaseViewer {
|
|
14
|
+
_submitData(arrayGridData: any, sort: boolean): void;
|
|
15
|
+
element(): JSX.Element;
|
|
16
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "./AForm.less";
|
|
3
|
+
import { Viewer, ViewerState } from '../../BaseViewer';
|
|
4
|
+
import { MProp } from '../../../framework/Schema';
|
|
5
|
+
interface State extends ViewerState {
|
|
6
|
+
/** 编辑中的分组label,以及编辑前的数据 */
|
|
7
|
+
editing: {
|
|
8
|
+
[label: string]: any;
|
|
9
|
+
};
|
|
10
|
+
/** 保存中的分组label */
|
|
11
|
+
saving: {
|
|
12
|
+
[segmentLabel: string]: boolean;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare class AForm extends Viewer<State> {
|
|
16
|
+
constructor(p: MProp);
|
|
17
|
+
/**
|
|
18
|
+
* 表单项,包括label和viewer
|
|
19
|
+
* @param hideField
|
|
20
|
+
* @param hideMap
|
|
21
|
+
* @param f
|
|
22
|
+
* @param objectFields
|
|
23
|
+
* @param uispec
|
|
24
|
+
* @param morph
|
|
25
|
+
* @param labelWidth
|
|
26
|
+
* @param invalidLayoutMsg
|
|
27
|
+
* @param column
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
private formItem;
|
|
31
|
+
/**
|
|
32
|
+
* 分段表单
|
|
33
|
+
* @param objectFields
|
|
34
|
+
* @param uispec
|
|
35
|
+
*/
|
|
36
|
+
private _segmentForm;
|
|
37
|
+
/**
|
|
38
|
+
* 不分段的表单
|
|
39
|
+
* @param objectFields
|
|
40
|
+
* @param uispec
|
|
41
|
+
* @param column
|
|
42
|
+
*/
|
|
43
|
+
private _flowForm;
|
|
44
|
+
element(): JSX.Element;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseViewer } from "../../BaseViewer";
|
|
3
|
+
/**
|
|
4
|
+
* 类似这样分正负的数字:
|
|
5
|
+
*
|
|
6
|
+
* 与去年同期(2019 年 1 月初-6 月底)相比,您的收入
|
|
7
|
+
* (1)增长了(具体数字:约___万元) (2)下降了(具体数字:约___万元) (3) 基本没有变化
|
|
8
|
+
*/
|
|
9
|
+
export declare class AIntDiff extends BaseViewer {
|
|
10
|
+
_posInputBoxValue?: number;
|
|
11
|
+
_negInputBoxValue?: number;
|
|
12
|
+
_radio?: number;
|
|
13
|
+
element(): JSX.Element;
|
|
14
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "./AMatrix.less";
|
|
3
|
+
import { BaseViewer } from "../../BaseViewer";
|
|
4
|
+
/**
|
|
5
|
+
* 单选矩阵.
|
|
6
|
+
* 暂不支持字符串以外的值。
|
|
7
|
+
* 示例:{label:"3.3 您是否愿意与农村人",name:"countryman", type:"matrix", editor:"ARadioMatrix", matrix: {x:"很愿意 比较愿意 不太愿意 很不愿意 不好说", y:"聊天 一起工作 成为邻居 成为亲密朋友 结成亲家"}},
|
|
8
|
+
* 数据:
|
|
9
|
+
* {"聊天":["很愿意", "比较愿意"], "一起工作":"比较愿意"}
|
|
10
|
+
*/
|
|
11
|
+
export declare class AMatrix extends BaseViewer {
|
|
12
|
+
private _inputBoxValue?;
|
|
13
|
+
/**
|
|
14
|
+
* 当某个值被选中时,将其设置到数据上。
|
|
15
|
+
* 例如:
|
|
16
|
+
* let data = {}
|
|
17
|
+
* _setDataForKey(data, "foo", "bar", ["foo"])
|
|
18
|
+
* // data会变成 {foo:bar}
|
|
19
|
+
*
|
|
20
|
+
* let data = {"foo": "bar1"}
|
|
21
|
+
* _setDataForKey(data, "foo", "bar2", ["foo"])
|
|
22
|
+
* // data会变成 {foo:["bar1", "bar2"]}
|
|
23
|
+
*
|
|
24
|
+
* let data = {"foo": "bar1"}
|
|
25
|
+
* _setDataForKey(data, "foo", "bar2", ["foo"])
|
|
26
|
+
* // data会变成 {foo:["bar1", "bar2"]}
|
|
27
|
+
*
|
|
28
|
+
* let data = {"foo": "bar1", "open":"before"}
|
|
29
|
+
* _setDataForKey(data, nil, "bar2", ["foo"])
|
|
30
|
+
* // 假如此时文本框内是foo3
|
|
31
|
+
* // data会变成 {foo:"bar1", foo3:"bar2"}
|
|
32
|
+
*
|
|
33
|
+
* @param data 这个控件的数据,这个函数会讲key/value存入data,例如:{"聊天":["很愿意", "比较愿意"], "一起工作":"比较愿意", "开放-用户填的":"比较愿意"}
|
|
34
|
+
* @param key 字符串表示 nil表示设置开放选项,此时key不固定,以_inputBoxValue为准
|
|
35
|
+
* @param value
|
|
36
|
+
* @param yyClosed 非开放选项的值,传进来免得再计算
|
|
37
|
+
*/
|
|
38
|
+
private _setDataForKey;
|
|
39
|
+
/**
|
|
40
|
+
* 渲染成矩阵
|
|
41
|
+
*/
|
|
42
|
+
_renderAsMatrix(): JSX.Element;
|
|
43
|
+
/**
|
|
44
|
+
* 渲染成一组下拉框
|
|
45
|
+
*/
|
|
46
|
+
_renderAsDropdownList(): any[];
|
|
47
|
+
element(): any[] | JSX.Element;
|
|
48
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { CSSProperties } from "react";
|
|
2
|
+
interface Prop {
|
|
3
|
+
/** 单测需要用到的属性 */
|
|
4
|
+
name: string;
|
|
5
|
+
/** 是否展开状态 */
|
|
6
|
+
open: boolean;
|
|
7
|
+
/** 动画时长,默认0.5秒,nil表示无动画效果 */
|
|
8
|
+
ms?: number;
|
|
9
|
+
/** Collapsible也能定义样式 */
|
|
10
|
+
style?: CSSProperties;
|
|
11
|
+
/** html元素id */
|
|
12
|
+
id?: string;
|
|
13
|
+
}
|
|
14
|
+
interface State {
|
|
15
|
+
css: CSSProperties;
|
|
16
|
+
self?: Collapsible;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 可以折叠的元素,折叠时可带动画效果
|
|
20
|
+
*
|
|
21
|
+
* 以下几点帮助理解这个组件:
|
|
22
|
+
* 1. 初始元素隐藏时,需要隐藏又不能占用空间,否则无法获取其高度,用position="absolute"让其脱离文档流来实现
|
|
23
|
+
* 2. 折叠效果通过max-height来实现
|
|
24
|
+
* 3. 用state来控制元素的css,state可能由props变化和定时器自己触发,所以要用getDerivedStateFromProps
|
|
25
|
+
*/
|
|
26
|
+
export declare class Collapsible extends React.Component<Prop, State> {
|
|
27
|
+
div: HTMLDivElement;
|
|
28
|
+
height: number;
|
|
29
|
+
action: any;
|
|
30
|
+
/** props.style去掉margin。如果不去掉,隐藏后margin会占用空间出来 */
|
|
31
|
+
closeStyle: CSSProperties;
|
|
32
|
+
constructor(p: Prop);
|
|
33
|
+
componentDidMount(): void;
|
|
34
|
+
/**
|
|
35
|
+
* 产生state对象
|
|
36
|
+
* @param self
|
|
37
|
+
* @param open 是否展开
|
|
38
|
+
* @param changing 是否是切换中
|
|
39
|
+
* @returns 新的state对象
|
|
40
|
+
*/
|
|
41
|
+
static genNextState(self: Collapsible, open: boolean, changing: boolean): State;
|
|
42
|
+
/** Collapsible的state既可以被props影响,也可能自发(延时)改变 */
|
|
43
|
+
static getDerivedStateFromProps(nextProps: Prop, prevState: State): State;
|
|
44
|
+
render(): JSX.Element;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./Segment.less";
|
|
3
|
+
interface Prop {
|
|
4
|
+
style?: React.CSSProperties;
|
|
5
|
+
mainTitle?: React.ReactNode;
|
|
6
|
+
/** 副标题 */
|
|
7
|
+
subTitle?: React.ReactNode;
|
|
8
|
+
/** 右上角的按钮 */
|
|
9
|
+
topRight?: React.ReactNode;
|
|
10
|
+
/** label的name,可以用于query到dom定位 */
|
|
11
|
+
labelName?: string;
|
|
12
|
+
/** 分栏数 */
|
|
13
|
+
column?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare class Segment extends React.Component<Prop, any> {
|
|
16
|
+
render(): JSX.Element;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare type SegmentEditSwitchState =
|
|
3
|
+
/** 只有一个可以按的【编辑】按钮 */
|
|
4
|
+
"readable" |
|
|
5
|
+
/** 只有一个disable的编辑按钮 */
|
|
6
|
+
"disable" |
|
|
7
|
+
/** 有【取消】和【编辑】按钮,都能按 */
|
|
8
|
+
"editor" |
|
|
9
|
+
/** 有【取消】和【编辑】按钮,但编辑按钮展示为loading且disable */
|
|
10
|
+
"saving";
|
|
11
|
+
export interface SegmentEditSwitchProps {
|
|
12
|
+
state: SegmentEditSwitchState;
|
|
13
|
+
/** edit=true表示按【提交】或者【编辑】按钮 edit=false表示按了【取消】按钮*/
|
|
14
|
+
onClick: (edit: boolean) => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 展示一个【编辑】按钮,点下以后变成【提交】和【取消】两个按钮
|
|
18
|
+
* @param props
|
|
19
|
+
*/
|
|
20
|
+
export declare function SegmentEditSwitch(props: SegmentEditSwitchProps): JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PickerData } from "antd-mobile/lib/picker/PropsType";
|
|
2
|
+
import React from "react";
|
|
3
|
+
interface Prop {
|
|
4
|
+
data: string;
|
|
5
|
+
options: PickerData[];
|
|
6
|
+
onChange: (newValue?: string) => void;
|
|
7
|
+
onBlur?: () => void;
|
|
8
|
+
openLabel?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class SelectBox extends React.Component<Prop, any> {
|
|
11
|
+
render(): JSX.Element;
|
|
12
|
+
}
|
|
13
|
+
export {};
|