ronds-metadata 1.2.37 → 1.2.38

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
+ };
@@ -17,7 +17,7 @@ import _Input from "antd/es/input";
17
17
  /*
18
18
  * @Author: wangxian
19
19
  * @Date: 2021-09-18 14:15:04
20
- * @LastEditTime: 2023-04-04 09:20:39
20
+ * @LastEditTime: 2023-04-27 18:56:50
21
21
  */
22
22
  import React from 'react';
23
23
  import { UploadOutlined } from '@ant-design/icons';
@@ -91,12 +91,16 @@ function Index(props) {
91
91
  });
92
92
 
93
93
  case 'datePicker':
94
- return /*#__PURE__*/React.createElement(_DatePicker, {
95
- showTime: true,
96
- format: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.format) || DEFAULT_DATE_FORMAT,
97
- disabled: (_extraInfo$disabled4 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled4 !== void 0 ? _extraInfo$disabled4 : disabled,
98
- placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
99
- });
94
+ return (
95
+ /*#__PURE__*/
96
+ // @ts-ignore
97
+ React.createElement(_DatePicker, {
98
+ showTime: true,
99
+ format: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.format) || DEFAULT_DATE_FORMAT,
100
+ disabled: (_extraInfo$disabled4 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled4 !== void 0 ? _extraInfo$disabled4 : disabled,
101
+ placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
102
+ })
103
+ );
100
104
 
101
105
  case 'upload':
102
106
  return /*#__PURE__*/React.createElement(_Upload, null, /*#__PURE__*/React.createElement(_Button, {
@@ -38,7 +38,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
38
38
  /*
39
39
  * @Author:wangxian
40
40
  * @Date: 2021-09-18 14:15:04
41
- * @LastEditTime: 2023-04-03 15:47:01
41
+ * @LastEditTime: 2023-04-28 10:25:33
42
42
  */
43
43
  import React from 'react';
44
44
  import { MetadataFormContext, MetadataRefContext } from '../interface';
@@ -48,7 +48,7 @@ import { deepClone } from '../../../utils';
48
48
  import { useAsyncMemo } from '../../../framework/hooks/use-async-memo';
49
49
  import { tr } from '../../../framework/locale';
50
50
  import useObservable from '../../../framework/rxjs-hooks/useObservable';
51
- import { assign } from '../utils';
51
+ import { assignReplace } from '../utils';
52
52
 
53
53
  function Index(props) {
54
54
  var _extraInfo$http8, _extraInfo$http9, _extraInfo$http10, _extraInfo$http11, _extraInfo$http12, _extraInfo$http13;
@@ -142,7 +142,7 @@ function Index(props) {
142
142
  if (_changeData && !(p === null || p === void 0 ? void 0 : (_p$payload = p.payload) === null || _p$payload === void 0 ? void 0 : _p$payload.trigger)) {
143
143
  setTimeout(function () {
144
144
  var v = {};
145
- assign(name, undefined, v);
145
+ assignReplace(name, undefined, v);
146
146
  formContext.form.setFieldsValue(_objectSpread({}, v));
147
147
  }, 100);
148
148
  }
@@ -176,7 +176,7 @@ function Index(props) {
176
176
  setWatchValue(_objectSpread({}, watchValueRef.current));
177
177
  setTimeout(function () {
178
178
  var v = {};
179
- assign(name, undefined, v);
179
+ assignReplace(name, undefined, v);
180
180
  formContext.form.setFieldsValue(_objectSpread({}, v));
181
181
  }, 100);
182
182
  }
@@ -14,7 +14,7 @@ import { JsonMetadataProvider } from '../../../../framework/metadata';
14
14
  import Editable from '../../../../comps/Editable';
15
15
  import useObservable from '../../../../framework/rxjs-hooks/useObservable';
16
16
  import { MetadataFormContext } from '../../interface';
17
- import { assign, getLabelByProps } from '../../utils';
17
+ import { assignReplace, getLabelByProps } from '../../utils';
18
18
  import { deepClone, getConstantValue } from '../../../../utils';
19
19
  import { STREAM_EVENT_TYPE } from '../../constants';
20
20
 
@@ -104,10 +104,10 @@ var TableArray = function TableArray(props) {
104
104
 
105
105
  var _allVals = form.getFieldsValue();
106
106
 
107
- assign(name, _objectSpread({
107
+ assignReplace(name, _objectSpread({
108
108
  rowIdx: p === null || p === void 0 ? void 0 : (_p$payload2 = p.payload) === null || _p$payload2 === void 0 ? void 0 : _p$payload2.rowIdx
109
109
  }, p.payload.values), _val2);
110
- assign(name, _toConsumableArray(listRef.current), _allVals);
110
+ assignReplace(name, _toConsumableArray(listRef.current), _allVals);
111
111
  formContext.stream$.next({
112
112
  type: STREAM_EVENT_TYPE.ON_VALUES_CHANGE,
113
113
  payload: {
@@ -377,11 +377,11 @@ var TableArray = function TableArray(props) {
377
377
  form.setFieldsValue(_objectSpread({}, _defineProperty({}, "".concat(name), values)));
378
378
  } else {
379
379
  var val = {};
380
- assign(name, _toConsumableArray(values), val);
380
+ assignReplace(name, _toConsumableArray(values), val);
381
381
 
382
382
  var _allVals2 = form.getFieldsValue();
383
383
 
384
- assign(name, _toConsumableArray(values), _allVals2);
384
+ assignReplace(name, _toConsumableArray(values), _allVals2);
385
385
  formContext.stream$.next({
386
386
  type: STREAM_EVENT_TYPE.ON_VALUES_CHANGE,
387
387
  payload: {
@@ -1,41 +1,41 @@
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-select-tree-indent {
31
- .ant-select-tree-indent-unit {
32
- width: 10px !important;
33
- }
34
- }
35
-
36
- /* .ant-col-2.7 {
37
- display: block;
38
- flex: 0 0 75%;
39
- max-width: 75%;
40
- } */
41
- }
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-select-tree-indent {
31
+ .ant-select-tree-indent-unit {
32
+ width: 10px !important;
33
+ }
34
+ }
35
+
36
+ /* .ant-col-2.7 {
37
+ display: block;
38
+ flex: 0 0 75%;
39
+ max-width: 75%;
40
+ } */
41
+ }
@@ -14,3 +14,4 @@ export declare function getDataCell(item: any, options: IFormOptions, colSpan: n
14
14
  export declare function renderForm(schemaRef: any[], options: IFormOptions, colSpan?: number): JSX.Element;
15
15
  export declare function getLabelByProps(data: any): any;
16
16
  export declare function assign(pathArr: string[], val: any, obj: any): void;
17
+ export declare function assignReplace(pathArr: string[], val: any, obj: any): void;
@@ -7,7 +7,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
7
7
  /*
8
8
  * @Author: wangxian
9
9
  * @Date: 2021-09-18 14:15:04
10
- * @LastEditTime: 2023-04-24 11:25:12
10
+ * @LastEditTime: 2023-04-28 10:22:47
11
11
  */
12
12
  import React from 'react';
13
13
  import Input from './DataCell/Input';
@@ -113,6 +113,18 @@ export function assign(pathArr, val, obj) {
113
113
  }
114
114
  }
115
115
 
116
+ return cur[key];
117
+ }, obj);
118
+ }
119
+ export function assignReplace(pathArr, val, obj) {
120
+ var len = pathArr.length - 1;
121
+ pathArr.reduce(function (cur, key, index) {
122
+ if (index === len) {
123
+ cur[key] = val;
124
+ } else {
125
+ cur[key] = {};
126
+ }
127
+
116
128
  return cur[key];
117
129
  }, obj);
118
130
  }
@@ -31,22 +31,26 @@ var Index = function Index(props) {
31
31
  onDrag = props.onDrag,
32
32
  onDragStart = props.onDragStart,
33
33
  onDragEnd = props.onDragEnd;
34
- return /*#__PURE__*/React.createElement(Split, {
35
- className: classNames('split-panel', className),
36
- dragInterval: dragInterval,
37
- gutterSize: gutterSize,
38
- sizes: sizes,
39
- minSize: minSize,
40
- direction: direction,
41
- style: style,
42
- cursor: cursor,
43
- gutter: gutter,
44
- elementStyle: elementStyle,
45
- gutterStyle: gutterStyle,
46
- onDrag: onDrag,
47
- onDragStart: onDragStart,
48
- onDragEnd: onDragEnd
49
- }, children);
34
+ return (
35
+ /*#__PURE__*/
36
+ // @ts-ignore
37
+ React.createElement(Split, {
38
+ className: classNames('split-panel', className),
39
+ dragInterval: dragInterval,
40
+ gutterSize: gutterSize,
41
+ sizes: sizes,
42
+ minSize: minSize,
43
+ direction: direction,
44
+ style: style,
45
+ cursor: cursor,
46
+ gutter: gutter,
47
+ elementStyle: elementStyle,
48
+ gutterStyle: gutterStyle,
49
+ onDrag: onDrag,
50
+ onDragStart: onDragStart,
51
+ onDragEnd: onDragEnd
52
+ }, children)
53
+ );
50
54
  };
51
55
 
52
56
  export default Index;
@@ -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
+ }