ronds-metadata 1.0.24 → 1.0.28

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/es/api/index.js CHANGED
@@ -36,7 +36,7 @@ var Api = /*#__PURE__*/function () {
36
36
  size: 30
37
37
  }
38
38
  };
39
- url = "/metadata/list";
39
+ url = "/metamgt-web/metadata/list";
40
40
  _context.next = 4;
41
41
  return http.post(url, param);
42
42
 
@@ -73,7 +73,7 @@ var Api = /*#__PURE__*/function () {
73
73
  while (1) {
74
74
  switch (_context2.prev = _context2.next) {
75
75
  case 0:
76
- url = "/metadata/".concat(metadataId);
76
+ url = "/metamgt-web/metadata/".concat(metadataId);
77
77
  _context2.next = 3;
78
78
  return http.get(url);
79
79
 
@@ -112,7 +112,7 @@ var Api = /*#__PURE__*/function () {
112
112
  tags: [metadataTag],
113
113
  permission: 'public'
114
114
  };
115
- url = "/metadata";
115
+ url = "/metamgt-web/metadata/add";
116
116
  _context3.next = 4;
117
117
  return http.post(url, param);
118
118
 
@@ -69,7 +69,7 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
69
69
 
70
70
  for (var i = 0; i < _fields.length; i++) {
71
71
  if (_fields[i].type === 'ref') {
72
- _fields[i].value = refValues[i];
72
+ _fields[i].value = refValues[i] || _fields[i].value;
73
73
  }
74
74
  }
75
75
 
@@ -206,8 +206,8 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
206
206
  }, /*#__PURE__*/React.createElement(MetadataForm, {
207
207
  initialValues: defaultValues && defaultValues.length > 0 && ((_defaultValues$index = defaultValues[index]) === null || _defaultValues$index === void 0 ? void 0 : _defaultValues$index.value),
208
208
  refId: refIds[index],
209
- onValuesChange: function onValuesChange(values) {
210
- onRefRulesValuesChange(values, index);
209
+ onValuesChange: function onValuesChange(values, allValues) {
210
+ onRefRulesValuesChange(allValues, index);
211
211
  }
212
212
  })));
213
213
  }), /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Button, {
@@ -16,6 +16,7 @@ import React from 'react';
16
16
  import { MinusCircleOutlined, PlusOutlined, ReloadOutlined } from '@ant-design/icons';
17
17
  import { ARRAY_TYPES_OPTIONS, BASIC_TYPES_OPTIONS, NUMBER_FORMAT_OPTIONS } from '../constant';
18
18
  import { useMetaType } from '../hooks';
19
+ import { guid } from '../../../utils';
19
20
 
20
21
  var MetaPropsEdit = function MetaPropsEdit(props) {
21
22
  var form = props.form,
@@ -52,7 +53,7 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
52
53
  remove = _ref.remove;
53
54
  return /*#__PURE__*/React.createElement(React.Fragment, null, fields.map(function (field, index) {
54
55
  return /*#__PURE__*/React.createElement("div", {
55
- key: field.key
56
+ key: guid()
56
57
  }, /*#__PURE__*/React.createElement("div", {
57
58
  style: {
58
59
  display: 'flex',
@@ -42,6 +42,12 @@ var MetadataEdit = function MetadataEdit(props) {
42
42
  metaSchema = _React$useState4[0],
43
43
  setMetaSchema = _React$useState4[1];
44
44
 
45
+ var metaSchemaRef = React.useRef({
46
+ id: '',
47
+ type: 'object'
48
+ });
49
+ var firstLoadRef = React.useRef(true);
50
+
45
51
  var _React$useState5 = React.useState(false),
46
52
  _React$useState6 = _slicedToArray(_React$useState5, 2),
47
53
  isFields = _React$useState6[0],
@@ -66,15 +72,17 @@ var MetadataEdit = function MetadataEdit(props) {
66
72
  });
67
73
  }, [form]);
68
74
  React.useEffect(function () {
69
- if (initialValues) {
75
+ if (initialValues && firstLoadRef.current) {
70
76
  form.setFieldsValue(_objectSpread({}, initialValues));
71
77
  setMetaSchema(_objectSpread({}, initialValues));
78
+ metaSchemaRef.current = initialValues;
72
79
  processFileds(initialValues);
80
+ firstLoadRef.current = false;
73
81
  }
74
82
  }, [form, initialValues]);
75
83
 
76
84
  var onMyFinish = function onMyFinish(values) {
77
- var _metaSchema = metaSchema;
85
+ var _metaSchema = metaSchemaRef.current;
78
86
  _metaSchema.id = values.id;
79
87
  _metaSchema.type = values.type;
80
88
 
@@ -93,6 +101,7 @@ var MetadataEdit = function MetadataEdit(props) {
93
101
  }
94
102
 
95
103
  setMetaSchema(_objectSpread({}, _metaSchema));
104
+ metaSchemaRef.current = _metaSchema;
96
105
  onFinish && onFinish(JSON.stringify(_metaSchema));
97
106
  };
98
107
 
@@ -112,8 +121,7 @@ var MetadataEdit = function MetadataEdit(props) {
112
121
  return;
113
122
  }
114
123
 
115
- var _properties = form.getFieldValue('properties');
116
-
124
+ var _properties = metaSchemaRef.current.properties;
117
125
  var _curFields = _properties[index];
118
126
 
119
127
  if (_curFields && _curFields.id) {
@@ -87,7 +87,6 @@ function Index(props) {
87
87
  case 'datePicker':
88
88
  return /*#__PURE__*/React.createElement(_DatePicker, {
89
89
  showTime: true,
90
- format: "YYYY-MM-DD HH:mm:ss",
91
90
  disabled: (_extraInfo$disabled4 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled4 !== void 0 ? _extraInfo$disabled4 : disabled,
92
91
  placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
93
92
  });
@@ -1,5 +1,16 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
3
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
+
5
+ /*
6
+ * @Author: your name
7
+ * @Date: 2021-09-18 14:15:04
8
+ * @LastEditTime: 2021-12-03 16:00:13
9
+ * @LastEditors: Please set LastEditors
10
+ * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
11
+ * @FilePath: \ronds.metadata\src\comps\MetadataForm\hooks\index.tsx
12
+ */
13
+ import moment from 'moment';
3
14
  import React from 'react';
4
15
  export var useGetExtraInfo = function useGetExtraInfo(fields, id, form) {
5
16
  var _React$useState = React.useState({}),
@@ -17,6 +28,11 @@ export var useGetExtraInfo = function useGetExtraInfo(fields, id, form) {
17
28
 
18
29
  for (var k in extraInfo) {
19
30
  _extraInfo[k] = extraInfo[k];
31
+ }
32
+
33
+ // 时间格式转化
34
+ if (_extraInfo.type === 'datePicker' && form.getFieldValue(id)) {
35
+ form.setFieldsValue(_defineProperty({}, id, moment(form.getFieldValue(id), 'YYYY-MM-DD HH:mm:ss')));
20
36
  } // 暂时注释加载默认值
21
37
  // if (_extraInfo?.defaultValue) {
22
38
  // form.setFieldsValue({ [id]: _extraInfo?.defaultValue });
package/es/config.js CHANGED
@@ -3,7 +3,7 @@ var defaultConfig = {
3
3
  locale: 'zh-CN',
4
4
  msgpack: false,
5
5
  openLoading: true,
6
- baseUrl: '/api/datamanagerplatform/v1'
6
+ baseUrl: '/phm'
7
7
  };
8
8
  var config = defaultConfig;
9
9
  /** 设置配置 */
package/es/index.d.ts CHANGED
@@ -3,4 +3,5 @@ export { default as MetadataForm } from './comps/MetadataForm';
3
3
  export { default as JsonView } from './comps/JsonView';
4
4
  export { default as JsonEdit } from './comps/JsonEdit';
5
5
  export * from './framework/metadata/index';
6
+ export { default as http, addInterceptor } from './framework/http/index';
6
7
  export { registerMetadataAPI } from './framework/metadata/MetadataService';
package/es/index.js CHANGED
@@ -1,6 +1,14 @@
1
+ /*
2
+ * @Author:wangxian
3
+ * @Date: 2021-09-18 14:15:04
4
+ * @LastEditTime: 2021-12-14 09:08:16
5
+ * @LastEditors: wangxain
6
+ * @FilePath: \ronds.metadata\src\index.ts
7
+ */
1
8
  export { default as MetadataEdit } from './comps/MetadataEdit';
2
9
  export { default as MetadataForm } from './comps/MetadataForm';
3
10
  export { default as JsonView } from './comps/JsonView';
4
11
  export { default as JsonEdit } from './comps/JsonEdit';
5
12
  export * from './framework/metadata/index';
13
+ export { default as http, addInterceptor } from './framework/http/index';
6
14
  export { registerMetadataAPI } from './framework/metadata/MetadataService';
package/es/utils.d.ts CHANGED
@@ -12,3 +12,4 @@ export declare function useDebounce(fn: Function, delay: number, dep?: Dependenc
12
12
  */
13
13
  export declare function useThrottle(fn: Function, delay: number, dep?: DependencyList): (...args: any[]) => void;
14
14
  export declare function deepClone<T = any>(target: T): T;
15
+ export declare function guid(): string;
package/es/utils.js CHANGED
@@ -1,3 +1,11 @@
1
+ /*
2
+ * @Author: your name
3
+ * @Date: 2021-09-18 14:15:04
4
+ * @LastEditTime: 2021-12-22 14:10:34
5
+ * @LastEditors: your name
6
+ * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
7
+ * @FilePath: \ronds.metadata\src\utils.ts
8
+ */
1
9
  import { useCallback, useEffect, useRef } from 'react';
2
10
  /** 防抖 */
3
11
 
@@ -78,4 +86,23 @@ export function useThrottle(fn, delay) {
78
86
  }
79
87
  export function deepClone(target) {
80
88
  return JSON.parse(JSON.stringify(target));
89
+ }
90
+ export function guid() {
91
+ var id = '',
92
+ i,
93
+ random,
94
+ chars = 'abcdef';
95
+ id += chars[Math.floor(Math.random() * Math.floor(chars.length))];
96
+
97
+ for (i = 1; i < 32; i++) {
98
+ random = Math.random() * 16 | 0;
99
+
100
+ if (i == 8 || i == 12 || i == 16 || i == 20) {
101
+ id += '-';
102
+ }
103
+
104
+ id += (i == 12 ? 4 : i == 16 ? random & 3 | 8 : random).toString(16);
105
+ }
106
+
107
+ return id;
81
108
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.0.24",
4
+ "version": "1.0.28",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",