kts-components-document-access-point 1.3.25 → 1.3.26

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.
Files changed (121) hide show
  1. package/.editorconfig +16 -16
  2. package/.fatherrc.ts +4 -4
  3. package/.prettierignore +7 -7
  4. package/.prettierrc +11 -11
  5. package/.umirc.ts +11 -11
  6. package/README.md +3 -3
  7. package/dist/index.esm.js +2 -13
  8. package/dist/index.js +2 -13
  9. package/docs/index.md +3 -3
  10. package/docs-dist/404.html +38 -38
  11. package/docs-dist/index.html +38 -38
  12. package/docs-dist/umi.css +10 -10
  13. package/index.html +12 -12
  14. package/package.json +56 -56
  15. package/src/DocumentWhiteList/___demo___/base/index.tsx +7 -7
  16. package/src/DocumentWhiteList/___demo___/setService/index.tsx +23 -23
  17. package/src/DocumentWhiteList/control/actions/addblack/index.ts +14 -14
  18. package/src/DocumentWhiteList/control/actions/addwhite/index.ts +14 -14
  19. package/src/DocumentWhiteList/control/actions/blacklist/index.ts +22 -22
  20. package/src/DocumentWhiteList/control/actions/checkclient/index.ts +14 -14
  21. package/src/DocumentWhiteList/control/actions/demo/index.ts +4 -4
  22. package/src/DocumentWhiteList/control/actions/didilist/index.ts +18 -18
  23. package/src/DocumentWhiteList/control/actions/enableblacklist/index.ts +17 -17
  24. package/src/DocumentWhiteList/control/actions/enablelist/index.ts +18 -18
  25. package/src/DocumentWhiteList/control/actions/enablewhitelist/index.ts +17 -17
  26. package/src/DocumentWhiteList/control/actions/getmode/index.ts +14 -14
  27. package/src/DocumentWhiteList/control/actions/setmode/index.ts +14 -14
  28. package/src/DocumentWhiteList/control/actions/synclist/index.ts +19 -19
  29. package/src/DocumentWhiteList/control/actions/whitelist/index.ts +22 -22
  30. package/src/DocumentWhiteList/control/index.tsx +42 -42
  31. package/src/DocumentWhiteList/control/state/index.ts +47 -47
  32. package/src/DocumentWhiteList/index.md +5 -5
  33. package/src/DocumentWhiteList/index.tsx +40 -40
  34. package/src/DocumentWhiteList/interface/index.ts +30 -30
  35. package/src/DocumentWhiteList/ui/clientmodal/index.tsx +190 -190
  36. package/src/DocumentWhiteList/ui/main/black.tsx +132 -132
  37. package/src/DocumentWhiteList/ui/main/index.tsx +49 -49
  38. package/src/DocumentWhiteList/ui/main/switchmode.tsx +52 -52
  39. package/src/DocumentWhiteList/ui/main/white.tsx +120 -120
  40. package/src/DocumentWhiteList/ui/pageheader/BlackHeader.tsx +143 -143
  41. package/src/DocumentWhiteList/ui/pageheader/WhiteHeader.tsx +152 -152
  42. package/src/DocumentWhiteList/ui/pageui/index.tsx +64 -64
  43. package/src/DocumentWhiteList/ui/whitemodal/index.tsx +146 -146
  44. package/src/DocumentWhiteList/util/ConfigEnum.ts +8 -8
  45. package/src/DocumentsCont/___demo___/base/index.tsx +7 -7
  46. package/src/DocumentsCont/___demo___/setService/index.tsx +25 -25
  47. package/src/DocumentsCont/index.md +9 -9
  48. package/src/DocumentsCont/index.tsx +51 -51
  49. package/src/DocumentsDemo/Controller/index.tsx +14 -14
  50. package/src/DocumentsDemo/Controller/whitelist.ts +22 -22
  51. package/src/DocumentsDemo/Text.tsx +22 -22
  52. package/src/DocumentsDemo/___demo___/base/index.tsx +7 -7
  53. package/src/DocumentsDemo/index.md +6 -6
  54. package/src/DocumentsDemo/index.tsx +38 -38
  55. package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/IProperties/index.ts +69 -69
  56. package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/IRules/index.ts +18 -18
  57. package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/ISchema/index.ts +14 -14
  58. package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/PropertyTableState/index.ts +12 -12
  59. package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/RuleState/index.ts +336 -336
  60. package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/index.ts +51 -51
  61. package/src/DocumentsEdit/DocumentsEditController/actions/addProperties/index.ts +37 -37
  62. package/src/DocumentsEdit/DocumentsEditController/actions/delProperties/index.ts +48 -48
  63. package/src/DocumentsEdit/DocumentsEditController/actions/editProperties/index.ts +78 -78
  64. package/src/DocumentsEdit/DocumentsEditController/index.tsx +21 -21
  65. package/src/DocumentsEdit/___demo___/conventional/index.tsx +10 -10
  66. package/src/DocumentsEdit/___demo___/monitor/index.tsx +73 -73
  67. package/src/DocumentsEdit/___demo___/readOnly/index.tsx +16 -16
  68. package/src/DocumentsEdit/constant/propertyColumns/index.tsx +65 -65
  69. package/src/DocumentsEdit/index.less +45 -45
  70. package/src/DocumentsEdit/index.md +10 -10
  71. package/src/DocumentsEdit/index.tsx +117 -117
  72. package/src/DocumentsEdit/tools/index.ts +88 -88
  73. package/src/DocumentsEdit/ui/AddPropertyButton/index.tsx +238 -250
  74. package/src/DocumentsEdit/ui/Breadcrumb/index.tsx +51 -51
  75. package/src/DocumentsEdit/ui/EditProperty/index.tsx +290 -290
  76. package/src/DocumentsEdit/ui/EditRule/index.tsx +156 -156
  77. package/src/DocumentsEdit/ui/EditRule/ui/AddRuleButton/index.tsx +49 -49
  78. package/src/DocumentsEdit/ui/EditRule/ui/DelRuleButton/index.tsx +31 -31
  79. package/src/DocumentsEdit/ui/EditRule/ui/RuleForm/fn/algorithmFormComponent/index.tsx +142 -142
  80. package/src/DocumentsEdit/ui/EditRule/ui/RuleForm/index.tsx +154 -154
  81. package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/index.less +4 -4
  82. package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/index.tsx +70 -68
  83. package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/ui/AddChildPropertyButton/index.tsx +34 -34
  84. package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/ui/AddRuleButton/index.tsx +64 -64
  85. package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/ui/EditPropertyButton/index.tsx +31 -31
  86. package/src/DocumentsEdit/ui/PropertyTable/index.less +19 -19
  87. package/src/DocumentsEdit/ui/PropertyTable/index.tsx +18 -18
  88. package/src/DocumentsEdit/ui/RefPropertyButton/index.tsx +121 -121
  89. package/src/DocumentsList/DocumentsListController/DocumentsListControllerState/index.ts +55 -55
  90. package/src/DocumentsList/DocumentsListController/actions/demo/index.ts +4 -4
  91. package/src/DocumentsList/DocumentsListController/actions/typelist/index.ts +15 -15
  92. package/src/DocumentsList/DocumentsListController/index.tsx +16 -16
  93. package/src/DocumentsList/___demo___/list/index.tsx +4 -4
  94. package/src/DocumentsList/index.less +22 -22
  95. package/src/DocumentsList/index.md +3 -3
  96. package/src/DocumentsList/index.tsx +46 -46
  97. package/src/DocumentsList/ui/ModalComfirm/index.tsx +92 -92
  98. package/src/DocumentsList/ui/PageHeader/SendHeader.tsx +230 -230
  99. package/src/DocumentsList/ui/PageHeader/index.tsx +325 -325
  100. package/src/DocumentsList/ui/PageUI/index.tsx +65 -65
  101. package/src/DocumentsList/ui/RuleTable/index.tsx +163 -163
  102. package/src/DocumentsList/ui/sendlist/index.tsx +151 -151
  103. package/src/DocumentsList/util/ConfigEnum.ts +11 -11
  104. package/src/DocumentsRule/control/actions/batchsend/index.ts +13 -13
  105. package/src/DocumentsRule/control/actions/configsave/index.ts +14 -14
  106. package/src/DocumentsRule/control/actions/configupdate/index.ts +13 -13
  107. package/src/DocumentsRule/control/actions/getconfigbyid/index.ts +14 -14
  108. package/src/DocumentsRule/control/actions/getrecordbyid/index.ts +14 -14
  109. package/src/DocumentsRule/control/actions/gettemplate/index.ts +15 -15
  110. package/src/DocumentsRule/control/actions/listbysubjectid/index.ts +13 -13
  111. package/src/DocumentsRule/control/actions/typelist/index.ts +13 -13
  112. package/src/DocumentsRule/control/index.tsx +30 -30
  113. package/src/DocumentsRule/control/state/index.ts +42 -42
  114. package/src/DocumentsRule/index.md +1 -1
  115. package/src/DocumentsRule/index.tsx +25 -25
  116. package/src/DocumentsRule/interface/index.ts +28 -28
  117. package/src/DocumentsRule/ui/main/index.tsx +357 -357
  118. package/src/DocumentsService/index.ts +18 -18
  119. package/src/index.ts +9 -9
  120. package/tsconfig.json +29 -29
  121. package/typings.d.ts +3 -3
@@ -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,79 +1,79 @@
1
- import IProperties from '../../DocumentsEditControllerState/IProperties';
2
- import DocumentsEditControllerState from '../../DocumentsEditControllerState';
3
- import * as tools from '../../../tools';
4
-
5
- export default async (s: DocumentsEditControllerState, options: any) => {
6
- if (!options) return;
7
-
8
- const { editProperties, properties } = options;
9
- const current = options.current.properties ? options.current : options.current.items;
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
- const pro = (() => {
29
- if (editProperties.ref.items) {
30
- return editProperties.ref.items.properties;
31
- } else {
32
- return editProperties.ref.properties;
33
- }
34
- })()
35
-
36
- const rules = (editProperties.ref.items ? editProperties.ref.items.rules : editProperties.ref.rules) || [];
37
-
38
- // 设置数据
39
- s.schema.definitions[editProperties.ref.$name] = {
40
- ...editProperties.ref,
41
- type: properties.type,
42
- format: properties.format,
43
- rules: properties.items ? properties.rules : rules,
44
- properties: pro,
45
- };
46
-
47
- // 是否数组
48
- if (properties.items) {
49
- s.schema.definitions[editProperties.ref.$name].rules = properties.rules;
50
- s.schema.definitions[editProperties.ref.$name]['items'] = {
51
- ...editProperties.ref.items,
52
- type: properties.items.type,
53
- format: properties.items.format,
54
- title: properties.items.title,
55
- properties: pro,
56
- rules,
57
- }
58
- } else {
59
- delete s.schema.definitions[editProperties.ref.$name]['items']
60
- }
61
-
62
- const properties_type = properties.items ? properties.items.type : properties.type;
63
- const editProperties_type = editProperties.ref.items ? editProperties.ref.items.type : editProperties.ref.type;
64
-
65
- const editProperties_format = editProperties.ref.items ? editProperties.ref.items.format : editProperties.ref.format;
66
- const properties_format = properties.items ? properties.items.format : properties.format;
67
-
68
- // 内部规则 修改了类型 清空规则
69
- if (editProperties_type !== properties_type || editProperties_format !== properties_format) {
70
- const obj = s.schema.definitions[editProperties.ref.$name]
71
- if (obj.items) {
72
- obj.items.rules = [];
73
- } else {
74
- obj.rules = [];
75
- }
76
- }
77
-
78
- s.schema = { ...s.schema };
1
+ import IProperties from '../../DocumentsEditControllerState/IProperties';
2
+ import DocumentsEditControllerState from '../../DocumentsEditControllerState';
3
+ import * as tools from '../../../tools';
4
+
5
+ export default async (s: DocumentsEditControllerState, options: any) => {
6
+ if (!options) return;
7
+
8
+ const { editProperties, properties } = options;
9
+ const current = options.current.properties ? options.current : options.current.items;
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
+ const pro = (() => {
29
+ if (editProperties.ref.items) {
30
+ return editProperties.ref.items.properties;
31
+ } else {
32
+ return editProperties.ref.properties;
33
+ }
34
+ })()
35
+
36
+ const rules = (editProperties.ref.items ? editProperties.ref.items.rules : editProperties.ref.rules) || [];
37
+
38
+ // 设置数据
39
+ s.schema.definitions[editProperties.ref.$name] = {
40
+ ...editProperties.ref,
41
+ type: properties.type,
42
+ format: properties.format,
43
+ rules: properties.items ? properties.rules : rules,
44
+ properties: pro,
45
+ };
46
+
47
+ // 是否数组
48
+ if (properties.items) {
49
+ s.schema.definitions[editProperties.ref.$name].rules = properties.rules;
50
+ s.schema.definitions[editProperties.ref.$name]['items'] = {
51
+ ...editProperties.ref.items,
52
+ type: properties.items.type,
53
+ format: properties.items.format,
54
+ title: properties.items.title,
55
+ properties: pro,
56
+ rules,
57
+ }
58
+ } else {
59
+ delete s.schema.definitions[editProperties.ref.$name]['items']
60
+ }
61
+
62
+ const properties_type = properties.items ? properties.items.type : properties.type;
63
+ const editProperties_type = editProperties.ref.items ? editProperties.ref.items.type : editProperties.ref.type;
64
+
65
+ const editProperties_format = editProperties.ref.items ? editProperties.ref.items.format : editProperties.ref.format;
66
+ const properties_format = properties.items ? properties.items.format : properties.format;
67
+
68
+ // 内部规则 修改了类型 清空规则
69
+ if (editProperties_type !== properties_type || editProperties_format !== properties_format) {
70
+ const obj = s.schema.definitions[editProperties.ref.$name]
71
+ if (obj.items) {
72
+ obj.items.rules = [];
73
+ } else {
74
+ obj.rules = [];
75
+ }
76
+ }
77
+
78
+ s.schema = { ...s.schema };
79
79
  }
@@ -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
+ };
@@ -1,74 +1,74 @@
1
-
2
- import ISchema from '../../DocumentsEditController/DocumentsEditControllerState/ISchema';
3
- import React from 'react';
4
- import { DocumentsEdit } from '../../../';
5
- import { Button } from 'kts-components-antd-x4';
6
-
7
- const { createSchema } = DocumentsEdit;
8
-
9
- export default () => {
10
-
11
- const [schema, setScheme] = React.useState<any>();
12
-
13
- const onChange = React.useCallback((schema: ISchema) => {
14
- setScheme(schema)
15
- console.log('===> onChange', schema);
16
- }, [])
17
-
18
- return (
19
- <div>
20
- <Button onClick={() => { setScheme(demo) }} >更新文档</Button>
21
- {schema && <DocumentsEdit
22
- schema={schema} // 初始化文档
23
- onChange={onChange} // 文档变化事件
24
- />}
25
- </div>
26
- );
27
- };
28
-
29
- const demo = {
30
- "$schema": "",
31
- "$id": "",
32
- "$createTime": 0,
33
- "$count": 0,
34
- "$name": "schema",
35
- "type": "object",
36
- "title": "对账单",
37
- "definitions": {
38
- "8ce2b492-f7f3-47fe-b6cf-1eb2efad6cf6": {
39
- "$id": "#/definitions/8ce2b492-f7f3-47fe-b6cf-1eb2efad6cf6",
40
- "$count": 1,
41
- "$name": "8ce2b492-f7f3-47fe-b6cf-1eb2efad6cf6",
42
- "$createTime": 1634006471799,
43
- "title": "测试",
44
- "type": "string",
45
- "description": "11",
46
- "rules": [
47
- {
48
- "_index": 1,
49
- "name": "规则",
50
- "message": "规则",
51
- "checkType": "control",
52
- "algorithm": "enumString",
53
- "enum": [
54
- "11",
55
- "11",
56
- "11"
57
- ]
58
- }
59
- ]
60
- }
61
- },
62
- "properties": {
63
- "tst": {
64
- "alias": "测试",
65
- "detailed": "11",
66
- "$ref": "#/definitions/8ce2b492-f7f3-47fe-b6cf-1eb2efad6cf6",
67
- "$refName": "8ce2b492-f7f3-47fe-b6cf-1eb2efad6cf6",
68
- "$canDel": true
69
- }
70
- },
71
- "required": [
72
- "tst"
73
- ]
1
+
2
+ import ISchema from '../../DocumentsEditController/DocumentsEditControllerState/ISchema';
3
+ import React from 'react';
4
+ import { DocumentsEdit } from '../../../';
5
+ import { Button } from 'kts-components-antd-x4';
6
+
7
+ const { createSchema } = DocumentsEdit;
8
+
9
+ export default () => {
10
+
11
+ const [schema, setScheme] = React.useState<any>();
12
+
13
+ const onChange = React.useCallback((schema: ISchema) => {
14
+ setScheme(schema)
15
+ console.log('===> onChange', schema);
16
+ }, [])
17
+
18
+ return (
19
+ <div>
20
+ <Button onClick={() => { setScheme(demo) }} >更新文档</Button>
21
+ {schema && <DocumentsEdit
22
+ schema={schema} // 初始化文档
23
+ onChange={onChange} // 文档变化事件
24
+ />}
25
+ </div>
26
+ );
27
+ };
28
+
29
+ const demo = {
30
+ "$schema": "",
31
+ "$id": "",
32
+ "$createTime": 0,
33
+ "$count": 0,
34
+ "$name": "schema",
35
+ "type": "object",
36
+ "title": "对账单",
37
+ "definitions": {
38
+ "8ce2b492-f7f3-47fe-b6cf-1eb2efad6cf6": {
39
+ "$id": "#/definitions/8ce2b492-f7f3-47fe-b6cf-1eb2efad6cf6",
40
+ "$count": 1,
41
+ "$name": "8ce2b492-f7f3-47fe-b6cf-1eb2efad6cf6",
42
+ "$createTime": 1634006471799,
43
+ "title": "测试",
44
+ "type": "string",
45
+ "description": "11",
46
+ "rules": [
47
+ {
48
+ "_index": 1,
49
+ "name": "规则",
50
+ "message": "规则",
51
+ "checkType": "control",
52
+ "algorithm": "enumString",
53
+ "enum": [
54
+ "11",
55
+ "11",
56
+ "11"
57
+ ]
58
+ }
59
+ ]
60
+ }
61
+ },
62
+ "properties": {
63
+ "tst": {
64
+ "alias": "测试",
65
+ "detailed": "11",
66
+ "$ref": "#/definitions/8ce2b492-f7f3-47fe-b6cf-1eb2efad6cf6",
67
+ "$refName": "8ce2b492-f7f3-47fe-b6cf-1eb2efad6cf6",
68
+ "$canDel": true
69
+ }
70
+ },
71
+ "required": [
72
+ "tst"
73
+ ]
74
74
  }