@para-ui/core 4.0.32 → 4.0.37
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/Anchor/anchorMenu/index.d.ts +16 -0
- package/Anchor/index.d.ts +4 -0
- package/Anchor/index.js +394 -0
- package/Anchor/lang/en_US.d.ts +4 -0
- package/Anchor/lang/index.d.ts +9 -0
- package/Anchor/lang/zh_CN.d.ts +4 -0
- package/Anchor/type.d.ts +42 -0
- package/Argv/batchEdit/index.d.ts +18 -0
- package/Argv/dataGenerator/config.d.ts +16 -0
- package/Argv/dataGenerator/index.d.ts +24 -0
- package/Argv/index.d.ts +36 -0
- package/Argv/index.js +738 -0
- package/Argv/lang/en_US.d.ts +15 -0
- package/Argv/lang/index.d.ts +31 -0
- package/Argv/lang/zh_CN.d.ts +15 -0
- package/AutoBox/index.js +1 -1
- package/AutoButton/index.js +3 -3
- package/AutoTips/index.js +1 -1
- package/Breadcrumbs/index.js +1 -1
- package/Button/index.d.ts +2 -2
- package/Button/index.js +4 -4
- package/ButtonGroup/index.d.ts +4 -0
- package/ButtonGroup/index.js +53 -37
- package/Card/index.js +1 -1
- package/Carousel/index.js +1 -1
- package/Cascader/index.js +3 -3
- package/Checkbox/index.js +1 -1
- package/CheckboxGroup/index.js +1 -1
- package/CollapseLayout/index.js +1 -1
- package/ComboSelect/index.js +7 -4
- package/CopyText/index.js +1 -1
- package/CycleSelector/index.js +1 -1
- package/DatePicker/index.js +1 -1
- package/Descriptions/index.js +1 -1
- package/Desktop/index.js +1 -1
- package/DragVerify/index.js +1 -1
- package/Drawer/index.js +1 -1
- package/DynamicMultiBox/index.js +5 -5
- package/Form/index.js +7 -4
- package/FormItem/index.js +7 -4
- package/FunctionModal/index.js +3 -3
- package/Help/index.js +1 -1
- package/Image/index.js +1 -1
- package/InputCode/index.js +1 -1
- package/InputLang/index.js +1 -1
- package/InputNumber/index.js +1 -1
- package/Label/index.js +1 -1
- package/Menu/index.js +1 -1
- package/Modal/index.js +1 -1
- package/MultiBox/index.js +1 -1
- package/OperateBtn/index.js +1 -1
- package/PageHeader/index.js +1 -1
- package/Pagination/index.js +1 -1
- package/PopConfirm/index.js +1 -1
- package/PopMenu/index.js +1 -1
- package/Popover/index.js +1 -1
- package/Progress/index.js +1 -1
- package/QuickReply/index.js +1 -1
- package/README.md +29 -0
- package/Radio/index.js +1 -1
- package/RadioGroup/index.js +1 -1
- package/RangeInput/index.js +1 -1
- package/Search/index.js +1 -1
- package/Select/index.js +1 -1
- package/SelectInput/index.js +1 -1
- package/Selector/index.js +53 -41
- package/Selector/interface.d.ts +2 -1
- package/SelectorPicker/index.js +1 -1
- package/SingleBox/index.js +1 -1
- package/Slider/index.js +1 -1
- package/SortBox/index.d.ts +0 -2
- package/SortBox/index.js +9 -9
- package/Stepper/index.js +1 -1
- package/Switch/index.js +1 -1
- package/Table/index.js +555 -499
- package/Table/interface.d.ts +9 -1
- package/Table/lang/en_US.d.ts +1 -0
- package/Table/lang/index.d.ts +2 -0
- package/Table/lang/zh_CN.d.ts +1 -0
- package/Table/tableBodyElement/index.d.ts +5 -0
- package/Table/tableBodyInterface.d.ts +4 -0
- package/Table/tableHeadInterface.d.ts +2 -0
- package/Tabs/index.js +1 -1
- package/Tag/index.js +1 -1
- package/TextEditor/index.js +4 -4
- package/TextField/index.js +1 -1
- package/TimePicker/index.js +1 -1
- package/Timeline/index.js +21 -14
- package/Title/index.js +1 -1
- package/ToggleButton/ToggleButtonGroup.d.ts +4 -2
- package/ToggleButton/index.d.ts +4 -3
- package/ToggleButton/index.js +51 -37
- package/Tooltip/index.js +1 -1
- package/Transfer/index.js +1 -1
- package/Tree/index.js +3 -3
- package/Upload/index.js +79 -23
- package/Upload/interface.d.ts +4 -0
- package/Upload/util.d.ts +32 -0
- package/Utils/index.d.ts +7 -0
- package/Utils/index.js +10 -1
- package/Utils/type.d.ts +1 -0
- package/_verture/{index-519d0a1f.js → index-086e9a6d.js} +1 -1
- package/_verture/{index-44152845.js → index-5f0bfdcf.js} +1 -1
- package/_verture/{modalContext-10f0c5aa.js → modalContext-205db1f4.js} +1 -1
- package/_verture/{tslib.es6-55ed4bd2.js → tslib.es6-f43aa41d.js} +1 -1
- package/index.d.ts +4 -0
- package/index.js +21 -16
- package/locale/en-US.d.ts +18 -0
- package/locale/index.d.ts +36 -0
- package/locale/index.js +38 -2
- package/locale/zh-CN.d.ts +18 -0
- package/package.json +6 -4
- package/umd/Anchor.js +43 -0
- package/umd/Argv.js +43 -0
- package/umd/AutoButton.js +5 -5
- package/umd/Button.js +1 -1
- package/umd/ButtonGroup.js +5 -5
- package/umd/CollapseLayout.js +1 -1
- package/umd/ComboSelect.js +19 -7
- package/umd/CopyText.js +3 -3
- package/umd/CycleSelector.js +3 -3
- package/umd/DatePicker.js +1 -1
- package/umd/Descriptions.js +1 -1
- package/umd/Desktop.js +3 -3
- package/umd/Drawer.js +1 -1
- package/umd/DynamicMultiBox.js +6 -6
- package/umd/Form.js +19 -7
- package/umd/FormItem.js +19 -7
- package/umd/FunctionModal.js +1 -1
- package/umd/InputCode.js +3 -3
- package/umd/InputLang.js +3 -3
- package/umd/Message.js +15 -16
- package/umd/Modal.js +1 -1
- package/umd/MultiBox.js +3 -3
- package/umd/OperateBtn.js +1 -1
- package/umd/PageHeader.js +1 -1
- package/umd/Pagination.js +3 -3
- package/umd/PopConfirm.js +1 -1
- package/umd/QuickReply.js +3 -3
- package/umd/Search.js +3 -3
- package/umd/Selector.js +4 -4
- package/umd/SelectorPicker.js +6 -6
- package/umd/SingleBox.js +3 -3
- package/umd/SortBox.js +1 -1
- package/umd/Table.js +19 -7
- package/umd/Tabs.js +1 -1
- package/umd/TextField.js +2 -2
- package/umd/TimePicker.js +1 -1
- package/umd/ToggleButton.js +6 -6
- package/umd/Transfer.js +2 -2
- package/umd/Upload.js +2 -2
- package/umd/Utils.js +1 -1
- package/umd/locale.js +1 -1
- /package/_verture/{index-b037486c.js → index-4c5d6cd7.js} +0 -0
package/Table/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest, _ as __awaiter } from '../_verture/tslib.es6-f43aa41d.js';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { useRef, useState, useEffect, useMemo, useCallback, Fragment as Fragment$1 } from 'react';
|
|
4
4
|
import { Get, Post, DeepClone, GetBrowserClass, Cancel, ArrayToObject } from '@paraview/lib';
|
|
5
|
-
import { _ as _typeof, a as _defineProperty } from '../_verture/defineProperty-f0e15205.js';
|
|
6
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-75fa4188.js';
|
|
7
5
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
8
6
|
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
9
7
|
import { Popover } from '../Popover/index.js';
|
|
@@ -16,9 +14,11 @@ import SolidArrowDown from '@para-ui/icons/DownTriangleF';
|
|
|
16
14
|
import Panel from '@para-ui/icons/Panel';
|
|
17
15
|
import { u as useFormatMessage } from '../_verture/useFormatMessage-1fc7c957.js';
|
|
18
16
|
import Empty from '../Empty/index.js';
|
|
17
|
+
import { d as dist } from '../_verture/index-0f5ee6f7.js';
|
|
19
18
|
import { Radio } from '../Radio/index.js';
|
|
20
19
|
import OperateBtn from '../OperateBtn/index.js';
|
|
21
20
|
import Down from '@para-ui/icons/Down';
|
|
21
|
+
import Drag from '@para-ui/icons/Drag';
|
|
22
22
|
import Refresh from '@para-ui/icons/Refresh';
|
|
23
23
|
import { Pagination } from '../Pagination/index.js';
|
|
24
24
|
import { Loading } from '../Loading/index.js';
|
|
@@ -37,6 +37,7 @@ import '../_verture/index-bde7aabe.js';
|
|
|
37
37
|
import 'rc-dropdown';
|
|
38
38
|
import 'dayjs';
|
|
39
39
|
import '../_verture/index-ca413216.js';
|
|
40
|
+
import '../_verture/sortable.esm-76fe46a4.js';
|
|
40
41
|
import '@para-ui/icons/More';
|
|
41
42
|
import '../PopConfirm/index.js';
|
|
42
43
|
import '@para-ui/icons/CheckCircleF';
|
|
@@ -61,23 +62,25 @@ import '@para-ui/icons/DoubleRight';
|
|
|
61
62
|
* 发送请求
|
|
62
63
|
* @param obj {ReqProps} 请求信息
|
|
63
64
|
*/
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
const requestFunc = obj => {
|
|
66
|
+
const {
|
|
67
|
+
method,
|
|
68
|
+
url,
|
|
69
|
+
ctx,
|
|
70
|
+
data
|
|
71
|
+
} = obj,
|
|
69
72
|
otherProps = __rest(obj, ["method", "url", "ctx", "data"]);
|
|
70
73
|
if (method === 'Get') {
|
|
71
74
|
return Get(Object.assign({
|
|
72
75
|
url: url,
|
|
73
|
-
ctx
|
|
76
|
+
ctx
|
|
74
77
|
}, otherProps));
|
|
75
78
|
}
|
|
76
79
|
if (method === 'Post') {
|
|
77
80
|
return Post(Object.assign({
|
|
78
81
|
url: url,
|
|
79
|
-
ctx
|
|
80
|
-
data
|
|
82
|
+
ctx,
|
|
83
|
+
data
|
|
81
84
|
}, otherProps));
|
|
82
85
|
}
|
|
83
86
|
};
|
|
@@ -86,23 +89,23 @@ var requestFunc = function requestFunc(obj) {
|
|
|
86
89
|
* @param obj {ReqProps} 请求信息
|
|
87
90
|
* @return string get请求地址参数
|
|
88
91
|
*/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
for (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (
|
|
92
|
+
const handGetReqParams = obj => {
|
|
93
|
+
let str = obj.url;
|
|
94
|
+
const params = obj.data || {};
|
|
95
|
+
const arrKey = Object.keys(params);
|
|
96
|
+
const paramsArr = [];
|
|
97
|
+
for (let i = 0, l = arrKey.length; i < l; i++) {
|
|
98
|
+
const key = arrKey[i];
|
|
99
|
+
let val = params[key];
|
|
100
|
+
if (typeof val === 'object') {
|
|
98
101
|
val = encodeURIComponent(JSON.stringify(val));
|
|
99
102
|
} else {
|
|
100
103
|
val = encodeURIComponent(val);
|
|
101
104
|
}
|
|
102
105
|
paramsArr.push("".concat(key, "=").concat(val));
|
|
103
106
|
}
|
|
104
|
-
|
|
105
|
-
|
|
107
|
+
const paramsStr = paramsArr.join('&');
|
|
108
|
+
const pos = str.indexOf('?');
|
|
106
109
|
if (pos !== -1) {
|
|
107
110
|
str += (pos === str.length - 1 ? '' : '&') + paramsStr;
|
|
108
111
|
} else {
|
|
@@ -113,9 +116,9 @@ var handGetReqParams = function handGetReqParams(obj) {
|
|
|
113
116
|
/**
|
|
114
117
|
* 提取字符串里面的数字
|
|
115
118
|
* */
|
|
116
|
-
|
|
119
|
+
const getStringInNumber = str => {
|
|
117
120
|
if (typeof str === 'number') return str;
|
|
118
|
-
|
|
121
|
+
const strHand = str.replace(/[^0-9$]/gi, '');
|
|
119
122
|
return Number(strHand);
|
|
120
123
|
};
|
|
121
124
|
/**
|
|
@@ -123,23 +126,23 @@ var getStringInNumber = function getStringInNumber(str) {
|
|
|
123
126
|
* @param key {string} 键值
|
|
124
127
|
* @param num {number} 过期天数
|
|
125
128
|
* */
|
|
126
|
-
|
|
129
|
+
const getLocalStorageSelectHead = (key, num) => {
|
|
127
130
|
//debugger
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
for (
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
const headJsonStr = window.localStorage.getItem('_paraui_table_head') || '{}';
|
|
132
|
+
const headJson = JSON.parse(headJsonStr);
|
|
133
|
+
const headJsonArr = Object.keys(headJson);
|
|
134
|
+
for (let i = 0, l = headJsonArr.length; i < l; i++) {
|
|
135
|
+
const keyStr = headJsonArr[i];
|
|
136
|
+
const item = headJson[i];
|
|
134
137
|
if (!item) continue;
|
|
135
|
-
|
|
136
|
-
|
|
138
|
+
const newDate = new Date().getTime(); // 当前时间
|
|
139
|
+
const endTime = item.storageTime + item.validity; // 过期时间
|
|
137
140
|
// 过期时间 小于 当前时间, 说明已经过期了, 删除当前表格列数据
|
|
138
141
|
if (endTime < newDate) {
|
|
139
142
|
delete headJson[keyStr];
|
|
140
143
|
}
|
|
141
144
|
}
|
|
142
|
-
|
|
145
|
+
const headJsonItem = headJson[key];
|
|
143
146
|
// 重置过期时间
|
|
144
147
|
if (headJsonItem) {
|
|
145
148
|
headJsonItem.storageTime = new Date().getTime();
|
|
@@ -152,9 +155,9 @@ var getLocalStorageSelectHead = function getLocalStorageSelectHead(key, num) {
|
|
|
152
155
|
* @param key {string} 键值
|
|
153
156
|
* @param val {HeadLocalStorageItem} 保存值
|
|
154
157
|
* */
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
+
const setLocalStorageSelectHead = (key, val) => {
|
|
159
|
+
const headJsonStr = window.localStorage.getItem('_paraui_table_head') || '{}';
|
|
160
|
+
const headJson = JSON.parse(headJsonStr);
|
|
158
161
|
headJson[key] = val;
|
|
159
162
|
window.localStorage.setItem('_paraui_table_head', JSON.stringify(headJson));
|
|
160
163
|
};
|
|
@@ -163,8 +166,8 @@ var setLocalStorageSelectHead = function setLocalStorageSelectHead(key, val) {
|
|
|
163
166
|
* @param el 当前元素
|
|
164
167
|
* @param selector 查找元素class
|
|
165
168
|
*/
|
|
166
|
-
|
|
167
|
-
|
|
169
|
+
const closest = (el, selector) => {
|
|
170
|
+
const matchesSelector = el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector;
|
|
168
171
|
while (el) {
|
|
169
172
|
if (matchesSelector.call(el, selector)) {
|
|
170
173
|
break;
|
|
@@ -216,7 +219,7 @@ var TrElement = function TrElement(props) {
|
|
|
216
219
|
}));
|
|
217
220
|
};
|
|
218
221
|
|
|
219
|
-
var css_248z$5 = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.th-element {\n letter-spacing: 0.01071em;\n line-height: 1.43;\n padding: 0;\n font-weight: 700;\n font-size: 14px;\n background-color: rgb(247, 248, 250);\n border-bottom: 1px solid rgb(234, 236, 241);\n height: 100%;\n}\n.th-element.th-element-draggable {\n position: relative;\n}\n.th-element:first-child {\n border-top-left-radius: 4px;\n}\n.th-element:last-child {\n border-top-right-radius: 4px;\n}\n.th-element:hover {\n background-color: rgb(240, 245, 255);\n}\n.th-element.table-operate.table-operate-small {\n width: 105px;\n}\n.th-element.table-operate.table-operate-small > .table-header-box {\n width:
|
|
222
|
+
var css_248z$5 = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.th-element {\n letter-spacing: 0.01071em;\n line-height: 1.43;\n padding: 0;\n font-weight: 700;\n font-size: 14px;\n background-color: rgb(247, 248, 250);\n border-bottom: 1px solid rgb(234, 236, 241);\n height: 100%;\n}\n.th-element.th-element-draggable {\n position: relative;\n}\n.th-element:first-child {\n border-top-left-radius: 4px;\n}\n.th-element:last-child {\n border-top-right-radius: 4px;\n}\n.th-element:hover {\n background-color: rgb(240, 245, 255);\n}\n.th-element.table-operate.table-operate-small {\n width: 105px;\n}\n.th-element.table-operate.table-operate-small > .table-header-box {\n width: 100%;\n}\n.th-element.table-operate.table-operate-not-columns.table-operate-small {\n width: 158px;\n}\n.th-element.table-operate.table-operate-drag-row.table-operate-small {\n width: 145px;\n}\n.th-element.table-operate.table-operate-drag-row.table-operate-not-columns.table-operate-small {\n width: 198px;\n}\n.th-element > .th-element-draggable-box {\n width: 4px;\n height: 100%;\n position: absolute;\n right: 0;\n top: 0;\n}\n.th-element:hover > .th-element-draggable-box {\n background-color: rgb(213, 224, 250);\n cursor: ew-resize;\n}";
|
|
220
223
|
styleInject(css_248z$5);
|
|
221
224
|
|
|
222
225
|
var ThElement = function ThElement(props) {
|
|
@@ -339,7 +342,8 @@ var en = {
|
|
|
339
342
|
loadMore: 'Load more',
|
|
340
343
|
refresh: 'Refresh',
|
|
341
344
|
selectNum: 'Selected {num} items',
|
|
342
|
-
selectAll: 'Select All'
|
|
345
|
+
selectAll: 'Select All',
|
|
346
|
+
dragSort: 'Drag Sort'
|
|
343
347
|
};
|
|
344
348
|
|
|
345
349
|
var zh = {
|
|
@@ -350,73 +354,55 @@ var zh = {
|
|
|
350
354
|
loadMore: '加载更多',
|
|
351
355
|
refresh: '刷新',
|
|
352
356
|
selectNum: '已选{num}项',
|
|
353
|
-
selectAll: '全选'
|
|
357
|
+
selectAll: '全选',
|
|
358
|
+
dragSort: '拖动排序'
|
|
354
359
|
};
|
|
355
360
|
|
|
356
361
|
var localeJson = {
|
|
357
|
-
zh
|
|
358
|
-
en
|
|
362
|
+
zh,
|
|
363
|
+
en
|
|
359
364
|
};
|
|
360
365
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
headData =
|
|
364
|
-
sortTable
|
|
365
|
-
filter
|
|
366
|
-
expandable
|
|
367
|
-
check
|
|
368
|
-
radio
|
|
369
|
-
onRequestSort
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
setChecked = _useState4[1]; // 选中
|
|
402
|
-
var _useState5 = useState(null),
|
|
403
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
404
|
-
anchorElColums = _useState6[0],
|
|
405
|
-
setAnchorElColums = _useState6[1]; // 显示列定位元素
|
|
406
|
-
var _useState7 = useState({}),
|
|
407
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
408
|
-
headDataJson = _useState8[0],
|
|
409
|
-
setHeadDataJson = _useState8[1]; // 显示列json
|
|
410
|
-
var _useState9 = useState({}),
|
|
411
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
412
|
-
filterHead = _useState10[0],
|
|
413
|
-
setFilterHead = _useState10[1]; // 过滤项当前表头数据
|
|
414
|
-
var _useState11 = useState({}),
|
|
415
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
416
|
-
selectFilterCom = _useState12[0],
|
|
417
|
-
setSelectFilterCom = _useState12[1]; // 过滤项当前选中值
|
|
418
|
-
var intl = useFormatMessage('Table', localeJson);
|
|
419
|
-
useEffect(function () {
|
|
366
|
+
const TableHead$1 = props => {
|
|
367
|
+
const {
|
|
368
|
+
headData = [],
|
|
369
|
+
sortTable,
|
|
370
|
+
filter,
|
|
371
|
+
expandable,
|
|
372
|
+
check,
|
|
373
|
+
radio,
|
|
374
|
+
onRequestSort,
|
|
375
|
+
orderFieldArr = [],
|
|
376
|
+
orderTypeArr = [],
|
|
377
|
+
selectAll,
|
|
378
|
+
selectStatus,
|
|
379
|
+
align,
|
|
380
|
+
showList = [],
|
|
381
|
+
changeShowList,
|
|
382
|
+
selectFilter,
|
|
383
|
+
changeFilter,
|
|
384
|
+
operate,
|
|
385
|
+
showColumns,
|
|
386
|
+
fixedTable,
|
|
387
|
+
fixedColumn,
|
|
388
|
+
posFixed,
|
|
389
|
+
beyondText,
|
|
390
|
+
lineWidth,
|
|
391
|
+
dragColumn,
|
|
392
|
+
dragRow,
|
|
393
|
+
changeColumnWidth,
|
|
394
|
+
headDataConfig,
|
|
395
|
+
getPopupContainer,
|
|
396
|
+
tipMaxWidth
|
|
397
|
+
} = props;
|
|
398
|
+
const [indeterminate, setIndeterminate] = useState(false); // 半选中
|
|
399
|
+
const [checked, setChecked] = useState(false); // 选中
|
|
400
|
+
const [anchorElColums, setAnchorElColums] = useState(null); // 显示列定位元素
|
|
401
|
+
const [headDataJson, setHeadDataJson] = useState({}); // 显示列json
|
|
402
|
+
const [filterHead, setFilterHead] = useState({}); // 过滤项当前表头数据
|
|
403
|
+
const [selectFilterCom, setSelectFilterCom] = useState({}); // 过滤项当前选中值
|
|
404
|
+
const intl = useFormatMessage('Table', localeJson);
|
|
405
|
+
useEffect(() => {
|
|
420
406
|
// 全选
|
|
421
407
|
if (selectStatus === 'all') {
|
|
422
408
|
setChecked(true);
|
|
@@ -433,17 +419,17 @@ var TableHead$1 = function TableHead(props) {
|
|
|
433
419
|
setIndeterminate(false);
|
|
434
420
|
}
|
|
435
421
|
}, [selectStatus]);
|
|
436
|
-
useEffect(
|
|
422
|
+
useEffect(() => {
|
|
437
423
|
if (headData) {
|
|
438
|
-
|
|
439
|
-
for (
|
|
440
|
-
|
|
424
|
+
const json = [];
|
|
425
|
+
for (let i = 0, l = headData.length; i < l; i++) {
|
|
426
|
+
const item = headData[i];
|
|
441
427
|
json[item.name] = item;
|
|
442
428
|
}
|
|
443
429
|
setHeadDataJson(json);
|
|
444
430
|
}
|
|
445
431
|
}, [headData]);
|
|
446
|
-
useEffect(
|
|
432
|
+
useEffect(() => {
|
|
447
433
|
if (selectFilter) setSelectFilterCom(DeepClone(selectFilter));
|
|
448
434
|
}, [selectFilter]);
|
|
449
435
|
/**
|
|
@@ -451,30 +437,28 @@ var TableHead$1 = function TableHead(props) {
|
|
|
451
437
|
* @param name 排序列
|
|
452
438
|
* @param event 当前排序元素
|
|
453
439
|
*/
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
if (onRequestSort) onRequestSort(event, name);
|
|
459
|
-
};
|
|
440
|
+
const createSortHandler = (name, item) => event => {
|
|
441
|
+
// 不存在排序,不触发事件
|
|
442
|
+
if (!(sortTable && item.name && item.sort !== false)) return;
|
|
443
|
+
if (onRequestSort) onRequestSort(event, name);
|
|
460
444
|
};
|
|
461
445
|
/**
|
|
462
446
|
* 全选 / 全不选
|
|
463
447
|
* @param event 操作元素
|
|
464
448
|
* @param bol 选中 / 不选中
|
|
465
449
|
*/
|
|
466
|
-
|
|
450
|
+
const onSelectAll = (event, bol) => {
|
|
467
451
|
if (selectAll) selectAll(event, bol);
|
|
468
452
|
};
|
|
469
453
|
/**
|
|
470
454
|
* 点击显示选择列
|
|
471
455
|
* @param event 点击元素
|
|
472
456
|
*/
|
|
473
|
-
|
|
457
|
+
const clickShowColums = event => {
|
|
474
458
|
setAnchorElColums(event.currentTarget);
|
|
475
459
|
};
|
|
476
460
|
// 点击隐藏选择列
|
|
477
|
-
|
|
461
|
+
const clickHideColums = bol => {
|
|
478
462
|
if (bol) return;
|
|
479
463
|
setAnchorElColums(null);
|
|
480
464
|
};
|
|
@@ -482,29 +466,27 @@ var TableHead$1 = function TableHead(props) {
|
|
|
482
466
|
* 点击显示列 列表
|
|
483
467
|
* @param item 详细
|
|
484
468
|
*/
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
arr1.push(headDataJson[_name]);
|
|
498
|
-
}
|
|
499
|
-
changeShowList && changeShowList(arr1, false, item);
|
|
500
|
-
} else {
|
|
501
|
-
headData.push(item);
|
|
502
|
-
changeShowList && changeShowList(headData, false, item);
|
|
469
|
+
const clickColumsList = item => () => {
|
|
470
|
+
if (item.disabledSelection) return;
|
|
471
|
+
const name = item.name;
|
|
472
|
+
const itemHead = headDataJson[name];
|
|
473
|
+
if (itemHead) {
|
|
474
|
+
// 取消勾选
|
|
475
|
+
delete headDataJson[name];
|
|
476
|
+
const arr = Object.keys(headDataJson);
|
|
477
|
+
const arr1 = [];
|
|
478
|
+
for (let i = 0, l = arr.length; i < l; i++) {
|
|
479
|
+
const name = arr[i];
|
|
480
|
+
arr1.push(headDataJson[name]);
|
|
503
481
|
}
|
|
504
|
-
|
|
482
|
+
changeShowList && changeShowList(arr1, false, item);
|
|
483
|
+
} else {
|
|
484
|
+
headData.push(item);
|
|
485
|
+
changeShowList && changeShowList(headData, false, item);
|
|
486
|
+
}
|
|
505
487
|
};
|
|
506
488
|
// 重置显示列
|
|
507
|
-
|
|
489
|
+
const resetShowList = () => {
|
|
508
490
|
changeShowList && changeShowList(headData, true);
|
|
509
491
|
};
|
|
510
492
|
/**
|
|
@@ -512,69 +494,63 @@ var TableHead$1 = function TableHead(props) {
|
|
|
512
494
|
* @param headCell 当前列信息
|
|
513
495
|
* @param event 元素
|
|
514
496
|
*/
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
setSelectFilterCom(Object.assign({}, selectFilter));
|
|
519
|
-
};
|
|
497
|
+
const clickShowFilter = headCell => event => {
|
|
498
|
+
setFilterHead(headCell);
|
|
499
|
+
setSelectFilterCom(Object.assign({}, selectFilter));
|
|
520
500
|
};
|
|
521
501
|
// 点击隐藏过滤
|
|
522
|
-
|
|
502
|
+
const clickHideFilter = bol => {
|
|
523
503
|
if (bol) return;
|
|
524
504
|
setFilterHead({});
|
|
525
505
|
setSelectFilterCom(Object.assign({}, selectFilter));
|
|
526
506
|
};
|
|
527
507
|
// 点击过滤
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
filterValue = [filterValue[num]];
|
|
546
|
-
}
|
|
508
|
+
const clickFilter = item => () => {
|
|
509
|
+
const name = filterHead.name;
|
|
510
|
+
let filterValue = DeepClone(selectFilterCom[name] || []);
|
|
511
|
+
const index = filterValue.indexOf(item.value);
|
|
512
|
+
if (index !== -1) {
|
|
513
|
+
// 勾选 -> 不勾选
|
|
514
|
+
filterValue.splice(index, 1);
|
|
515
|
+
} else {
|
|
516
|
+
// 不勾选 -> 勾选
|
|
517
|
+
filterValue.push(item.value);
|
|
518
|
+
}
|
|
519
|
+
const filterRadio = filterHead.filterRadio;
|
|
520
|
+
if (filterRadio) {
|
|
521
|
+
// 过滤单个
|
|
522
|
+
const num = filterValue.indexOf(item.value);
|
|
523
|
+
if (num !== -1) {
|
|
524
|
+
filterValue = [filterValue[num]];
|
|
547
525
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
};
|
|
526
|
+
}
|
|
527
|
+
selectFilterCom[name] = filterValue;
|
|
528
|
+
setSelectFilterCom(Object.assign({}, selectFilterCom));
|
|
551
529
|
};
|
|
552
530
|
/**
|
|
553
531
|
* 重置 / 确定过滤
|
|
554
532
|
* @param type {'reset' | 'confirm'} 重置 / 确定过滤
|
|
555
533
|
*/
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
}
|
|
570
|
-
};
|
|
534
|
+
const filterFunc = type => () => {
|
|
535
|
+
if (type === 'confirm') {
|
|
536
|
+
// 确定
|
|
537
|
+
changeFilter && changeFilter(Object.assign({}, selectFilterCom));
|
|
538
|
+
setFilterHead({});
|
|
539
|
+
} else {
|
|
540
|
+
// 重置
|
|
541
|
+
const json = DeepClone(selectFilterCom);
|
|
542
|
+
delete json[filterHead.name];
|
|
543
|
+
setSelectFilterCom(json);
|
|
544
|
+
changeFilter && changeFilter(Object.assign({}, json));
|
|
545
|
+
setFilterHead({});
|
|
546
|
+
}
|
|
571
547
|
};
|
|
572
548
|
/**
|
|
573
549
|
* 自定义过滤确定
|
|
574
550
|
* @param val {[name: string]: any[]}
|
|
575
551
|
* */
|
|
576
|
-
|
|
577
|
-
|
|
552
|
+
const filterCustomConfirm = function () {
|
|
553
|
+
let val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
578
554
|
changeFilter && changeFilter(Object.assign({}, val));
|
|
579
555
|
setFilterHead({});
|
|
580
556
|
};
|
|
@@ -582,12 +558,12 @@ var TableHead$1 = function TableHead(props) {
|
|
|
582
558
|
* 处理TableCell
|
|
583
559
|
* @param item 当前列信息
|
|
584
560
|
*/
|
|
585
|
-
|
|
586
|
-
|
|
561
|
+
const handCellClass = item => {
|
|
562
|
+
let str = 'table-header-box';
|
|
587
563
|
// 排序
|
|
588
564
|
if (sortTable && item.name && item.sort !== false) {
|
|
589
565
|
str += ' table-header-box-sort';
|
|
590
|
-
|
|
566
|
+
const index = orderFieldArr.indexOf(item.name);
|
|
591
567
|
if (index !== -1) {
|
|
592
568
|
// 升序
|
|
593
569
|
if (orderTypeArr[index] === 'asc') {
|
|
@@ -606,10 +582,10 @@ var TableHead$1 = function TableHead(props) {
|
|
|
606
582
|
return str;
|
|
607
583
|
};
|
|
608
584
|
// 复选框memo
|
|
609
|
-
|
|
585
|
+
const TableCheckMemo = useMemo(() => {
|
|
610
586
|
if (check) {
|
|
611
|
-
|
|
612
|
-
|
|
587
|
+
const handCls = () => {
|
|
588
|
+
let str = 'table-checkbox table-head-btn';
|
|
613
589
|
if (fixedColumn) {
|
|
614
590
|
str += ' table-fixed-dom-left';
|
|
615
591
|
// 左边没有定位,且没有单选,没有嵌套表格
|
|
@@ -637,10 +613,10 @@ var TableHead$1 = function TableHead(props) {
|
|
|
637
613
|
}
|
|
638
614
|
}, [check, indeterminate, checked, selectAll, posFixed, radio, expandable, fixedColumn]);
|
|
639
615
|
// 单选框memo
|
|
640
|
-
|
|
616
|
+
const TableRadioMemo = useMemo(() => {
|
|
641
617
|
if (radio) {
|
|
642
|
-
|
|
643
|
-
|
|
618
|
+
const handCls = () => {
|
|
619
|
+
let str = 'table-radio table-head-btn';
|
|
644
620
|
if (fixedColumn) {
|
|
645
621
|
str += ' table-fixed-dom-left';
|
|
646
622
|
// 左边没有定位,没有嵌套表格
|
|
@@ -662,10 +638,10 @@ var TableHead$1 = function TableHead(props) {
|
|
|
662
638
|
}
|
|
663
639
|
}, [radio, posFixed, expandable, fixedColumn]);
|
|
664
640
|
// 嵌套表格memo
|
|
665
|
-
|
|
641
|
+
const TableExpandableMemo = useMemo(() => {
|
|
666
642
|
if (expandable) {
|
|
667
|
-
|
|
668
|
-
|
|
643
|
+
const handCls = () => {
|
|
644
|
+
let str = 'table-expandable table-head-btn';
|
|
669
645
|
if (fixedColumn) {
|
|
670
646
|
str += ' table-fixed-dom-left';
|
|
671
647
|
// 左边没有定位,没有嵌套表格
|
|
@@ -687,21 +663,21 @@ var TableHead$1 = function TableHead(props) {
|
|
|
687
663
|
}
|
|
688
664
|
}, [expandable, posFixed, fixedColumn]);
|
|
689
665
|
// 过滤弹窗内容
|
|
690
|
-
|
|
691
|
-
|
|
666
|
+
const filterPopoverContent = () => {
|
|
667
|
+
const name = filterHead.name;
|
|
692
668
|
if (!name) return;
|
|
693
|
-
|
|
669
|
+
const filterValue = selectFilterCom[name] || [];
|
|
694
670
|
if (filterHead.filterRender) {
|
|
695
671
|
// 自定义渲染过滤
|
|
696
672
|
return filterHead.filterRender({
|
|
697
|
-
filterValue
|
|
673
|
+
filterValue,
|
|
698
674
|
selectFilter: selectFilterCom,
|
|
699
|
-
filterHead
|
|
675
|
+
filterHead,
|
|
700
676
|
setFilter: filterCustomConfirm
|
|
701
677
|
});
|
|
702
678
|
}
|
|
703
|
-
|
|
704
|
-
|
|
679
|
+
const arr = filterHead.enums || [];
|
|
680
|
+
let str = 'filter-select';
|
|
705
681
|
if (arr.length === 0) str += ' filter-select-none';
|
|
706
682
|
return jsx("div", Object.assign({
|
|
707
683
|
className: str
|
|
@@ -716,8 +692,8 @@ var TableHead$1 = function TableHead(props) {
|
|
|
716
692
|
children: [jsx("div", Object.assign({
|
|
717
693
|
className: "filter-select-box"
|
|
718
694
|
}, {
|
|
719
|
-
children: arr.map(
|
|
720
|
-
|
|
695
|
+
children: arr.map((item, index) => {
|
|
696
|
+
const checked = filterValue.indexOf(item.value) !== -1;
|
|
721
697
|
return jsxs("div", Object.assign({
|
|
722
698
|
onClick: clickFilter(item),
|
|
723
699
|
className: checked ? 'filter-select-item filter-select-item-select' : 'filter-select-item'
|
|
@@ -756,30 +732,28 @@ var TableHead$1 = function TableHead(props) {
|
|
|
756
732
|
}));
|
|
757
733
|
};
|
|
758
734
|
// 表格列拖拽放下
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
changeColumnWidth && changeColumnWidth(headCell, result);
|
|
762
|
-
};
|
|
735
|
+
const onDragDown = headCell => result => {
|
|
736
|
+
changeColumnWidth && changeColumnWidth(headCell, result);
|
|
763
737
|
};
|
|
764
738
|
// 获取宽度
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
739
|
+
const getWidth = item => {
|
|
740
|
+
let w = item.width || '';
|
|
741
|
+
const name = item.name || '';
|
|
742
|
+
const wDrag = headDataConfig[name] && headDataConfig[name].width;
|
|
769
743
|
if (wDrag) w = "".concat(wDrag, "px");
|
|
770
744
|
return w;
|
|
771
745
|
};
|
|
772
746
|
// 内容列memo
|
|
773
|
-
|
|
747
|
+
const TableContentMemo = useMemo(() => {
|
|
774
748
|
// 处理过滤的class
|
|
775
|
-
|
|
776
|
-
|
|
749
|
+
const handFilterClass = item => {
|
|
750
|
+
let str = 'table-header-filter';
|
|
777
751
|
if (filterHead.name === item.name) str += ' table-header-filter-show';
|
|
778
752
|
if (item.name && selectFilterCom[item.name] && selectFilterCom[item.name].length > 0) str += ' table-header-filter-select';
|
|
779
753
|
return str;
|
|
780
754
|
};
|
|
781
|
-
|
|
782
|
-
|
|
755
|
+
const handCls = item => {
|
|
756
|
+
let str = '';
|
|
783
757
|
if (item.className) str += item.className;
|
|
784
758
|
if (fixedColumn && item.fixed) {
|
|
785
759
|
str += " table-fixed-dom-".concat(item.fixed);
|
|
@@ -794,8 +768,8 @@ var TableHead$1 = function TableHead(props) {
|
|
|
794
768
|
}
|
|
795
769
|
return str;
|
|
796
770
|
};
|
|
797
|
-
|
|
798
|
-
|
|
771
|
+
const handStyle = item => {
|
|
772
|
+
const json = {
|
|
799
773
|
width: getWidth(item)
|
|
800
774
|
};
|
|
801
775
|
if (fixedColumn && item.fixed && item.width) {
|
|
@@ -809,13 +783,13 @@ var TableHead$1 = function TableHead(props) {
|
|
|
809
783
|
return Object.assign(Object.assign({}, json), item.style);
|
|
810
784
|
};
|
|
811
785
|
// 处理拖拽
|
|
812
|
-
|
|
786
|
+
const handDrag = item => {
|
|
813
787
|
if (item.name === 'table-serial-number') return false; // 序号不拖拽
|
|
814
788
|
if (dragColumn && item.drag !== false) return true;
|
|
815
789
|
return false;
|
|
816
790
|
};
|
|
817
|
-
return headData.map(
|
|
818
|
-
|
|
791
|
+
return headData.map((headCell, index) => {
|
|
792
|
+
let str = "".concat($prefixCls, "-filter-popover ").concat($prefixCls, "-scrollbar-small");
|
|
819
793
|
if (!headCell.filterRender) str += " ".concat($prefixCls, "-filter-popover-default");
|
|
820
794
|
return jsx(ThElement, Object.assign({
|
|
821
795
|
className: handCls(headCell),
|
|
@@ -832,9 +806,7 @@ var TableHead$1 = function TableHead(props) {
|
|
|
832
806
|
content: filterPopoverContent(),
|
|
833
807
|
onVisibleChange: clickHideFilter,
|
|
834
808
|
overlayClassName: str,
|
|
835
|
-
getPopupContainer: getPopupContainer ? getPopupContainer :
|
|
836
|
-
return document.body;
|
|
837
|
-
},
|
|
809
|
+
getPopupContainer: getPopupContainer ? getPopupContainer : () => document.body,
|
|
838
810
|
maxWidth: headCell.filterMaxWidth
|
|
839
811
|
}, {
|
|
840
812
|
children: jsxs("div", Object.assign({
|
|
@@ -879,11 +851,13 @@ var TableHead$1 = function TableHead(props) {
|
|
|
879
851
|
});
|
|
880
852
|
}, [headData, sortTable, filter, orderFieldArr, orderTypeArr, align, filterHead, selectFilterCom, beyondText, selectFilter, fixedColumn, lineWidth, dragColumn, changeColumnWidth, headDataConfig, getPopupContainer, tipMaxWidth]);
|
|
881
853
|
// 操作栏memo
|
|
882
|
-
|
|
854
|
+
const TableOperateMemo = useMemo(() => {
|
|
883
855
|
if (operate) {
|
|
884
|
-
|
|
885
|
-
|
|
856
|
+
const handCls = () => {
|
|
857
|
+
let str = 'table-operate';
|
|
886
858
|
if (operate.operateBtnRender) str += ' table-operate-small';
|
|
859
|
+
if (showColumns === false) str += ' table-operate-not-columns';
|
|
860
|
+
if (dragRow) str += ' table-operate-drag-row';
|
|
887
861
|
if (fixedColumn) {
|
|
888
862
|
str += ' table-fixed-dom-right';
|
|
889
863
|
// 存在显示列,且没有右侧固定列
|
|
@@ -893,8 +867,8 @@ var TableHead$1 = function TableHead(props) {
|
|
|
893
867
|
}
|
|
894
868
|
return str;
|
|
895
869
|
};
|
|
896
|
-
|
|
897
|
-
|
|
870
|
+
const handStyle = () => {
|
|
871
|
+
const json = {
|
|
898
872
|
width: operate.width
|
|
899
873
|
};
|
|
900
874
|
if (fixedColumn) {
|
|
@@ -928,18 +902,18 @@ var TableHead$1 = function TableHead(props) {
|
|
|
928
902
|
}))
|
|
929
903
|
}));
|
|
930
904
|
}
|
|
931
|
-
}, [operate, align, posFixed, showColumns, posFixed, beyondText, fixedColumn, tipMaxWidth]);
|
|
905
|
+
}, [operate, align, posFixed, showColumns, posFixed, beyondText, fixedColumn, tipMaxWidth, dragRow]);
|
|
932
906
|
// 显示列弹窗内容
|
|
933
|
-
|
|
907
|
+
const showListContent = () => {
|
|
934
908
|
return jsxs("div", Object.assign({
|
|
935
909
|
className: "show-colums-select"
|
|
936
910
|
}, {
|
|
937
911
|
children: [jsx("div", Object.assign({
|
|
938
912
|
className: "show-colums-select-box"
|
|
939
913
|
}, {
|
|
940
|
-
children: showList.map(
|
|
941
|
-
|
|
942
|
-
|
|
914
|
+
children: showList.map((item, index) => {
|
|
915
|
+
const checked = Boolean(headDataJson[item.name]);
|
|
916
|
+
let str = 'show-colums-select-item';
|
|
943
917
|
if (checked) str += ' show-colums-select-item-select';
|
|
944
918
|
if (item.disabledSelection) str += ' show-colums-select-item-disabled';
|
|
945
919
|
return jsxs("div", Object.assign({
|
|
@@ -973,9 +947,9 @@ var TableHead$1 = function TableHead(props) {
|
|
|
973
947
|
}));
|
|
974
948
|
};
|
|
975
949
|
// 显示列memo
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
950
|
+
const TableShowList = useMemo(() => {
|
|
951
|
+
const handCls = () => {
|
|
952
|
+
let str = 'show-colums table-fixed-dom-right';
|
|
979
953
|
// 没有固定列参数 或者 没有操作栏且没有右侧固定列
|
|
980
954
|
if (!fixedColumn || !operate && !(posFixed === null || posFixed === void 0 ? void 0 : posFixed.rightBol)) {
|
|
981
955
|
str += ' table-fixed-dom-right-first';
|
|
@@ -988,9 +962,7 @@ var TableHead$1 = function TableHead(props) {
|
|
|
988
962
|
content: showListContent(),
|
|
989
963
|
onVisibleChange: clickHideColums,
|
|
990
964
|
overlayClassName: "".concat($prefixCls, "-table-show-colums-popover ").concat($prefixCls, "-scrollbar-small"),
|
|
991
|
-
getPopupContainer: getPopupContainer ? getPopupContainer :
|
|
992
|
-
return document.body;
|
|
993
|
-
}
|
|
965
|
+
getPopupContainer: getPopupContainer ? getPopupContainer : () => document.body
|
|
994
966
|
}, {
|
|
995
967
|
children: jsx(ThElement, Object.assign({
|
|
996
968
|
align: "center",
|
|
@@ -1006,9 +978,26 @@ var TableHead$1 = function TableHead(props) {
|
|
|
1006
978
|
}))
|
|
1007
979
|
}));
|
|
1008
980
|
}, [showColumns, posFixed, operate, anchorElColums, showList, headDataJson, getPopupContainer, tipMaxWidth]);
|
|
981
|
+
// 拖动行
|
|
982
|
+
const TbaleDragRow = useMemo(() => {
|
|
983
|
+
if (!dragRow || operate || showColumns === 'inside') return null;
|
|
984
|
+
const handCls = () => {
|
|
985
|
+
let str = 'drag-row table-fixed-dom-right';
|
|
986
|
+
// 没有固定列参数 或者 没有操作栏且没有右侧固定列
|
|
987
|
+
if (!fixedColumn || !operate && !(posFixed === null || posFixed === void 0 ? void 0 : posFixed.rightBol)) {
|
|
988
|
+
str += ' table-fixed-dom-right-first';
|
|
989
|
+
}
|
|
990
|
+
return str;
|
|
991
|
+
};
|
|
992
|
+
return jsx(ThElement, {
|
|
993
|
+
align: "center",
|
|
994
|
+
className: handCls(),
|
|
995
|
+
draggable: false
|
|
996
|
+
});
|
|
997
|
+
}, [operate, showColumns, fixedColumn, posFixed, dragRow]);
|
|
1009
998
|
// 处理class
|
|
1010
|
-
|
|
1011
|
-
|
|
999
|
+
const handClass = () => {
|
|
1000
|
+
let str = 'table-head';
|
|
1012
1001
|
if (showColumns === 'inside') str += ' table-head-inside';
|
|
1013
1002
|
if (!fixedTable) str += ' table-head-scroll'; // 防止长度过长
|
|
1014
1003
|
// 没有 复选框,单选框,展开 按钮
|
|
@@ -1019,7 +1008,7 @@ var TableHead$1 = function TableHead(props) {
|
|
|
1019
1008
|
className: handClass()
|
|
1020
1009
|
}, {
|
|
1021
1010
|
children: jsxs(TrElement, {
|
|
1022
|
-
children: [TableCheckMemo, TableRadioMemo, TableExpandableMemo, TableContentMemo, TableOperateMemo, TableShowList]
|
|
1011
|
+
children: [TableCheckMemo, TableRadioMemo, TableExpandableMemo, TableContentMemo, TableOperateMemo, TableShowList, TbaleDragRow]
|
|
1023
1012
|
})
|
|
1024
1013
|
}));
|
|
1025
1014
|
};
|
|
@@ -1031,12 +1020,32 @@ var TableBodyElement = function TableBodyElement(props) {
|
|
|
1031
1020
|
var className = props.className,
|
|
1032
1021
|
style = props.style,
|
|
1033
1022
|
children = props.children,
|
|
1034
|
-
|
|
1023
|
+
drag = props.drag,
|
|
1024
|
+
handle = props.handle,
|
|
1025
|
+
onDrag = props.onDrag,
|
|
1026
|
+
onChoose = props.onChoose,
|
|
1027
|
+
list = props.list,
|
|
1028
|
+
otherProps = __rest(props, ["className", "style", "children", "drag", "handle", "onDrag", "onChoose", "list"]);
|
|
1035
1029
|
var handClass = function handClass() {
|
|
1036
1030
|
var str = 'table-body-element';
|
|
1037
1031
|
if (className) str += " ".concat(className);
|
|
1038
1032
|
return str;
|
|
1039
1033
|
};
|
|
1034
|
+
if (drag) {
|
|
1035
|
+
return jsx(dist.exports.ReactSortable, Object.assign({}, otherProps, {
|
|
1036
|
+
className: handClass(),
|
|
1037
|
+
style: style,
|
|
1038
|
+
list: list || [],
|
|
1039
|
+
handle: handle,
|
|
1040
|
+
animation: 300,
|
|
1041
|
+
setList: function setList() {},
|
|
1042
|
+
onEnd: onDrag,
|
|
1043
|
+
onChoose: onChoose,
|
|
1044
|
+
tag: 'tbody'
|
|
1045
|
+
}, {
|
|
1046
|
+
children: children
|
|
1047
|
+
}));
|
|
1048
|
+
}
|
|
1040
1049
|
return jsx("tbody", Object.assign({
|
|
1041
1050
|
className: handClass(),
|
|
1042
1051
|
style: style
|
|
@@ -1066,92 +1075,74 @@ var TdElement = function TdElement(props) {
|
|
|
1066
1075
|
}));
|
|
1067
1076
|
};
|
|
1068
1077
|
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
rowData =
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
lineHeight = props.lineHeight;
|
|
1126
|
-
var _useState = useState(0),
|
|
1127
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1128
|
-
expandableColSpan = _useState2[0],
|
|
1129
|
-
setExpandableColSpan = _useState2[1]; // 嵌套表格合并列数
|
|
1130
|
-
var _useState3 = useState({}),
|
|
1131
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
1132
|
-
expandableRow = _useState4[0],
|
|
1133
|
-
setExpandableRow = _useState4[1]; // 当前哪行展开表格嵌套
|
|
1134
|
-
var _useState5 = useState(true),
|
|
1135
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
1136
|
-
showMoreBtn = _useState6[0],
|
|
1137
|
-
setShowMoreBtn = _useState6[1]; // 加载更多
|
|
1138
|
-
var _useState7 = useState({}),
|
|
1139
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
1140
|
-
disabledExpandJson = _useState8[0],
|
|
1141
|
-
setDisabledExpand = _useState8[1]; // 禁用加减部分嵌套
|
|
1142
|
-
var intl = useFormatMessage('Table', localeJson);
|
|
1078
|
+
const TableBody = props => {
|
|
1079
|
+
const {
|
|
1080
|
+
url,
|
|
1081
|
+
emptyProps,
|
|
1082
|
+
rowData = [],
|
|
1083
|
+
rowKey = 'key',
|
|
1084
|
+
check,
|
|
1085
|
+
radio,
|
|
1086
|
+
tableCell,
|
|
1087
|
+
expandable,
|
|
1088
|
+
headData = [],
|
|
1089
|
+
disabledJson = {},
|
|
1090
|
+
disabledArrStatus,
|
|
1091
|
+
checkJson = {},
|
|
1092
|
+
radioValue,
|
|
1093
|
+
selectCheck,
|
|
1094
|
+
selectRadio,
|
|
1095
|
+
align,
|
|
1096
|
+
operate,
|
|
1097
|
+
showColumns,
|
|
1098
|
+
fixedTable,
|
|
1099
|
+
fixedColumn,
|
|
1100
|
+
formatter,
|
|
1101
|
+
orderFieldArr = [],
|
|
1102
|
+
orderTypeArr = [],
|
|
1103
|
+
sortTable,
|
|
1104
|
+
loadState,
|
|
1105
|
+
loadMore,
|
|
1106
|
+
loadMoreRender,
|
|
1107
|
+
onClickMore,
|
|
1108
|
+
total,
|
|
1109
|
+
page,
|
|
1110
|
+
currentRowsPerPage,
|
|
1111
|
+
changePage,
|
|
1112
|
+
loadMoreUrl,
|
|
1113
|
+
expandMultiple = false,
|
|
1114
|
+
expandValue = [],
|
|
1115
|
+
disabledExpand = [],
|
|
1116
|
+
defaultExpandAllRows = false,
|
|
1117
|
+
onExpand,
|
|
1118
|
+
onRefresh,
|
|
1119
|
+
posFixed,
|
|
1120
|
+
beyondText,
|
|
1121
|
+
onClickRow,
|
|
1122
|
+
rowClassMapping,
|
|
1123
|
+
tipMaxWidth,
|
|
1124
|
+
lineHeight,
|
|
1125
|
+
dragRow,
|
|
1126
|
+
onDragRow
|
|
1127
|
+
} = props;
|
|
1128
|
+
const [expandableColSpan, setExpandableColSpan] = useState(0); // 嵌套表格合并列数
|
|
1129
|
+
const [expandableRow, setExpandableRow] = useState({}); // 当前哪行展开表格嵌套
|
|
1130
|
+
const [showMoreBtn, setShowMoreBtn] = useState(true); // 加载更多
|
|
1131
|
+
const [disabledExpandJson, setDisabledExpand] = useState({}); // 禁用加减部分嵌套
|
|
1132
|
+
const [dragBol, setDragBol] = useState(false);
|
|
1133
|
+
const intl = useFormatMessage('Table', localeJson);
|
|
1143
1134
|
// 默认是否展开所有
|
|
1144
|
-
useEffect(
|
|
1135
|
+
useEffect(() => {
|
|
1145
1136
|
if (!defaultExpandAllRows) {
|
|
1146
1137
|
setExpandableRow({});
|
|
1147
1138
|
return;
|
|
1148
1139
|
}
|
|
1149
|
-
|
|
1150
|
-
for (
|
|
1151
|
-
|
|
1152
|
-
|
|
1140
|
+
const json = {};
|
|
1141
|
+
for (let i = 0, l = rowData.length; i < l; i++) {
|
|
1142
|
+
const item = rowData[i] || {};
|
|
1143
|
+
const id = item[rowKey];
|
|
1153
1144
|
json[id] = {
|
|
1154
|
-
id
|
|
1145
|
+
id,
|
|
1155
1146
|
status: 'develop'
|
|
1156
1147
|
};
|
|
1157
1148
|
}
|
|
@@ -1159,41 +1150,41 @@ var TableBody = function TableBody(props) {
|
|
|
1159
1150
|
}, [defaultExpandAllRows, rowData, rowKey]);
|
|
1160
1151
|
// 监听展开表格
|
|
1161
1152
|
// 如果直接写expandMultiple, expandValue会死循环
|
|
1162
|
-
useEffect(
|
|
1153
|
+
useEffect(() => {
|
|
1163
1154
|
if (props.expandValue === undefined) return;
|
|
1164
|
-
|
|
1165
|
-
|
|
1155
|
+
const json = {};
|
|
1156
|
+
let expandValueHand = expandValue;
|
|
1166
1157
|
// 只展开一个,去第一个值
|
|
1167
1158
|
if (!expandMultiple && expandValue.length > 0) {
|
|
1168
1159
|
expandValueHand = [expandValue[0]];
|
|
1169
1160
|
}
|
|
1170
|
-
for (
|
|
1171
|
-
|
|
1161
|
+
for (let i = 0, l = expandValueHand.length; i < l; i++) {
|
|
1162
|
+
const id = expandValueHand[i];
|
|
1172
1163
|
json[id] = {
|
|
1173
|
-
id
|
|
1164
|
+
id,
|
|
1174
1165
|
status: 'develop'
|
|
1175
1166
|
};
|
|
1176
1167
|
}
|
|
1177
1168
|
setExpandableRow(json);
|
|
1178
1169
|
}, [props.expandMultiple, props.expandValue, rowData]);
|
|
1179
1170
|
// 监听禁用嵌套 props.disabledExpand 防止死循环
|
|
1180
|
-
useEffect(
|
|
1181
|
-
|
|
1182
|
-
for (
|
|
1183
|
-
|
|
1171
|
+
useEffect(() => {
|
|
1172
|
+
const json = {};
|
|
1173
|
+
for (let i = 0, l = disabledExpand.length; i < l; i++) {
|
|
1174
|
+
const id = disabledExpand[i];
|
|
1184
1175
|
json[id] = true;
|
|
1185
1176
|
}
|
|
1186
1177
|
setDisabledExpand(json);
|
|
1187
1178
|
}, [props.disabledExpand]);
|
|
1188
|
-
useEffect(
|
|
1179
|
+
useEffect(() => {
|
|
1189
1180
|
if (loadMoreUrl) {
|
|
1190
|
-
|
|
1181
|
+
const bol = Number(total) > Number(page) * Number(currentRowsPerPage);
|
|
1191
1182
|
setShowMoreBtn(bol);
|
|
1192
1183
|
}
|
|
1193
1184
|
}, [loadMoreUrl, total, page, currentRowsPerPage]);
|
|
1194
1185
|
// 处理嵌套表格合并列数
|
|
1195
|
-
useEffect(
|
|
1196
|
-
|
|
1186
|
+
useEffect(() => {
|
|
1187
|
+
let num = headData.length;
|
|
1197
1188
|
if (expandable) num += 1;
|
|
1198
1189
|
if (check) num += 1;
|
|
1199
1190
|
if (radio) num += 1;
|
|
@@ -1202,55 +1193,55 @@ var TableBody = function TableBody(props) {
|
|
|
1202
1193
|
setExpandableColSpan(num);
|
|
1203
1194
|
}, [headData, expandable, check, radio]);
|
|
1204
1195
|
// 展开/收起嵌套表格
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
status: status
|
|
1214
|
-
};
|
|
1215
|
-
if (expandMultiple) {
|
|
1216
|
-
// 展开多个
|
|
1217
|
-
expandableRow[id] = expandItem;
|
|
1218
|
-
setExpandableRow(Object.assign({}, expandableRow));
|
|
1219
|
-
} else {
|
|
1220
|
-
// 展开一个
|
|
1221
|
-
setExpandableRow(_defineProperty({}, id, expandItem));
|
|
1222
|
-
}
|
|
1223
|
-
onExpand && onExpand(row, status);
|
|
1224
|
-
event.stopPropagation();
|
|
1196
|
+
const handClickNestTable = row => event => {
|
|
1197
|
+
const id = row[rowKey];
|
|
1198
|
+
let expandItem = expandableRow[id] || {};
|
|
1199
|
+
let status = 'develop';
|
|
1200
|
+
if (expandItem.status === 'develop') status = 'retract';
|
|
1201
|
+
expandItem = {
|
|
1202
|
+
id,
|
|
1203
|
+
status
|
|
1225
1204
|
};
|
|
1205
|
+
if (expandMultiple) {
|
|
1206
|
+
// 展开多个
|
|
1207
|
+
expandableRow[id] = expandItem;
|
|
1208
|
+
setExpandableRow(Object.assign({}, expandableRow));
|
|
1209
|
+
} else {
|
|
1210
|
+
// 展开一个
|
|
1211
|
+
setExpandableRow({
|
|
1212
|
+
[id]: expandItem
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
onExpand && onExpand(row, status);
|
|
1216
|
+
event.stopPropagation();
|
|
1226
1217
|
};
|
|
1227
1218
|
// 处理class
|
|
1228
|
-
|
|
1229
|
-
|
|
1219
|
+
const handClass = () => {
|
|
1220
|
+
let str = 'table-body';
|
|
1230
1221
|
if (!fixedTable) str += ' table-body-scroll';
|
|
1231
1222
|
// 没有 复选框,单选框,展开 按钮
|
|
1232
1223
|
if (!check && !radio && !expandable) str += ' table-body-no-btn';
|
|
1233
1224
|
return str;
|
|
1234
1225
|
};
|
|
1235
1226
|
// 处理嵌套表格class
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1227
|
+
const handExpandClass = row => {
|
|
1228
|
+
const id = row[rowKey];
|
|
1229
|
+
const expandItem = expandableRow[id] || {};
|
|
1230
|
+
let str = 'retract';
|
|
1240
1231
|
if (expandItem.status === 'develop') {
|
|
1241
1232
|
str = 'expand';
|
|
1242
1233
|
}
|
|
1243
1234
|
return str;
|
|
1244
1235
|
};
|
|
1245
1236
|
// 点击加载更多
|
|
1246
|
-
|
|
1237
|
+
const clickMore = () => {
|
|
1247
1238
|
if (loadMoreUrl) changePage && changePage();
|
|
1248
1239
|
onClickMore && onClickMore();
|
|
1249
1240
|
};
|
|
1250
1241
|
// 暂无数据memo
|
|
1251
|
-
|
|
1242
|
+
const NodataMemo = useMemo(() => {
|
|
1252
1243
|
// 处理刷新按钮
|
|
1253
|
-
|
|
1244
|
+
const handRefreshBtn = () => {
|
|
1254
1245
|
if ((emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.showRefresh) !== undefined) {
|
|
1255
1246
|
return emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.showRefresh;
|
|
1256
1247
|
}
|
|
@@ -1260,8 +1251,8 @@ var TableBody = function TableBody(props) {
|
|
|
1260
1251
|
return false;
|
|
1261
1252
|
};
|
|
1262
1253
|
// 处理className
|
|
1263
|
-
|
|
1264
|
-
|
|
1254
|
+
const handClassNoData = () => {
|
|
1255
|
+
let str = 'table-no-data';
|
|
1265
1256
|
if (emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.size) str += " table-no-data-".concat(emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.size);
|
|
1266
1257
|
return str;
|
|
1267
1258
|
};
|
|
@@ -1274,24 +1265,24 @@ var TableBody = function TableBody(props) {
|
|
|
1274
1265
|
}, {
|
|
1275
1266
|
children: jsx(Empty, Object.assign({}, emptyProps, {
|
|
1276
1267
|
showRefresh: handRefreshBtn(),
|
|
1277
|
-
onRefresh:
|
|
1268
|
+
onRefresh: event => {
|
|
1278
1269
|
if (emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.onRefresh) {
|
|
1279
1270
|
emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.onRefresh(event);
|
|
1280
1271
|
return;
|
|
1281
1272
|
}
|
|
1282
|
-
|
|
1273
|
+
onRefresh && onRefresh();
|
|
1283
1274
|
}
|
|
1284
1275
|
}))
|
|
1285
1276
|
}))
|
|
1286
1277
|
}));
|
|
1287
|
-
}, [expandableColSpan, emptyProps, url,
|
|
1278
|
+
}, [expandableColSpan, emptyProps, url, onRefresh]);
|
|
1288
1279
|
// 复选框useCallback
|
|
1289
|
-
|
|
1280
|
+
const TableCheckCallback = useCallback(row => {
|
|
1290
1281
|
if (check) {
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1282
|
+
const handId = row[rowKey];
|
|
1283
|
+
const disabledHand = Boolean(disabledJson[handId]);
|
|
1284
|
+
let checkHand = checkJson[handId] || false;
|
|
1285
|
+
let showCheck = true;
|
|
1295
1286
|
if (disabledHand && disabledArrStatus) {
|
|
1296
1287
|
// 选中
|
|
1297
1288
|
if (disabledArrStatus[handId] === true) {
|
|
@@ -1306,8 +1297,8 @@ var TableBody = function TableBody(props) {
|
|
|
1306
1297
|
showCheck = false;
|
|
1307
1298
|
}
|
|
1308
1299
|
}
|
|
1309
|
-
|
|
1310
|
-
|
|
1300
|
+
const handCls = () => {
|
|
1301
|
+
let str = 'table-checkbox table-body-btn';
|
|
1311
1302
|
if (fixedColumn) {
|
|
1312
1303
|
str += ' table-fixed-dom-left';
|
|
1313
1304
|
// 左边没有定位,且没有单选,没有嵌套表格
|
|
@@ -1324,7 +1315,7 @@ var TableBody = function TableBody(props) {
|
|
|
1324
1315
|
children: showCheck && jsx(Checkbox, {
|
|
1325
1316
|
disabled: disabledHand,
|
|
1326
1317
|
checked: checkHand,
|
|
1327
|
-
onChange:
|
|
1318
|
+
onChange: (event, bol) => {
|
|
1328
1319
|
event.stopPropagation();
|
|
1329
1320
|
selectCheck && selectCheck(event, bol, row[rowKey]);
|
|
1330
1321
|
}
|
|
@@ -1333,12 +1324,12 @@ var TableBody = function TableBody(props) {
|
|
|
1333
1324
|
}
|
|
1334
1325
|
}, [check, disabledJson, rowKey, checkJson, selectCheck, disabledArrStatus, posFixed, expandable, radio, fixedColumn]);
|
|
1335
1326
|
// 单选框useCallback
|
|
1336
|
-
|
|
1327
|
+
const TableRadioCallback = useCallback(row => {
|
|
1337
1328
|
if (radio) {
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1329
|
+
const handId = row[rowKey];
|
|
1330
|
+
const disabledHand = Boolean(disabledJson[handId]);
|
|
1331
|
+
let checkHand = radioValue === row[rowKey];
|
|
1332
|
+
let showRadio = true;
|
|
1342
1333
|
if (disabledHand && disabledArrStatus) {
|
|
1343
1334
|
// 选中
|
|
1344
1335
|
if (disabledArrStatus[handId] === true) {
|
|
@@ -1353,8 +1344,8 @@ var TableBody = function TableBody(props) {
|
|
|
1353
1344
|
showRadio = false;
|
|
1354
1345
|
}
|
|
1355
1346
|
}
|
|
1356
|
-
|
|
1357
|
-
|
|
1347
|
+
const handCls = () => {
|
|
1348
|
+
let str = 'table-radio table-body-btn';
|
|
1358
1349
|
if (fixedColumn) {
|
|
1359
1350
|
str += ' table-fixed-dom-left';
|
|
1360
1351
|
// 左边没有定位,没有嵌套表格
|
|
@@ -1371,7 +1362,7 @@ var TableBody = function TableBody(props) {
|
|
|
1371
1362
|
children: showRadio && jsx(Radio, {
|
|
1372
1363
|
disabled: disabledHand,
|
|
1373
1364
|
checked: checkHand,
|
|
1374
|
-
onChange:
|
|
1365
|
+
onChange: event => {
|
|
1375
1366
|
event.stopPropagation();
|
|
1376
1367
|
selectRadio && selectRadio(event, row[rowKey]);
|
|
1377
1368
|
}
|
|
@@ -1380,13 +1371,13 @@ var TableBody = function TableBody(props) {
|
|
|
1380
1371
|
}
|
|
1381
1372
|
}, [radio, disabledJson, radioValue, rowKey, selectRadio, disabledArrStatus, expandable, posFixed, fixedColumn]);
|
|
1382
1373
|
// 嵌套加减useCallback
|
|
1383
|
-
|
|
1374
|
+
const TableExpandableMemo = useCallback(row => {
|
|
1384
1375
|
if (!expandable) return null;
|
|
1385
|
-
|
|
1376
|
+
const expandableDemo = expandable(row);
|
|
1386
1377
|
// 禁用一行表格展开 或者 展开表格返回值为false,返回空列
|
|
1387
1378
|
if (disabledExpandJson[row[rowKey]] || expandableDemo === false) return jsx(TdElement, {});
|
|
1388
|
-
|
|
1389
|
-
|
|
1379
|
+
const handCls = () => {
|
|
1380
|
+
let str = 'table-expandable table-body-btn';
|
|
1390
1381
|
if (fixedColumn) {
|
|
1391
1382
|
str += ' table-fixed-dom-left';
|
|
1392
1383
|
// 左边没有定位,没有嵌套表格
|
|
@@ -1407,17 +1398,17 @@ var TableBody = function TableBody(props) {
|
|
|
1407
1398
|
}));
|
|
1408
1399
|
}, [expandable, expandableRow, rowKey, disabledExpandJson, onExpand, fixedColumn]);
|
|
1409
1400
|
// 表格一行内容useCallback
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
orderFieldArr
|
|
1413
|
-
orderTypeArr
|
|
1401
|
+
const TableContentUseCallback = useCallback((row, rowIndex) => {
|
|
1402
|
+
const params = {
|
|
1403
|
+
orderFieldArr,
|
|
1404
|
+
orderTypeArr
|
|
1414
1405
|
};
|
|
1415
|
-
|
|
1416
|
-
|
|
1406
|
+
const handContentClass = item => {
|
|
1407
|
+
let str = 'table-content-columms';
|
|
1417
1408
|
if (item.className) str += " ".concat(item.className);
|
|
1418
1409
|
// 排序
|
|
1419
1410
|
if (sortTable && item.name && item.sort !== false) {
|
|
1420
|
-
|
|
1411
|
+
const index = orderFieldArr.indexOf(item.name);
|
|
1421
1412
|
if (index !== -1) {
|
|
1422
1413
|
// 升序
|
|
1423
1414
|
if (orderTypeArr[index] === 'asc') {
|
|
@@ -1442,8 +1433,8 @@ var TableBody = function TableBody(props) {
|
|
|
1442
1433
|
}
|
|
1443
1434
|
return str;
|
|
1444
1435
|
};
|
|
1445
|
-
|
|
1446
|
-
|
|
1436
|
+
const handStyle = item => {
|
|
1437
|
+
const json = {};
|
|
1447
1438
|
if (fixedColumn && item.fixed && item.width) {
|
|
1448
1439
|
if (item.fixed === 'left') {
|
|
1449
1440
|
json.left = "".concat(item.paraui_left_width, "px");
|
|
@@ -1454,14 +1445,14 @@ var TableBody = function TableBody(props) {
|
|
|
1454
1445
|
}
|
|
1455
1446
|
return json;
|
|
1456
1447
|
};
|
|
1457
|
-
return tableCell ? tableCell(row, params) : headData.map(
|
|
1458
|
-
|
|
1459
|
-
|
|
1448
|
+
return tableCell ? tableCell(row, params) : headData.map((item, index) => {
|
|
1449
|
+
let text = row[item.name];
|
|
1450
|
+
let colSpan = 1;
|
|
1460
1451
|
if (item.render) text = item.render(row, item, row[item.name], index, rowIndex);
|
|
1461
1452
|
if (formatter) text = formatter(row, item, row[item.name], index, rowIndex);
|
|
1462
|
-
|
|
1453
|
+
const itemStyle = handStyle(item);
|
|
1463
1454
|
// 存在显示列,最后一列占两格
|
|
1464
|
-
if (showColumns === 'inside' && !operate && index === headData.length - 1) {
|
|
1455
|
+
if (showColumns === 'inside' && !operate && index === headData.length - 1 && !dragRow) {
|
|
1465
1456
|
colSpan = 2;
|
|
1466
1457
|
if (itemStyle.right) {
|
|
1467
1458
|
itemStyle.right = '0px';
|
|
@@ -1481,27 +1472,28 @@ var TableBody = function TableBody(props) {
|
|
|
1481
1472
|
})) : text
|
|
1482
1473
|
}), item.name || index);
|
|
1483
1474
|
});
|
|
1484
|
-
}, [tableCell, headData, align, formatter, orderFieldArr, orderTypeArr, sortTable, showColumns, operate, beyondText, fixedColumn, tipMaxWidth]);
|
|
1475
|
+
}, [tableCell, headData, align, formatter, orderFieldArr, orderTypeArr, sortTable, showColumns, operate, beyondText, fixedColumn, tipMaxWidth, dragRow]);
|
|
1485
1476
|
// 操作栏useCallback
|
|
1486
|
-
|
|
1487
|
-
if (operate) {
|
|
1488
|
-
|
|
1489
|
-
if (showColumns === 'inside') colSpan = 2;
|
|
1490
|
-
|
|
1491
|
-
if (operate.render) return operate.render(row);
|
|
1492
|
-
if (operate.operateBtnRender) {
|
|
1493
|
-
|
|
1477
|
+
const TableOperateUseCallback = useCallback((row, rowIndex) => {
|
|
1478
|
+
if (operate || dragRow) {
|
|
1479
|
+
let colSpan = 1;
|
|
1480
|
+
if (showColumns === 'inside' && operate) colSpan = 2;
|
|
1481
|
+
const handOperate = () => {
|
|
1482
|
+
if (operate === null || operate === void 0 ? void 0 : operate.render) return operate.render(row);
|
|
1483
|
+
if (operate === null || operate === void 0 ? void 0 : operate.operateBtnRender) {
|
|
1484
|
+
const operateConfig = operate.operateBtnRender(row, rowIndex);
|
|
1494
1485
|
return jsx(OperateBtn, Object.assign({}, operateConfig));
|
|
1495
1486
|
}
|
|
1496
1487
|
};
|
|
1497
|
-
|
|
1498
|
-
|
|
1488
|
+
const handStyle = () => {
|
|
1489
|
+
const json = {
|
|
1499
1490
|
right: '0'
|
|
1500
1491
|
};
|
|
1501
1492
|
return json;
|
|
1502
1493
|
};
|
|
1503
|
-
|
|
1504
|
-
|
|
1494
|
+
const handCls = () => {
|
|
1495
|
+
let str = 'table-operate';
|
|
1496
|
+
if (!operate) str += ' table-operate-center';
|
|
1505
1497
|
if (fixedColumn) {
|
|
1506
1498
|
str += ' table-fixed-dom-right';
|
|
1507
1499
|
if (!(posFixed === null || posFixed === void 0 ? void 0 : posFixed.rightBol)) {
|
|
@@ -1511,21 +1503,41 @@ var TableBody = function TableBody(props) {
|
|
|
1511
1503
|
return str;
|
|
1512
1504
|
};
|
|
1513
1505
|
return jsx(TdElement, Object.assign({
|
|
1514
|
-
align: operate.align || align,
|
|
1506
|
+
align: (operate === null || operate === void 0 ? void 0 : operate.align) || align,
|
|
1515
1507
|
className: handCls(),
|
|
1516
1508
|
colSpan: colSpan,
|
|
1517
1509
|
style: handStyle()
|
|
1518
1510
|
}, {
|
|
1519
|
-
children:
|
|
1511
|
+
children: jsxs("div", Object.assign({
|
|
1512
|
+
className: 'table-operate-box'
|
|
1513
|
+
}, {
|
|
1514
|
+
children: [handOperate(), dragRow && jsxs(Fragment, {
|
|
1515
|
+
children: [operate && jsx("span", {
|
|
1516
|
+
className: 'drag-btn-line'
|
|
1517
|
+
}), jsx(Button.IconButton, Object.assign({
|
|
1518
|
+
className: 'drag-row-btn',
|
|
1519
|
+
variant: 'text',
|
|
1520
|
+
toolTipTitle: !dragBol && intl({
|
|
1521
|
+
id: 'dragSort'
|
|
1522
|
+
}),
|
|
1523
|
+
TooltipProps: {
|
|
1524
|
+
placement: 'bottom-end',
|
|
1525
|
+
arrow: false
|
|
1526
|
+
}
|
|
1527
|
+
}, {
|
|
1528
|
+
children: jsx(Drag, {})
|
|
1529
|
+
}))]
|
|
1530
|
+
})]
|
|
1531
|
+
}))
|
|
1520
1532
|
}));
|
|
1521
1533
|
}
|
|
1522
|
-
}, [operate, align, showColumns, posFixed, fixedColumn]);
|
|
1534
|
+
}, [operate, align, showColumns, posFixed, fixedColumn, dragRow, onDragRow, dragBol]);
|
|
1523
1535
|
// 嵌套表格useCallback
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1536
|
+
const TableExpandableContentUseCallback = useCallback(row => {
|
|
1537
|
+
const id = row[rowKey];
|
|
1538
|
+
const expandItem = expandableRow[id] || {};
|
|
1527
1539
|
if (expandable && expandItem.status === 'develop') {
|
|
1528
|
-
|
|
1540
|
+
const expandableDemo = expandable(row);
|
|
1529
1541
|
if (expandableDemo === false) return null; // 展开表格返回值为false,不展示这一行
|
|
1530
1542
|
return jsx(TrElement, Object.assign({
|
|
1531
1543
|
className: "table-body-expand-row"
|
|
@@ -1540,7 +1552,7 @@ var TableBody = function TableBody(props) {
|
|
|
1540
1552
|
}
|
|
1541
1553
|
}, [expandable, expandableRow, expandableColSpan, rowKey]);
|
|
1542
1554
|
// 加载更多
|
|
1543
|
-
|
|
1555
|
+
const MoreMemo = useMemo(() => {
|
|
1544
1556
|
if (!loadMore || !showMoreBtn) return null;
|
|
1545
1557
|
return jsx(TrElement, Object.assign({
|
|
1546
1558
|
className: "more-table-row",
|
|
@@ -1563,10 +1575,10 @@ var TableBody = function TableBody(props) {
|
|
|
1563
1575
|
}))
|
|
1564
1576
|
}));
|
|
1565
1577
|
}, [expandableColSpan, loadMore, loadMoreRender, onClickMore, showMoreBtn, changePage, loadMoreUrl, lineHeight]);
|
|
1566
|
-
|
|
1578
|
+
const TableBodySubjectContentMemo = useMemo(() => {
|
|
1567
1579
|
return jsx(Fragment, {
|
|
1568
|
-
children: rowData.map(
|
|
1569
|
-
|
|
1580
|
+
children: rowData.map((row, index) => {
|
|
1581
|
+
let str = 'table-body-row';
|
|
1570
1582
|
if (rowClassMapping && rowClassMapping[row[rowKey]]) {
|
|
1571
1583
|
str += " ".concat(rowClassMapping[row[rowKey]]);
|
|
1572
1584
|
}
|
|
@@ -1576,7 +1588,7 @@ var TableBody = function TableBody(props) {
|
|
|
1576
1588
|
style: {
|
|
1577
1589
|
height: "".concat(lineHeight, "px")
|
|
1578
1590
|
},
|
|
1579
|
-
onClick:
|
|
1591
|
+
onClick: e => {
|
|
1580
1592
|
onClickRow && onClickRow(row, e);
|
|
1581
1593
|
}
|
|
1582
1594
|
}, {
|
|
@@ -1585,55 +1597,72 @@ var TableBody = function TableBody(props) {
|
|
|
1585
1597
|
}, index);
|
|
1586
1598
|
})
|
|
1587
1599
|
});
|
|
1588
|
-
}, [rowData, rowKey, disabledJson, checkJson, radio, radioValue, expandable, expandableRow, tableCell, headData, align, operate, expandableColSpan, selectCheck, selectRadio, disabledExpandJson, onExpand, disabledArrStatus, showColumns, onClickRow, rowClassMapping, tipMaxWidth, lineHeight]);
|
|
1600
|
+
}, [rowData, rowKey, disabledJson, checkJson, radio, radioValue, expandable, expandableRow, tableCell, headData, align, operate, expandableColSpan, selectCheck, selectRadio, disabledExpandJson, onExpand, disabledArrStatus, showColumns, onClickRow, rowClassMapping, tipMaxWidth, lineHeight, dragRow, onDragRow, dragBol]);
|
|
1589
1601
|
// 内容memo
|
|
1590
|
-
|
|
1602
|
+
const TableBodyContentMemo = useMemo(() => {
|
|
1591
1603
|
return jsxs(Fragment$1, {
|
|
1592
1604
|
children: [TableBodySubjectContentMemo, MoreMemo]
|
|
1593
1605
|
});
|
|
1594
|
-
}, [rowData, rowKey, disabledJson, checkJson, radio, radioValue, expandable, expandableRow, tableCell, headData, align, operate, expandableColSpan, selectCheck, selectRadio, loadMore, loadMoreRender, onClickMore, changePage, loadMoreUrl, disabledExpandJson, onExpand, showMoreBtn, disabledArrStatus, showColumns, onClickRow, rowClassMapping, tipMaxWidth, lineHeight]);
|
|
1606
|
+
}, [rowData, rowKey, disabledJson, checkJson, radio, radioValue, expandable, expandableRow, tableCell, headData, align, operate, expandableColSpan, selectCheck, selectRadio, loadMore, loadMoreRender, onClickMore, changePage, loadMoreUrl, disabledExpandJson, onExpand, showMoreBtn, disabledArrStatus, showColumns, onClickRow, rowClassMapping, tipMaxWidth, lineHeight, dragRow, onDragRow, dragBol]);
|
|
1595
1607
|
// 处理内容
|
|
1596
|
-
|
|
1608
|
+
const handContent = () => {
|
|
1597
1609
|
// 无数据,且不再请求,显示暂无数据
|
|
1598
1610
|
if (rowData.length === 0 && !loadState) return NodataMemo;
|
|
1599
1611
|
return TableBodyContentMemo;
|
|
1600
1612
|
};
|
|
1613
|
+
const handleRowData = () => {
|
|
1614
|
+
const arr = [];
|
|
1615
|
+
if (dragRow) {
|
|
1616
|
+
rowData.forEach(item => {
|
|
1617
|
+
const obj = {};
|
|
1618
|
+
obj[rowKey] = item[rowKey];
|
|
1619
|
+
arr.push(obj);
|
|
1620
|
+
});
|
|
1621
|
+
}
|
|
1622
|
+
return arr;
|
|
1623
|
+
};
|
|
1624
|
+
const onChoose = () => {
|
|
1625
|
+
setDragBol(true);
|
|
1626
|
+
};
|
|
1627
|
+
const onDragRowCom = evt => {
|
|
1628
|
+
setDragBol(false);
|
|
1629
|
+
onDragRow && onDragRow(evt);
|
|
1630
|
+
};
|
|
1601
1631
|
return jsx(TableBodyElement, Object.assign({
|
|
1602
|
-
className: handClass()
|
|
1632
|
+
className: handClass(),
|
|
1633
|
+
drag: dragRow,
|
|
1634
|
+
handle: '.drag-row-btn',
|
|
1635
|
+
list: handleRowData(),
|
|
1636
|
+
onDrag: onDragRowCom,
|
|
1637
|
+
onChoose: onChoose
|
|
1603
1638
|
}, {
|
|
1604
1639
|
children: handContent()
|
|
1605
1640
|
}));
|
|
1606
1641
|
};
|
|
1607
1642
|
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
checkNumber =
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
setIndeterminate = _useState2[1]; // 半选中
|
|
1632
|
-
var _useState3 = useState(false),
|
|
1633
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
1634
|
-
checked = _useState4[0],
|
|
1635
|
-
setChecked = _useState4[1]; // 选中
|
|
1636
|
-
useEffect(function () {
|
|
1643
|
+
const TableHead = props => {
|
|
1644
|
+
const {
|
|
1645
|
+
paginationType,
|
|
1646
|
+
flippingArrow,
|
|
1647
|
+
autoPagination,
|
|
1648
|
+
total,
|
|
1649
|
+
page,
|
|
1650
|
+
rowsPerPage,
|
|
1651
|
+
currentRowsPerPage,
|
|
1652
|
+
changePage,
|
|
1653
|
+
changeRowsPerPage,
|
|
1654
|
+
refreshInside,
|
|
1655
|
+
checkCount,
|
|
1656
|
+
onRefresh,
|
|
1657
|
+
selectAll,
|
|
1658
|
+
selectStatus,
|
|
1659
|
+
checkNumber = 0,
|
|
1660
|
+
currentPageTotal = 0
|
|
1661
|
+
} = props;
|
|
1662
|
+
const intl = useFormatMessage('Table', localeJson);
|
|
1663
|
+
const [indeterminate, setIndeterminate] = useState(false); // 半选中
|
|
1664
|
+
const [checked, setChecked] = useState(false); // 选中
|
|
1665
|
+
useEffect(() => {
|
|
1637
1666
|
// 全选
|
|
1638
1667
|
if (selectStatus === 'all') {
|
|
1639
1668
|
setChecked(true);
|
|
@@ -1655,23 +1684,23 @@ var TableHead = function TableHead(props) {
|
|
|
1655
1684
|
* @param event 操作元素
|
|
1656
1685
|
* @param bol 选中 / 不选中
|
|
1657
1686
|
*/
|
|
1658
|
-
|
|
1687
|
+
const onSelectAll = (event, bol) => {
|
|
1659
1688
|
if (selectAll) selectAll(event, bol);
|
|
1660
1689
|
};
|
|
1661
1690
|
// 改变页面
|
|
1662
|
-
|
|
1691
|
+
const changePageCom = num => {
|
|
1663
1692
|
changePage && changePage(num);
|
|
1664
1693
|
};
|
|
1665
1694
|
// 改变每页显示条数
|
|
1666
|
-
|
|
1695
|
+
const changeRowsPerPageCom = num => {
|
|
1667
1696
|
changeRowsPerPage && changeRowsPerPage(num);
|
|
1668
1697
|
};
|
|
1669
1698
|
// 刷新
|
|
1670
|
-
|
|
1699
|
+
const clickRefresh = () => {
|
|
1671
1700
|
onRefresh && onRefresh();
|
|
1672
1701
|
};
|
|
1673
1702
|
// 处理分页右侧
|
|
1674
|
-
|
|
1703
|
+
const handlePaginationRight = () => {
|
|
1675
1704
|
if (!checkCount) return null;
|
|
1676
1705
|
return jsxs("div", Object.assign({
|
|
1677
1706
|
className: 'table-pagination-right'
|
|
@@ -1694,8 +1723,8 @@ var TableHead = function TableHead(props) {
|
|
|
1694
1723
|
}));
|
|
1695
1724
|
};
|
|
1696
1725
|
// 处理样式
|
|
1697
|
-
|
|
1698
|
-
|
|
1726
|
+
const handleClass = () => {
|
|
1727
|
+
const str = 'table-pagination';
|
|
1699
1728
|
return str;
|
|
1700
1729
|
};
|
|
1701
1730
|
return jsxs("div", Object.assign({
|
|
@@ -1712,9 +1741,7 @@ var TableHead = function TableHead(props) {
|
|
|
1712
1741
|
currentRowsPerPage: currentRowsPerPage,
|
|
1713
1742
|
changePage: changePageCom,
|
|
1714
1743
|
changeRowsPerPage: changeRowsPerPageCom,
|
|
1715
|
-
getPopupContainer:
|
|
1716
|
-
return document.body;
|
|
1717
|
-
}
|
|
1744
|
+
getPopupContainer: () => document.body
|
|
1718
1745
|
}), refreshInside && jsx(Button.IconButton, Object.assign({
|
|
1719
1746
|
className: 'refresh-btn',
|
|
1720
1747
|
variant: "outlined",
|
|
@@ -1728,14 +1755,16 @@ var TableHead = function TableHead(props) {
|
|
|
1728
1755
|
var css_248z$2 = ".table-container {\n overflow-x: auto;\n}";
|
|
1729
1756
|
styleInject(css_248z$2);
|
|
1730
1757
|
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1758
|
+
const TableContainer = props => {
|
|
1759
|
+
const {
|
|
1760
|
+
cRef,
|
|
1761
|
+
className,
|
|
1762
|
+
style,
|
|
1763
|
+
children
|
|
1764
|
+
} = props,
|
|
1736
1765
|
otherProps = __rest(props, ["cRef", "className", "style", "children"]);
|
|
1737
|
-
|
|
1738
|
-
|
|
1766
|
+
const handClass = () => {
|
|
1767
|
+
let str = 'table-container';
|
|
1739
1768
|
if (className) str += " ".concat(className);
|
|
1740
1769
|
return str;
|
|
1741
1770
|
};
|
|
@@ -1751,14 +1780,16 @@ var TableContainer = function TableContainer(props) {
|
|
|
1751
1780
|
var css_248z$1 = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.table-element {\n width: 100%;\n display: table;\n border-collapse: separate;\n border-spacing: 0;\n}\n.table-element.table-element-fixed-column > .table-body-element > .tr-element > .td-element {\n position: sticky;\n}\n.table-element > .table-head-element > .tr-element > .th-element {\n position: sticky;\n top: 0;\n z-index: 10;\n}\n.table-element > .table-head-element > .tr-element > .th-element.table-fixed-dom-left.table-fixed-dom-left-last::after {\n height: 100%;\n width: 30px;\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(100%);\n content: \"\";\n transition: box-shadow 0.3s;\n pointer-events: none;\n}\n.table-element > .table-head-element > .tr-element > .th-element.table-fixed-dom-right.table-fixed-dom-right-first::after {\n height: 100%;\n width: 30px;\n position: absolute;\n top: 0;\n left: 0;\n transform: translate(-100%);\n content: \"\";\n transition: box-shadow 0.3s;\n pointer-events: none;\n}\n.table-element > .table-head-element > .tr-element > .th-element.table-fixed-dom-left {\n z-index: 11;\n}\n.table-element > .table-head-element > .tr-element > .th-element.table-fixed-dom-right {\n z-index: 11;\n}\n.table-element > .table-body-element > .tr-element > .td-element {\n z-index: 1;\n}\n.table-element > .table-body-element > .tr-element > .td-element.table-fixed-dom-left.table-fixed-dom-left-last::after {\n height: 100%;\n width: 30px;\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(100%);\n content: \"\";\n transition: box-shadow 0.3s;\n pointer-events: none;\n}\n.table-element > .table-body-element > .tr-element > .td-element.table-fixed-dom-right.table-fixed-dom-right-first::after {\n height: 100%;\n width: 30px;\n position: absolute;\n top: 0;\n left: 0;\n transform: translate(-100%);\n content: \"\";\n transition: box-shadow 0.3s;\n pointer-events: none;\n}\n.table-element > .table-body-element > .tr-element > .td-element.table-fixed-dom-left {\n z-index: 2;\n}\n.table-element > .table-body-element > .tr-element > .td-element.table-fixed-dom-right {\n z-index: 2;\n}\n\n.table-scroll-left .table-element > .table-head-element > .tr-element > .th-element.table-fixed-dom-right.table-fixed-dom-right-first::after {\n box-shadow: inset -10px 0 10px -8px rgb(234, 236, 241);\n}\n.table-scroll-left .table-element > .table-body-element > .tr-element > .td-element.table-fixed-dom-right.table-fixed-dom-right-first::after {\n box-shadow: inset -10px 0 10px -8px rgb(234, 236, 241);\n}\n\n.table-scroll-right .table-element > .table-head-element > .tr-element > .th-element.table-fixed-dom-left.table-fixed-dom-left-last::after {\n box-shadow: inset 10px 0 10px -8px rgb(234, 236, 241);\n}\n.table-scroll-right .table-element > .table-body-element > .tr-element > .td-element.table-fixed-dom-left.table-fixed-dom-left-last::after {\n box-shadow: inset 10px 0 10px -8px rgb(234, 236, 241);\n}\n\n.table-scroll-middle .table-element > .table-head-element > .tr-element > .th-element.table-fixed-dom-left.table-fixed-dom-left-last::after {\n box-shadow: inset 10px 0 10px -8px rgb(234, 236, 241);\n}\n.table-scroll-middle .table-element > .table-head-element > .tr-element > .th-element.table-fixed-dom-right.table-fixed-dom-right-first::after {\n box-shadow: inset -10px 0 10px -8px rgb(234, 236, 241);\n}\n.table-scroll-middle .table-element > .table-body-element > .tr-element > .td-element.table-fixed-dom-left.table-fixed-dom-left-last::after {\n box-shadow: inset 10px 0 10px -8px rgb(234, 236, 241);\n}\n.table-scroll-middle .table-element > .table-body-element > .tr-element > .td-element.table-fixed-dom-right.table-fixed-dom-right-first::after {\n box-shadow: inset -10px 0 10px -8px rgb(234, 236, 241);\n}";
|
|
1752
1781
|
styleInject(css_248z$1);
|
|
1753
1782
|
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1783
|
+
const TableElement = props => {
|
|
1784
|
+
const {
|
|
1785
|
+
className,
|
|
1786
|
+
style,
|
|
1787
|
+
fixedColumn,
|
|
1788
|
+
children
|
|
1789
|
+
} = props,
|
|
1759
1790
|
otherProps = __rest(props, ["className", "style", "fixedColumn", "children"]);
|
|
1760
|
-
|
|
1761
|
-
|
|
1791
|
+
const handClass = () => {
|
|
1792
|
+
let str = 'table-element';
|
|
1762
1793
|
if (fixedColumn) str += ' table-element-fixed-column';
|
|
1763
1794
|
if (className) str += " ".concat(className);
|
|
1764
1795
|
return str;
|
|
@@ -1771,7 +1802,7 @@ var TableElement = function TableElement(props) {
|
|
|
1771
1802
|
}));
|
|
1772
1803
|
};
|
|
1773
1804
|
|
|
1774
|
-
var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-table {\n width: 100%;\n height: 100%;\n overflow: auto;\n background-color: white;\n font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC, WenQuanYi Micro Hei, sans-serif;\n font-size: 14px;\n font-weight: 400;\n position: relative;\n}\n.paraui-v4-table.paraui-v4-table-draggable * {\n user-select: none !important;\n}\n.paraui-v4-table.paraui-v4-table-fixed-table > .table-contain > table {\n table-layout: fixed;\n}\n.paraui-v4-table.paraui-v4-table-fixed-cloumn > .table-contain > table .table-checkbox {\n left: 0;\n}\n.paraui-v4-table.paraui-v4-table-fixed-cloumn > .table-contain > table .table-radio {\n left: 0;\n}\n.paraui-v4-table.paraui-v4-table-fixed-cloumn > .table-contain > table .table-expandable {\n left: 0;\n}\n.paraui-v4-table.paraui-v4-table-fixed-cloumn.paraui-v4-table-radio.paraui-v4-table-check .table-radio {\n left: 48px;\n}\n.paraui-v4-table.paraui-v4-table-fixed-cloumn.paraui-v4-table-expandable.paraui-v4-table-check .table-expandable {\n left: 48px;\n}\n.paraui-v4-table.paraui-v4-table-fixed-cloumn.paraui-v4-table-expandable.paraui-v4-table-check.paraui-v4-table-radio .table-expandable {\n left: 80px;\n}\n.paraui-v4-table.paraui-v4-table-no-data > .table-container > table {\n height: 100%;\n}\n.paraui-v4-table.paraui-v4-table-no-data > .table-container > table .paraui-v4-empty {\n overflow: hidden;\n}\n.paraui-v4-table.paraui-v4-table-load.paraui-v4-table-no-data > .table-container > table {\n height: auto;\n}\n.paraui-v4-table.paraui-v4-table-pagination > .table-contain {\n height: calc(100% - 36px);\n}\n.paraui-v4-table.paraui-v4-table-pagination.table-load-more > .table-contain {\n height: 100%;\n}\n.paraui-v4-table.paraui-v4-table-load-more.paraui-v4-table-pagination > .table-contain {\n height: 100%;\n}\n.paraui-v4-table > .table-contain {\n height: 100%;\n position: relative;\n}\n.paraui-v4-table > .table-contain > table {\n height: auto;\n}\n.paraui-v4-table > .table-contain > table .table-checkbox > label {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.paraui-v4-table > .table-contain > table .table-checkbox .table-header-box {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.paraui-v4-table > .table-contain > table .table-radio > label {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.paraui-v4-table > .table-contain > table .table-radio .table-header-box {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.paraui-v4-table > .table-contain > table .table-expandable > svg {\n vertical-align: middle;\n}\n.paraui-v4-table > .table-contain > table > .table-head {\n width: 100%;\n white-space: nowrap;\n}\n.paraui-v4-table > .table-contain > table > .table-head > tr th {\n height: 48px;\n}\n.paraui-v4-table > .table-contain > table > .table-head.table-head-scroll tr th {\n max-width: 240px;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-serial-number .table-header-box .table-header-title {\n padding-right: 0;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box {\n height: 47px;\n line-height: 47px;\n position: relative;\n padding: 0 8px;\n display: flex;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-header-title {\n max-width: 100%;\n display: flex;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-header-title > .table-header-title-label {\n width: 100%;\n color: rgb(92, 101, 115);\n font-weight: 700;\n font-size: 14px;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-sort-svg {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-sort-svg > span {\n width: 20px;\n height: 20px;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n border-radius: 2px;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-sort-svg > span:hover {\n background-color: rgba(46, 101, 230, 0.1);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-sort-svg > span:hover > svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-sort-svg > span > svg {\n font-size: 12px;\n color: rgb(92, 101, 115);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-sort-svg > span > .up-svg {\n position: relative;\n top: 3px;\n transform: scale(0.8);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-sort-svg > span > .down-svg {\n position: relative;\n top: -3px;\n transform: scale(0.8);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-header-filter {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-header-filter > span {\n width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n cursor: pointer;\n border-radius: 2px;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-header-filter > span:hover {\n background-color: rgba(46, 101, 230, 0.1);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-header-filter > span:hover > svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-header-filter > span > svg {\n font-size: 14px;\n color: rgb(92, 101, 115);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-header-filter.table-header-filter-show > span > svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-header-filter.table-header-filter-select > span > svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-header-filter.table-header-filter-select > span:after {\n position: absolute;\n width: 4px;\n height: 4px;\n border-radius: 50%;\n background-color: rgb(244, 66, 66);\n content: \"\";\n right: 3px;\n top: 2px;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box.table-header-box-sort > .table-header-title {\n padding-right: 8px;\n max-width: calc(100% - 20px);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box.table-header-box-filter > .table-header-title {\n padding-right: 8px;\n max-width: calc(100% - 20px);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box.table-header-box-sort.table-header-box-filter > .table-header-title {\n max-width: calc(100% - 40px);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box.table-header-box-sort-asc > .table-sort-svg > span > .up-svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box.table-header-box-sort-desc > .table-sort-svg > span > .down-svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-table > .table-contain > table > .table-head .show-colums {\n width: 53px;\n cursor: pointer;\n border-left: 1px solid rgb(234, 236, 241);\n right: 0;\n}\n.paraui-v4-table > .table-contain > table > .table-head .show-colums .table-header-box {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n}\n.paraui-v4-table > .table-contain > table > .table-head .show-colums .table-header-box > svg {\n font-size: 20px;\n color: rgb(92, 101, 115);\n}\n.paraui-v4-table > .table-contain > table > .table-head .show-colums .table-header-box:hover > svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-table > .table-contain > table > .table-head.table-head-no-btn tr th:first-child .table-header-box {\n padding-left: 20px;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-head-btn {\n width: 32px;\n padding: 0;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-head-btn > .table-header-box {\n width: 32px;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-head-btn:first-child {\n width: 48px;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-head-btn:first-child > .table-header-box {\n width: 48px;\n}\n.paraui-v4-table > .table-contain > table > .table-body {\n width: 100%;\n}\n.paraui-v4-table > .table-contain > table > .table-body.table-body-scroll tr td {\n max-width: 240px;\n}\n.paraui-v4-table > .table-contain > table > .table-body tr td {\n background-color: white;\n color: rgb(29, 33, 38);\n}\n.paraui-v4-table > .table-contain > table > .table-body tr td.table-operate {\n padding-right: 16px;\n}\n.paraui-v4-table > .table-contain > table > .table-body tr:nth-of-type(2n) td {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-table > .table-contain > table > .table-body tr:hover td {\n background-color: rgb(233, 239, 255);\n}\n.paraui-v4-table > .table-contain > table > .table-body tr .table-expandable > svg {\n transition: all 0.3s;\n cursor: pointer;\n font-size: 18px;\n color: rgb(92, 101, 115);\n transform: rotate(270deg);\n}\n.paraui-v4-table > .table-contain > table > .table-body tr .table-expandable > svg:hover {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-table > .table-contain > table > .table-body tr .table-expandable > .expand {\n transform: rotate(360deg);\n}\n.paraui-v4-table > .table-contain > table > .table-body .more-table-row {\n cursor: pointer;\n position: sticky;\n bottom: 0;\n z-index: 10;\n}\n.paraui-v4-table > .table-contain > table > .table-body .more-table-row .more-btn {\n color: rgb(46, 101, 230);\n font-size: 14px;\n}\n.paraui-v4-table > .table-contain > table > .table-body .more-table-row > .td-element {\n position: relative;\n background: white;\n box-shadow: 4px -4px 8px 0px rgb(234, 236, 241);\n}\n.paraui-v4-table > .table-contain > table > .table-body.table-body-no-btn tr td:first-child {\n padding-left: 20px;\n}\n.paraui-v4-table > .table-contain > table > .table-body.table-body-no-btn tr.more-table-row td:first-child {\n padding-left: 8px;\n}\n.paraui-v4-table > .table-contain > table > .table-body.table-body-no-btn > .table-no-data > td:first-child {\n padding: 0;\n}\n.paraui-v4-table > .table-contain > table > .table-body .table-body-btn {\n width: 32px;\n padding: 0;\n}\n.paraui-v4-table > .table-contain > table > .table-body .table-body-btn:first-child {\n width: 48px;\n}\n.paraui-v4-table > .table-contain > table > .table-body > .table-no-data {\n height: calc(100% - 50px);\n}\n.paraui-v4-table > .table-contain > table > .table-body > .table-no-data:hover td {\n background-color: white;\n}\n.paraui-v4-table > .table-contain > table > .table-body > .table-no-data > td {\n padding: 56px 0 0 0;\n}\n.paraui-v4-table > .table-contain > .table-pos-line {\n position: absolute;\n top: 0;\n width: 1px;\n background-color: rgb(46, 101, 230);\n z-index: 1000;\n}\n.paraui-v4-table > .table-pagination {\n width: 100%;\n height: 36px;\n display: flex;\n align-items: flex-end;\n}\n.paraui-v4-table > .table-pagination .table-pagination-right {\n display: flex;\n height: 32px;\n align-items: center;\n color: rgb(29, 33, 38);\n line-height: 32px;\n padding-left: 16px;\n}\n.paraui-v4-table > .table-pagination .table-pagination-right .all-select {\n margin-left: 12px;\n}\n.paraui-v4-table > .table-pagination .table-pagination-right .line {\n width: 1px;\n height: 12px;\n background-color: rgb(212, 218, 227);\n margin: 0 10px;\n}\n.paraui-v4-table > .table-pagination .table-pagination-right .check-number {\n width: 65px;\n display: inline-block;\n}\n.paraui-v4-table > .table-pagination .table-pagination-com {\n flex: 1;\n justify-content: flex-end;\n}\n.paraui-v4-table > .table-pagination .refresh-btn {\n margin-left: 20px;\n}\n\n.paraui-v4-table-show-colums-popover > .component-popover-content {\n min-width: 200px;\n}\n.paraui-v4-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box {\n padding-top: 4px;\n max-height: 320px;\n overflow-y: auto;\n}\n.paraui-v4-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box > .show-colums-select-item {\n height: 30px;\n line-height: 30px;\n cursor: pointer;\n display: flex;\n padding: 0 10px;\n}\n.paraui-v4-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box > .show-colums-select-item > label {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.paraui-v4-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box > .show-colums-select-item > span {\n padding-left: 8px;\n color: rgb(29, 33, 38);\n font-size: 14px;\n display: inline-block;\n width: calc(100% - 14px);\n}\n.paraui-v4-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box > .show-colums-select-item:hover {\n background: rgb(247, 248, 250);\n}\n.paraui-v4-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box > .show-colums-select-item.show-colums-select-item-disabled {\n cursor: inherit;\n}\n.paraui-v4-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box > .show-colums-select-item.show-colums-select-item-disabled > span {\n color: rgb(29, 33, 38);\n}\n.paraui-v4-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box > .show-colums-select-item.show-colums-select-item-disabled:hover {\n background: transparent;\n}\n.paraui-v4-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-footer {\n height: 36px;\n border-top: 1px solid rgb(247, 248, 250);\n text-align: center;\n}\n.paraui-v4-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-footer > button {\n width: 100%;\n height: 100%;\n margin: 0;\n}\n\n.paraui-v4-filter-popover > .component-popover-content .filter-select > .filter-select-box {\n padding-top: 4px;\n max-height: 320px;\n overflow-y: auto;\n}\n.paraui-v4-filter-popover > .component-popover-content .filter-select > .filter-select-box > .filter-select-item {\n height: 30px;\n line-height: 30px;\n cursor: pointer;\n display: flex;\n padding: 0 10px;\n}\n.paraui-v4-filter-popover > .component-popover-content .filter-select > .filter-select-box > .filter-select-item > label {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.paraui-v4-filter-popover > .component-popover-content .filter-select > .filter-select-box > .filter-select-item > span {\n padding-left: 8px;\n color: rgb(29, 33, 38);\n font-size: 14px;\n display: inline-block;\n width: calc(100% - 14px);\n}\n.paraui-v4-filter-popover > .component-popover-content .filter-select > .filter-select-box > .filter-select-item:hover {\n background: rgb(247, 248, 250);\n}\n.paraui-v4-filter-popover > .component-popover-content .filter-select > .filter-select-footer {\n height: 36px;\n border-top: 1px solid rgb(247, 248, 250);\n text-align: center;\n}\n.paraui-v4-filter-popover > .component-popover-content .filter-select > .filter-select-footer > button {\n width: 50%;\n height: 100%;\n margin: 0;\n}\n.paraui-v4-filter-popover > .component-popover-content .filter-select.filter-select-none {\n text-align: center;\n padding: 20px 0;\n}\n.paraui-v4-filter-popover.paraui-v4-filter-popover-default > .component-popover-content {\n min-width: 200px;\n}";
|
|
1805
|
+
var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-table {\n width: 100%;\n height: 100%;\n overflow: auto;\n background-color: white;\n font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC, WenQuanYi Micro Hei, sans-serif;\n font-size: 14px;\n font-weight: 400;\n position: relative;\n}\n.paraui-v4-table.paraui-v4-table-draggable * {\n user-select: none !important;\n}\n.paraui-v4-table.paraui-v4-table-fixed-table > .table-contain > table {\n table-layout: fixed;\n}\n.paraui-v4-table.paraui-v4-table-fixed-cloumn > .table-contain > table .table-checkbox {\n left: 0;\n}\n.paraui-v4-table.paraui-v4-table-fixed-cloumn > .table-contain > table .table-radio {\n left: 0;\n}\n.paraui-v4-table.paraui-v4-table-fixed-cloumn > .table-contain > table .table-expandable {\n left: 0;\n}\n.paraui-v4-table.paraui-v4-table-fixed-cloumn.paraui-v4-table-radio.paraui-v4-table-check .table-radio {\n left: 48px;\n}\n.paraui-v4-table.paraui-v4-table-fixed-cloumn.paraui-v4-table-expandable.paraui-v4-table-check .table-expandable {\n left: 48px;\n}\n.paraui-v4-table.paraui-v4-table-fixed-cloumn.paraui-v4-table-expandable.paraui-v4-table-check.paraui-v4-table-radio .table-expandable {\n left: 80px;\n}\n.paraui-v4-table.paraui-v4-table-no-data > .table-container > table {\n height: 100%;\n}\n.paraui-v4-table.paraui-v4-table-no-data > .table-container > table .paraui-v4-empty {\n overflow: hidden;\n}\n.paraui-v4-table.paraui-v4-table-load.paraui-v4-table-no-data > .table-container > table {\n height: auto;\n}\n.paraui-v4-table.paraui-v4-table-pagination > .table-contain {\n height: calc(100% - 36px);\n}\n.paraui-v4-table.paraui-v4-table-pagination.table-load-more > .table-contain {\n height: 100%;\n}\n.paraui-v4-table.paraui-v4-table-load-more.paraui-v4-table-pagination > .table-contain {\n height: 100%;\n}\n.paraui-v4-table > .table-contain {\n height: 100%;\n position: relative;\n}\n.paraui-v4-table > .table-contain > table {\n height: auto;\n}\n.paraui-v4-table > .table-contain > table .table-checkbox > label {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.paraui-v4-table > .table-contain > table .table-checkbox .table-header-box {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.paraui-v4-table > .table-contain > table .table-radio > label {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.paraui-v4-table > .table-contain > table .table-radio .table-header-box {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.paraui-v4-table > .table-contain > table .table-expandable > svg {\n vertical-align: middle;\n}\n.paraui-v4-table > .table-contain > table > .table-head {\n width: 100%;\n white-space: nowrap;\n}\n.paraui-v4-table > .table-contain > table > .table-head > tr th {\n height: 48px;\n}\n.paraui-v4-table > .table-contain > table > .table-head.table-head-scroll tr th {\n max-width: 240px;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-serial-number .table-header-box .table-header-title {\n padding-right: 0;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box {\n height: 47px;\n line-height: 47px;\n position: relative;\n padding: 0 8px;\n display: flex;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-header-title {\n max-width: 100%;\n display: flex;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-header-title > .table-header-title-label {\n width: 100%;\n color: rgb(92, 101, 115);\n font-weight: 700;\n font-size: 14px;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-sort-svg {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-sort-svg > span {\n width: 20px;\n height: 20px;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n border-radius: 2px;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-sort-svg > span:hover {\n background-color: rgba(46, 101, 230, 0.1);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-sort-svg > span:hover > svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-sort-svg > span > svg {\n font-size: 12px;\n color: rgb(92, 101, 115);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-sort-svg > span > .up-svg {\n position: relative;\n top: 3px;\n transform: scale(0.8);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-sort-svg > span > .down-svg {\n position: relative;\n top: -3px;\n transform: scale(0.8);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-header-filter {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-header-filter > span {\n width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n cursor: pointer;\n border-radius: 2px;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-header-filter > span:hover {\n background-color: rgba(46, 101, 230, 0.1);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-header-filter > span:hover > svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-header-filter > span > svg {\n font-size: 14px;\n color: rgb(92, 101, 115);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-header-filter.table-header-filter-show > span > svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-header-filter.table-header-filter-select > span > svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box > .table-header-filter.table-header-filter-select > span:after {\n position: absolute;\n width: 4px;\n height: 4px;\n border-radius: 50%;\n background-color: rgb(244, 66, 66);\n content: \"\";\n right: 3px;\n top: 2px;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box.table-header-box-sort > .table-header-title {\n padding-right: 8px;\n max-width: calc(100% - 20px);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box.table-header-box-filter > .table-header-title {\n padding-right: 8px;\n max-width: calc(100% - 20px);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box.table-header-box-sort.table-header-box-filter > .table-header-title {\n max-width: calc(100% - 40px);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box.table-header-box-sort-asc > .table-sort-svg > span > .up-svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-header-box.table-header-box-sort-desc > .table-sort-svg > span > .down-svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-table > .table-contain > table > .table-head .show-colums {\n width: 53px;\n cursor: pointer;\n border-left: 1px solid rgb(234, 236, 241);\n right: 0;\n}\n.paraui-v4-table > .table-contain > table > .table-head .show-colums .table-header-box {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n}\n.paraui-v4-table > .table-contain > table > .table-head .show-colums .table-header-box > svg {\n font-size: 20px;\n color: rgb(92, 101, 115);\n}\n.paraui-v4-table > .table-contain > table > .table-head .show-colums .table-header-box:hover > svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-table > .table-contain > table > .table-head .drag-row {\n width: 53px;\n cursor: pointer;\n border-left: 1px solid rgb(234, 236, 241);\n right: 0;\n}\n.paraui-v4-table > .table-contain > table > .table-head.table-head-no-btn tr th:first-child .table-header-box {\n padding-left: 20px;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-head-btn {\n width: 32px;\n padding: 0;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-head-btn > .table-header-box {\n width: 32px;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-head-btn:first-child {\n width: 48px;\n}\n.paraui-v4-table > .table-contain > table > .table-head .table-head-btn:first-child > .table-header-box {\n width: 48px;\n}\n.paraui-v4-table > .table-contain > table > .table-body {\n width: 100%;\n}\n.paraui-v4-table > .table-contain > table > .table-body.table-body-scroll tr td {\n max-width: 240px;\n}\n.paraui-v4-table > .table-contain > table > .table-body tr td {\n background-color: white;\n color: rgb(29, 33, 38);\n}\n.paraui-v4-table > .table-contain > table > .table-body tr td.table-operate {\n padding-right: 16px;\n}\n.paraui-v4-table > .table-contain > table > .table-body tr td.table-operate > .table-operate-box {\n display: flex;\n align-items: center;\n}\n.paraui-v4-table > .table-contain > table > .table-body tr td.table-operate > .table-operate-box .drag-btn-line {\n display: inline-block;\n width: 1px;\n height: 12px;\n background-color: rgb(213, 224, 250);\n margin: 0 10px;\n}\n.paraui-v4-table > .table-contain > table > .table-body tr td.table-operate > .table-operate-box .drag-row-btn {\n cursor: all-scroll;\n}\n.paraui-v4-table > .table-contain > table > .table-body tr td.table-operate > .table-operate-box .drag-row-btn svg {\n font-size: 18px;\n}\n.paraui-v4-table > .table-contain > table > .table-body tr td.table-operate.table-operate-center {\n padding-right: 8px;\n}\n.paraui-v4-table > .table-contain > table > .table-body tr td.table-operate.table-operate-center > .table-operate-box {\n justify-content: center;\n}\n.paraui-v4-table > .table-contain > table > .table-body tr:nth-of-type(2n) td {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-table > .table-contain > table > .table-body tr:hover td {\n background-color: rgb(233, 239, 255);\n}\n.paraui-v4-table > .table-contain > table > .table-body tr .table-expandable > svg {\n transition: all 0.3s;\n cursor: pointer;\n font-size: 18px;\n color: rgb(92, 101, 115);\n transform: rotate(270deg);\n}\n.paraui-v4-table > .table-contain > table > .table-body tr .table-expandable > svg:hover {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-table > .table-contain > table > .table-body tr .table-expandable > .expand {\n transform: rotate(360deg);\n}\n.paraui-v4-table > .table-contain > table > .table-body .more-table-row {\n cursor: pointer;\n position: sticky;\n bottom: 0;\n z-index: 10;\n}\n.paraui-v4-table > .table-contain > table > .table-body .more-table-row .more-btn {\n color: rgb(46, 101, 230);\n font-size: 14px;\n}\n.paraui-v4-table > .table-contain > table > .table-body .more-table-row > .td-element {\n position: relative;\n background: white;\n box-shadow: 4px -4px 8px 0px rgb(234, 236, 241);\n}\n.paraui-v4-table > .table-contain > table > .table-body.table-body-no-btn tr td:first-child {\n padding-left: 20px;\n}\n.paraui-v4-table > .table-contain > table > .table-body.table-body-no-btn tr.more-table-row td:first-child {\n padding-left: 8px;\n}\n.paraui-v4-table > .table-contain > table > .table-body.table-body-no-btn > .table-no-data > td:first-child {\n padding: 0;\n}\n.paraui-v4-table > .table-contain > table > .table-body .table-body-btn {\n width: 32px;\n padding: 0;\n}\n.paraui-v4-table > .table-contain > table > .table-body .table-body-btn:first-child {\n width: 48px;\n}\n.paraui-v4-table > .table-contain > table > .table-body > .table-no-data {\n height: calc(100% - 50px);\n}\n.paraui-v4-table > .table-contain > table > .table-body > .table-no-data:hover td {\n background-color: white;\n}\n.paraui-v4-table > .table-contain > table > .table-body > .table-no-data > td {\n padding: 56px 0 0 0;\n}\n.paraui-v4-table > .table-contain > .table-pos-line {\n position: absolute;\n top: 0;\n width: 1px;\n background-color: rgb(46, 101, 230);\n z-index: 1000;\n}\n.paraui-v4-table > .table-pagination {\n width: 100%;\n height: 36px;\n display: flex;\n align-items: flex-end;\n}\n.paraui-v4-table > .table-pagination .table-pagination-right {\n display: flex;\n height: 32px;\n align-items: center;\n color: rgb(29, 33, 38);\n line-height: 32px;\n padding-left: 16px;\n}\n.paraui-v4-table > .table-pagination .table-pagination-right .all-select {\n margin-left: 12px;\n}\n.paraui-v4-table > .table-pagination .table-pagination-right .line {\n width: 1px;\n height: 12px;\n background-color: rgb(212, 218, 227);\n margin: 0 10px;\n}\n.paraui-v4-table > .table-pagination .table-pagination-right .check-number {\n width: 65px;\n display: inline-block;\n}\n.paraui-v4-table > .table-pagination .table-pagination-com {\n flex: 1;\n justify-content: flex-end;\n}\n.paraui-v4-table > .table-pagination .refresh-btn {\n margin-left: 20px;\n}\n\n.paraui-v4-table-show-colums-popover > .component-popover-content {\n min-width: 200px;\n}\n.paraui-v4-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box {\n padding-top: 4px;\n max-height: 320px;\n overflow-y: auto;\n}\n.paraui-v4-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box > .show-colums-select-item {\n height: 30px;\n line-height: 30px;\n cursor: pointer;\n display: flex;\n padding: 0 10px;\n}\n.paraui-v4-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box > .show-colums-select-item > label {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.paraui-v4-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box > .show-colums-select-item > span {\n padding-left: 8px;\n color: rgb(29, 33, 38);\n font-size: 14px;\n display: inline-block;\n width: calc(100% - 14px);\n}\n.paraui-v4-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box > .show-colums-select-item:hover {\n background: rgb(247, 248, 250);\n}\n.paraui-v4-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box > .show-colums-select-item.show-colums-select-item-disabled {\n cursor: inherit;\n}\n.paraui-v4-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box > .show-colums-select-item.show-colums-select-item-disabled > span {\n color: rgb(29, 33, 38);\n}\n.paraui-v4-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box > .show-colums-select-item.show-colums-select-item-disabled:hover {\n background: transparent;\n}\n.paraui-v4-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-footer {\n height: 36px;\n border-top: 1px solid rgb(247, 248, 250);\n text-align: center;\n}\n.paraui-v4-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-footer > button {\n width: 100%;\n height: 100%;\n margin: 0;\n}\n\n.paraui-v4-filter-popover > .component-popover-content .filter-select > .filter-select-box {\n padding-top: 4px;\n max-height: 320px;\n overflow-y: auto;\n}\n.paraui-v4-filter-popover > .component-popover-content .filter-select > .filter-select-box > .filter-select-item {\n height: 30px;\n line-height: 30px;\n cursor: pointer;\n display: flex;\n padding: 0 10px;\n}\n.paraui-v4-filter-popover > .component-popover-content .filter-select > .filter-select-box > .filter-select-item > label {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.paraui-v4-filter-popover > .component-popover-content .filter-select > .filter-select-box > .filter-select-item > span {\n padding-left: 8px;\n color: rgb(29, 33, 38);\n font-size: 14px;\n display: inline-block;\n width: calc(100% - 14px);\n}\n.paraui-v4-filter-popover > .component-popover-content .filter-select > .filter-select-box > .filter-select-item:hover {\n background: rgb(247, 248, 250);\n}\n.paraui-v4-filter-popover > .component-popover-content .filter-select > .filter-select-footer {\n height: 36px;\n border-top: 1px solid rgb(247, 248, 250);\n text-align: center;\n}\n.paraui-v4-filter-popover > .component-popover-content .filter-select > .filter-select-footer > button {\n width: 50%;\n height: 100%;\n margin: 0;\n}\n.paraui-v4-filter-popover > .component-popover-content .filter-select.filter-select-none {\n text-align: center;\n padding: 20px 0;\n}\n.paraui-v4-filter-popover.paraui-v4-filter-popover-default > .component-popover-content {\n min-width: 200px;\n}";
|
|
1775
1806
|
styleInject(css_248z);
|
|
1776
1807
|
|
|
1777
1808
|
const Table = propsInit => {
|
|
@@ -1823,6 +1854,7 @@ const Table = propsInit => {
|
|
|
1823
1854
|
fixedTable = true,
|
|
1824
1855
|
fixedColumn = true,
|
|
1825
1856
|
dragColumn = true,
|
|
1857
|
+
dragRow,
|
|
1826
1858
|
formatter,
|
|
1827
1859
|
lineHeight = 48,
|
|
1828
1860
|
lineWidth = 80,
|
|
@@ -1849,7 +1881,8 @@ const Table = propsInit => {
|
|
|
1849
1881
|
onSort,
|
|
1850
1882
|
onError,
|
|
1851
1883
|
refreshInside = props.url ? true : false,
|
|
1852
|
-
checkCount = props.check ? true : false
|
|
1884
|
+
checkCount = props.check ? true : false,
|
|
1885
|
+
onDragRow
|
|
1853
1886
|
} = props;
|
|
1854
1887
|
const intl = useFormatMessage('Table', localeJson);
|
|
1855
1888
|
const dayNum = props.expirationTime ? props.expirationTime === 0 ? 100000000 : props.expirationTime : 7; // 过期天数
|
|
@@ -2378,8 +2411,8 @@ const Table = propsInit => {
|
|
|
2378
2411
|
// 计算右边的差量
|
|
2379
2412
|
const handRightWidth = () => {
|
|
2380
2413
|
let rightNum = 0;
|
|
2381
|
-
// 显示列宽度
|
|
2382
|
-
if (props.showColumns === 'inside' || props.showColumns === undefined) {
|
|
2414
|
+
// 显示列宽度 拖拽
|
|
2415
|
+
if (props.showColumns === 'inside' || props.showColumns === undefined || props.dragRow) {
|
|
2383
2416
|
rightNum += 53;
|
|
2384
2417
|
}
|
|
2385
2418
|
// 操作列
|
|
@@ -2388,10 +2421,13 @@ const Table = propsInit => {
|
|
|
2388
2421
|
rightNum += getStringInNumber(props.operate.width);
|
|
2389
2422
|
} else {
|
|
2390
2423
|
if (props.operate.operateBtnRender) {
|
|
2391
|
-
|
|
2392
|
-
|
|
2424
|
+
if (props.dragRow) {
|
|
2425
|
+
rightNum += 145;
|
|
2426
|
+
} else {
|
|
2427
|
+
rightNum += rightNum === 0 ? 158 : 105;
|
|
2428
|
+
}
|
|
2393
2429
|
} else {
|
|
2394
|
-
rightNum += lineWidth; //
|
|
2430
|
+
rightNum += lineWidth; // 自定义操作, 补偿一个最小的宽度
|
|
2395
2431
|
}
|
|
2396
2432
|
}
|
|
2397
2433
|
}
|
|
@@ -2828,6 +2864,22 @@ const Table = propsInit => {
|
|
|
2828
2864
|
setDrag: true
|
|
2829
2865
|
});
|
|
2830
2866
|
};
|
|
2867
|
+
/** 数组交换位置 */
|
|
2868
|
+
const moveElementToNthPosition = (arr, indexA, indexB) => {
|
|
2869
|
+
// 使用splice方法移除索引a处的元素,并将其存储在变量element中
|
|
2870
|
+
const element = arr.splice(indexA, 1)[0];
|
|
2871
|
+
// 在索引n处插入被移除的元素
|
|
2872
|
+
arr.splice(indexB, 0, element);
|
|
2873
|
+
return arr;
|
|
2874
|
+
};
|
|
2875
|
+
/** 拖动行 */
|
|
2876
|
+
const onDragRowCom = evt => __awaiter(void 0, void 0, void 0, function* () {
|
|
2877
|
+
if (evt.oldIndex === evt.newIndex) return;
|
|
2878
|
+
const newList = [...(rowData || [])];
|
|
2879
|
+
moveElementToNthPosition(newList, evt.oldIndex, evt.newIndex);
|
|
2880
|
+
const bol = yield onDragRow === null || onDragRow === void 0 ? void 0 : onDragRow(newList, evt);
|
|
2881
|
+
if (!bol) setRowData(newList);
|
|
2882
|
+
});
|
|
2831
2883
|
// 表格头部memo
|
|
2832
2884
|
const TableHeadMemo = useMemo(() => {
|
|
2833
2885
|
return jsx(TableHead$1, {
|
|
@@ -2856,12 +2908,13 @@ const Table = propsInit => {
|
|
|
2856
2908
|
beyondText: beyondText,
|
|
2857
2909
|
lineWidth: lineWidth,
|
|
2858
2910
|
dragColumn: dragColumn,
|
|
2911
|
+
dragRow: dragRow,
|
|
2859
2912
|
headDataConfig: headDataConfig,
|
|
2860
2913
|
tipMaxWidth: tipMaxWidth,
|
|
2861
2914
|
changeColumnWidth: changeColumnWidth,
|
|
2862
2915
|
getPopupContainer: getPopupContainer
|
|
2863
2916
|
});
|
|
2864
|
-
}, [totalDataJson, showColumns, rowKey, rowData, checkJson, disabledJson, orderTypeArr, orderFieldArr, sortTable, filter, expandable, check, headSelectStatus, radio, align, showHeadList, headDataCom, selectFilterCom, operate, onClickColumns, sortTableRadio, fixedTable, posFixed, beyondText, fixedColumn, lineWidth, dragColumn, headDataConfig, getPopupContainer, onSort, tipMaxWidth]);
|
|
2917
|
+
}, [totalDataJson, showColumns, rowKey, rowData, checkJson, disabledJson, orderTypeArr, orderFieldArr, sortTable, filter, expandable, check, headSelectStatus, radio, align, showHeadList, headDataCom, selectFilterCom, operate, onClickColumns, sortTableRadio, fixedTable, posFixed, beyondText, fixedColumn, lineWidth, dragColumn, dragRow, headDataConfig, getPopupContainer, onSort, tipMaxWidth]);
|
|
2865
2918
|
// 表格内容memo
|
|
2866
2919
|
const TableBodyMemo = useMemo(() => {
|
|
2867
2920
|
return jsx(TableBody, {
|
|
@@ -2912,9 +2965,11 @@ const Table = propsInit => {
|
|
|
2912
2965
|
onClickRow: onClickRow,
|
|
2913
2966
|
rowClassMapping: rowClassMapping,
|
|
2914
2967
|
tipMaxWidth: tipMaxWidth,
|
|
2915
|
-
lineHeight: lineHeight
|
|
2968
|
+
lineHeight: lineHeight,
|
|
2969
|
+
dragRow: dragRow,
|
|
2970
|
+
onDragRow: onDragRowCom
|
|
2916
2971
|
});
|
|
2917
|
-
}, [showColumns, formatter, rowKey, rowData, headDataCom, expandable, check, radio, checkJson, sortTable, orderTypeArr, orderFieldArr, radioValue, disabledJson, align, tableCell, operate, setRadio, setCheck, totalDataJson, loadMore, loadMoreRender, onClickMore, total, pageCom, sizeCom, loadMoreUrl, expandValue, expandMultiple, disabledExpand, onExpand, defaultExpandAllRows, loadState, emptyProps, url, disabledArrStatus, posFixed, beyondText, fixedTable, fixedColumn, onClickRow, rowClassMapping, tipMaxWidth, lineHeight]);
|
|
2972
|
+
}, [showColumns, formatter, rowKey, rowData, headDataCom, expandable, check, radio, checkJson, sortTable, orderTypeArr, orderFieldArr, radioValue, disabledJson, align, tableCell, operate, setRadio, setCheck, totalDataJson, loadMore, loadMoreRender, onClickMore, total, pageCom, sizeCom, loadMoreUrl, expandValue, expandMultiple, disabledExpand, onExpand, defaultExpandAllRows, loadState, emptyProps, url, disabledArrStatus, posFixed, beyondText, fixedTable, fixedColumn, onClickRow, rowClassMapping, tipMaxWidth, lineHeight, dragRow, onDragRow]);
|
|
2918
2973
|
// 表格分页memo
|
|
2919
2974
|
const TablePaginationMemo = useMemo(() => {
|
|
2920
2975
|
if (constData.current.page === null || constData.current.size === null || loadMore) return;
|
|
@@ -2968,6 +3023,7 @@ const Table = propsInit => {
|
|
|
2968
3023
|
if (fixedTable) str += " ".concat($prefixCls, "-table-fixed-table");
|
|
2969
3024
|
if (fixedColumn) str += " ".concat($prefixCls, "-table-fixed-cloumn");
|
|
2970
3025
|
if (dragColumn) str += " ".concat($prefixCls, "-table-drag-column");
|
|
3026
|
+
if (dragRow) str += " ".concat($prefixCls, "-table-drag-row");
|
|
2971
3027
|
if (check) str += " ".concat($prefixCls, "-table-check");
|
|
2972
3028
|
if (radio) str += " ".concat($prefixCls, "-table-radio");
|
|
2973
3029
|
if (expandable) str += " ".concat($prefixCls, "-table-expandable");
|