@guiexpert/vue3-table 3.1.78 → 3.1.80
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/index.cjs +10 -7
- package/index.js +1186 -186
- package/package.json +5 -3
package/index.js
CHANGED
|
@@ -7,14 +7,14 @@ function ne(d, e = 500) {
|
|
|
7
7
|
}, e);
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
|
-
class
|
|
10
|
+
class I {
|
|
11
11
|
// The constructor is private to prevent direct construction calls
|
|
12
12
|
// with the `new` operator
|
|
13
13
|
constructor() {
|
|
14
14
|
this.alreadySet = !1;
|
|
15
15
|
}
|
|
16
16
|
static getInstance() {
|
|
17
|
-
return
|
|
17
|
+
return I.instance || (I.instance = new I()), I.instance;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Method to set the license key for the application.
|
|
@@ -32,18 +32,18 @@ class k {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function O(d) {
|
|
36
36
|
return d && d.type === "TreeRow";
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function $(d) {
|
|
39
39
|
return d && d.type === "AreaModelTree";
|
|
40
40
|
}
|
|
41
|
-
class
|
|
41
|
+
class H {
|
|
42
42
|
constructor(e = -1, t = -1, s = -1, o = -1, i, r, a, l = 0, n = 0, c = 0, p = "") {
|
|
43
43
|
this.rowIndex = e, this.rowTop = t, this.columnIndex = s, this.columnLeft = o, this.areaIdent = i, this.sideIdent = r, this.originalEvent = a, this.clickCount = l, this.draggingX = n, this.draggingY = c, this.action = p;
|
|
44
44
|
}
|
|
45
45
|
clone() {
|
|
46
|
-
return new
|
|
46
|
+
return new H(
|
|
47
47
|
this.rowIndex,
|
|
48
48
|
this.rowTop,
|
|
49
49
|
this.columnIndex,
|
|
@@ -58,25 +58,25 @@ class V {
|
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
class
|
|
61
|
+
class F {
|
|
62
62
|
constructor(e = ">", t = "", s = []) {
|
|
63
63
|
this.content = e, this.style = t, this.classes = s;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
class J {
|
|
67
|
-
constructor(e = new
|
|
67
|
+
constructor(e = new F(
|
|
68
68
|
">",
|
|
69
69
|
"transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",
|
|
70
70
|
["gt-table-tree-arrow-expanded"]
|
|
71
|
-
), t = new
|
|
71
|
+
), t = new F(
|
|
72
72
|
">",
|
|
73
73
|
"",
|
|
74
74
|
["ge-table-tree-arrow-collapsed"]
|
|
75
|
-
), s = new
|
|
75
|
+
), s = new F(
|
|
76
76
|
">",
|
|
77
77
|
"color:transparent;",
|
|
78
78
|
["gt-table-tree-arrow-hidden"]
|
|
79
|
-
), o = new
|
|
79
|
+
), o = new F(
|
|
80
80
|
"↕",
|
|
81
81
|
"",
|
|
82
82
|
["gt-table-tree-arrow-expanded-all"]
|
|
@@ -85,7 +85,7 @@ class J {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
class Z {
|
|
88
|
-
constructor(e = new
|
|
88
|
+
constructor(e = new F("↑", "", ["ge-header-sorted-asc"]), t = new F("↓", "", ["ge-header-sorted-desc"]), s = new F("↑", "color:transparent;", [])) {
|
|
89
89
|
this.iconAsc = e, this.iconDesc = t, this.iconPlaceholder = s;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -177,10 +177,10 @@ class ce {
|
|
|
177
177
|
addColumnDiv(e) {
|
|
178
178
|
const { parent: t, geo: s, rowIndex: o = -1, columnIndex: i = -1, areaIdent: r, sideIdent: a, text: l = "", treeArrow: n, tableOptions: c, checkedType: p = void 0, sortState: h } = e, m = c == null ? void 0 : c.treeOptions, g = c == null ? void 0 : c.showCheckboxWihoutExtraColumn, b = this.domService.createElement("div");
|
|
179
179
|
this.domService.addClass(b, "ge-table-col-div"), g && this.domService.addClass(b, "ge-with-checkbox"), this.domService.addClass(b, `ge-table-col-div-${s.index}`), this.domService.setAttribute(b, "data-col-index", `${s.index}`), this.domService.setAttribute(b, "data-row-index", `${o}`), this.domService.setAttribute(b, "data-area", `${r}`);
|
|
180
|
-
const
|
|
181
|
-
if (r === "body" && a === "center" && this.domService.addClass(b, `ge-table-column-${
|
|
182
|
-
const
|
|
183
|
-
this.addLabelDiv(b, l,
|
|
180
|
+
const u = ((s == null ? void 0 : s.index) ?? 0) % 2 === 0 ? "even" : "odd";
|
|
181
|
+
if (r === "body" && a === "center" && this.domService.addClass(b, `ge-table-column-${u}`), this.domService.setStyle(b, "display", "clip"), this.domService.setStyle(b, "position", "absolute"), this.domService.setStyle(b, "left", `${s.left}px`), this.domService.setStyle(b, "top", `${s.top}px`), this.domService.setStyle(b, "width", `${s.width}px`), this.domService.setStyle(b, "height", `${s.height}px`), n && n !== "none" && (this.domService.addClass(b, "ge-table-col-tree"), this.addArrowDiv(b, n, m, o, i, r)), g && i === 0 && p && this.addCheckboxToDiv(b, p, r, o), l) {
|
|
182
|
+
const f = n !== "none" && i === 0;
|
|
183
|
+
this.addLabelDiv(b, l, f, o, i, r);
|
|
184
184
|
}
|
|
185
185
|
return h && this.addSortedIcon(b, h, c == null ? void 0 : c.sortedOptions, i), this.domService.appendChild(t, b), b;
|
|
186
186
|
}
|
|
@@ -323,7 +323,7 @@ class he {
|
|
|
323
323
|
this.tableScope.toggleHeaderGroup(s), e.preventDefault(), e.stopPropagation();
|
|
324
324
|
else if (s.inputType === "checkbox" && s.areaIdent)
|
|
325
325
|
this.tableScope.toggleRowCheckbox(s.rowIdx, s.colIdx, s.areaIdent), e.preventDefault(), e.stopPropagation();
|
|
326
|
-
else if (
|
|
326
|
+
else if (O(s.row) && s.areaModel) {
|
|
327
327
|
const o = s.colIdx === this.getArrowColumnIndex() && e.altKey, i = s.className.includes("ge-table-tree-arrow-div");
|
|
328
328
|
if (o || i) {
|
|
329
329
|
e.preventDefault(), e.stopPropagation();
|
|
@@ -350,7 +350,7 @@ class he {
|
|
|
350
350
|
this.tableScope.tableModel.isSortable(r) && (this.tableScope.clearSelection(), this.tableScope.onHeaderDblClicked(e, i, r));
|
|
351
351
|
else if (t.getAttribute("data-row-index")) {
|
|
352
352
|
const l = a.getRowByIndex(i);
|
|
353
|
-
if (s && o === "body" && a.isEditable(i, r) && (this.tableScope.clearSelection(), this.tableScope.initRenderEditor(i, r)),
|
|
353
|
+
if (s && o === "body" && a.isEditable(i, r) && (this.tableScope.clearSelection(), this.tableScope.initRenderEditor(i, r)), O(l) && r === this.getArrowColumnIndex()) {
|
|
354
354
|
e.preventDefault(), e.stopPropagation();
|
|
355
355
|
const n = l;
|
|
356
356
|
n.expanded = !n.expanded, "recalcVisibleTreeRows" in a && a.recalcVisibleTreeRows(), this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth), this.tableScope.adjustContainersAndRows(), this.updateCollapsedExpandedState(n);
|
|
@@ -534,77 +534,307 @@ class ge {
|
|
|
534
534
|
return s * ("" + e).localeCompare("" + t);
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
|
-
class
|
|
537
|
+
class D extends pe {
|
|
538
|
+
/**
|
|
539
|
+
* Creates an instance of AreaModelObjectArray.
|
|
540
|
+
*
|
|
541
|
+
* @param {AreaIdent} areaIdent - Identifies which area of the table this model represents ('header', 'body', or 'footer')
|
|
542
|
+
* @param {T[]} rows - The array of objects that represent the rows in this area
|
|
543
|
+
* @param {number} defaultRowHeight - The default height for rows in this area (in pixels)
|
|
544
|
+
* @param {ColumnDefIf[]} [columnDefs=[]] - Definitions for the columns in this area
|
|
545
|
+
* @param {string} [selectedRowClass='ge-selected-row'] - CSS class to apply to selected rows
|
|
546
|
+
* @param {string} [focusedRowClass='ge-focused-row'] - CSS class to apply to the focused row
|
|
547
|
+
*
|
|
548
|
+
* @example
|
|
549
|
+
* const rows = [
|
|
550
|
+
* { id: 1, name: 'John', age: 30 },
|
|
551
|
+
* { id: 2, name: 'Jane', age: 25 }
|
|
552
|
+
* ];
|
|
553
|
+
*
|
|
554
|
+
* const columnDefs = [
|
|
555
|
+
* { property: 'id', headerLabel: 'ID', width: 50 },
|
|
556
|
+
* { property: 'name', headerLabel: 'Name', width: 150 },
|
|
557
|
+
* { property: 'age', headerLabel: 'Age', width: 100 }
|
|
558
|
+
* ];
|
|
559
|
+
*
|
|
560
|
+
* const bodyAreaModel = new AreaModelObjectArray(
|
|
561
|
+
* 'body',
|
|
562
|
+
* rows,
|
|
563
|
+
* 30,
|
|
564
|
+
* columnDefs
|
|
565
|
+
* );
|
|
566
|
+
*/
|
|
538
567
|
constructor(e, t, s, o = [], i = "ge-selected-row", r = "ge-focused-row") {
|
|
539
568
|
super(e, o, s), this.areaIdent = e, this.rows = t, this.defaultRowHeight = s, this.columnDefs = o, this.selectedRowClass = i, this.focusedRowClass = r, this.sorterService = new ge(), this._focusedRowIndex = 0, this.filteredRows = [...t], this.properties = o.map((a) => a.property);
|
|
540
569
|
}
|
|
570
|
+
/**
|
|
571
|
+
* Gets the index of the currently focused row.
|
|
572
|
+
*
|
|
573
|
+
* @returns {number} The index of the focused row
|
|
574
|
+
*
|
|
575
|
+
* @example
|
|
576
|
+
* const focusedRowIndex = bodyAreaModel.getFocusedRowIndex();
|
|
577
|
+
* console.log(`The focused row is at index ${focusedRowIndex}`);
|
|
578
|
+
*/
|
|
541
579
|
getFocusedRowIndex() {
|
|
542
580
|
return this._focusedRowIndex;
|
|
543
581
|
}
|
|
582
|
+
/**
|
|
583
|
+
* Sets the index of the focused row.
|
|
584
|
+
* This will apply the focused row styling to the specified row.
|
|
585
|
+
*
|
|
586
|
+
* @param {number} value - The index of the row to focus
|
|
587
|
+
*
|
|
588
|
+
* @example
|
|
589
|
+
* // Focus the second row (index 1)
|
|
590
|
+
* bodyAreaModel.setFocusedRowIndex(1);
|
|
591
|
+
*/
|
|
544
592
|
setFocusedRowIndex(e) {
|
|
545
593
|
this._focusedRowIndex = e;
|
|
546
594
|
}
|
|
595
|
+
/**
|
|
596
|
+
* Replaces the current rows array with a new one.
|
|
597
|
+
* This also resets the filtered rows to match the new rows array.
|
|
598
|
+
*
|
|
599
|
+
* @param {T[]} rows - The new array of row objects
|
|
600
|
+
*
|
|
601
|
+
* @example
|
|
602
|
+
* // Replace the current rows with new data
|
|
603
|
+
* const newRows = [
|
|
604
|
+
* { id: 4, name: 'Alice', age: 35 },
|
|
605
|
+
* { id: 5, name: 'Charlie', age: 45 }
|
|
606
|
+
* ];
|
|
607
|
+
* bodyAreaModel.setRows(newRows);
|
|
608
|
+
*/
|
|
547
609
|
setRows(e) {
|
|
548
610
|
this.rows = e, this.filteredRows = [...e];
|
|
549
611
|
}
|
|
612
|
+
/**
|
|
613
|
+
* Filters both the original rows and filtered rows arrays using the provided predicate function.
|
|
614
|
+
* Unlike `externalFilterChanged`, this method permanently modifies the original rows array.
|
|
615
|
+
*
|
|
616
|
+
* @param {(row: T) => boolean} predict - A function that returns true for rows to keep and false for rows to filter out
|
|
617
|
+
*
|
|
618
|
+
* @example
|
|
619
|
+
* // Remove all rows where age is less than 30
|
|
620
|
+
* bodyAreaModel.filterRowsByPredict(row => row.age >= 30);
|
|
621
|
+
*/
|
|
550
622
|
filterRowsByPredict(e) {
|
|
551
623
|
this.rows = this.rows.filter(e), this.filteredRows = this.filteredRows.filter(e);
|
|
552
624
|
}
|
|
553
625
|
/**
|
|
554
|
-
*
|
|
626
|
+
* Returns the number of rows in the filtered rows array.
|
|
627
|
+
* This is used to determine how many rows should be rendered in the table.
|
|
628
|
+
*
|
|
629
|
+
* @returns {number} The number of rows in the filtered rows array
|
|
630
|
+
*
|
|
631
|
+
* @example
|
|
632
|
+
* const rowCount = bodyAreaModel.getRowCount();
|
|
633
|
+
* console.log(`The table has ${rowCount} rows`);
|
|
555
634
|
*/
|
|
556
635
|
getRowCount() {
|
|
557
636
|
var e;
|
|
558
637
|
return ((e = this.filteredRows) == null ? void 0 : e.length) ?? 0;
|
|
559
638
|
}
|
|
639
|
+
/**
|
|
640
|
+
* Gets the value at the specified row and column indices.
|
|
641
|
+
* This method handles tree rows and nested properties.
|
|
642
|
+
*
|
|
643
|
+
* @param {number} rowIndex - The index of the row
|
|
644
|
+
* @param {number} columnIndex - The index of the column
|
|
645
|
+
* @returns {any} The value at the specified cell, or an empty string if not found
|
|
646
|
+
*
|
|
647
|
+
* @example
|
|
648
|
+
* // Get the value in the first row, second column
|
|
649
|
+
* const value = bodyAreaModel.getValueAt(0, 1);
|
|
650
|
+
* console.log(`The value is: ${value}`);
|
|
651
|
+
*
|
|
652
|
+
* @example
|
|
653
|
+
* // Iterate through all cells in a row
|
|
654
|
+
* const rowIndex = 0;
|
|
655
|
+
* for (let colIndex = 0; colIndex < columnDefs.length; colIndex++) {
|
|
656
|
+
* const value = bodyAreaModel.getValueAt(rowIndex, colIndex);
|
|
657
|
+
* console.log(`Cell (${rowIndex}, ${colIndex}): ${value}`);
|
|
658
|
+
* }
|
|
659
|
+
*/
|
|
560
660
|
getValueAt(e, t) {
|
|
561
661
|
const s = this.properties[t];
|
|
562
662
|
let o = this.filteredRows[e];
|
|
563
|
-
return
|
|
663
|
+
return O(o) && (o = o.data), o ? this.getValueByT(o, s) : "";
|
|
564
664
|
}
|
|
565
665
|
/**
|
|
566
666
|
* Retrieves the filtered and sorted rows from the dataset.
|
|
567
667
|
* These rows are used for rendering the table.
|
|
668
|
+
* Unlike `getAllRows()`, this method returns only the rows that match any applied filters.
|
|
568
669
|
*
|
|
569
|
-
* @
|
|
670
|
+
* @returns {T[]} An array containing the filtered (and sorted) rows
|
|
671
|
+
*
|
|
672
|
+
* @example
|
|
673
|
+
* // Get all filtered rows
|
|
674
|
+
* const filteredRows = bodyAreaModel.getFilteredRows();
|
|
675
|
+
*
|
|
676
|
+
* // Count rows that match a certain condition
|
|
677
|
+
* const adultsCount = filteredRows.filter(row => row.age >= 18).length;
|
|
570
678
|
*/
|
|
571
679
|
getFilteredRows() {
|
|
572
680
|
return this.filteredRows;
|
|
573
681
|
}
|
|
682
|
+
/**
|
|
683
|
+
* Returns the original, unfiltered array of rows.
|
|
684
|
+
* This can be useful when you need to access all data regardless of any applied filters.
|
|
685
|
+
*
|
|
686
|
+
* @returns {T[]} The original array of row objects
|
|
687
|
+
*
|
|
688
|
+
* @example
|
|
689
|
+
* // Get all rows, including those filtered out
|
|
690
|
+
* const allRows = bodyAreaModel.getAllRows();
|
|
691
|
+
*
|
|
692
|
+
* // Calculate average age across all rows
|
|
693
|
+
* const totalAge = allRows.reduce((sum, row) => sum + row.age, 0);
|
|
694
|
+
* const averageAge = totalAge / allRows.length;
|
|
695
|
+
*/
|
|
574
696
|
getAllRows() {
|
|
575
697
|
return this.rows;
|
|
576
698
|
}
|
|
577
699
|
/**
|
|
578
700
|
* Returns the first row from the filtered rows that matches the given criteria based on the provided predicate function.
|
|
701
|
+
* This method only searches within the filtered rows, not the original rows array.
|
|
579
702
|
*
|
|
580
703
|
* @param {Partial<T>} criteria - A partial object containing the search criteria
|
|
581
704
|
* @param {(criteria: Partial<T>, row: T) => boolean} predicate - A function that takes the search criteria and a row,
|
|
582
705
|
* and returns true if the row matches the criteria
|
|
583
706
|
* @returns {T | undefined} The first matching row, or undefined if no match is found
|
|
707
|
+
*
|
|
708
|
+
* @example
|
|
709
|
+
* // Find a user by name in the filtered rows
|
|
710
|
+
* const criteria = { name: 'John' };
|
|
711
|
+
* const user = bodyAreaModel.findRowFromFilteredRowsByAllCriteria(
|
|
712
|
+
* criteria,
|
|
713
|
+
* (criteria, row) => row.name === criteria.name
|
|
714
|
+
* );
|
|
715
|
+
*
|
|
716
|
+
* @example
|
|
717
|
+
* // Find a user by age range in the filtered rows
|
|
718
|
+
* const criteria = { minAge: 25, maxAge: 35 };
|
|
719
|
+
* const user = bodyAreaModel.findRowFromFilteredRowsByAllCriteria(
|
|
720
|
+
* criteria,
|
|
721
|
+
* (criteria, row) => row.age >= criteria.minAge && row.age <= criteria.maxAge
|
|
722
|
+
* );
|
|
584
723
|
*/
|
|
585
724
|
findRowFromFilteredRowsByAllCriteria(e, t) {
|
|
586
725
|
return this.getFilteredRows().find((s) => t(e, s));
|
|
587
726
|
}
|
|
588
727
|
/**
|
|
589
728
|
* Searches through all rows to find a row that matches the given criteria based on the predicate function.
|
|
729
|
+
* This method searches within the original rows array, including rows that may have been filtered out.
|
|
590
730
|
*
|
|
591
731
|
* @param {Partial<T>} criteria - A partial object containing the search criteria
|
|
592
732
|
* @param {(criteria: Partial<T>, row: T) => boolean} predicate - A function that takes the search criteria and a row,
|
|
593
733
|
* and returns true if the row matches the criteria
|
|
594
734
|
* @returns {T | undefined} The first matching row from all rows, or undefined if no match is found
|
|
735
|
+
*
|
|
736
|
+
* @example
|
|
737
|
+
* // Find a user by ID in all rows
|
|
738
|
+
* const criteria = { id: 42 };
|
|
739
|
+
* const user = bodyAreaModel.findRowFromAllRowsByAllCriteria(
|
|
740
|
+
* criteria,
|
|
741
|
+
* (criteria, row) => row.id === criteria.id
|
|
742
|
+
* );
|
|
743
|
+
*
|
|
744
|
+
* @example
|
|
745
|
+
* // Find a user with a specific property value in all rows
|
|
746
|
+
* const criteria = { department: 'Engineering', role: 'Manager' };
|
|
747
|
+
* const user = bodyAreaModel.findRowFromAllRowsByAllCriteria(
|
|
748
|
+
* criteria,
|
|
749
|
+
* (criteria, row) => row.department === criteria.department && row.role === criteria.role
|
|
750
|
+
* );
|
|
595
751
|
*/
|
|
596
752
|
findRowFromAllRowsByAllCriteria(e, t) {
|
|
597
753
|
return this.getAllRows().find((s) => t(e, s));
|
|
598
754
|
}
|
|
755
|
+
/**
|
|
756
|
+
* Returns the height of the row at the specified index.
|
|
757
|
+
* This implementation always returns the default row height.
|
|
758
|
+
* Override this method in subclasses to support variable row heights.
|
|
759
|
+
*
|
|
760
|
+
* @param {number} _rowIndex - The index of the row (unused in this implementation)
|
|
761
|
+
* @returns {number} The height of the row in pixels
|
|
762
|
+
*
|
|
763
|
+
* @example
|
|
764
|
+
* const rowHeight = bodyAreaModel.getRowHeight(0);
|
|
765
|
+
* console.log(`The first row has a height of ${rowHeight}px`);
|
|
766
|
+
*/
|
|
599
767
|
getRowHeight(e) {
|
|
600
768
|
return this.defaultRowHeight;
|
|
601
769
|
}
|
|
770
|
+
/**
|
|
771
|
+
* Returns the row object at the specified index from the filtered rows array.
|
|
772
|
+
* This method overrides the parent class implementation.
|
|
773
|
+
*
|
|
774
|
+
* @param {number} rowIndex - The index of the row to retrieve
|
|
775
|
+
* @returns {any} The row object at the specified index, or undefined if the index is out of bounds
|
|
776
|
+
*
|
|
777
|
+
* @example
|
|
778
|
+
* // Get the first row object
|
|
779
|
+
* const row = bodyAreaModel.getRowByIndex(0);
|
|
780
|
+
* console.log('First row:', row);
|
|
781
|
+
*
|
|
782
|
+
* @example
|
|
783
|
+
* // Iterate through all rows
|
|
784
|
+
* for (let i = 0; i < bodyAreaModel.getRowCount(); i++) {
|
|
785
|
+
* const row = bodyAreaModel.getRowByIndex(i);
|
|
786
|
+
* console.log(`Row ${i}:`, row);
|
|
787
|
+
* }
|
|
788
|
+
*/
|
|
602
789
|
getRowByIndex(e) {
|
|
603
790
|
return this.filteredRows[e];
|
|
604
791
|
}
|
|
792
|
+
/**
|
|
793
|
+
* Applies an external filter function to the rows array.
|
|
794
|
+
* This method updates the filtered rows array without modifying the original rows array.
|
|
795
|
+
*
|
|
796
|
+
* @param {FilterFunction<any>} predictFn - A function that returns true for rows to keep and false for rows to filter out
|
|
797
|
+
*
|
|
798
|
+
* @example
|
|
799
|
+
* // Filter rows where age is greater than 30
|
|
800
|
+
* bodyAreaModel.externalFilterChanged(row => row.age > 30);
|
|
801
|
+
*
|
|
802
|
+
* @example
|
|
803
|
+
* // Filter rows based on a search term
|
|
804
|
+
* const searchTerm = 'john';
|
|
805
|
+
* bodyAreaModel.externalFilterChanged(row =>
|
|
806
|
+
* row.name.toLowerCase().includes(searchTerm.toLowerCase())
|
|
807
|
+
* );
|
|
808
|
+
*
|
|
809
|
+
* @example
|
|
810
|
+
* // Clear all filters
|
|
811
|
+
* bodyAreaModel.externalFilterChanged(() => true);
|
|
812
|
+
*/
|
|
605
813
|
externalFilterChanged(e) {
|
|
606
814
|
this.filteredRows = this.rows ? this.rows.filter(e) : [];
|
|
607
815
|
}
|
|
816
|
+
/**
|
|
817
|
+
* Sorts the filtered rows based on the provided sort items.
|
|
818
|
+
* This method supports sorting by multiple columns with different sort directions.
|
|
819
|
+
*
|
|
820
|
+
* @param {SortItem[]} sortItems - An array of sort items, each containing a column index and sort state
|
|
821
|
+
* @returns {boolean} Always returns true to indicate sorting was performed
|
|
822
|
+
*
|
|
823
|
+
* @example
|
|
824
|
+
* // Sort by age in ascending order
|
|
825
|
+
* bodyAreaModel.doSort([{ columnIndex: 2, sortState: 'asc' }]);
|
|
826
|
+
*
|
|
827
|
+
* @example
|
|
828
|
+
* // Sort by name in descending order, then by age in ascending order
|
|
829
|
+
* bodyAreaModel.doSort([
|
|
830
|
+
* { columnIndex: 1, sortState: 'desc' },
|
|
831
|
+
* { columnIndex: 2, sortState: 'asc' }
|
|
832
|
+
* ]);
|
|
833
|
+
*
|
|
834
|
+
* @example
|
|
835
|
+
* // Clear sorting
|
|
836
|
+
* bodyAreaModel.doSort([{ columnIndex: 0, sortState: 'none' }]);
|
|
837
|
+
*/
|
|
608
838
|
doSort(e) {
|
|
609
839
|
for (const t of e) {
|
|
610
840
|
const { columnIndex: s, sortState: o } = t, i = o === "asc" ? 1 : o === "desc" ? -1 : 0, r = this.properties[s];
|
|
@@ -612,20 +842,110 @@ class F extends pe {
|
|
|
612
842
|
}
|
|
613
843
|
return !0;
|
|
614
844
|
}
|
|
845
|
+
/**
|
|
846
|
+
* Sorts the filtered rows using a custom comparator function.
|
|
847
|
+
* This method provides more flexibility than `doSort()` for complex sorting logic.
|
|
848
|
+
*
|
|
849
|
+
* @param {(a: T, b: T) => number} compareFn - A function that compares two rows and returns a number:
|
|
850
|
+
* - Negative if a should come before b
|
|
851
|
+
* - Positive if a should come after b
|
|
852
|
+
* - Zero if they are equivalent for sorting purposes
|
|
853
|
+
*
|
|
854
|
+
* @example
|
|
855
|
+
* // Sort by name length
|
|
856
|
+
* bodyAreaModel.sort((a, b) => a.name.length - b.name.length);
|
|
857
|
+
*
|
|
858
|
+
* @example
|
|
859
|
+
* // Sort by a computed value
|
|
860
|
+
* bodyAreaModel.sort((a, b) => {
|
|
861
|
+
* const scoreA = a.wins * 3 + a.draws;
|
|
862
|
+
* const scoreB = b.wins * 3 + b.draws;
|
|
863
|
+
* return scoreB - scoreA; // Descending order
|
|
864
|
+
* });
|
|
865
|
+
*/
|
|
615
866
|
sort(e) {
|
|
616
867
|
this.filteredRows = this.filteredRows.sort(e);
|
|
617
868
|
}
|
|
869
|
+
/**
|
|
870
|
+
* Gets a value from an object using a property path.
|
|
871
|
+
* This method supports accessing nested properties using dot notation (e.g., 'person.name').
|
|
872
|
+
*
|
|
873
|
+
* @param {T} t - The object to get the value from
|
|
874
|
+
* @param {string} property - The property path to access (e.g., 'name' or 'person.contact.email')
|
|
875
|
+
* @returns {any} The value at the specified property path, or undefined if not found
|
|
876
|
+
*
|
|
877
|
+
* @example
|
|
878
|
+
* const user = { id: 1, name: 'John', contact: { email: 'john@example.com' } };
|
|
879
|
+
*
|
|
880
|
+
* // Access simple property
|
|
881
|
+
* const name = bodyAreaModel.getValueByT(user, 'name');
|
|
882
|
+
* console.log(name); // 'John'
|
|
883
|
+
*
|
|
884
|
+
* // Access nested property
|
|
885
|
+
* const email = bodyAreaModel.getValueByT(user, 'contact.email');
|
|
886
|
+
* console.log(email); // 'john@example.com'
|
|
887
|
+
*/
|
|
618
888
|
getValueByT(e, t) {
|
|
619
889
|
if (e && t)
|
|
620
890
|
return t.includes(".") ? this.getPropertyValue(e, t.split(".")) : e[t];
|
|
621
891
|
}
|
|
892
|
+
/**
|
|
893
|
+
* Changes the order of columns by moving a column from one position to another.
|
|
894
|
+
* This method updates both the properties array and calls the parent class implementation.
|
|
895
|
+
*
|
|
896
|
+
* @param {number} sourceColumnIndex - The index of the column to move
|
|
897
|
+
* @param {number} targetColumnIndex - The index where the column should be moved to
|
|
898
|
+
*
|
|
899
|
+
* @example
|
|
900
|
+
* // Move the second column (index 1) to the fourth position (index 3)
|
|
901
|
+
* bodyAreaModel.changeColumnOrder(1, 3);
|
|
902
|
+
*
|
|
903
|
+
* @example
|
|
904
|
+
* // Move the last column to the first position
|
|
905
|
+
* const lastIndex = bodyAreaModel.columnDefs.length - 1;
|
|
906
|
+
* bodyAreaModel.changeColumnOrder(lastIndex, 0);
|
|
907
|
+
*/
|
|
622
908
|
changeColumnOrder(e, t) {
|
|
623
909
|
this.arrayMove(this.properties, e, t), super.changeColumnOrder(e, t);
|
|
624
910
|
}
|
|
911
|
+
/**
|
|
912
|
+
* Gets the custom CSS classes that should be applied to a cell.
|
|
913
|
+
* This method extends the parent class implementation to add selection and focus classes.
|
|
914
|
+
*
|
|
915
|
+
* @param {number} rowIndex - The index of the row
|
|
916
|
+
* @param {number} _columnIndex - The index of the column (unused in this implementation)
|
|
917
|
+
* @returns {string[]} An array of CSS class names to apply to the cell
|
|
918
|
+
*
|
|
919
|
+
* @example
|
|
920
|
+
* // Get the CSS classes for a cell
|
|
921
|
+
* const classes = bodyAreaModel.getCustomClassesAt(1, 2);
|
|
922
|
+
* console.log('CSS classes:', classes);
|
|
923
|
+
*
|
|
924
|
+
* @example
|
|
925
|
+
* // Apply the classes to a cell element
|
|
926
|
+
* const cellElement = document.createElement('div');
|
|
927
|
+
* const classes = bodyAreaModel.getCustomClassesAt(rowIndex, columnIndex);
|
|
928
|
+
* cellElement.classList.add(...classes);
|
|
929
|
+
*/
|
|
625
930
|
getCustomClassesAt(e, t) {
|
|
626
931
|
const s = super.getCustomClassesAt(e, t);
|
|
627
932
|
return this.getRowByIndex(e).selected && s.push(this.selectedRowClass), this._focusedRowIndex === e && s.push(this.focusedRowClass), s;
|
|
628
933
|
}
|
|
934
|
+
/**
|
|
935
|
+
* Creates a comparator function for sorting rows based on a property and sort direction.
|
|
936
|
+
* This method supports custom sort comparators defined in column definitions.
|
|
937
|
+
*
|
|
938
|
+
* @param {string} property - The property to sort by
|
|
939
|
+
* @param {number} f - The sort direction factor: 1 for ascending, -1 for descending, 0 for no sorting
|
|
940
|
+
* @returns {(a: T, b: T) => number} A comparator function that compares two rows
|
|
941
|
+
*
|
|
942
|
+
* @example
|
|
943
|
+
* // Create a comparator for sorting by name in ascending order
|
|
944
|
+
* const comparator = bodyAreaModel.genericFlatTableSortComparator('name', 1);
|
|
945
|
+
*
|
|
946
|
+
* // Sort the rows using the comparator
|
|
947
|
+
* const sortedRows = [...bodyAreaModel.getFilteredRows()].sort(comparator);
|
|
948
|
+
*/
|
|
629
949
|
genericFlatTableSortComparator(e, t) {
|
|
630
950
|
const s = this.columnDefs.find((o) => o.property === e);
|
|
631
951
|
return (o, i) => {
|
|
@@ -633,51 +953,322 @@ class F extends pe {
|
|
|
633
953
|
return s != null && s.sortComparator ? t * s.sortComparator(r, a, o, i, t) : this.sorterService.genericSortComparator(r, a, t);
|
|
634
954
|
};
|
|
635
955
|
}
|
|
956
|
+
/**
|
|
957
|
+
* Recursively gets a value from an object using an array of property names.
|
|
958
|
+
* This is a helper method used by `getValueByT` to access nested properties.
|
|
959
|
+
*
|
|
960
|
+
* @param {any} o - The object to get the value from
|
|
961
|
+
* @param {string[]} props - An array of property names representing the path to the value
|
|
962
|
+
* @returns {any} The value at the specified property path, or undefined if not found
|
|
963
|
+
*
|
|
964
|
+
* @private
|
|
965
|
+
*/
|
|
636
966
|
getPropertyValue(e, t) {
|
|
637
967
|
const s = t.shift(), o = e[s];
|
|
638
968
|
return o && t.length ? this.getPropertyValue(o, t) : o;
|
|
639
969
|
}
|
|
640
970
|
}
|
|
641
|
-
class
|
|
971
|
+
class ue {
|
|
642
972
|
constructor(e) {
|
|
643
973
|
this.tableScope = e;
|
|
644
974
|
}
|
|
645
975
|
/**
|
|
646
|
-
* Updates the cells in the table
|
|
976
|
+
* Updates the cells in the table with the provided cell update events.
|
|
647
977
|
*
|
|
648
|
-
*
|
|
649
|
-
*
|
|
978
|
+
* This method allows you to update specific cells in the table without requiring a full table repaint,
|
|
979
|
+
* which can significantly improve performance when updating large tables frequently.
|
|
650
980
|
*
|
|
651
|
-
* @
|
|
981
|
+
* @param {TableCellUpdateEventIf[]} events - An array of cell update events, each defining a single cell update operation.
|
|
982
|
+
* Each event must specify:
|
|
983
|
+
* - area: The table area to update ('header', 'body', or 'footer')
|
|
984
|
+
* - rowIndex: The row index of the cell to update
|
|
985
|
+
* - columnIndex: The column index of the cell to update
|
|
986
|
+
* - value: The new value to set for the cell
|
|
987
|
+
* - cssClasses: Optional object mapping CSS class names to boolean values
|
|
988
|
+
* (true to add the class, false to remove it)
|
|
989
|
+
*
|
|
990
|
+
* @param {boolean} [repaintAll=false] - Whether to repaint the entire table after updating cells.
|
|
991
|
+
* - If true: All cells will be repainted after updating (slower but ensures visual consistency)
|
|
992
|
+
* - If false: Only the modified cells will be repainted (faster, recommended for frequent updates)
|
|
993
|
+
*
|
|
994
|
+
* @returns {void}
|
|
995
|
+
*
|
|
996
|
+
* @example
|
|
997
|
+
* // Update a single cell with a new value and CSS classes
|
|
998
|
+
* tableApi.updateCells([{
|
|
999
|
+
* area: 'body',
|
|
1000
|
+
* rowIndex: 3,
|
|
1001
|
+
* columnIndex: 2,
|
|
1002
|
+
* value: 42,
|
|
1003
|
+
* cssClasses: {
|
|
1004
|
+
* 'highlight': true, // Add 'highlight' class
|
|
1005
|
+
* 'error': false // Remove 'error' class if present
|
|
1006
|
+
* }
|
|
1007
|
+
* }]);
|
|
1008
|
+
*
|
|
1009
|
+
* @example
|
|
1010
|
+
* // Update multiple cells at once
|
|
1011
|
+
* tableApi.updateCells([
|
|
1012
|
+
* {
|
|
1013
|
+
* area: 'body',
|
|
1014
|
+
* rowIndex: 1,
|
|
1015
|
+
* columnIndex: 1,
|
|
1016
|
+
* value: 'New Value 1',
|
|
1017
|
+
* cssClasses: { 'updated': true }
|
|
1018
|
+
* },
|
|
1019
|
+
* {
|
|
1020
|
+
* area: 'body',
|
|
1021
|
+
* rowIndex: 2,
|
|
1022
|
+
* columnIndex: 3,
|
|
1023
|
+
* value: 'New Value 2',
|
|
1024
|
+
* cssClasses: { 'updated': true }
|
|
1025
|
+
* }
|
|
1026
|
+
* ]);
|
|
1027
|
+
*
|
|
1028
|
+
* @example
|
|
1029
|
+
* // Update cells and repaint the entire table
|
|
1030
|
+
* tableApi.updateCells([
|
|
1031
|
+
* { area: 'body', rowIndex: 0, columnIndex: 0, value: 'Hello', cssClasses: { 'bg-green-0': true } },
|
|
1032
|
+
* { area: 'body', rowIndex: 1, columnIndex: 1, value: 'World', cssClasses: { 'bg-red-0': true } }
|
|
1033
|
+
* ], true);
|
|
1034
|
+
*
|
|
1035
|
+
* @example
|
|
1036
|
+
* // High-performance animation example (update without full repaint)
|
|
1037
|
+
* function animateCell() {
|
|
1038
|
+
* const value = Math.sin(Date.now() / 1000) * 50;
|
|
1039
|
+
* const cssClasses = {
|
|
1040
|
+
* 'positive': value > 0,
|
|
1041
|
+
* 'negative': value < 0
|
|
1042
|
+
* };
|
|
1043
|
+
*
|
|
1044
|
+
* tableApi.updateCells([{
|
|
1045
|
+
* area: 'body',
|
|
1046
|
+
* rowIndex: 0,
|
|
1047
|
+
* columnIndex: 0,
|
|
1048
|
+
* value: Math.round(value),
|
|
1049
|
+
* cssClasses
|
|
1050
|
+
* }]);
|
|
1051
|
+
*
|
|
1052
|
+
* requestAnimationFrame(animateCell);
|
|
1053
|
+
* }
|
|
1054
|
+
* animateCell();
|
|
652
1055
|
*/
|
|
653
1056
|
updateCells(e, t = !1) {
|
|
654
1057
|
this.tableScope.updateCells(e, t);
|
|
655
1058
|
}
|
|
656
1059
|
/**
|
|
657
|
-
* Notifies that
|
|
1060
|
+
* Notifies the table that an external filter has been changed and needs to be applied.
|
|
658
1061
|
*
|
|
659
|
-
*
|
|
1062
|
+
* This method is used when an external filter condition (defined by `tableOptions.externalFilterFunction`)
|
|
1063
|
+
* has changed and the table needs to refresh its display to reflect the new filtering criteria.
|
|
1064
|
+
*
|
|
1065
|
+
* When called, this method:
|
|
1066
|
+
* 1. Applies the external filter function to all rows
|
|
1067
|
+
* 2. Clears the current selection (by default)
|
|
1068
|
+
* 3. Scrolls to the top of the table
|
|
1069
|
+
* 4. Recalculates table dimensions
|
|
1070
|
+
* 5. Repaints the table to display only the filtered rows
|
|
1071
|
+
*
|
|
1072
|
+
* @example
|
|
1073
|
+
* ```typescript
|
|
1074
|
+
* // Define an external filter function in your table options
|
|
1075
|
+
* const tableOptions = {
|
|
1076
|
+
* externalFilterFunction: (row: MyRowType) => {
|
|
1077
|
+
* // Return true to include the row, false to filter it out
|
|
1078
|
+
* return row.status === 'active';
|
|
1079
|
+
* }
|
|
1080
|
+
* };
|
|
1081
|
+
*
|
|
1082
|
+
* // Initialize your table with these options
|
|
1083
|
+
* const tableApi = new TableApi(tableScope);
|
|
1084
|
+
*
|
|
1085
|
+
* // Later, when filter criteria change (e.g., in a search input handler)
|
|
1086
|
+
* function onFilterTextChanged() {
|
|
1087
|
+
* // Update the filter function if needed
|
|
1088
|
+
* tableOptions.externalFilterFunction = (row: MyRowType) => {
|
|
1089
|
+
* return row.name.includes(searchText);
|
|
1090
|
+
* };
|
|
1091
|
+
*
|
|
1092
|
+
* // Apply the updated filter
|
|
1093
|
+
* tableApi.externalFilterChanged();
|
|
1094
|
+
* }
|
|
1095
|
+
* ```
|
|
1096
|
+
*
|
|
1097
|
+
* @returns {void}
|
|
1098
|
+
* @see TableScope.externalFilterChanged
|
|
660
1099
|
*/
|
|
661
1100
|
externalFilterChanged() {
|
|
662
1101
|
this.tableScope.externalFilterChanged();
|
|
663
1102
|
}
|
|
664
1103
|
/**
|
|
665
|
-
* Scrolls the table
|
|
1104
|
+
* Scrolls the table content to the specified pixel coordinates.
|
|
666
1105
|
*
|
|
667
|
-
*
|
|
668
|
-
*
|
|
669
|
-
*
|
|
1106
|
+
* This method allows programmatic scrolling of the table viewport to exact pixel positions.
|
|
1107
|
+
* It delegates the scrolling operation to the underlying TableScope instance.
|
|
1108
|
+
*
|
|
1109
|
+
* @param {number} px - The horizontal pixel coordinate to scroll to. Defaults to 0 (leftmost position).
|
|
1110
|
+
* @param {number} py - The vertical pixel coordinate to scroll to. Defaults to 0 (topmost position).
|
|
1111
|
+
* @returns {void}
|
|
1112
|
+
*
|
|
1113
|
+
* @example
|
|
1114
|
+
* // Scroll to the top-left corner of the table
|
|
1115
|
+
* tableApi.scrollToPixel(0, 0);
|
|
1116
|
+
*
|
|
1117
|
+
* @example
|
|
1118
|
+
* // Scroll 200 pixels horizontally and 150 pixels vertically
|
|
1119
|
+
* tableApi.scrollToPixel(200, 150);
|
|
1120
|
+
*
|
|
1121
|
+
* @example
|
|
1122
|
+
* // Scroll only vertically, keeping the current horizontal position
|
|
1123
|
+
* tableApi.scrollToPixel(undefined, 300);
|
|
1124
|
+
*
|
|
1125
|
+
* @example
|
|
1126
|
+
* // Example in a component that needs precise scrolling control
|
|
1127
|
+
* class TableScroller {
|
|
1128
|
+
* private tableApi: TableApi;
|
|
1129
|
+
*
|
|
1130
|
+
* constructor(tableApi: TableApi) {
|
|
1131
|
+
* this.tableApi = tableApi;
|
|
1132
|
+
* }
|
|
1133
|
+
*
|
|
1134
|
+
* scrollToPosition(x: number, y: number) {
|
|
1135
|
+
* // Scroll to exact pixel coordinates
|
|
1136
|
+
* this.tableApi.scrollToPixel(x, y);
|
|
1137
|
+
* }
|
|
1138
|
+
*
|
|
1139
|
+
* scrollHalfway() {
|
|
1140
|
+
* const tableModel = this.tableApi.getTableModel();
|
|
1141
|
+
* const totalWidth = tableModel.getContentWidthInPixel();
|
|
1142
|
+
* const totalHeight = tableModel.getContentHeightInPixel();
|
|
1143
|
+
*
|
|
1144
|
+
* // Scroll to the middle of the table content
|
|
1145
|
+
* this.tableApi.scrollToPixel(totalWidth / 2, totalHeight / 2);
|
|
1146
|
+
* }
|
|
1147
|
+
* }
|
|
1148
|
+
*
|
|
1149
|
+
* @example
|
|
1150
|
+
* // Advanced usage with animated scrolling
|
|
1151
|
+
* class SmoothScroller {
|
|
1152
|
+
* private tableApi: TableApi;
|
|
1153
|
+
* private animationFrameId: number | null = null;
|
|
1154
|
+
*
|
|
1155
|
+
* constructor(tableApi: TableApi) {
|
|
1156
|
+
* this.tableApi = tableApi;
|
|
1157
|
+
* }
|
|
1158
|
+
*
|
|
1159
|
+
* smoothScrollTo(targetX: number, targetY: number, duration: number = 500) {
|
|
1160
|
+
* // Cancel any ongoing animation
|
|
1161
|
+
* if (this.animationFrameId !== null) {
|
|
1162
|
+
* cancelAnimationFrame(this.animationFrameId);
|
|
1163
|
+
* }
|
|
1164
|
+
*
|
|
1165
|
+
* const startTime = performance.now();
|
|
1166
|
+
* const startX = this.tableApi.getTableScope().getScrollLeft();
|
|
1167
|
+
* const startY = this.tableApi.getTableScope().getScrollTop();
|
|
1168
|
+
* const distanceX = targetX - startX;
|
|
1169
|
+
* const distanceY = targetY - startY;
|
|
1170
|
+
*
|
|
1171
|
+
* const step = (currentTime: number) => {
|
|
1172
|
+
* const elapsed = currentTime - startTime;
|
|
1173
|
+
* const progress = Math.min(elapsed / duration, 1);
|
|
1174
|
+
*
|
|
1175
|
+
* // Use easing function for smooth animation
|
|
1176
|
+
* const easeProgress = 1 - Math.pow(1 - progress, 3); // Cubic ease-out
|
|
1177
|
+
*
|
|
1178
|
+
* const currentX = startX + distanceX * easeProgress;
|
|
1179
|
+
* const currentY = startY + distanceY * easeProgress;
|
|
1180
|
+
*
|
|
1181
|
+
* this.tableApi.scrollToPixel(currentX, currentY);
|
|
1182
|
+
*
|
|
1183
|
+
* if (progress < 1) {
|
|
1184
|
+
* this.animationFrameId = requestAnimationFrame(step);
|
|
1185
|
+
* } else {
|
|
1186
|
+
* this.animationFrameId = null;
|
|
1187
|
+
* }
|
|
1188
|
+
* };
|
|
1189
|
+
*
|
|
1190
|
+
* this.animationFrameId = requestAnimationFrame(step);
|
|
1191
|
+
* }
|
|
1192
|
+
*
|
|
1193
|
+
* cancelAnimation() {
|
|
1194
|
+
* if (this.animationFrameId !== null) {
|
|
1195
|
+
* cancelAnimationFrame(this.animationFrameId);
|
|
1196
|
+
* this.animationFrameId = null;
|
|
1197
|
+
* }
|
|
1198
|
+
* }
|
|
1199
|
+
* }
|
|
1200
|
+
*
|
|
1201
|
+
* @see {@link scrollToIndex} - For scrolling based on row and column indices
|
|
1202
|
+
* @see {@link ensureRowIsVisible} - For scrolling to make a specific row visible
|
|
670
1203
|
*/
|
|
671
1204
|
scrollToPixel(e = 0, t = 0) {
|
|
672
1205
|
this.tableScope.scrollToPixel(e, t);
|
|
673
1206
|
}
|
|
674
1207
|
/**
|
|
675
|
-
* Scrolls to the specified
|
|
1208
|
+
* Scrolls the table to display the specified row and column indices at the top-left corner of the viewport.
|
|
676
1209
|
*
|
|
677
|
-
*
|
|
678
|
-
*
|
|
1210
|
+
* This method allows programmatic scrolling to a specific position in the table grid based on row and column indices.
|
|
1211
|
+
* It uses the underlying TableScope's scrolling mechanism to navigate to the target location.
|
|
679
1212
|
*
|
|
680
|
-
* @
|
|
1213
|
+
* @param {number} indexX - The horizontal index (column) to scroll to. Defaults to 0 (leftmost column).
|
|
1214
|
+
* @param {number} indexY - The vertical index (row) to scroll to. Defaults to 0 (topmost row).
|
|
1215
|
+
* @returns {void}
|
|
1216
|
+
*
|
|
1217
|
+
* @example
|
|
1218
|
+
* // Scroll to the 5th row, keeping the current horizontal scroll position
|
|
1219
|
+
* tableApi.scrollToIndex(0, 5);
|
|
1220
|
+
*
|
|
1221
|
+
* @example
|
|
1222
|
+
* // Scroll to column 3, row 10
|
|
1223
|
+
* tableApi.scrollToIndex(3, 10);
|
|
1224
|
+
*
|
|
1225
|
+
* @example
|
|
1226
|
+
* // Example in a component that needs to navigate to specific content
|
|
1227
|
+
* class TableNavigator {
|
|
1228
|
+
* private tableApi: TableApi;
|
|
1229
|
+
*
|
|
1230
|
+
* constructor(tableApi: TableApi) {
|
|
1231
|
+
* this.tableApi = tableApi;
|
|
1232
|
+
* }
|
|
1233
|
+
*
|
|
1234
|
+
* goToCell(columnIndex: number, rowIndex: number) {
|
|
1235
|
+
* // Navigate directly to the specified cell position
|
|
1236
|
+
* this.tableApi.scrollToIndex(columnIndex, rowIndex);
|
|
1237
|
+
*
|
|
1238
|
+
* // Optional: Select the cell after navigating to it
|
|
1239
|
+
* const selectionModel = this.tableApi.getSelectionModel();
|
|
1240
|
+
* if (selectionModel) {
|
|
1241
|
+
* selectionModel.selectCell(rowIndex, columnIndex);
|
|
1242
|
+
* }
|
|
1243
|
+
* }
|
|
1244
|
+
* }
|
|
1245
|
+
*
|
|
1246
|
+
* @example
|
|
1247
|
+
* // Advanced usage with search functionality
|
|
1248
|
+
* class TableSearcher {
|
|
1249
|
+
* findAndScrollToMatch(searchTerm: string) {
|
|
1250
|
+
* const tableModel = this.tableApi.getTableModel();
|
|
1251
|
+
* const bodyModel = tableModel.getAreaModel('body');
|
|
1252
|
+
*
|
|
1253
|
+
* // Search for the term in the table data
|
|
1254
|
+
* for (let row = 0; row < bodyModel.getRowCount(); row++) {
|
|
1255
|
+
* for (let col = 0; col < tableModel.getColumnCount(); col++) {
|
|
1256
|
+
* const cellContent = bodyModel.getValueAt(row, col)?.toString() || '';
|
|
1257
|
+
*
|
|
1258
|
+
* if (cellContent.includes(searchTerm)) {
|
|
1259
|
+
* // Found a match, scroll to it
|
|
1260
|
+
* this.tableApi.scrollToIndex(col, row);
|
|
1261
|
+
* return true;
|
|
1262
|
+
* }
|
|
1263
|
+
* }
|
|
1264
|
+
* }
|
|
1265
|
+
*
|
|
1266
|
+
* return false; // No match found
|
|
1267
|
+
* }
|
|
1268
|
+
* }
|
|
1269
|
+
*
|
|
1270
|
+
* @see {@link scrollToPixel} - For scrolling to specific pixel coordinates
|
|
1271
|
+
* @see {@link ensureRowIsVisible} - For scrolling to make a specific row visible
|
|
681
1272
|
*/
|
|
682
1273
|
scrollToIndex(e = 0, t = 0) {
|
|
683
1274
|
this.tableScope.scrollToIndex(e, t);
|
|
@@ -738,19 +1329,71 @@ class fe {
|
|
|
738
1329
|
/**
|
|
739
1330
|
* Repaints the table.
|
|
740
1331
|
*
|
|
741
|
-
* This method
|
|
742
|
-
*
|
|
1332
|
+
* This method refreshes the visual representation of the table by delegating to the
|
|
1333
|
+
* tableScope's repaint functionality. Use this method whenever the table's visual state
|
|
1334
|
+
* needs to be updated after data changes, selection changes, or any modifications that
|
|
1335
|
+
* affect the rendered output.
|
|
1336
|
+
*
|
|
1337
|
+
* Repainting the table ensures that all visible cells, rows, and styling reflect the
|
|
1338
|
+
* current state of the underlying data model and configuration settings.
|
|
1339
|
+
*
|
|
1340
|
+
* @example
|
|
1341
|
+
* // Update data and repaint the table
|
|
1342
|
+
* const tableApi = new TableApi(tableScope);
|
|
1343
|
+
* tableApi.setRows(newData);
|
|
1344
|
+
* tableApi.repaint();
|
|
1345
|
+
*
|
|
1346
|
+
* @example
|
|
1347
|
+
* // Update selection and repaint to show the visual change
|
|
1348
|
+
* tableApi.getSelectionModel().selectCell(2, 3);
|
|
1349
|
+
* tableApi.repaint();
|
|
1350
|
+
*
|
|
1351
|
+
* @example
|
|
1352
|
+
* // After changing column visibility, repaint to reflect changes
|
|
1353
|
+
* tableApi.setColumnVisible(0, false);
|
|
1354
|
+
* tableApi.repaint();
|
|
1355
|
+
*
|
|
1356
|
+
* @returns {void}
|
|
743
1357
|
*/
|
|
744
1358
|
repaint() {
|
|
745
1359
|
this.tableScope.repaint();
|
|
746
1360
|
}
|
|
747
1361
|
/**
|
|
748
|
-
*
|
|
749
|
-
* Repaints the UI by resetting the size of the wrapper div,
|
|
750
|
-
* adjusting the containers and rows, and performing additional adjustments
|
|
751
|
-
* after scrolling.
|
|
1362
|
+
* Performs a complete repaint of the table by triggering a hard repaint on the underlying table scope.
|
|
752
1363
|
*
|
|
753
|
-
*
|
|
1364
|
+
* A hard repaint is more thorough than a regular repaint and performs the following operations:
|
|
1365
|
+
* - Recalculates the height and padding of the table model
|
|
1366
|
+
* - Resets the size of the wrapper div elements
|
|
1367
|
+
* - Adjusts containers and rows positioning
|
|
1368
|
+
* - Makes additional adjustments after scrolling
|
|
1369
|
+
*
|
|
1370
|
+
* Use this method when regular repaint isn't sufficient, such as when:
|
|
1371
|
+
* - Table dimensions have significantly changed
|
|
1372
|
+
* - The structure of data has been modified (rows/columns added or removed)
|
|
1373
|
+
* - The table layout needs complete recalculation
|
|
1374
|
+
* - After major DOM changes affecting the table's container
|
|
1375
|
+
*
|
|
1376
|
+
* @example
|
|
1377
|
+
* // Example 1: Basic usage
|
|
1378
|
+
* tableApi.repaintHard();
|
|
1379
|
+
*
|
|
1380
|
+
* @example
|
|
1381
|
+
* // Example 2: Using after major data changes
|
|
1382
|
+
* tableApi.setRows(newDataSet);
|
|
1383
|
+
* tableApi.repaintHard();
|
|
1384
|
+
*
|
|
1385
|
+
* @example
|
|
1386
|
+
* // Example 3: Using after resizing a container
|
|
1387
|
+
* window.addEventListener('resize', () => {
|
|
1388
|
+
* tableApi.repaintHard();
|
|
1389
|
+
* });
|
|
1390
|
+
*
|
|
1391
|
+
* @example
|
|
1392
|
+
* // Example 4: Using after changing column visibility
|
|
1393
|
+
* tableApi.setColumnVisible(2, false);
|
|
1394
|
+
* tableApi.repaintHard();
|
|
1395
|
+
*
|
|
1396
|
+
* @returns {void} This method doesn't return a value
|
|
754
1397
|
*/
|
|
755
1398
|
repaintHard() {
|
|
756
1399
|
this.tableScope.repaintHard();
|
|
@@ -766,8 +1409,30 @@ class fe {
|
|
|
766
1409
|
this.tableScope.recalcColumnWidths(e);
|
|
767
1410
|
}
|
|
768
1411
|
/**
|
|
769
|
-
* Clears the current selection
|
|
770
|
-
*
|
|
1412
|
+
* Clears the current selection in the table.
|
|
1413
|
+
*
|
|
1414
|
+
* This method removes any selected cells, rows, or columns in the table.
|
|
1415
|
+
* It provides a convenient way to programmatically clear all selections in the table
|
|
1416
|
+
* without having to access the underlying selection model directly.
|
|
1417
|
+
*
|
|
1418
|
+
* When called, this method delegates to the table scope's clearSelection method with
|
|
1419
|
+
* a parameter value of true, which ensures the table is automatically repainted after
|
|
1420
|
+
* the selection is cleared.
|
|
1421
|
+
*
|
|
1422
|
+
* @example
|
|
1423
|
+
* // Clear all selections in the table
|
|
1424
|
+
* tableApi.clearSelection();
|
|
1425
|
+
*
|
|
1426
|
+
* // Example usage in a component
|
|
1427
|
+
* class MyComponent {
|
|
1428
|
+
* @ViewChild('tableComponent') tableComponent: TableComponent;
|
|
1429
|
+
*
|
|
1430
|
+
* resetTableSelection(): void {
|
|
1431
|
+
* if (this.tableComponent?.api) {
|
|
1432
|
+
* this.tableComponent.api.clearSelection();
|
|
1433
|
+
* }
|
|
1434
|
+
* }
|
|
1435
|
+
* }
|
|
771
1436
|
*
|
|
772
1437
|
* @returns {void}
|
|
773
1438
|
*/
|
|
@@ -775,12 +1440,31 @@ class fe {
|
|
|
775
1440
|
this.tableScope.clearSelection(!0);
|
|
776
1441
|
}
|
|
777
1442
|
/**
|
|
778
|
-
* Sets the selection model for the table
|
|
1443
|
+
* Sets the selection model for the table.
|
|
779
1444
|
*
|
|
780
|
-
*
|
|
781
|
-
*
|
|
1445
|
+
* This method allows you to replace the current selection model with a new one,
|
|
1446
|
+
* which controls how cells, rows, or columns can be selected in the table.
|
|
782
1447
|
*
|
|
783
|
-
* @
|
|
1448
|
+
* @param {SelectionModel} sm - The new selection model to be set. This model defines
|
|
1449
|
+
* the selection behavior including selection type (none, cell, row, column),
|
|
1450
|
+
* selection mode (single, multi), and manages the selected ranges.
|
|
1451
|
+
* @param {boolean} [repaint=true] - Whether to repaint the table after changing the selection model.
|
|
1452
|
+
* Default is true, which immediately reflects the change visually.
|
|
1453
|
+
* Set to false if you want to avoid immediate repainting.
|
|
1454
|
+
*
|
|
1455
|
+
* @example
|
|
1456
|
+
* // Create a new selection model with row selection and multi-select mode
|
|
1457
|
+
* const selectionModel = new SelectionModel("row", "multi");
|
|
1458
|
+
*
|
|
1459
|
+
* // Set the new selection model and repaint the table
|
|
1460
|
+
* tableApi.setSelectionModel(selectionModel);
|
|
1461
|
+
*
|
|
1462
|
+
* // Set a selection model without repainting (if you plan to make more changes)
|
|
1463
|
+
* tableApi.setSelectionModel(selectionModel, false);
|
|
1464
|
+
* // ... make other changes ...
|
|
1465
|
+
* tableApi.repaint(); // Now repaint once
|
|
1466
|
+
*
|
|
1467
|
+
* @returns {void}
|
|
784
1468
|
*/
|
|
785
1469
|
setSelectionModel(e, t = !0) {
|
|
786
1470
|
this.tableScope.setSelectionModel(e, t);
|
|
@@ -796,9 +1480,36 @@ class fe {
|
|
|
796
1480
|
this.tableScope.onActionTriggered(e);
|
|
797
1481
|
}
|
|
798
1482
|
/**
|
|
799
|
-
* Retrieves the
|
|
1483
|
+
* Retrieves the shortcut action mapping from the table's shortcut service.
|
|
1484
|
+
*
|
|
1485
|
+
* This method provides access to the keyboard shortcut configuration that defines
|
|
1486
|
+
* which keys trigger specific actions in the table. The mapping contains key-value
|
|
1487
|
+
* pairs where:
|
|
1488
|
+
* - Keys are string representations of keyboard shortcuts (e.g., "ctrl+c", "shift+arrow_down")
|
|
1489
|
+
* - Values are ActionId values representing the corresponding table actions
|
|
1490
|
+
*
|
|
1491
|
+
* This mapping can be useful for:
|
|
1492
|
+
* - Displaying available shortcuts to users
|
|
1493
|
+
* - Creating custom shortcut documentation
|
|
1494
|
+
* - Dynamically checking which actions are available via keyboard
|
|
1495
|
+
* - Extending or integrating with the table's shortcut system
|
|
800
1496
|
*
|
|
801
|
-
* @
|
|
1497
|
+
* @returns {ShortcutActionIdMapping} An object mapping shortcut key combinations to their corresponding action IDs.
|
|
1498
|
+
* For example: { "ctrl+c": "COPY_2_CLIPBOARD", "arrow_down": "NAVIGATE_DOWN" }
|
|
1499
|
+
*
|
|
1500
|
+
* @example
|
|
1501
|
+
* // Get all available shortcuts in the table
|
|
1502
|
+
* const shortcuts = tableApi.getShortcutActionMapping();
|
|
1503
|
+
*
|
|
1504
|
+
* // Check if a specific shortcut exists
|
|
1505
|
+
* if (shortcuts["ctrl+c"]) {
|
|
1506
|
+
* console.log("Copy shortcut is available with action:", shortcuts["ctrl+c"]);
|
|
1507
|
+
* }
|
|
1508
|
+
*
|
|
1509
|
+
* // Display available shortcuts in the UI
|
|
1510
|
+
* Object.entries(shortcuts).forEach(([key, actionId]) => {
|
|
1511
|
+
* console.log(`${key}: ${actionId}`);
|
|
1512
|
+
* });
|
|
802
1513
|
*/
|
|
803
1514
|
getShortcutActionMapping() {
|
|
804
1515
|
return this.tableScope.shortcutService.getShortcutActionMapping();
|
|
@@ -806,7 +1517,35 @@ class fe {
|
|
|
806
1517
|
/**
|
|
807
1518
|
* Copies the selected data from the table to the clipboard.
|
|
808
1519
|
*
|
|
809
|
-
*
|
|
1520
|
+
* This method leverages the copyService to extract and copy the currently selected data
|
|
1521
|
+
* from the table. It works with the current selection state and focus position to determine
|
|
1522
|
+
* what content should be copied.
|
|
1523
|
+
*
|
|
1524
|
+
* The copied data is formatted as tab-separated text that can be pasted into spreadsheet
|
|
1525
|
+
* applications like Excel or text editors while maintaining the tabular structure.
|
|
1526
|
+
*
|
|
1527
|
+
* @example
|
|
1528
|
+
* // Copy the currently selected data to clipboard
|
|
1529
|
+
* tableApi.copyToClipboard().then(content => {
|
|
1530
|
+
* console.log('Copied to clipboard:', content);
|
|
1531
|
+
* });
|
|
1532
|
+
*
|
|
1533
|
+
* // Using with a button click handler
|
|
1534
|
+
* function onCopyButtonClick() {
|
|
1535
|
+
* if (tableApi) {
|
|
1536
|
+
* tableApi.copyToClipboard()
|
|
1537
|
+
* .then(content => {
|
|
1538
|
+
* console.log('Successfully copied data to clipboard');
|
|
1539
|
+
* // Optionally do something with the copied content
|
|
1540
|
+
* })
|
|
1541
|
+
* .catch(error => {
|
|
1542
|
+
* console.error('Failed to copy to clipboard:', error);
|
|
1543
|
+
* });
|
|
1544
|
+
* }
|
|
1545
|
+
* }
|
|
1546
|
+
*
|
|
1547
|
+
* @returns {Promise<string>} A promise that resolves with the copied data as a string.
|
|
1548
|
+
* The string contains the tab-separated representation of the selected table data.
|
|
810
1549
|
*/
|
|
811
1550
|
copyToClipboard() {
|
|
812
1551
|
return this.tableScope.copyService.copyToClipboard(
|
|
@@ -816,11 +1555,33 @@ class fe {
|
|
|
816
1555
|
);
|
|
817
1556
|
}
|
|
818
1557
|
/**
|
|
819
|
-
*
|
|
1558
|
+
* Downloads the current table data as an Excel file.
|
|
1559
|
+
*
|
|
1560
|
+
* This method extracts all visible data from the table (including header, body, and footer areas),
|
|
1561
|
+
* converts it into a matrix format, and triggers a download of an Excel file containing this data.
|
|
1562
|
+
*
|
|
1563
|
+
* The method works by:
|
|
1564
|
+
* 1. Creating an empty matrix to hold all table data
|
|
1565
|
+
* 2. Iterating through each area of the table (header, body, footer)
|
|
1566
|
+
* 3. For each area, iterating through all rows and columns to extract cell values
|
|
1567
|
+
* 4. Passing the complete data matrix to the Excel service for file generation and download
|
|
1568
|
+
*
|
|
1569
|
+
* @param {string} fileName - The name of the Excel file to be downloaded (default: 'table.xlsx')
|
|
1570
|
+
* @param {string} author - Optional metadata for the Excel file to specify the author (default: '')
|
|
1571
|
+
*
|
|
1572
|
+
* @returns {void} The result of the excelService.downloadExcel method call
|
|
820
1573
|
*
|
|
821
|
-
* @
|
|
822
|
-
*
|
|
823
|
-
*
|
|
1574
|
+
* @example
|
|
1575
|
+
* // Download table data with default filename
|
|
1576
|
+
* tableApi.downloadExcel();
|
|
1577
|
+
*
|
|
1578
|
+
* @example
|
|
1579
|
+
* // Download table data with custom filename and author
|
|
1580
|
+
* tableApi.downloadExcel('sales-report.xlsx', 'John Doe');
|
|
1581
|
+
*
|
|
1582
|
+
* @example
|
|
1583
|
+
* // Download table data with custom filename only
|
|
1584
|
+
* tableApi.downloadExcel('quarterly-data.xlsx');
|
|
824
1585
|
*/
|
|
825
1586
|
downloadExcel(e = "table.xlsx", t = "") {
|
|
826
1587
|
const s = [], o = this.tableScope.tableModel.getColumnCount(), i = ["header", "body", "footer"];
|
|
@@ -836,18 +1597,66 @@ class fe {
|
|
|
836
1597
|
return this.tableScope.excelService.downloadExcel(s, e, t);
|
|
837
1598
|
}
|
|
838
1599
|
/**
|
|
839
|
-
*
|
|
1600
|
+
* Returns the TableScope instance associated with this TableApi.
|
|
1601
|
+
*
|
|
1602
|
+
* The TableScope provides access to the core functionality and internal state of the table component,
|
|
1603
|
+
* including rendering, event handling, selection, and other low-level operations.
|
|
840
1604
|
*
|
|
841
|
-
*
|
|
1605
|
+
* This method is useful for advanced customization scenarios where you need direct access
|
|
1606
|
+
* to the table's internal structure and behaviors.
|
|
1607
|
+
*
|
|
1608
|
+
* @returns {TableScope} The TableScope instance that controls this table component
|
|
1609
|
+
*
|
|
1610
|
+
* @example
|
|
1611
|
+
* // Access the TableScope to perform a custom operation
|
|
1612
|
+
* const tableApi = new TableApi(myTableScope);
|
|
1613
|
+
* const tableScope = tableApi.getTableScope();
|
|
1614
|
+
*
|
|
1615
|
+
* // Example: Manually trigger a context menu at a specific location
|
|
1616
|
+
* const mouseEvent = new MouseEvent('contextmenu');
|
|
1617
|
+
* const geMouseEvent = tableScope.createGeMouseEvent(mouseEvent);
|
|
1618
|
+
* tableScope.contextmenu(geMouseEvent);
|
|
842
1619
|
*/
|
|
843
1620
|
getTableScope() {
|
|
844
1621
|
return this.tableScope;
|
|
845
1622
|
}
|
|
846
1623
|
/**
|
|
847
|
-
*
|
|
1624
|
+
* Returns the current selection model for the table.
|
|
1625
|
+
*
|
|
1626
|
+
* The selection model manages cell selection state, including single cells, ranges, rows, and columns.
|
|
1627
|
+
* This method provides access to the selection model instance, allowing operations like:
|
|
1628
|
+
* - Checking if cells are selected
|
|
1629
|
+
* - Getting selection ranges
|
|
1630
|
+
* - Modifying selections
|
|
1631
|
+
* - Adding/removing selection event listeners
|
|
1632
|
+
*
|
|
1633
|
+
* @returns {SelectionModelIf | undefined} The current selection model if available, otherwise undefined.
|
|
1634
|
+
*
|
|
1635
|
+
* @example
|
|
1636
|
+
* // Get the selection model
|
|
1637
|
+
* const selectionModel = tableApi.getSelectionModel();
|
|
848
1638
|
*
|
|
849
|
-
*
|
|
850
|
-
*
|
|
1639
|
+
* // Check if a specific cell is selected
|
|
1640
|
+
* if (selectionModel?.isSelected(3, 2)) {
|
|
1641
|
+
* console.log('Cell at row 3, column 2 is selected');
|
|
1642
|
+
* }
|
|
1643
|
+
*
|
|
1644
|
+
* // Get all selected ranges
|
|
1645
|
+
* const ranges = selectionModel?.getRanges();
|
|
1646
|
+
* console.log('Selected ranges:', ranges);
|
|
1647
|
+
*
|
|
1648
|
+
* // Clear all selections
|
|
1649
|
+
* selectionModel?.clear();
|
|
1650
|
+
*
|
|
1651
|
+
* // Toggle selection of a cell
|
|
1652
|
+
* selectionModel?.togglePoint(5, 1);
|
|
1653
|
+
*
|
|
1654
|
+
* // Add a selection change listener
|
|
1655
|
+
* selectionModel?.addEventSelectionChangedListener({
|
|
1656
|
+
* selectionChanged: () => {
|
|
1657
|
+
* console.log('Selection has changed');
|
|
1658
|
+
* }
|
|
1659
|
+
* });
|
|
851
1660
|
*/
|
|
852
1661
|
getSelectionModel() {
|
|
853
1662
|
return this.tableScope.selectionModel();
|
|
@@ -920,7 +1729,7 @@ class fe {
|
|
|
920
1729
|
*/
|
|
921
1730
|
setRows(e) {
|
|
922
1731
|
const t = this.getBodyModel();
|
|
923
|
-
t instanceof
|
|
1732
|
+
t instanceof D ? t.setRows(e) : console.warn("setRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ", typeof t, t);
|
|
924
1733
|
}
|
|
925
1734
|
/**
|
|
926
1735
|
* Adds new rows to the end of the table body.
|
|
@@ -938,7 +1747,7 @@ class fe {
|
|
|
938
1747
|
*/
|
|
939
1748
|
addRows(e) {
|
|
940
1749
|
const t = this.getBodyModel();
|
|
941
|
-
if (t instanceof
|
|
1750
|
+
if (t instanceof D) {
|
|
942
1751
|
const s = t;
|
|
943
1752
|
let o = s.getAllRows();
|
|
944
1753
|
s.setRows([...o, ...e]);
|
|
@@ -963,7 +1772,7 @@ class fe {
|
|
|
963
1772
|
*/
|
|
964
1773
|
addRowsAt(e, t) {
|
|
965
1774
|
const s = this.getBodyModel();
|
|
966
|
-
if (s instanceof
|
|
1775
|
+
if (s instanceof D) {
|
|
967
1776
|
const o = s;
|
|
968
1777
|
let i = o.getAllRows();
|
|
969
1778
|
o.setRows([...i.slice(0, t), ...e, ...i.slice(t)]);
|
|
@@ -989,7 +1798,7 @@ class fe {
|
|
|
989
1798
|
*/
|
|
990
1799
|
removeRows(e, t = (s, o) => s === o) {
|
|
991
1800
|
const s = this.getBodyModel();
|
|
992
|
-
if (s instanceof
|
|
1801
|
+
if (s instanceof D) {
|
|
993
1802
|
const o = s, i = o.getAllRows().filter((r) => !e.some((a) => t(r, a)));
|
|
994
1803
|
o.setRows(i);
|
|
995
1804
|
} else
|
|
@@ -1030,7 +1839,7 @@ class fe {
|
|
|
1030
1839
|
*/
|
|
1031
1840
|
findRows(e, t = (s, o) => s === o) {
|
|
1032
1841
|
const s = this.getBodyModel();
|
|
1033
|
-
return s instanceof
|
|
1842
|
+
return s instanceof D ? s.getAllRows().filter((i) => e.some((r) => t(i, r))) : (console.warn("findRows<T>(rows: T[], predicate: (a: T, b: T) => boolean) only works with AreaModelObjectArray<T>, but this body area model is ", typeof s, s), []);
|
|
1034
1843
|
}
|
|
1035
1844
|
/**
|
|
1036
1845
|
* Searches through the filtered rows of the table to find a row that matches specific criteria.
|
|
@@ -1087,7 +1896,7 @@ class fe {
|
|
|
1087
1896
|
*/
|
|
1088
1897
|
findRowFromFilteredRowsByAllCriteria(e, t) {
|
|
1089
1898
|
const s = this.getBodyModel();
|
|
1090
|
-
if (s instanceof
|
|
1899
|
+
if (s instanceof D)
|
|
1091
1900
|
return s.getFilteredRows().find((i) => t(e, i));
|
|
1092
1901
|
console.warn("findRowFromFilteredRowsByAllCriteria(...) only works with AreaModelObjectArray<T>, but this body area model is ", typeof s, s);
|
|
1093
1902
|
}
|
|
@@ -1134,7 +1943,7 @@ class fe {
|
|
|
1134
1943
|
*/
|
|
1135
1944
|
findRowFromAllRowsByAllCriteria(e, t) {
|
|
1136
1945
|
const s = this.getBodyModel();
|
|
1137
|
-
if (s instanceof
|
|
1946
|
+
if (s instanceof D)
|
|
1138
1947
|
return s.getAllRows().find((i) => t(e, i));
|
|
1139
1948
|
console.warn("findRowFromAllRowsByAllCriteria(...) only works with AreaModelObjectArray<T>, but this body area model is ", typeof s, s);
|
|
1140
1949
|
}
|
|
@@ -1159,7 +1968,7 @@ class fe {
|
|
|
1159
1968
|
*/
|
|
1160
1969
|
updateRows(e, t = (s, o) => s === o) {
|
|
1161
1970
|
const s = this.getBodyModel();
|
|
1162
|
-
if (s instanceof
|
|
1971
|
+
if (s instanceof D) {
|
|
1163
1972
|
let i = s.getAllRows();
|
|
1164
1973
|
for (const r of i)
|
|
1165
1974
|
for (const a of e)
|
|
@@ -1328,6 +2137,184 @@ class fe {
|
|
|
1328
2137
|
getFirstVisibleRowIndex() {
|
|
1329
2138
|
return this.tableScope.getFirstVisibleRowIndex();
|
|
1330
2139
|
}
|
|
2140
|
+
/**
|
|
2141
|
+
* Retrieves the index of the first fully visible row in the table's viewport.
|
|
2142
|
+
*
|
|
2143
|
+
* A row is considered "fully visible" when it's completely within the visible area of the table.
|
|
2144
|
+
* This differs from the regular "visible" row, which might be partially visible at the edges of the viewport.
|
|
2145
|
+
*
|
|
2146
|
+
* This method is useful for:
|
|
2147
|
+
* - Determining which rows are completely in view for operations that require full visibility
|
|
2148
|
+
* - Implementing pagination or virtualization logic that needs to know complete row visibility
|
|
2149
|
+
* - Supporting keyboard navigation that should skip partially visible rows
|
|
2150
|
+
*
|
|
2151
|
+
* @returns {number} The index of the first fully visible row, or -1 if no rows are fully visible
|
|
2152
|
+
*
|
|
2153
|
+
* @example
|
|
2154
|
+
* // Get the first fully visible row index
|
|
2155
|
+
* const firstFullVisibleRow = tableApi.getFirstFullVisibleRowIndex();
|
|
2156
|
+
*
|
|
2157
|
+
* // Check if a specific row is fully visible
|
|
2158
|
+
* const isRowFullyVisible = (rowIndex) => {
|
|
2159
|
+
* const firstFullVisible = tableApi.getFirstFullVisibleRowIndex();
|
|
2160
|
+
* const lastFullVisible = tableApi.getLastFullVisibleRowIndex();
|
|
2161
|
+
* return rowIndex >= firstFullVisible && rowIndex <= lastFullVisible;
|
|
2162
|
+
* };
|
|
2163
|
+
*/
|
|
2164
|
+
getFirstFullVisibleRowIndex() {
|
|
2165
|
+
return this.tableScope.getFirstFullVisibleRowIndex();
|
|
2166
|
+
}
|
|
2167
|
+
/**
|
|
2168
|
+
* Returns the index of the last row that is visible in the table's viewport.
|
|
2169
|
+
*
|
|
2170
|
+
* This method retrieves the last visible row index from the table scope, which keeps
|
|
2171
|
+
* track of which rows are currently visible as the user scrolls through the table.
|
|
2172
|
+
*
|
|
2173
|
+
* This can be useful for:
|
|
2174
|
+
* - Implementing virtualized scrolling optimizations
|
|
2175
|
+
* - Determining if specific rows are currently in view
|
|
2176
|
+
* - Implementing features that need to know the visible range of rows
|
|
2177
|
+
*
|
|
2178
|
+
* @returns {number} The index of the last visible row in the table viewport
|
|
2179
|
+
*
|
|
2180
|
+
* @example
|
|
2181
|
+
* // Check if a specific row is currently visible in the viewport
|
|
2182
|
+
* const lastVisibleIndex = tableApi.getLastVisibleRowIndex();
|
|
2183
|
+
* const firstVisibleIndex = tableApi.getFirstVisibleRowIndex();
|
|
2184
|
+
* const isRowVisible = rowIndex >= firstVisibleIndex && rowIndex <= lastVisibleIndex;
|
|
2185
|
+
*
|
|
2186
|
+
* @example
|
|
2187
|
+
* // Get the range of visible rows
|
|
2188
|
+
* const visibleRowsRange = {
|
|
2189
|
+
* first: tableApi.getFirstVisibleRowIndex(),
|
|
2190
|
+
* last: tableApi.getLastVisibleRowIndex()
|
|
2191
|
+
* };
|
|
2192
|
+
* console.log(`Visible rows: ${visibleRowsRange.first} to ${visibleRowsRange.last}`);
|
|
2193
|
+
*/
|
|
2194
|
+
getLastVisibleRowIndex() {
|
|
2195
|
+
return this.tableScope.getLastVisibleRowIndex();
|
|
2196
|
+
}
|
|
2197
|
+
/**
|
|
2198
|
+
* Returns the index of the last fully visible row in the table's viewport.
|
|
2199
|
+
*
|
|
2200
|
+
* This method retrieves the last row that is completely visible within the current
|
|
2201
|
+
* viewport of the table. A row is considered "fully visible" when its entire height
|
|
2202
|
+
* is visible without any portion being cut off by the viewport boundaries.
|
|
2203
|
+
*
|
|
2204
|
+
* The distinction between "visible" and "fully visible" is important when scrolling:
|
|
2205
|
+
* - A row can be partially visible (some portion is in view)
|
|
2206
|
+
* - A row can be fully visible (the entire row is in view)
|
|
2207
|
+
*
|
|
2208
|
+
* @returns {number} The index of the last fully visible row in the table.
|
|
2209
|
+
* If no row is fully visible or the table is empty, the method might return -1.
|
|
2210
|
+
*
|
|
2211
|
+
* @example
|
|
2212
|
+
* ```typescript
|
|
2213
|
+
* // Get the index of the last fully visible row
|
|
2214
|
+
* const lastVisibleRowIndex = tableApi.getLastFullVisibleRowIndex();
|
|
2215
|
+
*
|
|
2216
|
+
* // Use this information to determine if a specific row is fully visible
|
|
2217
|
+
* const isRowFullyVisible = rowIndex <= lastVisibleRowIndex && rowIndex >= tableApi.getFirstFullVisibleRowIndex();
|
|
2218
|
+
*
|
|
2219
|
+
* // Can be used with scrolling operations to ensure certain rows are visible
|
|
2220
|
+
* if (rowIndex > lastVisibleRowIndex) {
|
|
2221
|
+
* tableApi.ensureRowIsVisible(rowIndex);
|
|
2222
|
+
* }
|
|
2223
|
+
* ```
|
|
2224
|
+
*/
|
|
2225
|
+
getLastFullVisibleRowIndex() {
|
|
2226
|
+
return this.tableScope.getLastFullVisibleRowIndex();
|
|
2227
|
+
}
|
|
2228
|
+
/**
|
|
2229
|
+
* Checks whether logging is currently active for the table component.
|
|
2230
|
+
*
|
|
2231
|
+
* This method returns the current state of logging for the table. When logging is active,
|
|
2232
|
+
* the table outputs detailed information about its operations to the console, including:
|
|
2233
|
+
*
|
|
2234
|
+
* - Rendering processes and lifecycle events
|
|
2235
|
+
* - Data modifications and updates
|
|
2236
|
+
* - Event handling and user interactions
|
|
2237
|
+
* - Performance metrics and state changes
|
|
2238
|
+
*
|
|
2239
|
+
* Logging can be toggled using the `setLoggingActive(boolean)` method.
|
|
2240
|
+
*
|
|
2241
|
+
* @returns {boolean} True if logging is currently enabled, false otherwise.
|
|
2242
|
+
*
|
|
2243
|
+
* @example
|
|
2244
|
+
* // Check if logging is enabled
|
|
2245
|
+
* if (tableApi.isLoggingActive()) {
|
|
2246
|
+
* console.log("Table logging is currently active");
|
|
2247
|
+
* }
|
|
2248
|
+
*
|
|
2249
|
+
* // Conditionally enable logging only if it's not already active
|
|
2250
|
+
* if (!tableApi.isLoggingActive()) {
|
|
2251
|
+
* tableApi.setLoggingActive(true);
|
|
2252
|
+
*
|
|
2253
|
+
* // Perform operations that need debugging
|
|
2254
|
+
* tableApi.updateCells([
|
|
2255
|
+
* {
|
|
2256
|
+
* area: "body",
|
|
2257
|
+
* rowIndex: 2,
|
|
2258
|
+
* columnIndex: 3,
|
|
2259
|
+
* value: "New Value",
|
|
2260
|
+
* cssClasses: { "highlight": true }
|
|
2261
|
+
* }
|
|
2262
|
+
* ]);
|
|
2263
|
+
*
|
|
2264
|
+
* // Run some additional operations...
|
|
2265
|
+
*
|
|
2266
|
+
* // Disable logging when finished
|
|
2267
|
+
* tableApi.setLoggingActive(false);
|
|
2268
|
+
* }
|
|
2269
|
+
*/
|
|
2270
|
+
setLoggingActive(e) {
|
|
2271
|
+
this.tableScope.loggingActive = e;
|
|
2272
|
+
}
|
|
2273
|
+
/**
|
|
2274
|
+
* Checks whether logging is currently active for the table component.
|
|
2275
|
+
*
|
|
2276
|
+
* This method returns the current state of logging for the table. When logging is active,
|
|
2277
|
+
* the table outputs detailed information about its operations to the console, including:
|
|
2278
|
+
*
|
|
2279
|
+
* - Rendering processes and lifecycle events
|
|
2280
|
+
* - Data modifications and updates
|
|
2281
|
+
* - Event handling and user interactions
|
|
2282
|
+
* - Performance metrics and state changes
|
|
2283
|
+
*
|
|
2284
|
+
* Logging can be toggled using the `setLoggingActive(boolean)` method.
|
|
2285
|
+
*
|
|
2286
|
+
* @returns {boolean} True if logging is currently enabled, false otherwise.
|
|
2287
|
+
*
|
|
2288
|
+
* @example
|
|
2289
|
+
* // Check if logging is enabled
|
|
2290
|
+
* if (tableApi.isLoggingActive()) {
|
|
2291
|
+
* console.log("Table logging is currently active");
|
|
2292
|
+
* }
|
|
2293
|
+
*
|
|
2294
|
+
* // Conditionally enable logging only if it's not already active
|
|
2295
|
+
* if (!tableApi.isLoggingActive()) {
|
|
2296
|
+
* tableApi.setLoggingActive(true);
|
|
2297
|
+
*
|
|
2298
|
+
* // Perform operations that need debugging
|
|
2299
|
+
* tableApi.updateCells([
|
|
2300
|
+
* {
|
|
2301
|
+
* area: "body",
|
|
2302
|
+
* rowIndex: 2,
|
|
2303
|
+
* columnIndex: 3,
|
|
2304
|
+
* value: "New Value",
|
|
2305
|
+
* cssClasses: { "highlight": true }
|
|
2306
|
+
* }
|
|
2307
|
+
* ]);
|
|
2308
|
+
*
|
|
2309
|
+
* // Run some additional operations...
|
|
2310
|
+
*
|
|
2311
|
+
* // Disable logging when finished
|
|
2312
|
+
* tableApi.setLoggingActive(false);
|
|
2313
|
+
* }
|
|
2314
|
+
*/
|
|
2315
|
+
isLoggingActive() {
|
|
2316
|
+
return this.tableScope.loggingActive;
|
|
2317
|
+
}
|
|
1331
2318
|
}
|
|
1332
2319
|
class G {
|
|
1333
2320
|
constructor(e) {
|
|
@@ -1396,7 +2383,7 @@ class G {
|
|
|
1396
2383
|
// }
|
|
1397
2384
|
// }
|
|
1398
2385
|
}
|
|
1399
|
-
class
|
|
2386
|
+
class fe extends G {
|
|
1400
2387
|
constructor(e) {
|
|
1401
2388
|
super(e), this.SCROLL_STATE = "scrollState", this.scrollOffset = [0, 0], this.load();
|
|
1402
2389
|
}
|
|
@@ -1730,11 +2717,11 @@ class xe {
|
|
|
1730
2717
|
class Ce extends ye {
|
|
1731
2718
|
constructor(e, t, s, o) {
|
|
1732
2719
|
var r, a;
|
|
1733
|
-
super(e, t, s, o), this.dragging = !1, this.editing = !1, this.storedColumnWidths = [], this.scrollLeft = 0, this.scrollViewportLeft = 0, this.scrollFactorY = 0, this.scrollFactorX = 0, this.cleanupFunctions = {
|
|
2720
|
+
super(e, t, s, o), this.firstVisibleRowIndex = -1, this.lastVisibleRowIndex = -1, this.firstFullVisibleRowIndex = -1, this.lastFullVisibleRowIndex = -1, this.displayedRowCount = 0, this.pixelLimitForFullVisible = 5, this.loggingActive = !1, this.dragging = !1, this.editing = !1, this.storedColumnWidths = [], this.scrollLeft = 0, this.scrollViewportLeft = 0, this.scrollFactorY = 0, this.scrollFactorX = 0, this.cleanupFunctions = {
|
|
1734
2721
|
header: [],
|
|
1735
2722
|
body: [],
|
|
1736
2723
|
footer: []
|
|
1737
|
-
}, this.tree = !1, this.colAndRowspanModels = new xe(), this.
|
|
2724
|
+
}, this.tree = !1, this.colAndRowspanModels = new xe(), this.draggingTargetColumnIndex = -1, this.removables = [], this.tableModel.getSelectionModel ? this.getSelectionModel = this.tableModel.getSelectionModel : (r = this.tableOptions) != null && r.getSelectionModel && (this.getSelectionModel = this.tableOptions.getSelectionModel), (a = this.tableOptions) != null && a.getFocusModel && (this.getFocusModel = this.tableOptions.getFocusModel), $(t.getAreaModel("body")) && (this.tree = !0), ["header", "body", "footer"].forEach(
|
|
1738
2725
|
(l) => {
|
|
1739
2726
|
var n;
|
|
1740
2727
|
this.colAndRowspanModels[l] = new we(t, t.getAreaModel(l)), (n = this.colAndRowspanModels[l]) == null || n.init();
|
|
@@ -1893,6 +2880,21 @@ class Ce extends ye {
|
|
|
1893
2880
|
this.dom.setStyle(l, g, m[g]);
|
|
1894
2881
|
}
|
|
1895
2882
|
}
|
|
2883
|
+
getFirstVisibleRowIndex() {
|
|
2884
|
+
return this.firstVisibleRowIndex;
|
|
2885
|
+
}
|
|
2886
|
+
getLastVisibleRowIndex() {
|
|
2887
|
+
return this.lastVisibleRowIndex;
|
|
2888
|
+
}
|
|
2889
|
+
getFirstFullVisibleRowIndex() {
|
|
2890
|
+
return this.firstFullVisibleRowIndex;
|
|
2891
|
+
}
|
|
2892
|
+
getLastFullVisibleRowIndex() {
|
|
2893
|
+
return this.lastFullVisibleRowIndex;
|
|
2894
|
+
}
|
|
2895
|
+
getDisplayedRowCount() {
|
|
2896
|
+
return this.displayedRowCount;
|
|
2897
|
+
}
|
|
1896
2898
|
/**
|
|
1897
2899
|
* Stores the widths of all columns in the table.
|
|
1898
2900
|
*
|
|
@@ -1988,21 +2990,22 @@ class Ce extends ye {
|
|
|
1988
2990
|
* @protected
|
|
1989
2991
|
*/
|
|
1990
2992
|
adjustArea(e, t = 0) {
|
|
1991
|
-
var
|
|
2993
|
+
var u;
|
|
1992
2994
|
const s = this.getArea(e, "west"), o = this.getArea(e, "center"), i = this.getArea(e, "east"), r = o.child.clientHeight;
|
|
1993
2995
|
s.child.innerText = "", o.child.innerText = "", i.child.innerText = "";
|
|
1994
2996
|
const a = 0, l = this.areaBodyCenterGeo.width, n = this.tableModel.getPadding(), c = this.tableModel.getAreaModel(e), p = c.getRowCount();
|
|
1995
2997
|
for (; this.cleanupFunctions[e].length; ) {
|
|
1996
|
-
const
|
|
1997
|
-
|
|
2998
|
+
const f = this.cleanupFunctions[e].shift();
|
|
2999
|
+
f && f();
|
|
1998
3000
|
}
|
|
1999
3001
|
let h = t;
|
|
2000
3002
|
const m = this.tableModel.getColumnCount(), g = this.tableModel.getFixedRightColumnCount(), b = this.tableModel.getFixedLeftColumnCount();
|
|
2001
|
-
|
|
2002
|
-
|
|
3003
|
+
e === "body" && (this.firstVisibleRowIndex = -1, this.firstFullVisibleRowIndex = -1, this.lastVisibleRowIndex = -1, this.lastFullVisibleRowIndex = -1);
|
|
3004
|
+
for (let f = 0; f < p; f++) {
|
|
3005
|
+
const w = h, x = f === p - 1, v = this.tableModel.getRowHeight(e, f);
|
|
2003
3006
|
if (w + v > 0) {
|
|
2004
|
-
this.firstVisibleRowIndex =
|
|
2005
|
-
let y = { left: a, width: l, height: v, top: w, index:
|
|
3007
|
+
e === "body" && this.firstVisibleRowIndex === -1 && (this.firstVisibleRowIndex = f, this.firstFullVisibleRowIndex = w < -this.pixelLimitForFullVisible ? this.firstVisibleRowIndex + 1 : this.firstVisibleRowIndex);
|
|
3008
|
+
let y = { left: a, width: l, height: v, top: w, index: f }, S = this.dom.addRowDiv(o, y, f, e, "center");
|
|
2006
3009
|
const M = b;
|
|
2007
3010
|
if (this.adjustColumnsToRowParent({
|
|
2008
3011
|
areaIdent: e,
|
|
@@ -2010,57 +3013,60 @@ class Ce extends ye {
|
|
|
2010
3013
|
areaModel: c,
|
|
2011
3014
|
geo: y,
|
|
2012
3015
|
parent: S,
|
|
2013
|
-
rowIndex:
|
|
3016
|
+
rowIndex: f,
|
|
2014
3017
|
columnIndexStart: M,
|
|
2015
3018
|
columnIndexEnd: m - g - 1,
|
|
2016
3019
|
verticalFixed: !1,
|
|
2017
3020
|
lastRowOfModel: x
|
|
2018
|
-
}), n.left > 0 && (y = { left: a, width: this.areaBodyWestGeo.width, height: v, top: w, index:
|
|
3021
|
+
}), n.left > 0 && (y = { left: a, width: this.areaBodyWestGeo.width, height: v, top: w, index: f }, S = this.dom.addRowDiv(s, y, f, e, "west"), this.adjustColumnsToRowParent({
|
|
2019
3022
|
areaIdent: e,
|
|
2020
3023
|
sideIdent: "west",
|
|
2021
3024
|
areaModel: c,
|
|
2022
3025
|
geo: y,
|
|
2023
3026
|
parent: S,
|
|
2024
|
-
rowIndex:
|
|
3027
|
+
rowIndex: f,
|
|
2025
3028
|
columnIndexStart: 0,
|
|
2026
3029
|
columnIndexEnd: M - 1,
|
|
2027
3030
|
verticalFixed: !0,
|
|
2028
3031
|
lastRowOfModel: x
|
|
2029
|
-
})), n.right > 0 && (y = { left: a, width: this.areaBodyEastGeo.width, height: v, top: w, index:
|
|
3032
|
+
})), n.right > 0 && (y = { left: a, width: this.areaBodyEastGeo.width, height: v, top: w, index: f }, S = this.dom.addRowDiv(i, y, f, e, "east"), this.adjustColumnsToRowParent({
|
|
2030
3033
|
areaIdent: e,
|
|
2031
3034
|
sideIdent: "east",
|
|
2032
3035
|
areaModel: c,
|
|
2033
3036
|
geo: y,
|
|
2034
3037
|
parent: S,
|
|
2035
|
-
rowIndex:
|
|
3038
|
+
rowIndex: f,
|
|
2036
3039
|
columnIndexStart: m - g,
|
|
2037
3040
|
columnIndexEnd: m - 1,
|
|
2038
3041
|
verticalFixed: !0,
|
|
2039
3042
|
lastRowOfModel: x
|
|
2040
|
-
})), e === "header" && this.tree &&
|
|
2041
|
-
const
|
|
3043
|
+
})), e === "header" && this.tree && f === p - 1) {
|
|
3044
|
+
const R = this.dom.applyStyle(
|
|
2042
3045
|
this.dom.setAttribute(
|
|
2043
3046
|
this.dom.addDiv(S, new T(16, 20, 20, 8)),
|
|
2044
3047
|
"data-ge-action",
|
|
2045
3048
|
"toggleExpandCollapseAll"
|
|
2046
3049
|
),
|
|
2047
3050
|
{ cursor: "pointer" }
|
|
2048
|
-
),
|
|
2049
|
-
if (
|
|
2050
|
-
const
|
|
2051
|
-
this.dom.domService.appendChild(
|
|
3051
|
+
), E = this.tableOptions.treeOptions.arrowExpandCollapseAll;
|
|
3052
|
+
if (E) {
|
|
3053
|
+
const L = this.dom.domService.createText(E.content);
|
|
3054
|
+
this.dom.domService.appendChild(R, L), E.style && this.dom.applyStyleString(R, E.style);
|
|
2052
3055
|
}
|
|
2053
3056
|
}
|
|
2054
3057
|
}
|
|
2055
3058
|
if (h = h + v, h > r) {
|
|
2056
|
-
e === "body" && (this.displayedRowCount = this.
|
|
3059
|
+
e === "body" && (this.lastVisibleRowIndex = f, this.lastFullVisibleRowIndex = r - h < -this.pixelLimitForFullVisible ? f - 1 : f, this.displayedRowCount = this.lastFullVisibleRowIndex - this.firstFullVisibleRowIndex + 1);
|
|
2057
3060
|
break;
|
|
2058
3061
|
}
|
|
2059
3062
|
}
|
|
2060
|
-
if (this.
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
3063
|
+
if (this.loggingActive && e === "body" && console.log("render scope: this.firstVisibleRowIndex <- " + this.firstVisibleRowIndex + `
|
|
3064
|
+
render scope: this.firstFullVisibleRowIndex <- ` + this.firstFullVisibleRowIndex + `
|
|
3065
|
+
render scope: this.lastVisibleRowIndex <- ` + this.lastVisibleRowIndex + `
|
|
3066
|
+
render scope: this.lastFullVisibleRowIndex <- ` + this.lastFullVisibleRowIndex), this.colAndRowspanModels && this.colAndRowspanModels[e]) {
|
|
3067
|
+
const f = ((u = this.colAndRowspanModels[e]) == null ? void 0 : u.getRanges()) ?? [];
|
|
3068
|
+
if (f.length)
|
|
3069
|
+
for (const w of f) {
|
|
2064
3070
|
let x = 0, v = o.child, y = "center";
|
|
2065
3071
|
if (w.c1 < b)
|
|
2066
3072
|
v = s.child, y = "west";
|
|
@@ -2085,10 +3091,10 @@ class Ce extends ye {
|
|
|
2085
3091
|
* @protected
|
|
2086
3092
|
*/
|
|
2087
3093
|
drawBigCell(e, t, s, o, i, r) {
|
|
2088
|
-
const a = s + this.getRowHeights(0, e.r1 - 1, o).reduce((
|
|
3094
|
+
const a = s + this.getRowHeights(0, e.r1 - 1, o).reduce((u, f) => u + f, 0), l = this.tableModel.getColumnCount(), n = this.tableModel.getFixedRightColumnCount();
|
|
2089
3095
|
let c = 0;
|
|
2090
3096
|
n > 0 && e.c1 >= l - n && (c = l - n);
|
|
2091
|
-
const p = t + this.getColumnWidths(c, e.c1 - 1).reduce((
|
|
3097
|
+
const p = t + this.getColumnWidths(c, e.c1 - 1).reduce((u, f) => u + f, 0), h = this.getRowHeights(e.r1, e.r2, o).reduce((u, f) => u + f, 0), m = this.getColumnWidths(e.c1, e.c2).reduce((u, f) => u + f, 0);
|
|
2092
3098
|
let g = !1;
|
|
2093
3099
|
const b = this.getSelectionModel ? this.getSelectionModel() : void 0;
|
|
2094
3100
|
b && (g = b.getSelectionCount(e.r1, e.c1) > 0), e.gammaRange ? this.renderCell({
|
|
@@ -2172,44 +3178,44 @@ class Ce extends ye {
|
|
|
2172
3178
|
this.scrollViewportLeft = this.scrollViewport.scrollLeft;
|
|
2173
3179
|
let p = 0;
|
|
2174
3180
|
if (!n) {
|
|
2175
|
-
const
|
|
2176
|
-
p = this.scrollFactorX *
|
|
3181
|
+
const u = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
|
|
3182
|
+
p = this.scrollFactorX * u;
|
|
2177
3183
|
}
|
|
2178
3184
|
const h = 0, m = !!(e === "body" && t);
|
|
2179
3185
|
let g = p;
|
|
2180
|
-
for (let
|
|
2181
|
-
const
|
|
2182
|
-
if (w > 0 &&
|
|
3186
|
+
for (let u = a; u <= l; u++) {
|
|
3187
|
+
const f = g, w = this.tableModel.getColumnWidth(u);
|
|
3188
|
+
if (w > 0 && f + w > 0) {
|
|
2183
3189
|
let x = o.height;
|
|
2184
|
-
const v = s.getRowspanAt(r,
|
|
2185
|
-
v > 1 && (x = this.getRowHeights(r, r + v - 1, s).reduce((
|
|
3190
|
+
const v = s.getRowspanAt(r, u), y = s.getColspanAt(r, u);
|
|
3191
|
+
v > 1 && (x = this.getRowHeights(r, r + v - 1, s).reduce((R, E) => R + E, 0));
|
|
2186
3192
|
let S = w;
|
|
2187
|
-
y > 1 && (S = this.getColumnWidths(
|
|
3193
|
+
y > 1 && (S = this.getColumnWidths(u, u + y - 1).reduce((R, E) => R + E, 0));
|
|
2188
3194
|
let M = !1;
|
|
2189
|
-
if (this.colAndRowspanModels && this.colAndRowspanModels[e] && (b = this.colAndRowspanModels[e]) != null && b.isInRange(r,
|
|
2190
|
-
this.renderDragTargetDiv(i,
|
|
2191
|
-
const
|
|
2192
|
-
this.dom.addColumnBorderDivs(this.tableOptions, i,
|
|
3195
|
+
if (this.colAndRowspanModels && this.colAndRowspanModels[e] && (b = this.colAndRowspanModels[e]) != null && b.isInRange(r, u) && (M = !0), this.draggingTargetColumnIndex === u && e !== "header") {
|
|
3196
|
+
this.renderDragTargetDiv(i, f, h, S, x);
|
|
3197
|
+
const R = { left: f, top: h, width: S, height: x };
|
|
3198
|
+
this.dom.addColumnBorderDivs(this.tableOptions, i, R, e, t);
|
|
2193
3199
|
} else {
|
|
2194
|
-
const
|
|
2195
|
-
"gammaCells" in s && s.getValueAt(r,
|
|
3200
|
+
const R = this.renderSelectedBackgroundDiv(M, m, t, s, r, u, i, f, h, S, x);
|
|
3201
|
+
"gammaCells" in s && s.getValueAt(r, u) && (M = !1), M || this.renderCell({
|
|
2196
3202
|
areaModel: s,
|
|
2197
3203
|
areaIdent: e,
|
|
2198
3204
|
sideIdent: t,
|
|
2199
3205
|
rowIndex: r,
|
|
2200
|
-
columnIndex:
|
|
2201
|
-
left:
|
|
3206
|
+
columnIndex: u,
|
|
3207
|
+
left: f,
|
|
2202
3208
|
top: h,
|
|
2203
3209
|
width: S,
|
|
2204
3210
|
height: x,
|
|
2205
3211
|
parent: i,
|
|
2206
|
-
cellSelected:
|
|
3212
|
+
cellSelected: R,
|
|
2207
3213
|
lastRowOfModel: c,
|
|
2208
3214
|
gammaRange: !0
|
|
2209
3215
|
}), e === "header" && this.tableOptions.columnsResizable && this.renderHeaderCellResizeHandle({
|
|
2210
3216
|
rowIndex: r,
|
|
2211
|
-
columnIndex:
|
|
2212
|
-
cellLeft:
|
|
3217
|
+
columnIndex: u,
|
|
3218
|
+
cellLeft: f,
|
|
2213
3219
|
cellTop: h,
|
|
2214
3220
|
cellWidth: S,
|
|
2215
3221
|
cellHeight: x,
|
|
@@ -2249,10 +3255,10 @@ class Ce extends ye {
|
|
|
2249
3255
|
}) {
|
|
2250
3256
|
var U;
|
|
2251
3257
|
const m = this.editorRenderer && this.editorRendererRow === o && this.editorRendererColumn === i ? this.editorRenderer : e.getCellRenderer(o, i), g = { left: r, width: a, height: l, top: n, index: i }, b = e.getRowByIndex(o);
|
|
2252
|
-
let
|
|
2253
|
-
if (i === this.getTreeArrowColumnIndex() &&
|
|
3258
|
+
let u = "none";
|
|
3259
|
+
if (i === this.getTreeArrowColumnIndex() && O(b)) {
|
|
2254
3260
|
const C = b;
|
|
2255
|
-
(U = C.children) != null && U.length ? C.expanded ?
|
|
3261
|
+
(U = C.children) != null && U.length ? C.expanded ? u = "expanded" : u = "collapsed" : u = "hidden";
|
|
2256
3262
|
}
|
|
2257
3263
|
let w;
|
|
2258
3264
|
if (t === "header") {
|
|
@@ -2268,28 +3274,28 @@ class Ce extends ye {
|
|
|
2268
3274
|
areaIdent: t,
|
|
2269
3275
|
sideIdent: s,
|
|
2270
3276
|
text: v,
|
|
2271
|
-
treeArrow:
|
|
3277
|
+
treeArrow: u,
|
|
2272
3278
|
tableOptions: this.tableOptions,
|
|
2273
3279
|
checkedType: y,
|
|
2274
3280
|
sortState: w
|
|
2275
3281
|
}
|
|
2276
3282
|
), M = e.getTooltipAt(o, i);
|
|
2277
3283
|
M && this.dom.setAttribute(S, "title", M);
|
|
2278
|
-
const
|
|
2279
|
-
|
|
2280
|
-
let
|
|
2281
|
-
m && (
|
|
2282
|
-
const
|
|
2283
|
-
if (
|
|
3284
|
+
const R = this.tableModel.getColumnDef(i);
|
|
3285
|
+
R && R.classes[t] && this.dom.addClasses(R.classes[t], S);
|
|
3286
|
+
let E;
|
|
3287
|
+
m && (E = m.render(S, o, i, t, e, x, this.dom.domService));
|
|
3288
|
+
const L = e.getCustomClassesAt(o, i);
|
|
3289
|
+
if (L.length && this.dom.addClasses(L, S), this.dom.addColumnBorderDivs(this.tableOptions, c, g, t, s), p && this.dom.addHorizontalBorder({ left: r, width: a, height: l, top: n + l }, c), this.getFocusModel && t === "body") {
|
|
2284
3290
|
const C = this.getFocusModel();
|
|
2285
3291
|
C != null && C.hasFocus(o, i) && this.dom.addFocusBorderDivs(c, g, {});
|
|
2286
3292
|
}
|
|
2287
3293
|
t === "header" && this.dom.setAttribute(S, "data-ge-action", "drag-column");
|
|
2288
|
-
const
|
|
2289
|
-
if (
|
|
2290
|
-
for (const C in
|
|
2291
|
-
this.dom.setStyle(S, C,
|
|
2292
|
-
return [S,
|
|
3294
|
+
const W = e.getCustomStyleAt(o, i);
|
|
3295
|
+
if (W)
|
|
3296
|
+
for (const C in W)
|
|
3297
|
+
this.dom.setStyle(S, C, W[C]);
|
|
3298
|
+
return [S, E];
|
|
2293
3299
|
}
|
|
2294
3300
|
/**
|
|
2295
3301
|
* Applies CSS classes to an HTML element.
|
|
@@ -2455,7 +3461,7 @@ class Ce extends ye {
|
|
|
2455
3461
|
if (r) {
|
|
2456
3462
|
const a = e.index ?? 0, l = this.draggingColumn;
|
|
2457
3463
|
for (let n = 0; n < r; n++) {
|
|
2458
|
-
const c = s, p = i.getRowHeight(n), h = { left: 0, width: e.width, height: p, top: c, index: n }, m = i.getValueAt(n, a), g = i.getCellRenderer(n, a), b = g ? "" : `${m}`,
|
|
3464
|
+
const c = s, p = i.getRowHeight(n), h = { left: 0, width: e.width, height: p, top: c, index: n }, m = i.getValueAt(n, a), g = i.getCellRenderer(n, a), b = g ? "" : `${m}`, u = {
|
|
2459
3465
|
parent: l,
|
|
2460
3466
|
geo: h,
|
|
2461
3467
|
rowIndex: n,
|
|
@@ -2463,17 +3469,17 @@ class Ce extends ye {
|
|
|
2463
3469
|
areaIdent: t,
|
|
2464
3470
|
sideIdent: o,
|
|
2465
3471
|
text: b
|
|
2466
|
-
},
|
|
3472
|
+
}, f = this.dom.addColumnDiv(u);
|
|
2467
3473
|
let w;
|
|
2468
|
-
g && (w = g.render(
|
|
3474
|
+
g && (w = g.render(f, n, a, t, i, m, this.dom.domService), w && this.cleanupFunctions[t].push(w));
|
|
2469
3475
|
const x = i.getCustomClassesAt(n, a);
|
|
2470
|
-
x.length && this.dom.addClasses(x,
|
|
3476
|
+
x.length && this.dom.addClasses(x, f);
|
|
2471
3477
|
const v = this.tableModel.getColumnDef(a);
|
|
2472
|
-
v && v.classes[t] && this.dom.addClasses(v.classes[t],
|
|
3478
|
+
v && v.classes[t] && this.dom.addClasses(v.classes[t], f), this.dom.addColumnBorderDivs(this.tableOptions, l, h, t, o);
|
|
2473
3479
|
const y = i.getCustomStyleAt(n, a);
|
|
2474
3480
|
if (y)
|
|
2475
3481
|
for (const S in y)
|
|
2476
|
-
this.dom.setStyle(
|
|
3482
|
+
this.dom.setStyle(f, S, y[S]);
|
|
2477
3483
|
s = s + p;
|
|
2478
3484
|
}
|
|
2479
3485
|
}
|
|
@@ -2531,11 +3537,11 @@ class Ce extends ye {
|
|
|
2531
3537
|
const g = m.getSelectionCount(i, r);
|
|
2532
3538
|
h = g > 0;
|
|
2533
3539
|
for (let b = 0; b < g; b++) {
|
|
2534
|
-
const
|
|
3540
|
+
const u = this.dom.applyStylePosistionAbsolute(
|
|
2535
3541
|
// ge-table-body-west-selected-range
|
|
2536
3542
|
this.dom.createDivWithClass(`ge-table-${o.areaIdent}-${s}-selected-range`, a)
|
|
2537
3543
|
);
|
|
2538
|
-
this.dom.setStyle(
|
|
3544
|
+
this.dom.setStyle(u, "left", `${l}px`), this.dom.setStyle(u, "top", `${n}px`), this.dom.setStyle(u, "width", `${c}px`), this.dom.setStyle(u, "height", `${p}px`);
|
|
2539
3545
|
}
|
|
2540
3546
|
}
|
|
2541
3547
|
}
|
|
@@ -2635,7 +3641,7 @@ class Ae {
|
|
|
2635
3641
|
}
|
|
2636
3642
|
}
|
|
2637
3643
|
}
|
|
2638
|
-
class
|
|
3644
|
+
class Re {
|
|
2639
3645
|
constructor(e = -1, t = -1) {
|
|
2640
3646
|
this.rowIndex = e, this.columnIndex = t;
|
|
2641
3647
|
}
|
|
@@ -2645,10 +3651,10 @@ class z {
|
|
|
2645
3651
|
this.cells = e;
|
|
2646
3652
|
}
|
|
2647
3653
|
static createSingle(e, t) {
|
|
2648
|
-
return new z([new
|
|
3654
|
+
return new z([new Re(e, t)]);
|
|
2649
3655
|
}
|
|
2650
3656
|
}
|
|
2651
|
-
class
|
|
3657
|
+
class Ee {
|
|
2652
3658
|
constructor(e) {
|
|
2653
3659
|
var t, s;
|
|
2654
3660
|
this.tableScope = e, (t = this.tableScope.tableOptions) != null && t.getSelectionModel && (this.getSelectionModel = this.tableScope.tableOptions.getSelectionModel), (s = this.tableScope.tableOptions) != null && s.getFocusModel && (this.getFocusModel = this.tableScope.tableOptions.getFocusModel);
|
|
@@ -2731,7 +3737,7 @@ class Te {
|
|
|
2731
3737
|
};
|
|
2732
3738
|
}
|
|
2733
3739
|
}
|
|
2734
|
-
function
|
|
3740
|
+
function Fe(d) {
|
|
2735
3741
|
return d.trim().replace(/\+/g, " ").replace(/ +/g, " ").replace(/⌫/g, "backspace").replace(/↩/g, "enter").replace(/⇧/g, "shift").replace(/⌥/g, "alt").replace(/option/g, "alt").replace(/opt/g, "alt").replace(/⌃/g, "ctrl").replace(/control/g, "ctrl").replace(/command/g, "cmd").replace(/meta/g, "cmd").replace(/escape/g, "esc").replace(/⌘/g, "cmd").replace(/\*/g, "multiply").split(" ").filter((e) => e).filter((e, t, s) => s.indexOf(e) === t).sort((e, t) => {
|
|
2736
3742
|
const s = { cmd: 1, ctrl: 2, alt: 3, shift: 4 }, o = s[e] || 5, i = s[t] || 5;
|
|
2737
3743
|
return o !== i ? o - i : e.localeCompare(t);
|
|
@@ -2745,9 +3751,9 @@ function X(d) {
|
|
|
2745
3751
|
}
|
|
2746
3752
|
d.code.match(/^F\d+$/) && (e = d.code.toLowerCase()), d.code.match(/^Digit\d+$/) && (e = d.code.replace(/Digit/g, ""));
|
|
2747
3753
|
let t = "";
|
|
2748
|
-
return d.ctrlKey && (t += " ctrl"), d.altKey && (t += t + " alt"), d.shiftKey && (t += t + " shift"), d.metaKey && (t += t + " cmd"),
|
|
3754
|
+
return d.ctrlKey && (t += " ctrl"), d.altKey && (t += t + " alt"), d.shiftKey && (t += t + " shift"), d.metaKey && (t += t + " cmd"), Fe(t + " " + e);
|
|
2749
3755
|
}
|
|
2750
|
-
class
|
|
3756
|
+
class De {
|
|
2751
3757
|
constructor(e) {
|
|
2752
3758
|
this.tableScope = e, this.shortcutActionIdMapping = {}, this.listener = [], this.listener.push(e), this.init();
|
|
2753
3759
|
}
|
|
@@ -2889,7 +3895,7 @@ class Q {
|
|
|
2889
3895
|
e.setAttribute(t, s);
|
|
2890
3896
|
}
|
|
2891
3897
|
}
|
|
2892
|
-
class
|
|
3898
|
+
class Ie {
|
|
2893
3899
|
render(e, t, s, o, i, r, a) {
|
|
2894
3900
|
if (i.isEditable(t, s)) {
|
|
2895
3901
|
a.addClass(e, "ge-table-row-input-div");
|
|
@@ -2910,7 +3916,7 @@ class ke {
|
|
|
2910
3916
|
}
|
|
2911
3917
|
}
|
|
2912
3918
|
}
|
|
2913
|
-
class
|
|
3919
|
+
class ke {
|
|
2914
3920
|
constructor(e = "none", t = "single") {
|
|
2915
3921
|
this.selectionType = e, this.selectionMode = t, this.ranges = [], this.negativeRanges = [], this.allSelected = !1, this.silent = !1, this.listenerArr = [];
|
|
2916
3922
|
}
|
|
@@ -2992,7 +3998,7 @@ class Ie {
|
|
|
2992
3998
|
this.selectionType !== "none" && (this.allSelected = !1, this.selectionMode === "single" && (this.ranges = []), this.selectionType === "row" ? (e.c1 = 0, e.c2 = Number.MAX_SAFE_INTEGER) : this.selectionType === "column" ? (e.r1 = 0, e.r2 = Number.MAX_SAFE_INTEGER) : this.selectionType === "cell" ? (e.r2 = e.r1, e.c2 = e.c1) : this.selectionType, this.ranges.push(e), this.fireChangeEvent());
|
|
2993
3999
|
}
|
|
2994
4000
|
}
|
|
2995
|
-
class
|
|
4001
|
+
class Le {
|
|
2996
4002
|
constructor(e = "none") {
|
|
2997
4003
|
this.selectionType = e, this.rowIndex = -1, this.columnIndex = -1, this.changed = !1, this.listenerArr = [];
|
|
2998
4004
|
}
|
|
@@ -3030,11 +4036,11 @@ class Oe {
|
|
|
3030
4036
|
}
|
|
3031
4037
|
}
|
|
3032
4038
|
class ee {
|
|
3033
|
-
constructor(e = new
|
|
4039
|
+
constructor(e = new F(
|
|
3034
4040
|
"❯",
|
|
3035
4041
|
"",
|
|
3036
4042
|
["gt-table-icon-expanded"]
|
|
3037
|
-
), t = new
|
|
4043
|
+
), t = new F(
|
|
3038
4044
|
"❯",
|
|
3039
4045
|
"transform: rotate(180deg) translate(-100%, -100%); transform-origin: 0 0;",
|
|
3040
4046
|
["ge-table-icon-collapsed"]
|
|
@@ -3043,17 +4049,17 @@ class ee {
|
|
|
3043
4049
|
}
|
|
3044
4050
|
// `⊖ `, `⊕ `;
|
|
3045
4051
|
}
|
|
3046
|
-
const
|
|
4052
|
+
const Oe = new ke(), Be = new Le("cell");
|
|
3047
4053
|
class te {
|
|
3048
4054
|
constructor() {
|
|
3049
4055
|
this.overflowX = "auto", this.overflowY = "auto", this.horizontalBorderVisible = !0, this.verticalBorderVisible = !0, this.footerSeparatorBorderVisible = !0, this.headerSeparatorBorderVisible = !0, this.fixedEastSeparatorBorderVisible = !0, this.fixedWestSeparatorBorderVisible = !0, this.tableTopBorderVisible = !0, this.tableBottomBorderVisible = !0, this.hoverRowVisible = !0, this.hoverColumnVisible = !0, this.columnsResizable = !0, this.columnsDraggable = !0, this.columnResizeHandleWidthInPx = 4, this.defaultRowHeights = {
|
|
3050
4056
|
header: 34,
|
|
3051
4057
|
body: 34,
|
|
3052
4058
|
footer: 34
|
|
3053
|
-
}, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new J(), this.headerGroupOptions = new ee(), this.showCheckboxWihoutExtraColumn = !1, this.externalFilterFunction = void 0, this.sortedOptions = new Z(), this.sortOrder = ["asc", "desc"], this.shortcutActionsDisabled = !1, this.resizeEventDebounceDelay = 500, this.getEditRenderer = (e, t) => new
|
|
4059
|
+
}, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new J(), this.headerGroupOptions = new ee(), this.showCheckboxWihoutExtraColumn = !1, this.externalFilterFunction = void 0, this.sortedOptions = new Z(), this.sortOrder = ["asc", "desc"], this.shortcutActionsDisabled = !1, this.resizeEventDebounceDelay = 500, this.getEditRenderer = (e, t) => new Ie(), this.getSelectionModel = () => Oe, this.getFocusModel = () => Be;
|
|
3054
4060
|
}
|
|
3055
4061
|
}
|
|
3056
|
-
const
|
|
4062
|
+
const k = class k {
|
|
3057
4063
|
/**
|
|
3058
4064
|
* Returns the content to be copied based on the provided table model, selection model, and focus model.
|
|
3059
4065
|
*
|
|
@@ -3076,9 +4082,9 @@ const I = class I {
|
|
|
3076
4082
|
const p = t.isSelected(l, c) ? e.getBodyModel().getTextValueAt(l, c) : "";
|
|
3077
4083
|
n.push(p);
|
|
3078
4084
|
}
|
|
3079
|
-
a.push(n.join(
|
|
4085
|
+
a.push(n.join(k.columnSeparatorChar));
|
|
3080
4086
|
}
|
|
3081
|
-
return o(a.join(
|
|
4087
|
+
return o(a.join(k.rowSeparatorChar));
|
|
3082
4088
|
}
|
|
3083
4089
|
}
|
|
3084
4090
|
if (s) {
|
|
@@ -3135,9 +4141,9 @@ const I = class I {
|
|
|
3135
4141
|
return t;
|
|
3136
4142
|
}
|
|
3137
4143
|
};
|
|
3138
|
-
|
|
4144
|
+
k.columnSeparatorChar = " ", k.rowSeparatorChar = `
|
|
3139
4145
|
`;
|
|
3140
|
-
let B =
|
|
4146
|
+
let B = k;
|
|
3141
4147
|
class Pe {
|
|
3142
4148
|
constructor(e, t = 500) {
|
|
3143
4149
|
this.tableScope = e, this.debounceDelay = t, new ResizeObserver(ne(this.handleResize.bind(this), t)).observe(this.tableScope.hostElement);
|
|
@@ -3147,7 +4153,7 @@ class Pe {
|
|
|
3147
4153
|
this.tableScope.recalcColumnWidths(s);
|
|
3148
4154
|
}
|
|
3149
4155
|
}
|
|
3150
|
-
class
|
|
4156
|
+
class Ve {
|
|
3151
4157
|
/**
|
|
3152
4158
|
* Downloads a matrix data as an Excel file.
|
|
3153
4159
|
*
|
|
@@ -3228,8 +4234,8 @@ class We {
|
|
|
3228
4234
|
let s = 0;
|
|
3229
4235
|
const o = [];
|
|
3230
4236
|
e.forEach((p, h) => {
|
|
3231
|
-
const m = new TextEncoder().encode(h), g = new TextEncoder().encode(p), b = new Uint8Array(30 + m.length),
|
|
3232
|
-
b.set([80, 75, 3, 4], 0),
|
|
4237
|
+
const m = new TextEncoder().encode(h), g = new TextEncoder().encode(p), b = new Uint8Array(30 + m.length), u = new DataView(b.buffer);
|
|
4238
|
+
b.set([80, 75, 3, 4], 0), u.setUint16(4, 20, !0), u.setUint16(6, 0, !0), u.setUint16(8, 0, !0), u.setUint16(10, 0, !0), u.setUint16(12, 0, !0), u.setUint32(14, 0, !0), u.setUint32(18, g.length, !0), u.setUint32(22, g.length, !0), u.setUint16(26, m.length, !0), u.setUint16(28, 0, !0), b.set(m, 30), t.push(b, g), o.push({
|
|
3233
4239
|
path: h,
|
|
3234
4240
|
offset: s,
|
|
3235
4241
|
contentSize: g.length
|
|
@@ -3254,13 +4260,13 @@ class We {
|
|
|
3254
4260
|
}
|
|
3255
4261
|
}
|
|
3256
4262
|
class N extends Ce {
|
|
3257
|
-
constructor(e, t, s, o, i, r = new B(), a = new
|
|
4263
|
+
constructor(e, t, s, o, i, r = new B(), a = new Ve()) {
|
|
3258
4264
|
var c;
|
|
3259
|
-
if (super(e, t, new ce(s), o), this.eventListener = i, this.copyService = r, this.excelService = a, this.licenseManager =
|
|
4265
|
+
if (super(e, t, new ce(s), o), this.eventListener = i, this.copyService = r, this.excelService = a, this.licenseManager = I.getInstance(), this.selectionService = new Ee(this), this.api = new ue(this), this.mouseStartAction = "", this.mouseStartWidth = -1, this.mouseStartColumnIndex = -1, this.dragFrom = -1, this.dragTo = -1, this.lastDragFrom = -1, this.lastDragTo = -1, this.firstDraggingRendering = !0, this.lastContextmenu = Date.now(), t.setTableScope(this), i || (this.eventListener = new K()), (c = this.tableOptions) != null && c.autoRestoreOptions) {
|
|
3260
4266
|
const p = this.tableOptions.autoRestoreOptions, h = p.getStorageKeyFn;
|
|
3261
|
-
h && (p.autoRestoreScrollPosition && (this.storeScrollPosStateService = new
|
|
4267
|
+
h && (p.autoRestoreScrollPosition && (this.storeScrollPosStateService = new fe(h)), p.autoRestoreCollapsedExpandedState && (this.storeStateCollapsedExpandService = new be(h)), p.autoRestoreSortingState && (this.storeSortingService = new Se(h)));
|
|
3262
4268
|
}
|
|
3263
|
-
this.mouseHandler = new he(this), this.inputHandler = new Ae(this), this.resizeHandler = new Pe(this, o.resizeEventDebounceDelay), this.shortcutService = new
|
|
4269
|
+
this.mouseHandler = new he(this), this.inputHandler = new Ae(this), this.resizeHandler = new Pe(this, o.resizeEventDebounceDelay), this.shortcutService = new De(this), this.shortcutService.addListener(this.selectionService);
|
|
3264
4270
|
const l = this.getSelectionModel ? this.getSelectionModel() : void 0;
|
|
3265
4271
|
l && l.addEventSelectionChangedListener(this);
|
|
3266
4272
|
const n = this.getFocusModel ? this.getFocusModel() : void 0;
|
|
@@ -3336,7 +4342,7 @@ class N extends Ce {
|
|
|
3336
4342
|
* @return {GeMouseEvent} - The created GeMouseEvent object.
|
|
3337
4343
|
*/
|
|
3338
4344
|
createGeMouseEvent(e) {
|
|
3339
|
-
const t = new
|
|
4345
|
+
const t = new H();
|
|
3340
4346
|
if (t.originalEvent = e, e) {
|
|
3341
4347
|
const s = e.target;
|
|
3342
4348
|
if ([t.areaIdent, t.sideIdent] = this.getAreaAndSideIdentByAttr(s), t.rowIndex = this.getNumberByAttr(s, "data-row-index"), t.columnIndex = this.getNumberByAttr(s, "data-col-index"), t.action = this.getStringByAttr(s, "data-ge-action"), t.areaIdent) {
|
|
@@ -3412,7 +4418,7 @@ class N extends Ce {
|
|
|
3412
4418
|
toggleExpandCollapseAll(e = !0) {
|
|
3413
4419
|
var s;
|
|
3414
4420
|
const t = this.tableModel.getBodyModel();
|
|
3415
|
-
|
|
4421
|
+
$(t) && (t.toggleExpandCollapseAll(e), this.repaint(), (s = this.storeStateCollapsedExpandService) == null || s.collapsedStateAll(e));
|
|
3416
4422
|
}
|
|
3417
4423
|
/**
|
|
3418
4424
|
* Toggles the checkbox state of a specific row in a table.
|
|
@@ -3628,7 +4634,7 @@ class N extends Ce {
|
|
|
3628
4634
|
const s = this.tableOptions.autoRestoreOptions, o = s.getRowId;
|
|
3629
4635
|
if (s.autoRestoreCollapsedExpandedState && o) {
|
|
3630
4636
|
const i = this.storeStateCollapsedExpandService.collapsedExpandedStateGet(), r = this.tableModel.getAreaModel("body");
|
|
3631
|
-
if (
|
|
4637
|
+
if ($(r)) {
|
|
3632
4638
|
const a = r, l = r.getRowCount();
|
|
3633
4639
|
for (let n = 0; n < l; n++) {
|
|
3634
4640
|
const c = r.getRowByIndex(n);
|
|
@@ -3681,9 +4687,6 @@ class N extends Ce {
|
|
|
3681
4687
|
sort(e) {
|
|
3682
4688
|
this.tableModel.sort(e);
|
|
3683
4689
|
}
|
|
3684
|
-
getDisplayedRowCount() {
|
|
3685
|
-
return this.displayedRowCount;
|
|
3686
|
-
}
|
|
3687
4690
|
/**
|
|
3688
4691
|
* Ensures that a specific row is visible in the viewport by scrolling if necessary.
|
|
3689
4692
|
* This method checks if the target row is within the currently visible range and
|
|
@@ -3736,11 +4739,8 @@ class N extends Ce {
|
|
|
3736
4739
|
* @see {@link getDisplayedRowCount} - Related method for getting visible row count
|
|
3737
4740
|
*/
|
|
3738
4741
|
ensureRowIsVisible(e) {
|
|
3739
|
-
const t = this.
|
|
3740
|
-
return e < t ? (this.scrollToIndex(0, e
|
|
3741
|
-
}
|
|
3742
|
-
getFirstVisibleRowIndex() {
|
|
3743
|
-
return this.firstVisibleRowIndex;
|
|
4742
|
+
const t = this.getFirstFullVisibleRowIndex(), s = this.getLastFullVisibleRowIndex(), o = this.getDisplayedRowCount();
|
|
4743
|
+
return e < t ? (this.scrollToIndex(0, e), !0) : e > s ? (this.scrollToIndex(0, e - o + 1), !0) : !1;
|
|
3744
4744
|
}
|
|
3745
4745
|
}
|
|
3746
4746
|
const P = class P {
|
|
@@ -3980,14 +4980,14 @@ P.themes = ["light", "combat", "paper", "blackboard"], P.vars = {
|
|
|
3980
4980
|
}`
|
|
3981
4981
|
};
|
|
3982
4982
|
let Y = P;
|
|
3983
|
-
const
|
|
4983
|
+
const V = class V {
|
|
3984
4984
|
constructor(e = new ee()) {
|
|
3985
4985
|
this.headerGroupOptions = e;
|
|
3986
4986
|
}
|
|
3987
4987
|
render(e, t, s, o, i, r, a) {
|
|
3988
4988
|
const l = r != null && r.data ? r.data : "";
|
|
3989
4989
|
if (r) {
|
|
3990
|
-
const { toggle: n, visibility: c, closed: p } = r, h = n ?
|
|
4990
|
+
const { toggle: n, visibility: c, closed: p } = r, h = n ? V.toggleHeaderGroup : "";
|
|
3991
4991
|
this.addText(e, o, t, s, l, h), n && c !== "always" && this.addArrowDiv(a, e, !p, t, s, o, h);
|
|
3992
4992
|
} else
|
|
3993
4993
|
this.addText(e, o, t, s, l, "");
|
|
@@ -4019,9 +5019,9 @@ const W = class W {
|
|
|
4019
5019
|
}
|
|
4020
5020
|
}
|
|
4021
5021
|
};
|
|
4022
|
-
|
|
4023
|
-
let q =
|
|
4024
|
-
const
|
|
5022
|
+
V.toggleHeaderGroup = "toggleHeaderGroup";
|
|
5023
|
+
let q = V;
|
|
5024
|
+
const We = se({
|
|
4025
5025
|
inheritAttrs: !1,
|
|
4026
5026
|
props: {
|
|
4027
5027
|
tableModel: {
|
|
@@ -4095,24 +5095,24 @@ const $e = se({
|
|
|
4095
5095
|
};
|
|
4096
5096
|
return ie(() => {
|
|
4097
5097
|
t.value && s(t.value);
|
|
4098
|
-
}), d.licenseKey &&
|
|
5098
|
+
}), d.licenseKey && I.getInstance().setLicenseKey(d.licenseKey), {
|
|
4099
5099
|
root: t
|
|
4100
5100
|
};
|
|
4101
5101
|
}
|
|
4102
|
-
}),
|
|
5102
|
+
}), $e = (d, e) => {
|
|
4103
5103
|
const t = d.__vccOpts || d;
|
|
4104
5104
|
for (const [s, o] of e)
|
|
4105
5105
|
t[s] = o;
|
|
4106
5106
|
return t;
|
|
4107
|
-
},
|
|
5107
|
+
}, He = {
|
|
4108
5108
|
ref: "root",
|
|
4109
5109
|
class: "container-div",
|
|
4110
5110
|
style: { width: "100%", height: "100%", "background-color": "transparent", padding: "0", margin: "0" }
|
|
4111
5111
|
};
|
|
4112
5112
|
function _e(d, e, t, s, o, i) {
|
|
4113
|
-
return ae(), re("div",
|
|
5113
|
+
return ae(), re("div", He, null, 512);
|
|
4114
5114
|
}
|
|
4115
|
-
const Ge = /* @__PURE__ */
|
|
5115
|
+
const Ge = /* @__PURE__ */ $e(We, [["render", _e]]);
|
|
4116
5116
|
class Ne {
|
|
4117
5117
|
constructor(e, t) {
|
|
4118
5118
|
this.component = e, this.appContext = t;
|