@guiexpert/svelte-table 4.1.78 → 4.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.
Files changed (3) hide show
  1. package/index.cjs +9 -6
  2. package/index.js +1194 -194
  3. package/package.json +5 -3
package/index.js CHANGED
@@ -19,10 +19,10 @@ function pe(n) {
19
19
  function Ae(n, e) {
20
20
  return n != n ? e == e : n !== e || n && typeof n == "object" || typeof n == "function";
21
21
  }
22
- function Ee(n) {
22
+ function Re(n) {
23
23
  return Object.keys(n).length === 0;
24
24
  }
25
- function Re(n, e, t) {
25
+ function Ee(n, e, t) {
26
26
  n.insertBefore(e, t || null);
27
27
  }
28
28
  function ge(n) {
@@ -37,63 +37,63 @@ function Te(n, e, t) {
37
37
  function De(n) {
38
38
  return Array.from(n.childNodes);
39
39
  }
40
- function _(n, e, t, s) {
40
+ function V(n, e, t, s) {
41
41
  t == null ? n.style.removeProperty(e) : n.style.setProperty(e, t, "");
42
42
  }
43
43
  let Z;
44
- function $(n) {
44
+ function _(n) {
45
45
  Z = n;
46
46
  }
47
- const O = [], K = [];
47
+ const L = [], K = [];
48
48
  let P = [];
49
- const ae = [], ke = /* @__PURE__ */ Promise.resolve();
49
+ const ae = [], Fe = /* @__PURE__ */ Promise.resolve();
50
50
  let Y = !1;
51
- function Fe() {
52
- Y || (Y = !0, ke.then(fe));
51
+ function Ie() {
52
+ Y || (Y = !0, Fe.then(fe));
53
53
  }
54
54
  function J(n) {
55
55
  P.push(n);
56
56
  }
57
57
  const X = /* @__PURE__ */ new Set();
58
- let I = 0;
58
+ let k = 0;
59
59
  function fe() {
60
- if (I !== 0)
60
+ if (k !== 0)
61
61
  return;
62
62
  const n = Z;
63
63
  do {
64
64
  try {
65
- for (; I < O.length; ) {
66
- const e = O[I];
67
- I++, $(e), Ie(e.$$);
65
+ for (; k < L.length; ) {
66
+ const e = L[k];
67
+ k++, _(e), ke(e.$$);
68
68
  }
69
69
  } catch (e) {
70
- throw O.length = 0, I = 0, e;
70
+ throw L.length = 0, k = 0, e;
71
71
  }
72
- for ($(null), O.length = 0, I = 0; K.length; ) K.pop()();
72
+ for (_(null), L.length = 0, k = 0; K.length; ) K.pop()();
73
73
  for (let e = 0; e < P.length; e += 1) {
74
74
  const t = P[e];
75
75
  X.has(t) || (X.add(t), t());
76
76
  }
77
77
  P.length = 0;
78
- } while (O.length);
78
+ } while (L.length);
79
79
  for (; ae.length; )
80
80
  ae.pop()();
81
- Y = !1, X.clear(), $(n);
81
+ Y = !1, X.clear(), _(n);
82
82
  }
83
- function Ie(n) {
83
+ function ke(n) {
84
84
  if (n.fragment !== null) {
85
85
  n.update(), z(n.before_update);
86
86
  const e = n.dirty;
87
87
  n.dirty = [-1], n.fragment && n.fragment.p(n.ctx, e), n.after_update.forEach(J);
88
88
  }
89
89
  }
90
- function Oe(n) {
90
+ function Le(n) {
91
91
  const e = [], t = [];
92
92
  P.forEach((s) => n.indexOf(s) === -1 ? e.push(s) : t.push(s)), t.forEach((s) => s()), P = e;
93
93
  }
94
- const Le = /* @__PURE__ */ new Set();
94
+ const Oe = /* @__PURE__ */ new Set();
95
95
  function Be(n, e) {
96
- n && n.i && (Le.delete(n), n.i(e));
96
+ n && n.i && (Oe.delete(n), n.i(e));
97
97
  }
98
98
  function Pe(n, e, t) {
99
99
  const { fragment: s, after_update: o } = n.$$;
@@ -102,16 +102,16 @@ function Pe(n, e, t) {
102
102
  n.$$.on_destroy ? n.$$.on_destroy.push(...i) : z(i), n.$$.on_mount = [];
103
103
  }), o.forEach(J);
104
104
  }
105
- function _e(n, e) {
105
+ function Ve(n, e) {
106
106
  const t = n.$$;
107
- t.fragment !== null && (Oe(t.after_update), z(t.on_destroy), t.fragment && t.fragment.d(e), t.on_destroy = t.fragment = null, t.ctx = []);
107
+ t.fragment !== null && (Le(t.after_update), z(t.on_destroy), t.fragment && t.fragment.d(e), t.on_destroy = t.fragment = null, t.ctx = []);
108
108
  }
109
- function $e(n, e) {
110
- n.$$.dirty[0] === -1 && (O.push(n), Fe(), n.$$.dirty.fill(0)), n.$$.dirty[e / 31 | 0] |= 1 << e % 31;
109
+ function _e(n, e) {
110
+ n.$$.dirty[0] === -1 && (L.push(n), Ie(), n.$$.dirty.fill(0)), n.$$.dirty[e / 31 | 0] |= 1 << e % 31;
111
111
  }
112
- function We(n, e, t, s, o, i, r = null, a = [-1]) {
112
+ function $e(n, e, t, s, o, i, r = null, a = [-1]) {
113
113
  const l = Z;
114
- $(n);
114
+ _(n);
115
115
  const c = n.$$ = {
116
116
  fragment: null,
117
117
  ctx: [],
@@ -135,9 +135,9 @@ function We(n, e, t, s, o, i, r = null, a = [-1]) {
135
135
  };
136
136
  r && r(c.root);
137
137
  let h = !1;
138
- if (c.ctx = t ? t(n, e.props || {}, (d, p, ...u) => {
139
- const g = u.length ? u[0] : p;
140
- return c.ctx && o(c.ctx[d], c.ctx[d] = g) && (!c.skip_bound && c.bound[d] && c.bound[d](g), h && $e(n, d)), p;
138
+ if (c.ctx = t ? t(n, e.props || {}, (d, p, ...m) => {
139
+ const g = m.length ? m[0] : p;
140
+ return c.ctx && o(c.ctx[d], c.ctx[d] = g) && (!c.skip_bound && c.bound[d] && c.bound[d](g), h && _e(n, d)), p;
141
141
  }) : [], c.update(), h = !0, z(c.before_update), c.fragment = s ? s(c.ctx) : !1, e.target) {
142
142
  if (e.hydrate) {
143
143
  const d = De(e.target);
@@ -146,9 +146,9 @@ function We(n, e, t, s, o, i, r = null, a = [-1]) {
146
146
  c.fragment && c.fragment.c();
147
147
  e.intro && Be(n.$$.fragment), Pe(n, e.target, e.anchor), fe();
148
148
  }
149
- $(l);
149
+ _(l);
150
150
  }
151
- class He {
151
+ class We {
152
152
  constructor() {
153
153
  /**
154
154
  * ### PRIVATE API
@@ -169,7 +169,7 @@ class He {
169
169
  }
170
170
  /** @returns {void} */
171
171
  $destroy() {
172
- _e(this, 1), this.$destroy = B;
172
+ Ve(this, 1), this.$destroy = B;
173
173
  }
174
174
  /**
175
175
  * @template {Extract<keyof Events, string>} K
@@ -191,11 +191,11 @@ class He {
191
191
  * @returns {void}
192
192
  */
193
193
  $set(e) {
194
- this.$$set && !Ee(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
194
+ this.$$set && !Re(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
195
195
  }
196
196
  }
197
- const Ve = "4";
198
- typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(Ve);
197
+ const He = "4";
198
+ typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(He);
199
199
  function Ne(n, e = 500) {
200
200
  let t = null;
201
201
  return function(...s) {
@@ -204,14 +204,14 @@ function Ne(n, e = 500) {
204
204
  }, e);
205
205
  };
206
206
  }
207
- class F {
207
+ class I {
208
208
  // The constructor is private to prevent direct construction calls
209
209
  // with the `new` operator
210
210
  constructor() {
211
211
  this.alreadySet = !1;
212
212
  }
213
213
  static getInstance() {
214
- return F.instance || (F.instance = new F()), F.instance;
214
+ return I.instance || (I.instance = new I()), I.instance;
215
215
  }
216
216
  /**
217
217
  * Method to set the license key for the application.
@@ -229,7 +229,7 @@ class F {
229
229
  }
230
230
  }
231
231
  }
232
- function H(n) {
232
+ function W(n) {
233
233
  return n && n.type === "TreeRow";
234
234
  }
235
235
  function q(n) {
@@ -372,12 +372,12 @@ class Ge {
372
372
  return this.domService.appendChild(e.child, l), l;
373
373
  }
374
374
  addColumnDiv(e) {
375
- const { parent: t, geo: s, rowIndex: o = -1, columnIndex: i = -1, areaIdent: r, sideIdent: a, text: l = "", treeArrow: c, tableOptions: h, checkedType: d = void 0, sortState: p } = e, u = h == null ? void 0 : h.treeOptions, g = h == null ? void 0 : h.showCheckboxWihoutExtraColumn, b = this.domService.createElement("div");
375
+ const { parent: t, geo: s, rowIndex: o = -1, columnIndex: i = -1, areaIdent: r, sideIdent: a, text: l = "", treeArrow: c, tableOptions: h, checkedType: d = void 0, sortState: p } = e, m = h == null ? void 0 : h.treeOptions, g = h == null ? void 0 : h.showCheckboxWihoutExtraColumn, b = this.domService.createElement("div");
376
376
  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}`);
377
377
  const f = ((s == null ? void 0 : s.index) ?? 0) % 2 === 0 ? "even" : "odd";
378
- if (r === "body" && a === "center" && this.domService.addClass(b, `ge-table-column-${f}`), 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`), c && c !== "none" && (this.domService.addClass(b, "ge-table-col-tree"), this.addArrowDiv(b, c, u, o, i, r)), g && i === 0 && d && this.addCheckboxToDiv(b, d, r, o), l) {
379
- const m = c !== "none" && i === 0;
380
- this.addLabelDiv(b, l, m, o, i, r);
378
+ if (r === "body" && a === "center" && this.domService.addClass(b, `ge-table-column-${f}`), 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`), c && c !== "none" && (this.domService.addClass(b, "ge-table-col-tree"), this.addArrowDiv(b, c, m, o, i, r)), g && i === 0 && d && this.addCheckboxToDiv(b, d, r, o), l) {
379
+ const u = c !== "none" && i === 0;
380
+ this.addLabelDiv(b, l, u, o, i, r);
381
381
  }
382
382
  return p && this.addSortedIcon(b, p, h == null ? void 0 : h.sortedOptions, i), this.domService.appendChild(t, b), b;
383
383
  }
@@ -520,7 +520,7 @@ class Ue {
520
520
  this.tableScope.toggleHeaderGroup(s), e.preventDefault(), e.stopPropagation();
521
521
  else if (s.inputType === "checkbox" && s.areaIdent)
522
522
  this.tableScope.toggleRowCheckbox(s.rowIdx, s.colIdx, s.areaIdent), e.preventDefault(), e.stopPropagation();
523
- else if (H(s.row) && s.areaModel) {
523
+ else if (W(s.row) && s.areaModel) {
524
524
  const o = s.colIdx === this.getArrowColumnIndex() && e.altKey, i = s.className.includes("ge-table-tree-arrow-div");
525
525
  if (o || i) {
526
526
  e.preventDefault(), e.stopPropagation();
@@ -547,7 +547,7 @@ class Ue {
547
547
  this.tableScope.tableModel.isSortable(r) && (this.tableScope.clearSelection(), this.tableScope.onHeaderDblClicked(e, i, r));
548
548
  else if (t.getAttribute("data-row-index")) {
549
549
  const l = a.getRowByIndex(i);
550
- if (s && o === "body" && a.isEditable(i, r) && (this.tableScope.clearSelection(), this.tableScope.initRenderEditor(i, r)), H(l) && r === this.getArrowColumnIndex()) {
550
+ if (s && o === "body" && a.isEditable(i, r) && (this.tableScope.clearSelection(), this.tableScope.initRenderEditor(i, r)), W(l) && r === this.getArrowColumnIndex()) {
551
551
  e.preventDefault(), e.stopPropagation();
552
552
  const c = l;
553
553
  c.expanded = !c.expanded, "recalcVisibleTreeRows" in a && a.recalcVisibleTreeRows(), this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth), this.tableScope.adjustContainersAndRows(), this.updateCollapsedExpandedState(c);
@@ -731,77 +731,307 @@ class Xe {
731
731
  return s * ("" + e).localeCompare("" + t);
732
732
  }
733
733
  }
734
- class k extends je {
734
+ class F extends je {
735
+ /**
736
+ * Creates an instance of AreaModelObjectArray.
737
+ *
738
+ * @param {AreaIdent} areaIdent - Identifies which area of the table this model represents ('header', 'body', or 'footer')
739
+ * @param {T[]} rows - The array of objects that represent the rows in this area
740
+ * @param {number} defaultRowHeight - The default height for rows in this area (in pixels)
741
+ * @param {ColumnDefIf[]} [columnDefs=[]] - Definitions for the columns in this area
742
+ * @param {string} [selectedRowClass='ge-selected-row'] - CSS class to apply to selected rows
743
+ * @param {string} [focusedRowClass='ge-focused-row'] - CSS class to apply to the focused row
744
+ *
745
+ * @example
746
+ * const rows = [
747
+ * { id: 1, name: 'John', age: 30 },
748
+ * { id: 2, name: 'Jane', age: 25 }
749
+ * ];
750
+ *
751
+ * const columnDefs = [
752
+ * { property: 'id', headerLabel: 'ID', width: 50 },
753
+ * { property: 'name', headerLabel: 'Name', width: 150 },
754
+ * { property: 'age', headerLabel: 'Age', width: 100 }
755
+ * ];
756
+ *
757
+ * const bodyAreaModel = new AreaModelObjectArray(
758
+ * 'body',
759
+ * rows,
760
+ * 30,
761
+ * columnDefs
762
+ * );
763
+ */
735
764
  constructor(e, t, s, o = [], i = "ge-selected-row", r = "ge-focused-row") {
736
765
  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 Xe(), this._focusedRowIndex = 0, this.filteredRows = [...t], this.properties = o.map((a) => a.property);
737
766
  }
767
+ /**
768
+ * Gets the index of the currently focused row.
769
+ *
770
+ * @returns {number} The index of the focused row
771
+ *
772
+ * @example
773
+ * const focusedRowIndex = bodyAreaModel.getFocusedRowIndex();
774
+ * console.log(`The focused row is at index ${focusedRowIndex}`);
775
+ */
738
776
  getFocusedRowIndex() {
739
777
  return this._focusedRowIndex;
740
778
  }
779
+ /**
780
+ * Sets the index of the focused row.
781
+ * This will apply the focused row styling to the specified row.
782
+ *
783
+ * @param {number} value - The index of the row to focus
784
+ *
785
+ * @example
786
+ * // Focus the second row (index 1)
787
+ * bodyAreaModel.setFocusedRowIndex(1);
788
+ */
741
789
  setFocusedRowIndex(e) {
742
790
  this._focusedRowIndex = e;
743
791
  }
792
+ /**
793
+ * Replaces the current rows array with a new one.
794
+ * This also resets the filtered rows to match the new rows array.
795
+ *
796
+ * @param {T[]} rows - The new array of row objects
797
+ *
798
+ * @example
799
+ * // Replace the current rows with new data
800
+ * const newRows = [
801
+ * { id: 4, name: 'Alice', age: 35 },
802
+ * { id: 5, name: 'Charlie', age: 45 }
803
+ * ];
804
+ * bodyAreaModel.setRows(newRows);
805
+ */
744
806
  setRows(e) {
745
807
  this.rows = e, this.filteredRows = [...e];
746
808
  }
809
+ /**
810
+ * Filters both the original rows and filtered rows arrays using the provided predicate function.
811
+ * Unlike `externalFilterChanged`, this method permanently modifies the original rows array.
812
+ *
813
+ * @param {(row: T) => boolean} predict - A function that returns true for rows to keep and false for rows to filter out
814
+ *
815
+ * @example
816
+ * // Remove all rows where age is less than 30
817
+ * bodyAreaModel.filterRowsByPredict(row => row.age >= 30);
818
+ */
747
819
  filterRowsByPredict(e) {
748
820
  this.rows = this.rows.filter(e), this.filteredRows = this.filteredRows.filter(e);
749
821
  }
750
822
  /**
751
- * return row count of filtered rows
823
+ * Returns the number of rows in the filtered rows array.
824
+ * This is used to determine how many rows should be rendered in the table.
825
+ *
826
+ * @returns {number} The number of rows in the filtered rows array
827
+ *
828
+ * @example
829
+ * const rowCount = bodyAreaModel.getRowCount();
830
+ * console.log(`The table has ${rowCount} rows`);
752
831
  */
753
832
  getRowCount() {
754
833
  var e;
755
834
  return ((e = this.filteredRows) == null ? void 0 : e.length) ?? 0;
756
835
  }
836
+ /**
837
+ * Gets the value at the specified row and column indices.
838
+ * This method handles tree rows and nested properties.
839
+ *
840
+ * @param {number} rowIndex - The index of the row
841
+ * @param {number} columnIndex - The index of the column
842
+ * @returns {any} The value at the specified cell, or an empty string if not found
843
+ *
844
+ * @example
845
+ * // Get the value in the first row, second column
846
+ * const value = bodyAreaModel.getValueAt(0, 1);
847
+ * console.log(`The value is: ${value}`);
848
+ *
849
+ * @example
850
+ * // Iterate through all cells in a row
851
+ * const rowIndex = 0;
852
+ * for (let colIndex = 0; colIndex < columnDefs.length; colIndex++) {
853
+ * const value = bodyAreaModel.getValueAt(rowIndex, colIndex);
854
+ * console.log(`Cell (${rowIndex}, ${colIndex}): ${value}`);
855
+ * }
856
+ */
757
857
  getValueAt(e, t) {
758
858
  const s = this.properties[t];
759
859
  let o = this.filteredRows[e];
760
- return H(o) && (o = o.data), o ? this.getValueByT(o, s) : "";
860
+ return W(o) && (o = o.data), o ? this.getValueByT(o, s) : "";
761
861
  }
762
862
  /**
763
863
  * Retrieves the filtered and sorted rows from the dataset.
764
864
  * These rows are used for rendering the table.
865
+ * Unlike `getAllRows()`, this method returns only the rows that match any applied filters.
765
866
  *
766
- * @return {T[]} An array containing the filtered (and sorted) rows.
867
+ * @returns {T[]} An array containing the filtered (and sorted) rows
868
+ *
869
+ * @example
870
+ * // Get all filtered rows
871
+ * const filteredRows = bodyAreaModel.getFilteredRows();
872
+ *
873
+ * // Count rows that match a certain condition
874
+ * const adultsCount = filteredRows.filter(row => row.age >= 18).length;
767
875
  */
768
876
  getFilteredRows() {
769
877
  return this.filteredRows;
770
878
  }
879
+ /**
880
+ * Returns the original, unfiltered array of rows.
881
+ * This can be useful when you need to access all data regardless of any applied filters.
882
+ *
883
+ * @returns {T[]} The original array of row objects
884
+ *
885
+ * @example
886
+ * // Get all rows, including those filtered out
887
+ * const allRows = bodyAreaModel.getAllRows();
888
+ *
889
+ * // Calculate average age across all rows
890
+ * const totalAge = allRows.reduce((sum, row) => sum + row.age, 0);
891
+ * const averageAge = totalAge / allRows.length;
892
+ */
771
893
  getAllRows() {
772
894
  return this.rows;
773
895
  }
774
896
  /**
775
897
  * Returns the first row from the filtered rows that matches the given criteria based on the provided predicate function.
898
+ * This method only searches within the filtered rows, not the original rows array.
776
899
  *
777
900
  * @param {Partial<T>} criteria - A partial object containing the search criteria
778
901
  * @param {(criteria: Partial<T>, row: T) => boolean} predicate - A function that takes the search criteria and a row,
779
902
  * and returns true if the row matches the criteria
780
903
  * @returns {T | undefined} The first matching row, or undefined if no match is found
904
+ *
905
+ * @example
906
+ * // Find a user by name in the filtered rows
907
+ * const criteria = { name: 'John' };
908
+ * const user = bodyAreaModel.findRowFromFilteredRowsByAllCriteria(
909
+ * criteria,
910
+ * (criteria, row) => row.name === criteria.name
911
+ * );
912
+ *
913
+ * @example
914
+ * // Find a user by age range in the filtered rows
915
+ * const criteria = { minAge: 25, maxAge: 35 };
916
+ * const user = bodyAreaModel.findRowFromFilteredRowsByAllCriteria(
917
+ * criteria,
918
+ * (criteria, row) => row.age >= criteria.minAge && row.age <= criteria.maxAge
919
+ * );
781
920
  */
782
921
  findRowFromFilteredRowsByAllCriteria(e, t) {
783
922
  return this.getFilteredRows().find((s) => t(e, s));
784
923
  }
785
924
  /**
786
925
  * Searches through all rows to find a row that matches the given criteria based on the predicate function.
926
+ * This method searches within the original rows array, including rows that may have been filtered out.
787
927
  *
788
928
  * @param {Partial<T>} criteria - A partial object containing the search criteria
789
929
  * @param {(criteria: Partial<T>, row: T) => boolean} predicate - A function that takes the search criteria and a row,
790
930
  * and returns true if the row matches the criteria
791
931
  * @returns {T | undefined} The first matching row from all rows, or undefined if no match is found
932
+ *
933
+ * @example
934
+ * // Find a user by ID in all rows
935
+ * const criteria = { id: 42 };
936
+ * const user = bodyAreaModel.findRowFromAllRowsByAllCriteria(
937
+ * criteria,
938
+ * (criteria, row) => row.id === criteria.id
939
+ * );
940
+ *
941
+ * @example
942
+ * // Find a user with a specific property value in all rows
943
+ * const criteria = { department: 'Engineering', role: 'Manager' };
944
+ * const user = bodyAreaModel.findRowFromAllRowsByAllCriteria(
945
+ * criteria,
946
+ * (criteria, row) => row.department === criteria.department && row.role === criteria.role
947
+ * );
792
948
  */
793
949
  findRowFromAllRowsByAllCriteria(e, t) {
794
950
  return this.getAllRows().find((s) => t(e, s));
795
951
  }
952
+ /**
953
+ * Returns the height of the row at the specified index.
954
+ * This implementation always returns the default row height.
955
+ * Override this method in subclasses to support variable row heights.
956
+ *
957
+ * @param {number} _rowIndex - The index of the row (unused in this implementation)
958
+ * @returns {number} The height of the row in pixels
959
+ *
960
+ * @example
961
+ * const rowHeight = bodyAreaModel.getRowHeight(0);
962
+ * console.log(`The first row has a height of ${rowHeight}px`);
963
+ */
796
964
  getRowHeight(e) {
797
965
  return this.defaultRowHeight;
798
966
  }
967
+ /**
968
+ * Returns the row object at the specified index from the filtered rows array.
969
+ * This method overrides the parent class implementation.
970
+ *
971
+ * @param {number} rowIndex - The index of the row to retrieve
972
+ * @returns {any} The row object at the specified index, or undefined if the index is out of bounds
973
+ *
974
+ * @example
975
+ * // Get the first row object
976
+ * const row = bodyAreaModel.getRowByIndex(0);
977
+ * console.log('First row:', row);
978
+ *
979
+ * @example
980
+ * // Iterate through all rows
981
+ * for (let i = 0; i < bodyAreaModel.getRowCount(); i++) {
982
+ * const row = bodyAreaModel.getRowByIndex(i);
983
+ * console.log(`Row ${i}:`, row);
984
+ * }
985
+ */
799
986
  getRowByIndex(e) {
800
987
  return this.filteredRows[e];
801
988
  }
989
+ /**
990
+ * Applies an external filter function to the rows array.
991
+ * This method updates the filtered rows array without modifying the original rows array.
992
+ *
993
+ * @param {FilterFunction<any>} predictFn - A function that returns true for rows to keep and false for rows to filter out
994
+ *
995
+ * @example
996
+ * // Filter rows where age is greater than 30
997
+ * bodyAreaModel.externalFilterChanged(row => row.age > 30);
998
+ *
999
+ * @example
1000
+ * // Filter rows based on a search term
1001
+ * const searchTerm = 'john';
1002
+ * bodyAreaModel.externalFilterChanged(row =>
1003
+ * row.name.toLowerCase().includes(searchTerm.toLowerCase())
1004
+ * );
1005
+ *
1006
+ * @example
1007
+ * // Clear all filters
1008
+ * bodyAreaModel.externalFilterChanged(() => true);
1009
+ */
802
1010
  externalFilterChanged(e) {
803
1011
  this.filteredRows = this.rows ? this.rows.filter(e) : [];
804
1012
  }
1013
+ /**
1014
+ * Sorts the filtered rows based on the provided sort items.
1015
+ * This method supports sorting by multiple columns with different sort directions.
1016
+ *
1017
+ * @param {SortItem[]} sortItems - An array of sort items, each containing a column index and sort state
1018
+ * @returns {boolean} Always returns true to indicate sorting was performed
1019
+ *
1020
+ * @example
1021
+ * // Sort by age in ascending order
1022
+ * bodyAreaModel.doSort([{ columnIndex: 2, sortState: 'asc' }]);
1023
+ *
1024
+ * @example
1025
+ * // Sort by name in descending order, then by age in ascending order
1026
+ * bodyAreaModel.doSort([
1027
+ * { columnIndex: 1, sortState: 'desc' },
1028
+ * { columnIndex: 2, sortState: 'asc' }
1029
+ * ]);
1030
+ *
1031
+ * @example
1032
+ * // Clear sorting
1033
+ * bodyAreaModel.doSort([{ columnIndex: 0, sortState: 'none' }]);
1034
+ */
805
1035
  doSort(e) {
806
1036
  for (const t of e) {
807
1037
  const { columnIndex: s, sortState: o } = t, i = o === "asc" ? 1 : o === "desc" ? -1 : 0, r = this.properties[s];
@@ -809,20 +1039,110 @@ class k extends je {
809
1039
  }
810
1040
  return !0;
811
1041
  }
1042
+ /**
1043
+ * Sorts the filtered rows using a custom comparator function.
1044
+ * This method provides more flexibility than `doSort()` for complex sorting logic.
1045
+ *
1046
+ * @param {(a: T, b: T) => number} compareFn - A function that compares two rows and returns a number:
1047
+ * - Negative if a should come before b
1048
+ * - Positive if a should come after b
1049
+ * - Zero if they are equivalent for sorting purposes
1050
+ *
1051
+ * @example
1052
+ * // Sort by name length
1053
+ * bodyAreaModel.sort((a, b) => a.name.length - b.name.length);
1054
+ *
1055
+ * @example
1056
+ * // Sort by a computed value
1057
+ * bodyAreaModel.sort((a, b) => {
1058
+ * const scoreA = a.wins * 3 + a.draws;
1059
+ * const scoreB = b.wins * 3 + b.draws;
1060
+ * return scoreB - scoreA; // Descending order
1061
+ * });
1062
+ */
812
1063
  sort(e) {
813
1064
  this.filteredRows = this.filteredRows.sort(e);
814
1065
  }
1066
+ /**
1067
+ * Gets a value from an object using a property path.
1068
+ * This method supports accessing nested properties using dot notation (e.g., 'person.name').
1069
+ *
1070
+ * @param {T} t - The object to get the value from
1071
+ * @param {string} property - The property path to access (e.g., 'name' or 'person.contact.email')
1072
+ * @returns {any} The value at the specified property path, or undefined if not found
1073
+ *
1074
+ * @example
1075
+ * const user = { id: 1, name: 'John', contact: { email: 'john@example.com' } };
1076
+ *
1077
+ * // Access simple property
1078
+ * const name = bodyAreaModel.getValueByT(user, 'name');
1079
+ * console.log(name); // 'John'
1080
+ *
1081
+ * // Access nested property
1082
+ * const email = bodyAreaModel.getValueByT(user, 'contact.email');
1083
+ * console.log(email); // 'john@example.com'
1084
+ */
815
1085
  getValueByT(e, t) {
816
1086
  if (e && t)
817
1087
  return t.includes(".") ? this.getPropertyValue(e, t.split(".")) : e[t];
818
1088
  }
1089
+ /**
1090
+ * Changes the order of columns by moving a column from one position to another.
1091
+ * This method updates both the properties array and calls the parent class implementation.
1092
+ *
1093
+ * @param {number} sourceColumnIndex - The index of the column to move
1094
+ * @param {number} targetColumnIndex - The index where the column should be moved to
1095
+ *
1096
+ * @example
1097
+ * // Move the second column (index 1) to the fourth position (index 3)
1098
+ * bodyAreaModel.changeColumnOrder(1, 3);
1099
+ *
1100
+ * @example
1101
+ * // Move the last column to the first position
1102
+ * const lastIndex = bodyAreaModel.columnDefs.length - 1;
1103
+ * bodyAreaModel.changeColumnOrder(lastIndex, 0);
1104
+ */
819
1105
  changeColumnOrder(e, t) {
820
1106
  this.arrayMove(this.properties, e, t), super.changeColumnOrder(e, t);
821
1107
  }
1108
+ /**
1109
+ * Gets the custom CSS classes that should be applied to a cell.
1110
+ * This method extends the parent class implementation to add selection and focus classes.
1111
+ *
1112
+ * @param {number} rowIndex - The index of the row
1113
+ * @param {number} _columnIndex - The index of the column (unused in this implementation)
1114
+ * @returns {string[]} An array of CSS class names to apply to the cell
1115
+ *
1116
+ * @example
1117
+ * // Get the CSS classes for a cell
1118
+ * const classes = bodyAreaModel.getCustomClassesAt(1, 2);
1119
+ * console.log('CSS classes:', classes);
1120
+ *
1121
+ * @example
1122
+ * // Apply the classes to a cell element
1123
+ * const cellElement = document.createElement('div');
1124
+ * const classes = bodyAreaModel.getCustomClassesAt(rowIndex, columnIndex);
1125
+ * cellElement.classList.add(...classes);
1126
+ */
822
1127
  getCustomClassesAt(e, t) {
823
1128
  const s = super.getCustomClassesAt(e, t);
824
1129
  return this.getRowByIndex(e).selected && s.push(this.selectedRowClass), this._focusedRowIndex === e && s.push(this.focusedRowClass), s;
825
1130
  }
1131
+ /**
1132
+ * Creates a comparator function for sorting rows based on a property and sort direction.
1133
+ * This method supports custom sort comparators defined in column definitions.
1134
+ *
1135
+ * @param {string} property - The property to sort by
1136
+ * @param {number} f - The sort direction factor: 1 for ascending, -1 for descending, 0 for no sorting
1137
+ * @returns {(a: T, b: T) => number} A comparator function that compares two rows
1138
+ *
1139
+ * @example
1140
+ * // Create a comparator for sorting by name in ascending order
1141
+ * const comparator = bodyAreaModel.genericFlatTableSortComparator('name', 1);
1142
+ *
1143
+ * // Sort the rows using the comparator
1144
+ * const sortedRows = [...bodyAreaModel.getFilteredRows()].sort(comparator);
1145
+ */
826
1146
  genericFlatTableSortComparator(e, t) {
827
1147
  const s = this.columnDefs.find((o) => o.property === e);
828
1148
  return (o, i) => {
@@ -830,6 +1150,16 @@ class k extends je {
830
1150
  return s != null && s.sortComparator ? t * s.sortComparator(r, a, o, i, t) : this.sorterService.genericSortComparator(r, a, t);
831
1151
  };
832
1152
  }
1153
+ /**
1154
+ * Recursively gets a value from an object using an array of property names.
1155
+ * This is a helper method used by `getValueByT` to access nested properties.
1156
+ *
1157
+ * @param {any} o - The object to get the value from
1158
+ * @param {string[]} props - An array of property names representing the path to the value
1159
+ * @returns {any} The value at the specified property path, or undefined if not found
1160
+ *
1161
+ * @private
1162
+ */
833
1163
  getPropertyValue(e, t) {
834
1164
  const s = t.shift(), o = e[s];
835
1165
  return o && t.length ? this.getPropertyValue(o, t) : o;
@@ -840,41 +1170,302 @@ class Ke {
840
1170
  this.tableScope = e;
841
1171
  }
842
1172
  /**
843
- * Updates the cells in the table based on the provided events.
1173
+ * Updates the cells in the table with the provided cell update events.
844
1174
  *
845
- * @param {TableCellUpdateEventIf[]} events - The array of events representing the updates to perform on the cells.
846
- * @param {boolean} [repaintAll=false] - Optional parameter indicating whether to repaint all cells or not. Default value is false. If true, the full table will be rendered. If false, the table cell will be rendered immediately.
1175
+ * This method allows you to update specific cells in the table without requiring a full table repaint,
1176
+ * which can significantly improve performance when updating large tables frequently.
847
1177
  *
848
- * @return {void} - This method doesn't return anything.
1178
+ * @param {TableCellUpdateEventIf[]} events - An array of cell update events, each defining a single cell update operation.
1179
+ * Each event must specify:
1180
+ * - area: The table area to update ('header', 'body', or 'footer')
1181
+ * - rowIndex: The row index of the cell to update
1182
+ * - columnIndex: The column index of the cell to update
1183
+ * - value: The new value to set for the cell
1184
+ * - cssClasses: Optional object mapping CSS class names to boolean values
1185
+ * (true to add the class, false to remove it)
1186
+ *
1187
+ * @param {boolean} [repaintAll=false] - Whether to repaint the entire table after updating cells.
1188
+ * - If true: All cells will be repainted after updating (slower but ensures visual consistency)
1189
+ * - If false: Only the modified cells will be repainted (faster, recommended for frequent updates)
1190
+ *
1191
+ * @returns {void}
1192
+ *
1193
+ * @example
1194
+ * // Update a single cell with a new value and CSS classes
1195
+ * tableApi.updateCells([{
1196
+ * area: 'body',
1197
+ * rowIndex: 3,
1198
+ * columnIndex: 2,
1199
+ * value: 42,
1200
+ * cssClasses: {
1201
+ * 'highlight': true, // Add 'highlight' class
1202
+ * 'error': false // Remove 'error' class if present
1203
+ * }
1204
+ * }]);
1205
+ *
1206
+ * @example
1207
+ * // Update multiple cells at once
1208
+ * tableApi.updateCells([
1209
+ * {
1210
+ * area: 'body',
1211
+ * rowIndex: 1,
1212
+ * columnIndex: 1,
1213
+ * value: 'New Value 1',
1214
+ * cssClasses: { 'updated': true }
1215
+ * },
1216
+ * {
1217
+ * area: 'body',
1218
+ * rowIndex: 2,
1219
+ * columnIndex: 3,
1220
+ * value: 'New Value 2',
1221
+ * cssClasses: { 'updated': true }
1222
+ * }
1223
+ * ]);
1224
+ *
1225
+ * @example
1226
+ * // Update cells and repaint the entire table
1227
+ * tableApi.updateCells([
1228
+ * { area: 'body', rowIndex: 0, columnIndex: 0, value: 'Hello', cssClasses: { 'bg-green-0': true } },
1229
+ * { area: 'body', rowIndex: 1, columnIndex: 1, value: 'World', cssClasses: { 'bg-red-0': true } }
1230
+ * ], true);
1231
+ *
1232
+ * @example
1233
+ * // High-performance animation example (update without full repaint)
1234
+ * function animateCell() {
1235
+ * const value = Math.sin(Date.now() / 1000) * 50;
1236
+ * const cssClasses = {
1237
+ * 'positive': value > 0,
1238
+ * 'negative': value < 0
1239
+ * };
1240
+ *
1241
+ * tableApi.updateCells([{
1242
+ * area: 'body',
1243
+ * rowIndex: 0,
1244
+ * columnIndex: 0,
1245
+ * value: Math.round(value),
1246
+ * cssClasses
1247
+ * }]);
1248
+ *
1249
+ * requestAnimationFrame(animateCell);
1250
+ * }
1251
+ * animateCell();
849
1252
  */
850
1253
  updateCells(e, t = !1) {
851
1254
  this.tableScope.updateCells(e, t);
852
1255
  }
853
1256
  /**
854
- * Notifies that the external filter has changed.
1257
+ * Notifies the table that an external filter has been changed and needs to be applied.
855
1258
  *
856
- * @return {void}
1259
+ * This method is used when an external filter condition (defined by `tableOptions.externalFilterFunction`)
1260
+ * has changed and the table needs to refresh its display to reflect the new filtering criteria.
1261
+ *
1262
+ * When called, this method:
1263
+ * 1. Applies the external filter function to all rows
1264
+ * 2. Clears the current selection (by default)
1265
+ * 3. Scrolls to the top of the table
1266
+ * 4. Recalculates table dimensions
1267
+ * 5. Repaints the table to display only the filtered rows
1268
+ *
1269
+ * @example
1270
+ * ```typescript
1271
+ * // Define an external filter function in your table options
1272
+ * const tableOptions = {
1273
+ * externalFilterFunction: (row: MyRowType) => {
1274
+ * // Return true to include the row, false to filter it out
1275
+ * return row.status === 'active';
1276
+ * }
1277
+ * };
1278
+ *
1279
+ * // Initialize your table with these options
1280
+ * const tableApi = new TableApi(tableScope);
1281
+ *
1282
+ * // Later, when filter criteria change (e.g., in a search input handler)
1283
+ * function onFilterTextChanged() {
1284
+ * // Update the filter function if needed
1285
+ * tableOptions.externalFilterFunction = (row: MyRowType) => {
1286
+ * return row.name.includes(searchText);
1287
+ * };
1288
+ *
1289
+ * // Apply the updated filter
1290
+ * tableApi.externalFilterChanged();
1291
+ * }
1292
+ * ```
1293
+ *
1294
+ * @returns {void}
1295
+ * @see TableScope.externalFilterChanged
857
1296
  */
858
1297
  externalFilterChanged() {
859
1298
  this.tableScope.externalFilterChanged();
860
1299
  }
861
1300
  /**
862
- * Scrolls the table body to the specified pixel coordinates.
1301
+ * Scrolls the table content to the specified pixel coordinates.
863
1302
  *
864
- * @param {number} px - The horizontal pixel coordinate to scroll to. Defaults to 0.
865
- * @param {number} py - The vertical pixel coordinate to scroll to. Defaults to 0.
866
- * @return {void}
1303
+ * This method allows programmatic scrolling of the table viewport to exact pixel positions.
1304
+ * It delegates the scrolling operation to the underlying TableScope instance.
1305
+ *
1306
+ * @param {number} px - The horizontal pixel coordinate to scroll to. Defaults to 0 (leftmost position).
1307
+ * @param {number} py - The vertical pixel coordinate to scroll to. Defaults to 0 (topmost position).
1308
+ * @returns {void}
1309
+ *
1310
+ * @example
1311
+ * // Scroll to the top-left corner of the table
1312
+ * tableApi.scrollToPixel(0, 0);
1313
+ *
1314
+ * @example
1315
+ * // Scroll 200 pixels horizontally and 150 pixels vertically
1316
+ * tableApi.scrollToPixel(200, 150);
1317
+ *
1318
+ * @example
1319
+ * // Scroll only vertically, keeping the current horizontal position
1320
+ * tableApi.scrollToPixel(undefined, 300);
1321
+ *
1322
+ * @example
1323
+ * // Example in a component that needs precise scrolling control
1324
+ * class TableScroller {
1325
+ * private tableApi: TableApi;
1326
+ *
1327
+ * constructor(tableApi: TableApi) {
1328
+ * this.tableApi = tableApi;
1329
+ * }
1330
+ *
1331
+ * scrollToPosition(x: number, y: number) {
1332
+ * // Scroll to exact pixel coordinates
1333
+ * this.tableApi.scrollToPixel(x, y);
1334
+ * }
1335
+ *
1336
+ * scrollHalfway() {
1337
+ * const tableModel = this.tableApi.getTableModel();
1338
+ * const totalWidth = tableModel.getContentWidthInPixel();
1339
+ * const totalHeight = tableModel.getContentHeightInPixel();
1340
+ *
1341
+ * // Scroll to the middle of the table content
1342
+ * this.tableApi.scrollToPixel(totalWidth / 2, totalHeight / 2);
1343
+ * }
1344
+ * }
1345
+ *
1346
+ * @example
1347
+ * // Advanced usage with animated scrolling
1348
+ * class SmoothScroller {
1349
+ * private tableApi: TableApi;
1350
+ * private animationFrameId: number | null = null;
1351
+ *
1352
+ * constructor(tableApi: TableApi) {
1353
+ * this.tableApi = tableApi;
1354
+ * }
1355
+ *
1356
+ * smoothScrollTo(targetX: number, targetY: number, duration: number = 500) {
1357
+ * // Cancel any ongoing animation
1358
+ * if (this.animationFrameId !== null) {
1359
+ * cancelAnimationFrame(this.animationFrameId);
1360
+ * }
1361
+ *
1362
+ * const startTime = performance.now();
1363
+ * const startX = this.tableApi.getTableScope().getScrollLeft();
1364
+ * const startY = this.tableApi.getTableScope().getScrollTop();
1365
+ * const distanceX = targetX - startX;
1366
+ * const distanceY = targetY - startY;
1367
+ *
1368
+ * const step = (currentTime: number) => {
1369
+ * const elapsed = currentTime - startTime;
1370
+ * const progress = Math.min(elapsed / duration, 1);
1371
+ *
1372
+ * // Use easing function for smooth animation
1373
+ * const easeProgress = 1 - Math.pow(1 - progress, 3); // Cubic ease-out
1374
+ *
1375
+ * const currentX = startX + distanceX * easeProgress;
1376
+ * const currentY = startY + distanceY * easeProgress;
1377
+ *
1378
+ * this.tableApi.scrollToPixel(currentX, currentY);
1379
+ *
1380
+ * if (progress < 1) {
1381
+ * this.animationFrameId = requestAnimationFrame(step);
1382
+ * } else {
1383
+ * this.animationFrameId = null;
1384
+ * }
1385
+ * };
1386
+ *
1387
+ * this.animationFrameId = requestAnimationFrame(step);
1388
+ * }
1389
+ *
1390
+ * cancelAnimation() {
1391
+ * if (this.animationFrameId !== null) {
1392
+ * cancelAnimationFrame(this.animationFrameId);
1393
+ * this.animationFrameId = null;
1394
+ * }
1395
+ * }
1396
+ * }
1397
+ *
1398
+ * @see {@link scrollToIndex} - For scrolling based on row and column indices
1399
+ * @see {@link ensureRowIsVisible} - For scrolling to make a specific row visible
867
1400
  */
868
1401
  scrollToPixel(e = 0, t = 0) {
869
1402
  this.tableScope.scrollToPixel(e, t);
870
1403
  }
871
1404
  /**
872
- * Scrolls to the specified index in both horizontal and vertical directions.
1405
+ * Scrolls the table to display the specified row and column indices at the top-left corner of the viewport.
873
1406
  *
874
- * @param {number} indexX - The index of the column to scroll to in the horizontal direction. Default is 0.
875
- * @param {number} indexY - The index of the row to scroll to in the vertical direction. Default is 0.
1407
+ * This method allows programmatic scrolling to a specific position in the table grid based on row and column indices.
1408
+ * It uses the underlying TableScope's scrolling mechanism to navigate to the target location.
876
1409
  *
877
- * @return undefined
1410
+ * @param {number} indexX - The horizontal index (column) to scroll to. Defaults to 0 (leftmost column).
1411
+ * @param {number} indexY - The vertical index (row) to scroll to. Defaults to 0 (topmost row).
1412
+ * @returns {void}
1413
+ *
1414
+ * @example
1415
+ * // Scroll to the 5th row, keeping the current horizontal scroll position
1416
+ * tableApi.scrollToIndex(0, 5);
1417
+ *
1418
+ * @example
1419
+ * // Scroll to column 3, row 10
1420
+ * tableApi.scrollToIndex(3, 10);
1421
+ *
1422
+ * @example
1423
+ * // Example in a component that needs to navigate to specific content
1424
+ * class TableNavigator {
1425
+ * private tableApi: TableApi;
1426
+ *
1427
+ * constructor(tableApi: TableApi) {
1428
+ * this.tableApi = tableApi;
1429
+ * }
1430
+ *
1431
+ * goToCell(columnIndex: number, rowIndex: number) {
1432
+ * // Navigate directly to the specified cell position
1433
+ * this.tableApi.scrollToIndex(columnIndex, rowIndex);
1434
+ *
1435
+ * // Optional: Select the cell after navigating to it
1436
+ * const selectionModel = this.tableApi.getSelectionModel();
1437
+ * if (selectionModel) {
1438
+ * selectionModel.selectCell(rowIndex, columnIndex);
1439
+ * }
1440
+ * }
1441
+ * }
1442
+ *
1443
+ * @example
1444
+ * // Advanced usage with search functionality
1445
+ * class TableSearcher {
1446
+ * findAndScrollToMatch(searchTerm: string) {
1447
+ * const tableModel = this.tableApi.getTableModel();
1448
+ * const bodyModel = tableModel.getAreaModel('body');
1449
+ *
1450
+ * // Search for the term in the table data
1451
+ * for (let row = 0; row < bodyModel.getRowCount(); row++) {
1452
+ * for (let col = 0; col < tableModel.getColumnCount(); col++) {
1453
+ * const cellContent = bodyModel.getValueAt(row, col)?.toString() || '';
1454
+ *
1455
+ * if (cellContent.includes(searchTerm)) {
1456
+ * // Found a match, scroll to it
1457
+ * this.tableApi.scrollToIndex(col, row);
1458
+ * return true;
1459
+ * }
1460
+ * }
1461
+ * }
1462
+ *
1463
+ * return false; // No match found
1464
+ * }
1465
+ * }
1466
+ *
1467
+ * @see {@link scrollToPixel} - For scrolling to specific pixel coordinates
1468
+ * @see {@link ensureRowIsVisible} - For scrolling to make a specific row visible
878
1469
  */
879
1470
  scrollToIndex(e = 0, t = 0) {
880
1471
  this.tableScope.scrollToIndex(e, t);
@@ -935,19 +1526,71 @@ class Ke {
935
1526
  /**
936
1527
  * Repaints the table.
937
1528
  *
938
- * This method calls the repaint method of the tableScope object
939
- * to update and redraw the table based on the latest data.
1529
+ * This method refreshes the visual representation of the table by delegating to the
1530
+ * tableScope's repaint functionality. Use this method whenever the table's visual state
1531
+ * needs to be updated after data changes, selection changes, or any modifications that
1532
+ * affect the rendered output.
1533
+ *
1534
+ * Repainting the table ensures that all visible cells, rows, and styling reflect the
1535
+ * current state of the underlying data model and configuration settings.
1536
+ *
1537
+ * @example
1538
+ * // Update data and repaint the table
1539
+ * const tableApi = new TableApi(tableScope);
1540
+ * tableApi.setRows(newData);
1541
+ * tableApi.repaint();
1542
+ *
1543
+ * @example
1544
+ * // Update selection and repaint to show the visual change
1545
+ * tableApi.getSelectionModel().selectCell(2, 3);
1546
+ * tableApi.repaint();
1547
+ *
1548
+ * @example
1549
+ * // After changing column visibility, repaint to reflect changes
1550
+ * tableApi.setColumnVisible(0, false);
1551
+ * tableApi.repaint();
1552
+ *
1553
+ * @returns {void}
940
1554
  */
941
1555
  repaint() {
942
1556
  this.tableScope.repaint();
943
1557
  }
944
1558
  /**
945
- * Repaints the table scope with hard repaint.
946
- * Repaints the UI by resetting the size of the wrapper div,
947
- * adjusting the containers and rows, and performing additional adjustments
948
- * after scrolling.
1559
+ * Performs a complete repaint of the table by triggering a hard repaint on the underlying table scope.
949
1560
  *
950
- * @return {void}
1561
+ * A hard repaint is more thorough than a regular repaint and performs the following operations:
1562
+ * - Recalculates the height and padding of the table model
1563
+ * - Resets the size of the wrapper div elements
1564
+ * - Adjusts containers and rows positioning
1565
+ * - Makes additional adjustments after scrolling
1566
+ *
1567
+ * Use this method when regular repaint isn't sufficient, such as when:
1568
+ * - Table dimensions have significantly changed
1569
+ * - The structure of data has been modified (rows/columns added or removed)
1570
+ * - The table layout needs complete recalculation
1571
+ * - After major DOM changes affecting the table's container
1572
+ *
1573
+ * @example
1574
+ * // Example 1: Basic usage
1575
+ * tableApi.repaintHard();
1576
+ *
1577
+ * @example
1578
+ * // Example 2: Using after major data changes
1579
+ * tableApi.setRows(newDataSet);
1580
+ * tableApi.repaintHard();
1581
+ *
1582
+ * @example
1583
+ * // Example 3: Using after resizing a container
1584
+ * window.addEventListener('resize', () => {
1585
+ * tableApi.repaintHard();
1586
+ * });
1587
+ *
1588
+ * @example
1589
+ * // Example 4: Using after changing column visibility
1590
+ * tableApi.setColumnVisible(2, false);
1591
+ * tableApi.repaintHard();
1592
+ *
1593
+ * @returns {void} This method doesn't return a value
951
1594
  */
952
1595
  repaintHard() {
953
1596
  this.tableScope.repaintHard();
@@ -963,8 +1606,30 @@ class Ke {
963
1606
  this.tableScope.recalcColumnWidths(e);
964
1607
  }
965
1608
  /**
966
- * Clears the current selection of the table.
967
- * The table will be rendered automatically.
1609
+ * Clears the current selection in the table.
1610
+ *
1611
+ * This method removes any selected cells, rows, or columns in the table.
1612
+ * It provides a convenient way to programmatically clear all selections in the table
1613
+ * without having to access the underlying selection model directly.
1614
+ *
1615
+ * When called, this method delegates to the table scope's clearSelection method with
1616
+ * a parameter value of true, which ensures the table is automatically repainted after
1617
+ * the selection is cleared.
1618
+ *
1619
+ * @example
1620
+ * // Clear all selections in the table
1621
+ * tableApi.clearSelection();
1622
+ *
1623
+ * // Example usage in a component
1624
+ * class MyComponent {
1625
+ * @ViewChild('tableComponent') tableComponent: TableComponent;
1626
+ *
1627
+ * resetTableSelection(): void {
1628
+ * if (this.tableComponent?.api) {
1629
+ * this.tableComponent.api.clearSelection();
1630
+ * }
1631
+ * }
1632
+ * }
968
1633
  *
969
1634
  * @returns {void}
970
1635
  */
@@ -972,12 +1637,31 @@ class Ke {
972
1637
  this.tableScope.clearSelection(!0);
973
1638
  }
974
1639
  /**
975
- * Sets the selection model for the table scope.
1640
+ * Sets the selection model for the table.
976
1641
  *
977
- * @param {SelectionModel} sm - The selection model to be set.
978
- * @param {boolean} [repaint=true] - Indicates whether the table should be repainted after setting the selection model. Default value is true.
1642
+ * This method allows you to replace the current selection model with a new one,
1643
+ * which controls how cells, rows, or columns can be selected in the table.
979
1644
  *
980
- * @return {void}
1645
+ * @param {SelectionModel} sm - The new selection model to be set. This model defines
1646
+ * the selection behavior including selection type (none, cell, row, column),
1647
+ * selection mode (single, multi), and manages the selected ranges.
1648
+ * @param {boolean} [repaint=true] - Whether to repaint the table after changing the selection model.
1649
+ * Default is true, which immediately reflects the change visually.
1650
+ * Set to false if you want to avoid immediate repainting.
1651
+ *
1652
+ * @example
1653
+ * // Create a new selection model with row selection and multi-select mode
1654
+ * const selectionModel = new SelectionModel("row", "multi");
1655
+ *
1656
+ * // Set the new selection model and repaint the table
1657
+ * tableApi.setSelectionModel(selectionModel);
1658
+ *
1659
+ * // Set a selection model without repainting (if you plan to make more changes)
1660
+ * tableApi.setSelectionModel(selectionModel, false);
1661
+ * // ... make other changes ...
1662
+ * tableApi.repaint(); // Now repaint once
1663
+ *
1664
+ * @returns {void}
981
1665
  */
982
1666
  setSelectionModel(e, t = !0) {
983
1667
  this.tableScope.setSelectionModel(e, t);
@@ -993,9 +1677,36 @@ class Ke {
993
1677
  this.tableScope.onActionTriggered(e);
994
1678
  }
995
1679
  /**
996
- * Retrieves the mapping of shortcuts to corresponding action in the current table scope.
1680
+ * Retrieves the shortcut action mapping from the table's shortcut service.
1681
+ *
1682
+ * This method provides access to the keyboard shortcut configuration that defines
1683
+ * which keys trigger specific actions in the table. The mapping contains key-value
1684
+ * pairs where:
1685
+ * - Keys are string representations of keyboard shortcuts (e.g., "ctrl+c", "shift+arrow_down")
1686
+ * - Values are ActionId values representing the corresponding table actions
1687
+ *
1688
+ * This mapping can be useful for:
1689
+ * - Displaying available shortcuts to users
1690
+ * - Creating custom shortcut documentation
1691
+ * - Dynamically checking which actions are available via keyboard
1692
+ * - Extending or integrating with the table's shortcut system
1693
+ *
1694
+ * @returns {ShortcutActionIdMapping} An object mapping shortcut key combinations to their corresponding action IDs.
1695
+ * For example: { "ctrl+c": "COPY_2_CLIPBOARD", "arrow_down": "NAVIGATE_DOWN" }
997
1696
  *
998
- * @return {ShortcutActionIdMapping} The mapping of shortcuts to corresponding action.
1697
+ * @example
1698
+ * // Get all available shortcuts in the table
1699
+ * const shortcuts = tableApi.getShortcutActionMapping();
1700
+ *
1701
+ * // Check if a specific shortcut exists
1702
+ * if (shortcuts["ctrl+c"]) {
1703
+ * console.log("Copy shortcut is available with action:", shortcuts["ctrl+c"]);
1704
+ * }
1705
+ *
1706
+ * // Display available shortcuts in the UI
1707
+ * Object.entries(shortcuts).forEach(([key, actionId]) => {
1708
+ * console.log(`${key}: ${actionId}`);
1709
+ * });
999
1710
  */
1000
1711
  getShortcutActionMapping() {
1001
1712
  return this.tableScope.shortcutService.getShortcutActionMapping();
@@ -1003,7 +1714,35 @@ class Ke {
1003
1714
  /**
1004
1715
  * Copies the selected data from the table to the clipboard.
1005
1716
  *
1006
- * @return {Promise<string>} - A promise that resolves with the copied data as a string.
1717
+ * This method leverages the copyService to extract and copy the currently selected data
1718
+ * from the table. It works with the current selection state and focus position to determine
1719
+ * what content should be copied.
1720
+ *
1721
+ * The copied data is formatted as tab-separated text that can be pasted into spreadsheet
1722
+ * applications like Excel or text editors while maintaining the tabular structure.
1723
+ *
1724
+ * @example
1725
+ * // Copy the currently selected data to clipboard
1726
+ * tableApi.copyToClipboard().then(content => {
1727
+ * console.log('Copied to clipboard:', content);
1728
+ * });
1729
+ *
1730
+ * // Using with a button click handler
1731
+ * function onCopyButtonClick() {
1732
+ * if (tableApi) {
1733
+ * tableApi.copyToClipboard()
1734
+ * .then(content => {
1735
+ * console.log('Successfully copied data to clipboard');
1736
+ * // Optionally do something with the copied content
1737
+ * })
1738
+ * .catch(error => {
1739
+ * console.error('Failed to copy to clipboard:', error);
1740
+ * });
1741
+ * }
1742
+ * }
1743
+ *
1744
+ * @returns {Promise<string>} A promise that resolves with the copied data as a string.
1745
+ * The string contains the tab-separated representation of the selected table data.
1007
1746
  */
1008
1747
  copyToClipboard() {
1009
1748
  return this.tableScope.copyService.copyToClipboard(
@@ -1013,11 +1752,33 @@ class Ke {
1013
1752
  );
1014
1753
  }
1015
1754
  /**
1016
- * Generates and downloads an Excel file based on the table data.
1755
+ * Downloads the current table data as an Excel file.
1756
+ *
1757
+ * This method extracts all visible data from the table (including header, body, and footer areas),
1758
+ * converts it into a matrix format, and triggers a download of an Excel file containing this data.
1759
+ *
1760
+ * The method works by:
1761
+ * 1. Creating an empty matrix to hold all table data
1762
+ * 2. Iterating through each area of the table (header, body, footer)
1763
+ * 3. For each area, iterating through all rows and columns to extract cell values
1764
+ * 4. Passing the complete data matrix to the Excel service for file generation and download
1765
+ *
1766
+ * @param {string} fileName - The name of the Excel file to be downloaded (default: 'table.xlsx')
1767
+ * @param {string} author - Optional metadata for the Excel file to specify the author (default: '')
1768
+ *
1769
+ * @returns {void} The result of the excelService.downloadExcel method call
1770
+ *
1771
+ * @example
1772
+ * // Download table data with default filename
1773
+ * tableApi.downloadExcel();
1774
+ *
1775
+ * @example
1776
+ * // Download table data with custom filename and author
1777
+ * tableApi.downloadExcel('sales-report.xlsx', 'John Doe');
1017
1778
  *
1018
- * @param {string} fileName - The name of the Excel file to be downloaded. Defaults to 'table.xlsx'.
1019
- * @param {string} author - The author of the Excel file. If not provided, it will remain empty.
1020
- * @return {void} No return value. Initiates a file download of the Excel document.
1779
+ * @example
1780
+ * // Download table data with custom filename only
1781
+ * tableApi.downloadExcel('quarterly-data.xlsx');
1021
1782
  */
1022
1783
  downloadExcel(e = "table.xlsx", t = "") {
1023
1784
  const s = [], o = this.tableScope.tableModel.getColumnCount(), i = ["header", "body", "footer"];
@@ -1033,18 +1794,66 @@ class Ke {
1033
1794
  return this.tableScope.excelService.downloadExcel(s, e, t);
1034
1795
  }
1035
1796
  /**
1036
- * Retrieves the current scope of the table.
1797
+ * Returns the TableScope instance associated with this TableApi.
1798
+ *
1799
+ * The TableScope provides access to the core functionality and internal state of the table component,
1800
+ * including rendering, event handling, selection, and other low-level operations.
1801
+ *
1802
+ * This method is useful for advanced customization scenarios where you need direct access
1803
+ * to the table's internal structure and behaviors.
1804
+ *
1805
+ * @returns {TableScope} The TableScope instance that controls this table component
1037
1806
  *
1038
- * @returns {TableScope} The current scope of the table.
1807
+ * @example
1808
+ * // Access the TableScope to perform a custom operation
1809
+ * const tableApi = new TableApi(myTableScope);
1810
+ * const tableScope = tableApi.getTableScope();
1811
+ *
1812
+ * // Example: Manually trigger a context menu at a specific location
1813
+ * const mouseEvent = new MouseEvent('contextmenu');
1814
+ * const geMouseEvent = tableScope.createGeMouseEvent(mouseEvent);
1815
+ * tableScope.contextmenu(geMouseEvent);
1039
1816
  */
1040
1817
  getTableScope() {
1041
1818
  return this.tableScope;
1042
1819
  }
1043
1820
  /**
1044
- * Retrieves the selection model of the table.
1821
+ * Returns the current selection model for the table.
1822
+ *
1823
+ * The selection model manages cell selection state, including single cells, ranges, rows, and columns.
1824
+ * This method provides access to the selection model instance, allowing operations like:
1825
+ * - Checking if cells are selected
1826
+ * - Getting selection ranges
1827
+ * - Modifying selections
1828
+ * - Adding/removing selection event listeners
1829
+ *
1830
+ * @returns {SelectionModelIf | undefined} The current selection model if available, otherwise undefined.
1831
+ *
1832
+ * @example
1833
+ * // Get the selection model
1834
+ * const selectionModel = tableApi.getSelectionModel();
1045
1835
  *
1046
- * @return {SelectionModelIf | undefined} The selection model of the table,
1047
- * or undefined if no selection model is available.
1836
+ * // Check if a specific cell is selected
1837
+ * if (selectionModel?.isSelected(3, 2)) {
1838
+ * console.log('Cell at row 3, column 2 is selected');
1839
+ * }
1840
+ *
1841
+ * // Get all selected ranges
1842
+ * const ranges = selectionModel?.getRanges();
1843
+ * console.log('Selected ranges:', ranges);
1844
+ *
1845
+ * // Clear all selections
1846
+ * selectionModel?.clear();
1847
+ *
1848
+ * // Toggle selection of a cell
1849
+ * selectionModel?.togglePoint(5, 1);
1850
+ *
1851
+ * // Add a selection change listener
1852
+ * selectionModel?.addEventSelectionChangedListener({
1853
+ * selectionChanged: () => {
1854
+ * console.log('Selection has changed');
1855
+ * }
1856
+ * });
1048
1857
  */
1049
1858
  getSelectionModel() {
1050
1859
  return this.tableScope.selectionModel();
@@ -1117,7 +1926,7 @@ class Ke {
1117
1926
  */
1118
1927
  setRows(e) {
1119
1928
  const t = this.getBodyModel();
1120
- t instanceof k ? t.setRows(e) : console.warn("setRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ", typeof t, t);
1929
+ t instanceof F ? t.setRows(e) : console.warn("setRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ", typeof t, t);
1121
1930
  }
1122
1931
  /**
1123
1932
  * Adds new rows to the end of the table body.
@@ -1135,7 +1944,7 @@ class Ke {
1135
1944
  */
1136
1945
  addRows(e) {
1137
1946
  const t = this.getBodyModel();
1138
- if (t instanceof k) {
1947
+ if (t instanceof F) {
1139
1948
  const s = t;
1140
1949
  let o = s.getAllRows();
1141
1950
  s.setRows([...o, ...e]);
@@ -1160,7 +1969,7 @@ class Ke {
1160
1969
  */
1161
1970
  addRowsAt(e, t) {
1162
1971
  const s = this.getBodyModel();
1163
- if (s instanceof k) {
1972
+ if (s instanceof F) {
1164
1973
  const o = s;
1165
1974
  let i = o.getAllRows();
1166
1975
  o.setRows([...i.slice(0, t), ...e, ...i.slice(t)]);
@@ -1186,7 +1995,7 @@ class Ke {
1186
1995
  */
1187
1996
  removeRows(e, t = (s, o) => s === o) {
1188
1997
  const s = this.getBodyModel();
1189
- if (s instanceof k) {
1998
+ if (s instanceof F) {
1190
1999
  const o = s, i = o.getAllRows().filter((r) => !e.some((a) => t(r, a)));
1191
2000
  o.setRows(i);
1192
2001
  } else
@@ -1227,7 +2036,7 @@ class Ke {
1227
2036
  */
1228
2037
  findRows(e, t = (s, o) => s === o) {
1229
2038
  const s = this.getBodyModel();
1230
- return s instanceof k ? 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), []);
2039
+ return s instanceof F ? 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), []);
1231
2040
  }
1232
2041
  /**
1233
2042
  * Searches through the filtered rows of the table to find a row that matches specific criteria.
@@ -1284,7 +2093,7 @@ class Ke {
1284
2093
  */
1285
2094
  findRowFromFilteredRowsByAllCriteria(e, t) {
1286
2095
  const s = this.getBodyModel();
1287
- if (s instanceof k)
2096
+ if (s instanceof F)
1288
2097
  return s.getFilteredRows().find((i) => t(e, i));
1289
2098
  console.warn("findRowFromFilteredRowsByAllCriteria(...) only works with AreaModelObjectArray<T>, but this body area model is ", typeof s, s);
1290
2099
  }
@@ -1331,7 +2140,7 @@ class Ke {
1331
2140
  */
1332
2141
  findRowFromAllRowsByAllCriteria(e, t) {
1333
2142
  const s = this.getBodyModel();
1334
- if (s instanceof k)
2143
+ if (s instanceof F)
1335
2144
  return s.getAllRows().find((i) => t(e, i));
1336
2145
  console.warn("findRowFromAllRowsByAllCriteria(...) only works with AreaModelObjectArray<T>, but this body area model is ", typeof s, s);
1337
2146
  }
@@ -1356,7 +2165,7 @@ class Ke {
1356
2165
  */
1357
2166
  updateRows(e, t = (s, o) => s === o) {
1358
2167
  const s = this.getBodyModel();
1359
- if (s instanceof k) {
2168
+ if (s instanceof F) {
1360
2169
  let i = s.getAllRows();
1361
2170
  for (const r of i)
1362
2171
  for (const a of e)
@@ -1525,6 +2334,184 @@ class Ke {
1525
2334
  getFirstVisibleRowIndex() {
1526
2335
  return this.tableScope.getFirstVisibleRowIndex();
1527
2336
  }
2337
+ /**
2338
+ * Retrieves the index of the first fully visible row in the table's viewport.
2339
+ *
2340
+ * A row is considered "fully visible" when it's completely within the visible area of the table.
2341
+ * This differs from the regular "visible" row, which might be partially visible at the edges of the viewport.
2342
+ *
2343
+ * This method is useful for:
2344
+ * - Determining which rows are completely in view for operations that require full visibility
2345
+ * - Implementing pagination or virtualization logic that needs to know complete row visibility
2346
+ * - Supporting keyboard navigation that should skip partially visible rows
2347
+ *
2348
+ * @returns {number} The index of the first fully visible row, or -1 if no rows are fully visible
2349
+ *
2350
+ * @example
2351
+ * // Get the first fully visible row index
2352
+ * const firstFullVisibleRow = tableApi.getFirstFullVisibleRowIndex();
2353
+ *
2354
+ * // Check if a specific row is fully visible
2355
+ * const isRowFullyVisible = (rowIndex) => {
2356
+ * const firstFullVisible = tableApi.getFirstFullVisibleRowIndex();
2357
+ * const lastFullVisible = tableApi.getLastFullVisibleRowIndex();
2358
+ * return rowIndex >= firstFullVisible && rowIndex <= lastFullVisible;
2359
+ * };
2360
+ */
2361
+ getFirstFullVisibleRowIndex() {
2362
+ return this.tableScope.getFirstFullVisibleRowIndex();
2363
+ }
2364
+ /**
2365
+ * Returns the index of the last row that is visible in the table's viewport.
2366
+ *
2367
+ * This method retrieves the last visible row index from the table scope, which keeps
2368
+ * track of which rows are currently visible as the user scrolls through the table.
2369
+ *
2370
+ * This can be useful for:
2371
+ * - Implementing virtualized scrolling optimizations
2372
+ * - Determining if specific rows are currently in view
2373
+ * - Implementing features that need to know the visible range of rows
2374
+ *
2375
+ * @returns {number} The index of the last visible row in the table viewport
2376
+ *
2377
+ * @example
2378
+ * // Check if a specific row is currently visible in the viewport
2379
+ * const lastVisibleIndex = tableApi.getLastVisibleRowIndex();
2380
+ * const firstVisibleIndex = tableApi.getFirstVisibleRowIndex();
2381
+ * const isRowVisible = rowIndex >= firstVisibleIndex && rowIndex <= lastVisibleIndex;
2382
+ *
2383
+ * @example
2384
+ * // Get the range of visible rows
2385
+ * const visibleRowsRange = {
2386
+ * first: tableApi.getFirstVisibleRowIndex(),
2387
+ * last: tableApi.getLastVisibleRowIndex()
2388
+ * };
2389
+ * console.log(`Visible rows: ${visibleRowsRange.first} to ${visibleRowsRange.last}`);
2390
+ */
2391
+ getLastVisibleRowIndex() {
2392
+ return this.tableScope.getLastVisibleRowIndex();
2393
+ }
2394
+ /**
2395
+ * Returns the index of the last fully visible row in the table's viewport.
2396
+ *
2397
+ * This method retrieves the last row that is completely visible within the current
2398
+ * viewport of the table. A row is considered "fully visible" when its entire height
2399
+ * is visible without any portion being cut off by the viewport boundaries.
2400
+ *
2401
+ * The distinction between "visible" and "fully visible" is important when scrolling:
2402
+ * - A row can be partially visible (some portion is in view)
2403
+ * - A row can be fully visible (the entire row is in view)
2404
+ *
2405
+ * @returns {number} The index of the last fully visible row in the table.
2406
+ * If no row is fully visible or the table is empty, the method might return -1.
2407
+ *
2408
+ * @example
2409
+ * ```typescript
2410
+ * // Get the index of the last fully visible row
2411
+ * const lastVisibleRowIndex = tableApi.getLastFullVisibleRowIndex();
2412
+ *
2413
+ * // Use this information to determine if a specific row is fully visible
2414
+ * const isRowFullyVisible = rowIndex <= lastVisibleRowIndex && rowIndex >= tableApi.getFirstFullVisibleRowIndex();
2415
+ *
2416
+ * // Can be used with scrolling operations to ensure certain rows are visible
2417
+ * if (rowIndex > lastVisibleRowIndex) {
2418
+ * tableApi.ensureRowIsVisible(rowIndex);
2419
+ * }
2420
+ * ```
2421
+ */
2422
+ getLastFullVisibleRowIndex() {
2423
+ return this.tableScope.getLastFullVisibleRowIndex();
2424
+ }
2425
+ /**
2426
+ * Checks whether logging is currently active for the table component.
2427
+ *
2428
+ * This method returns the current state of logging for the table. When logging is active,
2429
+ * the table outputs detailed information about its operations to the console, including:
2430
+ *
2431
+ * - Rendering processes and lifecycle events
2432
+ * - Data modifications and updates
2433
+ * - Event handling and user interactions
2434
+ * - Performance metrics and state changes
2435
+ *
2436
+ * Logging can be toggled using the `setLoggingActive(boolean)` method.
2437
+ *
2438
+ * @returns {boolean} True if logging is currently enabled, false otherwise.
2439
+ *
2440
+ * @example
2441
+ * // Check if logging is enabled
2442
+ * if (tableApi.isLoggingActive()) {
2443
+ * console.log("Table logging is currently active");
2444
+ * }
2445
+ *
2446
+ * // Conditionally enable logging only if it's not already active
2447
+ * if (!tableApi.isLoggingActive()) {
2448
+ * tableApi.setLoggingActive(true);
2449
+ *
2450
+ * // Perform operations that need debugging
2451
+ * tableApi.updateCells([
2452
+ * {
2453
+ * area: "body",
2454
+ * rowIndex: 2,
2455
+ * columnIndex: 3,
2456
+ * value: "New Value",
2457
+ * cssClasses: { "highlight": true }
2458
+ * }
2459
+ * ]);
2460
+ *
2461
+ * // Run some additional operations...
2462
+ *
2463
+ * // Disable logging when finished
2464
+ * tableApi.setLoggingActive(false);
2465
+ * }
2466
+ */
2467
+ setLoggingActive(e) {
2468
+ this.tableScope.loggingActive = e;
2469
+ }
2470
+ /**
2471
+ * Checks whether logging is currently active for the table component.
2472
+ *
2473
+ * This method returns the current state of logging for the table. When logging is active,
2474
+ * the table outputs detailed information about its operations to the console, including:
2475
+ *
2476
+ * - Rendering processes and lifecycle events
2477
+ * - Data modifications and updates
2478
+ * - Event handling and user interactions
2479
+ * - Performance metrics and state changes
2480
+ *
2481
+ * Logging can be toggled using the `setLoggingActive(boolean)` method.
2482
+ *
2483
+ * @returns {boolean} True if logging is currently enabled, false otherwise.
2484
+ *
2485
+ * @example
2486
+ * // Check if logging is enabled
2487
+ * if (tableApi.isLoggingActive()) {
2488
+ * console.log("Table logging is currently active");
2489
+ * }
2490
+ *
2491
+ * // Conditionally enable logging only if it's not already active
2492
+ * if (!tableApi.isLoggingActive()) {
2493
+ * tableApi.setLoggingActive(true);
2494
+ *
2495
+ * // Perform operations that need debugging
2496
+ * tableApi.updateCells([
2497
+ * {
2498
+ * area: "body",
2499
+ * rowIndex: 2,
2500
+ * columnIndex: 3,
2501
+ * value: "New Value",
2502
+ * cssClasses: { "highlight": true }
2503
+ * }
2504
+ * ]);
2505
+ *
2506
+ * // Run some additional operations...
2507
+ *
2508
+ * // Disable logging when finished
2509
+ * tableApi.setLoggingActive(false);
2510
+ * }
2511
+ */
2512
+ isLoggingActive() {
2513
+ return this.tableScope.loggingActive;
2514
+ }
1528
2515
  }
1529
2516
  class te {
1530
2517
  constructor(e) {
@@ -1927,11 +2914,11 @@ class tt {
1927
2914
  class st extends Qe {
1928
2915
  constructor(e, t, s, o) {
1929
2916
  var r, a;
1930
- 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 = {
2917
+ 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 = {
1931
2918
  header: [],
1932
2919
  body: [],
1933
2920
  footer: []
1934
- }, this.tree = !1, this.colAndRowspanModels = new tt(), this.firstVisibleRowIndex = -1, this.draggingTargetColumnIndex = -1, this.removables = [], this.displayedRowCount = 0, 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), q(t.getAreaModel("body")) && (this.tree = !0), ["header", "body", "footer"].forEach(
2921
+ }, this.tree = !1, this.colAndRowspanModels = new tt(), 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), q(t.getAreaModel("body")) && (this.tree = !0), ["header", "body", "footer"].forEach(
1935
2922
  (l) => {
1936
2923
  var c;
1937
2924
  this.colAndRowspanModels[l] = new et(t, t.getAreaModel(l)), (c = this.colAndRowspanModels[l]) == null || c.init();
@@ -2084,12 +3071,27 @@ class st extends Qe {
2084
3071
  }
2085
3072
  const p = r.getCustomClassesAt(t, s);
2086
3073
  p.length && this.dom.addClasses(p, l);
2087
- const u = r.getCustomStyleAt(t, s);
2088
- if (u)
2089
- for (const g in u)
2090
- this.dom.setStyle(l, g, u[g]);
3074
+ const m = r.getCustomStyleAt(t, s);
3075
+ if (m)
3076
+ for (const g in m)
3077
+ this.dom.setStyle(l, g, m[g]);
2091
3078
  }
2092
3079
  }
3080
+ getFirstVisibleRowIndex() {
3081
+ return this.firstVisibleRowIndex;
3082
+ }
3083
+ getLastVisibleRowIndex() {
3084
+ return this.lastVisibleRowIndex;
3085
+ }
3086
+ getFirstFullVisibleRowIndex() {
3087
+ return this.firstFullVisibleRowIndex;
3088
+ }
3089
+ getLastFullVisibleRowIndex() {
3090
+ return this.lastFullVisibleRowIndex;
3091
+ }
3092
+ getDisplayedRowCount() {
3093
+ return this.displayedRowCount;
3094
+ }
2093
3095
  /**
2094
3096
  * Stores the widths of all columns in the table.
2095
3097
  *
@@ -2190,16 +3192,17 @@ class st extends Qe {
2190
3192
  s.child.innerText = "", o.child.innerText = "", i.child.innerText = "";
2191
3193
  const a = 0, l = this.areaBodyCenterGeo.width, c = this.tableModel.getPadding(), h = this.tableModel.getAreaModel(e), d = h.getRowCount();
2192
3194
  for (; this.cleanupFunctions[e].length; ) {
2193
- const m = this.cleanupFunctions[e].shift();
2194
- m && m();
3195
+ const u = this.cleanupFunctions[e].shift();
3196
+ u && u();
2195
3197
  }
2196
3198
  let p = t;
2197
- const u = this.tableModel.getColumnCount(), g = this.tableModel.getFixedRightColumnCount(), b = this.tableModel.getFixedLeftColumnCount();
2198
- for (let m = 0; m < d; m++) {
2199
- const w = p, x = m === d - 1, v = this.tableModel.getRowHeight(e, m);
3199
+ const m = this.tableModel.getColumnCount(), g = this.tableModel.getFixedRightColumnCount(), b = this.tableModel.getFixedLeftColumnCount();
3200
+ e === "body" && (this.firstVisibleRowIndex = -1, this.firstFullVisibleRowIndex = -1, this.lastVisibleRowIndex = -1, this.lastFullVisibleRowIndex = -1);
3201
+ for (let u = 0; u < d; u++) {
3202
+ const w = p, x = u === d - 1, v = this.tableModel.getRowHeight(e, u);
2200
3203
  if (w + v > 0) {
2201
- this.firstVisibleRowIndex = m;
2202
- let y = { left: a, width: l, height: v, top: w, index: m }, S = this.dom.addRowDiv(o, y, m, e, "center");
3204
+ e === "body" && this.firstVisibleRowIndex === -1 && (this.firstVisibleRowIndex = u, this.firstFullVisibleRowIndex = w < -this.pixelLimitForFullVisible ? this.firstVisibleRowIndex + 1 : this.firstVisibleRowIndex);
3205
+ let y = { left: a, width: l, height: v, top: w, index: u }, S = this.dom.addRowDiv(o, y, u, e, "center");
2203
3206
  const M = b;
2204
3207
  if (this.adjustColumnsToRowParent({
2205
3208
  areaIdent: e,
@@ -2207,61 +3210,64 @@ class st extends Qe {
2207
3210
  areaModel: h,
2208
3211
  geo: y,
2209
3212
  parent: S,
2210
- rowIndex: m,
3213
+ rowIndex: u,
2211
3214
  columnIndexStart: M,
2212
- columnIndexEnd: u - g - 1,
3215
+ columnIndexEnd: m - g - 1,
2213
3216
  verticalFixed: !1,
2214
3217
  lastRowOfModel: x
2215
- }), c.left > 0 && (y = { left: a, width: this.areaBodyWestGeo.width, height: v, top: w, index: m }, S = this.dom.addRowDiv(s, y, m, e, "west"), this.adjustColumnsToRowParent({
3218
+ }), c.left > 0 && (y = { left: a, width: this.areaBodyWestGeo.width, height: v, top: w, index: u }, S = this.dom.addRowDiv(s, y, u, e, "west"), this.adjustColumnsToRowParent({
2216
3219
  areaIdent: e,
2217
3220
  sideIdent: "west",
2218
3221
  areaModel: h,
2219
3222
  geo: y,
2220
3223
  parent: S,
2221
- rowIndex: m,
3224
+ rowIndex: u,
2222
3225
  columnIndexStart: 0,
2223
3226
  columnIndexEnd: M - 1,
2224
3227
  verticalFixed: !0,
2225
3228
  lastRowOfModel: x
2226
- })), c.right > 0 && (y = { left: a, width: this.areaBodyEastGeo.width, height: v, top: w, index: m }, S = this.dom.addRowDiv(i, y, m, e, "east"), this.adjustColumnsToRowParent({
3229
+ })), c.right > 0 && (y = { left: a, width: this.areaBodyEastGeo.width, height: v, top: w, index: u }, S = this.dom.addRowDiv(i, y, u, e, "east"), this.adjustColumnsToRowParent({
2227
3230
  areaIdent: e,
2228
3231
  sideIdent: "east",
2229
3232
  areaModel: h,
2230
3233
  geo: y,
2231
3234
  parent: S,
2232
- rowIndex: m,
2233
- columnIndexStart: u - g,
2234
- columnIndexEnd: u - 1,
3235
+ rowIndex: u,
3236
+ columnIndexStart: m - g,
3237
+ columnIndexEnd: m - 1,
2235
3238
  verticalFixed: !0,
2236
3239
  lastRowOfModel: x
2237
- })), e === "header" && this.tree && m === d - 1) {
2238
- const E = this.dom.applyStyle(
3240
+ })), e === "header" && this.tree && u === d - 1) {
3241
+ const R = this.dom.applyStyle(
2239
3242
  this.dom.setAttribute(
2240
3243
  this.dom.addDiv(S, new T(16, 20, 20, 8)),
2241
3244
  "data-ge-action",
2242
3245
  "toggleExpandCollapseAll"
2243
3246
  ),
2244
3247
  { cursor: "pointer" }
2245
- ), R = this.tableOptions.treeOptions.arrowExpandCollapseAll;
2246
- if (R) {
2247
- const W = this.dom.domService.createText(R.content);
2248
- this.dom.domService.appendChild(E, W), R.style && this.dom.applyStyleString(E, R.style);
3248
+ ), E = this.tableOptions.treeOptions.arrowExpandCollapseAll;
3249
+ if (E) {
3250
+ const $ = this.dom.domService.createText(E.content);
3251
+ this.dom.domService.appendChild(R, $), E.style && this.dom.applyStyleString(R, E.style);
2249
3252
  }
2250
3253
  }
2251
3254
  }
2252
3255
  if (p = p + v, p > r) {
2253
- e === "body" && (this.displayedRowCount = this.firstVisibleRowIndex - m);
3256
+ e === "body" && (this.lastVisibleRowIndex = u, this.lastFullVisibleRowIndex = r - p < -this.pixelLimitForFullVisible ? u - 1 : u, this.displayedRowCount = this.lastFullVisibleRowIndex - this.firstFullVisibleRowIndex + 1);
2254
3257
  break;
2255
3258
  }
2256
3259
  }
2257
- if (this.colAndRowspanModels && this.colAndRowspanModels[e]) {
2258
- const m = ((f = this.colAndRowspanModels[e]) == null ? void 0 : f.getRanges()) ?? [];
2259
- if (m.length)
2260
- for (const w of m) {
3260
+ if (this.loggingActive && e === "body" && console.log("render scope: this.firstVisibleRowIndex <- " + this.firstVisibleRowIndex + `
3261
+ render scope: this.firstFullVisibleRowIndex <- ` + this.firstFullVisibleRowIndex + `
3262
+ render scope: this.lastVisibleRowIndex <- ` + this.lastVisibleRowIndex + `
3263
+ render scope: this.lastFullVisibleRowIndex <- ` + this.lastFullVisibleRowIndex), this.colAndRowspanModels && this.colAndRowspanModels[e]) {
3264
+ const u = ((f = this.colAndRowspanModels[e]) == null ? void 0 : f.getRanges()) ?? [];
3265
+ if (u.length)
3266
+ for (const w of u) {
2261
3267
  let x = 0, v = o.child, y = "center";
2262
3268
  if (w.c1 < b)
2263
3269
  v = s.child, y = "west";
2264
- else if (g > 0 && w.c1 >= u - g)
3270
+ else if (g > 0 && w.c1 >= m - g)
2265
3271
  v = i.child, y = "east";
2266
3272
  else {
2267
3273
  const S = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
@@ -2282,10 +3288,10 @@ class st extends Qe {
2282
3288
  * @protected
2283
3289
  */
2284
3290
  drawBigCell(e, t, s, o, i, r) {
2285
- const a = s + this.getRowHeights(0, e.r1 - 1, o).reduce((f, m) => f + m, 0), l = this.tableModel.getColumnCount(), c = this.tableModel.getFixedRightColumnCount();
3291
+ const a = s + this.getRowHeights(0, e.r1 - 1, o).reduce((f, u) => f + u, 0), l = this.tableModel.getColumnCount(), c = this.tableModel.getFixedRightColumnCount();
2286
3292
  let h = 0;
2287
3293
  c > 0 && e.c1 >= l - c && (h = l - c);
2288
- const d = t + this.getColumnWidths(h, e.c1 - 1).reduce((f, m) => f + m, 0), p = this.getRowHeights(e.r1, e.r2, o).reduce((f, m) => f + m, 0), u = this.getColumnWidths(e.c1, e.c2).reduce((f, m) => f + m, 0);
3294
+ const d = t + this.getColumnWidths(h, e.c1 - 1).reduce((f, u) => f + u, 0), p = this.getRowHeights(e.r1, e.r2, o).reduce((f, u) => f + u, 0), m = this.getColumnWidths(e.c1, e.c2).reduce((f, u) => f + u, 0);
2289
3295
  let g = !1;
2290
3296
  const b = this.getSelectionModel ? this.getSelectionModel() : void 0;
2291
3297
  b && (g = b.getSelectionCount(e.r1, e.c1) > 0), e.gammaRange ? this.renderCell({
@@ -2296,7 +3302,7 @@ class st extends Qe {
2296
3302
  columnIndex: e.c1,
2297
3303
  left: d,
2298
3304
  top: a,
2299
- width: u,
3305
+ width: m,
2300
3306
  height: p,
2301
3307
  parent: i,
2302
3308
  cellSelected: g,
@@ -2310,7 +3316,7 @@ class st extends Qe {
2310
3316
  columnIndex: e.c1,
2311
3317
  left: d,
2312
3318
  top: a,
2313
- width: u,
3319
+ width: m,
2314
3320
  height: p,
2315
3321
  parent: i,
2316
3322
  cellSelected: g,
@@ -2321,7 +3327,7 @@ class st extends Qe {
2321
3327
  columnIndex: e.c1,
2322
3328
  cellLeft: d,
2323
3329
  cellTop: a,
2324
- cellWidth: u,
3330
+ cellWidth: m,
2325
3331
  cellHeight: p,
2326
3332
  parent: i
2327
3333
  });
@@ -2372,41 +3378,41 @@ class st extends Qe {
2372
3378
  const f = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
2373
3379
  d = this.scrollFactorX * f;
2374
3380
  }
2375
- const p = 0, u = !!(e === "body" && t);
3381
+ const p = 0, m = !!(e === "body" && t);
2376
3382
  let g = d;
2377
3383
  for (let f = a; f <= l; f++) {
2378
- const m = g, w = this.tableModel.getColumnWidth(f);
2379
- if (w > 0 && m + w > 0) {
3384
+ const u = g, w = this.tableModel.getColumnWidth(f);
3385
+ if (w > 0 && u + w > 0) {
2380
3386
  let x = o.height;
2381
3387
  const v = s.getRowspanAt(r, f), y = s.getColspanAt(r, f);
2382
- v > 1 && (x = this.getRowHeights(r, r + v - 1, s).reduce((E, R) => E + R, 0));
3388
+ v > 1 && (x = this.getRowHeights(r, r + v - 1, s).reduce((R, E) => R + E, 0));
2383
3389
  let S = w;
2384
- y > 1 && (S = this.getColumnWidths(f, f + y - 1).reduce((E, R) => E + R, 0));
3390
+ y > 1 && (S = this.getColumnWidths(f, f + y - 1).reduce((R, E) => R + E, 0));
2385
3391
  let M = !1;
2386
3392
  if (this.colAndRowspanModels && this.colAndRowspanModels[e] && (b = this.colAndRowspanModels[e]) != null && b.isInRange(r, f) && (M = !0), this.draggingTargetColumnIndex === f && e !== "header") {
2387
- this.renderDragTargetDiv(i, m, p, S, x);
2388
- const E = { left: m, top: p, width: S, height: x };
2389
- this.dom.addColumnBorderDivs(this.tableOptions, i, E, e, t);
3393
+ this.renderDragTargetDiv(i, u, p, S, x);
3394
+ const R = { left: u, top: p, width: S, height: x };
3395
+ this.dom.addColumnBorderDivs(this.tableOptions, i, R, e, t);
2390
3396
  } else {
2391
- const E = this.renderSelectedBackgroundDiv(M, u, t, s, r, f, i, m, p, S, x);
3397
+ const R = this.renderSelectedBackgroundDiv(M, m, t, s, r, f, i, u, p, S, x);
2392
3398
  "gammaCells" in s && s.getValueAt(r, f) && (M = !1), M || this.renderCell({
2393
3399
  areaModel: s,
2394
3400
  areaIdent: e,
2395
3401
  sideIdent: t,
2396
3402
  rowIndex: r,
2397
3403
  columnIndex: f,
2398
- left: m,
3404
+ left: u,
2399
3405
  top: p,
2400
3406
  width: S,
2401
3407
  height: x,
2402
3408
  parent: i,
2403
- cellSelected: E,
3409
+ cellSelected: R,
2404
3410
  lastRowOfModel: h,
2405
3411
  gammaRange: !0
2406
3412
  }), e === "header" && this.tableOptions.columnsResizable && this.renderHeaderCellResizeHandle({
2407
3413
  rowIndex: r,
2408
3414
  columnIndex: f,
2409
- cellLeft: m,
3415
+ cellLeft: u,
2410
3416
  cellTop: p,
2411
3417
  cellWidth: S,
2412
3418
  cellHeight: x,
@@ -2445,9 +3451,9 @@ class st extends Qe {
2445
3451
  lastRowOfModel: d
2446
3452
  }) {
2447
3453
  var ie;
2448
- const u = this.editorRenderer && this.editorRendererRow === o && this.editorRendererColumn === i ? this.editorRenderer : e.getCellRenderer(o, i), g = { left: r, width: a, height: l, top: c, index: i }, b = e.getRowByIndex(o);
3454
+ const m = this.editorRenderer && this.editorRendererRow === o && this.editorRendererColumn === i ? this.editorRenderer : e.getCellRenderer(o, i), g = { left: r, width: a, height: l, top: c, index: i }, b = e.getRowByIndex(o);
2449
3455
  let f = "none";
2450
- if (i === this.getTreeArrowColumnIndex() && H(b)) {
3456
+ if (i === this.getTreeArrowColumnIndex() && W(b)) {
2451
3457
  const C = b;
2452
3458
  (ie = C.children) != null && ie.length ? C.expanded ? f = "expanded" : f = "collapsed" : f = "hidden";
2453
3459
  }
@@ -2456,7 +3462,7 @@ class st extends Qe {
2456
3462
  const C = this.tableModel.getColumnDef(i);
2457
3463
  (!(C != null && C.sortIconVisible) || C != null && C.sortIconVisible()) && (w = C == null ? void 0 : C.sortState);
2458
3464
  }
2459
- const x = e.getValueAt(o, i), v = u ? "" : `${x}`, y = e.isRowChecked(o), S = this.dom.addColumnDiv(
3465
+ const x = e.getValueAt(o, i), v = m ? "" : `${x}`, y = e.isRowChecked(o), S = this.dom.addColumnDiv(
2460
3466
  {
2461
3467
  parent: h,
2462
3468
  geo: g,
@@ -2472,12 +3478,12 @@ class st extends Qe {
2472
3478
  }
2473
3479
  ), M = e.getTooltipAt(o, i);
2474
3480
  M && this.dom.setAttribute(S, "title", M);
2475
- const E = this.tableModel.getColumnDef(i);
2476
- E && E.classes[t] && this.dom.addClasses(E.classes[t], S);
2477
- let R;
2478
- u && (R = u.render(S, o, i, t, e, x, this.dom.domService));
2479
- const W = e.getCustomClassesAt(o, i);
2480
- if (W.length && this.dom.addClasses(W, S), this.dom.addColumnBorderDivs(this.tableOptions, h, g, t, s), d && this.dom.addHorizontalBorder({ left: r, width: a, height: l, top: c + l }, h), this.getFocusModel && t === "body") {
3481
+ const R = this.tableModel.getColumnDef(i);
3482
+ R && R.classes[t] && this.dom.addClasses(R.classes[t], S);
3483
+ let E;
3484
+ m && (E = m.render(S, o, i, t, e, x, this.dom.domService));
3485
+ const $ = e.getCustomClassesAt(o, i);
3486
+ if ($.length && this.dom.addClasses($, S), this.dom.addColumnBorderDivs(this.tableOptions, h, g, t, s), d && this.dom.addHorizontalBorder({ left: r, width: a, height: l, top: c + l }, h), this.getFocusModel && t === "body") {
2481
3487
  const C = this.getFocusModel();
2482
3488
  C != null && C.hasFocus(o, i) && this.dom.addFocusBorderDivs(h, g, {});
2483
3489
  }
@@ -2486,7 +3492,7 @@ class st extends Qe {
2486
3492
  if (U)
2487
3493
  for (const C in U)
2488
3494
  this.dom.setStyle(S, C, U[C]);
2489
- return [S, R];
3495
+ return [S, E];
2490
3496
  }
2491
3497
  /**
2492
3498
  * Applies CSS classes to an HTML element.
@@ -2652,7 +3658,7 @@ class st extends Qe {
2652
3658
  if (r) {
2653
3659
  const a = e.index ?? 0, l = this.draggingColumn;
2654
3660
  for (let c = 0; c < r; c++) {
2655
- const h = s, d = i.getRowHeight(c), p = { left: 0, width: e.width, height: d, top: h, index: c }, u = i.getValueAt(c, a), g = i.getCellRenderer(c, a), b = g ? "" : `${u}`, f = {
3661
+ const h = s, d = i.getRowHeight(c), p = { left: 0, width: e.width, height: d, top: h, index: c }, m = i.getValueAt(c, a), g = i.getCellRenderer(c, a), b = g ? "" : `${m}`, f = {
2656
3662
  parent: l,
2657
3663
  geo: p,
2658
3664
  rowIndex: c,
@@ -2660,17 +3666,17 @@ class st extends Qe {
2660
3666
  areaIdent: t,
2661
3667
  sideIdent: o,
2662
3668
  text: b
2663
- }, m = this.dom.addColumnDiv(f);
3669
+ }, u = this.dom.addColumnDiv(f);
2664
3670
  let w;
2665
- g && (w = g.render(m, c, a, t, i, u, this.dom.domService), w && this.cleanupFunctions[t].push(w));
3671
+ g && (w = g.render(u, c, a, t, i, m, this.dom.domService), w && this.cleanupFunctions[t].push(w));
2666
3672
  const x = i.getCustomClassesAt(c, a);
2667
- x.length && this.dom.addClasses(x, m);
3673
+ x.length && this.dom.addClasses(x, u);
2668
3674
  const v = this.tableModel.getColumnDef(a);
2669
- v && v.classes[t] && this.dom.addClasses(v.classes[t], m), this.dom.addColumnBorderDivs(this.tableOptions, l, p, t, o);
3675
+ v && v.classes[t] && this.dom.addClasses(v.classes[t], u), this.dom.addColumnBorderDivs(this.tableOptions, l, p, t, o);
2670
3676
  const y = i.getCustomStyleAt(c, a);
2671
3677
  if (y)
2672
3678
  for (const S in y)
2673
- this.dom.setStyle(m, S, y[S]);
3679
+ this.dom.setStyle(u, S, y[S]);
2674
3680
  s = s + d;
2675
3681
  }
2676
3682
  }
@@ -2723,9 +3729,9 @@ class st extends Qe {
2723
3729
  renderSelectedBackgroundDiv(e, t, s, o, i, r, a, l, c, h, d) {
2724
3730
  let p = !1;
2725
3731
  if (!e && t && o.isSelectable(i, r) && this.getSelectionModel) {
2726
- const u = this.getSelectionModel();
2727
- if (u) {
2728
- const g = u.getSelectionCount(i, r);
3732
+ const m = this.getSelectionModel();
3733
+ if (m) {
3734
+ const g = m.getSelectionCount(i, r);
2729
3735
  p = g > 0;
2730
3736
  for (let b = 0; b < g; b++) {
2731
3737
  const f = this.dom.applyStylePosistionAbsolute(
@@ -2771,7 +3777,7 @@ class st extends Qe {
2771
3777
  cellSelected: d,
2772
3778
  lastRowOfModel: p
2773
3779
  }) {
2774
- const [u, g] = this.addAndRenderCellDiv({
3780
+ const [m, g] = this.addAndRenderCellDiv({
2775
3781
  areaModel: e,
2776
3782
  areaIdent: t,
2777
3783
  sideIdent: s,
@@ -2784,7 +3790,7 @@ class st extends Qe {
2784
3790
  parent: h,
2785
3791
  lastRowOfModel: p
2786
3792
  });
2787
- d && this.dom.addClass(`ge-table-${t}-${s}-selected-range`, u), g && this.cleanupFunctions[t].push(g);
3793
+ d && this.dom.addClass(`ge-table-${t}-${s}-selected-range`, m), g && this.cleanupFunctions[t].push(g);
2788
3794
  }
2789
3795
  /**
2790
3796
  * Render the header cell resize handle.
@@ -2854,8 +3860,8 @@ class at {
2854
3860
  var i, r, a, l, c, h, d;
2855
3861
  let s = !1, o = !1;
2856
3862
  if (this.getSelectionModel && this.getFocusModel) {
2857
- const p = this.getSelectionModel(), u = this.getFocusModel();
2858
- p && u && (u.hasFocus(e.rowIndex, e.columnIndex) || (u.setFocus(e.rowIndex, e.columnIndex), this.tableScope.onFocusChanged(u), s = !0), (i = e.originalEvent) != null && i.shiftKey || p.hasSelection() && (p.clear(), s = !0), (r = e.originalEvent) != null && r.shiftKey && this.previousEvt ? (p.addSelection(this.createRangeByEvents(e, this.previousEvt)), o = !0, s = !0) : (a = e.originalEvent) != null && a.altKey && ((l = e.originalEvent) != null && l.ctrlKey || (c = e.originalEvent) != null && c.metaKey) ? (p.removeSelection(A.singleCell(e.rowIndex, e.columnIndex)), o = !0, s = !0) : (h = e.originalEvent) != null && h.ctrlKey || (d = e.originalEvent) != null && d.metaKey ? (p.addSelection(A.singleCell(e.rowIndex, e.columnIndex)), o = !0, s = !0) : (p.firstClick(e.rowIndex, e.columnIndex), s = !0), this.tableScope.onSelectionChanged(p));
3863
+ const p = this.getSelectionModel(), m = this.getFocusModel();
3864
+ p && m && (m.hasFocus(e.rowIndex, e.columnIndex) || (m.setFocus(e.rowIndex, e.columnIndex), this.tableScope.onFocusChanged(m), s = !0), (i = e.originalEvent) != null && i.shiftKey || p.hasSelection() && (p.clear(), s = !0), (r = e.originalEvent) != null && r.shiftKey && this.previousEvt ? (p.addSelection(this.createRangeByEvents(e, this.previousEvt)), o = !0, s = !0) : (a = e.originalEvent) != null && a.altKey && ((l = e.originalEvent) != null && l.ctrlKey || (c = e.originalEvent) != null && c.metaKey) ? (p.removeSelection(A.singleCell(e.rowIndex, e.columnIndex)), o = !0, s = !0) : (h = e.originalEvent) != null && h.ctrlKey || (d = e.originalEvent) != null && d.metaKey ? (p.addSelection(A.singleCell(e.rowIndex, e.columnIndex)), o = !0, s = !0) : (p.firstClick(e.rowIndex, e.columnIndex), s = !0), this.tableScope.onSelectionChanged(p));
2859
3865
  }
2860
3866
  return o ? this.previousEvt = void 0 : this.previousEvt = e == null ? void 0 : e.clone(), s;
2861
3867
  }
@@ -3250,7 +4256,7 @@ class ye {
3250
4256
  }, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new ue(), this.headerGroupOptions = new Se(), this.showCheckboxWihoutExtraColumn = !1, this.externalFilterFunction = void 0, this.sortedOptions = new me(), this.sortOrder = ["asc", "desc"], this.shortcutActionsDisabled = !1, this.resizeEventDebounceDelay = 500, this.getEditRenderer = (e, t) => new ht(), this.getSelectionModel = () => ft, this.getFocusModel = () => ut;
3251
4257
  }
3252
4258
  }
3253
- const L = class L {
4259
+ const O = class O {
3254
4260
  /**
3255
4261
  * Returns the content to be copied based on the provided table model, selection model, and focus model.
3256
4262
  *
@@ -3273,9 +4279,9 @@ const L = class L {
3273
4279
  const d = t.isSelected(l, h) ? e.getBodyModel().getTextValueAt(l, h) : "";
3274
4280
  c.push(d);
3275
4281
  }
3276
- a.push(c.join(L.columnSeparatorChar));
4282
+ a.push(c.join(O.columnSeparatorChar));
3277
4283
  }
3278
- return o(a.join(L.rowSeparatorChar));
4284
+ return o(a.join(O.rowSeparatorChar));
3279
4285
  }
3280
4286
  }
3281
4287
  if (s) {
@@ -3332,9 +4338,9 @@ const L = class L {
3332
4338
  return t;
3333
4339
  }
3334
4340
  };
3335
- L.columnSeparatorChar = " ", L.rowSeparatorChar = `
4341
+ O.columnSeparatorChar = " ", O.rowSeparatorChar = `
3336
4342
  `;
3337
- let V = L;
4343
+ let H = O;
3338
4344
  class mt {
3339
4345
  constructor(e, t = 500) {
3340
4346
  this.tableScope = e, this.debounceDelay = t, new ResizeObserver(Ne(this.handleResize.bind(this), t)).observe(this.tableScope.hostElement);
@@ -3425,8 +4431,8 @@ class bt {
3425
4431
  let s = 0;
3426
4432
  const o = [];
3427
4433
  e.forEach((d, p) => {
3428
- const u = new TextEncoder().encode(p), g = new TextEncoder().encode(d), b = new Uint8Array(30 + u.length), f = new DataView(b.buffer);
3429
- b.set([80, 75, 3, 4], 0), f.setUint16(4, 20, !0), f.setUint16(6, 0, !0), f.setUint16(8, 0, !0), f.setUint16(10, 0, !0), f.setUint16(12, 0, !0), f.setUint32(14, 0, !0), f.setUint32(18, g.length, !0), f.setUint32(22, g.length, !0), f.setUint16(26, u.length, !0), f.setUint16(28, 0, !0), b.set(u, 30), t.push(b, g), o.push({
4434
+ const m = new TextEncoder().encode(p), g = new TextEncoder().encode(d), b = new Uint8Array(30 + m.length), f = new DataView(b.buffer);
4435
+ b.set([80, 75, 3, 4], 0), f.setUint16(4, 20, !0), f.setUint16(6, 0, !0), f.setUint16(8, 0, !0), f.setUint16(10, 0, !0), f.setUint16(12, 0, !0), f.setUint32(14, 0, !0), f.setUint32(18, g.length, !0), f.setUint32(22, g.length, !0), f.setUint16(26, m.length, !0), f.setUint16(28, 0, !0), b.set(m, 30), t.push(b, g), o.push({
3430
4436
  path: p,
3431
4437
  offset: s,
3432
4438
  contentSize: g.length
@@ -3434,8 +4440,8 @@ class bt {
3434
4440
  });
3435
4441
  const i = s;
3436
4442
  o.forEach((d) => {
3437
- const p = new TextEncoder().encode(d.path), u = new Uint8Array(46 + p.length), g = new DataView(u.buffer);
3438
- u.set([80, 75, 1, 2], 0), g.setUint16(4, 20, !0), g.setUint16(6, 20, !0), g.setUint16(8, 0, !0), g.setUint16(10, 0, !0), g.setUint16(12, 0, !0), g.setUint16(14, 0, !0), g.setUint32(16, 0, !0), g.setUint32(20, d.contentSize, !0), g.setUint32(24, d.contentSize, !0), g.setUint16(28, p.length, !0), g.setUint16(30, 0, !0), g.setUint16(32, 0, !0), g.setUint16(34, 0, !0), g.setUint16(36, 0, !0), g.setUint32(38, 0, !0), g.setUint32(42, d.offset, !0), u.set(p, 46), t.push(u), s += u.length;
4443
+ const p = new TextEncoder().encode(d.path), m = new Uint8Array(46 + p.length), g = new DataView(m.buffer);
4444
+ m.set([80, 75, 1, 2], 0), g.setUint16(4, 20, !0), g.setUint16(6, 20, !0), g.setUint16(8, 0, !0), g.setUint16(10, 0, !0), g.setUint16(12, 0, !0), g.setUint16(14, 0, !0), g.setUint32(16, 0, !0), g.setUint32(20, d.contentSize, !0), g.setUint32(24, d.contentSize, !0), g.setUint16(28, p.length, !0), g.setUint16(30, 0, !0), g.setUint16(32, 0, !0), g.setUint16(34, 0, !0), g.setUint16(36, 0, !0), g.setUint32(38, 0, !0), g.setUint32(42, d.offset, !0), m.set(p, 46), t.push(m), s += m.length;
3439
4445
  });
3440
4446
  const r = new Uint8Array(22), a = new DataView(r.buffer);
3441
4447
  r.set([80, 75, 5, 6], 0), a.setUint16(4, 0, !0), a.setUint16(6, 0, !0), a.setUint16(8, o.length, !0), a.setUint16(10, o.length, !0), a.setUint32(12, s - i, !0), a.setUint32(16, i, !0), a.setUint16(20, 0, !0), t.push(r);
@@ -3451,9 +4457,9 @@ class bt {
3451
4457
  }
3452
4458
  }
3453
4459
  class oe extends st {
3454
- constructor(e, t, s, o, i, r = new V(), a = new bt()) {
4460
+ constructor(e, t, s, o, i, r = new H(), a = new bt()) {
3455
4461
  var h;
3456
- if (super(e, t, new Ge(s), o), this.eventListener = i, this.copyService = r, this.excelService = a, this.licenseManager = F.getInstance(), this.selectionService = new at(this), this.api = new Ke(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 ne()), (h = this.tableOptions) != null && h.autoRestoreOptions) {
4462
+ if (super(e, t, new Ge(s), o), this.eventListener = i, this.copyService = r, this.excelService = a, this.licenseManager = I.getInstance(), this.selectionService = new at(this), this.api = new Ke(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 ne()), (h = this.tableOptions) != null && h.autoRestoreOptions) {
3457
4463
  const d = this.tableOptions.autoRestoreOptions, p = d.getStorageKeyFn;
3458
4464
  p && (d.autoRestoreScrollPosition && (this.storeScrollPosStateService = new Ye(p)), d.autoRestoreCollapsedExpandedState && (this.storeStateCollapsedExpandService = new qe(p)), d.autoRestoreSortingState && (this.storeSortingService = new Ze(p)));
3459
4465
  }
@@ -3475,7 +4481,7 @@ class oe extends st {
3475
4481
  *
3476
4482
  * @return {TableScope} - The newly created TableScope instance.
3477
4483
  */
3478
- static create(e, t, s = new ye(), o = new ne(), i = new be(), r = new V()) {
4484
+ static create(e, t, s = new ye(), o = new ne(), i = new be(), r = new H()) {
3479
4485
  return new oe(e, t, i, s, o, r);
3480
4486
  }
3481
4487
  /**
@@ -3878,9 +4884,6 @@ class oe extends st {
3878
4884
  sort(e) {
3879
4885
  this.tableModel.sort(e);
3880
4886
  }
3881
- getDisplayedRowCount() {
3882
- return this.displayedRowCount;
3883
- }
3884
4887
  /**
3885
4888
  * Ensures that a specific row is visible in the viewport by scrolling if necessary.
3886
4889
  * This method checks if the target row is within the currently visible range and
@@ -3933,11 +4936,8 @@ class oe extends st {
3933
4936
  * @see {@link getDisplayedRowCount} - Related method for getting visible row count
3934
4937
  */
3935
4938
  ensureRowIsVisible(e) {
3936
- const t = this.firstVisibleRowIndex, s = this.firstVisibleRowIndex + this.displayedRowCount - 1;
3937
- return e < t ? (this.scrollToIndex(0, e + 2), !0) : e > s ? (this.scrollToIndex(0, e + this.displayedRowCount - 3), !0) : !1;
3938
- }
3939
- getFirstVisibleRowIndex() {
3940
- return this.firstVisibleRowIndex;
4939
+ const t = this.getFirstFullVisibleRowIndex(), s = this.getLastFullVisibleRowIndex(), o = this.getDisplayedRowCount();
4940
+ return e < t ? (this.scrollToIndex(0, e), !0) : e > s ? (this.scrollToIndex(0, e - o + 1), !0) : !1;
3941
4941
  }
3942
4942
  }
3943
4943
  const N = class N {
@@ -4222,10 +5222,10 @@ function St(n) {
4222
5222
  let e;
4223
5223
  return {
4224
5224
  c() {
4225
- e = Me("div"), Te(e, "class", "ge-table"), _(e, "width", "100%"), _(e, "height", "100%"), _(e, "background-color", "transparent"), _(e, "padding", "0"), _(e, "margin", "0");
5225
+ e = Me("div"), Te(e, "class", "ge-table"), V(e, "width", "100%"), V(e, "height", "100%"), V(e, "background-color", "transparent"), V(e, "padding", "0"), V(e, "margin", "0");
4226
5226
  },
4227
5227
  m(t, s) {
4228
- Re(t, e, s), n[4](e);
5228
+ Ee(t, e, s), n[4](e);
4229
5229
  },
4230
5230
  p: B,
4231
5231
  i: B,
@@ -4268,7 +5268,7 @@ function yt(n, e, t) {
4268
5268
  a("mouseMoved", d);
4269
5269
  }
4270
5270
  }, h = new oe(r, s, new be(), o, c);
4271
- h.firstInit(), a("tableReady", h.getApi()), i && F.getInstance().setLicenseKey(i);
5271
+ h.firstInit(), a("tableReady", h.getApi()), i && I.getInstance().setLicenseKey(i);
4272
5272
  });
4273
5273
  function l(c) {
4274
5274
  K[c ? "unshift" : "push"](() => {
@@ -4279,9 +5279,9 @@ function yt(n, e, t) {
4279
5279
  "tableModel" in c && t(1, s = c.tableModel), "tableOptions" in c && t(2, o = c.tableOptions), "licenseKey" in c && t(3, i = c.licenseKey);
4280
5280
  }, [r, s, o, i, l];
4281
5281
  }
4282
- class Ct extends He {
5282
+ class Ct extends We {
4283
5283
  constructor(e) {
4284
- super(), We(this, e, yt, St, Ae, {
5284
+ super(), $e(this, e, yt, St, Ae, {
4285
5285
  tableModel: 1,
4286
5286
  tableOptions: 2,
4287
5287
  licenseKey: 3