@arim-aisdc/public-components 2.0.24 → 2.0.25
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/assets/iconfont/table/iconfont.css +11 -13
- package/dist/assets/iconfont/table/iconfont.ttf +0 -0
- package/dist/components/ConfigProvider/context.d.ts +2 -0
- package/dist/components/CustomForm/CustomForm.js +1 -0
- package/dist/components/CustomForm/index.less +6 -6
- package/dist/components/GlobalTip/MessageTip/MessageTip.d.ts +1 -0
- package/dist/components/GlobalTip/MessageTip/MessageTip.js +3 -2
- package/dist/components/GlobalTip/MessageTip/index.less +15 -0
- package/dist/components/GlobalTip/ModalTip/ModalTip.js +2 -1
- package/dist/components/QueryFilter/index.less +7 -7
- package/dist/components/TableMax/TableBody/Row.d.ts +9 -2
- package/dist/components/TableMax/TableBody/Row.js +27 -5
- package/dist/components/TableMax/TableBody/index.d.ts +2 -1
- package/dist/components/TableMax/TableBody/index.js +82 -4
- package/dist/components/TableMax/TableBody/index.less +36 -12
- package/dist/components/TableMax/TableHeader/Cell.d.ts +2 -1
- package/dist/components/TableMax/TableHeader/Cell.js +6 -2
- package/dist/components/TableMax/TableHeader/index.d.ts +2 -1
- package/dist/components/TableMax/TableHeader/index.js +6 -3
- package/dist/components/TableMax/TableHeader/index.less +13 -7
- package/dist/components/TableMax/TableMax.d.ts +1 -1
- package/dist/components/TableMax/TableMax.js +102 -40
- package/dist/components/TableMax/components/ColumnSetting/index.d.ts +2 -0
- package/dist/components/TableMax/components/ColumnSetting/index.js +50 -12
- package/dist/components/TableMax/components/ColumnSetting/index.less +21 -10
- package/dist/components/TableMax/components/CustomDragerLayer/index.d.ts +1 -1
- package/dist/components/TableMax/components/CustomDragerLayer/index.js +3 -2
- package/dist/components/TableMax/components/CustomDragerLayer/index.less +2 -3
- package/dist/components/TableMax/tableMax.less +51 -3
- package/dist/components/TableMax/type.d.ts +24 -2
- package/dist/components/TableMax/type.js +17 -1
- package/dist/components/TableMax/utils.d.ts +3 -2
- package/dist/components/TableMax/utils.js +5 -4
- package/package.json +105 -105
- package/dist/assets/iconfont/table/demo.css +0 -539
- package/dist/assets/iconfont/table/demo_index.html +0 -372
- package/dist/assets/iconfont/table/iconfont.js +0 -42
- package/dist/assets/iconfont/table/iconfont.json +0 -65
- package/dist/assets/iconfont/table/iconfont.woff +0 -0
- package/dist/assets/iconfont/table/iconfont.woff2 +0 -0
|
@@ -1,47 +1,45 @@
|
|
|
1
1
|
@font-face {
|
|
2
|
-
font-family:
|
|
3
|
-
src: url('iconfont.
|
|
4
|
-
url('iconfont.woff?t=1727342206392') format('woff'),
|
|
5
|
-
url('iconfont.ttf?t=1727342206392') format('truetype');
|
|
2
|
+
font-family: iconfont-table; /* Project id 4453758 */
|
|
3
|
+
src: url('iconfont.ttf?t=1728885230733') format('truetype');
|
|
6
4
|
}
|
|
7
5
|
|
|
8
6
|
.iconfont-table {
|
|
9
|
-
font-family:
|
|
7
|
+
font-family: iconfont-table !important;
|
|
10
8
|
font-size: 16px;
|
|
11
9
|
font-style: normal;
|
|
12
10
|
-webkit-font-smoothing: antialiased;
|
|
13
11
|
-moz-osx-font-smoothing: grayscale;
|
|
14
12
|
}
|
|
15
13
|
|
|
16
|
-
.icon-table-midu
|
|
14
|
+
.icon-table-midu::before {
|
|
17
15
|
content: "\e87d";
|
|
18
16
|
}
|
|
19
17
|
|
|
20
|
-
.icon-table-delete
|
|
18
|
+
.icon-table-delete::before {
|
|
21
19
|
content: "\e87c";
|
|
22
20
|
}
|
|
23
21
|
|
|
24
|
-
.icon-table-shuaxin
|
|
22
|
+
.icon-table-shuaxin::before {
|
|
25
23
|
content: "\e87b";
|
|
26
24
|
}
|
|
27
25
|
|
|
28
|
-
.icon-table-upload
|
|
26
|
+
.icon-table-upload::before {
|
|
29
27
|
content: "\e878";
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
.icon-table-download
|
|
30
|
+
.icon-table-download::before {
|
|
33
31
|
content: "\e87a";
|
|
34
32
|
}
|
|
35
33
|
|
|
36
|
-
.icon-table-shezhi
|
|
34
|
+
.icon-table-shezhi::before {
|
|
37
35
|
content: "\e643";
|
|
38
36
|
}
|
|
39
37
|
|
|
40
|
-
.icon-table-zhexian
|
|
38
|
+
.icon-table-zhexian::before {
|
|
41
39
|
content: "\e644";
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
.icon-table-biaoge
|
|
42
|
+
.icon-table-biaoge::before {
|
|
45
43
|
content: "\e645";
|
|
46
44
|
}
|
|
47
45
|
|
|
Binary file
|
|
@@ -16,6 +16,8 @@ export interface ConfigConsumerProps {
|
|
|
16
16
|
root?: string;
|
|
17
17
|
/** 空数据图标组件 */
|
|
18
18
|
renderEmpty?: (theme?: ThemeType) => React.ReactNode;
|
|
19
|
+
/**request函数 用于下载*/
|
|
20
|
+
request?: (...params: any[]) => Promise<Blob>;
|
|
19
21
|
}
|
|
20
22
|
export declare const DEFAULT_CONTEXT: {
|
|
21
23
|
theme: string;
|
|
@@ -340,6 +340,7 @@ var CustomForm = function CustomForm(_ref, ref) {
|
|
|
340
340
|
onChange: function onChange(e) {
|
|
341
341
|
return commonChange(e, item);
|
|
342
342
|
},
|
|
343
|
+
disabled: item === null || item === void 0 ? void 0 : item.disabled,
|
|
343
344
|
children: item.setting.map(function (el, num) {
|
|
344
345
|
return /*#__PURE__*/_jsx(Radio, {
|
|
345
346
|
value: el.value,
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
.xmTtn {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
48
|
+
// .xmTtn {
|
|
49
|
+
// width: 76px;
|
|
50
|
+
// height: 32px;
|
|
51
|
+
// border-radius: 2px;
|
|
52
|
+
// padding: 0 !important;
|
|
53
|
+
// }
|
|
54
54
|
|
|
55
55
|
.xmTtn + .xmTtn {
|
|
56
56
|
margin-left: 16px;
|
|
@@ -5,13 +5,14 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import { message } from 'antd';
|
|
8
|
+
import "./index.less";
|
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
10
|
var defaultTipIconMap = {
|
|
10
11
|
success: 'iconfont-theme-dark-four icon-theme-dark-four-successful',
|
|
11
12
|
error: 'iconfont-theme-dark-four icon-theme-dark-four-error',
|
|
12
13
|
info: 'iconfont-theme-dark-four icon-theme-dark-four-information',
|
|
13
14
|
attention: 'iconfont-theme-dark-four icon-theme-dark-four-warning',
|
|
14
|
-
loading: 'iconfont-theme-dark-four icon-theme-dark-four-loading'
|
|
15
|
+
loading: 'anticon-loading-spin iconfont-theme-dark-four icon-theme-dark-four-loading'
|
|
15
16
|
};
|
|
16
17
|
var messageConfig = function messageConfig(_ref) {
|
|
17
18
|
var key = _ref.key,
|
|
@@ -22,7 +23,7 @@ var messageConfig = function messageConfig(_ref) {
|
|
|
22
23
|
_ref$tipIconMap = _ref.tipIconMap,
|
|
23
24
|
tipIconMap = _ref$tipIconMap === void 0 ? defaultTipIconMap : _ref$tipIconMap;
|
|
24
25
|
var defaultDuration = tipCode === 'loading' ? 0 : 2;
|
|
25
|
-
message.
|
|
26
|
+
message.open({
|
|
26
27
|
key: key,
|
|
27
28
|
icon: /*#__PURE__*/_jsx("span", {
|
|
28
29
|
className: "".concat(tipCode, "Icon"),
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.anticon-loading-spin {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
animation: loong 1s infinite linear;
|
|
4
|
+
|
|
5
|
+
// &:before {
|
|
6
|
+
// display: inline-block;
|
|
7
|
+
// animation: loong 1s infinite linear;
|
|
8
|
+
// -webkit-animation: loong 1s infinite linear
|
|
9
|
+
// }
|
|
10
|
+
}
|
|
11
|
+
@keyframes loong {
|
|
12
|
+
100% {
|
|
13
|
+
transform: rotate(360deg);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -70,7 +70,8 @@ var updateModal = function updateModal(_ref3) {
|
|
|
70
70
|
_ref3$duration = _ref3.duration,
|
|
71
71
|
duration = _ref3$duration === void 0 ? 3000 : _ref3$duration,
|
|
72
72
|
afterClose = _ref3.afterClose;
|
|
73
|
-
console.log('==================', modal);
|
|
73
|
+
// console.log('==================', modal);
|
|
74
|
+
|
|
74
75
|
if (modal) {
|
|
75
76
|
modal.update(_objectSpread(_objectSpread({}, config({
|
|
76
77
|
tipCode: tipCode,
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
.xmTtn {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
42
|
+
// .xmTtn {
|
|
43
|
+
// width: 76px;
|
|
44
|
+
// height: 32px;
|
|
45
|
+
// border-radius: 2px;
|
|
46
|
+
// // margin-bottom: 8px;
|
|
47
|
+
// padding: 0 !important;
|
|
48
|
+
// }
|
|
49
49
|
|
|
50
50
|
// .xmTtnDefault {
|
|
51
51
|
// background: rgba(245, 245, 245, 1);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OnSelectChangeType } from "../type";
|
|
1
|
+
import { DropSide, OnSelectChangeType } from "../type";
|
|
2
2
|
import { Table } from '@tanstack/react-table';
|
|
3
3
|
import { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
4
4
|
import './index.less';
|
|
@@ -51,6 +51,13 @@ type IRowProps = {
|
|
|
51
51
|
color: string;
|
|
52
52
|
};
|
|
53
53
|
tableTooltip: boolean;
|
|
54
|
+
changeHoverRow: (params: {
|
|
55
|
+
target?: any;
|
|
56
|
+
origin?: any;
|
|
57
|
+
}) => void;
|
|
58
|
+
clearHoverRowIndex: () => void;
|
|
59
|
+
hoverRowIndex: number;
|
|
60
|
+
dropSide: DropSide;
|
|
54
61
|
};
|
|
55
|
-
declare const Row: ({ tableBodyRef, table, tableId, row, rowSelectedId, setRowSelectedId, rowHighLightId, setRowHighLightId, selectedRowChange, onSelectChange, canSelection, selectionWithoutChecked, reorderRow, canRowDrag, rowClassName, cellClassName, rowStyle, getCellProps, editting, rowEditing, renderSubComponent, selectedRowDragging, setSelectedRowDragging, onRowMouseEnter, onRowMouseLeave, onRowMouseClick, onRowMouseDoubleClick, rowHeight, disableDragRowIds, selectRowWhenClick, handleEditRowWhenDClick, canEditRowWhenDClick, theme, dragBeforeStart, shadowColumnInfo, onCellContextMenu, getRowHoverTipConfig, tableTooltip, }: IRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
62
|
+
declare const Row: ({ tableBodyRef, table, tableId, row, rowSelectedId, setRowSelectedId, rowHighLightId, setRowHighLightId, selectedRowChange, onSelectChange, canSelection, selectionWithoutChecked, reorderRow, canRowDrag, rowClassName, cellClassName, rowStyle, getCellProps, editting, rowEditing, renderSubComponent, selectedRowDragging, setSelectedRowDragging, onRowMouseEnter, onRowMouseLeave, onRowMouseClick, onRowMouseDoubleClick, rowHeight, disableDragRowIds, selectRowWhenClick, handleEditRowWhenDClick, canEditRowWhenDClick, theme, dragBeforeStart, shadowColumnInfo, onCellContextMenu, getRowHoverTipConfig, tableTooltip, changeHoverRow, clearHoverRowIndex, hoverRowIndex, dropSide, }: IRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
56
63
|
export default Row;
|
|
@@ -10,13 +10,14 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
10
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
11
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import { DropSide } from "../type";
|
|
13
14
|
import { flexRender } from '@tanstack/react-table';
|
|
14
15
|
import { Tooltip } from 'antd';
|
|
15
16
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
16
17
|
import { useDrag, useDrop } from 'react-dnd';
|
|
17
18
|
import { getEmptyImage } from 'react-dnd-html5-backend';
|
|
18
|
-
import { EditableCell } from "../components/ColumnEdit";
|
|
19
19
|
import { getPinningStyle } from "../TableHeader/utils";
|
|
20
|
+
import { EditableCell } from "../components/ColumnEdit";
|
|
20
21
|
import "./index.less";
|
|
21
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
23
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -61,19 +62,37 @@ var Row = function Row(_ref) {
|
|
|
61
62
|
shadowColumnInfo = _ref.shadowColumnInfo,
|
|
62
63
|
onCellContextMenu = _ref.onCellContextMenu,
|
|
63
64
|
getRowHoverTipConfig = _ref.getRowHoverTipConfig,
|
|
64
|
-
tableTooltip = _ref.tableTooltip
|
|
65
|
+
tableTooltip = _ref.tableTooltip,
|
|
66
|
+
changeHoverRow = _ref.changeHoverRow,
|
|
67
|
+
clearHoverRowIndex = _ref.clearHoverRowIndex,
|
|
68
|
+
hoverRowIndex = _ref.hoverRowIndex,
|
|
69
|
+
dropSide = _ref.dropSide;
|
|
70
|
+
var dropPreviewLineClassName = useMemo(function () {
|
|
71
|
+
if (hoverRowIndex === row.index) {
|
|
72
|
+
return dropSide === DropSide.Top ? 'showTopBorder' : 'showBottomBorder';
|
|
73
|
+
} else {
|
|
74
|
+
return '';
|
|
75
|
+
}
|
|
76
|
+
}, [hoverRowIndex, dropSide]);
|
|
65
77
|
var timerRef = useRef();
|
|
66
78
|
var _useDrop = useDrop({
|
|
67
79
|
accept: 'TABLE_ROW',
|
|
68
80
|
drop: function drop(formDatas
|
|
69
81
|
// monitor
|
|
70
82
|
) {
|
|
71
|
-
|
|
83
|
+
clearHoverRowIndex();
|
|
72
84
|
return reorderRow === null || reorderRow === void 0 ? void 0 : reorderRow(formDatas, {
|
|
73
85
|
hoverRow: row,
|
|
74
86
|
targetTableId: tableId
|
|
75
87
|
});
|
|
76
|
-
|
|
88
|
+
},
|
|
89
|
+
hover: function hover(item, monitor) {
|
|
90
|
+
if (monitor.isOver() && monitor.canDrop()) {
|
|
91
|
+
changeHoverRow({
|
|
92
|
+
target: row,
|
|
93
|
+
origin: item
|
|
94
|
+
});
|
|
95
|
+
}
|
|
77
96
|
}
|
|
78
97
|
}),
|
|
79
98
|
_useDrop2 = _slicedToArray(_useDrop, 2),
|
|
@@ -262,6 +281,9 @@ var Row = function Row(_ref) {
|
|
|
262
281
|
canSelection && !selectRowWhenClick && String(row.id) === String(rowHighLightId) // 多选并且点击行时不选中,高亮状态单独管理
|
|
263
282
|
;
|
|
264
283
|
}, [row.id, row.getIsSelected(), rowSelectedId, selectRowWhenClick, rowHighLightId, canSelection]);
|
|
284
|
+
|
|
285
|
+
// console.log('row render', row.id);
|
|
286
|
+
|
|
265
287
|
var rowCom = function rowCom() {
|
|
266
288
|
var _row;
|
|
267
289
|
return /*#__PURE__*/_jsx("tr", {
|
|
@@ -277,7 +299,7 @@ var Row = function Row(_ref) {
|
|
|
277
299
|
onClick: rowClickOrDoubleClick,
|
|
278
300
|
onMouseEnter: rowMouseEnter,
|
|
279
301
|
onMouseLeave: rowMouseLeave,
|
|
280
|
-
className: "tbody-tr ".concat(isHighLight ? 'tbody-tr-selected' : '', " ").concat((rowClassName === null || rowClassName === void 0 ? void 0 : rowClassName(row).map(function (item) {
|
|
302
|
+
className: "tbody-tr ".concat(isHighLight ? 'tbody-tr-selected' : '', " ").concat(dropPreviewLineClassName, " ").concat((rowClassName === null || rowClassName === void 0 ? void 0 : rowClassName(row).map(function (item) {
|
|
281
303
|
return "".concat(item, "-").concat(theme);
|
|
282
304
|
}).join(' ')) || ''),
|
|
283
305
|
children: (_row = row["getVisibleCells"]) === null || _row === void 0 ? void 0 : _row.call(row).map(function (cell) {
|
|
@@ -69,6 +69,7 @@ type TableBodyPropsType = {
|
|
|
69
69
|
color: string;
|
|
70
70
|
};
|
|
71
71
|
tableTooltip: boolean;
|
|
72
|
+
compactMode: boolean;
|
|
72
73
|
};
|
|
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
|
+
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, compactMode, }: TableBodyPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
74
75
|
export default TableBody;
|
|
@@ -16,7 +16,8 @@ import { Spin } from 'antd';
|
|
|
16
16
|
import { useDrop } from 'react-dnd';
|
|
17
17
|
import { CustomDragLayer } from "../components/CustomDragerLayer";
|
|
18
18
|
// import RowContent from "../components/RowContent";
|
|
19
|
-
|
|
19
|
+
import { DropSide } from "../type";
|
|
20
|
+
import { events, useEventBus } from "../../..";
|
|
20
21
|
import { useCallback, useMemo, useState } from 'react';
|
|
21
22
|
import { createPortal } from 'react-dom';
|
|
22
23
|
import { useConfig } from "../../ConfigProvider";
|
|
@@ -69,7 +70,8 @@ var TableBody = function TableBody(_ref) {
|
|
|
69
70
|
getContextMenu = _ref.getContextMenu,
|
|
70
71
|
onClickContextMenu = _ref.onClickContextMenu,
|
|
71
72
|
getRowHoverTipConfig = _ref.getRowHoverTipConfig,
|
|
72
|
-
tableTooltip = _ref.tableTooltip
|
|
73
|
+
tableTooltip = _ref.tableTooltip,
|
|
74
|
+
compactMode = _ref.compactMode;
|
|
73
75
|
var _useConfig = useConfig(),
|
|
74
76
|
root = _useConfig.root;
|
|
75
77
|
var headerGroups = table.getHeaderGroups();
|
|
@@ -85,6 +87,66 @@ var TableBody = function TableBody(_ref) {
|
|
|
85
87
|
_useState2 = _slicedToArray(_useState, 2),
|
|
86
88
|
contextMenuData = _useState2[0],
|
|
87
89
|
setContextMenuData = _useState2[1];
|
|
90
|
+
// 拖动时显示放置的位置
|
|
91
|
+
var _useState3 = useState(undefined),
|
|
92
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
93
|
+
hoverRowIndex = _useState4[0],
|
|
94
|
+
setHoverRowIndex = _useState4[1];
|
|
95
|
+
var _useState5 = useState(undefined),
|
|
96
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
97
|
+
dropSide = _useState6[0],
|
|
98
|
+
setDropSide = _useState6[1]; // 放在目标的上侧或者下侧
|
|
99
|
+
// 清除hover行信息
|
|
100
|
+
var clearHoverRowIndex = useCallback(function () {
|
|
101
|
+
setHoverRowIndex(undefined);
|
|
102
|
+
}, []);
|
|
103
|
+
// 当前table在hover时进行广播
|
|
104
|
+
var publishCurTableHoveringEvent = function publishCurTableHoveringEvent() {
|
|
105
|
+
events.emit('TABLE_HOVERING', tableId);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// 接收广播:其他table在hover时,取消当前table的hover
|
|
109
|
+
var receiveCurTableHoveringEvent = useCallback(function (hoveringTableId) {
|
|
110
|
+
if (hoveringTableId !== tableId) {
|
|
111
|
+
clearHoverRowIndex();
|
|
112
|
+
}
|
|
113
|
+
}, []);
|
|
114
|
+
useEventBus('TABLE_HOVERING', receiveCurTableHoveringEvent);
|
|
115
|
+
|
|
116
|
+
// 拖动时,即时修改hover信息
|
|
117
|
+
var changeHoverRow = useCallback(function (_ref2) {
|
|
118
|
+
var _origin$draggedRow, _origin$draggedRows;
|
|
119
|
+
var target = _ref2.target,
|
|
120
|
+
origin = _ref2.origin;
|
|
121
|
+
publishCurTableHoveringEvent();
|
|
122
|
+
var targetRowIndex = target === null || target === void 0 ? void 0 : target.index;
|
|
123
|
+
var originRowIndex = origin === null || origin === void 0 || (_origin$draggedRow = origin.draggedRow) === null || _origin$draggedRow === void 0 ? void 0 : _origin$draggedRow.index;
|
|
124
|
+
var originRowIndexList = (origin === null || origin === void 0 || (_origin$draggedRows = origin.draggedRows) === null || _origin$draggedRows === void 0 ? void 0 : _origin$draggedRows.map(function (row) {
|
|
125
|
+
return row.index;
|
|
126
|
+
})) || [];
|
|
127
|
+
// console.log('hover :>> ', targetRowIndex, originRowIndex);
|
|
128
|
+
if (tableId === origin.sourceTableId && originRowIndexList.includes(targetRowIndex)) {
|
|
129
|
+
clearHoverRowIndex();
|
|
130
|
+
} else if (targetRowIndex !== hoverRowIndex) {
|
|
131
|
+
setHoverRowIndex(targetRowIndex);
|
|
132
|
+
if (tableId !== origin.sourceTableId) {
|
|
133
|
+
// 表格之间拖动
|
|
134
|
+
setDropSide(DropSide.Top);
|
|
135
|
+
} else {
|
|
136
|
+
// 表格内部拖动
|
|
137
|
+
setDropSide(targetRowIndex > originRowIndex ? DropSide.Bottom : DropSide.Top);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}, [hoverRowIndex]);
|
|
141
|
+
// 拖动到最后一行下面的空白处,在最后一行数据上展示预览位置
|
|
142
|
+
var addToLast = useCallback(function () {
|
|
143
|
+
publishCurTableHoveringEvent();
|
|
144
|
+
var lastIndex = table.getRowModel().rows.length - 1;
|
|
145
|
+
if (lastIndex !== hoverRowIndex) {
|
|
146
|
+
setHoverRowIndex(lastIndex);
|
|
147
|
+
setDropSide(DropSide.Bottom);
|
|
148
|
+
}
|
|
149
|
+
}, [hoverRowIndex]);
|
|
88
150
|
|
|
89
151
|
// cell右键菜单
|
|
90
152
|
var handleCellContextMenu = function handleCellContextMenu(e, cell) {
|
|
@@ -221,10 +283,18 @@ var TableBody = function TableBody(_ref) {
|
|
|
221
283
|
return undefined;
|
|
222
284
|
}
|
|
223
285
|
// console.log('drop-table-empty did');
|
|
286
|
+
clearHoverRowIndex();
|
|
224
287
|
return reorderRow === null || reorderRow === void 0 ? void 0 : reorderRow(formDatas, {
|
|
225
288
|
hoverRow: undefined,
|
|
226
289
|
targetTableId: tableId
|
|
227
290
|
});
|
|
291
|
+
},
|
|
292
|
+
hover: function hover(item, monitor) {
|
|
293
|
+
if (monitor.isOver({
|
|
294
|
+
shallow: true
|
|
295
|
+
}) && monitor.canDrop()) {
|
|
296
|
+
addToLast();
|
|
297
|
+
}
|
|
228
298
|
}
|
|
229
299
|
}),
|
|
230
300
|
_useDrop4 = _slicedToArray(_useDrop3, 2),
|
|
@@ -291,7 +361,11 @@ var TableBody = function TableBody(_ref) {
|
|
|
291
361
|
shadowColumnInfo: shadowColumnInfo,
|
|
292
362
|
onCellContextMenu: handleCellContextMenu,
|
|
293
363
|
getRowHoverTipConfig: getRowHoverTipConfig,
|
|
294
|
-
tableTooltip: tableTooltip
|
|
364
|
+
tableTooltip: tableTooltip,
|
|
365
|
+
changeHoverRow: changeHoverRow,
|
|
366
|
+
clearHoverRowIndex: clearHoverRowIndex,
|
|
367
|
+
hoverRowIndex: hoverRowIndex,
|
|
368
|
+
dropSide: dropSide
|
|
295
369
|
}, row.id);
|
|
296
370
|
});
|
|
297
371
|
};
|
|
@@ -301,6 +375,9 @@ var TableBody = function TableBody(_ref) {
|
|
|
301
375
|
var _table$getRowModel$ro;
|
|
302
376
|
return !loading && datas.length !== 0 && ((_table$getRowModel$ro = table.getRowModel().rows) === null || _table$getRowModel$ro === void 0 ? void 0 : _table$getRowModel$ro.length) !== 0;
|
|
303
377
|
}, [loading, datas.length, (_table$getRowModel$ro2 = table.getRowModel().rows) === null || _table$getRowModel$ro2 === void 0 ? void 0 : _table$getRowModel$ro2.length]);
|
|
378
|
+
|
|
379
|
+
// console.log('body render :>>');
|
|
380
|
+
|
|
304
381
|
return (
|
|
305
382
|
/*#__PURE__*/
|
|
306
383
|
// 修复筛选数据为空时,滚动条丢失
|
|
@@ -313,7 +390,8 @@ var TableBody = function TableBody(_ref) {
|
|
|
313
390
|
theme: theme,
|
|
314
391
|
rowSelectedId: rowSelectedId,
|
|
315
392
|
table: table,
|
|
316
|
-
tableId: tableId
|
|
393
|
+
tableId: tableId,
|
|
394
|
+
compactMode: compactMode
|
|
317
395
|
}),
|
|
318
396
|
// document.body,
|
|
319
397
|
root ? document.querySelector(root) : document.body), showTable ? /*#__PURE__*/_jsx("div", {
|
|
@@ -31,8 +31,8 @@ table {
|
|
|
31
31
|
.tbody-tr-selected > .tbody-tr-td,
|
|
32
32
|
.tbody-tr-selected > .tbody-tr-td-drag {
|
|
33
33
|
background-color: @globalColor0;
|
|
34
|
-
height:
|
|
35
|
-
line-height:
|
|
34
|
+
height: 32px;
|
|
35
|
+
line-height: 32px;
|
|
36
36
|
// overflow: hidden;
|
|
37
37
|
text-overflow: ellipsis;
|
|
38
38
|
white-space: nowrap;
|
|
@@ -53,6 +53,40 @@ table {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
.showTopBorder {
|
|
57
|
+
// border-top: 2px solid @global-primary-color;
|
|
58
|
+
position: relative;
|
|
59
|
+
|
|
60
|
+
&::after {
|
|
61
|
+
content: '';
|
|
62
|
+
display: block;
|
|
63
|
+
position: absolute;
|
|
64
|
+
left: 0;
|
|
65
|
+
top: 0;
|
|
66
|
+
width: 100%;
|
|
67
|
+
height: 0;
|
|
68
|
+
border-top: 2px dashed @global-primary-color;
|
|
69
|
+
z-index: 999;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.showBottomBorder {
|
|
74
|
+
// border-bottom: 2px solid @global-primary-color;
|
|
75
|
+
position: relative;
|
|
76
|
+
|
|
77
|
+
&::after {
|
|
78
|
+
content: '';
|
|
79
|
+
display: block;
|
|
80
|
+
position: absolute;
|
|
81
|
+
left: 0;
|
|
82
|
+
bottom: 0;
|
|
83
|
+
width: 100%;
|
|
84
|
+
height: 0;
|
|
85
|
+
border-bottom: 2px dashed @global-primary-color;
|
|
86
|
+
z-index: 999;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
56
90
|
.tbody-tr-td-drag:hover {
|
|
57
91
|
cursor: move;
|
|
58
92
|
}
|
|
@@ -68,16 +102,6 @@ table {
|
|
|
68
102
|
}
|
|
69
103
|
}
|
|
70
104
|
|
|
71
|
-
// .tbody-tr-subrow-light {
|
|
72
|
-
// border-bottom: 1px solid var(--tableColor2, rgba(94, 97, 117, 0.4));
|
|
73
|
-
// background: #fbfbfb;
|
|
74
|
-
// }
|
|
75
|
-
|
|
76
|
-
// .tbody-tr-subrow-dark {
|
|
77
|
-
// border-bottom: 1px solid #848695;
|
|
78
|
-
// background: rgba(94, 97, 117, 0.4);
|
|
79
|
-
// }
|
|
80
|
-
|
|
81
105
|
.table-loading {
|
|
82
106
|
display: flex;
|
|
83
107
|
flex-direction: column;
|
|
@@ -11,6 +11,7 @@ type ICellType = {
|
|
|
11
11
|
getHeaderCellProps?: (columns: TableMaxColumnType[]) => object;
|
|
12
12
|
columnResizeMode: ColumnResizeMode;
|
|
13
13
|
disableColumnDrag?: boolean;
|
|
14
|
+
headerRowNum: number;
|
|
14
15
|
};
|
|
15
|
-
declare const Cell: ({ tableContentRef, header, table, hasGroup, canSorting, getHeaderCellProps, disableColumnDrag, }: ICellType) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare const Cell: ({ tableContentRef, header, table, hasGroup, canSorting, getHeaderCellProps, disableColumnDrag, headerRowNum, }: ICellType) => import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export default Cell;
|
|
@@ -38,7 +38,8 @@ var Cell = function Cell(_ref) {
|
|
|
38
38
|
hasGroup = _ref.hasGroup,
|
|
39
39
|
canSorting = _ref.canSorting,
|
|
40
40
|
getHeaderCellProps = _ref.getHeaderCellProps,
|
|
41
|
-
disableColumnDrag = _ref.disableColumnDrag
|
|
41
|
+
disableColumnDrag = _ref.disableColumnDrag,
|
|
42
|
+
headerRowNum = _ref.headerRowNum;
|
|
42
43
|
var _useConfig = useConfig(),
|
|
43
44
|
root = _useConfig.root;
|
|
44
45
|
var cannotDragColumn = [ColumnType.Darg, ColumnType.Selection, ColumnType.Expander, ColumnType.PlaceHolder];
|
|
@@ -107,7 +108,7 @@ var Cell = function Cell(_ref) {
|
|
|
107
108
|
style: {
|
|
108
109
|
textAlign: columns ? 'center' : 'left'
|
|
109
110
|
},
|
|
110
|
-
children: [
|
|
111
|
+
children: [!cannotDragColumn.includes(header.column.id) ? /*#__PURE__*/_jsx(Tooltip, {
|
|
111
112
|
placement: "topLeft"
|
|
112
113
|
// @ts-ignore
|
|
113
114
|
,
|
|
@@ -115,6 +116,9 @@ var Cell = function Cell(_ref) {
|
|
|
115
116
|
mouseEnterDelay: 0.5,
|
|
116
117
|
children: /*#__PURE__*/_jsx("div", {
|
|
117
118
|
className: "cell-left-header",
|
|
119
|
+
style: {
|
|
120
|
+
WebkitLineClamp: headerRowNum
|
|
121
|
+
},
|
|
118
122
|
children:
|
|
119
123
|
// @ts-ignore
|
|
120
124
|
flexRender(columnDef.header, header.getContext())
|
|
@@ -17,6 +17,7 @@ type TableHeaderProps = {
|
|
|
17
17
|
rightFirstColumnId: string;
|
|
18
18
|
};
|
|
19
19
|
disableColumnDrag?: boolean;
|
|
20
|
+
headerRowNum: number;
|
|
20
21
|
};
|
|
21
|
-
declare const TableHeader: ({ tableContentRef, table, canFilter, enableFilters, canSorting, hasGroup, getHeaderCellProps, columnResizeMode, shadowColumnInfo, disableColumnDrag, }: TableHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
declare const TableHeader: ({ tableContentRef, table, canFilter, enableFilters, canSorting, hasGroup, getHeaderCellProps, columnResizeMode, shadowColumnInfo, disableColumnDrag, rowHeight, headerRowNum, }: TableHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
export default TableHeader;
|
|
@@ -24,7 +24,9 @@ var TableHeader = function TableHeader(_ref) {
|
|
|
24
24
|
getHeaderCellProps = _ref.getHeaderCellProps,
|
|
25
25
|
columnResizeMode = _ref.columnResizeMode,
|
|
26
26
|
shadowColumnInfo = _ref.shadowColumnInfo,
|
|
27
|
-
disableColumnDrag = _ref.disableColumnDrag
|
|
27
|
+
disableColumnDrag = _ref.disableColumnDrag,
|
|
28
|
+
rowHeight = _ref.rowHeight,
|
|
29
|
+
headerRowNum = _ref.headerRowNum;
|
|
28
30
|
var headerGroups = table.getHeaderGroups();
|
|
29
31
|
var headers = (headerGroups === null || headerGroups === void 0 || (_headerGroups = headerGroups[headerGroups.length - 1]) === null || _headerGroups === void 0 ? void 0 : _headerGroups.headers) || [];
|
|
30
32
|
var leftLastColumnId = shadowColumnInfo.leftLastColumnId,
|
|
@@ -43,7 +45,7 @@ var TableHeader = function TableHeader(_ref) {
|
|
|
43
45
|
return /*#__PURE__*/_jsx("tr", {
|
|
44
46
|
className: "table-thead-tr cus-table-thead-tr",
|
|
45
47
|
style: {
|
|
46
|
-
height: hasGroup && headerGroup.depth === 0 ?
|
|
48
|
+
height: hasGroup && headerGroup.depth === 0 ? "".concat(rowHeight, "px") : 'auto',
|
|
47
49
|
width: '100%'
|
|
48
50
|
},
|
|
49
51
|
children: headerGroup.headers.map(function (header) {
|
|
@@ -59,7 +61,8 @@ var TableHeader = function TableHeader(_ref) {
|
|
|
59
61
|
canSorting: canSorting,
|
|
60
62
|
getHeaderCellProps: getHeaderCellProps,
|
|
61
63
|
columnResizeMode: columnResizeMode,
|
|
62
|
-
disableColumnDrag: disableColumnDrag
|
|
64
|
+
disableColumnDrag: disableColumnDrag,
|
|
65
|
+
headerRowNum: headerRowNum
|
|
63
66
|
}, header.id)
|
|
64
67
|
}, header.id);
|
|
65
68
|
})
|
|
@@ -21,12 +21,13 @@ table {
|
|
|
21
21
|
|
|
22
22
|
.cell-wapper {
|
|
23
23
|
background: @globalColor_14;
|
|
24
|
-
height:
|
|
25
|
-
line-height:
|
|
24
|
+
height: fit-content;
|
|
25
|
+
line-height: 16px;
|
|
26
26
|
display: flex;
|
|
27
27
|
font-weight: 400;
|
|
28
|
-
padding:
|
|
28
|
+
padding: 8px;
|
|
29
29
|
text-align: left;
|
|
30
|
+
font-size: 14px;
|
|
30
31
|
// border-bottom: 1px solid @tableColor2;
|
|
31
32
|
|
|
32
33
|
.cell-left {
|
|
@@ -42,10 +43,15 @@ table {
|
|
|
42
43
|
align-items: center;
|
|
43
44
|
|
|
44
45
|
.cell-left-header {
|
|
45
|
-
display:
|
|
46
|
+
display: box;
|
|
47
|
+
-webkit-box-orient: vertical;
|
|
46
48
|
overflow: hidden;
|
|
47
49
|
text-overflow: ellipsis;
|
|
48
|
-
white-space:
|
|
50
|
+
white-space: normal;
|
|
51
|
+
|
|
52
|
+
.ant-checkbox-wrapper {
|
|
53
|
+
line-height: 16px;
|
|
54
|
+
}
|
|
49
55
|
}
|
|
50
56
|
}
|
|
51
57
|
|
|
@@ -181,13 +187,13 @@ table {
|
|
|
181
187
|
|
|
182
188
|
.custom-light-picker {
|
|
183
189
|
padding: 4px;
|
|
184
|
-
background:
|
|
190
|
+
background: @global-curd-input-background-color;
|
|
185
191
|
}
|
|
186
192
|
|
|
187
193
|
.custom-light-input-affix-wrapper,
|
|
188
194
|
.custom-light-input,
|
|
189
195
|
.custom-light-picker-input .custom-light-picker-clear {
|
|
190
|
-
background:
|
|
196
|
+
background: @global-curd-input-background-color;
|
|
191
197
|
}
|
|
192
198
|
}
|
|
193
199
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RowData } from '@tanstack/react-table';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import './tableMax.less';
|
|
4
|
-
import type
|
|
4
|
+
import { type TableContextType, type TableMaxProps } from './type';
|
|
5
5
|
declare module '@tanstack/react-table' {
|
|
6
6
|
interface TableMeta<TData extends RowData> {
|
|
7
7
|
updateData: (rowIndex: number, columnId: string, value: unknown) => void;
|