es-grid-template 1.9.63 → 1.9.65
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/es/ali-table/Grid.js +5 -2
- package/es/ali-table/InternalTable.js +499 -49
- package/es/ali-table/base-table/calculations.js +1 -1
- package/es/ali-table/base-table/cell/EditCell.js +14 -6
- package/es/ali-table/base-table/renderFilter.js +1 -1
- package/es/ali-table/interfaces.d.ts +2 -2
- package/es/ali-table/pipeline/features/columnCustom.d.ts +4 -2
- package/es/ali-table/pipeline/features/columnCustom.js +112 -48
- package/es/ali-table/utils/constants.d.ts +1 -0
- package/es/ali-table/utils/constants.js +1 -0
- package/es/ali-table/utils/convertColumnsChoose.d.ts +2 -2
- package/es/ali-table/utils/convertColumnsChoose.js +1 -2
- package/es/ali-table/utils/utility.d.ts +15 -1
- package/es/ali-table/utils/utility.js +399 -1
- package/es/grid-component/type.d.ts +2 -2
- package/es/group-component/hook/utils.d.ts +3 -3
- package/es/table-component/InternalTable.js +11 -3
- package/es/table-component/TableContainerEdit.js +148 -98
- package/es/table-component/body/EditableCell.js +9 -5
- package/es/table-component/body/TableBodyCellEdit.js +14 -8
- package/es/table-component/header/TableHeadCell2.js +2 -2
- package/es/table-component/hook/useColumns.js +1 -1
- package/es/table-component/hook/utils.d.ts +1 -1
- package/es/table-component/hook/utils.js +2 -6
- package/es/table-component/table/Grid.js +23 -17
- package/es/table-component/useContext.d.ts +1 -1
- package/lib/ali-table/Grid.js +5 -2
- package/lib/ali-table/InternalTable.js +490 -45
- package/lib/ali-table/base-table/calculations.js +1 -1
- package/lib/ali-table/base-table/cell/EditCell.js +14 -6
- package/lib/ali-table/base-table/renderFilter.js +1 -1
- package/lib/ali-table/interfaces.d.ts +2 -2
- package/lib/ali-table/pipeline/features/columnCustom.d.ts +4 -2
- package/lib/ali-table/pipeline/features/columnCustom.js +106 -46
- package/lib/ali-table/utils/constants.d.ts +1 -0
- package/lib/ali-table/utils/constants.js +2 -1
- package/lib/ali-table/utils/convertColumnsChoose.d.ts +2 -2
- package/lib/ali-table/utils/convertColumnsChoose.js +1 -2
- package/lib/ali-table/utils/utility.d.ts +15 -1
- package/lib/ali-table/utils/utility.js +410 -2
- package/lib/grid-component/type.d.ts +2 -2
- package/lib/table-component/InternalTable.js +11 -3
- package/lib/table-component/TableContainerEdit.js +148 -98
- package/lib/table-component/body/EditableCell.js +9 -5
- package/lib/table-component/body/TableBodyCellEdit.js +11 -7
- package/lib/table-component/header/TableHeadCell2.js +2 -2
- package/lib/table-component/hook/useColumns.js +1 -1
- package/lib/table-component/hook/utils.d.ts +1 -1
- package/lib/table-component/hook/utils.js +2 -6
- package/lib/table-component/table/Grid.js +22 -16
- package/lib/table-component/useContext.d.ts +1 -1
- package/package.json +1 -1
|
@@ -5,9 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.addRowIdArray = void 0;
|
|
7
7
|
exports.filterDataByColumns1 = filterDataByColumns1;
|
|
8
|
-
exports.
|
|
8
|
+
exports.filterVisibleColumns = filterVisibleColumns;
|
|
9
|
+
exports.getMaxDepth = exports.flattenArray = void 0;
|
|
10
|
+
exports.getVisibleColumnFields = getVisibleColumnFields;
|
|
11
|
+
exports.sortByType = exports.shouldIncludeOptimized = void 0;
|
|
9
12
|
exports.sortData = sortData;
|
|
10
13
|
exports.sortData1 = sortData1;
|
|
14
|
+
exports.unFlattenData = void 0;
|
|
15
|
+
exports.updateOrInsert = updateOrInsert;
|
|
16
|
+
exports.updateOrInsert1 = updateOrInsert1;
|
|
17
|
+
exports.updateOrInsert3 = updateOrInsert3;
|
|
11
18
|
var _utils = require("../../table-component/hook/utils");
|
|
12
19
|
const prepareFilters = (queries, ignoreAccents = true) => {
|
|
13
20
|
return queries.map(query => {
|
|
@@ -307,4 +314,405 @@ const addRowIdArray = inputArray => {
|
|
|
307
314
|
}
|
|
308
315
|
return result;
|
|
309
316
|
};
|
|
310
|
-
exports.addRowIdArray = addRowIdArray;
|
|
317
|
+
exports.addRowIdArray = addRowIdArray;
|
|
318
|
+
const unFlattenData = data => {
|
|
319
|
+
if (!data || data.length === 0) return [];
|
|
320
|
+
const idToNodeMap = new Map();
|
|
321
|
+
for (let index = 0; index < data.length; index += 1) {
|
|
322
|
+
const item = data[index];
|
|
323
|
+
idToNodeMap.set(item.rowId, {
|
|
324
|
+
...item
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
const tree = [];
|
|
328
|
+
for (let index = 0; index < data.length; index += 1) {
|
|
329
|
+
const item = data[index];
|
|
330
|
+
const currentNode = idToNodeMap.get(item.rowId);
|
|
331
|
+
if (!currentNode || !item.parentId) {
|
|
332
|
+
if (currentNode) tree.push(currentNode);
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
const parentNode = idToNodeMap.get(item.parentId);
|
|
336
|
+
if (parentNode) {
|
|
337
|
+
const parentWithChildren = parentNode;
|
|
338
|
+
const children = parentWithChildren.children ?? (parentWithChildren.children = []);
|
|
339
|
+
children.push(currentNode);
|
|
340
|
+
} else {
|
|
341
|
+
tree.push(currentNode);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return tree;
|
|
345
|
+
};
|
|
346
|
+
exports.unFlattenData = unFlattenData;
|
|
347
|
+
const flattenArray = arr => {
|
|
348
|
+
if (!arr) {
|
|
349
|
+
return [];
|
|
350
|
+
}
|
|
351
|
+
const result = [];
|
|
352
|
+
const pending = [...arr].reverse();
|
|
353
|
+
while (pending.length > 0) {
|
|
354
|
+
const item = pending.pop();
|
|
355
|
+
if (!item) continue;
|
|
356
|
+
const {
|
|
357
|
+
children,
|
|
358
|
+
...rest
|
|
359
|
+
} = item;
|
|
360
|
+
result.push(rest);
|
|
361
|
+
if (Array.isArray(children)) {
|
|
362
|
+
for (let index = children.length - 1; index >= 0; index -= 1) {
|
|
363
|
+
pending.push(children[index]);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return result;
|
|
368
|
+
};
|
|
369
|
+
exports.flattenArray = flattenArray;
|
|
370
|
+
function updateOrInsert1(dataArray, dataFilter) {
|
|
371
|
+
const nodesByRowId = new Map();
|
|
372
|
+
let head;
|
|
373
|
+
let tail;
|
|
374
|
+
for (const item of dataArray) {
|
|
375
|
+
const node = {
|
|
376
|
+
item,
|
|
377
|
+
next: undefined
|
|
378
|
+
};
|
|
379
|
+
if (!head) head = node;
|
|
380
|
+
if (tail) tail.next = node;
|
|
381
|
+
tail = node;
|
|
382
|
+
|
|
383
|
+
// Preserve findIndex semantics when duplicate rowId values exist.
|
|
384
|
+
if (!nodesByRowId.has(item.rowId)) {
|
|
385
|
+
nodesByRowId.set(item.rowId, node);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
for (let index = 0; index < dataFilter.length; index += 1) {
|
|
389
|
+
const filterItem = dataFilter[index];
|
|
390
|
+
const existingNode = nodesByRowId.get(filterItem.rowId);
|
|
391
|
+
if (existingNode) {
|
|
392
|
+
existingNode.item = {
|
|
393
|
+
...existingNode.item,
|
|
394
|
+
...filterItem
|
|
395
|
+
};
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
const node = {
|
|
399
|
+
item: filterItem,
|
|
400
|
+
next: undefined
|
|
401
|
+
};
|
|
402
|
+
nodesByRowId.set(filterItem.rowId, node);
|
|
403
|
+
const previousItem = dataFilter[index - 1];
|
|
404
|
+
const previousNode = previousItem ? nodesByRowId.get(previousItem.rowId) : undefined;
|
|
405
|
+
if (previousNode) {
|
|
406
|
+
node.next = previousNode.next;
|
|
407
|
+
previousNode.next = node;
|
|
408
|
+
if (tail === previousNode) tail = node;
|
|
409
|
+
} else {
|
|
410
|
+
if (tail) tail.next = node;else head = node;
|
|
411
|
+
tail = node;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
const result = [];
|
|
415
|
+
let current = head;
|
|
416
|
+
while (current) {
|
|
417
|
+
result.push(current.item);
|
|
418
|
+
current = current.next;
|
|
419
|
+
}
|
|
420
|
+
return result;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// export const addRowIdArray = (inputArray: any[]) => {
|
|
424
|
+
// if (!inputArray || inputArray.length === 0) return []
|
|
425
|
+
|
|
426
|
+
// const result = new Array<any>(inputArray.length)
|
|
427
|
+
// const pending: { source: any, target: any[], index: number, parentId?: any }[] = []
|
|
428
|
+
|
|
429
|
+
// for (let index = inputArray.length - 1; index >= 0; index -= 1) {
|
|
430
|
+
// pending.push({ source: inputArray[index], target: result, index })
|
|
431
|
+
// }
|
|
432
|
+
|
|
433
|
+
// while (pending.length > 0) {
|
|
434
|
+
// const { source, target, index, parentId } = pending.pop() as {
|
|
435
|
+
// source: any
|
|
436
|
+
// target: any[]
|
|
437
|
+
// index: number
|
|
438
|
+
// parentId?: any
|
|
439
|
+
// }
|
|
440
|
+
|
|
441
|
+
// const rowId = source.id ?? source.rowId ?? newGuid()
|
|
442
|
+
// const node = {
|
|
443
|
+
// ...source,
|
|
444
|
+
// rowId,
|
|
445
|
+
// ...(parentId !== undefined && source.parentId == null ? { parentId } : {})
|
|
446
|
+
// }
|
|
447
|
+
// target[index] = node
|
|
448
|
+
|
|
449
|
+
// if (Array.isArray(source.children) && source.children.length > 0) {
|
|
450
|
+
// const children = new Array<any>(source.children.length)
|
|
451
|
+
// node.children = children
|
|
452
|
+
|
|
453
|
+
// for (let childIndex = source.children.length - 1; childIndex >= 0; childIndex -= 1) {
|
|
454
|
+
// pending.push({
|
|
455
|
+
// source: source.children[childIndex],
|
|
456
|
+
// target: children,
|
|
457
|
+
// index: childIndex,
|
|
458
|
+
// parentId: rowId
|
|
459
|
+
// })
|
|
460
|
+
// }
|
|
461
|
+
// }
|
|
462
|
+
// }
|
|
463
|
+
|
|
464
|
+
// return result
|
|
465
|
+
// }
|
|
466
|
+
|
|
467
|
+
function updateOrInsert3(dataArray, dataFilter) {
|
|
468
|
+
const dataLength = dataArray.length;
|
|
469
|
+
const filterLength = dataFilter.length;
|
|
470
|
+
|
|
471
|
+
// rowId -> index trong data
|
|
472
|
+
const indexByRowId = new Map();
|
|
473
|
+
|
|
474
|
+
// next[index] = index tiếp theo
|
|
475
|
+
// -1 = không có next
|
|
476
|
+
const next = new Int32Array(dataLength + filterLength);
|
|
477
|
+
next.fill(-1);
|
|
478
|
+
|
|
479
|
+
// Data hiện tại
|
|
480
|
+
const items = new Array(dataLength + filterLength);
|
|
481
|
+
let head = dataLength > 0 ? 0 : -1;
|
|
482
|
+
let tail = dataLength - 1;
|
|
483
|
+
for (let i = 0; i < dataLength; i++) {
|
|
484
|
+
const item = dataArray[i];
|
|
485
|
+
items[i] = item;
|
|
486
|
+
|
|
487
|
+
// Preserve findIndex semantics:
|
|
488
|
+
// duplicate rowId -> giữ item đầu tiên
|
|
489
|
+
if (!indexByRowId.has(item.rowId)) {
|
|
490
|
+
indexByRowId.set(item.rowId, i);
|
|
491
|
+
}
|
|
492
|
+
if (i > 0) {
|
|
493
|
+
next[i - 1] = i;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
let size = dataLength;
|
|
497
|
+
for (let i = 0; i < filterLength; i++) {
|
|
498
|
+
const filterItem = dataFilter[i];
|
|
499
|
+
const rowId = filterItem.rowId;
|
|
500
|
+
const existingIndex = indexByRowId.get(rowId);
|
|
501
|
+
|
|
502
|
+
// =========================
|
|
503
|
+
// UPDATE
|
|
504
|
+
// =========================
|
|
505
|
+
if (existingIndex !== undefined) {
|
|
506
|
+
const existingItem = items[existingIndex];
|
|
507
|
+
|
|
508
|
+
// Nếu chấp nhận mutate object -> nhanh nhất
|
|
509
|
+
Object.assign(existingItem, filterItem);
|
|
510
|
+
continue;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// =========================
|
|
514
|
+
// INSERT
|
|
515
|
+
// =========================
|
|
516
|
+
const newIndex = size++;
|
|
517
|
+
items[newIndex] = filterItem;
|
|
518
|
+
next[newIndex] = -1;
|
|
519
|
+
indexByRowId.set(rowId, newIndex);
|
|
520
|
+
|
|
521
|
+
// previous item trong dataFilter
|
|
522
|
+
const previousItem = dataFilter[i - 1];
|
|
523
|
+
if (previousItem) {
|
|
524
|
+
const previousIndex = indexByRowId.get(previousItem.rowId);
|
|
525
|
+
if (previousIndex !== undefined) {
|
|
526
|
+
next[newIndex] = next[previousIndex];
|
|
527
|
+
next[previousIndex] = newIndex;
|
|
528
|
+
if (tail === previousIndex) {
|
|
529
|
+
tail = newIndex;
|
|
530
|
+
}
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
// Không có previous -> append cuối
|
|
536
|
+
if (tail !== -1) {
|
|
537
|
+
next[tail] = newIndex;
|
|
538
|
+
} else {
|
|
539
|
+
head = newIndex;
|
|
540
|
+
}
|
|
541
|
+
tail = newIndex;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// =========================
|
|
545
|
+
// BUILD RESULT
|
|
546
|
+
// =========================
|
|
547
|
+
const result = new Array(size);
|
|
548
|
+
let current = head;
|
|
549
|
+
let resultIndex = 0;
|
|
550
|
+
while (current !== -1) {
|
|
551
|
+
result[resultIndex++] = items[current];
|
|
552
|
+
current = next[current];
|
|
553
|
+
}
|
|
554
|
+
return result;
|
|
555
|
+
}
|
|
556
|
+
function updateOrInsert(dataArray, dataFilter) {
|
|
557
|
+
const dataLength = dataArray.length;
|
|
558
|
+
const filterLength = dataFilter.length;
|
|
559
|
+
if (filterLength === 0) {
|
|
560
|
+
return dataArray;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
// =========================================================
|
|
564
|
+
// Fast lookup bằng Map
|
|
565
|
+
// =========================================================
|
|
566
|
+
|
|
567
|
+
const indexByRowId = new Map();
|
|
568
|
+
for (let i = 0; i < dataLength; i++) {
|
|
569
|
+
const rowId = dataArray[i].rowId;
|
|
570
|
+
if (!indexByRowId.has(rowId)) {
|
|
571
|
+
indexByRowId.set(rowId, i);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
// =========================================================
|
|
576
|
+
// Xác định update + insert
|
|
577
|
+
// =========================================================
|
|
578
|
+
|
|
579
|
+
const inserted = new Map();
|
|
580
|
+
for (let i = 0; i < filterLength; i++) {
|
|
581
|
+
const item = dataFilter[i];
|
|
582
|
+
const rowId = item.rowId;
|
|
583
|
+
const index = indexByRowId.get(rowId);
|
|
584
|
+
if (index !== undefined) {
|
|
585
|
+
// UPDATE trực tiếp
|
|
586
|
+
Object.assign(dataArray[index], item);
|
|
587
|
+
} else {
|
|
588
|
+
inserted.set(rowId, item);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
// Không insert
|
|
593
|
+
if (inserted.size === 0) {
|
|
594
|
+
return dataArray;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
// =========================================================
|
|
598
|
+
// Build insertion map
|
|
599
|
+
// =========================================================
|
|
600
|
+
|
|
601
|
+
const insertAfter = new Map();
|
|
602
|
+
let pending = [];
|
|
603
|
+
for (let i = 0; i < filterLength; i++) {
|
|
604
|
+
const item = dataFilter[i];
|
|
605
|
+
const rowId = item.rowId;
|
|
606
|
+
if (!inserted.has(rowId)) {
|
|
607
|
+
pending = [];
|
|
608
|
+
continue;
|
|
609
|
+
}
|
|
610
|
+
pending.push(item);
|
|
611
|
+
const previous = i > 0 ? dataFilter[i - 1] : undefined;
|
|
612
|
+
if (previous) {
|
|
613
|
+
const previousId = previous.rowId;
|
|
614
|
+
let list = insertAfter.get(previousId);
|
|
615
|
+
if (!list) {
|
|
616
|
+
list = [];
|
|
617
|
+
insertAfter.set(previousId, list);
|
|
618
|
+
}
|
|
619
|
+
list.push(item);
|
|
620
|
+
pending = [];
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
// =========================================================
|
|
625
|
+
// Build result 1 lần
|
|
626
|
+
// =========================================================
|
|
627
|
+
|
|
628
|
+
const result = new Array(dataLength + inserted.size);
|
|
629
|
+
let resultIndex = 0;
|
|
630
|
+
for (let i = 0; i < dataLength; i++) {
|
|
631
|
+
const item = dataArray[i];
|
|
632
|
+
result[resultIndex++] = item;
|
|
633
|
+
const rows = insertAfter.get(item.rowId);
|
|
634
|
+
if (rows) {
|
|
635
|
+
for (let j = 0; j < rows.length; j++) {
|
|
636
|
+
result[resultIndex++] = rows[j];
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
return result;
|
|
641
|
+
}
|
|
642
|
+
function filterVisibleColumns(columns) {
|
|
643
|
+
let changed = false;
|
|
644
|
+
const result = [];
|
|
645
|
+
for (const column of columns) {
|
|
646
|
+
if (column.visible === false) {
|
|
647
|
+
changed = true;
|
|
648
|
+
continue;
|
|
649
|
+
}
|
|
650
|
+
if (column.children?.length) {
|
|
651
|
+
const children = filterVisibleColumns(column.children);
|
|
652
|
+
if (children !== column.children) {
|
|
653
|
+
changed = true;
|
|
654
|
+
result.push({
|
|
655
|
+
...column,
|
|
656
|
+
children
|
|
657
|
+
});
|
|
658
|
+
} else {
|
|
659
|
+
result.push(column);
|
|
660
|
+
}
|
|
661
|
+
} else {
|
|
662
|
+
result.push(column);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
return changed ? result : columns;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
// Sorting function
|
|
669
|
+
const sortByType = (arr, rowDnd) => {
|
|
670
|
+
const colDnd = {
|
|
671
|
+
field: 'drag-handle',
|
|
672
|
+
width: 50,
|
|
673
|
+
fixed: 'left',
|
|
674
|
+
headerText: '',
|
|
675
|
+
allowFiltering: false,
|
|
676
|
+
allowResizing: false,
|
|
677
|
+
allowSortering: false
|
|
678
|
+
};
|
|
679
|
+
const cols = rowDnd?.enabled ? [{
|
|
680
|
+
...colDnd
|
|
681
|
+
}, ...arr] : [...arr];
|
|
682
|
+
|
|
683
|
+
// const visibleColumns = filterVisibleColumns(cols)
|
|
684
|
+
|
|
685
|
+
if (cols) {
|
|
686
|
+
return cols.sort((a, b) => {
|
|
687
|
+
if ((a.fixed ?? a.fixedType) === 'left' && (b.fixed ?? b.fixedType) !== 'left') {
|
|
688
|
+
return -1;
|
|
689
|
+
} else if ((a.fixed ?? a.fixedType) !== 'left' && (b.fixed ?? b.fixedType) === 'left') {
|
|
690
|
+
return 1;
|
|
691
|
+
} else if ((a.fixed ?? a.fixedType) === 'right' && (b.fixed ?? b.fixedType) !== 'right') {
|
|
692
|
+
return 1;
|
|
693
|
+
} else if ((a.fixed ?? a.fixedType) !== 'right' && (b.fixed ?? b.fixedType) === 'right') {
|
|
694
|
+
return -1;
|
|
695
|
+
}
|
|
696
|
+
return 0;
|
|
697
|
+
});
|
|
698
|
+
} else {
|
|
699
|
+
return [];
|
|
700
|
+
}
|
|
701
|
+
};
|
|
702
|
+
exports.sortByType = sortByType;
|
|
703
|
+
function getVisibleColumnFields(columns) {
|
|
704
|
+
const result = [];
|
|
705
|
+
const traverse = items => {
|
|
706
|
+
for (const column of items) {
|
|
707
|
+
if (column?.visible === false) continue;
|
|
708
|
+
if (column.field) {
|
|
709
|
+
result.push(column.field);
|
|
710
|
+
}
|
|
711
|
+
if (column.children && column.children?.length) {
|
|
712
|
+
traverse(column.children);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
traverse(columns);
|
|
717
|
+
return result;
|
|
718
|
+
}
|
|
@@ -825,8 +825,8 @@ export type RangeState = {
|
|
|
825
825
|
endRowIndex: number | undefined;
|
|
826
826
|
startColIndex: number | undefined;
|
|
827
827
|
endColIndex: number | undefined;
|
|
828
|
-
rowIds
|
|
829
|
-
colIds
|
|
828
|
+
rowIds?: string[];
|
|
829
|
+
colIds?: string[];
|
|
830
830
|
type?: any;
|
|
831
831
|
};
|
|
832
832
|
export type Sorter = {
|
|
@@ -170,9 +170,17 @@ const InternalTable = props => {
|
|
|
170
170
|
selectedRowKeys,
|
|
171
171
|
defaultSelectedRowKeys
|
|
172
172
|
} = selectionSettings ?? {};
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
|
|
174
|
+
// const [mergedSelectedKeys] = useMergedState(
|
|
175
|
+
// selectedRowKeys || defaultSelectedRowKeys || [],
|
|
176
|
+
// {
|
|
177
|
+
// value: selectedRowKeys,
|
|
178
|
+
// },
|
|
179
|
+
// );
|
|
180
|
+
|
|
181
|
+
const mergedSelectedKeys = _react.default.useMemo(() => {
|
|
182
|
+
return selectedRowKeys ?? defaultSelectedRowKeys ?? [];
|
|
183
|
+
}, [defaultSelectedRowKeys, selectedRowKeys]);
|
|
176
184
|
const mergedData = _react.default.useMemo(() => {
|
|
177
185
|
return (0, _utils.filterDataByColumns)(convertData, onFilter ? undefined : filterStates ?? defaultFilter, onSorter ? undefined : sorterStates ?? defaultSorter, mergedFilterKeys, ignoreAccents);
|
|
178
186
|
}, [convertData, filterStates, mergedFilterKeys, sorterStates, ignoreAccents, defaultFilter, defaultSorter, onFilter, onSorter]);
|