@arim-aisdc/public-components 2.0.21 → 2.0.23
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/dist/components/CustomForm/CustomForm.js +2 -1
- package/dist/components/CustomForm/customFormItemInputNumber/index.d.ts +3 -1
- package/dist/components/CustomForm/customFormItemInputNumber/index.js +4 -2
- package/dist/components/CustomForm/customFormItemInputNumber/index.less +11 -5
- package/dist/components/Icon/index.js +2 -4
- package/dist/components/TableMax/TableBody/Row.js +4 -2
- package/dist/components/TableMax/TableBody/index.d.ts +1 -1
- package/dist/components/TableMax/TableBody/index.js +40 -21
- package/dist/components/TableMax/TableBody/index.less +6 -0
- package/dist/components/TableMax/TableMax.js +38 -18
- package/package.json +1 -1
|
@@ -258,7 +258,8 @@ var CustomForm = function CustomForm(_ref, ref) {
|
|
|
258
258
|
break;
|
|
259
259
|
case CustomFormItemType.Number:
|
|
260
260
|
element = /*#__PURE__*/_jsx(CustomFormItemInputNumber, {
|
|
261
|
-
item: item
|
|
261
|
+
item: item,
|
|
262
|
+
commonChange: commonChange
|
|
262
263
|
});
|
|
263
264
|
break;
|
|
264
265
|
case CustomFormItemType.Switch:
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { fieldType, inputValueType } from '../type';
|
|
1
2
|
import './index.less';
|
|
2
3
|
interface CustomFormItemInputNumberProps {
|
|
3
4
|
item: any;
|
|
5
|
+
commonChange: (e: any, item: fieldType, type?: inputValueType) => void;
|
|
4
6
|
value?: number;
|
|
5
7
|
onChange?: (e: any) => void;
|
|
6
8
|
}
|
|
7
|
-
declare const CustomFormItemInputNumber: ({ item, value, onChange }: CustomFormItemInputNumberProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const CustomFormItemInputNumber: ({ item, commonChange, value, onChange }: CustomFormItemInputNumberProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
export default CustomFormItemInputNumber;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { InputNumber } from 'antd';
|
|
2
2
|
import "./index.less";
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
4
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
5
|
var CustomFormItemInputNumber = function CustomFormItemInputNumber(_ref) {
|
|
7
6
|
var item = _ref.item,
|
|
7
|
+
commonChange = _ref.commonChange,
|
|
8
8
|
value = _ref.value,
|
|
9
9
|
_onChange = _ref.onChange;
|
|
10
|
-
return /*#__PURE__*/_jsxs(
|
|
10
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
11
|
+
className: "customFormItemInputNumber",
|
|
11
12
|
children: [/*#__PURE__*/_jsx(InputNumber, {
|
|
12
13
|
placeholder: item.inputTips,
|
|
13
14
|
precision: item.precision,
|
|
@@ -17,6 +18,7 @@ var CustomFormItemInputNumber = function CustomFormItemInputNumber(_ref) {
|
|
|
17
18
|
step: item.step,
|
|
18
19
|
onChange: function onChange(e) {
|
|
19
20
|
_onChange(e);
|
|
21
|
+
commonChange(e, item);
|
|
20
22
|
},
|
|
21
23
|
value: value
|
|
22
24
|
}), (item === null || item === void 0 ? void 0 : item.unit) && /*#__PURE__*/_jsx("span", {
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
.customFormItemInputNumber {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
|
|
5
|
+
.unit {
|
|
6
|
+
font-weight: 400;
|
|
7
|
+
font-size: 14px;
|
|
8
|
+
margin-left: 6px;
|
|
9
|
+
color: @globalColor1;
|
|
10
|
+
flex-shrink: 0;
|
|
11
|
+
}
|
|
6
12
|
}
|
|
@@ -9,7 +9,7 @@ var Icon = function Icon(_ref) {
|
|
|
9
9
|
name = _ref.name,
|
|
10
10
|
prefix = _ref.prefix,
|
|
11
11
|
style = _ref.style,
|
|
12
|
-
|
|
12
|
+
onClick = _ref.onClick;
|
|
13
13
|
var _useConfig = useConfig(),
|
|
14
14
|
theme = _useConfig.theme;
|
|
15
15
|
var iconPrefix = useMemo(function () {
|
|
@@ -20,9 +20,7 @@ var Icon = function Icon(_ref) {
|
|
|
20
20
|
return /*#__PURE__*/_jsx("i", {
|
|
21
21
|
className: "public-icon ".concat(className, " iconfont-").concat(iconPrefix, " icon-").concat(iconPrefix, "-").concat(name),
|
|
22
22
|
style: style,
|
|
23
|
-
onClick:
|
|
24
|
-
return _onClick(event);
|
|
25
|
-
}
|
|
23
|
+
onClick: onClick
|
|
26
24
|
});
|
|
27
25
|
};
|
|
28
26
|
export default Icon;
|
|
@@ -65,8 +65,10 @@ var Row = function Row(_ref) {
|
|
|
65
65
|
var timerRef = useRef();
|
|
66
66
|
var _useDrop = useDrop({
|
|
67
67
|
accept: 'TABLE_ROW',
|
|
68
|
-
drop: function drop(formDatas
|
|
69
|
-
|
|
68
|
+
drop: function drop(formDatas
|
|
69
|
+
// monitor
|
|
70
|
+
) {
|
|
71
|
+
// console.log('drop-row', monitor, row);
|
|
70
72
|
return reorderRow === null || reorderRow === void 0 ? void 0 : reorderRow(formDatas, {
|
|
71
73
|
hoverRow: row,
|
|
72
74
|
targetTableId: tableId
|
|
@@ -70,5 +70,5 @@ type TableBodyPropsType = {
|
|
|
70
70
|
};
|
|
71
71
|
tableTooltip: boolean;
|
|
72
72
|
};
|
|
73
|
-
declare const TableBody: ({
|
|
73
|
+
declare const TableBody: ({ tableBodyRef, table, tableId, theme, reorderRow, rowSelectedId, setRowSelectedId, rowHighLightId, setRowHighLightId, selectedRowChange, onSelectChange, canSelection, selectionWithoutChecked, tableContainerWidth, selectedRowDragging, setSelectedRowDragging, canRowDrag, rowKey, loading, rowClassName, cellClassName, rowStyle, getCellProps, rowHeight, renderSubComponent, onRowMouseEnter, onRowMouseLeave, onRowMouseClick, onRowMouseDoubleClick, disableDragRowIds, selectRowWhenClick, datas, canEditRowWhenDClick, editingRowId, handleEditRowWhenDClick, dragBeforeStart, shadowColumnInfo, getContextMenu, onClickContextMenu, getRowHoverTipConfig, tableTooltip, }: TableBodyPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
74
74
|
export default TableBody;
|
|
@@ -20,17 +20,16 @@ import { CustomDragLayer } from "../components/CustomDragerLayer";
|
|
|
20
20
|
import { useCallback, useMemo, useState } from 'react';
|
|
21
21
|
import { createPortal } from 'react-dom';
|
|
22
22
|
import { useConfig } from "../../ConfigProvider";
|
|
23
|
+
import Empty from "../../Empty";
|
|
23
24
|
import Row from "./Row";
|
|
24
25
|
import ContextMenu from "./contextMenu/ContextMenu";
|
|
25
26
|
import "./index.less";
|
|
26
|
-
import Empty from "../../Empty";
|
|
27
27
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
28
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
29
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
30
30
|
var TableBody = function TableBody(_ref) {
|
|
31
31
|
var _headerGroups, _table$getRowModel$ro2;
|
|
32
|
-
var
|
|
33
|
-
tableBodyRef = _ref.tableBodyRef,
|
|
32
|
+
var tableBodyRef = _ref.tableBodyRef,
|
|
34
33
|
table = _ref.table,
|
|
35
34
|
tableId = _ref.tableId,
|
|
36
35
|
theme = _ref.theme,
|
|
@@ -72,8 +71,7 @@ var TableBody = function TableBody(_ref) {
|
|
|
72
71
|
getRowHoverTipConfig = _ref.getRowHoverTipConfig,
|
|
73
72
|
tableTooltip = _ref.tableTooltip;
|
|
74
73
|
var _useConfig = useConfig(),
|
|
75
|
-
root = _useConfig.root
|
|
76
|
-
renderEmpty = _useConfig.renderEmpty;
|
|
74
|
+
root = _useConfig.root;
|
|
77
75
|
var headerGroups = table.getHeaderGroups();
|
|
78
76
|
var headers = (headerGroups === null || headerGroups === void 0 || (_headerGroups = headerGroups[headerGroups.length - 1]) === null || _headerGroups === void 0 ? void 0 : _headerGroups.headers) || [];
|
|
79
77
|
var _useState = useState({
|
|
@@ -203,17 +201,34 @@ var TableBody = function TableBody(_ref) {
|
|
|
203
201
|
var _useDrop = useDrop({
|
|
204
202
|
accept: 'TABLE_ROW',
|
|
205
203
|
drop: function drop(formDatas) {
|
|
204
|
+
// console.log('drop-empty did');
|
|
206
205
|
return reorderRow === null || reorderRow === void 0 ? void 0 : reorderRow(formDatas, {
|
|
207
206
|
hoverRow: {
|
|
208
207
|
index: 0
|
|
209
208
|
},
|
|
210
209
|
targetTableId: tableId
|
|
211
210
|
});
|
|
212
|
-
// return reorderRow?.(draggedRow, { ...row, tableId });
|
|
213
211
|
}
|
|
214
212
|
}),
|
|
215
213
|
_useDrop2 = _slicedToArray(_useDrop, 2),
|
|
216
|
-
|
|
214
|
+
dropEmptyRef = _useDrop2[1];
|
|
215
|
+
var _useDrop3 = useDrop({
|
|
216
|
+
accept: 'TABLE_ROW',
|
|
217
|
+
drop: function drop(formDatas, monitor) {
|
|
218
|
+
if (monitor.didDrop()) {
|
|
219
|
+
// drop到内部的row时,这里不再处理
|
|
220
|
+
// console.log('drop-table-empty stop');
|
|
221
|
+
return undefined;
|
|
222
|
+
}
|
|
223
|
+
// console.log('drop-table-empty did');
|
|
224
|
+
return reorderRow === null || reorderRow === void 0 ? void 0 : reorderRow(formDatas, {
|
|
225
|
+
hoverRow: undefined,
|
|
226
|
+
targetTableId: tableId
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}),
|
|
230
|
+
_useDrop4 = _slicedToArray(_useDrop3, 2),
|
|
231
|
+
dropTableEmptyRef = _useDrop4[1];
|
|
217
232
|
var LoadingAndEmptyContent = function LoadingAndEmptyContent() {
|
|
218
233
|
return /*#__PURE__*/_jsx("div", {
|
|
219
234
|
className: "empty-container",
|
|
@@ -227,7 +242,7 @@ var TableBody = function TableBody(_ref) {
|
|
|
227
242
|
},
|
|
228
243
|
children: loading ? /*#__PURE__*/_jsx(Spin, {}) : /*#__PURE__*/_jsx("span", {
|
|
229
244
|
className: "empty-content",
|
|
230
|
-
ref:
|
|
245
|
+
ref: dropEmptyRef,
|
|
231
246
|
children: /*#__PURE__*/_jsx(Empty, {})
|
|
232
247
|
})
|
|
233
248
|
})
|
|
@@ -301,19 +316,23 @@ var TableBody = function TableBody(_ref) {
|
|
|
301
316
|
tableId: tableId
|
|
302
317
|
}),
|
|
303
318
|
// document.body,
|
|
304
|
-
root ? document.querySelector(root) : document.body), showTable ? /*#__PURE__*/
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
319
|
+
root ? document.querySelector(root) : document.body), showTable ? /*#__PURE__*/_jsx("div", {
|
|
320
|
+
className: "table-max-table-body-table-wrapper",
|
|
321
|
+
ref: dropTableEmptyRef,
|
|
322
|
+
children: /*#__PURE__*/_jsxs("table", {
|
|
323
|
+
children: [/*#__PURE__*/_jsx("colgroup", {
|
|
324
|
+
children: headers.map(function (header) {
|
|
325
|
+
var _header$column;
|
|
326
|
+
var size = (header === null || header === void 0 || (_header$column = header.column) === null || _header$column === void 0 ? void 0 : _header$column.getSize()) || 120;
|
|
327
|
+
return /*#__PURE__*/_jsx("col", {
|
|
328
|
+
width: size
|
|
329
|
+
}, header.id);
|
|
330
|
+
})
|
|
331
|
+
}), /*#__PURE__*/_jsx("tbody", {
|
|
332
|
+
id: "table-max-tableBody-tbody-".concat(tableId),
|
|
333
|
+
children: TBodyContent()
|
|
334
|
+
})]
|
|
335
|
+
})
|
|
317
336
|
}) : LoadingAndEmptyContent(), /*#__PURE__*/_jsx(ContextMenu, _objectSpread(_objectSpread({}, contextMenuData), {}, {
|
|
318
337
|
onClickContextMenu: onClickContextMenu,
|
|
319
338
|
closeContextMenu: closeContextMenu
|
|
@@ -787,7 +787,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
787
787
|
targetTableId = toDatas.targetTableId;
|
|
788
788
|
if (!dragBeforeEnd(toDatas, fromDatas)) return;
|
|
789
789
|
var dragFromRowIndex = draggedRow.index;
|
|
790
|
-
var targetRowIndex = hoverRow.index;
|
|
790
|
+
var targetRowIndex = hoverRow === null || hoverRow === void 0 ? void 0 : hoverRow.index;
|
|
791
791
|
var draggedRowsIndexList = draggedRows === null || draggedRows === void 0 ? void 0 : draggedRows.map(function (row) {
|
|
792
792
|
return row.index;
|
|
793
793
|
});
|
|
@@ -796,9 +796,14 @@ var TableMax = function TableMax(_ref) {
|
|
|
796
796
|
aheadOfTargetRowNumber = 0;
|
|
797
797
|
var newTableDatas;
|
|
798
798
|
if (sourceTableId !== targetTableId) {
|
|
799
|
-
var _newTableDatas;
|
|
800
799
|
newTableDatas = _toConsumableArray(tableDatas);
|
|
801
|
-
(
|
|
800
|
+
if (targetRowIndex !== undefined) {
|
|
801
|
+
var _newTableDatas;
|
|
802
|
+
(_newTableDatas = newTableDatas).splice.apply(_newTableDatas, [targetRowIndex, 0].concat(_toConsumableArray(draggedRows)));
|
|
803
|
+
} else {
|
|
804
|
+
var _newTableDatas2;
|
|
805
|
+
(_newTableDatas2 = newTableDatas).push.apply(_newTableDatas2, _toConsumableArray(draggedRows));
|
|
806
|
+
}
|
|
802
807
|
rowOrderChange === null || rowOrderChange === void 0 || rowOrderChange({
|
|
803
808
|
sourceTableId: sourceTableId,
|
|
804
809
|
targetTableId: targetTableId,
|
|
@@ -813,31 +818,46 @@ var TableMax = function TableMax(_ref) {
|
|
|
813
818
|
}
|
|
814
819
|
// 多选行拖动(如果有多选行,且拖拽行属于选中行,则所有选中行跟随拖拽一起移动)
|
|
815
820
|
if (isMultipleDrag) {
|
|
816
|
-
var _newTableDatas2;
|
|
817
821
|
draggedRows.forEach(function (item) {
|
|
818
|
-
//如果目标行等于拖拽行,则取消拖拽操作
|
|
819
|
-
if (targetRowIndex === item.index) {
|
|
820
|
-
isDraggedToSourceRow = true;
|
|
821
|
-
}
|
|
822
|
-
if (item.index < targetRowIndex) {
|
|
823
|
-
aheadOfTargetRowNumber++;
|
|
824
|
-
}
|
|
825
822
|
if (draggedRowsIndexList.includes(item.index)) {
|
|
826
823
|
draggedDatas.push(tableDatas[item.index]);
|
|
827
824
|
}
|
|
828
825
|
});
|
|
829
|
-
if (
|
|
826
|
+
if (targetRowIndex !== undefined) {
|
|
827
|
+
var _newTableDatas3;
|
|
828
|
+
draggedRows.forEach(function (item) {
|
|
829
|
+
//如果目标行等于拖拽行,则取消拖拽操作
|
|
830
|
+
if (targetRowIndex === item.index) {
|
|
831
|
+
isDraggedToSourceRow = true;
|
|
832
|
+
}
|
|
833
|
+
if (item.index < targetRowIndex) {
|
|
834
|
+
aheadOfTargetRowNumber++;
|
|
835
|
+
}
|
|
836
|
+
});
|
|
837
|
+
if (isDraggedToSourceRow) return;
|
|
830
838
|
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
839
|
+
//统一删除选中行
|
|
840
|
+
newTableDatas = tableDatas.filter(function (data, idx) {
|
|
841
|
+
return !draggedRowsIndexList.includes(idx);
|
|
842
|
+
});
|
|
843
|
+
(_newTableDatas3 = newTableDatas).splice.apply(_newTableDatas3, [targetRowIndex > dragFromRowIndex ? targetRowIndex - aheadOfTargetRowNumber + 1 : targetRowIndex - aheadOfTargetRowNumber, 0].concat(draggedDatas));
|
|
844
|
+
} else {
|
|
845
|
+
var _newTableDatas4;
|
|
846
|
+
//统一删除选中行
|
|
847
|
+
newTableDatas = tableDatas.filter(function (data, idx) {
|
|
848
|
+
return !draggedRowsIndexList.includes(idx);
|
|
849
|
+
});
|
|
850
|
+
(_newTableDatas4 = newTableDatas).push.apply(_newTableDatas4, draggedDatas);
|
|
851
|
+
}
|
|
836
852
|
setTableDatas(_toConsumableArray(newTableDatas));
|
|
837
853
|
} else {
|
|
838
854
|
// 单选行拖动
|
|
839
855
|
newTableDatas = _toConsumableArray(tableDatas);
|
|
840
|
-
|
|
856
|
+
if (targetRowIndex !== undefined) {
|
|
857
|
+
newTableDatas.splice(targetRowIndex, 0, newTableDatas.splice(dragFromRowIndex, 1)[0]);
|
|
858
|
+
} else {
|
|
859
|
+
newTableDatas.push(newTableDatas.splice(dragFromRowIndex, 1)[0]);
|
|
860
|
+
}
|
|
841
861
|
setTableDatas(newTableDatas);
|
|
842
862
|
}
|
|
843
863
|
rowOrderChange === null || rowOrderChange === void 0 || rowOrderChange({
|