ronds-metadata 1.0.44 → 1.0.47

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.
@@ -6,7 +6,7 @@ import _Input from "antd/es/input";
6
6
  /*
7
7
  * @Author: wangxian
8
8
  * @Date: 2022-03-04 14:53:50
9
- * @LastEditTime: 2022-03-09 11:13:21
9
+ * @LastEditTime: 2022-03-10 14:38:32
10
10
  */
11
11
  import React from 'react';
12
12
  import { EditableContext } from '../interface';
@@ -28,8 +28,10 @@ function Index(props) {
28
28
 
29
29
  if (((_editConfig$editCellK = editConfig.editCellKey) === null || _editConfig$editCellK === void 0 ? void 0 : _editConfig$editCellK.dataIndex) === dataIndex && ((_editConfig$editCellK2 = editConfig.editCellKey) === null || _editConfig$editCellK2 === void 0 ? void 0 : _editConfig$editCellK2.rowIndex) === rowIndex) {
30
30
  if (firstLoadRef.current) {
31
+ var _inputRef$current$sta, _inputRef$current$sta2;
32
+
31
33
  // 选中内容
32
- inputRef.current.input.setSelectionRange(0, inputRef.current.state.value.length);
34
+ inputRef.current.input.setSelectionRange(0, ((_inputRef$current$sta = inputRef.current.state) === null || _inputRef$current$sta === void 0 ? void 0 : (_inputRef$current$sta2 = _inputRef$current$sta.value) === null || _inputRef$current$sta2 === void 0 ? void 0 : _inputRef$current$sta2.length) || 0);
33
35
  firstLoadRef.current = false;
34
36
  } // 设置焦点
35
37
 
@@ -2,14 +2,15 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import "antd/es/message/style";
3
3
  import _message from "antd/es/message";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
- var _excluded = ["editable", "record", "editableType", "dataIndex", "rowIndex", "children"];
5
+ var _excluded = ["isAddColumn", "editable", "record", "editableType", "dataIndex", "rowIndex", "children"];
6
6
  import React from 'react';
7
7
  import { EditableContext } from '../interface';
8
8
  import { getDataCell, isFreeEditCell, isFreeEditRow } from '../utils';
9
9
  import "./index.css";
10
10
 
11
11
  var EditableCell = function EditableCell(props) {
12
- var editable = props.editable,
12
+ var isAddColumn = props.isAddColumn,
13
+ editable = props.editable,
13
14
  record = props.record,
14
15
  editableType = props.editableType,
15
16
  dataIndex = props.dataIndex,
@@ -19,13 +20,12 @@ var EditableCell = function EditableCell(props) {
19
20
 
20
21
  var _ref = React.useContext(EditableContext) || undefined,
21
22
  editableStream = _ref.editableStream,
22
- editConfig = _ref.editConfig;
23
+ editConfig = _ref.editConfig; // console.log('EditableCell', props, editConfig);
23
24
 
24
- var onCellDoubleClick = function onCellDoubleClick() {
25
- if (editConfig === null || editConfig === void 0 ? void 0 : editConfig.curRow) {
26
- var _editConfig$curRow;
27
25
 
28
- if (((_editConfig$curRow = editConfig.curRow) === null || _editConfig$curRow === void 0 ? void 0 : _editConfig$curRow.toString().split(',').indexOf("".concat(rowIndex))) > -1) return;
26
+ var onCellDoubleClick = function onCellDoubleClick() {
27
+ if ((editConfig === null || editConfig === void 0 ? void 0 : editConfig.curRow) && (editConfig === null || editConfig === void 0 ? void 0 : editConfig.curRow) !== 'undefined') {
28
+ if (isFreeEditRow(editConfig.curRow, rowIndex)) return;
29
29
 
30
30
  _message.warning('请先保存正在编辑的行');
31
31
 
@@ -51,20 +51,33 @@ var EditableCell = function EditableCell(props) {
51
51
  }
52
52
  });
53
53
  }
54
+
55
+ if (isAddColumn) {
56
+ editableStream.next({
57
+ type: 'editHeardCellKey',
58
+ payload: undefined
59
+ });
60
+ }
54
61
  };
55
62
 
56
63
  if (editableType === 'single') {
57
- return /*#__PURE__*/React.createElement("td", restProps, editable && editConfig.curRow === rowIndex ? getDataCell(props) : children);
64
+ return /*#__PURE__*/React.createElement("td", _extends({}, restProps, {
65
+ className: "ant-table-cell ".concat(isAddColumn && editConfig.editHeardCellKey === dataIndex ? 'border-right' : '', " ")
66
+ }), editable && editConfig.curRow === rowIndex ? getDataCell(props) : children);
58
67
  }
59
68
 
60
69
  if (editableType === 'freedom') {
61
70
  return /*#__PURE__*/React.createElement("td", _extends({
62
71
  onDoubleClick: onCellDoubleClick,
63
72
  onClick: onCellClick
64
- }, restProps), editable && (isFreeEditRow(editConfig.curRow, rowIndex) || isFreeEditCell(editConfig.editCellKey, dataIndex, rowIndex)) ? getDataCell(props) : children);
73
+ }, restProps, {
74
+ className: "ant-table-cell ".concat(isAddColumn && editConfig.editHeardCellKey === dataIndex ? 'border-right' : '', " ")
75
+ }), editable && (isFreeEditRow(editConfig.curRow, rowIndex) || isFreeEditCell(editConfig.editCellKey, dataIndex, rowIndex)) ? getDataCell(props) : children);
65
76
  }
66
77
 
67
- return /*#__PURE__*/React.createElement("td", restProps, editable ? getDataCell(props) : children);
78
+ return /*#__PURE__*/React.createElement("td", _extends({}, restProps, {
79
+ className: "ant-table-cell ".concat(isAddColumn && editConfig.editHeardCellKey === dataIndex ? 'border-right' : '', " ")
80
+ }), editable ? getDataCell(props) : children);
68
81
  };
69
82
 
70
83
  export default EditableCell;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { EditableHeardCellProps } from '../interface';
3
+ import './index.less';
4
+ declare const EditableHeardCell: React.FC<EditableHeardCellProps>;
5
+ export default EditableHeardCell;
@@ -0,0 +1,141 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import "antd/es/popover/style";
3
+ import _Popover from "antd/es/popover";
4
+ import "antd/es/button/style";
5
+ import _Button from "antd/es/button";
6
+ import "antd/es/input/style";
7
+ import _Input from "antd/es/input";
8
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
9
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
10
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
11
+ var _excluded = ["title", "dataIndex", "isAddColumn", "children"];
12
+ import { PlusSquareOutlined, DeleteOutlined } from '@ant-design/icons';
13
+ import React from 'react';
14
+ import { EditableContext } from '../interface';
15
+ import "./index.css";
16
+
17
+ var EditableHeardCell = function EditableHeardCell(props) {
18
+ var title = props.title,
19
+ dataIndex = props.dataIndex,
20
+ isAddColumn = props.isAddColumn,
21
+ children = props.children,
22
+ restProps = _objectWithoutProperties(props, _excluded);
23
+
24
+ var _ref = React.useContext(EditableContext) || undefined,
25
+ editableStream = _ref.editableStream,
26
+ editConfig = _ref.editConfig;
27
+
28
+ var addColumnRef = React.useRef({
29
+ key: '',
30
+ title: ''
31
+ });
32
+
33
+ var _React$useState = React.useState({
34
+ key: '',
35
+ title: ''
36
+ }),
37
+ _React$useState2 = _slicedToArray(_React$useState, 2),
38
+ addColumn = _React$useState2[0],
39
+ setAddColumn = _React$useState2[1];
40
+
41
+ var _React$useState3 = React.useState(false),
42
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
43
+ visible = _React$useState4[0],
44
+ setVisible = _React$useState4[1];
45
+
46
+ var onMouseOver = function onMouseOver() {
47
+ editableStream.next({
48
+ type: 'editHeardCellKey',
49
+ payload: dataIndex
50
+ });
51
+ };
52
+
53
+ var onMouseLeave = function onMouseLeave() {};
54
+
55
+ var onAddColumn = function onAddColumn() {
56
+ setVisible(false);
57
+ editableStream.next({
58
+ type: 'onAddColumn',
59
+ payload: _objectSpread({
60
+ dataIndex: dataIndex
61
+ }, addColumnRef.current)
62
+ });
63
+ setAddColumn({
64
+ key: '',
65
+ title: ''
66
+ });
67
+ addColumnRef.current = {
68
+ key: '',
69
+ title: ''
70
+ };
71
+ };
72
+
73
+ var content = /*#__PURE__*/React.createElement("div", {
74
+ style: {
75
+ width: '100px'
76
+ }
77
+ }, /*#__PURE__*/React.createElement("div", {
78
+ style: {
79
+ marginBottom: '10px'
80
+ }
81
+ }, /*#__PURE__*/React.createElement(_Input, {
82
+ value: addColumn.key,
83
+ style: {
84
+ width: '100%',
85
+ marginBottom: '5px'
86
+ },
87
+ onChange: function onChange(e) {
88
+ var _ = addColumnRef.current;
89
+ _.key = e.target.value;
90
+ setAddColumn(_objectSpread({}, _));
91
+ addColumnRef.current = _;
92
+ },
93
+ placeholder: "\u8BF7\u8F93\u5165key"
94
+ }), /*#__PURE__*/React.createElement(_Input, {
95
+ value: addColumn.title,
96
+ style: {
97
+ width: '100%'
98
+ },
99
+ onChange: function onChange(e) {
100
+ var _ = addColumnRef.current;
101
+ _.title = e.target.value;
102
+ setAddColumn(_objectSpread({}, _));
103
+ addColumnRef.current = _;
104
+ },
105
+ placeholder: "\u8BF7\u8F93\u5165title",
106
+ onPressEnter: onAddColumn
107
+ })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Button, {
108
+ type: "primary",
109
+ block: true,
110
+ onClick: onAddColumn
111
+ }, "\u786E\u5B9A")));
112
+
113
+ var onVisibleChange = function onVisibleChange(b) {
114
+ setVisible(b);
115
+ };
116
+
117
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("th", _extends({}, restProps, {
118
+ className: "ant-table-cell ".concat(isAddColumn && editConfig.editHeardCellKey === dataIndex ? 'border-right ' : '', " ")
119
+ }), isAddColumn && /*#__PURE__*/React.createElement(_Popover, {
120
+ placement: "rightTop",
121
+ content: content,
122
+ trigger: "click",
123
+ visible: visible,
124
+ onVisibleChange: onVisibleChange
125
+ }, /*#__PURE__*/React.createElement("div", {
126
+ className: "".concat(editConfig.editHeardCellKey === dataIndex ? 'editable-th-hover-add' : 'display-none')
127
+ }, /*#__PURE__*/React.createElement(_Button, {
128
+ type: "link",
129
+ icon: /*#__PURE__*/React.createElement(PlusSquareOutlined, null)
130
+ }))), isAddColumn && /*#__PURE__*/React.createElement("div", {
131
+ className: "".concat(editConfig.editHeardCellKey === dataIndex ? 'editable-th-hover-delete' : 'display-none')
132
+ }, /*#__PURE__*/React.createElement(_Button, {
133
+ type: "link",
134
+ icon: /*#__PURE__*/React.createElement(DeleteOutlined, null)
135
+ })), /*#__PURE__*/React.createElement("div", {
136
+ onMouseOver: onMouseOver,
137
+ onMouseLeave: onMouseLeave
138
+ }, children)));
139
+ };
140
+
141
+ export default EditableHeardCell;
@@ -0,0 +1,19 @@
1
+ .editable-th-hover-add {
2
+ position: absolute;
3
+ right: -16px;
4
+ top: -30px;
5
+ }
6
+ .editable-th-hover-delete {
7
+ position: absolute;
8
+ left: 49%;
9
+ top: -30px;
10
+ }
11
+ .display-none {
12
+ display: none;
13
+ }
14
+ .border-right {
15
+ border-right: 1px solid var(--antd-wave-shadow-color) !important;
16
+ }
17
+ .border-top {
18
+ border-top: 1px solid var(--antd-wave-shadow-color) !important;
19
+ }
@@ -11,7 +11,7 @@ interface IEditableProps<R = any> {
11
11
  /**
12
12
  * 表格列的配置描述
13
13
  */
14
- columns: EditColumnsType;
14
+ columns: EditColumnsType[];
15
15
  /**
16
16
  * 新增一列 默认的值
17
17
  */
@@ -28,6 +28,10 @@ interface IEditableProps<R = any> {
28
28
  * 只读
29
29
  */
30
30
  readonly?: boolean;
31
+ /**
32
+ * 是否可以添加列
33
+ */
34
+ isAddColumn?: boolean;
31
35
  /**
32
36
  * antd自身的属性
33
37
  */
@@ -3,10 +3,10 @@ import _Button from "antd/es/button";
3
3
  import "antd/es/table/style";
4
4
  import _Table from "antd/es/table";
5
5
  import _extends from "@babel/runtime/helpers/esm/extends";
6
- import "antd/es/message/style";
7
- import _message from "antd/es/message";
8
6
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
9
7
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
8
+ import "antd/es/message/style";
9
+ import _message from "antd/es/message";
10
10
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
11
11
  import React from 'react';
12
12
  import { BehaviorSubject } from 'rxjs';
@@ -16,6 +16,7 @@ import EditableRow from './comps/EditableRow';
16
16
  import { EditableContext } from './interface';
17
17
  import EditableAction from './comps/EditableAction';
18
18
  import { isFreeEditRow, removeCurKeyFromEditRow } from './utils';
19
+ import EditableHeardCell from './comps/EditableHeardCell';
19
20
 
20
21
  var Editable = function Editable(props) {
21
22
  var _props$type = props.type,
@@ -26,6 +27,8 @@ var Editable = function Editable(props) {
26
27
  defaultValue = props.defaultValue,
27
28
  _props$addPosition = props.addPosition,
28
29
  addPosition = _props$addPosition === void 0 ? 'bottom' : _props$addPosition,
30
+ _props$isAddColumn = props.isAddColumn,
31
+ isAddColumn = _props$isAddColumn === void 0 ? false : _props$isAddColumn,
29
32
  tableProps = props.tableProps,
30
33
  onRowConfirm = props.onRowConfirm,
31
34
  onRowDelete = props.onRowDelete,
@@ -54,8 +57,21 @@ var Editable = function Editable(props) {
54
57
  var _React$useState7 = React.useState(),
55
58
  _React$useState8 = _slicedToArray(_React$useState7, 2),
56
59
  editCellKey = _React$useState8[0],
57
- setEditCellkey = _React$useState8[1]; // 记录上一次发生改变的行值
60
+ setEditCellkey = _React$useState8[1]; // 添加一列表头
61
+
62
+
63
+ var _React$useState9 = React.useState(),
64
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
65
+ editHeardCellKey = _React$useState10[0],
66
+ setEditHeardCellkey = _React$useState10[1]; // 记录临时加的列头
67
+
68
+
69
+ var _React$useState11 = React.useState([]),
70
+ _React$useState12 = _slicedToArray(_React$useState11, 2),
71
+ addColumns = _React$useState12[0],
72
+ setAddColumns = _React$useState12[1];
58
73
 
74
+ var addColumnsRef = React.useRef([]); // 记录上一次发生改变的行值
59
75
 
60
76
  var lastValueRef = React.useRef(); // 记录上一次的datasource
61
77
 
@@ -65,6 +81,35 @@ var Editable = function Editable(props) {
65
81
  var editableStream = React.useMemo(function () {
66
82
  return new BehaviorSubject(undefined);
67
83
  }, []);
84
+
85
+ var processAddColumnsData = function processAddColumnsData(data) {
86
+ var _columns = addColumnsRef.current.length > 0 ? addColumnsRef.current : columns; // 判断key是否重复
87
+
88
+
89
+ if (_columns.findIndex(function (v) {
90
+ return v.key === data.key;
91
+ }) > -1) {
92
+ _message.warning('表格的key不可以重复');
93
+
94
+ return;
95
+ }
96
+
97
+ var idx = _columns.findIndex(function (v) {
98
+ return v.dataIndex === data.dataIndex;
99
+ });
100
+
101
+ var obj = {
102
+ title: data.title,
103
+ key: data.key,
104
+ dataIndex: data.key
105
+ };
106
+
107
+ _columns.splice(idx + 1, 0, _objectSpread(_objectSpread({}, _columns[0]), obj));
108
+
109
+ setAddColumns(_toConsumableArray(_columns));
110
+ addColumnsRef.current = _columns; // editableStream.next({ type: 'editHeardCellKey', payload: undefined });
111
+ };
112
+
68
113
  var processStreamFactory = React.useCallback(function (data) {
69
114
  switch (data === null || data === void 0 ? void 0 : data.type) {
70
115
  case 'onValuesChange':
@@ -104,7 +149,14 @@ var Editable = function Editable(props) {
104
149
  dataIndex: data.payload.dataIndex,
105
150
  rowIndex: data.payload.rowIndex
106
151
  });
107
- editRowKeyRef.current = data.payload._rowKey_;
152
+ break;
153
+
154
+ case 'editHeardCellKey':
155
+ setEditHeardCellkey(data.payload);
156
+ break;
157
+
158
+ case 'onAddColumn':
159
+ processAddColumnsData(data.payload);
108
160
  break;
109
161
 
110
162
  case 'onSingleSave':
@@ -197,18 +249,30 @@ var Editable = function Editable(props) {
197
249
  _column.onCell = function (record, rowIndex) {
198
250
  return _objectSpread(_objectSpread({
199
251
  record: record,
200
- editableType: type
252
+ editableType: type,
253
+ isAddColumn: isAddColumn
201
254
  }, pick(column, ['editable', 'title', 'dataIndex', 'type', 'enum', 'disabled'])), {}, {
202
255
  rowIndex: rowIndex
203
256
  });
204
257
  };
205
258
  }
206
259
 
260
+ if (isAddColumn) {
261
+ _column.onHeaderCell = function (col) {
262
+ return _objectSpread({
263
+ width: col.width,
264
+ isAddColumn: isAddColumn
265
+ }, pick(column, ['title', 'dataIndex']));
266
+ };
267
+ }
268
+
207
269
  return _column;
208
270
  }, [readonly, type]); // 处理一下编辑表格的数据
209
271
 
210
272
  var _columns = React.useMemo(function () {
211
- var res = columns.map(getEditColumn);
273
+ var __columns__ = addColumns && addColumns.length > 0 ? addColumns : columns;
274
+
275
+ var res = __columns__.map(getEditColumn);
212
276
 
213
277
  if (!readonly) {
214
278
  var _aciton_ = {
@@ -230,7 +294,7 @@ var Editable = function Editable(props) {
230
294
  }
231
295
 
232
296
  return res;
233
- }, [columns, readonly, type]); // 主要是自己加一层rowkey
297
+ }, [columns, readonly, type, addColumns]); // 主要是自己加一层rowkey
234
298
 
235
299
 
236
300
  var _dataSource = React.useMemo(function () {
@@ -282,7 +346,8 @@ var Editable = function Editable(props) {
282
346
  editConfig: {
283
347
  curRow: editRowKey,
284
348
  type: editType,
285
- editCellKey: editCellKey
349
+ editCellKey: editCellKey,
350
+ editHeardCellKey: editHeardCellKey
286
351
  }
287
352
  }
288
353
  }, /*#__PURE__*/React.createElement(_Table, _extends({
@@ -294,6 +359,9 @@ var Editable = function Editable(props) {
294
359
  columns: _columns,
295
360
  dataSource: _dataSource,
296
361
  components: {
362
+ header: {
363
+ cell: EditableHeardCell
364
+ },
297
365
  body: {
298
366
  row: EditableRow,
299
367
  cell: EditableCell
@@ -305,7 +373,7 @@ var Editable = function Editable(props) {
305
373
  index: index
306
374
  };
307
375
  }
308
- })), (type === 'multiple' || type === 'freedom') && /*#__PURE__*/React.createElement(_Button, {
376
+ })), (type === 'multiple' || type === 'freedom') && !readonly && /*#__PURE__*/React.createElement(_Button, {
309
377
  block: true,
310
378
  type: "dashed",
311
379
  style: {
@@ -6,6 +6,7 @@ export interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
6
6
  editable: boolean;
7
7
  disabled?: boolean;
8
8
  dataIndex: string;
9
+ isAddColumn: boolean;
9
10
  rowIndex: number;
10
11
  record: any;
11
12
  type: InputType;
@@ -16,6 +17,13 @@ export interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
16
17
  }[];
17
18
  children: React.ReactNode;
18
19
  }
20
+ export interface EditableHeardCellProps extends React.HTMLAttributes<HTMLElement> {
21
+ title: any;
22
+ width: number;
23
+ isAddColumn: boolean;
24
+ dataIndex: string;
25
+ children: React.ReactNode;
26
+ }
19
27
  export interface EditableRowProps extends React.HTMLAttributes<HTMLElement> {
20
28
  rowIndex: number;
21
29
  record?: any;
@@ -47,6 +55,7 @@ export interface IEditableContextProps {
47
55
  dataIndex: string;
48
56
  rowIndex: number;
49
57
  };
58
+ editHeardCellKey: string;
50
59
  };
51
60
  }
52
61
  export declare const EditableContext: React.Context<IEditableContextProps>;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: wangxian
3
3
  * @Date: 2022-03-04 15:07:57
4
- * @LastEditTime: 2022-03-08 17:06:55
4
+ * @LastEditTime: 2022-03-10 13:49:40
5
5
  */
6
6
  import React from 'react';
7
7
  export var EditableContext = /*#__PURE__*/React.createContext(null);
@@ -0,0 +1,3 @@
1
+ .rc-md-editor.full {
2
+ width: 100% !important;
3
+ }
@@ -0,0 +1,10 @@
1
+ import 'react-markdown-editor-lite/lib/index.css';
2
+ import './index.less';
3
+ interface IMdEditProps {
4
+ value: string;
5
+ width?: number;
6
+ height?: number;
7
+ onChange: (txt: string) => void;
8
+ }
9
+ declare const MdEdit: (props: IMdEditProps) => JSX.Element;
10
+ export default MdEdit;
@@ -0,0 +1,51 @@
1
+ /*
2
+ * @Author: your name
3
+ * @Date: 2021-12-15 15:29:51
4
+ * @LastEditTime: 2022-03-16 17:08:11
5
+ */
6
+ import React from 'react';
7
+ import MdEditor from 'react-markdown-editor-lite';
8
+ import MarkdownIt from 'markdown-it';
9
+ import emoji from 'markdown-it-emoji';
10
+ import 'react-markdown-editor-lite/lib/index.css';
11
+ import "./index.css";
12
+ var mdParser = new MarkdownIt({
13
+ html: true,
14
+ linkify: true,
15
+ typographer: true // highlight: (str: string = '', lang: string) => {
16
+ // if (lang && hljs.getLanguage(lang)) {
17
+ // try {
18
+ // return hljs.highlight(lang, str).value;
19
+ // } catch (__) {
20
+ // // ...
21
+ // }
22
+ // }
23
+ // return '';
24
+ // },
25
+
26
+ }).use(emoji);
27
+
28
+ var MdEdit = function MdEdit(props) {
29
+ var value = props.value,
30
+ width = props.width,
31
+ height = props.height,
32
+ onChange = props.onChange;
33
+
34
+ var onValueChange = function onValueChange(v) {
35
+ onChange && onChange(v.text);
36
+ };
37
+
38
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MdEditor, {
39
+ value: value,
40
+ style: {
41
+ width: "".concat(width, "px"),
42
+ height: "".concat(height, "px")
43
+ },
44
+ renderHTML: function renderHTML(text) {
45
+ return mdParser.render(text);
46
+ },
47
+ onChange: onValueChange
48
+ }));
49
+ };
50
+
51
+ export default MdEdit;
@@ -5,6 +5,7 @@ interface IMetaPropsEditProps {
5
5
  metadataTag?: string;
6
6
  name: string;
7
7
  isEdit?: boolean;
8
+ isAddFields?: boolean;
8
9
  onAddFields?: (idx: number) => void;
9
10
  onNewRefClick?: () => void;
10
11
  }
@@ -23,6 +23,8 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
23
23
  id = props.id,
24
24
  metadataTag = props.metadataTag,
25
25
  name = props.name,
26
+ _props$isAddFields = props.isAddFields,
27
+ isAddFields = _props$isAddFields === void 0 ? true : _props$isAddFields,
26
28
  onAddFields = props.onAddFields,
27
29
  onNewRefClick = props.onNewRefClick;
28
30
 
@@ -320,7 +322,7 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
320
322
  },
321
323
  block: true,
322
324
  icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
323
- }, "\u6DFB\u52A0".concat(name, "\u540D\u79F0"))), /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Button, {
325
+ }, "\u6DFB\u52A0".concat(name, "\u540D\u79F0"))), isAddFields && /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Button, {
324
326
  type: "dashed",
325
327
  onClick: function onClick() {
326
328
  onAddFields(-1);
package/es/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { default as MetadataEditV2 } from './comps/MetadataEditV2';
4
4
  export { default as MetadataForm } from './comps/MetadataForm';
5
5
  export { default as JsonView } from './comps/JsonView';
6
6
  export { default as JsonEdit } from './comps/JsonEdit';
7
+ export { default as MdEditor } from './comps/MdEdit';
7
8
  export { default as Editable } from './comps/Editable';
8
9
  export * from './framework/metadata/index';
9
10
  export { default as http, addInterceptor } from './framework/http/index';
package/es/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author:wangxian
3
3
  * @Date: 2021-09-18 14:15:04
4
- * @LastEditTime: 2022-03-09 08:43:55
4
+ * @LastEditTime: 2022-03-16 16:51:12
5
5
  */
6
6
  export { default as MetadataEdit } from './comps/MetadataEdit';
7
7
  export { default as MetaPropsEdit } from './comps/MetadataEdit/components/MetaPropsEdit';
@@ -9,6 +9,7 @@ export { default as MetadataEditV2 } from './comps/MetadataEditV2';
9
9
  export { default as MetadataForm } from './comps/MetadataForm';
10
10
  export { default as JsonView } from './comps/JsonView';
11
11
  export { default as JsonEdit } from './comps/JsonEdit';
12
+ export { default as MdEditor } from './comps/MdEdit';
12
13
  export { default as Editable } from './comps/Editable';
13
14
  export * from './framework/metadata/index';
14
15
  export { default as http, addInterceptor } from './framework/http/index';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
- "public": true,
2
+ "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.0.44",
4
+ "version": "1.0.47",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",
@@ -39,10 +39,14 @@
39
39
  "babel-plugin-transform-remove-console": "^6.9.4",
40
40
  "bl": "^5.0.0",
41
41
  "codemirror": "^5.63.0",
42
+ "highlight.js": "11.3.1",
42
43
  "lodash": "^4.17.21",
44
+ "markdown-it": "^12.3.2",
45
+ "markdown-it-emoji": "^2.0.0",
43
46
  "qs": "^6.10.1",
44
47
  "react": "^16.12.0",
45
48
  "react-color": "^2.19.3",
49
+ "react-markdown-editor-lite": "^1.3.2",
46
50
  "rxjs": "^7.5.4"
47
51
  },
48
52
  "peerDependencies": {
@@ -73,4 +77,3 @@
73
77
  "yorkie": "^2.0.0"
74
78
  }
75
79
  }
76
-