ronds-metadata 1.2.1 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,41 +1,41 @@
1
- pre {
2
- margin: 0;
3
- font-weight: 900;
4
- font-size: 14px;
5
- }
6
- .string {
7
- color: #3ab54a;
8
- }
9
- .number {
10
- color: #25aae2;
11
- }
12
- .boolean {
13
- color: #f98280;
14
- }
15
- .null {
16
- color: #f1592a;
17
- }
18
- .width-10 {
19
- width: 10px;
20
- }
21
- .key {
22
- color: #92278f;
23
- }
24
- .open {
25
- display: inline-block;
26
- width: 12px;
27
- height: 12px;
28
- background: url('./icon/close.png') no-repeat;
29
- background-size: 100% 100%;
30
- vertical-align: middle;
31
- cursor: pointer;
32
- }
33
- .close {
34
- display: inline-block;
35
- width: 12px;
36
- height: 12px;
37
- background: url('./icon/open.png') no-repeat;
38
- background-size: 100% 100%;
39
- vertical-align: middle;
40
- cursor: pointer;
41
- }
1
+ pre {
2
+ margin: 0;
3
+ font-weight: 900;
4
+ font-size: 14px;
5
+ }
6
+ .string {
7
+ color: #3ab54a;
8
+ }
9
+ .number {
10
+ color: #25aae2;
11
+ }
12
+ .boolean {
13
+ color: #f98280;
14
+ }
15
+ .null {
16
+ color: #f1592a;
17
+ }
18
+ .width-10 {
19
+ width: 10px;
20
+ }
21
+ .key {
22
+ color: #92278f;
23
+ }
24
+ .open {
25
+ display: inline-block;
26
+ width: 12px;
27
+ height: 12px;
28
+ background: url('./icon/close.png') no-repeat;
29
+ background-size: 100% 100%;
30
+ vertical-align: middle;
31
+ cursor: pointer;
32
+ }
33
+ .close {
34
+ display: inline-block;
35
+ width: 12px;
36
+ height: 12px;
37
+ background: url('./icon/open.png') no-repeat;
38
+ background-size: 100% 100%;
39
+ vertical-align: middle;
40
+ cursor: pointer;
41
+ }
@@ -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
+ };
@@ -12,7 +12,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
12
12
  /*
13
13
  * @Author: wangxian
14
14
  * @Date: 2021-09-18 14:15:04
15
- * @LastEditTime: 2023-02-22 13:54:18
15
+ * @LastEditTime: 2023-02-22 16:38:00
16
16
  */
17
17
  import React from 'react';
18
18
  import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
@@ -30,6 +30,7 @@ function Index(props) {
30
30
  isRefForm = props.isRefForm,
31
31
  fieldRule = props.fields,
32
32
  colSpan = props.colSpan,
33
+ labelSpan = props.labelSpan,
33
34
  initEnumValue = props.initEnumValue,
34
35
  name = props.name,
35
36
  disabled = props.disabled;
@@ -72,15 +73,15 @@ function Index(props) {
72
73
  }
73
74
  }, [items]);
74
75
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, null, /*#__PURE__*/React.createElement(_Col, {
75
- span: (formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan) && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan : 24
76
+ span: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? labelSpan : 24
76
77
  }, !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.titleHidden) && /*#__PURE__*/React.createElement("div", {
77
78
  style: {
78
79
  position: 'relative',
79
80
  width: '100%',
80
- textAlign: "".concat((formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan) && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? 'right' : 'left')
81
+ textAlign: "".concat(labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? 'right' : 'left')
81
82
  }
82
83
  }, /*#__PURE__*/React.createElement("div", {
83
- className: "ant-form-item-label mt-1 "
84
+ className: "ant-form-item-label ant-form-item-label-wrap mt-1 "
84
85
  }, /*#__PURE__*/React.createElement("label", {
85
86
  className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
86
87
  }, extraInfo.label || fieldRule && ((_fieldRule$ = fieldRule[0]) === null || _fieldRule$ === void 0 ? void 0 : (_fieldRule$$value = _fieldRule$.value) === null || _fieldRule$$value === void 0 ? void 0 : _fieldRule$$value.label) || fieldRule && ((_fieldRule$2 = fieldRule[0]) === null || _fieldRule$2 === void 0 ? void 0 : (_fieldRule$2$value = _fieldRule$2.value) === null || _fieldRule$2$value === void 0 ? void 0 : _fieldRule$2$value.common.label) || id)), formContext.isShowTypeInfo && /*#__PURE__*/React.createElement("div", {
@@ -92,7 +93,7 @@ function Index(props) {
92
93
  background: '#fff'
93
94
  }
94
95
  }, help || (items === null || items === void 0 ? void 0 : items.type)))), /*#__PURE__*/React.createElement(_Col, {
95
- span: (formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan) && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? 24 - (formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan) : 24
96
+ span: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? 24 - labelSpan : 24
96
97
  }, extraInfo.layout === 'table' && items.type === 'ref' ? /*#__PURE__*/React.createElement(TableArray, {
97
98
  initValue: formContext.initialValues,
98
99
  initEnumValue: initEnumValue,
@@ -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-02-21 19:15:22
20
+ * @LastEditTime: 2023-02-22 15:51:51
21
21
  */
22
22
  import React from 'react';
23
23
  import { UploadOutlined } from '@ant-design/icons';
@@ -32,6 +32,7 @@ function Index(props) {
32
32
  isRefForm = props.isRefForm,
33
33
  disabled = props.disabled,
34
34
  field = props.field,
35
+ labelSpan = props.labelSpan,
35
36
  name = props.name,
36
37
  isObj = props.isObj;
37
38
  var formContext = React.useContext(MetadataFormContext) || {};
@@ -156,6 +157,14 @@ function Index(props) {
156
157
  color: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color
157
158
  } : {}
158
159
  }, (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
160
+ labelCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
161
+ span: labelSpan,
162
+ offset: 0
163
+ } : undefined,
164
+ wrapperCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
165
+ span: 24 - labelSpan,
166
+ offset: 0
167
+ } : undefined,
159
168
  name: (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$addonAfter6 = extraInfo.addonAfter) === null || _extraInfo$addonAfter6 === void 0 ? void 0 : _extraInfo$addonAfter6.key) ? [].concat(_toConsumableArray(name), ['value']) : name,
160
169
  rules: [{
161
170
  required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
@@ -31,7 +31,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
31
31
  /*
32
32
  * @Author:wangxian
33
33
  * @Date: 2021-09-18 14:15:04
34
- * @LastEditTime: 2023-02-21 19:19:39
34
+ * @LastEditTime: 2023-02-23 09:58:36
35
35
  */
36
36
  import React from 'react';
37
37
  import { MetadataFormContext, MetadataRefContext } from '../interface';
@@ -88,73 +88,77 @@ function Index(props) {
88
88
  var _watch = extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$http = extraInfo.http) === null || _extraInfo$http === void 0 ? void 0 : _extraInfo$http.watch;
89
89
 
90
90
  if (_watch && (p === null || p === void 0 ? void 0 : p.type) === 'onValuesChange') {
91
- var _watchArr = _watch.split(',');
91
+ try {
92
+ var _watchArr = _watch.split(',');
92
93
 
93
- if (_watchArr.length === 1) {
94
- var evalString = '';
94
+ if (_watchArr.length === 1) {
95
+ var evalString = '';
95
96
 
96
- for (var i = 0; i < name.length; i++) {
97
- if (i < name.length - 1) {
98
- evalString = "".concat(evalString, "[name[").concat(i, "]]");
97
+ for (var i = 0; i < name.length; i++) {
98
+ if (i < name.length - 1) {
99
+ evalString = "".concat(evalString, "[name[").concat(i, "]]");
100
+ }
99
101
  }
100
- }
101
102
 
102
- var _value = eval("p?.payload?.allVals".concat(evalString, "[_watchArr[0]]"));
103
+ var _value = eval("p?.payload?.allVals".concat(evalString, "[_watchArr[0]]"));
103
104
 
104
- var _changeData = eval("p?.payload?.val".concat(evalString, "[_watchArr[0]]"));
105
+ var _changeData = eval("p?.payload?.val".concat(evalString, "[_watchArr[0]]"));
105
106
 
106
- if (_value && _changeData) {
107
- if ((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http.method) === 'post') {
108
- var _wRef = watchValueRef.current || {};
107
+ if (_value && _changeData) {
108
+ if ((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http.method) === 'post') {
109
+ var _wRef = watchValueRef.current || {};
109
110
 
110
- _wRef[_watchArr[0]] = _value;
111
- watchValueRef.current = _wRef;
112
- setWatchValue(_value);
113
- } else {
114
- setWatchValue(_value.toString());
115
- watchValueRef.current = _value;
111
+ _wRef[_watchArr[0]] = _value;
112
+ watchValueRef.current = _wRef;
113
+ setWatchValue(_value);
114
+ } else {
115
+ setWatchValue(_value.toString());
116
+ watchValueRef.current = _value;
117
+ }
116
118
  }
117
- }
118
119
 
119
- if (_changeData) {
120
- setTimeout(function () {
121
- var v = {};
122
- assign(name, undefined, v);
123
- formContext.form.setFieldsValue(_objectSpread({}, v));
124
- }, 100);
125
- }
126
- } else {
127
- var b = false;
120
+ if (_changeData) {
121
+ setTimeout(function () {
122
+ var v = {};
123
+ assign(name, undefined, v);
124
+ formContext.form.setFieldsValue(_objectSpread({}, v));
125
+ }, 100);
126
+ }
127
+ } else {
128
+ var b = false;
128
129
 
129
- for (var _i = 0; _i < _watchArr.length; _i++) {
130
- var w = _watchArr[_i];
131
- var _evalString = '';
130
+ for (var _i = 0; _i < _watchArr.length; _i++) {
131
+ var w = _watchArr[_i];
132
+ var _evalString = '';
132
133
 
133
- for (var _i2 = 0; _i2 < name.length; _i2++) {
134
- if (_i2 < name.length - 1) {
135
- _evalString = "".concat(_evalString, "[name[").concat(_i2, "]]");
134
+ for (var _i2 = 0; _i2 < name.length; _i2++) {
135
+ if (_i2 < name.length - 1) {
136
+ _evalString = "".concat(_evalString, "[name[").concat(_i2, "]]");
137
+ }
136
138
  }
137
- }
138
139
 
139
- var _value2 = eval("p?.payload?.allVals".concat(_evalString, "[w]"));
140
+ var _value2 = eval("p?.payload?.allVals".concat(_evalString, "[w]"));
140
141
 
141
- if (_value2) {
142
- var _wRef2 = watchValueRef.current || {};
142
+ if (_value2) {
143
+ var _wRef2 = watchValueRef.current || {};
143
144
 
144
- _wRef2[w] = _value2;
145
- watchValueRef.current = _wRef2;
146
- b = eval("p?.payload?.val".concat(_evalString, "[w]"));
145
+ _wRef2[w] = _value2;
146
+ watchValueRef.current = _wRef2;
147
+ b = eval("p?.payload?.val".concat(_evalString, "[w]"));
148
+ }
147
149
  }
148
- }
149
150
 
150
- if (b) {
151
- setWatchValue(_objectSpread({}, watchValueRef.current));
152
- setTimeout(function () {
153
- var v = {};
154
- assign(name, undefined, v);
155
- formContext.form.setFieldsValue(_objectSpread({}, v));
156
- }, 100);
151
+ if (b) {
152
+ setWatchValue(_objectSpread({}, watchValueRef.current));
153
+ setTimeout(function () {
154
+ var v = {};
155
+ assign(name, undefined, v);
156
+ formContext.form.setFieldsValue(_objectSpread({}, v));
157
+ }, 100);
158
+ }
157
159
  }
160
+ } catch (error) {
161
+ console.warn('watch:' + error);
158
162
  }
159
163
  }
160
164
  }, [formContext.stream$, extraInfo]);
@@ -1,5 +1,3 @@
1
- import "antd/es/form/style";
2
- import _Form from "antd/es/form";
3
1
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
2
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
5
3
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
@@ -325,11 +323,6 @@ var TableArray = function TableArray(props) {
325
323
  width: '100%',
326
324
  height: addButtonHidden || readonly ? "".concat(rowNumber * getCellHeight(readonly) + 45, "px") : "".concat(rowNumber * getCellHeight(readonly) + 45 + 40, "px")
327
325
  }
328
- }, /*#__PURE__*/React.createElement(_Form.Item, {
329
- name: name,
330
- style: {
331
- margin: 0
332
- }
333
326
  }, /*#__PURE__*/React.createElement(Editable, {
334
327
  type: "multiple",
335
328
  readonly: readonly,
@@ -350,7 +343,7 @@ var TableArray = function TableArray(props) {
350
343
  y: addButtonHidden || readonly ? "".concat(rowNumber * getCellHeight(readonly) + 45, "px ") : "".concat(rowNumber * getCellHeight(readonly), "px ")
351
344
  }
352
345
  }
353
- })));
346
+ }));
354
347
  };
355
348
 
356
349
  export default TableArray;
@@ -34,6 +34,21 @@ export function withAddOnAfter(WrappedComponent) {
34
34
  cellColSpan = _React$useState4[0],
35
35
  setCellColSpan = _React$useState4[1];
36
36
 
37
+ var labelSpan = React.useMemo(function () {
38
+ var _fields$0$value, _fields$0$value$commo;
39
+
40
+ var _labelSpan = formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan;
41
+
42
+ var _colSpan = fields && ((_fields$0$value = fields[0].value) === null || _fields$0$value === void 0 ? void 0 : (_fields$0$value$commo = _fields$0$value.common) === null || _fields$0$value$commo === void 0 ? void 0 : _fields$0$value$commo.colSpan);
43
+
44
+ var _formLabelSpan = formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan;
45
+
46
+ if (_colSpan && _formLabelSpan) {
47
+ _labelSpan = _formLabelSpan / _colSpan;
48
+ }
49
+
50
+ return _labelSpan;
51
+ }, [fields, formContext === null || formContext === void 0 ? void 0 : formContext.colSpan, formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan]);
37
52
  React.useEffect(function () {
38
53
  if (refId) {
39
54
  var arr = refId.split(':');
@@ -87,6 +102,7 @@ export function withAddOnAfter(WrappedComponent) {
87
102
  display: 'flex !important'
88
103
  },
89
104
  name: _name,
105
+ labelSpan: labelSpan,
90
106
  isObj: isObj
91
107
  })), isShowTypeInfo && !field && type !== 'number' && type !== 'bool' && /*#__PURE__*/React.createElement("div", {
92
108
  className: "with-add-on-after-extra"
@@ -236,7 +236,7 @@ var MetadataForm = function MetadataForm(props) {
236
236
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MetadataFormContext.Provider, {
237
237
  value: {
238
238
  fields: fields,
239
- colSpan: colSpan,
239
+ colSpan: (formFieldValue === null || formFieldValue === void 0 ? void 0 : formFieldValue.colSpan) || colSpan,
240
240
  labelSpan: myLabelSpan,
241
241
  layout: myLayout,
242
242
  form: form,
@@ -40,7 +40,8 @@ export interface IMetaFormProps {
40
40
  name?: string[];
41
41
  isObj?: boolean;
42
42
  refId?: string;
43
- colSpan: number;
43
+ colSpan?: number;
44
+ labelSpan?: number;
44
45
  enum?: {
45
46
  value: string;
46
47
  }[];
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author:wangxian
3
3
  * @Date: 2021-09-18 14:15:04
4
- * @LastEditTime: 2023-02-03 16:08:47
4
+ * @LastEditTime: 2023-02-22 15:51:59
5
5
  */
6
6
  import React from 'react';
7
7
  export var MetadataFormContext = /*#__PURE__*/React.createContext(null);
@@ -1,8 +1,8 @@
1
1
  @font-face {
2
2
  font-family: "fa"; /* Project id 2247093 */
3
- src: url('iconfont.woff2?t=1667906194044') format('woff2'),
4
- url('iconfont.woff?t=1667906194044') format('woff'),
5
- url('iconfont.ttf?t=1667906194044') format('truetype');
3
+ src: url('iconfont.woff2?t=1677113748870') format('woff2'),
4
+ url('iconfont.woff?t=1677113748870') format('woff'),
5
+ url('iconfont.ttf?t=1677113748870') format('truetype');
6
6
  }
7
7
 
8
8
  .fa {
@@ -13,6 +13,10 @@
13
13
  -moz-osx-font-smoothing: grayscale;
14
14
  }
15
15
 
16
+ .fa-Es:before {
17
+ content: "\e6a1";
18
+ }
19
+
16
20
  .fa-transform:before {
17
21
  content: "\ed70";
18
22
  }