es-grid-template 1.2.1 → 1.2.2
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/assets/index.css +33 -17
- package/assets/index.scss +62 -5
- package/es/grid-component/GridStyle.js +1 -1
- package/es/grid-component/InternalTable.d.ts +1 -0
- package/es/grid-component/InternalTable.js +2 -1
- package/es/grid-component/TableGrid.js +3 -13
- package/es/grid-component/hooks/content/HeaderContent.js +6 -7
- package/es/grid-component/hooks/useColumns.js +10 -2
- package/es/grid-component/hooks/utils.d.ts +2 -22
- package/es/grid-component/hooks/utils.js +2 -410
- package/es/grid-component/styles.scss +62 -5
- package/es/grid-component/table/Grid.js +17 -1
- package/es/grid-component/table/GridEdit.js +383 -158
- package/es/grid-component/type.d.ts +1 -1
- package/lib/grid-component/GridStyle.js +1 -1
- package/lib/grid-component/InternalTable.d.ts +1 -0
- package/lib/grid-component/InternalTable.js +2 -1
- package/lib/grid-component/TableGrid.js +4 -13
- package/lib/grid-component/hooks/content/HeaderContent.js +6 -7
- package/lib/grid-component/hooks/useColumns.js +10 -2
- package/lib/grid-component/hooks/utils.d.ts +2 -22
- package/lib/grid-component/hooks/utils.js +3 -419
- package/lib/grid-component/styles.scss +62 -5
- package/lib/grid-component/table/Grid.js +17 -1
- package/lib/grid-component/table/GridEdit.js +382 -157
- package/lib/grid-component/type.d.ts +1 -1
- package/package.json +2 -2
|
@@ -494,400 +494,6 @@ export const getRowsPasteIndex = pasteRows => {
|
|
|
494
494
|
const result = Array.from(pasteRows).map(item => parseInt(item.split("-")[0]));
|
|
495
495
|
return [...new Set(result)];
|
|
496
496
|
};
|
|
497
|
-
|
|
498
|
-
// export const fff = [
|
|
499
|
-
// [1,'1998-11-03T18:20:45+07:00', "Fadel Groves", "C", true],
|
|
500
|
-
// ]
|
|
501
|
-
//
|
|
502
|
-
// export const oooo = [
|
|
503
|
-
// [1,'1998-11-03T18:20:45+07:00', "Fadel Groves", "C", true],
|
|
504
|
-
// [1,'1998-11-04T18:20:45+07:00', "Fadel Groves", "C", true],
|
|
505
|
-
// [1,'1998-11-05T18:20:45+07:00', "Fadel Groves", "C", true],
|
|
506
|
-
// [1,'1998-11-06T18:20:45+07:00', "Fadel Groves", "C", true],
|
|
507
|
-
// ]
|
|
508
|
-
//
|
|
509
|
-
// export const iii = [
|
|
510
|
-
// [1,'1998-11-03T18:20:45+07:00', "Fadel Groves", "C", true],
|
|
511
|
-
// [2,'1998-11-07T18:20:45+07:00', "Fahey Roads", "C", true],
|
|
512
|
-
// [3,'1998-11-19T18:20:45+07:00', "tess", "C", true],
|
|
513
|
-
// ]
|
|
514
|
-
//
|
|
515
|
-
// export const jjj = [
|
|
516
|
-
// [1,'1998-11-03T18:20:45+07:00', "Fadel Groves", "C", true],
|
|
517
|
-
// [2,'1998-11-07T18:20:45+07:00', "Fahey Roads", "C", true],
|
|
518
|
-
// [3,'1998-11-19T18:20:45+07:00', "tess", "C", true],
|
|
519
|
-
//
|
|
520
|
-
// [4,'1998-11-03T18:20:45+07:00', "Fadel Groves", "C", true],
|
|
521
|
-
// [5,'1998-11-07T18:20:45+07:00', "Fahey Roads", "C", true],
|
|
522
|
-
// [6,'1998-11-19T18:20:45+07:00', "tess", "C", true],
|
|
523
|
-
// ]
|
|
524
|
-
//
|
|
525
|
-
//
|
|
526
|
-
export const mmm = [[1, '1998-11-03T18:20:45+07:00', "Fadel Groves", "C", true], [3, '1998-11-04T18:20:45+07:00', "Fahey Roads", "C", true], [5, '1998-11-05T18:20:45+07:00', "tess", "C", true]];
|
|
527
|
-
//
|
|
528
|
-
// export const nnn = [
|
|
529
|
-
// [1,'1998-11-03T18:20:45+07:00', "Fadel Groves", "C", true],
|
|
530
|
-
// [2,'1998-11-04T18:20:45+07:00', "Fahey Roads", "C", true],
|
|
531
|
-
// [3,'1998-11-05T18:20:45+07:00', "tess", "C", true],
|
|
532
|
-
//
|
|
533
|
-
// [4,'1998-11-06T18:20:45+07:00', "Fadel Groves", "C", true],
|
|
534
|
-
// [5,'1998-11-07T18:20:45+07:00', "Fahey Roads", "C", true],
|
|
535
|
-
// [6,'1998-11-08T18:20:45+07:00', "tess", "C", true],
|
|
536
|
-
// ]
|
|
537
|
-
|
|
538
|
-
export function cloneRows(array, numRows) {
|
|
539
|
-
const result = [...array]; // Sao chép mảng ban đầu
|
|
540
|
-
|
|
541
|
-
for (let i = 0; i < numRows; i++) {
|
|
542
|
-
const lastId = result[result.length - 1][0]; // Lấy ID cuối cùng hiện có
|
|
543
|
-
|
|
544
|
-
for (let j = 0; j < array.length - 1; j++) {
|
|
545
|
-
// Nhân bản trừ dòng cuối
|
|
546
|
-
const newRow = [lastId + j + 1, array[j][1]]; // Tăng ID và giữ nguyên giá trị cột 2
|
|
547
|
-
result.push(newRow);
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
return result;
|
|
551
|
-
}
|
|
552
|
-
export function addRows1(arr, n) {
|
|
553
|
-
// const newArr = [...arr]; // Sao chép mảng gốc để không sửa đổi trực tiếp
|
|
554
|
-
// const baseIndex = arr[arr.length - 1][0]; // Lấy chỉ mục cuối cùng
|
|
555
|
-
//
|
|
556
|
-
// for (let i = 0; i < n; i++) {
|
|
557
|
-
// const newIndex = baseIndex + 1 + i;
|
|
558
|
-
// const newRow = [newIndex, ...arr[i % arr.length].slice(1)]; // Lặp lại các phần tử còn lại theo vòng tròn
|
|
559
|
-
// newArr.push(newRow);
|
|
560
|
-
// }
|
|
561
|
-
//
|
|
562
|
-
// return newArr;
|
|
563
|
-
|
|
564
|
-
const newArr = [...arr]; // Sao chép mảng gốc để không sửa đổi trực tiếp
|
|
565
|
-
|
|
566
|
-
if (arr.length === 1) {
|
|
567
|
-
// Nếu chỉ có một phần tử, lặp lại phần tử đó n lần
|
|
568
|
-
for (let i = 0; i < n; i++) {
|
|
569
|
-
newArr.push([...arr[0]]);
|
|
570
|
-
}
|
|
571
|
-
} else {
|
|
572
|
-
const baseIndex = arr[arr.length - 1][0]; // Lấy chỉ mục cuối cùng
|
|
573
|
-
|
|
574
|
-
for (let i = 0; i < n; i++) {
|
|
575
|
-
const newIndex = baseIndex + 1 + i;
|
|
576
|
-
const newRow = [newIndex, ...arr[i % arr.length].slice(1)]; // Lặp lại các phần tử còn lại theo vòng tròn
|
|
577
|
-
newArr.push(newRow);
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
return newArr;
|
|
581
|
-
}
|
|
582
|
-
export function addRows2(arr, n) {
|
|
583
|
-
const newArr = [...arr]; // Sao chép mảng gốc để không sửa đổi trực tiếp
|
|
584
|
-
const addedRows = [];
|
|
585
|
-
if (arr.length === 1) {
|
|
586
|
-
// Nếu chỉ có một phần tử, lặp lại phần tử đó n lần
|
|
587
|
-
for (let i = 0; i < n; i++) {
|
|
588
|
-
newArr.push([...arr[0]]);
|
|
589
|
-
addedRows.push([...arr[0]]);
|
|
590
|
-
}
|
|
591
|
-
} else {
|
|
592
|
-
const differences = [];
|
|
593
|
-
for (let i = 1; i < arr.length; i++) {
|
|
594
|
-
differences.push(arr[i][0] - arr[i - 1][0]);
|
|
595
|
-
}
|
|
596
|
-
const step = differences.reduce((a, b) => a + b, 0) / differences.length; // Tính khoảng cách trung bình
|
|
597
|
-
|
|
598
|
-
for (let i = 0; i < n; i++) {
|
|
599
|
-
const newIndex = newArr[newArr.length - 1][0] + step;
|
|
600
|
-
const newRow = [newIndex, ...arr[i % arr.length].slice(1)]; // Lặp lại nội dung theo vòng tròn
|
|
601
|
-
newArr.push(newRow);
|
|
602
|
-
addedRows.push(newRow);
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
return {
|
|
606
|
-
newArr,
|
|
607
|
-
addedRows
|
|
608
|
-
};
|
|
609
|
-
}
|
|
610
|
-
export function addRows(arr, n) {
|
|
611
|
-
const newArr = [...arr]; // Sao chép mảng gốc để không sửa đổi trực tiếp
|
|
612
|
-
const addedRows = [];
|
|
613
|
-
if (arr.length === 1) {
|
|
614
|
-
for (let i = 0; i < n; i++) {
|
|
615
|
-
newArr.push([...arr[0]]);
|
|
616
|
-
addedRows.push([...arr[0]]);
|
|
617
|
-
}
|
|
618
|
-
} else {
|
|
619
|
-
const diffs = arr[0].map((_, colIndex) => {
|
|
620
|
-
if (typeof arr[0][colIndex] === 'number') {
|
|
621
|
-
return arr[1][colIndex] - arr[0][colIndex];
|
|
622
|
-
} else if (!isNaN(Date.parse(arr[0][colIndex]))) {
|
|
623
|
-
console.log('Date.parse(arr[0][colIndex])', Date.parse(arr[0][colIndex]));
|
|
624
|
-
console.log('arr[0][colIndex]', arr[0][colIndex]);
|
|
625
|
-
// @ts-ignore
|
|
626
|
-
return new Date(arr[1][colIndex]) - new Date(arr[0][colIndex]);
|
|
627
|
-
}
|
|
628
|
-
return null;
|
|
629
|
-
});
|
|
630
|
-
console.log('diffs', diffs);
|
|
631
|
-
for (let i = 0; i < n; i++) {
|
|
632
|
-
const lastRow = [...newArr[newArr.length - 1]];
|
|
633
|
-
const newRow = lastRow.map((value, colIndex) => {
|
|
634
|
-
if (typeof value === 'number' && diffs[colIndex] !== null) {
|
|
635
|
-
return value + diffs[colIndex];
|
|
636
|
-
} else if (!isNaN(Date.parse(value)) && diffs[colIndex] !== null) {
|
|
637
|
-
const lastDate = new Date(value);
|
|
638
|
-
return moment(new Date(lastDate.getTime() + diffs[colIndex])).format();
|
|
639
|
-
} else return arr[i % arr.length][colIndex]; // Lặp lại nội dung theo vòng tròn
|
|
640
|
-
// arr[i % arr.length].slice(1)
|
|
641
|
-
// return value;
|
|
642
|
-
});
|
|
643
|
-
newArr.push(newRow);
|
|
644
|
-
addedRows.push(newRow);
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
return {
|
|
648
|
-
newArr,
|
|
649
|
-
addedRows
|
|
650
|
-
};
|
|
651
|
-
}
|
|
652
|
-
export function addRows4(arr, n) {
|
|
653
|
-
const newArr = [...arr]; // Sao chép mảng gốc để không sửa đổi trực tiếp
|
|
654
|
-
const addedRows = [];
|
|
655
|
-
if (arr.length === 1) {
|
|
656
|
-
for (let i = 0; i < n; i++) {
|
|
657
|
-
newArr.push([...arr[0]]);
|
|
658
|
-
addedRows.push([...arr[0]]);
|
|
659
|
-
}
|
|
660
|
-
} else {
|
|
661
|
-
const diffs = arr[0].map((_, colIndex) => {
|
|
662
|
-
if (typeof arr[0][colIndex] === 'number') {
|
|
663
|
-
return arr[1][colIndex] - arr[0][colIndex];
|
|
664
|
-
} else if (!isNaN(Date.parse(arr[0][colIndex]))) {
|
|
665
|
-
// @ts-ignore
|
|
666
|
-
return new Date(arr[1][colIndex]) - new Date(arr[0][colIndex]);
|
|
667
|
-
}
|
|
668
|
-
return null;
|
|
669
|
-
});
|
|
670
|
-
for (let i = 0; i < n; i++) {
|
|
671
|
-
const lastRow = [...newArr[newArr.length - 1]];
|
|
672
|
-
const newRow = lastRow.map((value, colIndex) => {
|
|
673
|
-
if (typeof value === 'number' && diffs[colIndex] !== null) {
|
|
674
|
-
return value + diffs[colIndex];
|
|
675
|
-
} else if (!isNaN(Date.parse(value)) && diffs[colIndex] !== null) {
|
|
676
|
-
const lastDate = new Date(value);
|
|
677
|
-
return new Date(lastDate.getTime() + diffs[colIndex]).toISOString();
|
|
678
|
-
} else if (typeof value === 'string') {
|
|
679
|
-
return arr[(i + 1) % arr.length][colIndex]; // Lặp lại nội dung theo vòng tròn
|
|
680
|
-
}
|
|
681
|
-
return value;
|
|
682
|
-
});
|
|
683
|
-
newArr.push(newRow);
|
|
684
|
-
addedRows.push(newRow);
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
return {
|
|
688
|
-
newArr,
|
|
689
|
-
addedRows
|
|
690
|
-
};
|
|
691
|
-
}
|
|
692
|
-
export function addRows6(arr, n) {
|
|
693
|
-
// const newArr = [...arr]; // Sao chép mảng gốc để không sửa đổi trực tiếp
|
|
694
|
-
// const addedRows = [];
|
|
695
|
-
//
|
|
696
|
-
// if (arr.length === 1) {
|
|
697
|
-
// for (let i = 0; i < n; i++) {
|
|
698
|
-
// newArr.push([...arr[0]]);
|
|
699
|
-
// addedRows.push([...arr[0]]);
|
|
700
|
-
// }
|
|
701
|
-
// } else {
|
|
702
|
-
// const diffs = arr[0].map((_: any, colIndex: number) => {
|
|
703
|
-
// if (typeof arr[0][colIndex] === 'number') {
|
|
704
|
-
// return arr[1][colIndex] - arr[0][colIndex];
|
|
705
|
-
// } else if (!isNaN(Date.parse(arr[0][colIndex])) && arr.length === 2) {
|
|
706
|
-
// // @ts-ignore
|
|
707
|
-
// return new Date(arr[1][colIndex]) - new Date(arr[0][colIndex]);
|
|
708
|
-
// }
|
|
709
|
-
// return null;
|
|
710
|
-
// });
|
|
711
|
-
//
|
|
712
|
-
// for (let i = 0; i < n; i++) {
|
|
713
|
-
// const lastRow = [...newArr[newArr.length - 1]];
|
|
714
|
-
//
|
|
715
|
-
// const newRow = lastRow.map((value, colIndex) => {
|
|
716
|
-
// if (typeof value === 'number' && diffs[colIndex] !== null) {
|
|
717
|
-
// return value + diffs[colIndex];
|
|
718
|
-
// } else if (!isNaN(Date.parse(value))) {
|
|
719
|
-
// if (arr.length > 2) {
|
|
720
|
-
// return arr[(i) % arr.length][colIndex]; // Lặp lại nội dung theo vòng tròn
|
|
721
|
-
// } else if (diffs[colIndex] !== null) {
|
|
722
|
-
// const lastDate = new Date(value);
|
|
723
|
-
// return new Date(lastDate.getTime() + diffs[colIndex]).toISOString();
|
|
724
|
-
// }
|
|
725
|
-
// } else if (typeof value === 'string') {
|
|
726
|
-
// return arr[(i) % arr.length][colIndex]; // Lặp lại nội dung theo vòng tròn
|
|
727
|
-
// }
|
|
728
|
-
// return value;
|
|
729
|
-
// });
|
|
730
|
-
//
|
|
731
|
-
// newArr.push(newRow);
|
|
732
|
-
// addedRows.push(newRow);
|
|
733
|
-
// }
|
|
734
|
-
// }
|
|
735
|
-
//
|
|
736
|
-
// return { newArr, addedRows };
|
|
737
|
-
|
|
738
|
-
const newArr = [...arr]; // Sao chép mảng gốc để không sửa đổi trực tiếp
|
|
739
|
-
const addedRows = [];
|
|
740
|
-
if (arr.length === 1) {
|
|
741
|
-
for (let i = 0; i < n; i++) {
|
|
742
|
-
newArr.push([...arr[0]]);
|
|
743
|
-
addedRows.push([...arr[0]]);
|
|
744
|
-
}
|
|
745
|
-
} else {
|
|
746
|
-
const diffs = arr[0].map((_, colIndex) => {
|
|
747
|
-
if (typeof arr[0][colIndex] === 'number') {
|
|
748
|
-
return arr[1][colIndex] - arr[0][colIndex];
|
|
749
|
-
} else if (!isNaN(Date.parse(arr[0][colIndex]))) {
|
|
750
|
-
// @ts-ignore
|
|
751
|
-
const dateDiffs = arr.slice(1).map((row, i) => new Date(row[colIndex]) - new Date(arr[i][colIndex]));
|
|
752
|
-
const avgDiff = dateDiffs.reduce((a, b) => a + b, 0) / dateDiffs.length;
|
|
753
|
-
return avgDiff || null;
|
|
754
|
-
}
|
|
755
|
-
return null;
|
|
756
|
-
});
|
|
757
|
-
for (let i = 0; i < n; i++) {
|
|
758
|
-
const lastRow = [...newArr[newArr.length - 1]];
|
|
759
|
-
const newRow = lastRow.map((value, colIndex) => {
|
|
760
|
-
if (typeof value === 'number' && diffs[colIndex] !== null) {
|
|
761
|
-
return value + diffs[colIndex];
|
|
762
|
-
} else if (!isNaN(Date.parse(value)) && diffs[colIndex] !== null) {
|
|
763
|
-
const lastDate = new Date(value);
|
|
764
|
-
return new Date(lastDate.getTime() + diffs[colIndex]).toISOString();
|
|
765
|
-
} else {
|
|
766
|
-
return arr[i % arr.length][colIndex]; // Lặp lại nội dung theo vòng tròn
|
|
767
|
-
}
|
|
768
|
-
});
|
|
769
|
-
newArr.push(newRow);
|
|
770
|
-
addedRows.push(newRow);
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
return {
|
|
774
|
-
newArr,
|
|
775
|
-
addedRows
|
|
776
|
-
};
|
|
777
|
-
}
|
|
778
|
-
export function addRows7(arr, n) {
|
|
779
|
-
if (!Array.isArray(arr) || arr.length === 0) return arr;
|
|
780
|
-
const m = arr.length;
|
|
781
|
-
const numCols = arr[0].length;
|
|
782
|
-
const newRows = [];
|
|
783
|
-
|
|
784
|
-
// Hàm kiểm tra kiểu date hợp lệ
|
|
785
|
-
const isValidDate = d => {
|
|
786
|
-
return !isNaN(Date.parse(d));
|
|
787
|
-
};
|
|
788
|
-
|
|
789
|
-
// Lấy giá trị mẫu của cột j từ hàng i (i thuộc [0, m-1])
|
|
790
|
-
const getSample = j => arr[0][j];
|
|
791
|
-
|
|
792
|
-
// Xác định cho mỗi cột chế độ xử lý:
|
|
793
|
-
// mode = 'number-stepping' | 'date-stepping' | 'cycle'
|
|
794
|
-
const modes = [];
|
|
795
|
-
const steps = []; // bước tăng, nếu có (cho number hoặc date)
|
|
796
|
-
|
|
797
|
-
for (let j = 0; j < numCols; j++) {
|
|
798
|
-
const sample = getSample(j);
|
|
799
|
-
if (m === 1) {
|
|
800
|
-
// Nếu mảng chỉ có 1 hàng: nếu là số thì giữ nguyên; nếu là date thì tăng 1 ngày; còn lại giữ nguyên.
|
|
801
|
-
if (typeof sample === "number") {
|
|
802
|
-
modes[j] = "number-constant";
|
|
803
|
-
} else if (isValidDate(sample)) {
|
|
804
|
-
modes[j] = "date-stepping";
|
|
805
|
-
steps[j] = 24 * 3600 * 1000; // 1 ngày = 86400000 ms
|
|
806
|
-
} else {
|
|
807
|
-
modes[j] = "cycle";
|
|
808
|
-
}
|
|
809
|
-
} else if (m === 2) {
|
|
810
|
-
// Nếu mảng có 2 hàng: nếu là số thì tính bước = row2 - row1, tương tự với date
|
|
811
|
-
const first = arr[0][j],
|
|
812
|
-
second = arr[1][j];
|
|
813
|
-
if (typeof first === "number" && typeof second === "number") {
|
|
814
|
-
modes[j] = "number-stepping";
|
|
815
|
-
steps[j] = second - first;
|
|
816
|
-
} else if (isValidDate(first) && isValidDate(second)) {
|
|
817
|
-
modes[j] = "date-stepping";
|
|
818
|
-
steps[j] = Date.parse(second) - Date.parse(first);
|
|
819
|
-
} else {
|
|
820
|
-
modes[j] = "cycle";
|
|
821
|
-
}
|
|
822
|
-
} else {
|
|
823
|
-
// mảng có >2 hàng
|
|
824
|
-
const first = arr[0][j],
|
|
825
|
-
second = arr[1][j],
|
|
826
|
-
third = arr[2][j];
|
|
827
|
-
if (typeof first === "number" && typeof second === "number" && typeof third === "number") {
|
|
828
|
-
const step1 = second - first;
|
|
829
|
-
const step2 = third - second;
|
|
830
|
-
if (step1 === step2) {
|
|
831
|
-
modes[j] = "number-stepping";
|
|
832
|
-
steps[j] = step1;
|
|
833
|
-
} else {
|
|
834
|
-
modes[j] = "cycle";
|
|
835
|
-
}
|
|
836
|
-
} else if (isValidDate(first) && isValidDate(second) && isValidDate(third)) {
|
|
837
|
-
const step1 = Date.parse(second) - Date.parse(first);
|
|
838
|
-
const step2 = Date.parse(third) - Date.parse(second);
|
|
839
|
-
if (step1 === step2) {
|
|
840
|
-
modes[j] = "date-stepping";
|
|
841
|
-
steps[j] = step1;
|
|
842
|
-
} else {
|
|
843
|
-
modes[j] = "cycle";
|
|
844
|
-
}
|
|
845
|
-
} else {
|
|
846
|
-
modes[j] = "cycle";
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
// Tạo các dòng mới (thêm n dòng)
|
|
852
|
-
// Với mỗi cột, nếu chế độ là stepping thì lấy giá trị cuối của mảng ban đầu, cộng thêm (i+1)*step
|
|
853
|
-
// Nếu chế độ là cycle thì dùng arr[i mod m][j]
|
|
854
|
-
for (let i = 0; i < n; i++) {
|
|
855
|
-
const newRow = [];
|
|
856
|
-
for (let j = 0; j < numCols; j++) {
|
|
857
|
-
let newValue;
|
|
858
|
-
switch (modes[j]) {
|
|
859
|
-
case "number-constant":
|
|
860
|
-
// mảng có 1 hàng, số giữ nguyên
|
|
861
|
-
newValue = arr[0][j];
|
|
862
|
-
break;
|
|
863
|
-
case "number-stepping":
|
|
864
|
-
{
|
|
865
|
-
// lấy giá trị cuối của cột j trong mảng ban đầu
|
|
866
|
-
const lastValue = arr[m - 1][j];
|
|
867
|
-
newValue = lastValue + (i + 1) * steps[j];
|
|
868
|
-
}
|
|
869
|
-
break;
|
|
870
|
-
case "date-stepping":
|
|
871
|
-
{
|
|
872
|
-
// lấy giá trị cuối, chuyển về date, cộng thêm (i+1)*step, convert về ISO string giữ định dạng ban đầu (nếu cần giữ định dạng như cũ)
|
|
873
|
-
const lastDate = new Date(arr[m - 1][j]);
|
|
874
|
-
const newTime = lastDate.getTime() + (i + 1) * steps[j];
|
|
875
|
-
// Giữ định dạng ISO với timezone tương tự nếu cần.
|
|
876
|
-
newValue = new Date(newTime).toISOString();
|
|
877
|
-
}
|
|
878
|
-
break;
|
|
879
|
-
case "cycle":
|
|
880
|
-
default:
|
|
881
|
-
// Lặp lại nội dung theo vòng tròn: dùng hàng thứ (i mod m)
|
|
882
|
-
newValue = arr[i % m][j];
|
|
883
|
-
break;
|
|
884
|
-
}
|
|
885
|
-
newRow.push(newValue);
|
|
886
|
-
}
|
|
887
|
-
newRows.push(newRow);
|
|
888
|
-
}
|
|
889
|
-
return arr.concat(newRows);
|
|
890
|
-
}
|
|
891
497
|
export function addRows8(arr, n) {
|
|
892
498
|
if (!Array.isArray(arr) || arr.length === 0) return {
|
|
893
499
|
combined: arr,
|
|
@@ -1025,7 +631,7 @@ export const transformColumns = (cols, convertColumns, t) => {
|
|
|
1025
631
|
return {
|
|
1026
632
|
...column,
|
|
1027
633
|
key: column.field ?? column.dataIndex ?? column.key,
|
|
1028
|
-
title: t ? t(column.headerText
|
|
634
|
+
title: t ? t(column.headerText) : column.headerText,
|
|
1029
635
|
ellipsis: column.ellipsis !== false,
|
|
1030
636
|
align: column.textAlign ?? column.align,
|
|
1031
637
|
children: transformColumns(column.children, convertColumns)
|
|
@@ -1084,8 +690,6 @@ export const transformColumns1 = (cols, sortMultiple) => {
|
|
|
1084
690
|
};
|
|
1085
691
|
export const removeColumns = (columns, groupColumns) => {
|
|
1086
692
|
const ttt = [...columns];
|
|
1087
|
-
|
|
1088
|
-
// @ts-ignore
|
|
1089
693
|
return ttt.filter(column => !groupColumns.includes(column.field)).map(column => {
|
|
1090
694
|
const newCol = {
|
|
1091
695
|
...column
|
|
@@ -1107,16 +711,4 @@ export const convertFlatColumn = array => {
|
|
|
1107
711
|
}
|
|
1108
712
|
});
|
|
1109
713
|
return result;
|
|
1110
|
-
};
|
|
1111
|
-
|
|
1112
|
-
// export const getColumnsByKeys = (columns: ColumnsTable, keys: string[]) => {
|
|
1113
|
-
// if (!columns || !keys) {
|
|
1114
|
-
// return[]
|
|
1115
|
-
// }
|
|
1116
|
-
//
|
|
1117
|
-
// return flatColumns2(columns).filter((column) => keys.includes(column.field as string)).map((it) => {
|
|
1118
|
-
// return {...it, value: it.field, label: it.headerText}
|
|
1119
|
-
// })
|
|
1120
|
-
//
|
|
1121
|
-
//
|
|
1122
|
-
// }
|
|
714
|
+
};
|
|
@@ -36,6 +36,13 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
36
36
|
margin: 0;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
.ui-rc-table {
|
|
40
|
+
//font-family: $fontFamily;
|
|
41
|
+
color: #000000de;
|
|
42
|
+
//font-weight: 500;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
39
46
|
|
|
40
47
|
&.table-none-column-select {
|
|
41
48
|
.#{$prefix}-table-cell {
|
|
@@ -178,12 +185,14 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
178
185
|
}
|
|
179
186
|
|
|
180
187
|
.#{$prefix}-table-thead {
|
|
188
|
+
//font-weight: 400;
|
|
181
189
|
|
|
182
190
|
> tr {
|
|
183
191
|
> th,
|
|
184
192
|
> td {
|
|
185
193
|
border-bottom: 1px solid $tableBorderColor;
|
|
186
|
-
background: #fff;
|
|
194
|
+
//background: #fff;
|
|
195
|
+
font-weight: 500;
|
|
187
196
|
}
|
|
188
197
|
}
|
|
189
198
|
|
|
@@ -326,6 +335,7 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
326
335
|
overflow: unset;
|
|
327
336
|
|
|
328
337
|
display: flex;
|
|
338
|
+
//--------
|
|
329
339
|
padding: 0;
|
|
330
340
|
|
|
331
341
|
.#{$prefix}-table-row-expand-icon {
|
|
@@ -342,14 +352,26 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
342
352
|
border-bottom: 1px solid $border-selected-color;
|
|
343
353
|
}
|
|
344
354
|
|
|
355
|
+
&.cell-paste-border-bottom {
|
|
356
|
+
border-bottom: 1px dashed #949494;
|
|
357
|
+
}
|
|
358
|
+
|
|
345
359
|
&.cell-border-left {
|
|
346
360
|
border-inline-end: 1px solid $border-selected-color;
|
|
347
361
|
}
|
|
348
362
|
|
|
363
|
+
&.cell-paste-border-left {
|
|
364
|
+
border-inline-end: 1px dashed #949494;
|
|
365
|
+
}
|
|
366
|
+
|
|
349
367
|
&.cell-border-right {
|
|
350
368
|
border-inline-end: 1px solid $border-selected-color;
|
|
351
369
|
}
|
|
352
370
|
|
|
371
|
+
&.cell-paste-border-right {
|
|
372
|
+
border-inline-end: 1px dashed #949494;
|
|
373
|
+
}
|
|
374
|
+
|
|
353
375
|
&.#{$prefix}-table-cell-fix-left {
|
|
354
376
|
&:has(.ui-rc_cell-content.selected) {
|
|
355
377
|
}
|
|
@@ -383,11 +405,23 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
383
405
|
}
|
|
384
406
|
}
|
|
385
407
|
|
|
408
|
+
|
|
409
|
+
&.next-cell-paste-border-left {
|
|
410
|
+
&::before {
|
|
411
|
+
border-inline-start: 1px dashed #949494;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
386
415
|
&.fixed-cell-border-left {
|
|
387
416
|
&::before {
|
|
388
417
|
border-inline-start: 1px solid $border-selected-color;
|
|
389
418
|
}
|
|
390
419
|
}
|
|
420
|
+
&.fixed-cell-paste-border-left {
|
|
421
|
+
&::before {
|
|
422
|
+
border-inline-start: 1px dashed #949494;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
391
425
|
|
|
392
426
|
}
|
|
393
427
|
|
|
@@ -493,14 +527,16 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
493
527
|
.#{$prefix}-table.#{$prefix}-table-small {
|
|
494
528
|
.#{$prefix}-table-selection-column{
|
|
495
529
|
//padding: 8px 8px;
|
|
530
|
+
padding: 6px 8px;
|
|
496
531
|
}
|
|
497
532
|
}
|
|
498
533
|
|
|
499
534
|
.ui-rc_cell-content {
|
|
500
535
|
//position: relative;
|
|
501
536
|
user-select: none;
|
|
502
|
-
padding: 8px 8px;
|
|
503
|
-
|
|
537
|
+
//padding: 8px 8px;
|
|
538
|
+
padding: 7px 8px;
|
|
539
|
+
//min-height: 23px;
|
|
504
540
|
overflow: hidden;
|
|
505
541
|
|
|
506
542
|
.ui-rc_content {
|
|
@@ -520,6 +556,7 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
520
556
|
cursor: crosshair;
|
|
521
557
|
right: 0;
|
|
522
558
|
bottom: 0;
|
|
559
|
+
//background: red;
|
|
523
560
|
|
|
524
561
|
.dot-point {
|
|
525
562
|
position: absolute;
|
|
@@ -627,7 +664,7 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
627
664
|
}
|
|
628
665
|
|
|
629
666
|
&.cell-editing {
|
|
630
|
-
padding: 0 !important;
|
|
667
|
+
//padding: 0 !important;
|
|
631
668
|
&:focus-visible {
|
|
632
669
|
outline: none;
|
|
633
670
|
}
|
|
@@ -965,7 +1002,7 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
965
1002
|
tfoot > tr > th,
|
|
966
1003
|
tfoot > tr > td {
|
|
967
1004
|
//padding: 8px 8px;
|
|
968
|
-
font-size: 13px;
|
|
1005
|
+
//font-size: 13px;
|
|
969
1006
|
}
|
|
970
1007
|
}
|
|
971
1008
|
}
|
|
@@ -1004,3 +1041,23 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
1004
1041
|
.#{$prefix}-table-wrapper .#{$prefix}-table.#{$prefix}-table-bordered >.#{$prefix}-table-container >.#{$prefix}-table-summary >table >tfoot>tr >.#{$prefix}-table-cell-fix-right-first::after {
|
|
1005
1042
|
border-inline-end: 1px solid $tableBorderColor;
|
|
1006
1043
|
}
|
|
1044
|
+
|
|
1045
|
+
|
|
1046
|
+
// toolbar
|
|
1047
|
+
|
|
1048
|
+
.ui-rc-toolbar-bottom {
|
|
1049
|
+
.be-toolbar-item {
|
|
1050
|
+
.toolbar-dropdown-button {
|
|
1051
|
+
.ant-btn.ant-btn-default.ant-btn-variant-outlined.ant-btn-compact-item.ant-btn-compact-first-item {
|
|
1052
|
+
border-color: #28c76f;
|
|
1053
|
+
}
|
|
1054
|
+
.ant-btn.ant-btn-default.ant-btn-variant-outlined.ant-btn-compact-item.ant-btn-compact-last-item {
|
|
1055
|
+
border-color: #28c76f;
|
|
1056
|
+
.ant-btn-icon {
|
|
1057
|
+
color: #28c76f;
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
@@ -4,6 +4,9 @@ import { GridStyle } from "../GridStyle";
|
|
|
4
4
|
import TableGrid from "../TableGrid";
|
|
5
5
|
// import type {ColumnsTable} from "../type";
|
|
6
6
|
|
|
7
|
+
import { ConfigProvider } from "rc-master-ui";
|
|
8
|
+
// import {ConfigProvider} from "antd";
|
|
9
|
+
|
|
7
10
|
const Grid = props => {
|
|
8
11
|
const {
|
|
9
12
|
height,
|
|
@@ -15,9 +18,22 @@ const Grid = props => {
|
|
|
15
18
|
style: {
|
|
16
19
|
position: 'relative'
|
|
17
20
|
}
|
|
21
|
+
}, /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
22
|
+
theme: {
|
|
23
|
+
components: {
|
|
24
|
+
Table: {
|
|
25
|
+
rowHoverBg: '#eb461912',
|
|
26
|
+
rowSelectedBg: '#eb4619',
|
|
27
|
+
rowSelectedHoverBg: '#eb4619',
|
|
28
|
+
cellFontSize: 12,
|
|
29
|
+
cellFontSizeSM: 13,
|
|
30
|
+
headerBg: '#ffffff'
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
18
34
|
}, /*#__PURE__*/React.createElement(TableGrid, _extends({}, rest, {
|
|
19
35
|
// style={{...style, minHeight: height}}
|
|
20
36
|
rowHoverable: rowHoverable ?? true
|
|
21
|
-
}))));
|
|
37
|
+
})))));
|
|
22
38
|
};
|
|
23
39
|
export default Grid;
|