ronds-metadata 1.0.90 → 1.0.91

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.
@@ -8,21 +8,15 @@ import "antd/es/button/style";
8
8
  import _Button from "antd/es/button";
9
9
  import "antd/es/date-picker/style";
10
10
  import _DatePicker from "antd/es/date-picker";
11
- import "antd/es/popover/style";
12
- import _Popover from "antd/es/popover";
13
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
14
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
15
11
  import "antd/es/input/style";
16
12
  import _Input from "antd/es/input";
17
13
 
18
14
  /*
19
15
  * @Author: wangxian
20
16
  * @Date: 2021-09-18 14:15:04
21
- * @LastEditTime: 2022-05-11 16:39:26
17
+ * @LastEditTime: 2022-05-16 09:24:21
22
18
  */
23
19
  import React from 'react';
24
- import { BgColorsOutlined } from '@ant-design/icons';
25
- import { SketchPicker } from 'react-color';
26
20
  import { UploadOutlined } from '@ant-design/icons';
27
21
  import { MetadataFormContext, MetadataRefContext } from '../interface';
28
22
  import { useGetExtraInfo } from '../hooks';
@@ -39,27 +33,6 @@ function Index(props) {
39
33
  var formRefContext = React.useContext(MetadataRefContext);
40
34
  var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form, props.type);
41
35
 
42
- var _React$useState = React.useState(''),
43
- _React$useState2 = _slicedToArray(_React$useState, 2),
44
- color = _React$useState2[0],
45
- setColor = _React$useState2[1];
46
-
47
- React.useEffect(function () {
48
- if ((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.type) === 'colorPicker') {
49
- setColor(formContext.form.getFieldValue(id));
50
- }
51
- }, [extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.type, formContext.form]);
52
-
53
- var onColorChange = function onColorChange(e) {
54
- formContext.form.setFieldsValue(_defineProperty({}, id, e.hex));
55
- setColor(e.hex);
56
- };
57
-
58
- var colorPicker = /*#__PURE__*/React.createElement(SketchPicker, {
59
- color: color,
60
- onChange: onColorChange
61
- });
62
-
63
36
  var processInputType = function processInputType(_type) {
64
37
  var _extraInfo$disabled, _extraInfo$disabled2, _extraInfo$disabled3, _extraInfo$disabled4, _extraInfo$disabled5;
65
38
 
@@ -78,22 +51,11 @@ function Index(props) {
78
51
  });
79
52
 
80
53
  case 'colorPicker':
81
- return /*#__PURE__*/React.createElement("div", {
82
- className: "flex relative"
83
- }, /*#__PURE__*/React.createElement(_Input, {
84
- value: color,
54
+ return /*#__PURE__*/React.createElement(_Input, {
55
+ type: "color",
85
56
  disabled: (_extraInfo$disabled3 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled3 !== void 0 ? _extraInfo$disabled3 : disabled,
86
57
  placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
87
- }), /*#__PURE__*/React.createElement("div", {
88
- style: {
89
- position: 'absolute',
90
- right: '5px',
91
- top: '5px',
92
- zIndex: 888
93
- }
94
- }, /*#__PURE__*/React.createElement(_Popover, {
95
- content: colorPicker
96
- }, /*#__PURE__*/React.createElement(BgColorsOutlined, null))));
58
+ });
97
59
 
98
60
  case 'datePicker':
99
61
  return /*#__PURE__*/React.createElement(_DatePicker, {
@@ -89,12 +89,14 @@ var TableArray = function TableArray(props) {
89
89
  dataIndex: it.id,
90
90
  width: 100,
91
91
  editable: true,
92
- type: it.type
93
- }; // 留一列不设宽度以适应弹性布局
94
-
95
- if (i === 0) {
96
- delete obj.width;
97
- }
92
+ type: it.type,
93
+ enum: it.type === 'enum' ? it.enum.map(function (v) {
94
+ return {
95
+ label: v.value,
96
+ value: v.value
97
+ };
98
+ }) : undefined
99
+ };
98
100
 
99
101
  _columns.push(obj);
100
102
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.0.90",
4
+ "version": "1.0.91",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",
@@ -45,7 +45,6 @@
45
45
  "markdown-it-emoji": "^2.0.0",
46
46
  "qs": "^6.10.1",
47
47
  "react": "^17.0.2",
48
- "react-color": "^2.19.3",
49
48
  "react-markdown-editor-lite": "^1.3.2",
50
49
  "react-popper": "^2.2.3",
51
50
  "rxjs": "^7.5.4"