ronds-metadata 1.2.37 → 1.2.39

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.
Files changed (131) hide show
  1. package/es/api/index.js +83 -131
  2. package/es/comps/DynamicPorts/comps/ContextMenu.js +3 -11
  3. package/es/comps/DynamicPorts/comps/DragNode.js +3 -8
  4. package/es/comps/DynamicPorts/comps/GraphHandler/index.js +4 -5
  5. package/es/comps/DynamicPorts/comps/NodeElement.js +1 -4
  6. package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.js +3 -6
  7. package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.js +3 -7
  8. package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.js +18 -21
  9. package/es/comps/DynamicPorts/comps/shape/edge.js +5 -18
  10. package/es/comps/DynamicPorts/comps/shape/node.js +4 -17
  11. package/es/comps/DynamicPorts/constant/index.js +2 -5
  12. package/es/comps/DynamicPorts/graph.d.ts +2 -2
  13. package/es/comps/DynamicPorts/graph.js +228 -312
  14. package/es/comps/DynamicPorts/index.js +39 -58
  15. package/es/comps/DynamicPorts/utils.js +21 -25
  16. package/es/comps/Editable/DataCell/ButtonCell.js +4 -10
  17. package/es/comps/Editable/DataCell/ColorPicker.js +2 -7
  18. package/es/comps/Editable/DataCell/Input.js +5 -14
  19. package/es/comps/Editable/DataCell/Number.js +3 -10
  20. package/es/comps/Editable/DataCell/Select.js +7 -14
  21. package/es/comps/Editable/DataCell/Switch.js +2 -7
  22. package/es/comps/Editable/comps/EditableAction.js +8 -12
  23. package/es/comps/Editable/comps/EditableCell.js +16 -26
  24. package/es/comps/Editable/comps/EditableHeardCell.js +21 -34
  25. package/es/comps/Editable/comps/EditableRow.js +49 -59
  26. package/es/comps/Editable/comps/Texty.js +40 -73
  27. package/es/comps/Editable/index.js +67 -112
  28. package/es/comps/Editable/interface.d.ts +1 -1
  29. package/es/comps/Editable/utils.js +0 -1
  30. package/es/comps/FileView/index.js +65 -101
  31. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Checkbox.js +8 -13
  32. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.js +8 -4
  33. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.js +6 -2
  34. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Input.js +8 -4
  35. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/List.js +6 -11
  36. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.js +6 -10
  37. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.js +6 -2
  38. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.js +6 -11
  39. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.js +8 -4
  40. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.js +8 -13
  41. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.js +6 -10
  42. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.js +6 -2
  43. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Table.js +6 -11
  44. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.js +6 -3
  45. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.js +2 -5
  46. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +86 -109
  47. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +3 -7
  48. package/es/comps/FormGenerator/comps/Canvas/core/index.js +54 -91
  49. package/es/comps/FormGenerator/comps/Canvas/index.js +8 -15
  50. package/es/comps/FormGenerator/comps/Settings/index.js +16 -30
  51. package/es/comps/FormGenerator/comps/Sidebar/Elements.js +23 -22
  52. package/es/comps/FormGenerator/comps/Sidebar/index.js +6 -2
  53. package/es/comps/FormGenerator/index.js +3 -9
  54. package/es/comps/FormGenerator/interface.d.ts +1 -1
  55. package/es/comps/FormGenerator/settings/index.js +12 -11
  56. package/es/comps/FormGenerator/settings/ruleConfig.js +0 -1
  57. package/es/comps/FormGenerator/transformer.js +40 -105
  58. package/es/comps/Icons/index.js +4 -7
  59. package/es/comps/JsonEdit/index.js +25 -50
  60. package/es/comps/JsonView/index.js +7 -21
  61. package/es/comps/MdEdit/index.js +7 -10
  62. package/es/comps/MdEditPro/index.d.ts +10 -0
  63. package/es/comps/MdEditPro/index.js +22 -0
  64. package/es/comps/MdEditPro/index.less +74 -0
  65. package/es/comps/MdNavbar/index.js +17 -40
  66. package/es/comps/MdNavbar/utils.js +0 -4
  67. package/es/comps/MdView/index.js +7 -11
  68. package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +129 -183
  69. package/es/comps/MetadataEdit/components/MetaPropsEdit.js +11 -27
  70. package/es/comps/MetadataEdit/hooks/index.js +3 -11
  71. package/es/comps/MetadataEdit/index.js +25 -58
  72. package/es/comps/MetadataEditV2/components/MetaFieldsEdit.js +17 -33
  73. package/es/comps/MetadataEditV2/components/MetaPropsEdit.js +15 -29
  74. package/es/comps/MetadataEditV2/hooks/index.js +5 -12
  75. package/es/comps/MetadataEditV2/index.js +30 -65
  76. package/es/comps/MetadataForm/DataCell/Array.js +12 -23
  77. package/es/comps/MetadataForm/DataCell/Input.js +23 -39
  78. package/es/comps/MetadataForm/DataCell/Number.js +10 -21
  79. package/es/comps/MetadataForm/DataCell/Ref.js +87 -121
  80. package/es/comps/MetadataForm/DataCell/Select.js +131 -226
  81. package/es/comps/MetadataForm/DataCell/Switch.js +7 -14
  82. package/es/comps/MetadataForm/DataCell/layout/TableArray.js +98 -169
  83. package/es/comps/MetadataForm/HOC/index.js +20 -37
  84. package/es/comps/MetadataForm/hooks/index.js +12 -38
  85. package/es/comps/MetadataForm/index.js +37 -72
  86. package/es/comps/MetadataForm/interface.d.ts +3 -3
  87. package/es/comps/MetadataForm/utils.d.ts +1 -0
  88. package/es/comps/MetadataForm/utils.js +12 -14
  89. package/es/comps/Split/index.js +40 -38
  90. package/es/config.js +0 -4
  91. package/es/framework/RxStore/demo/index.js +9 -10
  92. package/es/framework/RxStore/hooks.d.ts +9 -9
  93. package/es/framework/RxStore/hooks.js +10 -35
  94. package/es/framework/RxStore/store.d.ts +4 -4
  95. package/es/framework/RxStore/store.js +0 -10
  96. package/es/framework/fg/index.js +18 -80
  97. package/es/framework/fg/interface.d.ts +2 -2
  98. package/es/framework/fg/utils.js +0 -10
  99. package/es/framework/graph/index.d.ts +2 -2
  100. package/es/framework/graph/index.js +55 -110
  101. package/es/framework/hooks/use-async-memo.js +3 -7
  102. package/es/framework/hooks/use-sync-scroll.js +2 -15
  103. package/es/framework/http/cache.js +25 -32
  104. package/es/framework/http/cancel.js +1 -7
  105. package/es/framework/http/index.js +22 -82
  106. package/es/framework/http/msgpack.js +0 -4
  107. package/es/framework/http/msgpack5/index.js +2 -12
  108. package/es/framework/http/msgpack5/lib/codecs/DateCodec.js +1 -13
  109. package/es/framework/http/msgpack5/lib/decoder.js +10 -68
  110. package/es/framework/http/msgpack5/lib/encoder.js +8 -36
  111. package/es/framework/http/msgpack5/lib/helpers.js +3 -2
  112. package/es/framework/http/msgpack5/lib/streams.js +0 -18
  113. package/es/framework/libs/jquery.min.js +1009 -1696
  114. package/es/framework/locale/dil8/di18n.js +4 -15
  115. package/es/framework/locale/dil8/translate.js +0 -14
  116. package/es/framework/locale/dil8/util.js +0 -3
  117. package/es/framework/locale/index.js +2 -3
  118. package/es/framework/metadata/MetadataService.js +39 -78
  119. package/es/framework/metadata/index.js +4 -70
  120. package/es/framework/rxjs-hooks/useMemoSubject.js +0 -2
  121. package/es/framework/rxjs-hooks/useObservable.js +2 -4
  122. package/es/framework/rxjs-hooks/useObservableState.js +8 -14
  123. package/es/index.d.ts +1 -0
  124. package/es/index.js +2 -1
  125. package/es/utils.js +58 -97
  126. package/package.json +4 -2
  127. package/es/comps/MdEdit/plugin/EditContent.d.ts +0 -5
  128. package/es/comps/MdEdit/plugin/EditContent.js +0 -34
  129. package/es/comps/MdEdit/plugin/Mark.d.ts +0 -7
  130. package/es/comps/MdEdit/plugin/Mark.js +0 -60
  131. package/es/framework/libs/iconfont/iconfont.json +0 -401
@@ -1,6 +1,5 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
-
4
3
  /*
5
4
  * @Author: wangxian
6
5
  * @Date: 2022-05-16 18:53:31
@@ -17,33 +16,27 @@ import { DRAGGABLE_COMPONENT, DRAGGABLE_MODEL } from './constant';
17
16
  import { guid } from '../../utils';
18
17
  import ContextMenu from './comps/ContextMenu';
19
18
  import { GraphHandler } from './comps/GraphHandler';
20
-
21
19
  var DynamicPorts = function DynamicPorts(props) {
22
20
  var defaultValue = props.defaultValue,
23
- onChange = props.onChange,
24
- onNodeSelect = props.onNodeSelect,
25
- getDPGraphInstance = props.getDPGraphInstance;
21
+ onChange = props.onChange,
22
+ onNodeSelect = props.onNodeSelect,
23
+ getDPGraphInstance = props.getDPGraphInstance;
26
24
  var divRef = React.useRef(null);
27
25
  var containerRef = React.useRef(null);
28
-
29
26
  var _React$useState = React.useState(),
30
- _React$useState2 = _slicedToArray(_React$useState, 2),
31
- dpGraph = _React$useState2[0],
32
- setGraph = _React$useState2[1];
33
-
27
+ _React$useState2 = _slicedToArray(_React$useState, 2),
28
+ dpGraph = _React$useState2[0],
29
+ setGraph = _React$useState2[1];
34
30
  var dpGraphRef = React.useRef();
35
- var firstLoadRef = React.useRef(true); // 处理画布卸载
36
-
31
+ var firstLoadRef = React.useRef(true);
32
+ // 处理画布卸载
37
33
  useUnmountDPGraph();
38
34
  var resizeSensorRef = React.useRef(null);
39
-
40
35
  var onResizeStrategy = function onResizeStrategy() {
41
36
  var _dpGraphRef$current, _dpGraphRef$current2;
42
-
43
37
  (_dpGraphRef$current = dpGraphRef.current) === null || _dpGraphRef$current === void 0 ? void 0 : _dpGraphRef$current.resizeGraph();
44
38
  (_dpGraphRef$current2 = dpGraphRef.current) === null || _dpGraphRef$current2 === void 0 ? void 0 : _dpGraphRef$current2.zoomGraphRealSize();
45
39
  };
46
-
47
40
  React.useEffect(function () {
48
41
  if (dpGraphRef.current) {
49
42
  try {
@@ -52,61 +45,54 @@ var DynamicPorts = function DynamicPorts(props) {
52
45
  console.error(ex);
53
46
  }
54
47
  }
55
- }, []); // 渲染画布
56
-
48
+ }, []);
49
+ // 渲染画布
57
50
  React.useEffect(function () {
58
51
  if (firstLoadRef.current) {
59
52
  var _dpGraph = useDPGraph(defaultValue);
60
-
61
53
  dpGraphRef.current = _dpGraph;
62
54
  setGraph(_dpGraph);
63
-
64
- _dpGraph.renderGraph(containerRef.current, divRef.current); // 获取图信息的订阅
65
-
66
-
55
+ _dpGraph.renderGraph(containerRef.current, divRef.current);
56
+ // 获取图信息的订阅
67
57
  _dpGraph.factory$.dpGraph.pipe(filter(function (x) {
68
58
  return !!x;
69
59
  })).subscribe(function (v) {
70
60
  onChange && onChange(v);
71
- }); // 获取选中节点的订阅
72
-
73
-
61
+ });
62
+ // 获取选中节点的订阅
74
63
  _dpGraph.factory$.selectedNodes.subscribe(function (v) {
75
64
  onNodeSelect && onNodeSelect(v[0]);
76
65
  });
77
-
78
66
  getDPGraphInstance && getDPGraphInstance(_dpGraph);
79
67
  firstLoadRef.current = false;
80
68
  }
81
- }, [defaultValue]); // 处理组件拖拽落下事件
82
-
69
+ }, [defaultValue]);
70
+ // 处理组件拖拽落下事件
83
71
  var _useDrop = useDrop({
84
- accept: [DRAGGABLE_COMPONENT, DRAGGABLE_MODEL],
85
- drop: function drop(item, monitor) {
86
- var currentMouseOffset = monitor.getClientOffset();
87
- var sourceMouseOffset = monitor.getInitialClientOffset();
88
- var sourceElementOffset = monitor.getInitialSourceClientOffset();
89
- var diffX = sourceMouseOffset.x - sourceElementOffset.x;
90
- var diffY = sourceMouseOffset.y - sourceElementOffset.y;
91
- var x = currentMouseOffset.x - diffX;
92
- var y = currentMouseOffset.y - diffY;
93
-
94
- if (dpGraphRef.current.isGraphReady()) {
95
- dpGraphRef.current.addDragNode(_objectSpread(_objectSpread({}, item.comp), {}, {
96
- libId: item.comp.id,
97
- id: guid(),
98
- x: x,
99
- y: y
100
- }));
101
- } else {
102
- console.warn('请稍后再尝试添加节点');
72
+ accept: [DRAGGABLE_COMPONENT, DRAGGABLE_MODEL],
73
+ drop: function drop(item, monitor) {
74
+ var currentMouseOffset = monitor.getClientOffset();
75
+ var sourceMouseOffset = monitor.getInitialClientOffset();
76
+ var sourceElementOffset = monitor.getInitialSourceClientOffset();
77
+ var diffX = sourceMouseOffset.x - sourceElementOffset.x;
78
+ var diffY = sourceMouseOffset.y - sourceElementOffset.y;
79
+ var x = currentMouseOffset.x - diffX;
80
+ var y = currentMouseOffset.y - diffY;
81
+ if (dpGraphRef.current.isGraphReady()) {
82
+ dpGraphRef.current.addDragNode(_objectSpread(_objectSpread({}, item.comp), {}, {
83
+ libId: item.comp.id,
84
+ id: guid(),
85
+ x: x,
86
+ y: y
87
+ }));
88
+ } else {
89
+ console.warn('请稍后再尝试添加节点');
90
+ }
103
91
  }
104
- }
105
- }),
106
- _useDrop2 = _slicedToArray(_useDrop, 2),
107
- dropRef = _useDrop2[1]; // 画布侧边 toolbar handler
108
-
109
-
92
+ }),
93
+ _useDrop2 = _slicedToArray(_useDrop, 2),
94
+ dropRef = _useDrop2[1];
95
+ // 画布侧边 toolbar handler
110
96
  var onHandleSideToolbar = React.useCallback(function (action) {
111
97
  return function () {
112
98
  // 确保画布已渲染
@@ -115,19 +101,15 @@ var DynamicPorts = function DynamicPorts(props) {
115
101
  case 'in':
116
102
  dpGraphRef.current.zoomGraph(0.1);
117
103
  break;
118
-
119
104
  case 'out':
120
105
  dpGraphRef.current.zoomGraph(-0.1);
121
106
  break;
122
-
123
107
  case 'fit':
124
108
  dpGraphRef.current.zoomGraphToFit();
125
109
  break;
126
-
127
110
  case 'real':
128
111
  dpGraphRef.current.zoomGraphRealSize();
129
112
  break;
130
-
131
113
  default:
132
114
  }
133
115
  }
@@ -158,5 +140,4 @@ var DynamicPorts = function DynamicPorts(props) {
158
140
  ref: divRef
159
141
  })));
160
142
  };
161
-
162
143
  export default DynamicPorts;
@@ -1,14 +1,13 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
2
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
-
4
3
  /*
5
4
  * @Author: wangxian
6
5
  * @Date: 2022-05-24 16:40:49
7
6
  * @LastEditTime: 2022-05-27 16:02:48
8
7
  */
9
8
  import { sortBy } from 'lodash-es';
10
- import { NODE_HEIGHT, NODE_WIDTH } from './constant'; // 将画布上的点转换成相对于 offset parent 的点
11
-
9
+ import { NODE_HEIGHT, NODE_WIDTH } from './constant';
10
+ // 将画布上的点转换成相对于 offset parent 的点
12
11
  export function graphPointToOffsetPoint(graph, graphPoint, containerElem) {
13
12
  if (graph) {
14
13
  var point = graph.localToPage({
@@ -17,30 +16,28 @@ export function graphPointToOffsetPoint(graph, graphPoint, containerElem) {
17
16
  });
18
17
  var clientRect = containerElem === null || containerElem === void 0 ? void 0 : containerElem.getBoundingClientRect();
19
18
  var y = point.y - ((clientRect === null || clientRect === void 0 ? void 0 : clientRect.y) || 0); // ! offset parent 不能是画布容器,否则会影响内部布局,所以 offset parent 在外部,算上上方 toolbar 的高度
20
-
21
19
  var x = point.x - ((clientRect === null || clientRect === void 0 ? void 0 : clientRect.x) || 0);
22
20
  return {
23
21
  x: x,
24
22
  y: y
25
23
  };
26
24
  }
27
-
28
25
  return {
29
26
  x: 0,
30
27
  y: 0
31
28
  };
32
- } // 格式化单个节点,新增节点时复用
33
-
29
+ }
30
+ // 格式化单个节点,新增节点时复用
34
31
  export function formatNodeInfoToNodeMeta(nodeData) {
35
32
  var inputPortConnectedMap = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
36
33
  var portItems = [];
37
34
  var id = nodeData.id,
38
- _nodeData$x = nodeData.x,
39
- x = _nodeData$x === void 0 ? 0 : _nodeData$x,
40
- _nodeData$y = nodeData.y,
41
- y = _nodeData$y === void 0 ? 0 : _nodeData$y,
42
- inPorts = nodeData.inPorts,
43
- outPorts = nodeData.outPorts;
35
+ _nodeData$x = nodeData.x,
36
+ x = _nodeData$x === void 0 ? 0 : _nodeData$x,
37
+ _nodeData$y = nodeData.y,
38
+ y = _nodeData$y === void 0 ? 0 : _nodeData$y,
39
+ inPorts = nodeData.inPorts,
40
+ outPorts = nodeData.outPorts;
44
41
  sortBy(inPorts, 'seq').forEach(function (inPort) {
45
42
  portItems.push(_objectSpread(_objectSpread({}, inPort), {}, {
46
43
  group: 'in',
@@ -78,18 +75,17 @@ export function formatNodeInfoToNodeMeta(nodeData) {
78
75
  * 将暴露给接口的图信息转换可渲染的结图结构信息
79
76
  * @returns
80
77
  */
81
-
82
78
  export function formatGraphData(graphData) {
83
79
  var _graphData$nodes = graphData.nodes,
84
- nodes = _graphData$nodes === void 0 ? [] : _graphData$nodes,
85
- _graphData$edges = graphData.edges,
86
- edges = _graphData$edges === void 0 ? [] : _graphData$edges; // 格式化边
87
-
80
+ nodes = _graphData$nodes === void 0 ? [] : _graphData$nodes,
81
+ _graphData$edges = graphData.edges,
82
+ edges = _graphData$edges === void 0 ? [] : _graphData$edges;
83
+ // 格式化边
88
84
  var formattedEdges = edges.map(function (edges) {
89
85
  var source = edges.source,
90
- outPortId = edges.outPortId,
91
- target = edges.target,
92
- inPortId = edges.inPortId;
86
+ outPortId = edges.outPortId,
87
+ target = edges.target,
88
+ inPortId = edges.inPortId;
93
89
  return _objectSpread(_objectSpread({}, edges), {}, {
94
90
  data: _objectSpread({}, edges),
95
91
  sourceAnchor: 'bottom',
@@ -110,13 +106,13 @@ export function formatGraphData(graphData) {
110
106
  label: '',
111
107
  zIndex: 1
112
108
  });
113
- }); // 记录所有已连线的输入桩
114
-
109
+ });
110
+ // 记录所有已连线的输入桩
115
111
  var inputPortConnectedMap = formattedEdges.reduce(function (acc, edge) {
116
112
  acc[edge.inPortId] = true;
117
113
  return acc;
118
- }, {}); // 格式化算法组件节点
119
-
114
+ }, {});
115
+ // 格式化算法组件节点
120
116
  var formattedNodes = nodes.map(function (nodeData) {
121
117
  return formatNodeInfoToNodeMeta(nodeData, inputPortConnectedMap);
122
118
  });
@@ -2,7 +2,6 @@ import "antd/es/form/style";
2
2
  import _Form from "antd/es/form";
3
3
  import "antd/es/button/style";
4
4
  import _Button from "antd/es/button";
5
-
6
5
  /*
7
6
  * @Author: wangxian
8
7
  * @Date: 2022-03-04 14:53:50
@@ -11,16 +10,13 @@ import _Button from "antd/es/button";
11
10
  import React from 'react';
12
11
  import { SettingOutlined } from '@ant-design/icons';
13
12
  import { EditableContext } from '../interface';
14
-
15
13
  function Index(props) {
16
14
  var dataIndex = props.dataIndex,
17
- record = props.record,
18
- disabled = props.disabled;
19
-
15
+ record = props.record,
16
+ disabled = props.disabled;
20
17
  var _ref = React.useContext(EditableContext) || undefined,
21
- editableStream = _ref.editableStream,
22
- editConfig = _ref.editConfig;
23
-
18
+ editableStream = _ref.editableStream,
19
+ editConfig = _ref.editConfig;
24
20
  var onClick = function onClick(e) {
25
21
  e.stopPropagation();
26
22
  editableStream && editableStream.next({
@@ -28,7 +24,6 @@ function Index(props) {
28
24
  payload: record
29
25
  });
30
26
  };
31
-
32
27
  return /*#__PURE__*/React.createElement(_Form.Item, {
33
28
  name: dataIndex,
34
29
  style: {
@@ -41,5 +36,4 @@ function Index(props) {
41
36
  icon: /*#__PURE__*/React.createElement(SettingOutlined, null)
42
37
  }));
43
38
  }
44
-
45
39
  export default /*#__PURE__*/React.memo(Index);
@@ -2,7 +2,6 @@ import "antd/es/form/style";
2
2
  import _Form from "antd/es/form";
3
3
  import "antd/es/input/style";
4
4
  import _Input from "antd/es/input";
5
-
6
5
  /*
7
6
  * @Author: wangxian
8
7
  * @Date: 2022-03-04 14:53:50
@@ -10,14 +9,11 @@ import _Input from "antd/es/input";
10
9
  */
11
10
  import React from 'react';
12
11
  import { EditableContext } from '../interface';
13
-
14
12
  function Index(props) {
15
13
  var dataIndex = props.dataIndex,
16
- disabled = props.disabled;
17
-
14
+ disabled = props.disabled;
18
15
  var _ref = React.useContext(EditableContext) || undefined,
19
- editConfig = _ref.editConfig;
20
-
16
+ editConfig = _ref.editConfig;
21
17
  return /*#__PURE__*/React.createElement(_Form.Item, {
22
18
  name: dataIndex,
23
19
  style: {
@@ -29,5 +25,4 @@ function Index(props) {
29
25
  disabled: editConfig.type === 'edit' ? disabled : false
30
26
  }));
31
27
  }
32
-
33
28
  export default /*#__PURE__*/React.memo(Index);
@@ -2,7 +2,6 @@ import "antd/es/form/style";
2
2
  import _Form from "antd/es/form";
3
3
  import "antd/es/input/style";
4
4
  import _Input from "antd/es/input";
5
-
6
5
  /*
7
6
  * @Author: wangxian
8
7
  * @Date: 2022-03-04 14:53:50
@@ -10,32 +9,25 @@ import _Input from "antd/es/input";
10
9
  */
11
10
  import React from 'react';
12
11
  import { EditableContext } from '../interface';
13
-
14
12
  function Index(props) {
15
13
  var dataIndex = props.dataIndex,
16
- rowIndex = props.rowIndex,
17
- disabled = props.disabled;
18
-
14
+ rowIndex = props.rowIndex,
15
+ disabled = props.disabled;
19
16
  var _ref = React.useContext(EditableContext) || undefined,
20
- editConfig = _ref.editConfig;
21
-
17
+ editConfig = _ref.editConfig;
22
18
  var inputRef = React.useRef();
23
19
  var firstLoadRef = React.useRef(true);
24
20
  React.useEffect(function () {
25
21
  var _editConfig$editCellK, _editConfig$editCellK2;
26
-
27
22
  if (!inputRef.current) return;
28
-
29
23
  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
24
  if (firstLoadRef.current) {
31
25
  var _inputRef$current$sta, _inputRef$current$sta2;
32
-
33
26
  // 选中内容
34
27
  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);
35
28
  firstLoadRef.current = false;
36
- } // 设置焦点
37
-
38
-
29
+ }
30
+ // 设置焦点
39
31
  inputRef.current.focus();
40
32
  }
41
33
  }, [editConfig]);
@@ -50,5 +42,4 @@ function Index(props) {
50
42
  disabled: editConfig.type === 'edit' ? disabled : false
51
43
  }));
52
44
  }
53
-
54
45
  export default /*#__PURE__*/React.memo(Index);
@@ -2,7 +2,6 @@ import "antd/es/form/style";
2
2
  import _Form from "antd/es/form";
3
3
  import "antd/es/input-number/style";
4
4
  import _InputNumber from "antd/es/input-number";
5
-
6
5
  /*
7
6
  * @Author: wangxian
8
7
  * @Date: 2022-03-04 14:53:50
@@ -10,21 +9,16 @@ import _InputNumber from "antd/es/input-number";
10
9
  */
11
10
  import React from 'react';
12
11
  import { EditableContext } from '../interface';
13
-
14
12
  function Index(props) {
15
13
  var dataIndex = props.dataIndex,
16
- rowIndex = props.rowIndex,
17
- disabled = props.disabled;
18
-
14
+ rowIndex = props.rowIndex,
15
+ disabled = props.disabled;
19
16
  var _ref = React.useContext(EditableContext) || undefined,
20
- editConfig = _ref.editConfig;
21
-
17
+ editConfig = _ref.editConfig;
22
18
  var inputRef = React.useRef();
23
19
  React.useEffect(function () {
24
20
  var _editConfig$editCellK, _editConfig$editCellK2;
25
-
26
21
  if (!inputRef.current) return;
27
-
28
22
  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) {
29
23
  inputRef.current.focus(); // 设置焦点
30
24
  }
@@ -40,5 +34,4 @@ function Index(props) {
40
34
  disabled: editConfig.type === 'edit' ? disabled : false
41
35
  }));
42
36
  }
43
-
44
37
  export default /*#__PURE__*/React.memo(Index);
@@ -6,7 +6,6 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
6
6
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
7
7
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
8
8
  var _excluded = ["dataIndex", "mode", "disabled"];
9
-
10
9
  /*
11
10
  * @Author: wangxian
12
11
  * @Date: 2022-03-04 14:53:50
@@ -14,21 +13,17 @@ var _excluded = ["dataIndex", "mode", "disabled"];
14
13
  */
15
14
  import React from 'react';
16
15
  import { EditableContext } from '../interface';
17
-
18
16
  function Index(props) {
19
17
  var dataIndex = props.dataIndex,
20
- mode = props.mode,
21
- disabled = props.disabled,
22
- restProps = _objectWithoutProperties(props, _excluded);
23
-
18
+ mode = props.mode,
19
+ disabled = props.disabled,
20
+ restProps = _objectWithoutProperties(props, _excluded);
24
21
  var _ref = React.useContext(EditableContext) || undefined,
25
- editConfig = _ref.editConfig;
26
-
22
+ editConfig = _ref.editConfig;
27
23
  var _React$useState = React.useState([]),
28
- _React$useState2 = _slicedToArray(_React$useState, 2),
29
- options = _React$useState2[0],
30
- setOptions = _React$useState2[1];
31
-
24
+ _React$useState2 = _slicedToArray(_React$useState, 2),
25
+ options = _React$useState2[0],
26
+ setOptions = _React$useState2[1];
32
27
  React.useEffect(function () {
33
28
  if (restProps.enum) {
34
29
  Promise.resolve(restProps.enum).then(function (value) {
@@ -47,7 +42,6 @@ function Index(props) {
47
42
  showSearch: true,
48
43
  filterOption: function filterOption(input, option) {
49
44
  var _option$label;
50
-
51
45
  return (option === null || option === void 0 ? void 0 : (_option$label = option.label) === null || _option$label === void 0 ? void 0 : _option$label.toString().indexOf(input)) >= 0;
52
46
  },
53
47
  allowClear: true,
@@ -58,5 +52,4 @@ function Index(props) {
58
52
  options: options
59
53
  }));
60
54
  }
61
-
62
55
  export default /*#__PURE__*/React.memo(Index);
@@ -2,7 +2,6 @@ import "antd/es/form/style";
2
2
  import _Form from "antd/es/form";
3
3
  import "antd/es/switch/style";
4
4
  import _Switch from "antd/es/switch";
5
-
6
5
  /*
7
6
  * @Author: wangxian
8
7
  * @Date: 2022-03-04 14:53:50
@@ -10,14 +9,11 @@ import _Switch from "antd/es/switch";
10
9
  */
11
10
  import React from 'react';
12
11
  import { EditableContext } from '../interface';
13
-
14
12
  function Index(props) {
15
13
  var dataIndex = props.dataIndex,
16
- disabled = props.disabled;
17
-
14
+ disabled = props.disabled;
18
15
  var _ref = React.useContext(EditableContext) || undefined,
19
- editConfig = _ref.editConfig;
20
-
16
+ editConfig = _ref.editConfig;
21
17
  return /*#__PURE__*/React.createElement(_Form.Item, {
22
18
  name: dataIndex,
23
19
  valuePropName: "checked",
@@ -29,5 +25,4 @@ function Index(props) {
29
25
  disabled: editConfig.type === 'edit' ? disabled : false
30
26
  }));
31
27
  }
32
-
33
28
  export default /*#__PURE__*/React.memo(Index);
@@ -2,21 +2,22 @@ import "antd/es/popconfirm/style";
2
2
  import _Popconfirm from "antd/es/popconfirm";
3
3
  import "antd/es/button/style";
4
4
  import _Button from "antd/es/button";
5
+ /*
6
+ * @Author: wangxian
7
+ * @Date: 2022-03-05 10:10:07
8
+ * @LastEditTime: 2022-06-14 14:28:34
9
+ */
5
10
  import React from 'react';
6
11
  import { EditableContext } from '../interface';
7
12
  import { isFreeEditRow } from '../utils';
8
13
  import { tr } from '../../../framework/locale';
9
-
10
14
  var EditableAction = function EditableAction(props) {
11
15
  var _editConfig$editCellK;
12
-
13
16
  var type = props.type,
14
- record = props.record;
15
-
17
+ record = props.record;
16
18
  var _ref = React.useContext(EditableContext) || undefined,
17
- editableStream = _ref.editableStream,
18
- editConfig = _ref.editConfig;
19
-
19
+ editableStream = _ref.editableStream,
20
+ editConfig = _ref.editConfig;
20
21
  var onEdit = function onEdit(e) {
21
22
  e.stopPropagation();
22
23
  editableStream.next({
@@ -24,7 +25,6 @@ var EditableAction = function EditableAction(props) {
24
25
  payload: record
25
26
  });
26
27
  };
27
-
28
28
  var onCancel = function onCancel(e) {
29
29
  e.stopPropagation();
30
30
  editableStream.next({
@@ -34,7 +34,6 @@ var EditableAction = function EditableAction(props) {
34
34
  }
35
35
  });
36
36
  };
37
-
38
37
  var onSave = function onSave(e) {
39
38
  e.stopPropagation();
40
39
  editableStream.next({
@@ -49,7 +48,6 @@ var EditableAction = function EditableAction(props) {
49
48
  }
50
49
  });
51
50
  };
52
-
53
51
  var onDelete = function onDelete(e) {
54
52
  e.stopPropagation();
55
53
  editableStream.next({
@@ -57,7 +55,6 @@ var EditableAction = function EditableAction(props) {
57
55
  payload: record
58
56
  });
59
57
  };
60
-
61
58
  return /*#__PURE__*/React.createElement(React.Fragment, null, type === 'single' && /*#__PURE__*/React.createElement(React.Fragment, null, editConfig.curRow !== record._rowKey_ && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Button, {
62
59
  type: "link",
63
60
  style: {
@@ -106,5 +103,4 @@ var EditableAction = function EditableAction(props) {
106
103
  }
107
104
  }, tr('删除'))));
108
105
  };
109
-
110
106
  export default EditableAction;