ronds-metadata 1.2.14 → 1.2.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,10 @@
1
- .metadata-edit {
2
- height: 100%;
3
- width: 100%;
4
- .ant-row {
5
- display: block;
6
- }
7
- .pr-10 {
8
- padding-right: 10px;
9
- }
10
- }
1
+ .metadata-edit {
2
+ height: 100%;
3
+ width: 100%;
4
+ .ant-row {
5
+ display: block;
6
+ }
7
+ .pr-10 {
8
+ padding-right: 10px;
9
+ }
10
+ }
@@ -1,20 +1,20 @@
1
- export interface IMetaFileds {
2
- id: string;
3
- type: 'object';
4
- properties: any[];
5
- value: any;
6
- }
7
-
8
- export type ITypeStatus = 'object' | 'ref' | 'bool' | 'number' | 'text' | 'enum' | 'array';
9
-
10
- export type IMetaProperty = {
11
- /**
12
- * 属性的名称
13
- */
14
- id: string;
15
- /**
16
- * 类型
17
- */
18
- type: string;
19
- enum?: any[];
20
- };
1
+ export interface IMetaFileds {
2
+ id: string;
3
+ type: 'object';
4
+ properties: any[];
5
+ value: any;
6
+ }
7
+
8
+ export type ITypeStatus = 'object' | 'ref' | 'bool' | 'number' | 'text' | 'enum' | 'array';
9
+
10
+ export type IMetaProperty = {
11
+ /**
12
+ * 属性的名称
13
+ */
14
+ id: string;
15
+ /**
16
+ * 类型
17
+ */
18
+ type: string;
19
+ enum?: any[];
20
+ };
@@ -32,7 +32,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
32
32
  /*
33
33
  * @Author:wangxian
34
34
  * @Date: 2021-09-18 14:15:04
35
- * @LastEditTime: 2023-02-28 10:19:57
35
+ * @LastEditTime: 2023-03-06 14:43:01
36
36
  */
37
37
  import React from 'react';
38
38
  import { MetadataFormContext, MetadataRefContext } from '../interface';
@@ -198,7 +198,7 @@ function Index(props) {
198
198
  totalRef.current = res === null || res === void 0 ? void 0 : res.total;
199
199
 
200
200
  if (!(_res && _res.length > 0)) {
201
- _context.next = 15;
201
+ _context.next = 17;
202
202
  break;
203
203
  }
204
204
 
@@ -210,6 +210,14 @@ function Index(props) {
210
210
  return _context.abrupt("return", _res);
211
211
 
212
212
  case 12:
213
+ if (!(http === null || http === void 0 ? void 0 : http.isGroup)) {
214
+ _context.next = 14;
215
+ break;
216
+ }
217
+
218
+ return _context.abrupt("return", _res);
219
+
220
+ case 14:
213
221
  return _context.abrupt("return", _res.map(function (it) {
214
222
  if (http === null || http === void 0 ? void 0 : http.isCascader) {
215
223
  return {
@@ -226,11 +234,11 @@ function Index(props) {
226
234
  }
227
235
  }));
228
236
 
229
- case 15:
237
+ case 17:
230
238
  console.warn("".concat(_url, " is not return success result"));
231
239
  return _context.abrupt("return", []);
232
240
 
233
- case 17:
241
+ case 19:
234
242
  case "end":
235
243
  return _context.stop();
236
244
  }
@@ -481,7 +489,9 @@ function Index(props) {
481
489
  },
482
490
  allowClear: true,
483
491
  onChange: onSelectChange,
484
- maxTagCount: "responsive"
492
+ maxTagCount: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.maxTagCount,
493
+ maxTagTextLength: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.maxTagTextLength) || 9,
494
+ maxTagPlaceholder: "..."
485
495
  });
486
496
  }
487
497
  };
@@ -22,7 +22,7 @@ export function withAddOnAfter(WrappedComponent) {
22
22
  name = _props$name === void 0 ? [] : _props$name,
23
23
  isObj = props.isObj;
24
24
  var formContext = React.useContext(MetadataFormContext) || {};
25
- var depend = useWatchDepend(fields && ((_fields$ = fields[0]) === null || _fields$ === void 0 ? void 0 : (_fields$$value = _fields$.value) === null || _fields$$value === void 0 ? void 0 : (_fields$$value$common = _fields$$value.common) === null || _fields$$value$common === void 0 ? void 0 : _fields$$value$common.depend), formContext === null || formContext === void 0 ? void 0 : formContext.stream$);
25
+ var depend = useWatchDepend(fields && ((_fields$ = fields[0]) === null || _fields$ === void 0 ? void 0 : (_fields$$value = _fields$.value) === null || _fields$$value === void 0 ? void 0 : (_fields$$value$common = _fields$$value.common) === null || _fields$$value$common === void 0 ? void 0 : _fields$$value$common.depend), formContext === null || formContext === void 0 ? void 0 : formContext.stream$, name);
26
26
 
27
27
  var _React$useState = React.useState(),
28
28
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -1,35 +1,35 @@
1
- .with-add-on-after {
2
- --card-bg: #ffffff;
3
- position: relative;
4
- width: 100%;
5
-
6
- .ant-form-item-label {
7
- padding: 0 !important;
8
- }
9
-
10
- & > .ant-form-item {
11
- padding: 0 0 8px !important;
12
- flex: 1;
13
- }
14
- &-extra {
15
- position: absolute;
16
- right: 20px;
17
- top: 18px;
18
- padding: 0 6px;
19
- background-color: var(--card-bg);
20
- z-index: 1000;
21
- }
22
- &-ref {
23
- position: absolute;
24
- right: 20px;
25
- top: -10px;
26
- padding: 0 6px;
27
- background-color: var(--card-bg);
28
- z-index: 1000;
29
- }
30
- /* .ant-col-2.7 {
31
- display: block;
32
- flex: 0 0 75%;
33
- max-width: 75%;
34
- } */
35
- }
1
+ .with-add-on-after {
2
+ --card-bg: #ffffff;
3
+ position: relative;
4
+ width: 100%;
5
+
6
+ .ant-form-item-label {
7
+ padding: 0 !important;
8
+ }
9
+
10
+ & > .ant-form-item {
11
+ padding: 0 0 8px !important;
12
+ flex: 1;
13
+ }
14
+ &-extra {
15
+ position: absolute;
16
+ right: 20px;
17
+ top: 18px;
18
+ padding: 0 6px;
19
+ background-color: var(--card-bg);
20
+ z-index: 1000;
21
+ }
22
+ &-ref {
23
+ position: absolute;
24
+ right: 20px;
25
+ top: -10px;
26
+ padding: 0 6px;
27
+ background-color: var(--card-bg);
28
+ z-index: 1000;
29
+ }
30
+ /* .ant-col-2.7 {
31
+ display: block;
32
+ flex: 0 0 75%;
33
+ max-width: 75%;
34
+ } */
35
+ }
@@ -1,3 +1,3 @@
1
1
  import { IFiledDepend } from '../interface';
2
2
  export declare const useGetExtraInfo: (fields: any, id: string, form: any, type: string) => any;
3
- export declare const useWatchDepend: (_depends: IFiledDepend, stream$: any) => any;
3
+ export declare const useWatchDepend: (_depends: IFiledDepend, stream$: any, name: string[]) => any;
@@ -5,7 +5,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
5
  /*
6
6
  * @Author: your name
7
7
  * @Date: 2021-09-18 14:15:04
8
- * @LastEditTime: 2023-02-28 11:03:50
8
+ * @LastEditTime: 2023-02-28 15:38:07
9
9
  */
10
10
  import { getLocale } from '../../../framework/locale';
11
11
  import moment from 'moment';
@@ -57,7 +57,7 @@ export var useGetExtraInfo = function useGetExtraInfo(fields, id, form, type) {
57
57
  return extra;
58
58
  }; // 处理depend联动
59
59
 
60
- export var useWatchDepend = function useWatchDepend(_depends, stream$) {
60
+ export var useWatchDepend = function useWatchDepend(_depends, stream$, name) {
61
61
  var _React$useState3 = React.useState({}),
62
62
  _React$useState4 = _slicedToArray(_React$useState3, 2),
63
63
  depends = _React$useState4[0],
@@ -71,7 +71,7 @@ export var useWatchDepend = function useWatchDepend(_depends, stream$) {
71
71
  if (_depends === null || _depends === void 0 ? void 0 : _depends.hidden) {
72
72
  var _p$payload;
73
73
 
74
- var _hidden = processDependHiddenOrShow(_depends === null || _depends === void 0 ? void 0 : _depends.hidden, p === null || p === void 0 ? void 0 : (_p$payload = p.payload) === null || _p$payload === void 0 ? void 0 : _p$payload.allVals, stream$);
74
+ var _hidden = processDependHiddenOrShow(_depends === null || _depends === void 0 ? void 0 : _depends.hidden, p === null || p === void 0 ? void 0 : (_p$payload = p.payload) === null || _p$payload === void 0 ? void 0 : _p$payload.allVals, stream$, name);
75
75
 
76
76
  var _dr = dependsRef.current;
77
77
  _dr.hidden = _hidden;
@@ -82,7 +82,7 @@ export var useWatchDepend = function useWatchDepend(_depends, stream$) {
82
82
  if (_depends === null || _depends === void 0 ? void 0 : _depends.show) {
83
83
  var _p$payload2;
84
84
 
85
- var _show = processDependHiddenOrShow(_depends === null || _depends === void 0 ? void 0 : _depends.show, p === null || p === void 0 ? void 0 : (_p$payload2 = p.payload) === null || _p$payload2 === void 0 ? void 0 : _p$payload2.allVals, stream$);
85
+ var _show = processDependHiddenOrShow(_depends === null || _depends === void 0 ? void 0 : _depends.show, p === null || p === void 0 ? void 0 : (_p$payload2 = p.payload) === null || _p$payload2 === void 0 ? void 0 : _p$payload2.allVals, stream$, name);
86
86
 
87
87
  var _dr2 = dependsRef.current;
88
88
  _dr2.show = _show;
@@ -93,7 +93,7 @@ export var useWatchDepend = function useWatchDepend(_depends, stream$) {
93
93
  if (_depends === null || _depends === void 0 ? void 0 : _depends.notRequire) {
94
94
  var _p$payload3;
95
95
 
96
- var _show2 = processDependHiddenOrShow(_depends === null || _depends === void 0 ? void 0 : _depends.notRequire, p === null || p === void 0 ? void 0 : (_p$payload3 = p.payload) === null || _p$payload3 === void 0 ? void 0 : _p$payload3.allVals, stream$);
96
+ var _show2 = processDependHiddenOrShow(_depends === null || _depends === void 0 ? void 0 : _depends.notRequire, p === null || p === void 0 ? void 0 : (_p$payload3 = p.payload) === null || _p$payload3 === void 0 ? void 0 : _p$payload3.allVals, stream$, name);
97
97
 
98
98
  var _dr3 = dependsRef.current;
99
99
  _dr3.notRequire = _show2;
@@ -107,7 +107,7 @@ export var useWatchDepend = function useWatchDepend(_depends, stream$) {
107
107
  return depends;
108
108
  };
109
109
 
110
- var processDependHiddenOrShow = function processDependHiddenOrShow(depend, changeData, stream$) {
110
+ var processDependHiddenOrShow = function processDependHiddenOrShow(depend, changeData, stream$, name) {
111
111
  try {
112
112
  // const regex = /\w+(\.\w+)?[=<>!]{1}/g;
113
113
  var regex = /\w+(\.\w+)?[=<>!]{1}|\w+(\.\w+)?(\.indexOf\('.+'\)[=<>!]{1})/g;
@@ -124,8 +124,16 @@ var processDependHiddenOrShow = function processDependHiddenOrShow(depend, chang
124
124
 
125
125
  var _key = key.split('.');
126
126
 
127
- if (changeData[_key[0]] || changeData[_key[0]] === 0) {
128
- var r = key === _key[0] ? "'".concat(changeData[_key[0]], "'") : eval("changeData[_key[0]].".concat(_key[1]));
127
+ var evalString = 'changeData';
128
+
129
+ for (var _i = 0; _i < name.length; _i++) {
130
+ evalString = "".concat(evalString, "[name[").concat(_i, "]]");
131
+ }
132
+
133
+ var _changeData = eval("".concat(evalString, "['").concat(_key[0], "']"));
134
+
135
+ if (_changeData || _changeData === 0) {
136
+ var r = key === _key[0] ? "'".concat(_changeData, "'") : eval("_changeData.".concat(_key[1]));
129
137
  expression = expression.replace(key, r);
130
138
  } else {
131
139
  expression = expression.replace(key, undefined);
@@ -1,98 +1,98 @@
1
- /*
2
- * @Author: wangxian
3
- * @Date: 2021-09-18 14:15:04
4
- * @LastEditTime: 2023-02-09 18:37:15
5
- */
6
- export type IMetaType = 'object' | 'ref' | 'bool' | 'number' | 'text' | 'enum' | 'array' | string;
7
-
8
- export type IMetaData = {
9
- /**
10
- * 类名称/属性名称
11
- */
12
- id: string;
13
- /**
14
- * 类型
15
- */
16
- type: IMetaType;
17
- /**
18
- * 属性
19
- */
20
- properties?: IMetaProperties[];
21
-
22
- /**
23
- * 引用id
24
- */
25
- refId?: string;
26
- /**
27
- * 静态的变量
28
- */
29
- fields?: IMetaFileds[];
30
- /**
31
- * 内部类
32
- */
33
- types?: IMetaData[];
34
- };
35
-
36
- export type IMetaProperties = {
37
- /**
38
- * 类规则名称
39
- */
40
- id: string;
41
-
42
- /**
43
- * 类型
44
- */
45
- type: IMetaType;
46
-
47
- /**
48
- * 引用id
49
- */
50
- refId?: string;
51
- /**
52
- * 静态的变量
53
- */
54
- fields?: IMetaFileds[];
55
- /**
56
- * 枚举值
57
- */
58
- enum?: { value: string }[];
59
- /**
60
- * 数组类型
61
- */
62
- items?: { type: IMetaType; refId?: string };
63
- };
64
-
65
- export type IMetaFileds = {
66
- /**
67
- * 规则名称
68
- */
69
- id: string;
70
-
71
- /**
72
- * 类型
73
- */
74
- type: IMetaType;
75
-
76
- /**
77
- * 引用id
78
- */
79
- refId?: string;
80
-
81
- /**
82
- * 规则值
83
- */
84
- value: any;
85
- };
86
-
87
- export interface IAPI {
88
- // 获取元数据列表
89
- GetMetadataList(keyWords?: string[]): Promise<{ id: string; name: string; schema: string }[]>;
90
- // 通过元数据Id获取元数据详情
91
- GetMetadataDetailById(metadataId: string): Promise<any>;
92
- // 新增元数据
93
- SaveMetadata(data: any, metadataTag: string): Promise<any>;
94
- // 获取元数据的值
95
- GetMetadataObjList(data: any): Promise<any[]>;
96
- /** 通过扩展规则获取枚举类型的值 */
97
- GetEnumDataByUrl(url: string, method: 'get' | 'post', body: any): Promise<any>;
98
- }
1
+ /*
2
+ * @Author: wangxian
3
+ * @Date: 2021-09-18 14:15:04
4
+ * @LastEditTime: 2023-02-09 18:37:15
5
+ */
6
+ export type IMetaType = 'object' | 'ref' | 'bool' | 'number' | 'text' | 'enum' | 'array' | string;
7
+
8
+ export type IMetaData = {
9
+ /**
10
+ * 类名称/属性名称
11
+ */
12
+ id: string;
13
+ /**
14
+ * 类型
15
+ */
16
+ type: IMetaType;
17
+ /**
18
+ * 属性
19
+ */
20
+ properties?: IMetaProperties[];
21
+
22
+ /**
23
+ * 引用id
24
+ */
25
+ refId?: string;
26
+ /**
27
+ * 静态的变量
28
+ */
29
+ fields?: IMetaFileds[];
30
+ /**
31
+ * 内部类
32
+ */
33
+ types?: IMetaData[];
34
+ };
35
+
36
+ export type IMetaProperties = {
37
+ /**
38
+ * 类规则名称
39
+ */
40
+ id: string;
41
+
42
+ /**
43
+ * 类型
44
+ */
45
+ type: IMetaType;
46
+
47
+ /**
48
+ * 引用id
49
+ */
50
+ refId?: string;
51
+ /**
52
+ * 静态的变量
53
+ */
54
+ fields?: IMetaFileds[];
55
+ /**
56
+ * 枚举值
57
+ */
58
+ enum?: { value: string }[];
59
+ /**
60
+ * 数组类型
61
+ */
62
+ items?: { type: IMetaType; refId?: string };
63
+ };
64
+
65
+ export type IMetaFileds = {
66
+ /**
67
+ * 规则名称
68
+ */
69
+ id: string;
70
+
71
+ /**
72
+ * 类型
73
+ */
74
+ type: IMetaType;
75
+
76
+ /**
77
+ * 引用id
78
+ */
79
+ refId?: string;
80
+
81
+ /**
82
+ * 规则值
83
+ */
84
+ value: any;
85
+ };
86
+
87
+ export interface IAPI {
88
+ // 获取元数据列表
89
+ GetMetadataList(keyWords?: string[]): Promise<{ id: string; name: string; schema: string }[]>;
90
+ // 通过元数据Id获取元数据详情
91
+ GetMetadataDetailById(metadataId: string): Promise<any>;
92
+ // 新增元数据
93
+ SaveMetadata(data: any, metadataTag: string): Promise<any>;
94
+ // 获取元数据的值
95
+ GetMetadataObjList(data: any): Promise<any[]>;
96
+ /** 通过扩展规则获取枚举类型的值 */
97
+ GetEnumDataByUrl(url: string, method: 'get' | 'post', body: any): Promise<any>;
98
+ }
package/es/theme.less CHANGED
@@ -1,77 +1,77 @@
1
- .ronds-metadata-dark {
2
- --ronds-metadata-color-border-1: #314162;
3
- --ronds-metadata-color-border-2: #0d9af3;
4
- --ronds-metadata-color-bg-2: #0d1f40;
5
- --ronds-metadata-color-bg-3: #0d1f40;
6
- --ronds-metadata-color-bg-4: #1c3771;
7
- --ronds-metadata-color-text-1: #ffffff;
8
- --ronds-metadata-color-text-2: #ffffff;
9
- --ronds-metadata-color-text-3: #ffffff;
10
-
11
- ::-webkit-scrollbar {
12
- width: 6px;
13
- height: 6px;
14
- overflow: auto;
15
- }
16
- ::-webkit-scrollbar-corner {
17
- background-color: transparent;
18
- color: transparent;
19
- }
20
-
21
- ::-webkit-scrollbar-thumb {
22
- box-shadow: inset 0 0 5px var(--scrollbar-bg-color);
23
- background: var(--scrollbar-color);
24
- min-height: 25px;
25
- min-width: 25px;
26
- border-radius: 3px;
27
-
28
- &:hover {
29
- border-radius: 2px;
30
- // box-shadow: inset 0 0 5px var(--scrollbar-color-hover);
31
- background: var(--scrollbar-color-hover);
32
- }
33
-
34
- &:active {
35
- // box-shadow: inset 0 0 5px var(--scrollbar-bg-color);
36
- background: var(--scrollbar-color-hover);
37
- }
38
- }
39
- }
40
-
41
- .ronds-metadata-normal {
42
- --ronds-metadata-color-border-1: #d9d9d9;
43
- --ronds-metadata-color-border-2: #165dff;
44
- --ronds-metadata-color-bg-2: rgba(229, 238, 255, 0.85);
45
- --ronds-metadata-color-bg-3: #f6f5f6;
46
- --ronds-metadata-color-bg-4: #ffffff;
47
- --ronds-metadata-color-text-1: #1d2129;
48
- --ronds-metadata-color-text-2: #24292f;
49
- --ronds-metadata-color-text-3: #f2f3f5;
50
-
51
- ::-webkit-scrollbar {
52
- width: 6px;
53
- height: 6px;
54
- overflow: auto;
55
- }
56
-
57
- ::-webkit-scrollbar-thumb {
58
- background-color: var(--scrollbar-color);
59
- min-height: 25px;
60
- min-width: 25px;
61
- border-radius: 3px;
62
-
63
- &:hover {
64
- background-color: #a8a8a8;
65
- }
66
-
67
- &:active {
68
- background-color: #787878;
69
- }
70
-
71
- /* border: 1px solid #e0e0e0; */
72
- }
73
-
74
- ::-webkit-scrollbar-track {
75
- background-color: #f7f7f7;
76
- }
77
- }
1
+ .ronds-metadata-dark {
2
+ --ronds-metadata-color-border-1: #314162;
3
+ --ronds-metadata-color-border-2: #0d9af3;
4
+ --ronds-metadata-color-bg-2: #0d1f40;
5
+ --ronds-metadata-color-bg-3: #0d1f40;
6
+ --ronds-metadata-color-bg-4: #1c3771;
7
+ --ronds-metadata-color-text-1: #ffffff;
8
+ --ronds-metadata-color-text-2: #ffffff;
9
+ --ronds-metadata-color-text-3: #ffffff;
10
+
11
+ ::-webkit-scrollbar {
12
+ width: 6px;
13
+ height: 6px;
14
+ overflow: auto;
15
+ }
16
+ ::-webkit-scrollbar-corner {
17
+ background-color: transparent;
18
+ color: transparent;
19
+ }
20
+
21
+ ::-webkit-scrollbar-thumb {
22
+ box-shadow: inset 0 0 5px var(--scrollbar-bg-color);
23
+ background: var(--scrollbar-color);
24
+ min-height: 25px;
25
+ min-width: 25px;
26
+ border-radius: 3px;
27
+
28
+ &:hover {
29
+ border-radius: 2px;
30
+ // box-shadow: inset 0 0 5px var(--scrollbar-color-hover);
31
+ background: var(--scrollbar-color-hover);
32
+ }
33
+
34
+ &:active {
35
+ // box-shadow: inset 0 0 5px var(--scrollbar-bg-color);
36
+ background: var(--scrollbar-color-hover);
37
+ }
38
+ }
39
+ }
40
+
41
+ .ronds-metadata-normal {
42
+ --ronds-metadata-color-border-1: #d9d9d9;
43
+ --ronds-metadata-color-border-2: #165dff;
44
+ --ronds-metadata-color-bg-2: rgba(229, 238, 255, 0.85);
45
+ --ronds-metadata-color-bg-3: #f6f5f6;
46
+ --ronds-metadata-color-bg-4: #ffffff;
47
+ --ronds-metadata-color-text-1: #1d2129;
48
+ --ronds-metadata-color-text-2: #24292f;
49
+ --ronds-metadata-color-text-3: #f2f3f5;
50
+
51
+ ::-webkit-scrollbar {
52
+ width: 6px;
53
+ height: 6px;
54
+ overflow: auto;
55
+ }
56
+
57
+ ::-webkit-scrollbar-thumb {
58
+ background-color: var(--scrollbar-color);
59
+ min-height: 25px;
60
+ min-width: 25px;
61
+ border-radius: 3px;
62
+
63
+ &:hover {
64
+ background-color: #a8a8a8;
65
+ }
66
+
67
+ &:active {
68
+ background-color: #787878;
69
+ }
70
+
71
+ /* border: 1px solid #e0e0e0; */
72
+ }
73
+
74
+ ::-webkit-scrollbar-track {
75
+ background-color: #f7f7f7;
76
+ }
77
+ }