ronds-metadata 1.2.8 → 1.2.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Table.d.ts +2 -0
  2. package/es/comps/FormGenerator/comps/Canvas/core/index.less +23 -23
  3. package/es/comps/FormGenerator/index.d.ts +4 -0
  4. package/es/comps/FormGenerator/settings/index.d.ts +668 -49
  5. package/es/comps/JsonEdit/index.d.ts +5 -1
  6. package/es/comps/MetadataForm/index.less +1 -1
  7. package/es/comps/MetadataForm/utils.d.ts +1 -1
  8. package/package.json +1 -1
  9. package/es/api/index.js +0 -249
  10. package/es/comps/DynamicPorts/comps/ContextMenu.js +0 -44
  11. package/es/comps/DynamicPorts/comps/DragNode.js +0 -55
  12. package/es/comps/DynamicPorts/comps/GraphHandler/index.js +0 -51
  13. package/es/comps/DynamicPorts/comps/NodeElement.js +0 -30
  14. package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.js +0 -42
  15. package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.js +0 -40
  16. package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.js +0 -55
  17. package/es/comps/DynamicPorts/comps/shape/connector.js +0 -19
  18. package/es/comps/DynamicPorts/comps/shape/edge.js +0 -91
  19. package/es/comps/DynamicPorts/comps/shape/node.js +0 -190
  20. package/es/comps/DynamicPorts/constant/index.js +0 -19
  21. package/es/comps/DynamicPorts/graph.js +0 -697
  22. package/es/comps/DynamicPorts/index.js +0 -143
  23. package/es/comps/DynamicPorts/interface.js +0 -6
  24. package/es/comps/DynamicPorts/utils.js +0 -127
  25. package/es/comps/Editable/DataCell/ButtonCell.js +0 -45
  26. package/es/comps/Editable/DataCell/ColorPicker.js +0 -33
  27. package/es/comps/Editable/DataCell/Input.js +0 -54
  28. package/es/comps/Editable/DataCell/Number.js +0 -44
  29. package/es/comps/Editable/DataCell/Select.js +0 -48
  30. package/es/comps/Editable/DataCell/Switch.js +0 -33
  31. package/es/comps/Editable/comps/EditableAction.js +0 -110
  32. package/es/comps/Editable/comps/EditableCell.js +0 -108
  33. package/es/comps/Editable/comps/EditableHeardCell.js +0 -172
  34. package/es/comps/Editable/comps/EditableRow.js +0 -118
  35. package/es/comps/Editable/comps/Texty.js +0 -277
  36. package/es/comps/Editable/index.js +0 -385
  37. package/es/comps/Editable/interface.js +0 -8
  38. package/es/comps/Editable/utils.js +0 -46
  39. package/es/comps/FileView/index.js +0 -198
  40. package/es/comps/FormGenerator/Provider.js +0 -8
  41. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Checkbox.js +0 -17
  42. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.js +0 -17
  43. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.js +0 -16
  44. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Input.js +0 -17
  45. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/List.js +0 -17
  46. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.js +0 -55
  47. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.js +0 -14
  48. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.js +0 -50
  49. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.js +0 -17
  50. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.js +0 -17
  51. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.js +0 -55
  52. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.js +0 -13
  53. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.js +0 -14
  54. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.js +0 -17
  55. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +0 -250
  56. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +0 -60
  57. package/es/comps/FormGenerator/comps/Canvas/core/index.js +0 -313
  58. package/es/comps/FormGenerator/comps/Canvas/index.js +0 -216
  59. package/es/comps/FormGenerator/comps/Settings/index.js +0 -150
  60. package/es/comps/FormGenerator/comps/Sidebar/Elements.js +0 -48
  61. package/es/comps/FormGenerator/comps/Sidebar/index.js +0 -37
  62. package/es/comps/FormGenerator/index.js +0 -56
  63. package/es/comps/FormGenerator/settings/index.js +0 -303
  64. package/es/comps/FormGenerator/settings/ruleConfig.js +0 -557
  65. package/es/comps/FormGenerator/transformer.js +0 -214
  66. package/es/comps/Icons/index.js +0 -23
  67. package/es/comps/JsonEdit/constant/index.js +0 -87
  68. package/es/comps/JsonEdit/index.js +0 -217
  69. package/es/comps/JsonView/index.js +0 -109
  70. package/es/comps/MdEdit/index.js +0 -41
  71. package/es/comps/MdNavbar/index.js +0 -180
  72. package/es/comps/MdNavbar/utils.js +0 -34
  73. package/es/comps/MdView/index.js +0 -70
  74. package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +0 -419
  75. package/es/comps/MetadataEdit/components/MetaPropsEdit.js +0 -368
  76. package/es/comps/MetadataEdit/constant/index.js +0 -69
  77. package/es/comps/MetadataEdit/hooks/index.js +0 -43
  78. package/es/comps/MetadataEdit/index.js +0 -255
  79. package/es/comps/MetadataEditV2/components/MetaFieldsEdit.js +0 -237
  80. package/es/comps/MetadataEditV2/components/MetaPropsEdit.js +0 -367
  81. package/es/comps/MetadataEditV2/constant/index.js +0 -69
  82. package/es/comps/MetadataEditV2/hooks/index.js +0 -43
  83. package/es/comps/MetadataEditV2/index.js +0 -298
  84. package/es/comps/MetadataForm/DataCell/Array.js +0 -157
  85. package/es/comps/MetadataForm/DataCell/Input.js +0 -197
  86. package/es/comps/MetadataForm/DataCell/Number.js +0 -130
  87. package/es/comps/MetadataForm/DataCell/Ref.js +0 -323
  88. package/es/comps/MetadataForm/DataCell/Select.js +0 -517
  89. package/es/comps/MetadataForm/DataCell/Switch.js +0 -115
  90. package/es/comps/MetadataForm/DataCell/layout/TableArray.js +0 -359
  91. package/es/comps/MetadataForm/HOC/index.js +0 -111
  92. package/es/comps/MetadataForm/constants.js +0 -11
  93. package/es/comps/MetadataForm/hooks/index.js +0 -128
  94. package/es/comps/MetadataForm/index.js +0 -268
  95. package/es/comps/MetadataForm/interface.js +0 -8
  96. package/es/comps/MetadataForm/utils.js +0 -108
  97. package/es/comps/locales/en-US.js +0 -24
  98. package/es/comps/locales/index.js +0 -8
  99. package/es/comps/locales/zh-CN.js +0 -24
  100. package/es/config.js +0 -50
  101. package/es/framework/graph/index.js +0 -515
  102. package/es/framework/hooks/use-async-memo.js +0 -32
  103. package/es/framework/hooks/use-sync-scroll.js +0 -106
  104. package/es/framework/http/cache.js +0 -137
  105. package/es/framework/http/cancel.js +0 -44
  106. package/es/framework/http/index.js +0 -392
  107. package/es/framework/http/msgpack.js +0 -34
  108. package/es/framework/http/msgpack5/index.js +0 -84
  109. package/es/framework/http/msgpack5/lib/codecs/DateCodec.js +0 -71
  110. package/es/framework/http/msgpack5/lib/decoder.js +0 -287
  111. package/es/framework/http/msgpack5/lib/encoder.js +0 -252
  112. package/es/framework/http/msgpack5/lib/helpers.js +0 -23
  113. package/es/framework/http/msgpack5/lib/streams.js +0 -93
  114. package/es/framework/http/types.js +0 -1
  115. package/es/framework/libs/jquery.min.js +0 -4022
  116. package/es/framework/locale/dil8/di18n.js +0 -132
  117. package/es/framework/locale/dil8/index.js +0 -3
  118. package/es/framework/locale/dil8/translate.js +0 -76
  119. package/es/framework/locale/dil8/util.js +0 -17
  120. package/es/framework/locale/index.js +0 -26
  121. package/es/framework/metadata/MetadataService.js +0 -169
  122. package/es/framework/metadata/index.js +0 -384
  123. package/es/framework/rxjs-hooks/useMemoSubject.js +0 -16
  124. package/es/framework/rxjs-hooks/useObservable.js +0 -22
  125. package/es/framework/rxjs-hooks/useObservableState.js +0 -45
  126. package/es/index.js +0 -27
  127. package/es/utils.js +0 -138
@@ -1,108 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import "antd/es/message/style";
3
- import _message from "antd/es/message";
4
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
- var _excluded = ["title", "isAddColumn", "editable", "record", "editableType", "dataIndex", "rowIndex", "children", "className"];
6
- import React from 'react';
7
- import { EditableContext } from '../interface';
8
- import { getDataCell, isFreeEditCell, isFreeEditRow } from '../utils';
9
- import './index.less';
10
- import Texty from './Texty';
11
- import { tr } from '../../../framework/locale';
12
-
13
- var EditableCell = function EditableCell(props) {
14
- var title = props.title,
15
- isAddColumn = props.isAddColumn,
16
- editable = props.editable,
17
- record = props.record,
18
- editableType = props.editableType,
19
- dataIndex = props.dataIndex,
20
- rowIndex = props.rowIndex,
21
- children = props.children,
22
- className = props.className,
23
- restProps = _objectWithoutProperties(props, _excluded);
24
-
25
- var _ref = React.useContext(EditableContext) || undefined,
26
- editableStream = _ref.editableStream,
27
- editConfig = _ref.editConfig;
28
-
29
- var onCellDoubleClick = function onCellDoubleClick() {
30
- var _editConfig$editCellK, _editConfig$editCellK2;
31
-
32
- if ((editConfig === null || editConfig === void 0 ? void 0 : editConfig.curRow) && (editConfig === null || editConfig === void 0 ? void 0 : editConfig.curRow) !== 'undefined') {
33
- if (isFreeEditRow(editConfig.curRow, rowIndex)) return;
34
-
35
- _message.warning(tr('请先保存正在编辑的行'));
36
-
37
- return;
38
- }
39
-
40
- if (((editConfig === null || editConfig === void 0 ? void 0 : (_editConfig$editCellK = editConfig.editCellKey) === null || _editConfig$editCellK === void 0 ? void 0 : _editConfig$editCellK.rowIndex) || (editConfig === null || editConfig === void 0 ? void 0 : (_editConfig$editCellK2 = editConfig.editCellKey) === null || _editConfig$editCellK2 === void 0 ? void 0 : _editConfig$editCellK2.rowIndex) === 0) && rowIndex !== editConfig.editCellKey.rowIndex) {
41
- _message.warning(tr('请先保存正在编辑的行'));
42
-
43
- return;
44
- }
45
-
46
- editableStream.next({
47
- type: 'editCellKey',
48
- payload: {
49
- dataIndex: dataIndex,
50
- rowIndex: rowIndex
51
- }
52
- });
53
- };
54
-
55
- var onCellClick = function onCellClick() {
56
- if (isAddColumn) {
57
- editableStream.next({
58
- type: 'editHeardCellKey',
59
- payload: undefined
60
- });
61
- }
62
- };
63
-
64
- if (restProps === null || restProps === void 0 ? void 0 : restProps.colSpan) {
65
- return /*#__PURE__*/React.createElement("td", _extends({}, restProps, {
66
- className: "".concat(className, " ").concat(isAddColumn && editConfig.editHeardCellKey === dataIndex ? 'border-right' : '', " "),
67
- style: {
68
- border: 0
69
- }
70
- }), children);
71
- }
72
-
73
- if (editableType === 'single') {
74
- return /*#__PURE__*/React.createElement("td", _extends({}, restProps, {
75
- className: "".concat(className, " ").concat(isAddColumn && editConfig.editHeardCellKey === dataIndex ? 'border-right' : '', " ")
76
- }), editable && editConfig.curRow === rowIndex ? getDataCell(props) : /*#__PURE__*/React.createElement(Texty, {
77
- tooltipStyle: {
78
- wordWrap: 'break-word'
79
- },
80
- tooltipMaxWidth: 800
81
- }, children));
82
- }
83
-
84
- if (editableType === 'freedom') {
85
- return /*#__PURE__*/React.createElement("td", _extends({
86
- onDoubleClick: onCellDoubleClick,
87
- onClick: onCellClick
88
- }, restProps, {
89
- className: "".concat(className, " ").concat(isAddColumn && editConfig.editHeardCellKey === dataIndex ? 'border-right' : '', " ")
90
- }), editable && (isFreeEditRow(editConfig.curRow, rowIndex) || isFreeEditCell(editConfig.editCellKey, dataIndex, rowIndex)) ? getDataCell(props) : /*#__PURE__*/React.createElement(Texty, {
91
- tooltipStyle: {
92
- wordWrap: 'break-word'
93
- },
94
- tooltipMaxWidth: 800
95
- }, children));
96
- }
97
-
98
- return /*#__PURE__*/React.createElement("td", _extends({}, restProps, {
99
- className: "".concat(className, " ").concat(isAddColumn && editConfig.editHeardCellKey === dataIndex ? 'border-right' : '', " ")
100
- }), editable ? getDataCell(props) : /*#__PURE__*/React.createElement(Texty, {
101
- tooltipStyle: {
102
- wordWrap: 'break-word'
103
- },
104
- tooltipMaxWidth: 800
105
- }, children));
106
- };
107
-
108
- export default EditableCell;
@@ -1,172 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import "antd/es/popconfirm/style";
3
- import _Popconfirm from "antd/es/popconfirm";
4
- import "antd/es/popover/style";
5
- import _Popover from "antd/es/popover";
6
- import "antd/es/button/style";
7
- import _Button from "antd/es/button";
8
- import "antd/es/input/style";
9
- import _Input from "antd/es/input";
10
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
11
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
12
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
13
- var _excluded = ["title", "dataIndex", "isAddColumn", "children", "className", "style"];
14
- import { PlusSquareOutlined, DeleteOutlined } from '@ant-design/icons';
15
- import React from 'react';
16
- import { EditableContext } from '../interface';
17
- import { tr } from '../../../framework/locale';
18
- import './index.less';
19
- import Texty from './Texty';
20
-
21
- var EditableHeardCell = function EditableHeardCell(props) {
22
- var title = props.title,
23
- dataIndex = props.dataIndex,
24
- isAddColumn = props.isAddColumn,
25
- children = props.children,
26
- className = props.className,
27
- style = props.style,
28
- restProps = _objectWithoutProperties(props, _excluded);
29
-
30
- var _ref = React.useContext(EditableContext) || undefined,
31
- editableStream = _ref.editableStream,
32
- editConfig = _ref.editConfig;
33
-
34
- var addColumnRef = React.useRef({
35
- title: ''
36
- });
37
-
38
- var _React$useState = React.useState({
39
- title: ''
40
- }),
41
- _React$useState2 = _slicedToArray(_React$useState, 2),
42
- addColumn = _React$useState2[0],
43
- setAddColumn = _React$useState2[1];
44
-
45
- var _React$useState3 = React.useState(false),
46
- _React$useState4 = _slicedToArray(_React$useState3, 2),
47
- visible = _React$useState4[0],
48
- setVisible = _React$useState4[1];
49
-
50
- var myStyle = React.useMemo(function () {
51
- var res = {};
52
-
53
- if (style === null || style === void 0 ? void 0 : style.right) {
54
- res = _objectSpread(_objectSpread({}, style), {}, {
55
- right: (style === null || style === void 0 ? void 0 : style.right) - 6
56
- });
57
- }
58
-
59
- return res;
60
- }, [style]);
61
- var myClassName = React.useMemo(function () {
62
- var _cls = className;
63
-
64
- if (_cls && _cls.indexOf('ant-table-cell-scrollbar')) {
65
- _cls = _cls.replace('ant-table-cell-scrollbar', '');
66
- }
67
-
68
- return _cls;
69
- }, [className]);
70
-
71
- var onMouseOver = function onMouseOver() {
72
- editableStream.next({
73
- type: 'editHeardCellKey',
74
- payload: dataIndex
75
- });
76
- };
77
-
78
- var onMouseLeave = function onMouseLeave() {};
79
-
80
- var onAddColumn = function onAddColumn() {
81
- setVisible(false);
82
- editableStream.next({
83
- type: 'onAddColumn',
84
- payload: _objectSpread({
85
- dataIndex: dataIndex
86
- }, addColumnRef.current)
87
- });
88
- setAddColumn({
89
- title: ''
90
- });
91
- addColumnRef.current = {
92
- title: ''
93
- };
94
- };
95
-
96
- var onDeleteColumn = function onDeleteColumn() {
97
- setVisible(false);
98
- editableStream.next({
99
- type: 'onDeleteColumn',
100
- payload: {
101
- dataIndex: dataIndex
102
- }
103
- });
104
- };
105
-
106
- var content = /*#__PURE__*/React.createElement("div", {
107
- style: {
108
- width: '100px'
109
- }
110
- }, /*#__PURE__*/React.createElement("div", {
111
- style: {
112
- marginBottom: '10px'
113
- }
114
- }, /*#__PURE__*/React.createElement(_Input, {
115
- value: addColumn.title,
116
- style: {
117
- width: '100%'
118
- },
119
- onChange: function onChange(e) {
120
- var _ = addColumnRef.current;
121
- _.title = e.target.value;
122
- setAddColumn(_objectSpread({}, _));
123
- addColumnRef.current = _;
124
- },
125
- placeholder: tr('请输入title'),
126
- onPressEnter: onAddColumn
127
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Button, {
128
- type: "primary",
129
- block: true,
130
- onClick: onAddColumn
131
- }, tr('确定'))));
132
-
133
- var onVisibleChange = function onVisibleChange(b) {
134
- setVisible(b);
135
- };
136
-
137
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("th", _extends({
138
- className: "".concat(myClassName, " ant-table-th font-bold ").concat(isAddColumn && editConfig.editHeardCellKey === dataIndex ? 'border-right ' : '', " ")
139
- }, restProps, {
140
- style: _objectSpread({}, myStyle)
141
- }), isAddColumn && /*#__PURE__*/React.createElement(_Popover, {
142
- placement: "rightTop",
143
- content: content,
144
- trigger: "click",
145
- visible: visible,
146
- onVisibleChange: onVisibleChange
147
- }, /*#__PURE__*/React.createElement("div", {
148
- className: "".concat(editConfig.editHeardCellKey === dataIndex ? 'editable-th-hover-add' : 'display-none')
149
- }, /*#__PURE__*/React.createElement(_Button, {
150
- type: "link",
151
- icon: /*#__PURE__*/React.createElement(PlusSquareOutlined, null)
152
- }))), isAddColumn && /*#__PURE__*/React.createElement("div", {
153
- className: "".concat(editConfig.editHeardCellKey === dataIndex ? 'editable-th-hover-delete' : 'display-none')
154
- }, /*#__PURE__*/React.createElement(_Popconfirm, {
155
- placement: 'left',
156
- title: tr('确认会删除该列'),
157
- onConfirm: onDeleteColumn,
158
- onCancel: function onCancel(e) {
159
- e.stopPropagation();
160
- },
161
- okText: tr('确定'),
162
- cancelText: tr('取消')
163
- }, /*#__PURE__*/React.createElement(_Button, {
164
- type: "link",
165
- icon: /*#__PURE__*/React.createElement(DeleteOutlined, null)
166
- }))), /*#__PURE__*/React.createElement("div", {
167
- onMouseOver: onMouseOver,
168
- onMouseLeave: onMouseLeave
169
- }, /*#__PURE__*/React.createElement(Texty, null, children))));
170
- };
171
-
172
- export default EditableHeardCell;
@@ -1,118 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import "antd/es/form/style";
3
- import _Form from "antd/es/form";
4
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
- import React from 'react';
6
- import { useDrag, useDrop } from 'react-dnd';
7
- import { DND_TYPE, EditableContext } from '../interface';
8
-
9
- var EditableRow = function EditableRow(props) {
10
- var record = props.record,
11
- index = props.index,
12
- className = props.className,
13
- onMove = props.onMove;
14
-
15
- var _Form$useForm = _Form.useForm(),
16
- _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
17
- form = _Form$useForm2[0];
18
-
19
- var ref = React.useRef(null);
20
-
21
- var _ref = React.useContext(EditableContext) || undefined,
22
- editableStream = _ref.editableStream;
23
-
24
- React.useEffect(function () {
25
- if (!form) return;
26
- form.setFieldsValue(record);
27
- }, [record]);
28
-
29
- var _useDrop = useDrop({
30
- accept: DND_TYPE,
31
- collect: function collect(monitor) {
32
- var _ref2 = monitor.getItem() || {},
33
- dragIndex = _ref2.index;
34
-
35
- if (dragIndex === index || !onMove) {
36
- return {};
37
- }
38
-
39
- return {
40
- isOver: monitor.isOver(),
41
- dropClassName: dragIndex < index ? ' drop-over-downward' : ' drop-over-upward'
42
- };
43
- },
44
- drop: function drop(item, monitor) {
45
- onMove && onMove({
46
- dragIndex: item.index,
47
- hoverIndex: index
48
- });
49
- }
50
- }),
51
- _useDrop2 = _slicedToArray(_useDrop, 2),
52
- _useDrop2$ = _useDrop2[0],
53
- isOver = _useDrop2$.isOver,
54
- dropClassName = _useDrop2$.dropClassName,
55
- drop = _useDrop2[1];
56
-
57
- var _useDrag = useDrag({
58
- item: {
59
- index: index,
60
- type: DND_TYPE
61
- },
62
- end: function end(item, monitor) {
63
- var dropResult = monitor.getDropResult();
64
-
65
- if (item && dropResult) {}
66
- },
67
- collect: function collect(monitor) {
68
- return {
69
- isDragging: monitor.isDragging()
70
- };
71
- }
72
- }),
73
- _useDrag2 = _slicedToArray(_useDrag, 2),
74
- drag = _useDrag2[1];
75
-
76
- onMove && drop(drag(ref));
77
-
78
- var onValuesChange = function onValuesChange(values, allValues) {
79
- if (editableStream) {
80
- editableStream.next({
81
- type: 'onValuesChange',
82
- payload: {
83
- rowIdx: record === null || record === void 0 ? void 0 : record._rowKey_,
84
- values: values,
85
- allValues: allValues
86
- }
87
- });
88
- }
89
- };
90
-
91
- var onRowClick = function onRowClick() {
92
- editableStream.next({
93
- type: 'onRowClick',
94
- payload: {
95
- record: record
96
- }
97
- });
98
- };
99
-
100
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Form, {
101
- name: "editable_".concat(record === null || record === void 0 ? void 0 : record._rowKey_, "_"),
102
- form: form,
103
- initialValues: record,
104
- onValuesChange: onValuesChange,
105
- component: false
106
- }, /*#__PURE__*/React.createElement("tr", _extends({
107
- ref: ref
108
- }, props, {
109
- className: "".concat(index % 2 === 0 ? 'ant-table-row--even' : 'ant-table-row--odd', " ").concat(className, " ").concat(isOver ? dropClassName : '', " "),
110
- style: {
111
- height: '30px',
112
- fontSize: '13px'
113
- },
114
- onClick: onRowClick
115
- }))));
116
- };
117
-
118
- export default EditableRow;
@@ -1,277 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
5
- import _createClass from "@babel/runtime/helpers/esm/createClass";
6
- import _inherits from "@babel/runtime/helpers/esm/inherits";
7
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
8
- var _excluded = ["tagName", "children", "placement", "innerRef", "showDelay", "hideDelay", "tooltip", "tooltipClassName", "tooltipStyle", "tooltipMaxWidth", "hideArrow", "container"];
9
- import React from 'react';
10
- import ReactDom from 'react-dom';
11
- import { Popper } from 'react-popper';
12
- import './Texty.less';
13
- var modifiers = [{
14
- name: 'preventOverflow',
15
- options: {
16
- mainAxis: true,
17
- padding: 10
18
- }
19
- }];
20
- /**
21
- * 基于Popper的tooltip
22
- */
23
-
24
- var Texty = /*#__PURE__*/function (_React$PureComponent) {
25
- _inherits(Texty, _React$PureComponent);
26
-
27
- var _super = _createSuper(Texty);
28
-
29
- function Texty() {
30
- var _this;
31
-
32
- _classCallCheck(this, Texty);
33
-
34
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
35
- args[_key] = arguments[_key];
36
- }
37
-
38
- _this = _super.call.apply(_super, [this].concat(args));
39
- _this.state = {
40
- isHovered: false
41
- };
42
- _this.listenTimer = void 0;
43
- _this.targetNode = void 0;
44
- _this.hideTimer = void 0;
45
- _this.showTimer = void 0;
46
-
47
- _this.renderTooltip = function (_ref) {
48
- var ref = _ref.ref,
49
- style = _ref.style,
50
- placement = _ref.placement,
51
- arrowProps = _ref.arrowProps;
52
- var _this$props = _this.props,
53
- children = _this$props.children,
54
- container = _this$props.container,
55
- tooltip = _this$props.tooltip,
56
- tooltipClassName = _this$props.tooltipClassName,
57
- tooltipStyle = _this$props.tooltipStyle,
58
- tooltipMaxWidth = _this$props.tooltipMaxWidth,
59
- arrowClassName = _this$props.arrowClassName,
60
- hideArrow = _this$props.hideArrow;
61
- var content = tooltip || children;
62
- var extraStyle = tooltipMaxWidth ? _objectSpread(_objectSpread({}, tooltipStyle), {}, {
63
- maxWidth: tooltipMaxWidth
64
- }) : tooltipStyle;
65
- return /*#__PURE__*/ReactDom.createPortal( /*#__PURE__*/React.createElement("div", {
66
- ref: ref,
67
- "data-texty-tooltip": placement,
68
- className: tooltipClassName,
69
- style: extraStyle ? _objectSpread(_objectSpread({}, style), extraStyle) : style,
70
- onClick: _this.handleMouseEvent,
71
- onDoubleClick: _this.handleMouseEvent,
72
- onContextMenu: _this.handleMouseEvent,
73
- onMouseDown: _this.handleMouseEvent,
74
- onMouseUp: _this.handleMouseEvent
75
- }, content, !hideArrow && /*#__PURE__*/React.createElement("div", {
76
- ref: arrowProps.ref,
77
- "data-texty-arrow": placement,
78
- className: arrowClassName,
79
- style: arrowProps.style
80
- })), container || _this.targetNode.ownerDocument.body);
81
- };
82
-
83
- _this.setTargetRef = function (ref) {
84
- _this.props.innerRef && _this.props.innerRef(ref);
85
- _this.targetNode = ref; // console.log("setTargetRef",ref,this.targetNode)
86
- };
87
-
88
- _this.handleMouseEvent = function (e) {
89
- e.stopPropagation();
90
- };
91
-
92
- _this.handleScroll = function (e) {
93
- var _e$srcElement, _e$srcElement2;
94
-
95
- if ((e === null || e === void 0 ? void 0 : (_e$srcElement = e.srcElement) === null || _e$srcElement === void 0 ? void 0 : _e$srcElement.className) === 'contract-trigger') {
96
- return;
97
- }
98
-
99
- if ((e === null || e === void 0 ? void 0 : (_e$srcElement2 = e.srcElement) === null || _e$srcElement2 === void 0 ? void 0 : _e$srcElement2.className) === 'texty-scroll') {
100
- return;
101
- }
102
-
103
- _this.setState({
104
- isHovered: false
105
- });
106
- };
107
-
108
- _this.handleMouseEnter = function (e) {
109
- // console.log('handleMouseEnter');
110
- // eslint-disable-next-line react/prop-types
111
- var _this$props2 = _this.props,
112
- showDelay = _this$props2.showDelay,
113
- onMouseEnter = _this$props2.onMouseEnter;
114
- onMouseEnter && onMouseEnter(e);
115
-
116
- _this._clearHideTimer();
117
-
118
- if (!showDelay) {
119
- _this.setState({
120
- isHovered: true
121
- });
122
-
123
- return;
124
- }
125
-
126
- _this.showTimer = setTimeout(function () {
127
- _this.setState({
128
- isHovered: true
129
- });
130
-
131
- delete _this.showTimer;
132
- }, showDelay);
133
- };
134
-
135
- _this.handleMouseLeave = function (e) {
136
- // console.log('handleMouseLeave');
137
- // eslint-disable-next-line react/prop-types
138
- var _this$props3 = _this.props,
139
- hideDelay = _this$props3.hideDelay,
140
- onMouseLeave = _this$props3.onMouseLeave;
141
- onMouseLeave && onMouseLeave(e);
142
-
143
- _this._clearShowTimer();
144
-
145
- var isHovered = _this.state.isHovered;
146
- if (!isHovered) return;
147
-
148
- if (!hideDelay) {
149
- _this.setState({
150
- isHovered: false
151
- });
152
-
153
- return;
154
- }
155
-
156
- _this.hideTimer = setTimeout(function () {
157
- _this.setState({
158
- isHovered: false
159
- });
160
-
161
- delete _this.hideTimer;
162
- }, hideDelay);
163
- };
164
-
165
- return _this;
166
- }
167
-
168
- _createClass(Texty, [{
169
- key: "componentDidUpdate",
170
- value: function componentDidUpdate() {
171
- var _this2 = this;
172
-
173
- // console.log(this.state);
174
- if (this.state.isHovered) {
175
- window.addEventListener('scroll', this.handleScroll, true); // react - virtualized - auto - sizer would trigger scroll events after tooltip shown in some case,we have to skip those scroll events
176
-
177
- this.listenTimer = setTimeout(function () {
178
- window.removeEventListener('scroll', _this2.handleScroll, true);
179
- window.addEventListener('scroll', _this2.handleScroll, true);
180
- delete _this2.listenTimer;
181
- }, 50);
182
- } else {
183
- this._clearListenTimer();
184
-
185
- window.removeEventListener('scroll', this.handleScroll, true);
186
- }
187
- }
188
- }, {
189
- key: "componentWillUnmount",
190
- value: function componentWillUnmount() {
191
- this._clearListenTimer();
192
-
193
- window.removeEventListener('scroll', this.handleScroll, true);
194
-
195
- this._clearShowTimer();
196
-
197
- this._clearHideTimer();
198
- }
199
- }, {
200
- key: "render",
201
- value: function render() {
202
- /* eslint-disable no-unused-vars */
203
- var _this$props4 = this.props,
204
- tagName = _this$props4.tagName,
205
- children = _this$props4.children,
206
- placement = _this$props4.placement,
207
- innerRef = _this$props4.innerRef,
208
- showDelay = _this$props4.showDelay,
209
- hideDelay = _this$props4.hideDelay,
210
- tooltip = _this$props4.tooltip,
211
- tooltipClassName = _this$props4.tooltipClassName,
212
- tooltipStyle = _this$props4.tooltipStyle,
213
- tooltipMaxWidth = _this$props4.tooltipMaxWidth,
214
- hideArrow = _this$props4.hideArrow,
215
- container = _this$props4.container,
216
- rest = _objectWithoutProperties(_this$props4, _excluded);
217
- /* eslint-enable no-unused-vars */
218
-
219
-
220
- var Tag = tagName;
221
-
222
- if (!children) {
223
- return null; // return <Tag { ...rest } ref={ this.setTargetRef } data-texty={ false } />;
224
- }
225
-
226
- var target = this.targetNode;
227
- var isTruncated = !!target && target.scrollWidth > target.offsetWidth;
228
- var showTooltip = this.state.isHovered && isTruncated; // console.log("showTooltip",showTooltip)
229
-
230
- return /*#__PURE__*/React.createElement(Tag, _extends({}, rest, {
231
- ref: this.setTargetRef,
232
- "data-texty": showTooltip,
233
- onMouseEnter: this.handleMouseEnter,
234
- onMouseLeave: this.handleMouseLeave
235
- }), children, showTooltip && /*#__PURE__*/React.createElement(Popper, {
236
- referenceElement: target,
237
- placement: placement,
238
- modifiers: modifiers
239
- }, this.renderTooltip));
240
- }
241
- }, {
242
- key: "_clearListenTimer",
243
- value: function _clearListenTimer() {
244
- if (this.listenTimer) {
245
- clearTimeout(this.listenTimer);
246
- delete this.listenTimer;
247
- }
248
- }
249
- }, {
250
- key: "_clearShowTimer",
251
- value: function _clearShowTimer() {
252
- if (this.showTimer) {
253
- clearTimeout(this.showTimer);
254
- delete this.showTimer;
255
- }
256
- }
257
- }, {
258
- key: "_clearHideTimer",
259
- value: function _clearHideTimer() {
260
- if (this.hideTimer) {
261
- clearTimeout(this.hideTimer);
262
- delete this.hideTimer;
263
- }
264
- }
265
- }]);
266
-
267
- return Texty;
268
- }(React.PureComponent);
269
-
270
- Texty.defaultProps = {
271
- tagName: 'div',
272
- showDelay: 150,
273
- hideDelay: 150,
274
- hideArrow: true,
275
- placement: 'top'
276
- };
277
- export default Texty;