kts-components-document-access-point 1.4.4 → 1.4.5
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/.editorconfig +16 -16
- package/.fatherrc.ts +4 -4
- package/.prettierignore +7 -7
- package/.prettierrc +11 -11
- package/.umirc.ts +11 -11
- package/README.md +3 -3
- package/dist/index.esm.js +6 -2
- package/dist/index.js +6 -2
- package/docs/index.md +3 -3
- package/index.html +12 -12
- package/package.json +56 -56
- package/src/DocumentWhiteList/___demo___/base/index.tsx +7 -7
- package/src/DocumentWhiteList/___demo___/setService/index.tsx +23 -23
- package/src/DocumentWhiteList/control/actions/addblack/index.ts +14 -14
- package/src/DocumentWhiteList/control/actions/addwhite/index.ts +14 -14
- package/src/DocumentWhiteList/control/actions/blacklist/index.ts +22 -22
- package/src/DocumentWhiteList/control/actions/checkclient/index.ts +14 -14
- package/src/DocumentWhiteList/control/actions/demo/index.ts +4 -4
- package/src/DocumentWhiteList/control/actions/didilist/index.ts +18 -18
- package/src/DocumentWhiteList/control/actions/enableblacklist/index.ts +17 -17
- package/src/DocumentWhiteList/control/actions/enablelist/index.ts +18 -18
- package/src/DocumentWhiteList/control/actions/enablewhitelist/index.ts +17 -17
- package/src/DocumentWhiteList/control/actions/getmode/index.ts +14 -14
- package/src/DocumentWhiteList/control/actions/setmode/index.ts +14 -14
- package/src/DocumentWhiteList/control/actions/synclist/index.ts +19 -19
- package/src/DocumentWhiteList/control/actions/whitelist/index.ts +22 -22
- package/src/DocumentWhiteList/control/index.tsx +42 -42
- package/src/DocumentWhiteList/control/state/index.ts +47 -47
- package/src/DocumentWhiteList/index.md +5 -5
- package/src/DocumentWhiteList/index.tsx +40 -40
- package/src/DocumentWhiteList/interface/index.ts +30 -30
- package/src/DocumentWhiteList/ui/clientmodal/index.tsx +190 -190
- package/src/DocumentWhiteList/ui/main/black.tsx +132 -132
- package/src/DocumentWhiteList/ui/main/index.tsx +49 -49
- package/src/DocumentWhiteList/ui/main/switchmode.tsx +52 -52
- package/src/DocumentWhiteList/ui/main/white.tsx +120 -120
- package/src/DocumentWhiteList/ui/pageheader/BlackHeader.tsx +143 -143
- package/src/DocumentWhiteList/ui/pageheader/WhiteHeader.tsx +152 -152
- package/src/DocumentWhiteList/ui/pageui/index.tsx +64 -64
- package/src/DocumentWhiteList/ui/whitemodal/index.tsx +146 -146
- package/src/DocumentWhiteList/util/ConfigEnum.ts +8 -8
- package/src/DocumentsCont/___demo___/base/index.tsx +7 -7
- package/src/DocumentsCont/___demo___/setService/index.tsx +25 -25
- package/src/DocumentsCont/index.md +9 -9
- package/src/DocumentsCont/index.tsx +54 -51
- package/src/DocumentsDemo/Controller/index.tsx +14 -14
- package/src/DocumentsDemo/Controller/whitelist.ts +22 -22
- package/src/DocumentsDemo/Text.tsx +22 -22
- package/src/DocumentsDemo/___demo___/base/index.tsx +7 -7
- package/src/DocumentsDemo/index.md +6 -6
- package/src/DocumentsDemo/index.tsx +38 -38
- package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/IProperties/index.ts +69 -69
- package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/IRules/index.ts +18 -18
- package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/ISchema/index.ts +14 -14
- package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/PropertyTableState/index.ts +12 -12
- package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/RuleState/index.ts +336 -336
- package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/index.ts +51 -51
- package/src/DocumentsEdit/DocumentsEditController/actions/addProperties/index.ts +37 -37
- package/src/DocumentsEdit/DocumentsEditController/actions/delProperties/index.ts +48 -48
- package/src/DocumentsEdit/DocumentsEditController/actions/editProperties/index.ts +93 -93
- package/src/DocumentsEdit/DocumentsEditController/index.tsx +21 -21
- package/src/DocumentsEdit/___demo___/conventional/index.tsx +10 -10
- package/src/DocumentsEdit/___demo___/monitor/index.tsx +1421 -1421
- package/src/DocumentsEdit/___demo___/readOnly/index.tsx +16 -16
- package/src/DocumentsEdit/constant/propertyColumns/index.tsx +65 -65
- package/src/DocumentsEdit/index.less +45 -45
- package/src/DocumentsEdit/index.md +10 -10
- package/src/DocumentsEdit/index.tsx +117 -117
- package/src/DocumentsEdit/tools/index.ts +88 -88
- package/src/DocumentsEdit/ui/AddPropertyButton/index.tsx +238 -238
- package/src/DocumentsEdit/ui/Breadcrumb/index.tsx +51 -51
- package/src/DocumentsEdit/ui/EditProperty/index.tsx +290 -290
- package/src/DocumentsEdit/ui/EditRule/index.tsx +156 -156
- package/src/DocumentsEdit/ui/EditRule/ui/AddRuleButton/index.tsx +49 -49
- package/src/DocumentsEdit/ui/EditRule/ui/DelRuleButton/index.tsx +31 -31
- package/src/DocumentsEdit/ui/EditRule/ui/RuleForm/fn/algorithmFormComponent/index.tsx +142 -142
- package/src/DocumentsEdit/ui/EditRule/ui/RuleForm/index.tsx +154 -154
- package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/index.less +4 -4
- package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/index.tsx +70 -70
- package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/ui/AddChildPropertyButton/index.tsx +34 -34
- package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/ui/AddRuleButton/index.tsx +64 -64
- package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/ui/EditPropertyButton/index.tsx +31 -31
- package/src/DocumentsEdit/ui/PropertyTable/index.less +19 -19
- package/src/DocumentsEdit/ui/PropertyTable/index.tsx +18 -18
- package/src/DocumentsEdit/ui/RefPropertyButton/index.tsx +121 -121
- package/src/DocumentsList/DocumentsListController/DocumentsListControllerState/index.ts +55 -55
- package/src/DocumentsList/DocumentsListController/actions/demo/index.ts +4 -4
- package/src/DocumentsList/DocumentsListController/actions/typelist/index.ts +15 -15
- package/src/DocumentsList/DocumentsListController/index.tsx +16 -16
- package/src/DocumentsList/___demo___/list/index.tsx +4 -4
- package/src/DocumentsList/index.less +22 -22
- package/src/DocumentsList/index.md +3 -3
- package/src/DocumentsList/index.tsx +46 -46
- package/src/DocumentsList/ui/ModalComfirm/index.tsx +94 -92
- package/src/DocumentsList/ui/PageHeader/SendHeader.tsx +230 -230
- package/src/DocumentsList/ui/PageHeader/index.tsx +325 -325
- package/src/DocumentsList/ui/PageUI/index.tsx +65 -65
- package/src/DocumentsList/ui/RuleTable/index.tsx +163 -163
- package/src/DocumentsList/ui/sendlist/index.tsx +151 -151
- package/src/DocumentsList/util/ConfigEnum.ts +11 -11
- package/src/DocumentsRule/control/actions/batchsend/index.ts +13 -13
- package/src/DocumentsRule/control/actions/configsave/index.ts +14 -14
- package/src/DocumentsRule/control/actions/configupdate/index.ts +13 -13
- package/src/DocumentsRule/control/actions/getconfigbyid/index.ts +14 -14
- package/src/DocumentsRule/control/actions/getrecordbyid/index.ts +14 -14
- package/src/DocumentsRule/control/actions/gettemplate/index.ts +15 -15
- package/src/DocumentsRule/control/actions/listbysubjectid/index.ts +13 -13
- package/src/DocumentsRule/control/actions/typelist/index.ts +13 -13
- package/src/DocumentsRule/control/index.tsx +30 -30
- package/src/DocumentsRule/control/state/index.ts +42 -42
- package/src/DocumentsRule/index.md +1 -1
- package/src/DocumentsRule/index.tsx +25 -25
- package/src/DocumentsRule/interface/index.ts +28 -28
- package/src/DocumentsRule/ui/main/index.tsx +362 -362
- package/src/DocumentsService/index.ts +18 -18
- package/src/index.ts +9 -9
- package/tsconfig.json +29 -29
- package/typings.d.ts +3 -3
- package/docs-dist/404.html +0 -38
- package/docs-dist/index.html +0 -38
- package/docs-dist/static/icon.050945f2.svg +0 -1
- package/docs-dist/umi.css +0 -11
- package/docs-dist/umi.js +0 -1
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
import PropertyTableState from './PropertyTableState';
|
|
3
|
-
import IProperties, { IPropertiesItem } from './IProperties';
|
|
4
|
-
import ISchema from './ISchema';
|
|
5
|
-
import RuleState from './RuleState';
|
|
6
|
-
|
|
7
|
-
export interface IDataSource {
|
|
8
|
-
// 引用对象
|
|
9
|
-
ref: IProperties;
|
|
10
|
-
|
|
11
|
-
// 必填字段
|
|
12
|
-
required: string[];
|
|
13
|
-
|
|
14
|
-
// 对象数据
|
|
15
|
-
value: IPropertiesItem;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default class DocumentsEditControllerState {
|
|
19
|
-
|
|
20
|
-
constructor(schema?: ISchema) {
|
|
21
|
-
this.schema = schema ? JSON.parse(JSON.stringify(schema)) : JSON.parse(JSON.stringify(defaultSchema));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/** 文档数据 */
|
|
25
|
-
schema: ISchema = JSON.parse(JSON.stringify(defaultSchema));
|
|
26
|
-
|
|
27
|
-
/** 只读模式 */
|
|
28
|
-
readOnly: boolean = false;
|
|
29
|
-
|
|
30
|
-
/** 属性列表状态 */
|
|
31
|
-
propertyTableState = new PropertyTableState();
|
|
32
|
-
|
|
33
|
-
/** 定义的字段 */
|
|
34
|
-
definitions = new Map<string, IProperties>();
|
|
35
|
-
|
|
36
|
-
/** 面包屑数据 */
|
|
37
|
-
breadcrumbState: IDataSource[] = [];
|
|
38
|
-
|
|
39
|
-
/** 规则管理数据 */
|
|
40
|
-
ruleState = new RuleState();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const defaultSchema: ISchema = {
|
|
44
|
-
$schema: "http://json-schema.org/draft-07/schema",
|
|
45
|
-
$id: "http://example.com/example.json",
|
|
46
|
-
$createTime: 0,
|
|
47
|
-
$count: 0,
|
|
48
|
-
$name: 'schema',
|
|
49
|
-
type: "object",
|
|
50
|
-
title: "我的单据",
|
|
51
|
-
definitions: {}
|
|
1
|
+
|
|
2
|
+
import PropertyTableState from './PropertyTableState';
|
|
3
|
+
import IProperties, { IPropertiesItem } from './IProperties';
|
|
4
|
+
import ISchema from './ISchema';
|
|
5
|
+
import RuleState from './RuleState';
|
|
6
|
+
|
|
7
|
+
export interface IDataSource {
|
|
8
|
+
// 引用对象
|
|
9
|
+
ref: IProperties;
|
|
10
|
+
|
|
11
|
+
// 必填字段
|
|
12
|
+
required: string[];
|
|
13
|
+
|
|
14
|
+
// 对象数据
|
|
15
|
+
value: IPropertiesItem;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default class DocumentsEditControllerState {
|
|
19
|
+
|
|
20
|
+
constructor(schema?: ISchema) {
|
|
21
|
+
this.schema = schema ? JSON.parse(JSON.stringify(schema)) : JSON.parse(JSON.stringify(defaultSchema));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** 文档数据 */
|
|
25
|
+
schema: ISchema = JSON.parse(JSON.stringify(defaultSchema));
|
|
26
|
+
|
|
27
|
+
/** 只读模式 */
|
|
28
|
+
readOnly: boolean = false;
|
|
29
|
+
|
|
30
|
+
/** 属性列表状态 */
|
|
31
|
+
propertyTableState = new PropertyTableState();
|
|
32
|
+
|
|
33
|
+
/** 定义的字段 */
|
|
34
|
+
definitions = new Map<string, IProperties>();
|
|
35
|
+
|
|
36
|
+
/** 面包屑数据 */
|
|
37
|
+
breadcrumbState: IDataSource[] = [];
|
|
38
|
+
|
|
39
|
+
/** 规则管理数据 */
|
|
40
|
+
ruleState = new RuleState();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const defaultSchema: ISchema = {
|
|
44
|
+
$schema: "http://json-schema.org/draft-07/schema",
|
|
45
|
+
$id: "http://example.com/example.json",
|
|
46
|
+
$createTime: 0,
|
|
47
|
+
$count: 0,
|
|
48
|
+
$name: 'schema',
|
|
49
|
+
type: "object",
|
|
50
|
+
title: "我的单据",
|
|
51
|
+
definitions: {}
|
|
52
52
|
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import IProperties, { IPropertiesItem } from '../../DocumentsEditControllerState/IProperties';
|
|
2
|
-
import DocumentsEditControllerState from '../../DocumentsEditControllerState'
|
|
3
|
-
|
|
4
|
-
export default async (s: DocumentsEditControllerState, options?: { current?: IProperties, properties?: IProperties, values: { $name: string, description: string, title: string, required: boolean } }) => {
|
|
5
|
-
if (!options) return;
|
|
6
|
-
const { current, properties, values } = options;
|
|
7
|
-
|
|
8
|
-
if (!current || !properties) return;
|
|
9
|
-
|
|
10
|
-
if (s.schema.definitions[properties.$name]) {
|
|
11
|
-
console.error('属性名已经存在');
|
|
12
|
-
return
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const info = current.items ? current.items : current;
|
|
16
|
-
|
|
17
|
-
// let obj: any;
|
|
18
|
-
// 创建 properties (对象 还是 数组)
|
|
19
|
-
if (current.type === 'object') {
|
|
20
|
-
if (!current.properties) current.properties = {};
|
|
21
|
-
} else if (current.type === 'array' && current.items) {
|
|
22
|
-
if (!current.items.properties) current.items.properties = {};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (!info.required) info.required = [];
|
|
26
|
-
values.required && info.required.push(values.$name);
|
|
27
|
-
|
|
28
|
-
(info.properties as any)[values.$name] = {
|
|
29
|
-
alias: values.title,
|
|
30
|
-
detailed: values.description,
|
|
31
|
-
$ref: properties.$id,
|
|
32
|
-
$refName: properties.$name,
|
|
33
|
-
$canDel: true,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
s.schema.definitions[properties.$name] = properties;
|
|
37
|
-
s.schema = { ...s.schema };
|
|
1
|
+
import IProperties, { IPropertiesItem } from '../../DocumentsEditControllerState/IProperties';
|
|
2
|
+
import DocumentsEditControllerState from '../../DocumentsEditControllerState'
|
|
3
|
+
|
|
4
|
+
export default async (s: DocumentsEditControllerState, options?: { current?: IProperties, properties?: IProperties, values: { $name: string, description: string, title: string, required: boolean } }) => {
|
|
5
|
+
if (!options) return;
|
|
6
|
+
const { current, properties, values } = options;
|
|
7
|
+
|
|
8
|
+
if (!current || !properties) return;
|
|
9
|
+
|
|
10
|
+
if (s.schema.definitions[properties.$name]) {
|
|
11
|
+
console.error('属性名已经存在');
|
|
12
|
+
return
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const info = current.items ? current.items : current;
|
|
16
|
+
|
|
17
|
+
// let obj: any;
|
|
18
|
+
// 创建 properties (对象 还是 数组)
|
|
19
|
+
if (current.type === 'object') {
|
|
20
|
+
if (!current.properties) current.properties = {};
|
|
21
|
+
} else if (current.type === 'array' && current.items) {
|
|
22
|
+
if (!current.items.properties) current.items.properties = {};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (!info.required) info.required = [];
|
|
26
|
+
values.required && info.required.push(values.$name);
|
|
27
|
+
|
|
28
|
+
(info.properties as any)[values.$name] = {
|
|
29
|
+
alias: values.title,
|
|
30
|
+
detailed: values.description,
|
|
31
|
+
$ref: properties.$id,
|
|
32
|
+
$refName: properties.$name,
|
|
33
|
+
$canDel: true,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
s.schema.definitions[properties.$name] = properties;
|
|
37
|
+
s.schema = { ...s.schema };
|
|
38
38
|
}
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
import DocumentsEditControllerState, { IDataSource } from '../../DocumentsEditControllerState';
|
|
3
|
-
import IProperties from '../../DocumentsEditControllerState/IProperties';
|
|
4
|
-
|
|
5
|
-
export default async (s: DocumentsEditControllerState, options?: IDataSource) => {
|
|
6
|
-
if (!options || !s.propertyTableState.current) return;
|
|
7
|
-
|
|
8
|
-
const current = s.propertyTableState.current?.items
|
|
9
|
-
? s.propertyTableState.current?.items
|
|
10
|
-
: s.propertyTableState.current
|
|
11
|
-
|
|
12
|
-
_del(current, options.value.$name, options.value.$refName);
|
|
13
|
-
|
|
14
|
-
function _del(current: IProperties, name: string, refName: string) {
|
|
15
|
-
// 删除必填
|
|
16
|
-
(() => {
|
|
17
|
-
if (!current.required) return;
|
|
18
|
-
const p = current.required.indexOf(name);
|
|
19
|
-
current.required.splice(p, 1);
|
|
20
|
-
})();
|
|
21
|
-
|
|
22
|
-
// 删除引用
|
|
23
|
-
(() => {
|
|
24
|
-
if (!current.properties) return;
|
|
25
|
-
delete current.properties[name];
|
|
26
|
-
s.schema.definitions[refName].$count--;
|
|
27
|
-
})();
|
|
28
|
-
|
|
29
|
-
// 删除孩子
|
|
30
|
-
(() => {
|
|
31
|
-
const items = s.schema.definitions[refName].items;
|
|
32
|
-
const current: IProperties = items ? items : s.schema.definitions[refName];
|
|
33
|
-
const properties = current.properties;
|
|
34
|
-
if (!properties) return;
|
|
35
|
-
for (let name in properties) {
|
|
36
|
-
_del(current, name, properties[name].$refName);
|
|
37
|
-
}
|
|
38
|
-
})();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// 删除对象
|
|
42
|
-
for (let key in s.schema.definitions) {
|
|
43
|
-
if (s.schema.definitions[key].$count <= 0) {
|
|
44
|
-
delete s.schema.definitions[key];
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
s.schema = { ...s.schema }
|
|
1
|
+
|
|
2
|
+
import DocumentsEditControllerState, { IDataSource } from '../../DocumentsEditControllerState';
|
|
3
|
+
import IProperties from '../../DocumentsEditControllerState/IProperties';
|
|
4
|
+
|
|
5
|
+
export default async (s: DocumentsEditControllerState, options?: IDataSource) => {
|
|
6
|
+
if (!options || !s.propertyTableState.current) return;
|
|
7
|
+
|
|
8
|
+
const current = s.propertyTableState.current?.items
|
|
9
|
+
? s.propertyTableState.current?.items
|
|
10
|
+
: s.propertyTableState.current
|
|
11
|
+
|
|
12
|
+
_del(current, options.value.$name, options.value.$refName);
|
|
13
|
+
|
|
14
|
+
function _del(current: IProperties, name: string, refName: string) {
|
|
15
|
+
// 删除必填
|
|
16
|
+
(() => {
|
|
17
|
+
if (!current.required) return;
|
|
18
|
+
const p = current.required.indexOf(name);
|
|
19
|
+
current.required.splice(p, 1);
|
|
20
|
+
})();
|
|
21
|
+
|
|
22
|
+
// 删除引用
|
|
23
|
+
(() => {
|
|
24
|
+
if (!current.properties) return;
|
|
25
|
+
delete current.properties[name];
|
|
26
|
+
s.schema.definitions[refName].$count--;
|
|
27
|
+
})();
|
|
28
|
+
|
|
29
|
+
// 删除孩子
|
|
30
|
+
(() => {
|
|
31
|
+
const items = s.schema.definitions[refName].items;
|
|
32
|
+
const current: IProperties = items ? items : s.schema.definitions[refName];
|
|
33
|
+
const properties = current.properties;
|
|
34
|
+
if (!properties) return;
|
|
35
|
+
for (let name in properties) {
|
|
36
|
+
_del(current, name, properties[name].$refName);
|
|
37
|
+
}
|
|
38
|
+
})();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// 删除对象
|
|
42
|
+
for (let key in s.schema.definitions) {
|
|
43
|
+
if (s.schema.definitions[key].$count <= 0) {
|
|
44
|
+
delete s.schema.definitions[key];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
s.schema = { ...s.schema }
|
|
49
49
|
}
|
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
|
|
2
|
-
import DocumentsEditControllerState from '../../DocumentsEditControllerState';
|
|
3
|
-
|
|
4
|
-
export default async (s: DocumentsEditControllerState, options: any) => {
|
|
5
|
-
if (!options) return;
|
|
6
|
-
|
|
7
|
-
debugger;
|
|
8
|
-
const { editProperties, properties } = options;
|
|
9
|
-
const current = options.current.items ? options.current.items : options.current;
|
|
10
|
-
|
|
11
|
-
// 对象数据
|
|
12
|
-
current.properties[properties.$name].alias = properties.title;
|
|
13
|
-
current.properties[properties.$name].detailed = properties.description;
|
|
14
|
-
|
|
15
|
-
// 设置必填
|
|
16
|
-
const required = (current.required as string[] || (current.required = []));
|
|
17
|
-
if (properties.required) {
|
|
18
|
-
if (required.indexOf(properties.$name) < 0) {
|
|
19
|
-
current.required.push(properties.$name);
|
|
20
|
-
}
|
|
21
|
-
} else {
|
|
22
|
-
const p = required.indexOf(properties.$name)
|
|
23
|
-
if (p >= 0) {
|
|
24
|
-
required.splice(p, 1);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// 子应用的 必填项
|
|
29
|
-
const req = (() => {
|
|
30
|
-
debugger;
|
|
31
|
-
if (editProperties.ref.items) {
|
|
32
|
-
return editProperties.ref.items.required;
|
|
33
|
-
} else {
|
|
34
|
-
return editProperties.ref.required;
|
|
35
|
-
}
|
|
36
|
-
})()
|
|
37
|
-
|
|
38
|
-
// 子应用的 属性
|
|
39
|
-
const pro = (() => {
|
|
40
|
-
if (editProperties.ref.items) {
|
|
41
|
-
return editProperties.ref.items.properties;
|
|
42
|
-
} else {
|
|
43
|
-
return editProperties.ref.properties;
|
|
44
|
-
}
|
|
45
|
-
})()
|
|
46
|
-
|
|
47
|
-
const rules = (editProperties.ref.items ? editProperties.ref.items.rules : editProperties.ref.rules) || [];
|
|
48
|
-
|
|
49
|
-
// 设置数据
|
|
50
|
-
s.schema.definitions[editProperties.ref.$name] = {
|
|
51
|
-
...editProperties.ref,
|
|
52
|
-
type: properties.type,
|
|
53
|
-
format: properties.format,
|
|
54
|
-
rules: properties.items ? properties.rules : rules,
|
|
55
|
-
properties: pro,
|
|
56
|
-
required: req,
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
// 是否数组
|
|
60
|
-
if (properties.items) {
|
|
61
|
-
s.schema.definitions[editProperties.ref.$name].rules = properties.rules;
|
|
62
|
-
s.schema.definitions[editProperties.ref.$name]['items'] = {
|
|
63
|
-
...editProperties.ref.items,
|
|
64
|
-
type: properties.items.type,
|
|
65
|
-
format: properties.items.format,
|
|
66
|
-
title: properties.items.title,
|
|
67
|
-
properties: pro,
|
|
68
|
-
required: req,
|
|
69
|
-
rules,
|
|
70
|
-
}
|
|
71
|
-
delete s.schema.definitions[editProperties.ref.$name]['properties'];
|
|
72
|
-
delete s.schema.definitions[editProperties.ref.$name]['required'];
|
|
73
|
-
} else {
|
|
74
|
-
delete s.schema.definitions[editProperties.ref.$name]['items'];
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const properties_type = properties.items ? properties.items.type : properties.type;
|
|
78
|
-
const editProperties_type = editProperties.ref.items ? editProperties.ref.items.type : editProperties.ref.type;
|
|
79
|
-
|
|
80
|
-
const editProperties_format = editProperties.ref.items ? editProperties.ref.items.format : editProperties.ref.format;
|
|
81
|
-
const properties_format = properties.items ? properties.items.format : properties.format;
|
|
82
|
-
|
|
83
|
-
// 内部规则 修改了类型 清空规则
|
|
84
|
-
if (editProperties_type !== properties_type || editProperties_format !== properties_format) {
|
|
85
|
-
const obj = s.schema.definitions[editProperties.ref.$name]
|
|
86
|
-
if (obj.items) {
|
|
87
|
-
obj.items.rules = [];
|
|
88
|
-
} else {
|
|
89
|
-
obj.rules = [];
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
s.schema = { ...s.schema };
|
|
1
|
+
|
|
2
|
+
import DocumentsEditControllerState from '../../DocumentsEditControllerState';
|
|
3
|
+
|
|
4
|
+
export default async (s: DocumentsEditControllerState, options: any) => {
|
|
5
|
+
if (!options) return;
|
|
6
|
+
|
|
7
|
+
debugger;
|
|
8
|
+
const { editProperties, properties } = options;
|
|
9
|
+
const current = options.current.items ? options.current.items : options.current;
|
|
10
|
+
|
|
11
|
+
// 对象数据
|
|
12
|
+
current.properties[properties.$name].alias = properties.title;
|
|
13
|
+
current.properties[properties.$name].detailed = properties.description;
|
|
14
|
+
|
|
15
|
+
// 设置必填
|
|
16
|
+
const required = (current.required as string[] || (current.required = []));
|
|
17
|
+
if (properties.required) {
|
|
18
|
+
if (required.indexOf(properties.$name) < 0) {
|
|
19
|
+
current.required.push(properties.$name);
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
const p = required.indexOf(properties.$name)
|
|
23
|
+
if (p >= 0) {
|
|
24
|
+
required.splice(p, 1);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// 子应用的 必填项
|
|
29
|
+
const req = (() => {
|
|
30
|
+
debugger;
|
|
31
|
+
if (editProperties.ref.items) {
|
|
32
|
+
return editProperties.ref.items.required;
|
|
33
|
+
} else {
|
|
34
|
+
return editProperties.ref.required;
|
|
35
|
+
}
|
|
36
|
+
})()
|
|
37
|
+
|
|
38
|
+
// 子应用的 属性
|
|
39
|
+
const pro = (() => {
|
|
40
|
+
if (editProperties.ref.items) {
|
|
41
|
+
return editProperties.ref.items.properties;
|
|
42
|
+
} else {
|
|
43
|
+
return editProperties.ref.properties;
|
|
44
|
+
}
|
|
45
|
+
})()
|
|
46
|
+
|
|
47
|
+
const rules = (editProperties.ref.items ? editProperties.ref.items.rules : editProperties.ref.rules) || [];
|
|
48
|
+
|
|
49
|
+
// 设置数据
|
|
50
|
+
s.schema.definitions[editProperties.ref.$name] = {
|
|
51
|
+
...editProperties.ref,
|
|
52
|
+
type: properties.type,
|
|
53
|
+
format: properties.format,
|
|
54
|
+
rules: properties.items ? properties.rules : rules,
|
|
55
|
+
properties: pro,
|
|
56
|
+
required: req,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// 是否数组
|
|
60
|
+
if (properties.items) {
|
|
61
|
+
s.schema.definitions[editProperties.ref.$name].rules = properties.rules;
|
|
62
|
+
s.schema.definitions[editProperties.ref.$name]['items'] = {
|
|
63
|
+
...editProperties.ref.items,
|
|
64
|
+
type: properties.items.type,
|
|
65
|
+
format: properties.items.format,
|
|
66
|
+
title: properties.items.title,
|
|
67
|
+
properties: pro,
|
|
68
|
+
required: req,
|
|
69
|
+
rules,
|
|
70
|
+
}
|
|
71
|
+
delete s.schema.definitions[editProperties.ref.$name]['properties'];
|
|
72
|
+
delete s.schema.definitions[editProperties.ref.$name]['required'];
|
|
73
|
+
} else {
|
|
74
|
+
delete s.schema.definitions[editProperties.ref.$name]['items'];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const properties_type = properties.items ? properties.items.type : properties.type;
|
|
78
|
+
const editProperties_type = editProperties.ref.items ? editProperties.ref.items.type : editProperties.ref.type;
|
|
79
|
+
|
|
80
|
+
const editProperties_format = editProperties.ref.items ? editProperties.ref.items.format : editProperties.ref.format;
|
|
81
|
+
const properties_format = properties.items ? properties.items.format : properties.format;
|
|
82
|
+
|
|
83
|
+
// 内部规则 修改了类型 清空规则
|
|
84
|
+
if (editProperties_type !== properties_type || editProperties_format !== properties_format) {
|
|
85
|
+
const obj = s.schema.definitions[editProperties.ref.$name]
|
|
86
|
+
if (obj.items) {
|
|
87
|
+
obj.items.rules = [];
|
|
88
|
+
} else {
|
|
89
|
+
obj.rules = [];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
s.schema = { ...s.schema };
|
|
94
94
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
import GreyReactBox from 'grey-react-box';
|
|
3
|
-
import DocumentsEditControllerState from './DocumentsEditControllerState';
|
|
4
|
-
import addProperties from './actions/addProperties';
|
|
5
|
-
import editProperties from './actions/editProperties';
|
|
6
|
-
import delProperties from './actions/delProperties';
|
|
7
|
-
|
|
8
|
-
export default class DocumentsEditController extends GreyReactBox<DocumentsEditControllerState> {
|
|
9
|
-
constructor(state = new DocumentsEditControllerState()) {
|
|
10
|
-
super(state);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/** 添加属性字段 */
|
|
14
|
-
addProperties = this.pipeline(addProperties);
|
|
15
|
-
|
|
16
|
-
/** 编辑属性字段 */
|
|
17
|
-
editProperties = this.pipeline(editProperties);
|
|
18
|
-
|
|
19
|
-
/** 删除属性字段 */
|
|
20
|
-
delProperties = this.pipeline(delProperties);
|
|
21
|
-
}
|
|
1
|
+
|
|
2
|
+
import GreyReactBox from 'grey-react-box';
|
|
3
|
+
import DocumentsEditControllerState from './DocumentsEditControllerState';
|
|
4
|
+
import addProperties from './actions/addProperties';
|
|
5
|
+
import editProperties from './actions/editProperties';
|
|
6
|
+
import delProperties from './actions/delProperties';
|
|
7
|
+
|
|
8
|
+
export default class DocumentsEditController extends GreyReactBox<DocumentsEditControllerState> {
|
|
9
|
+
constructor(state = new DocumentsEditControllerState()) {
|
|
10
|
+
super(state);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** 添加属性字段 */
|
|
14
|
+
addProperties = this.pipeline(addProperties);
|
|
15
|
+
|
|
16
|
+
/** 编辑属性字段 */
|
|
17
|
+
editProperties = this.pipeline(editProperties);
|
|
18
|
+
|
|
19
|
+
/** 删除属性字段 */
|
|
20
|
+
delProperties = this.pipeline(delProperties);
|
|
21
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DocumentsEdit } from '../../../';
|
|
3
|
-
|
|
4
|
-
export default () => {
|
|
5
|
-
return (
|
|
6
|
-
<div style={{ height: 800 }} >
|
|
7
|
-
<DocumentsEdit />
|
|
8
|
-
</div>
|
|
9
|
-
);
|
|
10
|
-
};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DocumentsEdit } from '../../../';
|
|
3
|
+
|
|
4
|
+
export default () => {
|
|
5
|
+
return (
|
|
6
|
+
<div style={{ height: 800 }} >
|
|
7
|
+
<DocumentsEdit />
|
|
8
|
+
</div>
|
|
9
|
+
);
|
|
10
|
+
};
|