@para-ui/core 4.0.72 → 4.0.74
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/ComboSelect/index.js +3 -3
- package/DynamicMultiBox/index.js +4 -4
- package/Form/index.js +3 -3
- package/FormItem/index.js +3 -3
- package/README.md +12 -0
- package/SingleBox/index.js +2 -2
- package/Stepper/index.js +1 -1
- package/Table/index.js +432 -497
- package/Tabs/index.js +2 -2
- package/Upload/index.js +1 -1
- package/index.js +1 -1
- package/locale/index.js +1 -1
- package/package.json +1 -1
- package/umd/DynamicMultiBox.js +1 -1
- package/umd/Upload.js +1 -1
- package/umd/locale.js +1 -1
- /package/_verture/{index-d73a7bf3.js → index-10b7ed5d.js} +0 -0
package/Table/index.js
CHANGED
|
@@ -2,8 +2,6 @@ import { _ as __rest, a as __awaiter } from '../_verture/tslib.es6-55ed4bd2.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, UUID } from '@paraview/lib';
|
|
5
|
-
import { _ as _typeof } from '../_verture/typeof-adeedc13.js';
|
|
6
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-61604a6c.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,7 +14,6 @@ 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';
|
|
19
|
-
import { _ as _defineProperty } from '../_verture/defineProperty-6f62bb2a.js';
|
|
20
17
|
import { d as dist } from '../_verture/index-0f5ee6f7.js';
|
|
21
18
|
import { Radio } from '../Radio/index.js';
|
|
22
19
|
import OperateBtn from '../OperateBtn/index.js';
|
|
@@ -66,23 +63,25 @@ import '@para-ui/icons/DoubleRight';
|
|
|
66
63
|
* 发送请求
|
|
67
64
|
* @param obj {ReqProps} 请求信息
|
|
68
65
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
const requestFunc = obj => {
|
|
67
|
+
const {
|
|
68
|
+
method,
|
|
69
|
+
url,
|
|
70
|
+
ctx,
|
|
71
|
+
data
|
|
72
|
+
} = obj,
|
|
74
73
|
otherProps = __rest(obj, ["method", "url", "ctx", "data"]);
|
|
75
74
|
if (method === 'Get') {
|
|
76
75
|
return Get(Object.assign({
|
|
77
76
|
url: url,
|
|
78
|
-
ctx
|
|
77
|
+
ctx
|
|
79
78
|
}, otherProps));
|
|
80
79
|
}
|
|
81
80
|
if (method === 'Post') {
|
|
82
81
|
return Post(Object.assign({
|
|
83
82
|
url: url,
|
|
84
|
-
ctx
|
|
85
|
-
data
|
|
83
|
+
ctx,
|
|
84
|
+
data
|
|
86
85
|
}, otherProps));
|
|
87
86
|
}
|
|
88
87
|
};
|
|
@@ -91,23 +90,23 @@ var requestFunc = function requestFunc(obj) {
|
|
|
91
90
|
* @param obj {ReqProps} 请求信息
|
|
92
91
|
* @return string get请求地址参数
|
|
93
92
|
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
for (
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (
|
|
93
|
+
const handGetReqParams = obj => {
|
|
94
|
+
let str = obj.url;
|
|
95
|
+
const params = obj.data || {};
|
|
96
|
+
const arrKey = Object.keys(params);
|
|
97
|
+
const paramsArr = [];
|
|
98
|
+
for (let i = 0, l = arrKey.length; i < l; i++) {
|
|
99
|
+
const key = arrKey[i];
|
|
100
|
+
let val = params[key];
|
|
101
|
+
if (typeof val === 'object') {
|
|
103
102
|
val = encodeURIComponent(JSON.stringify(val));
|
|
104
103
|
} else {
|
|
105
104
|
val = encodeURIComponent(val);
|
|
106
105
|
}
|
|
107
106
|
paramsArr.push("".concat(key, "=").concat(val));
|
|
108
107
|
}
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
const paramsStr = paramsArr.join('&');
|
|
109
|
+
const pos = str.indexOf('?');
|
|
111
110
|
if (pos !== -1) {
|
|
112
111
|
str += (pos === str.length - 1 ? '' : '&') + paramsStr;
|
|
113
112
|
} else {
|
|
@@ -118,9 +117,9 @@ var handGetReqParams = function handGetReqParams(obj) {
|
|
|
118
117
|
/**
|
|
119
118
|
* 提取字符串里面的数字
|
|
120
119
|
* */
|
|
121
|
-
|
|
120
|
+
const getStringInNumber = str => {
|
|
122
121
|
if (typeof str === 'number') return str;
|
|
123
|
-
|
|
122
|
+
const strHand = str.replace(/[^0-9$]/gi, '');
|
|
124
123
|
return Number(strHand);
|
|
125
124
|
};
|
|
126
125
|
/**
|
|
@@ -128,23 +127,23 @@ var getStringInNumber = function getStringInNumber(str) {
|
|
|
128
127
|
* @param key {string} 键值
|
|
129
128
|
* @param num {number} 过期天数
|
|
130
129
|
* */
|
|
131
|
-
|
|
130
|
+
const getLocalStorageSelectHead = (key, num) => {
|
|
132
131
|
//debugger
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
for (
|
|
137
|
-
|
|
138
|
-
|
|
132
|
+
const headJsonStr = window.localStorage.getItem('_paraui_table_head') || '{}';
|
|
133
|
+
const headJson = JSON.parse(headJsonStr);
|
|
134
|
+
const headJsonArr = Object.keys(headJson);
|
|
135
|
+
for (let i = 0, l = headJsonArr.length; i < l; i++) {
|
|
136
|
+
const keyStr = headJsonArr[i];
|
|
137
|
+
const item = headJson[i];
|
|
139
138
|
if (!item) continue;
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
const newDate = new Date().getTime(); // 当前时间
|
|
140
|
+
const endTime = item.storageTime + item.validity; // 过期时间
|
|
142
141
|
// 过期时间 小于 当前时间, 说明已经过期了, 删除当前表格列数据
|
|
143
142
|
if (endTime < newDate) {
|
|
144
143
|
delete headJson[keyStr];
|
|
145
144
|
}
|
|
146
145
|
}
|
|
147
|
-
|
|
146
|
+
const headJsonItem = headJson[key];
|
|
148
147
|
// 重置过期时间
|
|
149
148
|
if (headJsonItem) {
|
|
150
149
|
headJsonItem.storageTime = new Date().getTime();
|
|
@@ -157,9 +156,9 @@ var getLocalStorageSelectHead = function getLocalStorageSelectHead(key, num) {
|
|
|
157
156
|
* @param key {string} 键值
|
|
158
157
|
* @param val {HeadLocalStorageItem} 保存值
|
|
159
158
|
* */
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
159
|
+
const setLocalStorageSelectHead = (key, val) => {
|
|
160
|
+
const headJsonStr = window.localStorage.getItem('_paraui_table_head') || '{}';
|
|
161
|
+
const headJson = JSON.parse(headJsonStr);
|
|
163
162
|
headJson[key] = val;
|
|
164
163
|
window.localStorage.setItem('_paraui_table_head', JSON.stringify(headJson));
|
|
165
164
|
};
|
|
@@ -168,8 +167,8 @@ var setLocalStorageSelectHead = function setLocalStorageSelectHead(key, val) {
|
|
|
168
167
|
* @param el 当前元素
|
|
169
168
|
* @param selector 查找元素class
|
|
170
169
|
*/
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
const closest = (el, selector) => {
|
|
171
|
+
const matchesSelector = el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector;
|
|
173
172
|
while (el) {
|
|
174
173
|
if (matchesSelector.call(el, selector)) {
|
|
175
174
|
break;
|
|
@@ -365,70 +364,50 @@ var zh = {
|
|
|
365
364
|
};
|
|
366
365
|
|
|
367
366
|
var localeJson = {
|
|
368
|
-
zh
|
|
369
|
-
en
|
|
367
|
+
zh,
|
|
368
|
+
en
|
|
370
369
|
};
|
|
371
370
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
headData =
|
|
375
|
-
sortTable
|
|
376
|
-
filter
|
|
377
|
-
expandable
|
|
378
|
-
check
|
|
379
|
-
radio
|
|
380
|
-
onRequestSort
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
checked = _useState4[0],
|
|
413
|
-
setChecked = _useState4[1]; // 选中
|
|
414
|
-
var _useState5 = useState(null),
|
|
415
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
416
|
-
anchorElColums = _useState6[0],
|
|
417
|
-
setAnchorElColums = _useState6[1]; // 显示列定位元素
|
|
418
|
-
var _useState7 = useState({}),
|
|
419
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
420
|
-
headDataJson = _useState8[0],
|
|
421
|
-
setHeadDataJson = _useState8[1]; // 显示列json
|
|
422
|
-
var _useState9 = useState({}),
|
|
423
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
424
|
-
filterHead = _useState10[0],
|
|
425
|
-
setFilterHead = _useState10[1]; // 过滤项当前表头数据
|
|
426
|
-
var _useState11 = useState({}),
|
|
427
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
428
|
-
selectFilterCom = _useState12[0],
|
|
429
|
-
setSelectFilterCom = _useState12[1]; // 过滤项当前选中值
|
|
430
|
-
var intl = useFormatMessage('Table', localeJson);
|
|
431
|
-
useEffect(function () {
|
|
371
|
+
const TableHead$1 = props => {
|
|
372
|
+
const {
|
|
373
|
+
headData = [],
|
|
374
|
+
sortTable,
|
|
375
|
+
filter,
|
|
376
|
+
expandable,
|
|
377
|
+
check,
|
|
378
|
+
radio,
|
|
379
|
+
onRequestSort,
|
|
380
|
+
orderFieldArr = [],
|
|
381
|
+
orderTypeArr = [],
|
|
382
|
+
selectAll,
|
|
383
|
+
selectStatus,
|
|
384
|
+
align,
|
|
385
|
+
showList = [],
|
|
386
|
+
changeShowList,
|
|
387
|
+
selectFilter,
|
|
388
|
+
changeFilter,
|
|
389
|
+
operate,
|
|
390
|
+
showColumns,
|
|
391
|
+
fixedTable,
|
|
392
|
+
fixedColumn,
|
|
393
|
+
posFixed,
|
|
394
|
+
beyondText,
|
|
395
|
+
lineWidth,
|
|
396
|
+
dragColumn,
|
|
397
|
+
dragRow,
|
|
398
|
+
changeColumnWidth,
|
|
399
|
+
headDataConfig,
|
|
400
|
+
getPopupContainer,
|
|
401
|
+
tipMaxWidth
|
|
402
|
+
} = props;
|
|
403
|
+
const [indeterminate, setIndeterminate] = useState(false); // 半选中
|
|
404
|
+
const [checked, setChecked] = useState(false); // 选中
|
|
405
|
+
const [anchorElColums, setAnchorElColums] = useState(null); // 显示列定位元素
|
|
406
|
+
const [headDataJson, setHeadDataJson] = useState({}); // 显示列json
|
|
407
|
+
const [filterHead, setFilterHead] = useState({}); // 过滤项当前表头数据
|
|
408
|
+
const [selectFilterCom, setSelectFilterCom] = useState({}); // 过滤项当前选中值
|
|
409
|
+
const intl = useFormatMessage('Table', localeJson);
|
|
410
|
+
useEffect(() => {
|
|
432
411
|
// 全选
|
|
433
412
|
if (selectStatus === 'all') {
|
|
434
413
|
setChecked(true);
|
|
@@ -445,17 +424,17 @@ var TableHead$1 = function TableHead(props) {
|
|
|
445
424
|
setIndeterminate(false);
|
|
446
425
|
}
|
|
447
426
|
}, [selectStatus]);
|
|
448
|
-
useEffect(
|
|
427
|
+
useEffect(() => {
|
|
449
428
|
if (headData) {
|
|
450
|
-
|
|
451
|
-
for (
|
|
452
|
-
|
|
429
|
+
const json = [];
|
|
430
|
+
for (let i = 0, l = headData.length; i < l; i++) {
|
|
431
|
+
const item = headData[i];
|
|
453
432
|
json[item.name] = item;
|
|
454
433
|
}
|
|
455
434
|
setHeadDataJson(json);
|
|
456
435
|
}
|
|
457
436
|
}, [headData]);
|
|
458
|
-
useEffect(
|
|
437
|
+
useEffect(() => {
|
|
459
438
|
if (selectFilter) setSelectFilterCom(DeepClone(selectFilter));
|
|
460
439
|
}, [selectFilter]);
|
|
461
440
|
/**
|
|
@@ -463,30 +442,28 @@ var TableHead$1 = function TableHead(props) {
|
|
|
463
442
|
* @param name 排序列
|
|
464
443
|
* @param event 当前排序元素
|
|
465
444
|
*/
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
if (onRequestSort) onRequestSort(event, name);
|
|
471
|
-
};
|
|
445
|
+
const createSortHandler = (name, item) => event => {
|
|
446
|
+
// 不存在排序,不触发事件
|
|
447
|
+
if (!(sortTable && item.name && item.sort !== false)) return;
|
|
448
|
+
if (onRequestSort) onRequestSort(event, name);
|
|
472
449
|
};
|
|
473
450
|
/**
|
|
474
451
|
* 全选 / 全不选
|
|
475
452
|
* @param event 操作元素
|
|
476
453
|
* @param bol 选中 / 不选中
|
|
477
454
|
*/
|
|
478
|
-
|
|
455
|
+
const onSelectAll = (event, bol) => {
|
|
479
456
|
if (selectAll) selectAll(event, bol);
|
|
480
457
|
};
|
|
481
458
|
/**
|
|
482
459
|
* 点击显示选择列
|
|
483
460
|
* @param event 点击元素
|
|
484
461
|
*/
|
|
485
|
-
|
|
462
|
+
const clickShowColums = event => {
|
|
486
463
|
setAnchorElColums(event.currentTarget);
|
|
487
464
|
};
|
|
488
465
|
// 点击隐藏选择列
|
|
489
|
-
|
|
466
|
+
const clickHideColums = bol => {
|
|
490
467
|
if (bol) return;
|
|
491
468
|
setAnchorElColums(null);
|
|
492
469
|
};
|
|
@@ -494,29 +471,27 @@ var TableHead$1 = function TableHead(props) {
|
|
|
494
471
|
* 点击显示列 列表
|
|
495
472
|
* @param item 详细
|
|
496
473
|
*/
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
arr1.push(headDataJson[_name]);
|
|
510
|
-
}
|
|
511
|
-
changeShowList && changeShowList(arr1, false, item);
|
|
512
|
-
} else {
|
|
513
|
-
headData.push(item);
|
|
514
|
-
changeShowList && changeShowList(headData, false, item);
|
|
474
|
+
const clickColumsList = item => () => {
|
|
475
|
+
if (item.disabledSelection) return;
|
|
476
|
+
const name = item.name;
|
|
477
|
+
const itemHead = headDataJson[name];
|
|
478
|
+
if (itemHead) {
|
|
479
|
+
// 取消勾选
|
|
480
|
+
delete headDataJson[name];
|
|
481
|
+
const arr = Object.keys(headDataJson);
|
|
482
|
+
const arr1 = [];
|
|
483
|
+
for (let i = 0, l = arr.length; i < l; i++) {
|
|
484
|
+
const name = arr[i];
|
|
485
|
+
arr1.push(headDataJson[name]);
|
|
515
486
|
}
|
|
516
|
-
|
|
487
|
+
changeShowList && changeShowList(arr1, false, item);
|
|
488
|
+
} else {
|
|
489
|
+
headData.push(item);
|
|
490
|
+
changeShowList && changeShowList(headData, false, item);
|
|
491
|
+
}
|
|
517
492
|
};
|
|
518
493
|
// 重置显示列
|
|
519
|
-
|
|
494
|
+
const resetShowList = () => {
|
|
520
495
|
changeShowList && changeShowList(headData, true);
|
|
521
496
|
};
|
|
522
497
|
/**
|
|
@@ -524,69 +499,63 @@ var TableHead$1 = function TableHead(props) {
|
|
|
524
499
|
* @param headCell 当前列信息
|
|
525
500
|
* @param event 元素
|
|
526
501
|
*/
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
setSelectFilterCom(Object.assign({}, selectFilter));
|
|
531
|
-
};
|
|
502
|
+
const clickShowFilter = headCell => event => {
|
|
503
|
+
setFilterHead(headCell);
|
|
504
|
+
setSelectFilterCom(Object.assign({}, selectFilter));
|
|
532
505
|
};
|
|
533
506
|
// 点击隐藏过滤
|
|
534
|
-
|
|
507
|
+
const clickHideFilter = bol => {
|
|
535
508
|
if (bol) return;
|
|
536
509
|
setFilterHead({});
|
|
537
510
|
setSelectFilterCom(Object.assign({}, selectFilter));
|
|
538
511
|
};
|
|
539
512
|
// 点击过滤
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
filterValue = [filterValue[num]];
|
|
558
|
-
}
|
|
513
|
+
const clickFilter = item => () => {
|
|
514
|
+
const name = filterHead.name;
|
|
515
|
+
let filterValue = DeepClone(selectFilterCom[name] || []);
|
|
516
|
+
const index = filterValue.indexOf(item.value);
|
|
517
|
+
if (index !== -1) {
|
|
518
|
+
// 勾选 -> 不勾选
|
|
519
|
+
filterValue.splice(index, 1);
|
|
520
|
+
} else {
|
|
521
|
+
// 不勾选 -> 勾选
|
|
522
|
+
filterValue.push(item.value);
|
|
523
|
+
}
|
|
524
|
+
const filterRadio = filterHead.filterRadio;
|
|
525
|
+
if (filterRadio) {
|
|
526
|
+
// 过滤单个
|
|
527
|
+
const num = filterValue.indexOf(item.value);
|
|
528
|
+
if (num !== -1) {
|
|
529
|
+
filterValue = [filterValue[num]];
|
|
559
530
|
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
};
|
|
531
|
+
}
|
|
532
|
+
selectFilterCom[name] = filterValue;
|
|
533
|
+
setSelectFilterCom(Object.assign({}, selectFilterCom));
|
|
563
534
|
};
|
|
564
535
|
/**
|
|
565
536
|
* 重置 / 确定过滤
|
|
566
537
|
* @param type {'reset' | 'confirm'} 重置 / 确定过滤
|
|
567
538
|
*/
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
}
|
|
582
|
-
};
|
|
539
|
+
const filterFunc = type => () => {
|
|
540
|
+
if (type === 'confirm') {
|
|
541
|
+
// 确定
|
|
542
|
+
changeFilter && changeFilter(Object.assign({}, selectFilterCom));
|
|
543
|
+
setFilterHead({});
|
|
544
|
+
} else {
|
|
545
|
+
// 重置
|
|
546
|
+
const json = DeepClone(selectFilterCom);
|
|
547
|
+
delete json[filterHead.name];
|
|
548
|
+
setSelectFilterCom(json);
|
|
549
|
+
changeFilter && changeFilter(Object.assign({}, json));
|
|
550
|
+
setFilterHead({});
|
|
551
|
+
}
|
|
583
552
|
};
|
|
584
553
|
/**
|
|
585
554
|
* 自定义过滤确定
|
|
586
555
|
* @param val {[name: string]: any[]}
|
|
587
556
|
* */
|
|
588
|
-
|
|
589
|
-
|
|
557
|
+
const filterCustomConfirm = function () {
|
|
558
|
+
let val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
590
559
|
changeFilter && changeFilter(Object.assign({}, val));
|
|
591
560
|
setFilterHead({});
|
|
592
561
|
};
|
|
@@ -594,12 +563,12 @@ var TableHead$1 = function TableHead(props) {
|
|
|
594
563
|
* 处理TableCell
|
|
595
564
|
* @param item 当前列信息
|
|
596
565
|
*/
|
|
597
|
-
|
|
598
|
-
|
|
566
|
+
const handCellClass = item => {
|
|
567
|
+
let str = 'table-header-box';
|
|
599
568
|
// 排序
|
|
600
569
|
if (sortTable && item.name && item.sort !== false) {
|
|
601
570
|
str += ' table-header-box-sort';
|
|
602
|
-
|
|
571
|
+
const index = orderFieldArr.indexOf(item.name);
|
|
603
572
|
if (index !== -1) {
|
|
604
573
|
// 升序
|
|
605
574
|
if (orderTypeArr[index] === 'asc') {
|
|
@@ -618,10 +587,10 @@ var TableHead$1 = function TableHead(props) {
|
|
|
618
587
|
return str;
|
|
619
588
|
};
|
|
620
589
|
// 复选框memo
|
|
621
|
-
|
|
590
|
+
const TableCheckMemo = useMemo(() => {
|
|
622
591
|
if (check) {
|
|
623
|
-
|
|
624
|
-
|
|
592
|
+
const handCls = () => {
|
|
593
|
+
let str = 'table-checkbox table-head-btn';
|
|
625
594
|
if (fixedColumn) {
|
|
626
595
|
str += ' table-fixed-dom-left';
|
|
627
596
|
// 左边没有定位,且没有单选,没有嵌套表格
|
|
@@ -649,10 +618,10 @@ var TableHead$1 = function TableHead(props) {
|
|
|
649
618
|
}
|
|
650
619
|
}, [check, indeterminate, checked, selectAll, posFixed, radio, expandable, fixedColumn]);
|
|
651
620
|
// 单选框memo
|
|
652
|
-
|
|
621
|
+
const TableRadioMemo = useMemo(() => {
|
|
653
622
|
if (radio) {
|
|
654
|
-
|
|
655
|
-
|
|
623
|
+
const handCls = () => {
|
|
624
|
+
let str = 'table-radio table-head-btn';
|
|
656
625
|
if (fixedColumn) {
|
|
657
626
|
str += ' table-fixed-dom-left';
|
|
658
627
|
// 左边没有定位,没有嵌套表格
|
|
@@ -674,10 +643,10 @@ var TableHead$1 = function TableHead(props) {
|
|
|
674
643
|
}
|
|
675
644
|
}, [radio, posFixed, expandable, fixedColumn]);
|
|
676
645
|
// 嵌套表格memo
|
|
677
|
-
|
|
646
|
+
const TableExpandableMemo = useMemo(() => {
|
|
678
647
|
if (expandable) {
|
|
679
|
-
|
|
680
|
-
|
|
648
|
+
const handCls = () => {
|
|
649
|
+
let str = 'table-expandable table-head-btn';
|
|
681
650
|
if (fixedColumn) {
|
|
682
651
|
str += ' table-fixed-dom-left';
|
|
683
652
|
// 左边没有定位,没有嵌套表格
|
|
@@ -699,21 +668,21 @@ var TableHead$1 = function TableHead(props) {
|
|
|
699
668
|
}
|
|
700
669
|
}, [expandable, posFixed, fixedColumn]);
|
|
701
670
|
// 过滤弹窗内容
|
|
702
|
-
|
|
703
|
-
|
|
671
|
+
const filterPopoverContent = () => {
|
|
672
|
+
const name = filterHead.name;
|
|
704
673
|
if (!name) return;
|
|
705
|
-
|
|
674
|
+
const filterValue = selectFilterCom[name] || [];
|
|
706
675
|
if (filterHead.filterRender) {
|
|
707
676
|
// 自定义渲染过滤
|
|
708
677
|
return filterHead.filterRender({
|
|
709
|
-
filterValue
|
|
678
|
+
filterValue,
|
|
710
679
|
selectFilter: selectFilterCom,
|
|
711
|
-
filterHead
|
|
680
|
+
filterHead,
|
|
712
681
|
setFilter: filterCustomConfirm
|
|
713
682
|
});
|
|
714
683
|
}
|
|
715
|
-
|
|
716
|
-
|
|
684
|
+
const arr = filterHead.enums || [];
|
|
685
|
+
let str = 'filter-select';
|
|
717
686
|
if (arr.length === 0) str += ' filter-select-none';
|
|
718
687
|
return jsx("div", Object.assign({
|
|
719
688
|
className: str
|
|
@@ -728,8 +697,8 @@ var TableHead$1 = function TableHead(props) {
|
|
|
728
697
|
children: [jsx("div", Object.assign({
|
|
729
698
|
className: "filter-select-box"
|
|
730
699
|
}, {
|
|
731
|
-
children: arr.map(
|
|
732
|
-
|
|
700
|
+
children: arr.map((item, index) => {
|
|
701
|
+
const checked = filterValue.indexOf(item.value) !== -1;
|
|
733
702
|
return jsxs("div", Object.assign({
|
|
734
703
|
onClick: clickFilter(item),
|
|
735
704
|
className: checked ? 'filter-select-item filter-select-item-select' : 'filter-select-item'
|
|
@@ -768,30 +737,28 @@ var TableHead$1 = function TableHead(props) {
|
|
|
768
737
|
}));
|
|
769
738
|
};
|
|
770
739
|
// 表格列拖拽放下
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
changeColumnWidth && changeColumnWidth(headCell, result);
|
|
774
|
-
};
|
|
740
|
+
const onDragDown = headCell => result => {
|
|
741
|
+
changeColumnWidth && changeColumnWidth(headCell, result);
|
|
775
742
|
};
|
|
776
743
|
// 获取宽度
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
744
|
+
const getWidth = item => {
|
|
745
|
+
let w = item.width || '';
|
|
746
|
+
const name = item.name || '';
|
|
747
|
+
const wDrag = headDataConfig[name] && headDataConfig[name].width;
|
|
781
748
|
if (wDrag) w = "".concat(wDrag, "px");
|
|
782
749
|
return w;
|
|
783
750
|
};
|
|
784
751
|
// 内容列memo
|
|
785
|
-
|
|
752
|
+
const TableContentMemo = useMemo(() => {
|
|
786
753
|
// 处理过滤的class
|
|
787
|
-
|
|
788
|
-
|
|
754
|
+
const handFilterClass = item => {
|
|
755
|
+
let str = 'table-header-filter';
|
|
789
756
|
if (filterHead.name === item.name) str += ' table-header-filter-show';
|
|
790
757
|
if (item.name && selectFilterCom[item.name] && selectFilterCom[item.name].length > 0) str += ' table-header-filter-select';
|
|
791
758
|
return str;
|
|
792
759
|
};
|
|
793
|
-
|
|
794
|
-
|
|
760
|
+
const handCls = item => {
|
|
761
|
+
let str = '';
|
|
795
762
|
if (item.className) str += item.className;
|
|
796
763
|
if (fixedColumn && item.fixed) {
|
|
797
764
|
str += " table-fixed-dom-".concat(item.fixed);
|
|
@@ -806,8 +773,8 @@ var TableHead$1 = function TableHead(props) {
|
|
|
806
773
|
}
|
|
807
774
|
return str;
|
|
808
775
|
};
|
|
809
|
-
|
|
810
|
-
|
|
776
|
+
const handStyle = item => {
|
|
777
|
+
const json = {
|
|
811
778
|
width: getWidth(item)
|
|
812
779
|
};
|
|
813
780
|
if (fixedColumn && item.fixed && item.width) {
|
|
@@ -821,13 +788,13 @@ var TableHead$1 = function TableHead(props) {
|
|
|
821
788
|
return Object.assign(Object.assign({}, json), item.style);
|
|
822
789
|
};
|
|
823
790
|
// 处理拖拽
|
|
824
|
-
|
|
791
|
+
const handDrag = item => {
|
|
825
792
|
if (item.name === 'table-serial-number') return false; // 序号不拖拽
|
|
826
793
|
if (dragColumn && item.drag !== false) return true;
|
|
827
794
|
return false;
|
|
828
795
|
};
|
|
829
|
-
return headData.map(
|
|
830
|
-
|
|
796
|
+
return headData.map((headCell, index) => {
|
|
797
|
+
let str = "".concat($prefixCls, "-filter-popover ").concat($prefixCls, "-scrollbar-small");
|
|
831
798
|
if (!headCell.filterRender) str += " ".concat($prefixCls, "-filter-popover-default");
|
|
832
799
|
return jsx(ThElement, Object.assign({
|
|
833
800
|
className: handCls(headCell),
|
|
@@ -847,9 +814,7 @@ var TableHead$1 = function TableHead(props) {
|
|
|
847
814
|
content: headCell.name !== undefined && filterHead.name === headCell.name && filterPopoverContent(),
|
|
848
815
|
onVisibleChange: clickHideFilter,
|
|
849
816
|
overlayClassName: str,
|
|
850
|
-
getPopupContainer: getPopupContainer ? getPopupContainer :
|
|
851
|
-
return document.body;
|
|
852
|
-
},
|
|
817
|
+
getPopupContainer: getPopupContainer ? getPopupContainer : () => document.body,
|
|
853
818
|
maxWidth: headCell.filterMaxWidth
|
|
854
819
|
}, {
|
|
855
820
|
children: jsxs("div", Object.assign({
|
|
@@ -894,10 +859,10 @@ var TableHead$1 = function TableHead(props) {
|
|
|
894
859
|
});
|
|
895
860
|
}, [headData, sortTable, filter, orderFieldArr, orderTypeArr, align, filterHead, selectFilterCom, beyondText, selectFilter, fixedColumn, lineWidth, dragColumn, changeColumnWidth, headDataConfig, getPopupContainer, tipMaxWidth]);
|
|
896
861
|
// 操作栏memo
|
|
897
|
-
|
|
862
|
+
const TableOperateMemo = useMemo(() => {
|
|
898
863
|
if (operate) {
|
|
899
|
-
|
|
900
|
-
|
|
864
|
+
const handCls = () => {
|
|
865
|
+
let str = 'table-operate';
|
|
901
866
|
if (operate.operateBtnRender) str += ' table-operate-small';
|
|
902
867
|
if (showColumns === false) str += ' table-operate-not-columns';
|
|
903
868
|
if (dragRow) str += ' table-operate-drag-row';
|
|
@@ -910,8 +875,8 @@ var TableHead$1 = function TableHead(props) {
|
|
|
910
875
|
}
|
|
911
876
|
return str;
|
|
912
877
|
};
|
|
913
|
-
|
|
914
|
-
|
|
878
|
+
const handStyle = () => {
|
|
879
|
+
const json = {
|
|
915
880
|
width: operate.width
|
|
916
881
|
};
|
|
917
882
|
if (fixedColumn) {
|
|
@@ -947,16 +912,16 @@ var TableHead$1 = function TableHead(props) {
|
|
|
947
912
|
}
|
|
948
913
|
}, [operate, align, posFixed, showColumns, posFixed, beyondText, fixedColumn, tipMaxWidth, dragRow]);
|
|
949
914
|
// 显示列弹窗内容
|
|
950
|
-
|
|
915
|
+
const showListContent = () => {
|
|
951
916
|
return jsxs("div", Object.assign({
|
|
952
917
|
className: "show-colums-select"
|
|
953
918
|
}, {
|
|
954
919
|
children: [jsx("div", Object.assign({
|
|
955
920
|
className: "show-colums-select-box"
|
|
956
921
|
}, {
|
|
957
|
-
children: showList.map(
|
|
958
|
-
|
|
959
|
-
|
|
922
|
+
children: showList.map((item, index) => {
|
|
923
|
+
const checked = Boolean(headDataJson[item.name]);
|
|
924
|
+
let str = 'show-colums-select-item';
|
|
960
925
|
if (checked) str += ' show-colums-select-item-select';
|
|
961
926
|
if (item.disabledSelection) str += ' show-colums-select-item-disabled';
|
|
962
927
|
return jsxs("div", Object.assign({
|
|
@@ -990,9 +955,9 @@ var TableHead$1 = function TableHead(props) {
|
|
|
990
955
|
}));
|
|
991
956
|
};
|
|
992
957
|
// 显示列memo
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
958
|
+
const TableShowList = useMemo(() => {
|
|
959
|
+
const handCls = () => {
|
|
960
|
+
let str = 'show-colums table-fixed-dom-right';
|
|
996
961
|
// 没有固定列参数 或者 没有操作栏且没有右侧固定列
|
|
997
962
|
if (!fixedColumn || !operate && !(posFixed === null || posFixed === void 0 ? void 0 : posFixed.rightBol)) {
|
|
998
963
|
str += ' table-fixed-dom-right-first';
|
|
@@ -1005,9 +970,7 @@ var TableHead$1 = function TableHead(props) {
|
|
|
1005
970
|
content: showListContent(),
|
|
1006
971
|
onVisibleChange: clickHideColums,
|
|
1007
972
|
overlayClassName: "".concat($prefixCls, "-table-show-colums-popover ").concat($prefixCls, "-scrollbar-small"),
|
|
1008
|
-
getPopupContainer: getPopupContainer ? getPopupContainer :
|
|
1009
|
-
return document.body;
|
|
1010
|
-
}
|
|
973
|
+
getPopupContainer: getPopupContainer ? getPopupContainer : () => document.body
|
|
1011
974
|
}, {
|
|
1012
975
|
children: jsx(ThElement, Object.assign({
|
|
1013
976
|
align: "center",
|
|
@@ -1024,10 +987,10 @@ var TableHead$1 = function TableHead(props) {
|
|
|
1024
987
|
}));
|
|
1025
988
|
}, [showColumns, posFixed, operate, anchorElColums, showList, headDataJson, getPopupContainer, tipMaxWidth]);
|
|
1026
989
|
// 拖动行
|
|
1027
|
-
|
|
990
|
+
const TbaleDragRow = useMemo(() => {
|
|
1028
991
|
if (!dragRow || operate || showColumns === 'inside') return null;
|
|
1029
|
-
|
|
1030
|
-
|
|
992
|
+
const handCls = () => {
|
|
993
|
+
let str = 'drag-row table-fixed-dom-right';
|
|
1031
994
|
// 没有固定列参数 或者 没有操作栏且没有右侧固定列
|
|
1032
995
|
if (!fixedColumn || !operate && !(posFixed === null || posFixed === void 0 ? void 0 : posFixed.rightBol)) {
|
|
1033
996
|
str += ' table-fixed-dom-right-first';
|
|
@@ -1041,8 +1004,8 @@ var TableHead$1 = function TableHead(props) {
|
|
|
1041
1004
|
});
|
|
1042
1005
|
}, [operate, showColumns, fixedColumn, posFixed, dragRow]);
|
|
1043
1006
|
// 处理class
|
|
1044
|
-
|
|
1045
|
-
|
|
1007
|
+
const handClass = () => {
|
|
1008
|
+
let str = 'table-head';
|
|
1046
1009
|
if (showColumns === 'inside') str += ' table-head-inside';
|
|
1047
1010
|
if (!fixedTable) str += ' table-head-scroll'; // 防止长度过长
|
|
1048
1011
|
// 没有 复选框,单选框,展开 按钮
|
|
@@ -1120,100 +1083,76 @@ var TdElement = function TdElement(props) {
|
|
|
1120
1083
|
}));
|
|
1121
1084
|
};
|
|
1122
1085
|
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
rowData =
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
onDragRow = props.onDragRow,
|
|
1182
|
-
virtualIndex = props.virtualIndex,
|
|
1183
|
-
virtual = props.virtual;
|
|
1184
|
-
var _useState = useState(0),
|
|
1185
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1186
|
-
expandableColSpan = _useState2[0],
|
|
1187
|
-
setExpandableColSpan = _useState2[1]; // 嵌套表格合并列数
|
|
1188
|
-
var _useState3 = useState({}),
|
|
1189
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
1190
|
-
expandableRow = _useState4[0],
|
|
1191
|
-
setExpandableRow = _useState4[1]; // 当前哪行展开表格嵌套
|
|
1192
|
-
var _useState5 = useState(true),
|
|
1193
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
1194
|
-
showMoreBtn = _useState6[0],
|
|
1195
|
-
setShowMoreBtn = _useState6[1]; // 加载更多
|
|
1196
|
-
var _useState7 = useState({}),
|
|
1197
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
1198
|
-
disabledExpandJson = _useState8[0],
|
|
1199
|
-
setDisabledExpand = _useState8[1]; // 禁用加减部分嵌套
|
|
1200
|
-
var _useState9 = useState(false),
|
|
1201
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
1202
|
-
dragBol = _useState10[0],
|
|
1203
|
-
setDragBol = _useState10[1];
|
|
1204
|
-
var intl = useFormatMessage('Table', localeJson);
|
|
1086
|
+
const TableBody = props => {
|
|
1087
|
+
const {
|
|
1088
|
+
url,
|
|
1089
|
+
emptyProps,
|
|
1090
|
+
rowData = [],
|
|
1091
|
+
rowKey = 'key',
|
|
1092
|
+
check,
|
|
1093
|
+
radio,
|
|
1094
|
+
tableCell,
|
|
1095
|
+
expandable,
|
|
1096
|
+
headData = [],
|
|
1097
|
+
disabledJson = {},
|
|
1098
|
+
disabledArrStatus,
|
|
1099
|
+
checkJson = {},
|
|
1100
|
+
radioValue,
|
|
1101
|
+
selectCheck,
|
|
1102
|
+
selectRadio,
|
|
1103
|
+
align,
|
|
1104
|
+
operate,
|
|
1105
|
+
showColumns,
|
|
1106
|
+
fixedTable,
|
|
1107
|
+
fixedColumn,
|
|
1108
|
+
formatter,
|
|
1109
|
+
orderFieldArr = [],
|
|
1110
|
+
orderTypeArr = [],
|
|
1111
|
+
sortTable,
|
|
1112
|
+
loadState,
|
|
1113
|
+
loadMore,
|
|
1114
|
+
loadMoreRender,
|
|
1115
|
+
onClickMore,
|
|
1116
|
+
total,
|
|
1117
|
+
page,
|
|
1118
|
+
currentRowsPerPage,
|
|
1119
|
+
changePage,
|
|
1120
|
+
loadMoreUrl,
|
|
1121
|
+
expandMultiple = false,
|
|
1122
|
+
expandValue = [],
|
|
1123
|
+
disabledExpand = [],
|
|
1124
|
+
defaultExpandAllRows = false,
|
|
1125
|
+
onExpand,
|
|
1126
|
+
onRefresh,
|
|
1127
|
+
posFixed,
|
|
1128
|
+
beyondText,
|
|
1129
|
+
onClickRow,
|
|
1130
|
+
rowClassMapping,
|
|
1131
|
+
tipMaxWidth,
|
|
1132
|
+
lineHeight,
|
|
1133
|
+
dragRow,
|
|
1134
|
+
onDragRow,
|
|
1135
|
+
virtualIndex,
|
|
1136
|
+
virtual
|
|
1137
|
+
} = props;
|
|
1138
|
+
const [expandableColSpan, setExpandableColSpan] = useState(0); // 嵌套表格合并列数
|
|
1139
|
+
const [expandableRow, setExpandableRow] = useState({}); // 当前哪行展开表格嵌套
|
|
1140
|
+
const [showMoreBtn, setShowMoreBtn] = useState(true); // 加载更多
|
|
1141
|
+
const [disabledExpandJson, setDisabledExpand] = useState({}); // 禁用加减部分嵌套
|
|
1142
|
+
const [dragBol, setDragBol] = useState(false);
|
|
1143
|
+
const intl = useFormatMessage('Table', localeJson);
|
|
1205
1144
|
// 默认是否展开所有
|
|
1206
|
-
useEffect(
|
|
1145
|
+
useEffect(() => {
|
|
1207
1146
|
if (!defaultExpandAllRows) {
|
|
1208
1147
|
setExpandableRow({});
|
|
1209
1148
|
return;
|
|
1210
1149
|
}
|
|
1211
|
-
|
|
1212
|
-
for (
|
|
1213
|
-
|
|
1214
|
-
|
|
1150
|
+
const json = {};
|
|
1151
|
+
for (let i = 0, l = rowData.length; i < l; i++) {
|
|
1152
|
+
const item = rowData[i] || {};
|
|
1153
|
+
const id = item[rowKey];
|
|
1215
1154
|
json[id] = {
|
|
1216
|
-
id
|
|
1155
|
+
id,
|
|
1217
1156
|
status: 'develop'
|
|
1218
1157
|
};
|
|
1219
1158
|
}
|
|
@@ -1221,41 +1160,41 @@ var TableBody = function TableBody(props) {
|
|
|
1221
1160
|
}, [defaultExpandAllRows, rowData, rowKey]);
|
|
1222
1161
|
// 监听展开表格
|
|
1223
1162
|
// 如果直接写expandMultiple, expandValue会死循环
|
|
1224
|
-
useEffect(
|
|
1163
|
+
useEffect(() => {
|
|
1225
1164
|
if (props.expandValue === undefined) return;
|
|
1226
|
-
|
|
1227
|
-
|
|
1165
|
+
const json = {};
|
|
1166
|
+
let expandValueHand = expandValue;
|
|
1228
1167
|
// 只展开一个,去第一个值
|
|
1229
1168
|
if (!expandMultiple && expandValue.length > 0) {
|
|
1230
1169
|
expandValueHand = [expandValue[0]];
|
|
1231
1170
|
}
|
|
1232
|
-
for (
|
|
1233
|
-
|
|
1171
|
+
for (let i = 0, l = expandValueHand.length; i < l; i++) {
|
|
1172
|
+
const id = expandValueHand[i];
|
|
1234
1173
|
json[id] = {
|
|
1235
|
-
id
|
|
1174
|
+
id,
|
|
1236
1175
|
status: 'develop'
|
|
1237
1176
|
};
|
|
1238
1177
|
}
|
|
1239
1178
|
setExpandableRow(json);
|
|
1240
1179
|
}, [props.expandMultiple, props.expandValue, rowData]);
|
|
1241
1180
|
// 监听禁用嵌套 props.disabledExpand 防止死循环
|
|
1242
|
-
useEffect(
|
|
1243
|
-
|
|
1244
|
-
for (
|
|
1245
|
-
|
|
1181
|
+
useEffect(() => {
|
|
1182
|
+
const json = {};
|
|
1183
|
+
for (let i = 0, l = disabledExpand.length; i < l; i++) {
|
|
1184
|
+
const id = disabledExpand[i];
|
|
1246
1185
|
json[id] = true;
|
|
1247
1186
|
}
|
|
1248
1187
|
setDisabledExpand(json);
|
|
1249
1188
|
}, [props.disabledExpand]);
|
|
1250
|
-
useEffect(
|
|
1189
|
+
useEffect(() => {
|
|
1251
1190
|
if (loadMoreUrl) {
|
|
1252
|
-
|
|
1191
|
+
const bol = Number(total) > Number(page) * Number(currentRowsPerPage);
|
|
1253
1192
|
setShowMoreBtn(bol);
|
|
1254
1193
|
}
|
|
1255
1194
|
}, [loadMoreUrl, total, page, currentRowsPerPage]);
|
|
1256
1195
|
// 处理嵌套表格合并列数
|
|
1257
|
-
useEffect(
|
|
1258
|
-
|
|
1196
|
+
useEffect(() => {
|
|
1197
|
+
let num = headData.length;
|
|
1259
1198
|
if (expandable) num += 1;
|
|
1260
1199
|
if (check) num += 1;
|
|
1261
1200
|
if (radio) num += 1;
|
|
@@ -1264,55 +1203,55 @@ var TableBody = function TableBody(props) {
|
|
|
1264
1203
|
setExpandableColSpan(num);
|
|
1265
1204
|
}, [headData, expandable, check, radio]);
|
|
1266
1205
|
// 展开/收起嵌套表格
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
status: status
|
|
1276
|
-
};
|
|
1277
|
-
if (expandMultiple) {
|
|
1278
|
-
// 展开多个
|
|
1279
|
-
expandableRow[id] = expandItem;
|
|
1280
|
-
setExpandableRow(Object.assign({}, expandableRow));
|
|
1281
|
-
} else {
|
|
1282
|
-
// 展开一个
|
|
1283
|
-
setExpandableRow(_defineProperty({}, id, expandItem));
|
|
1284
|
-
}
|
|
1285
|
-
onExpand && onExpand(row, status);
|
|
1286
|
-
event.stopPropagation();
|
|
1206
|
+
const handClickNestTable = row => event => {
|
|
1207
|
+
const id = row[rowKey];
|
|
1208
|
+
let expandItem = expandableRow[id] || {};
|
|
1209
|
+
let status = 'develop';
|
|
1210
|
+
if (expandItem.status === 'develop') status = 'retract';
|
|
1211
|
+
expandItem = {
|
|
1212
|
+
id,
|
|
1213
|
+
status
|
|
1287
1214
|
};
|
|
1215
|
+
if (expandMultiple) {
|
|
1216
|
+
// 展开多个
|
|
1217
|
+
expandableRow[id] = expandItem;
|
|
1218
|
+
setExpandableRow(Object.assign({}, expandableRow));
|
|
1219
|
+
} else {
|
|
1220
|
+
// 展开一个
|
|
1221
|
+
setExpandableRow({
|
|
1222
|
+
[id]: expandItem
|
|
1223
|
+
});
|
|
1224
|
+
}
|
|
1225
|
+
onExpand && onExpand(row, status);
|
|
1226
|
+
event.stopPropagation();
|
|
1288
1227
|
};
|
|
1289
1228
|
// 处理class
|
|
1290
|
-
|
|
1291
|
-
|
|
1229
|
+
const handClass = () => {
|
|
1230
|
+
let str = 'table-body';
|
|
1292
1231
|
if (!fixedTable) str += ' table-body-scroll';
|
|
1293
1232
|
// 没有 复选框,单选框,展开 按钮
|
|
1294
1233
|
if (!check && !radio && !expandable) str += ' table-body-no-btn';
|
|
1295
1234
|
return str;
|
|
1296
1235
|
};
|
|
1297
1236
|
// 处理嵌套表格class
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1237
|
+
const handExpandClass = row => {
|
|
1238
|
+
const id = row[rowKey];
|
|
1239
|
+
const expandItem = expandableRow[id] || {};
|
|
1240
|
+
let str = 'retract';
|
|
1302
1241
|
if (expandItem.status === 'develop') {
|
|
1303
1242
|
str = 'expand';
|
|
1304
1243
|
}
|
|
1305
1244
|
return str;
|
|
1306
1245
|
};
|
|
1307
1246
|
// 点击加载更多
|
|
1308
|
-
|
|
1247
|
+
const clickMore = () => {
|
|
1309
1248
|
if (loadMoreUrl) changePage && changePage();
|
|
1310
1249
|
onClickMore && onClickMore();
|
|
1311
1250
|
};
|
|
1312
1251
|
// 暂无数据memo
|
|
1313
|
-
|
|
1252
|
+
const NodataMemo = useMemo(() => {
|
|
1314
1253
|
// 处理刷新按钮
|
|
1315
|
-
|
|
1254
|
+
const handRefreshBtn = () => {
|
|
1316
1255
|
if ((emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.showRefresh) !== undefined) {
|
|
1317
1256
|
return emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.showRefresh;
|
|
1318
1257
|
}
|
|
@@ -1322,7 +1261,7 @@ var TableBody = function TableBody(props) {
|
|
|
1322
1261
|
return false;
|
|
1323
1262
|
};
|
|
1324
1263
|
// 处理非首页非空状态
|
|
1325
|
-
|
|
1264
|
+
const handleDescription = () => {
|
|
1326
1265
|
if (emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.description) return emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.description;
|
|
1327
1266
|
if (Number(page) > 1) {
|
|
1328
1267
|
return jsxs("div", Object.assign({
|
|
@@ -1340,7 +1279,7 @@ var TableBody = function TableBody(props) {
|
|
|
1340
1279
|
children: jsx(Button, Object.assign({
|
|
1341
1280
|
variant: "text",
|
|
1342
1281
|
size: "small",
|
|
1343
|
-
onClick:
|
|
1282
|
+
onClick: () => {
|
|
1344
1283
|
changePage && changePage(Number(page) - 1);
|
|
1345
1284
|
}
|
|
1346
1285
|
}, {
|
|
@@ -1353,8 +1292,8 @@ var TableBody = function TableBody(props) {
|
|
|
1353
1292
|
}
|
|
1354
1293
|
};
|
|
1355
1294
|
// 处理className
|
|
1356
|
-
|
|
1357
|
-
|
|
1295
|
+
const handClassNoData = () => {
|
|
1296
|
+
let str = 'table-no-data';
|
|
1358
1297
|
if (emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.size) str += " table-no-data-".concat(emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.size);
|
|
1359
1298
|
return str;
|
|
1360
1299
|
};
|
|
@@ -1368,24 +1307,24 @@ var TableBody = function TableBody(props) {
|
|
|
1368
1307
|
children: jsx(Empty, Object.assign({}, emptyProps, {
|
|
1369
1308
|
description: handleDescription(),
|
|
1370
1309
|
showRefresh: handRefreshBtn(),
|
|
1371
|
-
onRefresh:
|
|
1310
|
+
onRefresh: event => {
|
|
1372
1311
|
if (emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.onRefresh) {
|
|
1373
1312
|
emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.onRefresh(event);
|
|
1374
1313
|
return;
|
|
1375
1314
|
}
|
|
1376
|
-
|
|
1315
|
+
onRefresh && onRefresh();
|
|
1377
1316
|
}
|
|
1378
1317
|
}))
|
|
1379
1318
|
}))
|
|
1380
1319
|
}));
|
|
1381
|
-
}, [expandableColSpan, emptyProps, url,
|
|
1320
|
+
}, [expandableColSpan, emptyProps, url, onRefresh, page, changePage]);
|
|
1382
1321
|
// 复选框useCallback
|
|
1383
|
-
|
|
1322
|
+
const TableCheckCallback = useCallback(row => {
|
|
1384
1323
|
if (check) {
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1324
|
+
const handId = row[rowKey];
|
|
1325
|
+
const disabledHand = Boolean(disabledJson[handId]);
|
|
1326
|
+
let checkHand = checkJson[handId] || false;
|
|
1327
|
+
let showCheck = true;
|
|
1389
1328
|
if (disabledHand && disabledArrStatus) {
|
|
1390
1329
|
// 选中
|
|
1391
1330
|
if (disabledArrStatus[handId] === true) {
|
|
@@ -1400,8 +1339,8 @@ var TableBody = function TableBody(props) {
|
|
|
1400
1339
|
showCheck = false;
|
|
1401
1340
|
}
|
|
1402
1341
|
}
|
|
1403
|
-
|
|
1404
|
-
|
|
1342
|
+
const handCls = () => {
|
|
1343
|
+
let str = 'table-checkbox table-body-btn';
|
|
1405
1344
|
if (fixedColumn) {
|
|
1406
1345
|
str += ' table-fixed-dom-left';
|
|
1407
1346
|
// 左边没有定位,且没有单选,没有嵌套表格
|
|
@@ -1418,7 +1357,7 @@ var TableBody = function TableBody(props) {
|
|
|
1418
1357
|
children: showCheck && jsx(Checkbox, {
|
|
1419
1358
|
disabled: disabledHand,
|
|
1420
1359
|
checked: checkHand,
|
|
1421
|
-
onChange:
|
|
1360
|
+
onChange: (event, bol) => {
|
|
1422
1361
|
event.stopPropagation();
|
|
1423
1362
|
selectCheck && selectCheck(event, bol, row[rowKey]);
|
|
1424
1363
|
}
|
|
@@ -1427,12 +1366,12 @@ var TableBody = function TableBody(props) {
|
|
|
1427
1366
|
}
|
|
1428
1367
|
}, [check, disabledJson, rowKey, checkJson, selectCheck, disabledArrStatus, posFixed, expandable, radio, fixedColumn]);
|
|
1429
1368
|
// 单选框useCallback
|
|
1430
|
-
|
|
1369
|
+
const TableRadioCallback = useCallback(row => {
|
|
1431
1370
|
if (radio) {
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1371
|
+
const handId = row[rowKey];
|
|
1372
|
+
const disabledHand = Boolean(disabledJson[handId]);
|
|
1373
|
+
let checkHand = radioValue === row[rowKey];
|
|
1374
|
+
let showRadio = true;
|
|
1436
1375
|
if (disabledHand && disabledArrStatus) {
|
|
1437
1376
|
// 选中
|
|
1438
1377
|
if (disabledArrStatus[handId] === true) {
|
|
@@ -1447,8 +1386,8 @@ var TableBody = function TableBody(props) {
|
|
|
1447
1386
|
showRadio = false;
|
|
1448
1387
|
}
|
|
1449
1388
|
}
|
|
1450
|
-
|
|
1451
|
-
|
|
1389
|
+
const handCls = () => {
|
|
1390
|
+
let str = 'table-radio table-body-btn';
|
|
1452
1391
|
if (fixedColumn) {
|
|
1453
1392
|
str += ' table-fixed-dom-left';
|
|
1454
1393
|
// 左边没有定位,没有嵌套表格
|
|
@@ -1465,7 +1404,7 @@ var TableBody = function TableBody(props) {
|
|
|
1465
1404
|
children: showRadio && jsx(Radio, {
|
|
1466
1405
|
disabled: disabledHand,
|
|
1467
1406
|
checked: checkHand,
|
|
1468
|
-
onChange:
|
|
1407
|
+
onChange: event => {
|
|
1469
1408
|
event.stopPropagation();
|
|
1470
1409
|
selectRadio && selectRadio(event, row[rowKey]);
|
|
1471
1410
|
}
|
|
@@ -1474,13 +1413,13 @@ var TableBody = function TableBody(props) {
|
|
|
1474
1413
|
}
|
|
1475
1414
|
}, [radio, disabledJson, radioValue, rowKey, selectRadio, disabledArrStatus, expandable, posFixed, fixedColumn]);
|
|
1476
1415
|
// 嵌套加减useCallback
|
|
1477
|
-
|
|
1416
|
+
const TableExpandableMemo = useCallback(row => {
|
|
1478
1417
|
if (!expandable) return null;
|
|
1479
|
-
|
|
1418
|
+
const expandableDemo = expandable(row);
|
|
1480
1419
|
// 禁用一行表格展开 或者 展开表格返回值为false,返回空列
|
|
1481
1420
|
if (disabledExpandJson[row[rowKey]] || expandableDemo === false) return jsx(TdElement, {});
|
|
1482
|
-
|
|
1483
|
-
|
|
1421
|
+
const handCls = () => {
|
|
1422
|
+
let str = 'table-expandable table-body-btn';
|
|
1484
1423
|
if (fixedColumn) {
|
|
1485
1424
|
str += ' table-fixed-dom-left';
|
|
1486
1425
|
// 左边没有定位,没有嵌套表格
|
|
@@ -1501,17 +1440,17 @@ var TableBody = function TableBody(props) {
|
|
|
1501
1440
|
}));
|
|
1502
1441
|
}, [expandable, expandableRow, rowKey, disabledExpandJson, onExpand, fixedColumn]);
|
|
1503
1442
|
// 表格一行内容useCallback
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
orderFieldArr
|
|
1507
|
-
orderTypeArr
|
|
1443
|
+
const TableContentUseCallback = useCallback((row, rowIndex) => {
|
|
1444
|
+
const params = {
|
|
1445
|
+
orderFieldArr,
|
|
1446
|
+
orderTypeArr
|
|
1508
1447
|
};
|
|
1509
|
-
|
|
1510
|
-
|
|
1448
|
+
const handContentClass = item => {
|
|
1449
|
+
let str = 'table-content-columms';
|
|
1511
1450
|
if (item.className) str += " ".concat(item.className);
|
|
1512
1451
|
// 排序
|
|
1513
1452
|
if (sortTable && item.name && item.sort !== false) {
|
|
1514
|
-
|
|
1453
|
+
const index = orderFieldArr.indexOf(item.name);
|
|
1515
1454
|
if (index !== -1) {
|
|
1516
1455
|
// 升序
|
|
1517
1456
|
if (orderTypeArr[index] === 'asc') {
|
|
@@ -1536,8 +1475,8 @@ var TableBody = function TableBody(props) {
|
|
|
1536
1475
|
}
|
|
1537
1476
|
return str;
|
|
1538
1477
|
};
|
|
1539
|
-
|
|
1540
|
-
|
|
1478
|
+
const handStyle = item => {
|
|
1479
|
+
const json = {};
|
|
1541
1480
|
if (fixedColumn && item.fixed && item.width) {
|
|
1542
1481
|
if (item.fixed === 'left') {
|
|
1543
1482
|
json.left = "".concat(item.paraui_left_width, "px");
|
|
@@ -1548,12 +1487,12 @@ var TableBody = function TableBody(props) {
|
|
|
1548
1487
|
}
|
|
1549
1488
|
return json;
|
|
1550
1489
|
};
|
|
1551
|
-
return tableCell ? tableCell(row, params) : headData.map(
|
|
1552
|
-
|
|
1553
|
-
|
|
1490
|
+
return tableCell ? tableCell(row, params) : headData.map((item, index) => {
|
|
1491
|
+
let text = row[item.name];
|
|
1492
|
+
let colSpan = 1;
|
|
1554
1493
|
if (item.render) text = item.render(row, item, row[item.name], index, rowIndex);
|
|
1555
1494
|
if (formatter) text = formatter(row, item, row[item.name], index, rowIndex);
|
|
1556
|
-
|
|
1495
|
+
const itemStyle = handStyle(item);
|
|
1557
1496
|
// 存在显示列,最后一列占两格
|
|
1558
1497
|
if (showColumns === 'inside' && !operate && index === headData.length - 1 && !dragRow) {
|
|
1559
1498
|
colSpan = 2;
|
|
@@ -1577,25 +1516,25 @@ var TableBody = function TableBody(props) {
|
|
|
1577
1516
|
});
|
|
1578
1517
|
}, [tableCell, headData, align, formatter, orderFieldArr, orderTypeArr, sortTable, showColumns, operate, beyondText, fixedColumn, tipMaxWidth, dragRow]);
|
|
1579
1518
|
// 操作栏useCallback
|
|
1580
|
-
|
|
1519
|
+
const TableOperateUseCallback = useCallback((row, rowIndex) => {
|
|
1581
1520
|
if (operate || dragRow) {
|
|
1582
|
-
|
|
1521
|
+
let colSpan = 1;
|
|
1583
1522
|
if (showColumns === 'inside' && operate) colSpan = 2;
|
|
1584
|
-
|
|
1523
|
+
const handOperate = () => {
|
|
1585
1524
|
if (operate === null || operate === void 0 ? void 0 : operate.render) return operate.render(row);
|
|
1586
1525
|
if (operate === null || operate === void 0 ? void 0 : operate.operateBtnRender) {
|
|
1587
|
-
|
|
1526
|
+
const operateConfig = operate.operateBtnRender(row, rowIndex);
|
|
1588
1527
|
return jsx(OperateBtn, Object.assign({}, operateConfig));
|
|
1589
1528
|
}
|
|
1590
1529
|
};
|
|
1591
|
-
|
|
1592
|
-
|
|
1530
|
+
const handStyle = () => {
|
|
1531
|
+
const json = {
|
|
1593
1532
|
right: '0'
|
|
1594
1533
|
};
|
|
1595
1534
|
return json;
|
|
1596
1535
|
};
|
|
1597
|
-
|
|
1598
|
-
|
|
1536
|
+
const handCls = () => {
|
|
1537
|
+
let str = 'table-operate';
|
|
1599
1538
|
if (!operate) str += ' table-operate-center';
|
|
1600
1539
|
if (fixedColumn) {
|
|
1601
1540
|
str += ' table-fixed-dom-right';
|
|
@@ -1636,11 +1575,11 @@ var TableBody = function TableBody(props) {
|
|
|
1636
1575
|
}
|
|
1637
1576
|
}, [operate, align, showColumns, posFixed, fixedColumn, dragRow, onDragRow, dragBol]);
|
|
1638
1577
|
// 嵌套表格useCallback
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1578
|
+
const TableExpandableContentUseCallback = useCallback(row => {
|
|
1579
|
+
const id = row[rowKey];
|
|
1580
|
+
const expandItem = expandableRow[id] || {};
|
|
1642
1581
|
if (expandable && expandItem.status === 'develop') {
|
|
1643
|
-
|
|
1582
|
+
const expandableDemo = expandable(row);
|
|
1644
1583
|
if (expandableDemo === false) return null; // 展开表格返回值为false,不展示这一行
|
|
1645
1584
|
return jsx(TrElement, Object.assign({
|
|
1646
1585
|
className: "table-body-expand-row"
|
|
@@ -1655,7 +1594,7 @@ var TableBody = function TableBody(props) {
|
|
|
1655
1594
|
}
|
|
1656
1595
|
}, [expandable, expandableRow, expandableColSpan, rowKey]);
|
|
1657
1596
|
// 加载更多
|
|
1658
|
-
|
|
1597
|
+
const MoreMemo = useMemo(() => {
|
|
1659
1598
|
if (!loadMore || !showMoreBtn) return null;
|
|
1660
1599
|
return jsx(TrElement, Object.assign({
|
|
1661
1600
|
className: "more-table-row",
|
|
@@ -1678,25 +1617,25 @@ var TableBody = function TableBody(props) {
|
|
|
1678
1617
|
}))
|
|
1679
1618
|
}));
|
|
1680
1619
|
}, [expandableColSpan, loadMore, loadMoreRender, onClickMore, showMoreBtn, changePage, loadMoreUrl, lineHeight]);
|
|
1681
|
-
|
|
1682
|
-
|
|
1620
|
+
const TableBodySubjectContentMemo = useMemo(() => {
|
|
1621
|
+
let rowDataCom = rowData;
|
|
1683
1622
|
if (virtual) {
|
|
1684
1623
|
rowDataCom = rowDataCom.slice(virtualIndex[0], virtualIndex[1]);
|
|
1685
1624
|
}
|
|
1686
1625
|
return jsx(Fragment, {
|
|
1687
|
-
children: rowDataCom.map(
|
|
1688
|
-
|
|
1626
|
+
children: rowDataCom.map((row, idx) => {
|
|
1627
|
+
let str = 'table-body-row';
|
|
1689
1628
|
if (rowClassMapping && rowClassMapping[row[rowKey]]) {
|
|
1690
1629
|
str += " ".concat(rowClassMapping[row[rowKey]]);
|
|
1691
1630
|
}
|
|
1692
|
-
|
|
1631
|
+
const index = idx + virtualIndex[0];
|
|
1693
1632
|
return jsxs(Fragment$1, {
|
|
1694
1633
|
children: [jsxs(TrElement, Object.assign({
|
|
1695
1634
|
className: str,
|
|
1696
1635
|
style: {
|
|
1697
1636
|
height: "".concat(lineHeight, "px")
|
|
1698
1637
|
},
|
|
1699
|
-
onClick:
|
|
1638
|
+
onClick: e => {
|
|
1700
1639
|
onClickRow && onClickRow(row, e);
|
|
1701
1640
|
}
|
|
1702
1641
|
}, {
|
|
@@ -1707,7 +1646,7 @@ var TableBody = function TableBody(props) {
|
|
|
1707
1646
|
});
|
|
1708
1647
|
}, [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, virtualIndex, virtual]);
|
|
1709
1648
|
// 内容memo
|
|
1710
|
-
|
|
1649
|
+
const TableBodyContentMemo = useMemo(() => {
|
|
1711
1650
|
return jsxs(Fragment$1, {
|
|
1712
1651
|
children: [TableBodySubjectContentMemo, MoreMemo, virtual && jsx(TrElement, {
|
|
1713
1652
|
className: 'virtual-scroll-height'
|
|
@@ -1715,31 +1654,31 @@ var TableBody = function TableBody(props) {
|
|
|
1715
1654
|
});
|
|
1716
1655
|
}, [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, virtualIndex, virtual]);
|
|
1717
1656
|
// 处理内容
|
|
1718
|
-
|
|
1657
|
+
const handContent = () => {
|
|
1719
1658
|
// 无数据,且不再请求,显示暂无数据
|
|
1720
1659
|
if (rowData.length === 0 && !loadState) return NodataMemo;
|
|
1721
1660
|
return TableBodyContentMemo;
|
|
1722
1661
|
};
|
|
1723
|
-
|
|
1724
|
-
|
|
1662
|
+
const handleRowData = () => {
|
|
1663
|
+
const arr = [];
|
|
1725
1664
|
if (dragRow) {
|
|
1726
|
-
rowData.forEach(
|
|
1727
|
-
|
|
1665
|
+
rowData.forEach(item => {
|
|
1666
|
+
const obj = {};
|
|
1728
1667
|
obj[rowKey] = item[rowKey];
|
|
1729
1668
|
arr.push(obj);
|
|
1730
1669
|
});
|
|
1731
1670
|
}
|
|
1732
1671
|
return arr;
|
|
1733
1672
|
};
|
|
1734
|
-
|
|
1673
|
+
const onChoose = () => {
|
|
1735
1674
|
setDragBol(true);
|
|
1736
1675
|
};
|
|
1737
|
-
|
|
1676
|
+
const onDragRowCom = evt => {
|
|
1738
1677
|
setDragBol(false);
|
|
1739
1678
|
onDragRow && onDragRow(evt);
|
|
1740
1679
|
};
|
|
1741
|
-
|
|
1742
|
-
|
|
1680
|
+
const handleStyle = () => {
|
|
1681
|
+
const obj = {};
|
|
1743
1682
|
if (virtual) {
|
|
1744
1683
|
obj.height = rowData.length * lineHeight + 'px';
|
|
1745
1684
|
obj.position = 'relative';
|
|
@@ -1760,36 +1699,30 @@ var TableBody = function TableBody(props) {
|
|
|
1760
1699
|
}));
|
|
1761
1700
|
};
|
|
1762
1701
|
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
checkNumber =
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
setIndeterminate = _useState2[1]; // 半选中
|
|
1788
|
-
var _useState3 = useState(false),
|
|
1789
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
1790
|
-
checked = _useState4[0],
|
|
1791
|
-
setChecked = _useState4[1]; // 选中
|
|
1792
|
-
useEffect(function () {
|
|
1702
|
+
const TableHead = props => {
|
|
1703
|
+
const {
|
|
1704
|
+
paginationType,
|
|
1705
|
+
flippingArrow,
|
|
1706
|
+
autoPagination,
|
|
1707
|
+
total,
|
|
1708
|
+
page,
|
|
1709
|
+
rowsPerPage,
|
|
1710
|
+
currentRowsPerPage,
|
|
1711
|
+
changePage,
|
|
1712
|
+
changeRowsPerPage,
|
|
1713
|
+
refreshInside,
|
|
1714
|
+
checkCount,
|
|
1715
|
+
onRefresh,
|
|
1716
|
+
selectAll,
|
|
1717
|
+
selectStatus,
|
|
1718
|
+
checkNumber = 0,
|
|
1719
|
+
currentPageTotal = 0,
|
|
1720
|
+
resizePaginationLine
|
|
1721
|
+
} = props;
|
|
1722
|
+
const intl = useFormatMessage('Table', localeJson);
|
|
1723
|
+
const [indeterminate, setIndeterminate] = useState(false); // 半选中
|
|
1724
|
+
const [checked, setChecked] = useState(false); // 选中
|
|
1725
|
+
useEffect(() => {
|
|
1793
1726
|
// 全选
|
|
1794
1727
|
if (selectStatus === 'all') {
|
|
1795
1728
|
setChecked(true);
|
|
@@ -1811,23 +1744,23 @@ var TableHead = function TableHead(props) {
|
|
|
1811
1744
|
* @param event 操作元素
|
|
1812
1745
|
* @param bol 选中 / 不选中
|
|
1813
1746
|
*/
|
|
1814
|
-
|
|
1747
|
+
const onSelectAll = (event, bol) => {
|
|
1815
1748
|
if (selectAll) selectAll(event, bol);
|
|
1816
1749
|
};
|
|
1817
1750
|
// 改变页面
|
|
1818
|
-
|
|
1751
|
+
const changePageCom = num => {
|
|
1819
1752
|
changePage && changePage(num);
|
|
1820
1753
|
};
|
|
1821
1754
|
// 改变每页显示条数
|
|
1822
|
-
|
|
1755
|
+
const changeRowsPerPageCom = num => {
|
|
1823
1756
|
changeRowsPerPage && changeRowsPerPage(num);
|
|
1824
1757
|
};
|
|
1825
1758
|
// 刷新
|
|
1826
|
-
|
|
1759
|
+
const clickRefresh = () => {
|
|
1827
1760
|
onRefresh && onRefresh();
|
|
1828
1761
|
};
|
|
1829
1762
|
// 处理分页右侧
|
|
1830
|
-
|
|
1763
|
+
const handlePaginationRight = () => {
|
|
1831
1764
|
if (!checkCount) return null;
|
|
1832
1765
|
return jsxs("div", Object.assign({
|
|
1833
1766
|
className: 'table-pagination-right'
|
|
@@ -1850,8 +1783,8 @@ var TableHead = function TableHead(props) {
|
|
|
1850
1783
|
}));
|
|
1851
1784
|
};
|
|
1852
1785
|
// 处理样式
|
|
1853
|
-
|
|
1854
|
-
|
|
1786
|
+
const handleClass = () => {
|
|
1787
|
+
const str = 'table-pagination';
|
|
1855
1788
|
return str;
|
|
1856
1789
|
};
|
|
1857
1790
|
return jsxs("div", Object.assign({
|
|
@@ -1869,9 +1802,7 @@ var TableHead = function TableHead(props) {
|
|
|
1869
1802
|
currentRowsPerPage: currentRowsPerPage,
|
|
1870
1803
|
changePage: changePageCom,
|
|
1871
1804
|
changeRowsPerPage: changeRowsPerPageCom,
|
|
1872
|
-
getPopupContainer:
|
|
1873
|
-
return document.body;
|
|
1874
|
-
},
|
|
1805
|
+
getPopupContainer: () => document.body,
|
|
1875
1806
|
resizeLine: resizePaginationLine
|
|
1876
1807
|
}), refreshInside && jsx(Button.IconButton, Object.assign({
|
|
1877
1808
|
className: 'refresh-btn',
|
|
@@ -1886,14 +1817,16 @@ var TableHead = function TableHead(props) {
|
|
|
1886
1817
|
var css_248z$2 = ".table-container {\n overflow-x: auto;\n}";
|
|
1887
1818
|
styleInject(css_248z$2);
|
|
1888
1819
|
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1820
|
+
const TableContainer = props => {
|
|
1821
|
+
const {
|
|
1822
|
+
cRef,
|
|
1823
|
+
className,
|
|
1824
|
+
style,
|
|
1825
|
+
children
|
|
1826
|
+
} = props,
|
|
1894
1827
|
otherProps = __rest(props, ["cRef", "className", "style", "children"]);
|
|
1895
|
-
|
|
1896
|
-
|
|
1828
|
+
const handClass = () => {
|
|
1829
|
+
let str = 'table-container';
|
|
1897
1830
|
if (className) str += " ".concat(className);
|
|
1898
1831
|
return str;
|
|
1899
1832
|
};
|
|
@@ -1909,15 +1842,17 @@ var TableContainer = function TableContainer(props) {
|
|
|
1909
1842
|
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}";
|
|
1910
1843
|
styleInject(css_248z$1);
|
|
1911
1844
|
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1845
|
+
const TableElement = props => {
|
|
1846
|
+
const {
|
|
1847
|
+
className,
|
|
1848
|
+
style,
|
|
1849
|
+
fixedColumn,
|
|
1850
|
+
children,
|
|
1851
|
+
cRef
|
|
1852
|
+
} = props,
|
|
1918
1853
|
otherProps = __rest(props, ["className", "style", "fixedColumn", "children", "cRef"]);
|
|
1919
|
-
|
|
1920
|
-
|
|
1854
|
+
const handClass = () => {
|
|
1855
|
+
let str = 'table-element';
|
|
1921
1856
|
if (fixedColumn) str += ' table-element-fixed-column';
|
|
1922
1857
|
if (className) str += " ".concat(className);
|
|
1923
1858
|
return str;
|