@guiexpert/table 1.1.78 → 1.1.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +69 -66
- package/index.js +1745 -166
- package/lib/table/data/tablemodel/areamodel/area-model-object-array-with-columndefs.d.ts +106 -2
- package/lib/table/data/tablemodel/areamodel/area-model-object-array.d.ts +489 -4
- package/lib/table/data/tablemodel/areamodel/area-model.d.ts +660 -1
- package/lib/table/data/tablemodel/areamodel/area-model.if.d.ts +782 -69
- package/lib/table/render-scope.d.ts +12 -2
- package/lib/table/table-api.d.ts +1024 -42
- package/lib/table/table-scope.d.ts +0 -2
- package/package.json +4 -2
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function Vt(d, e = 500) {
|
|
2
2
|
let t = null, s = 0;
|
|
3
3
|
return function(...o) {
|
|
4
4
|
const i = Date.now(), r = e - (i - s);
|
|
@@ -15,7 +15,7 @@ function Ge(d, e = 500) {
|
|
|
15
15
|
}, e);
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function Bt(d = 500) {
|
|
19
19
|
return function(e, t, s) {
|
|
20
20
|
let o = 0;
|
|
21
21
|
const i = s.value;
|
|
@@ -25,8 +25,8 @@ function Vt(d = 500) {
|
|
|
25
25
|
}, s;
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
const De = "any", j = "undefined",
|
|
29
|
-
class
|
|
28
|
+
const De = "any", j = "undefined", Fe = "null", Pe = "string", ce = "number", de = "boolean", Le = "Array", U = "object", X = [Fe, j, De];
|
|
29
|
+
class Oe {
|
|
30
30
|
constructor(e) {
|
|
31
31
|
this.propertyName = e, this.type = De;
|
|
32
32
|
}
|
|
@@ -38,12 +38,12 @@ class se {
|
|
|
38
38
|
}
|
|
39
39
|
class ze {
|
|
40
40
|
constructor(e) {
|
|
41
|
-
this.propertyName = e, this.type =
|
|
41
|
+
this.propertyName = e, this.type = Fe;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
class je {
|
|
45
45
|
constructor(e) {
|
|
46
|
-
this.propertyName = e, this.type =
|
|
46
|
+
this.propertyName = e, this.type = Pe;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
class Ue {
|
|
@@ -56,9 +56,9 @@ class Ye {
|
|
|
56
56
|
this.propertyName = e, this.type = de;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
class
|
|
59
|
+
class B {
|
|
60
60
|
constructor(e, t = []) {
|
|
61
|
-
this.propertyName = e, this.items = t, this.type =
|
|
61
|
+
this.propertyName = e, this.items = t, this.type = Le;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
class _e {
|
|
@@ -100,7 +100,7 @@ class Ht {
|
|
|
100
100
|
const s = [];
|
|
101
101
|
if (!this.rootPropertyType)
|
|
102
102
|
return s;
|
|
103
|
-
if (e instanceof
|
|
103
|
+
if (e instanceof B) {
|
|
104
104
|
const o = e.items.find((i) => i.type === U);
|
|
105
105
|
if (o && o instanceof D) {
|
|
106
106
|
const i = o.properties;
|
|
@@ -119,13 +119,13 @@ class Ht {
|
|
|
119
119
|
this.iteratePropertyItems(e, n.properties, l);
|
|
120
120
|
else {
|
|
121
121
|
let a = "";
|
|
122
|
-
if (n instanceof
|
|
122
|
+
if (n instanceof B) {
|
|
123
123
|
const p = n.items.find((m) => m.type === U);
|
|
124
124
|
p && p instanceof D && (a = p.className);
|
|
125
125
|
}
|
|
126
126
|
const c = this.getReadableColumnLabel(l);
|
|
127
127
|
let h = 100, u = "", g = "ge-table-text-align-left";
|
|
128
|
-
if (n.type ===
|
|
128
|
+
if (n.type === Le) {
|
|
129
129
|
if (this.allowCustomRenderer && a) {
|
|
130
130
|
const p = `${a}ArrayCellRenderer`;
|
|
131
131
|
u = ` bodyRenderer: new ${p}(),`, g = "", this.renderCumstomCellRenderer(a, p);
|
|
@@ -262,7 +262,7 @@ class ye {
|
|
|
262
262
|
}
|
|
263
263
|
class Ke {
|
|
264
264
|
constructor() {
|
|
265
|
-
this.property = "", this.value = "", this.path = "", this.propertyItem = new _e("", [new
|
|
265
|
+
this.property = "", this.value = "", this.path = "", this.propertyItem = new _e("", [new Oe("")]);
|
|
266
266
|
}
|
|
267
267
|
toString() {
|
|
268
268
|
var e;
|
|
@@ -515,7 +515,7 @@ class Wt {
|
|
|
515
515
|
const l = r.propertyItem.types.filter((a) => !X.includes(a.type));
|
|
516
516
|
if (l.length === 1) {
|
|
517
517
|
const a = l[0];
|
|
518
|
-
if (a instanceof
|
|
518
|
+
if (a instanceof B) {
|
|
519
519
|
n = !0;
|
|
520
520
|
for (const c of o.propertyItem.types)
|
|
521
521
|
a.items.push(c);
|
|
@@ -527,7 +527,7 @@ class Wt {
|
|
|
527
527
|
}
|
|
528
528
|
}
|
|
529
529
|
}
|
|
530
|
-
return t || new
|
|
530
|
+
return t || new Oe("");
|
|
531
531
|
}
|
|
532
532
|
logValueInfos(e) {
|
|
533
533
|
for (let t = 0; t < e.length; t++) {
|
|
@@ -599,7 +599,7 @@ class Wt {
|
|
|
599
599
|
]);
|
|
600
600
|
}
|
|
601
601
|
createPropertyType(e, t) {
|
|
602
|
-
return e === null ? new ze(t) : e === void 0 ? new se(t) : typeof e ===
|
|
602
|
+
return e === null ? new ze(t) : e === void 0 ? new se(t) : typeof e === Pe ? new je(t) : typeof e === ce && !isNaN(e) ? new Ue(t) : typeof e === de ? new Ye(t) : Array.isArray(e) ? new B(t) : typeof e === U ? new D(t, Xe(t)) : new se(t);
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
605
|
class Nt {
|
|
@@ -620,7 +620,7 @@ class Nt {
|
|
|
620
620
|
}
|
|
621
621
|
renderTypeScriptInterfacesRecursive(e = this.rootPropertyType, t = [], s = this.rootName) {
|
|
622
622
|
if (!e) return t;
|
|
623
|
-
if (e instanceof
|
|
623
|
+
if (e instanceof B) {
|
|
624
624
|
for (const o of e.items)
|
|
625
625
|
if (this.renderTypeScriptInterfacesRecursive(o, t, s), o instanceof D) {
|
|
626
626
|
const i = o;
|
|
@@ -638,7 +638,7 @@ class Nt {
|
|
|
638
638
|
for (const a of r.types)
|
|
639
639
|
if (a instanceof D)
|
|
640
640
|
a !== this.rootPropertyType && this.renderTypeScriptInterfacesFifo.push(a);
|
|
641
|
-
else if (a instanceof
|
|
641
|
+
else if (a instanceof B)
|
|
642
642
|
for (const c of a.items)
|
|
643
643
|
c instanceof D && this.renderTypeScriptInterfacesFifo.push(c);
|
|
644
644
|
}
|
|
@@ -655,7 +655,7 @@ class Nt {
|
|
|
655
655
|
return t.includes(this.orOperator) ? "(" + t + ")" : t;
|
|
656
656
|
}
|
|
657
657
|
renderType(e, t) {
|
|
658
|
-
if (e instanceof
|
|
658
|
+
if (e instanceof B) {
|
|
659
659
|
const s = e.items.map((o) => this.renderType(o, t)).join(this.orOperator);
|
|
660
660
|
return s.includes(this.orOperator) ? `(${s})[]` : `${s}[]`;
|
|
661
661
|
}
|
|
@@ -747,7 +747,7 @@ class $e {
|
|
|
747
747
|
this.arrowExpanded = e, this.arrowCollapsed = t, this.arrowPlaceholder = s, this.arrowExpandCollapseAll = o;
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
|
-
class
|
|
750
|
+
class Ve {
|
|
751
751
|
constructor(e = new _("↑", "", ["ge-header-sorted-asc"]), t = new _("↓", "", ["ge-header-sorted-desc"]), s = new _("↑", "color:transparent;", [])) {
|
|
752
752
|
this.iconAsc = e, this.iconDesc = t, this.iconPlaceholder = s;
|
|
753
753
|
}
|
|
@@ -872,7 +872,7 @@ class Qe {
|
|
|
872
872
|
}
|
|
873
873
|
return this.domService.appendChild(e, n), n;
|
|
874
874
|
}
|
|
875
|
-
addSortedIcon(e, t = "", s = new
|
|
875
|
+
addSortedIcon(e, t = "", s = new Ve(), o = -1) {
|
|
876
876
|
const i = this.domService.createElement("div");
|
|
877
877
|
this.domService.addClass(i, "ge-table-sorted-icon-div"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "top", "0"), this.domService.setStyle(i, "right", "0"), this.domService.setStyle(i, "width", "20px"), this.domService.setStyle(i, "background", "transparent"), this.domService.setStyle(i, "cursor", "pointer"), this.domService.setAttribute(i, "data-col-index", `${o}`), this.domService.setAttribute(i, "data-area", "header");
|
|
878
878
|
let r;
|
|
@@ -1179,7 +1179,7 @@ class ue {
|
|
|
1179
1179
|
this.yPositions[t + 1] = this.getRowHeight(t) + this.yPositions[t];
|
|
1180
1180
|
}
|
|
1181
1181
|
}
|
|
1182
|
-
class
|
|
1182
|
+
class Be {
|
|
1183
1183
|
genericSortComparator(e, t, s) {
|
|
1184
1184
|
if (typeof e == "number" && typeof t == "number")
|
|
1185
1185
|
return s * (e - t);
|
|
@@ -1197,29 +1197,129 @@ class Ve {
|
|
|
1197
1197
|
return s * ("" + e).localeCompare("" + t);
|
|
1198
1198
|
}
|
|
1199
1199
|
}
|
|
1200
|
-
class
|
|
1200
|
+
class L extends ue {
|
|
1201
|
+
/**
|
|
1202
|
+
* Creates an instance of AreaModelObjectArray.
|
|
1203
|
+
*
|
|
1204
|
+
* @param {AreaIdent} areaIdent - Identifies which area of the table this model represents ('header', 'body', or 'footer')
|
|
1205
|
+
* @param {T[]} rows - The array of objects that represent the rows in this area
|
|
1206
|
+
* @param {number} defaultRowHeight - The default height for rows in this area (in pixels)
|
|
1207
|
+
* @param {ColumnDefIf[]} [columnDefs=[]] - Definitions for the columns in this area
|
|
1208
|
+
* @param {string} [selectedRowClass='ge-selected-row'] - CSS class to apply to selected rows
|
|
1209
|
+
* @param {string} [focusedRowClass='ge-focused-row'] - CSS class to apply to the focused row
|
|
1210
|
+
*
|
|
1211
|
+
* @example
|
|
1212
|
+
* const rows = [
|
|
1213
|
+
* { id: 1, name: 'John', age: 30 },
|
|
1214
|
+
* { id: 2, name: 'Jane', age: 25 }
|
|
1215
|
+
* ];
|
|
1216
|
+
*
|
|
1217
|
+
* const columnDefs = [
|
|
1218
|
+
* { property: 'id', headerLabel: 'ID', width: 50 },
|
|
1219
|
+
* { property: 'name', headerLabel: 'Name', width: 150 },
|
|
1220
|
+
* { property: 'age', headerLabel: 'Age', width: 100 }
|
|
1221
|
+
* ];
|
|
1222
|
+
*
|
|
1223
|
+
* const bodyAreaModel = new AreaModelObjectArray(
|
|
1224
|
+
* 'body',
|
|
1225
|
+
* rows,
|
|
1226
|
+
* 30,
|
|
1227
|
+
* columnDefs
|
|
1228
|
+
* );
|
|
1229
|
+
*/
|
|
1201
1230
|
constructor(e, t, s, o = [], i = "ge-selected-row", r = "ge-focused-row") {
|
|
1202
|
-
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
|
|
1231
|
+
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 Be(), this._focusedRowIndex = 0, this.filteredRows = [...t], this.properties = o.map((n) => n.property);
|
|
1203
1232
|
}
|
|
1233
|
+
/**
|
|
1234
|
+
* Gets the index of the currently focused row.
|
|
1235
|
+
*
|
|
1236
|
+
* @returns {number} The index of the focused row
|
|
1237
|
+
*
|
|
1238
|
+
* @example
|
|
1239
|
+
* const focusedRowIndex = bodyAreaModel.getFocusedRowIndex();
|
|
1240
|
+
* console.log(`The focused row is at index ${focusedRowIndex}`);
|
|
1241
|
+
*/
|
|
1204
1242
|
getFocusedRowIndex() {
|
|
1205
1243
|
return this._focusedRowIndex;
|
|
1206
1244
|
}
|
|
1245
|
+
/**
|
|
1246
|
+
* Sets the index of the focused row.
|
|
1247
|
+
* This will apply the focused row styling to the specified row.
|
|
1248
|
+
*
|
|
1249
|
+
* @param {number} value - The index of the row to focus
|
|
1250
|
+
*
|
|
1251
|
+
* @example
|
|
1252
|
+
* // Focus the second row (index 1)
|
|
1253
|
+
* bodyAreaModel.setFocusedRowIndex(1);
|
|
1254
|
+
*/
|
|
1207
1255
|
setFocusedRowIndex(e) {
|
|
1208
1256
|
this._focusedRowIndex = e;
|
|
1209
1257
|
}
|
|
1258
|
+
/**
|
|
1259
|
+
* Replaces the current rows array with a new one.
|
|
1260
|
+
* This also resets the filtered rows to match the new rows array.
|
|
1261
|
+
*
|
|
1262
|
+
* @param {T[]} rows - The new array of row objects
|
|
1263
|
+
*
|
|
1264
|
+
* @example
|
|
1265
|
+
* // Replace the current rows with new data
|
|
1266
|
+
* const newRows = [
|
|
1267
|
+
* { id: 4, name: 'Alice', age: 35 },
|
|
1268
|
+
* { id: 5, name: 'Charlie', age: 45 }
|
|
1269
|
+
* ];
|
|
1270
|
+
* bodyAreaModel.setRows(newRows);
|
|
1271
|
+
*/
|
|
1210
1272
|
setRows(e) {
|
|
1211
1273
|
this.rows = e, this.filteredRows = [...e];
|
|
1212
1274
|
}
|
|
1275
|
+
/**
|
|
1276
|
+
* Filters both the original rows and filtered rows arrays using the provided predicate function.
|
|
1277
|
+
* Unlike `externalFilterChanged`, this method permanently modifies the original rows array.
|
|
1278
|
+
*
|
|
1279
|
+
* @param {(row: T) => boolean} predict - A function that returns true for rows to keep and false for rows to filter out
|
|
1280
|
+
*
|
|
1281
|
+
* @example
|
|
1282
|
+
* // Remove all rows where age is less than 30
|
|
1283
|
+
* bodyAreaModel.filterRowsByPredict(row => row.age >= 30);
|
|
1284
|
+
*/
|
|
1213
1285
|
filterRowsByPredict(e) {
|
|
1214
1286
|
this.rows = this.rows.filter(e), this.filteredRows = this.filteredRows.filter(e);
|
|
1215
1287
|
}
|
|
1216
1288
|
/**
|
|
1217
|
-
*
|
|
1289
|
+
* Returns the number of rows in the filtered rows array.
|
|
1290
|
+
* This is used to determine how many rows should be rendered in the table.
|
|
1291
|
+
*
|
|
1292
|
+
* @returns {number} The number of rows in the filtered rows array
|
|
1293
|
+
*
|
|
1294
|
+
* @example
|
|
1295
|
+
* const rowCount = bodyAreaModel.getRowCount();
|
|
1296
|
+
* console.log(`The table has ${rowCount} rows`);
|
|
1218
1297
|
*/
|
|
1219
1298
|
getRowCount() {
|
|
1220
1299
|
var e;
|
|
1221
1300
|
return ((e = this.filteredRows) == null ? void 0 : e.length) ?? 0;
|
|
1222
1301
|
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Gets the value at the specified row and column indices.
|
|
1304
|
+
* This method handles tree rows and nested properties.
|
|
1305
|
+
*
|
|
1306
|
+
* @param {number} rowIndex - The index of the row
|
|
1307
|
+
* @param {number} columnIndex - The index of the column
|
|
1308
|
+
* @returns {any} The value at the specified cell, or an empty string if not found
|
|
1309
|
+
*
|
|
1310
|
+
* @example
|
|
1311
|
+
* // Get the value in the first row, second column
|
|
1312
|
+
* const value = bodyAreaModel.getValueAt(0, 1);
|
|
1313
|
+
* console.log(`The value is: ${value}`);
|
|
1314
|
+
*
|
|
1315
|
+
* @example
|
|
1316
|
+
* // Iterate through all cells in a row
|
|
1317
|
+
* const rowIndex = 0;
|
|
1318
|
+
* for (let colIndex = 0; colIndex < columnDefs.length; colIndex++) {
|
|
1319
|
+
* const value = bodyAreaModel.getValueAt(rowIndex, colIndex);
|
|
1320
|
+
* console.log(`Cell (${rowIndex}, ${colIndex}): ${value}`);
|
|
1321
|
+
* }
|
|
1322
|
+
*/
|
|
1223
1323
|
getValueAt(e, t) {
|
|
1224
1324
|
const s = this.properties[t];
|
|
1225
1325
|
let o = this.filteredRows[e];
|
|
@@ -1228,46 +1328,176 @@ class O extends ue {
|
|
|
1228
1328
|
/**
|
|
1229
1329
|
* Retrieves the filtered and sorted rows from the dataset.
|
|
1230
1330
|
* These rows are used for rendering the table.
|
|
1331
|
+
* Unlike `getAllRows()`, this method returns only the rows that match any applied filters.
|
|
1231
1332
|
*
|
|
1232
|
-
* @
|
|
1333
|
+
* @returns {T[]} An array containing the filtered (and sorted) rows
|
|
1334
|
+
*
|
|
1335
|
+
* @example
|
|
1336
|
+
* // Get all filtered rows
|
|
1337
|
+
* const filteredRows = bodyAreaModel.getFilteredRows();
|
|
1338
|
+
*
|
|
1339
|
+
* // Count rows that match a certain condition
|
|
1340
|
+
* const adultsCount = filteredRows.filter(row => row.age >= 18).length;
|
|
1233
1341
|
*/
|
|
1234
1342
|
getFilteredRows() {
|
|
1235
1343
|
return this.filteredRows;
|
|
1236
1344
|
}
|
|
1345
|
+
/**
|
|
1346
|
+
* Returns the original, unfiltered array of rows.
|
|
1347
|
+
* This can be useful when you need to access all data regardless of any applied filters.
|
|
1348
|
+
*
|
|
1349
|
+
* @returns {T[]} The original array of row objects
|
|
1350
|
+
*
|
|
1351
|
+
* @example
|
|
1352
|
+
* // Get all rows, including those filtered out
|
|
1353
|
+
* const allRows = bodyAreaModel.getAllRows();
|
|
1354
|
+
*
|
|
1355
|
+
* // Calculate average age across all rows
|
|
1356
|
+
* const totalAge = allRows.reduce((sum, row) => sum + row.age, 0);
|
|
1357
|
+
* const averageAge = totalAge / allRows.length;
|
|
1358
|
+
*/
|
|
1237
1359
|
getAllRows() {
|
|
1238
1360
|
return this.rows;
|
|
1239
1361
|
}
|
|
1240
1362
|
/**
|
|
1241
1363
|
* Returns the first row from the filtered rows that matches the given criteria based on the provided predicate function.
|
|
1364
|
+
* This method only searches within the filtered rows, not the original rows array.
|
|
1242
1365
|
*
|
|
1243
1366
|
* @param {Partial<T>} criteria - A partial object containing the search criteria
|
|
1244
1367
|
* @param {(criteria: Partial<T>, row: T) => boolean} predicate - A function that takes the search criteria and a row,
|
|
1245
1368
|
* and returns true if the row matches the criteria
|
|
1246
1369
|
* @returns {T | undefined} The first matching row, or undefined if no match is found
|
|
1370
|
+
*
|
|
1371
|
+
* @example
|
|
1372
|
+
* // Find a user by name in the filtered rows
|
|
1373
|
+
* const criteria = { name: 'John' };
|
|
1374
|
+
* const user = bodyAreaModel.findRowFromFilteredRowsByAllCriteria(
|
|
1375
|
+
* criteria,
|
|
1376
|
+
* (criteria, row) => row.name === criteria.name
|
|
1377
|
+
* );
|
|
1378
|
+
*
|
|
1379
|
+
* @example
|
|
1380
|
+
* // Find a user by age range in the filtered rows
|
|
1381
|
+
* const criteria = { minAge: 25, maxAge: 35 };
|
|
1382
|
+
* const user = bodyAreaModel.findRowFromFilteredRowsByAllCriteria(
|
|
1383
|
+
* criteria,
|
|
1384
|
+
* (criteria, row) => row.age >= criteria.minAge && row.age <= criteria.maxAge
|
|
1385
|
+
* );
|
|
1247
1386
|
*/
|
|
1248
1387
|
findRowFromFilteredRowsByAllCriteria(e, t) {
|
|
1249
1388
|
return this.getFilteredRows().find((s) => t(e, s));
|
|
1250
1389
|
}
|
|
1251
1390
|
/**
|
|
1252
1391
|
* Searches through all rows to find a row that matches the given criteria based on the predicate function.
|
|
1392
|
+
* This method searches within the original rows array, including rows that may have been filtered out.
|
|
1253
1393
|
*
|
|
1254
1394
|
* @param {Partial<T>} criteria - A partial object containing the search criteria
|
|
1255
1395
|
* @param {(criteria: Partial<T>, row: T) => boolean} predicate - A function that takes the search criteria and a row,
|
|
1256
1396
|
* and returns true if the row matches the criteria
|
|
1257
1397
|
* @returns {T | undefined} The first matching row from all rows, or undefined if no match is found
|
|
1398
|
+
*
|
|
1399
|
+
* @example
|
|
1400
|
+
* // Find a user by ID in all rows
|
|
1401
|
+
* const criteria = { id: 42 };
|
|
1402
|
+
* const user = bodyAreaModel.findRowFromAllRowsByAllCriteria(
|
|
1403
|
+
* criteria,
|
|
1404
|
+
* (criteria, row) => row.id === criteria.id
|
|
1405
|
+
* );
|
|
1406
|
+
*
|
|
1407
|
+
* @example
|
|
1408
|
+
* // Find a user with a specific property value in all rows
|
|
1409
|
+
* const criteria = { department: 'Engineering', role: 'Manager' };
|
|
1410
|
+
* const user = bodyAreaModel.findRowFromAllRowsByAllCriteria(
|
|
1411
|
+
* criteria,
|
|
1412
|
+
* (criteria, row) => row.department === criteria.department && row.role === criteria.role
|
|
1413
|
+
* );
|
|
1258
1414
|
*/
|
|
1259
1415
|
findRowFromAllRowsByAllCriteria(e, t) {
|
|
1260
1416
|
return this.getAllRows().find((s) => t(e, s));
|
|
1261
1417
|
}
|
|
1418
|
+
/**
|
|
1419
|
+
* Returns the height of the row at the specified index.
|
|
1420
|
+
* This implementation always returns the default row height.
|
|
1421
|
+
* Override this method in subclasses to support variable row heights.
|
|
1422
|
+
*
|
|
1423
|
+
* @param {number} _rowIndex - The index of the row (unused in this implementation)
|
|
1424
|
+
* @returns {number} The height of the row in pixels
|
|
1425
|
+
*
|
|
1426
|
+
* @example
|
|
1427
|
+
* const rowHeight = bodyAreaModel.getRowHeight(0);
|
|
1428
|
+
* console.log(`The first row has a height of ${rowHeight}px`);
|
|
1429
|
+
*/
|
|
1262
1430
|
getRowHeight(e) {
|
|
1263
1431
|
return this.defaultRowHeight;
|
|
1264
1432
|
}
|
|
1433
|
+
/**
|
|
1434
|
+
* Returns the row object at the specified index from the filtered rows array.
|
|
1435
|
+
* This method overrides the parent class implementation.
|
|
1436
|
+
*
|
|
1437
|
+
* @param {number} rowIndex - The index of the row to retrieve
|
|
1438
|
+
* @returns {any} The row object at the specified index, or undefined if the index is out of bounds
|
|
1439
|
+
*
|
|
1440
|
+
* @example
|
|
1441
|
+
* // Get the first row object
|
|
1442
|
+
* const row = bodyAreaModel.getRowByIndex(0);
|
|
1443
|
+
* console.log('First row:', row);
|
|
1444
|
+
*
|
|
1445
|
+
* @example
|
|
1446
|
+
* // Iterate through all rows
|
|
1447
|
+
* for (let i = 0; i < bodyAreaModel.getRowCount(); i++) {
|
|
1448
|
+
* const row = bodyAreaModel.getRowByIndex(i);
|
|
1449
|
+
* console.log(`Row ${i}:`, row);
|
|
1450
|
+
* }
|
|
1451
|
+
*/
|
|
1265
1452
|
getRowByIndex(e) {
|
|
1266
1453
|
return this.filteredRows[e];
|
|
1267
1454
|
}
|
|
1455
|
+
/**
|
|
1456
|
+
* Applies an external filter function to the rows array.
|
|
1457
|
+
* This method updates the filtered rows array without modifying the original rows array.
|
|
1458
|
+
*
|
|
1459
|
+
* @param {FilterFunction<any>} predictFn - A function that returns true for rows to keep and false for rows to filter out
|
|
1460
|
+
*
|
|
1461
|
+
* @example
|
|
1462
|
+
* // Filter rows where age is greater than 30
|
|
1463
|
+
* bodyAreaModel.externalFilterChanged(row => row.age > 30);
|
|
1464
|
+
*
|
|
1465
|
+
* @example
|
|
1466
|
+
* // Filter rows based on a search term
|
|
1467
|
+
* const searchTerm = 'john';
|
|
1468
|
+
* bodyAreaModel.externalFilterChanged(row =>
|
|
1469
|
+
* row.name.toLowerCase().includes(searchTerm.toLowerCase())
|
|
1470
|
+
* );
|
|
1471
|
+
*
|
|
1472
|
+
* @example
|
|
1473
|
+
* // Clear all filters
|
|
1474
|
+
* bodyAreaModel.externalFilterChanged(() => true);
|
|
1475
|
+
*/
|
|
1268
1476
|
externalFilterChanged(e) {
|
|
1269
1477
|
this.filteredRows = this.rows ? this.rows.filter(e) : [];
|
|
1270
1478
|
}
|
|
1479
|
+
/**
|
|
1480
|
+
* Sorts the filtered rows based on the provided sort items.
|
|
1481
|
+
* This method supports sorting by multiple columns with different sort directions.
|
|
1482
|
+
*
|
|
1483
|
+
* @param {SortItem[]} sortItems - An array of sort items, each containing a column index and sort state
|
|
1484
|
+
* @returns {boolean} Always returns true to indicate sorting was performed
|
|
1485
|
+
*
|
|
1486
|
+
* @example
|
|
1487
|
+
* // Sort by age in ascending order
|
|
1488
|
+
* bodyAreaModel.doSort([{ columnIndex: 2, sortState: 'asc' }]);
|
|
1489
|
+
*
|
|
1490
|
+
* @example
|
|
1491
|
+
* // Sort by name in descending order, then by age in ascending order
|
|
1492
|
+
* bodyAreaModel.doSort([
|
|
1493
|
+
* { columnIndex: 1, sortState: 'desc' },
|
|
1494
|
+
* { columnIndex: 2, sortState: 'asc' }
|
|
1495
|
+
* ]);
|
|
1496
|
+
*
|
|
1497
|
+
* @example
|
|
1498
|
+
* // Clear sorting
|
|
1499
|
+
* bodyAreaModel.doSort([{ columnIndex: 0, sortState: 'none' }]);
|
|
1500
|
+
*/
|
|
1271
1501
|
doSort(e) {
|
|
1272
1502
|
for (const t of e) {
|
|
1273
1503
|
const { columnIndex: s, sortState: o } = t, i = o === "asc" ? 1 : o === "desc" ? -1 : 0, r = this.properties[s];
|
|
@@ -1275,20 +1505,110 @@ class O extends ue {
|
|
|
1275
1505
|
}
|
|
1276
1506
|
return !0;
|
|
1277
1507
|
}
|
|
1508
|
+
/**
|
|
1509
|
+
* Sorts the filtered rows using a custom comparator function.
|
|
1510
|
+
* This method provides more flexibility than `doSort()` for complex sorting logic.
|
|
1511
|
+
*
|
|
1512
|
+
* @param {(a: T, b: T) => number} compareFn - A function that compares two rows and returns a number:
|
|
1513
|
+
* - Negative if a should come before b
|
|
1514
|
+
* - Positive if a should come after b
|
|
1515
|
+
* - Zero if they are equivalent for sorting purposes
|
|
1516
|
+
*
|
|
1517
|
+
* @example
|
|
1518
|
+
* // Sort by name length
|
|
1519
|
+
* bodyAreaModel.sort((a, b) => a.name.length - b.name.length);
|
|
1520
|
+
*
|
|
1521
|
+
* @example
|
|
1522
|
+
* // Sort by a computed value
|
|
1523
|
+
* bodyAreaModel.sort((a, b) => {
|
|
1524
|
+
* const scoreA = a.wins * 3 + a.draws;
|
|
1525
|
+
* const scoreB = b.wins * 3 + b.draws;
|
|
1526
|
+
* return scoreB - scoreA; // Descending order
|
|
1527
|
+
* });
|
|
1528
|
+
*/
|
|
1278
1529
|
sort(e) {
|
|
1279
1530
|
this.filteredRows = this.filteredRows.sort(e);
|
|
1280
1531
|
}
|
|
1532
|
+
/**
|
|
1533
|
+
* Gets a value from an object using a property path.
|
|
1534
|
+
* This method supports accessing nested properties using dot notation (e.g., 'person.name').
|
|
1535
|
+
*
|
|
1536
|
+
* @param {T} t - The object to get the value from
|
|
1537
|
+
* @param {string} property - The property path to access (e.g., 'name' or 'person.contact.email')
|
|
1538
|
+
* @returns {any} The value at the specified property path, or undefined if not found
|
|
1539
|
+
*
|
|
1540
|
+
* @example
|
|
1541
|
+
* const user = { id: 1, name: 'John', contact: { email: 'john@example.com' } };
|
|
1542
|
+
*
|
|
1543
|
+
* // Access simple property
|
|
1544
|
+
* const name = bodyAreaModel.getValueByT(user, 'name');
|
|
1545
|
+
* console.log(name); // 'John'
|
|
1546
|
+
*
|
|
1547
|
+
* // Access nested property
|
|
1548
|
+
* const email = bodyAreaModel.getValueByT(user, 'contact.email');
|
|
1549
|
+
* console.log(email); // 'john@example.com'
|
|
1550
|
+
*/
|
|
1281
1551
|
getValueByT(e, t) {
|
|
1282
1552
|
if (e && t)
|
|
1283
1553
|
return t.includes(".") ? this.getPropertyValue(e, t.split(".")) : e[t];
|
|
1284
1554
|
}
|
|
1555
|
+
/**
|
|
1556
|
+
* Changes the order of columns by moving a column from one position to another.
|
|
1557
|
+
* This method updates both the properties array and calls the parent class implementation.
|
|
1558
|
+
*
|
|
1559
|
+
* @param {number} sourceColumnIndex - The index of the column to move
|
|
1560
|
+
* @param {number} targetColumnIndex - The index where the column should be moved to
|
|
1561
|
+
*
|
|
1562
|
+
* @example
|
|
1563
|
+
* // Move the second column (index 1) to the fourth position (index 3)
|
|
1564
|
+
* bodyAreaModel.changeColumnOrder(1, 3);
|
|
1565
|
+
*
|
|
1566
|
+
* @example
|
|
1567
|
+
* // Move the last column to the first position
|
|
1568
|
+
* const lastIndex = bodyAreaModel.columnDefs.length - 1;
|
|
1569
|
+
* bodyAreaModel.changeColumnOrder(lastIndex, 0);
|
|
1570
|
+
*/
|
|
1285
1571
|
changeColumnOrder(e, t) {
|
|
1286
1572
|
this.arrayMove(this.properties, e, t), super.changeColumnOrder(e, t);
|
|
1287
1573
|
}
|
|
1574
|
+
/**
|
|
1575
|
+
* Gets the custom CSS classes that should be applied to a cell.
|
|
1576
|
+
* This method extends the parent class implementation to add selection and focus classes.
|
|
1577
|
+
*
|
|
1578
|
+
* @param {number} rowIndex - The index of the row
|
|
1579
|
+
* @param {number} _columnIndex - The index of the column (unused in this implementation)
|
|
1580
|
+
* @returns {string[]} An array of CSS class names to apply to the cell
|
|
1581
|
+
*
|
|
1582
|
+
* @example
|
|
1583
|
+
* // Get the CSS classes for a cell
|
|
1584
|
+
* const classes = bodyAreaModel.getCustomClassesAt(1, 2);
|
|
1585
|
+
* console.log('CSS classes:', classes);
|
|
1586
|
+
*
|
|
1587
|
+
* @example
|
|
1588
|
+
* // Apply the classes to a cell element
|
|
1589
|
+
* const cellElement = document.createElement('div');
|
|
1590
|
+
* const classes = bodyAreaModel.getCustomClassesAt(rowIndex, columnIndex);
|
|
1591
|
+
* cellElement.classList.add(...classes);
|
|
1592
|
+
*/
|
|
1288
1593
|
getCustomClassesAt(e, t) {
|
|
1289
1594
|
const s = super.getCustomClassesAt(e, t);
|
|
1290
1595
|
return this.getRowByIndex(e).selected && s.push(this.selectedRowClass), this._focusedRowIndex === e && s.push(this.focusedRowClass), s;
|
|
1291
1596
|
}
|
|
1597
|
+
/**
|
|
1598
|
+
* Creates a comparator function for sorting rows based on a property and sort direction.
|
|
1599
|
+
* This method supports custom sort comparators defined in column definitions.
|
|
1600
|
+
*
|
|
1601
|
+
* @param {string} property - The property to sort by
|
|
1602
|
+
* @param {number} f - The sort direction factor: 1 for ascending, -1 for descending, 0 for no sorting
|
|
1603
|
+
* @returns {(a: T, b: T) => number} A comparator function that compares two rows
|
|
1604
|
+
*
|
|
1605
|
+
* @example
|
|
1606
|
+
* // Create a comparator for sorting by name in ascending order
|
|
1607
|
+
* const comparator = bodyAreaModel.genericFlatTableSortComparator('name', 1);
|
|
1608
|
+
*
|
|
1609
|
+
* // Sort the rows using the comparator
|
|
1610
|
+
* const sortedRows = [...bodyAreaModel.getFilteredRows()].sort(comparator);
|
|
1611
|
+
*/
|
|
1292
1612
|
genericFlatTableSortComparator(e, t) {
|
|
1293
1613
|
const s = this.columnDefs.find((o) => o.property === e);
|
|
1294
1614
|
return (o, i) => {
|
|
@@ -1296,6 +1616,16 @@ class O extends ue {
|
|
|
1296
1616
|
return s != null && s.sortComparator ? t * s.sortComparator(r, n, o, i, t) : this.sorterService.genericSortComparator(r, n, t);
|
|
1297
1617
|
};
|
|
1298
1618
|
}
|
|
1619
|
+
/**
|
|
1620
|
+
* Recursively gets a value from an object using an array of property names.
|
|
1621
|
+
* This is a helper method used by `getValueByT` to access nested properties.
|
|
1622
|
+
*
|
|
1623
|
+
* @param {any} o - The object to get the value from
|
|
1624
|
+
* @param {string[]} props - An array of property names representing the path to the value
|
|
1625
|
+
* @returns {any} The value at the specified property path, or undefined if not found
|
|
1626
|
+
*
|
|
1627
|
+
* @private
|
|
1628
|
+
*/
|
|
1299
1629
|
getPropertyValue(e, t) {
|
|
1300
1630
|
const s = t.shift(), o = e[s];
|
|
1301
1631
|
return o && t.length ? this.getPropertyValue(o, t) : o;
|
|
@@ -1306,41 +1636,302 @@ class st {
|
|
|
1306
1636
|
this.tableScope = e;
|
|
1307
1637
|
}
|
|
1308
1638
|
/**
|
|
1309
|
-
* Updates the cells in the table
|
|
1639
|
+
* Updates the cells in the table with the provided cell update events.
|
|
1310
1640
|
*
|
|
1311
|
-
*
|
|
1312
|
-
*
|
|
1641
|
+
* This method allows you to update specific cells in the table without requiring a full table repaint,
|
|
1642
|
+
* which can significantly improve performance when updating large tables frequently.
|
|
1313
1643
|
*
|
|
1314
|
-
* @
|
|
1644
|
+
* @param {TableCellUpdateEventIf[]} events - An array of cell update events, each defining a single cell update operation.
|
|
1645
|
+
* Each event must specify:
|
|
1646
|
+
* - area: The table area to update ('header', 'body', or 'footer')
|
|
1647
|
+
* - rowIndex: The row index of the cell to update
|
|
1648
|
+
* - columnIndex: The column index of the cell to update
|
|
1649
|
+
* - value: The new value to set for the cell
|
|
1650
|
+
* - cssClasses: Optional object mapping CSS class names to boolean values
|
|
1651
|
+
* (true to add the class, false to remove it)
|
|
1652
|
+
*
|
|
1653
|
+
* @param {boolean} [repaintAll=false] - Whether to repaint the entire table after updating cells.
|
|
1654
|
+
* - If true: All cells will be repainted after updating (slower but ensures visual consistency)
|
|
1655
|
+
* - If false: Only the modified cells will be repainted (faster, recommended for frequent updates)
|
|
1656
|
+
*
|
|
1657
|
+
* @returns {void}
|
|
1658
|
+
*
|
|
1659
|
+
* @example
|
|
1660
|
+
* // Update a single cell with a new value and CSS classes
|
|
1661
|
+
* tableApi.updateCells([{
|
|
1662
|
+
* area: 'body',
|
|
1663
|
+
* rowIndex: 3,
|
|
1664
|
+
* columnIndex: 2,
|
|
1665
|
+
* value: 42,
|
|
1666
|
+
* cssClasses: {
|
|
1667
|
+
* 'highlight': true, // Add 'highlight' class
|
|
1668
|
+
* 'error': false // Remove 'error' class if present
|
|
1669
|
+
* }
|
|
1670
|
+
* }]);
|
|
1671
|
+
*
|
|
1672
|
+
* @example
|
|
1673
|
+
* // Update multiple cells at once
|
|
1674
|
+
* tableApi.updateCells([
|
|
1675
|
+
* {
|
|
1676
|
+
* area: 'body',
|
|
1677
|
+
* rowIndex: 1,
|
|
1678
|
+
* columnIndex: 1,
|
|
1679
|
+
* value: 'New Value 1',
|
|
1680
|
+
* cssClasses: { 'updated': true }
|
|
1681
|
+
* },
|
|
1682
|
+
* {
|
|
1683
|
+
* area: 'body',
|
|
1684
|
+
* rowIndex: 2,
|
|
1685
|
+
* columnIndex: 3,
|
|
1686
|
+
* value: 'New Value 2',
|
|
1687
|
+
* cssClasses: { 'updated': true }
|
|
1688
|
+
* }
|
|
1689
|
+
* ]);
|
|
1690
|
+
*
|
|
1691
|
+
* @example
|
|
1692
|
+
* // Update cells and repaint the entire table
|
|
1693
|
+
* tableApi.updateCells([
|
|
1694
|
+
* { area: 'body', rowIndex: 0, columnIndex: 0, value: 'Hello', cssClasses: { 'bg-green-0': true } },
|
|
1695
|
+
* { area: 'body', rowIndex: 1, columnIndex: 1, value: 'World', cssClasses: { 'bg-red-0': true } }
|
|
1696
|
+
* ], true);
|
|
1697
|
+
*
|
|
1698
|
+
* @example
|
|
1699
|
+
* // High-performance animation example (update without full repaint)
|
|
1700
|
+
* function animateCell() {
|
|
1701
|
+
* const value = Math.sin(Date.now() / 1000) * 50;
|
|
1702
|
+
* const cssClasses = {
|
|
1703
|
+
* 'positive': value > 0,
|
|
1704
|
+
* 'negative': value < 0
|
|
1705
|
+
* };
|
|
1706
|
+
*
|
|
1707
|
+
* tableApi.updateCells([{
|
|
1708
|
+
* area: 'body',
|
|
1709
|
+
* rowIndex: 0,
|
|
1710
|
+
* columnIndex: 0,
|
|
1711
|
+
* value: Math.round(value),
|
|
1712
|
+
* cssClasses
|
|
1713
|
+
* }]);
|
|
1714
|
+
*
|
|
1715
|
+
* requestAnimationFrame(animateCell);
|
|
1716
|
+
* }
|
|
1717
|
+
* animateCell();
|
|
1315
1718
|
*/
|
|
1316
1719
|
updateCells(e, t = !1) {
|
|
1317
1720
|
this.tableScope.updateCells(e, t);
|
|
1318
1721
|
}
|
|
1319
1722
|
/**
|
|
1320
|
-
* Notifies that
|
|
1723
|
+
* Notifies the table that an external filter has been changed and needs to be applied.
|
|
1321
1724
|
*
|
|
1322
|
-
*
|
|
1725
|
+
* This method is used when an external filter condition (defined by `tableOptions.externalFilterFunction`)
|
|
1726
|
+
* has changed and the table needs to refresh its display to reflect the new filtering criteria.
|
|
1727
|
+
*
|
|
1728
|
+
* When called, this method:
|
|
1729
|
+
* 1. Applies the external filter function to all rows
|
|
1730
|
+
* 2. Clears the current selection (by default)
|
|
1731
|
+
* 3. Scrolls to the top of the table
|
|
1732
|
+
* 4. Recalculates table dimensions
|
|
1733
|
+
* 5. Repaints the table to display only the filtered rows
|
|
1734
|
+
*
|
|
1735
|
+
* @example
|
|
1736
|
+
* ```typescript
|
|
1737
|
+
* // Define an external filter function in your table options
|
|
1738
|
+
* const tableOptions = {
|
|
1739
|
+
* externalFilterFunction: (row: MyRowType) => {
|
|
1740
|
+
* // Return true to include the row, false to filter it out
|
|
1741
|
+
* return row.status === 'active';
|
|
1742
|
+
* }
|
|
1743
|
+
* };
|
|
1744
|
+
*
|
|
1745
|
+
* // Initialize your table with these options
|
|
1746
|
+
* const tableApi = new TableApi(tableScope);
|
|
1747
|
+
*
|
|
1748
|
+
* // Later, when filter criteria change (e.g., in a search input handler)
|
|
1749
|
+
* function onFilterTextChanged() {
|
|
1750
|
+
* // Update the filter function if needed
|
|
1751
|
+
* tableOptions.externalFilterFunction = (row: MyRowType) => {
|
|
1752
|
+
* return row.name.includes(searchText);
|
|
1753
|
+
* };
|
|
1754
|
+
*
|
|
1755
|
+
* // Apply the updated filter
|
|
1756
|
+
* tableApi.externalFilterChanged();
|
|
1757
|
+
* }
|
|
1758
|
+
* ```
|
|
1759
|
+
*
|
|
1760
|
+
* @returns {void}
|
|
1761
|
+
* @see TableScope.externalFilterChanged
|
|
1323
1762
|
*/
|
|
1324
1763
|
externalFilterChanged() {
|
|
1325
1764
|
this.tableScope.externalFilterChanged();
|
|
1326
1765
|
}
|
|
1327
1766
|
/**
|
|
1328
|
-
* Scrolls the table
|
|
1767
|
+
* Scrolls the table content to the specified pixel coordinates.
|
|
1329
1768
|
*
|
|
1330
|
-
*
|
|
1331
|
-
*
|
|
1332
|
-
*
|
|
1769
|
+
* This method allows programmatic scrolling of the table viewport to exact pixel positions.
|
|
1770
|
+
* It delegates the scrolling operation to the underlying TableScope instance.
|
|
1771
|
+
*
|
|
1772
|
+
* @param {number} px - The horizontal pixel coordinate to scroll to. Defaults to 0 (leftmost position).
|
|
1773
|
+
* @param {number} py - The vertical pixel coordinate to scroll to. Defaults to 0 (topmost position).
|
|
1774
|
+
* @returns {void}
|
|
1775
|
+
*
|
|
1776
|
+
* @example
|
|
1777
|
+
* // Scroll to the top-left corner of the table
|
|
1778
|
+
* tableApi.scrollToPixel(0, 0);
|
|
1779
|
+
*
|
|
1780
|
+
* @example
|
|
1781
|
+
* // Scroll 200 pixels horizontally and 150 pixels vertically
|
|
1782
|
+
* tableApi.scrollToPixel(200, 150);
|
|
1783
|
+
*
|
|
1784
|
+
* @example
|
|
1785
|
+
* // Scroll only vertically, keeping the current horizontal position
|
|
1786
|
+
* tableApi.scrollToPixel(undefined, 300);
|
|
1787
|
+
*
|
|
1788
|
+
* @example
|
|
1789
|
+
* // Example in a component that needs precise scrolling control
|
|
1790
|
+
* class TableScroller {
|
|
1791
|
+
* private tableApi: TableApi;
|
|
1792
|
+
*
|
|
1793
|
+
* constructor(tableApi: TableApi) {
|
|
1794
|
+
* this.tableApi = tableApi;
|
|
1795
|
+
* }
|
|
1796
|
+
*
|
|
1797
|
+
* scrollToPosition(x: number, y: number) {
|
|
1798
|
+
* // Scroll to exact pixel coordinates
|
|
1799
|
+
* this.tableApi.scrollToPixel(x, y);
|
|
1800
|
+
* }
|
|
1801
|
+
*
|
|
1802
|
+
* scrollHalfway() {
|
|
1803
|
+
* const tableModel = this.tableApi.getTableModel();
|
|
1804
|
+
* const totalWidth = tableModel.getContentWidthInPixel();
|
|
1805
|
+
* const totalHeight = tableModel.getContentHeightInPixel();
|
|
1806
|
+
*
|
|
1807
|
+
* // Scroll to the middle of the table content
|
|
1808
|
+
* this.tableApi.scrollToPixel(totalWidth / 2, totalHeight / 2);
|
|
1809
|
+
* }
|
|
1810
|
+
* }
|
|
1811
|
+
*
|
|
1812
|
+
* @example
|
|
1813
|
+
* // Advanced usage with animated scrolling
|
|
1814
|
+
* class SmoothScroller {
|
|
1815
|
+
* private tableApi: TableApi;
|
|
1816
|
+
* private animationFrameId: number | null = null;
|
|
1817
|
+
*
|
|
1818
|
+
* constructor(tableApi: TableApi) {
|
|
1819
|
+
* this.tableApi = tableApi;
|
|
1820
|
+
* }
|
|
1821
|
+
*
|
|
1822
|
+
* smoothScrollTo(targetX: number, targetY: number, duration: number = 500) {
|
|
1823
|
+
* // Cancel any ongoing animation
|
|
1824
|
+
* if (this.animationFrameId !== null) {
|
|
1825
|
+
* cancelAnimationFrame(this.animationFrameId);
|
|
1826
|
+
* }
|
|
1827
|
+
*
|
|
1828
|
+
* const startTime = performance.now();
|
|
1829
|
+
* const startX = this.tableApi.getTableScope().getScrollLeft();
|
|
1830
|
+
* const startY = this.tableApi.getTableScope().getScrollTop();
|
|
1831
|
+
* const distanceX = targetX - startX;
|
|
1832
|
+
* const distanceY = targetY - startY;
|
|
1833
|
+
*
|
|
1834
|
+
* const step = (currentTime: number) => {
|
|
1835
|
+
* const elapsed = currentTime - startTime;
|
|
1836
|
+
* const progress = Math.min(elapsed / duration, 1);
|
|
1837
|
+
*
|
|
1838
|
+
* // Use easing function for smooth animation
|
|
1839
|
+
* const easeProgress = 1 - Math.pow(1 - progress, 3); // Cubic ease-out
|
|
1840
|
+
*
|
|
1841
|
+
* const currentX = startX + distanceX * easeProgress;
|
|
1842
|
+
* const currentY = startY + distanceY * easeProgress;
|
|
1843
|
+
*
|
|
1844
|
+
* this.tableApi.scrollToPixel(currentX, currentY);
|
|
1845
|
+
*
|
|
1846
|
+
* if (progress < 1) {
|
|
1847
|
+
* this.animationFrameId = requestAnimationFrame(step);
|
|
1848
|
+
* } else {
|
|
1849
|
+
* this.animationFrameId = null;
|
|
1850
|
+
* }
|
|
1851
|
+
* };
|
|
1852
|
+
*
|
|
1853
|
+
* this.animationFrameId = requestAnimationFrame(step);
|
|
1854
|
+
* }
|
|
1855
|
+
*
|
|
1856
|
+
* cancelAnimation() {
|
|
1857
|
+
* if (this.animationFrameId !== null) {
|
|
1858
|
+
* cancelAnimationFrame(this.animationFrameId);
|
|
1859
|
+
* this.animationFrameId = null;
|
|
1860
|
+
* }
|
|
1861
|
+
* }
|
|
1862
|
+
* }
|
|
1863
|
+
*
|
|
1864
|
+
* @see {@link scrollToIndex} - For scrolling based on row and column indices
|
|
1865
|
+
* @see {@link ensureRowIsVisible} - For scrolling to make a specific row visible
|
|
1333
1866
|
*/
|
|
1334
1867
|
scrollToPixel(e = 0, t = 0) {
|
|
1335
1868
|
this.tableScope.scrollToPixel(e, t);
|
|
1336
1869
|
}
|
|
1337
1870
|
/**
|
|
1338
|
-
* Scrolls to the specified
|
|
1871
|
+
* Scrolls the table to display the specified row and column indices at the top-left corner of the viewport.
|
|
1339
1872
|
*
|
|
1340
|
-
*
|
|
1341
|
-
*
|
|
1873
|
+
* This method allows programmatic scrolling to a specific position in the table grid based on row and column indices.
|
|
1874
|
+
* It uses the underlying TableScope's scrolling mechanism to navigate to the target location.
|
|
1342
1875
|
*
|
|
1343
|
-
* @
|
|
1876
|
+
* @param {number} indexX - The horizontal index (column) to scroll to. Defaults to 0 (leftmost column).
|
|
1877
|
+
* @param {number} indexY - The vertical index (row) to scroll to. Defaults to 0 (topmost row).
|
|
1878
|
+
* @returns {void}
|
|
1879
|
+
*
|
|
1880
|
+
* @example
|
|
1881
|
+
* // Scroll to the 5th row, keeping the current horizontal scroll position
|
|
1882
|
+
* tableApi.scrollToIndex(0, 5);
|
|
1883
|
+
*
|
|
1884
|
+
* @example
|
|
1885
|
+
* // Scroll to column 3, row 10
|
|
1886
|
+
* tableApi.scrollToIndex(3, 10);
|
|
1887
|
+
*
|
|
1888
|
+
* @example
|
|
1889
|
+
* // Example in a component that needs to navigate to specific content
|
|
1890
|
+
* class TableNavigator {
|
|
1891
|
+
* private tableApi: TableApi;
|
|
1892
|
+
*
|
|
1893
|
+
* constructor(tableApi: TableApi) {
|
|
1894
|
+
* this.tableApi = tableApi;
|
|
1895
|
+
* }
|
|
1896
|
+
*
|
|
1897
|
+
* goToCell(columnIndex: number, rowIndex: number) {
|
|
1898
|
+
* // Navigate directly to the specified cell position
|
|
1899
|
+
* this.tableApi.scrollToIndex(columnIndex, rowIndex);
|
|
1900
|
+
*
|
|
1901
|
+
* // Optional: Select the cell after navigating to it
|
|
1902
|
+
* const selectionModel = this.tableApi.getSelectionModel();
|
|
1903
|
+
* if (selectionModel) {
|
|
1904
|
+
* selectionModel.selectCell(rowIndex, columnIndex);
|
|
1905
|
+
* }
|
|
1906
|
+
* }
|
|
1907
|
+
* }
|
|
1908
|
+
*
|
|
1909
|
+
* @example
|
|
1910
|
+
* // Advanced usage with search functionality
|
|
1911
|
+
* class TableSearcher {
|
|
1912
|
+
* findAndScrollToMatch(searchTerm: string) {
|
|
1913
|
+
* const tableModel = this.tableApi.getTableModel();
|
|
1914
|
+
* const bodyModel = tableModel.getAreaModel('body');
|
|
1915
|
+
*
|
|
1916
|
+
* // Search for the term in the table data
|
|
1917
|
+
* for (let row = 0; row < bodyModel.getRowCount(); row++) {
|
|
1918
|
+
* for (let col = 0; col < tableModel.getColumnCount(); col++) {
|
|
1919
|
+
* const cellContent = bodyModel.getValueAt(row, col)?.toString() || '';
|
|
1920
|
+
*
|
|
1921
|
+
* if (cellContent.includes(searchTerm)) {
|
|
1922
|
+
* // Found a match, scroll to it
|
|
1923
|
+
* this.tableApi.scrollToIndex(col, row);
|
|
1924
|
+
* return true;
|
|
1925
|
+
* }
|
|
1926
|
+
* }
|
|
1927
|
+
* }
|
|
1928
|
+
*
|
|
1929
|
+
* return false; // No match found
|
|
1930
|
+
* }
|
|
1931
|
+
* }
|
|
1932
|
+
*
|
|
1933
|
+
* @see {@link scrollToPixel} - For scrolling to specific pixel coordinates
|
|
1934
|
+
* @see {@link ensureRowIsVisible} - For scrolling to make a specific row visible
|
|
1344
1935
|
*/
|
|
1345
1936
|
scrollToIndex(e = 0, t = 0) {
|
|
1346
1937
|
this.tableScope.scrollToIndex(e, t);
|
|
@@ -1401,19 +1992,71 @@ class st {
|
|
|
1401
1992
|
/**
|
|
1402
1993
|
* Repaints the table.
|
|
1403
1994
|
*
|
|
1404
|
-
* This method
|
|
1405
|
-
*
|
|
1995
|
+
* This method refreshes the visual representation of the table by delegating to the
|
|
1996
|
+
* tableScope's repaint functionality. Use this method whenever the table's visual state
|
|
1997
|
+
* needs to be updated after data changes, selection changes, or any modifications that
|
|
1998
|
+
* affect the rendered output.
|
|
1999
|
+
*
|
|
2000
|
+
* Repainting the table ensures that all visible cells, rows, and styling reflect the
|
|
2001
|
+
* current state of the underlying data model and configuration settings.
|
|
2002
|
+
*
|
|
2003
|
+
* @example
|
|
2004
|
+
* // Update data and repaint the table
|
|
2005
|
+
* const tableApi = new TableApi(tableScope);
|
|
2006
|
+
* tableApi.setRows(newData);
|
|
2007
|
+
* tableApi.repaint();
|
|
2008
|
+
*
|
|
2009
|
+
* @example
|
|
2010
|
+
* // Update selection and repaint to show the visual change
|
|
2011
|
+
* tableApi.getSelectionModel().selectCell(2, 3);
|
|
2012
|
+
* tableApi.repaint();
|
|
2013
|
+
*
|
|
2014
|
+
* @example
|
|
2015
|
+
* // After changing column visibility, repaint to reflect changes
|
|
2016
|
+
* tableApi.setColumnVisible(0, false);
|
|
2017
|
+
* tableApi.repaint();
|
|
2018
|
+
*
|
|
2019
|
+
* @returns {void}
|
|
1406
2020
|
*/
|
|
1407
2021
|
repaint() {
|
|
1408
2022
|
this.tableScope.repaint();
|
|
1409
2023
|
}
|
|
1410
2024
|
/**
|
|
1411
|
-
*
|
|
1412
|
-
* Repaints the UI by resetting the size of the wrapper div,
|
|
1413
|
-
* adjusting the containers and rows, and performing additional adjustments
|
|
1414
|
-
* after scrolling.
|
|
2025
|
+
* Performs a complete repaint of the table by triggering a hard repaint on the underlying table scope.
|
|
1415
2026
|
*
|
|
1416
|
-
*
|
|
2027
|
+
* A hard repaint is more thorough than a regular repaint and performs the following operations:
|
|
2028
|
+
* - Recalculates the height and padding of the table model
|
|
2029
|
+
* - Resets the size of the wrapper div elements
|
|
2030
|
+
* - Adjusts containers and rows positioning
|
|
2031
|
+
* - Makes additional adjustments after scrolling
|
|
2032
|
+
*
|
|
2033
|
+
* Use this method when regular repaint isn't sufficient, such as when:
|
|
2034
|
+
* - Table dimensions have significantly changed
|
|
2035
|
+
* - The structure of data has been modified (rows/columns added or removed)
|
|
2036
|
+
* - The table layout needs complete recalculation
|
|
2037
|
+
* - After major DOM changes affecting the table's container
|
|
2038
|
+
*
|
|
2039
|
+
* @example
|
|
2040
|
+
* // Example 1: Basic usage
|
|
2041
|
+
* tableApi.repaintHard();
|
|
2042
|
+
*
|
|
2043
|
+
* @example
|
|
2044
|
+
* // Example 2: Using after major data changes
|
|
2045
|
+
* tableApi.setRows(newDataSet);
|
|
2046
|
+
* tableApi.repaintHard();
|
|
2047
|
+
*
|
|
2048
|
+
* @example
|
|
2049
|
+
* // Example 3: Using after resizing a container
|
|
2050
|
+
* window.addEventListener('resize', () => {
|
|
2051
|
+
* tableApi.repaintHard();
|
|
2052
|
+
* });
|
|
2053
|
+
*
|
|
2054
|
+
* @example
|
|
2055
|
+
* // Example 4: Using after changing column visibility
|
|
2056
|
+
* tableApi.setColumnVisible(2, false);
|
|
2057
|
+
* tableApi.repaintHard();
|
|
2058
|
+
*
|
|
2059
|
+
* @returns {void} This method doesn't return a value
|
|
1417
2060
|
*/
|
|
1418
2061
|
repaintHard() {
|
|
1419
2062
|
this.tableScope.repaintHard();
|
|
@@ -1429,8 +2072,30 @@ class st {
|
|
|
1429
2072
|
this.tableScope.recalcColumnWidths(e);
|
|
1430
2073
|
}
|
|
1431
2074
|
/**
|
|
1432
|
-
* Clears the current selection
|
|
1433
|
-
*
|
|
2075
|
+
* Clears the current selection in the table.
|
|
2076
|
+
*
|
|
2077
|
+
* This method removes any selected cells, rows, or columns in the table.
|
|
2078
|
+
* It provides a convenient way to programmatically clear all selections in the table
|
|
2079
|
+
* without having to access the underlying selection model directly.
|
|
2080
|
+
*
|
|
2081
|
+
* When called, this method delegates to the table scope's clearSelection method with
|
|
2082
|
+
* a parameter value of true, which ensures the table is automatically repainted after
|
|
2083
|
+
* the selection is cleared.
|
|
2084
|
+
*
|
|
2085
|
+
* @example
|
|
2086
|
+
* // Clear all selections in the table
|
|
2087
|
+
* tableApi.clearSelection();
|
|
2088
|
+
*
|
|
2089
|
+
* // Example usage in a component
|
|
2090
|
+
* class MyComponent {
|
|
2091
|
+
* @ViewChild('tableComponent') tableComponent: TableComponent;
|
|
2092
|
+
*
|
|
2093
|
+
* resetTableSelection(): void {
|
|
2094
|
+
* if (this.tableComponent?.api) {
|
|
2095
|
+
* this.tableComponent.api.clearSelection();
|
|
2096
|
+
* }
|
|
2097
|
+
* }
|
|
2098
|
+
* }
|
|
1434
2099
|
*
|
|
1435
2100
|
* @returns {void}
|
|
1436
2101
|
*/
|
|
@@ -1438,12 +2103,31 @@ class st {
|
|
|
1438
2103
|
this.tableScope.clearSelection(!0);
|
|
1439
2104
|
}
|
|
1440
2105
|
/**
|
|
1441
|
-
* Sets the selection model for the table
|
|
2106
|
+
* Sets the selection model for the table.
|
|
1442
2107
|
*
|
|
1443
|
-
*
|
|
1444
|
-
*
|
|
2108
|
+
* This method allows you to replace the current selection model with a new one,
|
|
2109
|
+
* which controls how cells, rows, or columns can be selected in the table.
|
|
1445
2110
|
*
|
|
1446
|
-
* @
|
|
2111
|
+
* @param {SelectionModel} sm - The new selection model to be set. This model defines
|
|
2112
|
+
* the selection behavior including selection type (none, cell, row, column),
|
|
2113
|
+
* selection mode (single, multi), and manages the selected ranges.
|
|
2114
|
+
* @param {boolean} [repaint=true] - Whether to repaint the table after changing the selection model.
|
|
2115
|
+
* Default is true, which immediately reflects the change visually.
|
|
2116
|
+
* Set to false if you want to avoid immediate repainting.
|
|
2117
|
+
*
|
|
2118
|
+
* @example
|
|
2119
|
+
* // Create a new selection model with row selection and multi-select mode
|
|
2120
|
+
* const selectionModel = new SelectionModel("row", "multi");
|
|
2121
|
+
*
|
|
2122
|
+
* // Set the new selection model and repaint the table
|
|
2123
|
+
* tableApi.setSelectionModel(selectionModel);
|
|
2124
|
+
*
|
|
2125
|
+
* // Set a selection model without repainting (if you plan to make more changes)
|
|
2126
|
+
* tableApi.setSelectionModel(selectionModel, false);
|
|
2127
|
+
* // ... make other changes ...
|
|
2128
|
+
* tableApi.repaint(); // Now repaint once
|
|
2129
|
+
*
|
|
2130
|
+
* @returns {void}
|
|
1447
2131
|
*/
|
|
1448
2132
|
setSelectionModel(e, t = !0) {
|
|
1449
2133
|
this.tableScope.setSelectionModel(e, t);
|
|
@@ -1459,9 +2143,36 @@ class st {
|
|
|
1459
2143
|
this.tableScope.onActionTriggered(e);
|
|
1460
2144
|
}
|
|
1461
2145
|
/**
|
|
1462
|
-
* Retrieves the
|
|
2146
|
+
* Retrieves the shortcut action mapping from the table's shortcut service.
|
|
2147
|
+
*
|
|
2148
|
+
* This method provides access to the keyboard shortcut configuration that defines
|
|
2149
|
+
* which keys trigger specific actions in the table. The mapping contains key-value
|
|
2150
|
+
* pairs where:
|
|
2151
|
+
* - Keys are string representations of keyboard shortcuts (e.g., "ctrl+c", "shift+arrow_down")
|
|
2152
|
+
* - Values are ActionId values representing the corresponding table actions
|
|
2153
|
+
*
|
|
2154
|
+
* This mapping can be useful for:
|
|
2155
|
+
* - Displaying available shortcuts to users
|
|
2156
|
+
* - Creating custom shortcut documentation
|
|
2157
|
+
* - Dynamically checking which actions are available via keyboard
|
|
2158
|
+
* - Extending or integrating with the table's shortcut system
|
|
2159
|
+
*
|
|
2160
|
+
* @returns {ShortcutActionIdMapping} An object mapping shortcut key combinations to their corresponding action IDs.
|
|
2161
|
+
* For example: { "ctrl+c": "COPY_2_CLIPBOARD", "arrow_down": "NAVIGATE_DOWN" }
|
|
2162
|
+
*
|
|
2163
|
+
* @example
|
|
2164
|
+
* // Get all available shortcuts in the table
|
|
2165
|
+
* const shortcuts = tableApi.getShortcutActionMapping();
|
|
2166
|
+
*
|
|
2167
|
+
* // Check if a specific shortcut exists
|
|
2168
|
+
* if (shortcuts["ctrl+c"]) {
|
|
2169
|
+
* console.log("Copy shortcut is available with action:", shortcuts["ctrl+c"]);
|
|
2170
|
+
* }
|
|
1463
2171
|
*
|
|
1464
|
-
*
|
|
2172
|
+
* // Display available shortcuts in the UI
|
|
2173
|
+
* Object.entries(shortcuts).forEach(([key, actionId]) => {
|
|
2174
|
+
* console.log(`${key}: ${actionId}`);
|
|
2175
|
+
* });
|
|
1465
2176
|
*/
|
|
1466
2177
|
getShortcutActionMapping() {
|
|
1467
2178
|
return this.tableScope.shortcutService.getShortcutActionMapping();
|
|
@@ -1469,7 +2180,35 @@ class st {
|
|
|
1469
2180
|
/**
|
|
1470
2181
|
* Copies the selected data from the table to the clipboard.
|
|
1471
2182
|
*
|
|
1472
|
-
*
|
|
2183
|
+
* This method leverages the copyService to extract and copy the currently selected data
|
|
2184
|
+
* from the table. It works with the current selection state and focus position to determine
|
|
2185
|
+
* what content should be copied.
|
|
2186
|
+
*
|
|
2187
|
+
* The copied data is formatted as tab-separated text that can be pasted into spreadsheet
|
|
2188
|
+
* applications like Excel or text editors while maintaining the tabular structure.
|
|
2189
|
+
*
|
|
2190
|
+
* @example
|
|
2191
|
+
* // Copy the currently selected data to clipboard
|
|
2192
|
+
* tableApi.copyToClipboard().then(content => {
|
|
2193
|
+
* console.log('Copied to clipboard:', content);
|
|
2194
|
+
* });
|
|
2195
|
+
*
|
|
2196
|
+
* // Using with a button click handler
|
|
2197
|
+
* function onCopyButtonClick() {
|
|
2198
|
+
* if (tableApi) {
|
|
2199
|
+
* tableApi.copyToClipboard()
|
|
2200
|
+
* .then(content => {
|
|
2201
|
+
* console.log('Successfully copied data to clipboard');
|
|
2202
|
+
* // Optionally do something with the copied content
|
|
2203
|
+
* })
|
|
2204
|
+
* .catch(error => {
|
|
2205
|
+
* console.error('Failed to copy to clipboard:', error);
|
|
2206
|
+
* });
|
|
2207
|
+
* }
|
|
2208
|
+
* }
|
|
2209
|
+
*
|
|
2210
|
+
* @returns {Promise<string>} A promise that resolves with the copied data as a string.
|
|
2211
|
+
* The string contains the tab-separated representation of the selected table data.
|
|
1473
2212
|
*/
|
|
1474
2213
|
copyToClipboard() {
|
|
1475
2214
|
return this.tableScope.copyService.copyToClipboard(
|
|
@@ -1479,11 +2218,33 @@ class st {
|
|
|
1479
2218
|
);
|
|
1480
2219
|
}
|
|
1481
2220
|
/**
|
|
1482
|
-
*
|
|
2221
|
+
* Downloads the current table data as an Excel file.
|
|
2222
|
+
*
|
|
2223
|
+
* This method extracts all visible data from the table (including header, body, and footer areas),
|
|
2224
|
+
* converts it into a matrix format, and triggers a download of an Excel file containing this data.
|
|
2225
|
+
*
|
|
2226
|
+
* The method works by:
|
|
2227
|
+
* 1. Creating an empty matrix to hold all table data
|
|
2228
|
+
* 2. Iterating through each area of the table (header, body, footer)
|
|
2229
|
+
* 3. For each area, iterating through all rows and columns to extract cell values
|
|
2230
|
+
* 4. Passing the complete data matrix to the Excel service for file generation and download
|
|
2231
|
+
*
|
|
2232
|
+
* @param {string} fileName - The name of the Excel file to be downloaded (default: 'table.xlsx')
|
|
2233
|
+
* @param {string} author - Optional metadata for the Excel file to specify the author (default: '')
|
|
1483
2234
|
*
|
|
1484
|
-
* @
|
|
1485
|
-
*
|
|
1486
|
-
* @
|
|
2235
|
+
* @returns {void} The result of the excelService.downloadExcel method call
|
|
2236
|
+
*
|
|
2237
|
+
* @example
|
|
2238
|
+
* // Download table data with default filename
|
|
2239
|
+
* tableApi.downloadExcel();
|
|
2240
|
+
*
|
|
2241
|
+
* @example
|
|
2242
|
+
* // Download table data with custom filename and author
|
|
2243
|
+
* tableApi.downloadExcel('sales-report.xlsx', 'John Doe');
|
|
2244
|
+
*
|
|
2245
|
+
* @example
|
|
2246
|
+
* // Download table data with custom filename only
|
|
2247
|
+
* tableApi.downloadExcel('quarterly-data.xlsx');
|
|
1487
2248
|
*/
|
|
1488
2249
|
downloadExcel(e = "table.xlsx", t = "") {
|
|
1489
2250
|
const s = [], o = this.tableScope.tableModel.getColumnCount(), i = ["header", "body", "footer"];
|
|
@@ -1499,18 +2260,66 @@ class st {
|
|
|
1499
2260
|
return this.tableScope.excelService.downloadExcel(s, e, t);
|
|
1500
2261
|
}
|
|
1501
2262
|
/**
|
|
1502
|
-
*
|
|
2263
|
+
* Returns the TableScope instance associated with this TableApi.
|
|
2264
|
+
*
|
|
2265
|
+
* The TableScope provides access to the core functionality and internal state of the table component,
|
|
2266
|
+
* including rendering, event handling, selection, and other low-level operations.
|
|
1503
2267
|
*
|
|
1504
|
-
*
|
|
2268
|
+
* This method is useful for advanced customization scenarios where you need direct access
|
|
2269
|
+
* to the table's internal structure and behaviors.
|
|
2270
|
+
*
|
|
2271
|
+
* @returns {TableScope} The TableScope instance that controls this table component
|
|
2272
|
+
*
|
|
2273
|
+
* @example
|
|
2274
|
+
* // Access the TableScope to perform a custom operation
|
|
2275
|
+
* const tableApi = new TableApi(myTableScope);
|
|
2276
|
+
* const tableScope = tableApi.getTableScope();
|
|
2277
|
+
*
|
|
2278
|
+
* // Example: Manually trigger a context menu at a specific location
|
|
2279
|
+
* const mouseEvent = new MouseEvent('contextmenu');
|
|
2280
|
+
* const geMouseEvent = tableScope.createGeMouseEvent(mouseEvent);
|
|
2281
|
+
* tableScope.contextmenu(geMouseEvent);
|
|
1505
2282
|
*/
|
|
1506
2283
|
getTableScope() {
|
|
1507
2284
|
return this.tableScope;
|
|
1508
2285
|
}
|
|
1509
2286
|
/**
|
|
1510
|
-
*
|
|
2287
|
+
* Returns the current selection model for the table.
|
|
2288
|
+
*
|
|
2289
|
+
* The selection model manages cell selection state, including single cells, ranges, rows, and columns.
|
|
2290
|
+
* This method provides access to the selection model instance, allowing operations like:
|
|
2291
|
+
* - Checking if cells are selected
|
|
2292
|
+
* - Getting selection ranges
|
|
2293
|
+
* - Modifying selections
|
|
2294
|
+
* - Adding/removing selection event listeners
|
|
2295
|
+
*
|
|
2296
|
+
* @returns {SelectionModelIf | undefined} The current selection model if available, otherwise undefined.
|
|
1511
2297
|
*
|
|
1512
|
-
* @
|
|
1513
|
-
*
|
|
2298
|
+
* @example
|
|
2299
|
+
* // Get the selection model
|
|
2300
|
+
* const selectionModel = tableApi.getSelectionModel();
|
|
2301
|
+
*
|
|
2302
|
+
* // Check if a specific cell is selected
|
|
2303
|
+
* if (selectionModel?.isSelected(3, 2)) {
|
|
2304
|
+
* console.log('Cell at row 3, column 2 is selected');
|
|
2305
|
+
* }
|
|
2306
|
+
*
|
|
2307
|
+
* // Get all selected ranges
|
|
2308
|
+
* const ranges = selectionModel?.getRanges();
|
|
2309
|
+
* console.log('Selected ranges:', ranges);
|
|
2310
|
+
*
|
|
2311
|
+
* // Clear all selections
|
|
2312
|
+
* selectionModel?.clear();
|
|
2313
|
+
*
|
|
2314
|
+
* // Toggle selection of a cell
|
|
2315
|
+
* selectionModel?.togglePoint(5, 1);
|
|
2316
|
+
*
|
|
2317
|
+
* // Add a selection change listener
|
|
2318
|
+
* selectionModel?.addEventSelectionChangedListener({
|
|
2319
|
+
* selectionChanged: () => {
|
|
2320
|
+
* console.log('Selection has changed');
|
|
2321
|
+
* }
|
|
2322
|
+
* });
|
|
1514
2323
|
*/
|
|
1515
2324
|
getSelectionModel() {
|
|
1516
2325
|
return this.tableScope.selectionModel();
|
|
@@ -1583,7 +2392,7 @@ class st {
|
|
|
1583
2392
|
*/
|
|
1584
2393
|
setRows(e) {
|
|
1585
2394
|
const t = this.getBodyModel();
|
|
1586
|
-
t instanceof
|
|
2395
|
+
t instanceof L ? t.setRows(e) : console.warn("setRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ", typeof t, t);
|
|
1587
2396
|
}
|
|
1588
2397
|
/**
|
|
1589
2398
|
* Adds new rows to the end of the table body.
|
|
@@ -1601,7 +2410,7 @@ class st {
|
|
|
1601
2410
|
*/
|
|
1602
2411
|
addRows(e) {
|
|
1603
2412
|
const t = this.getBodyModel();
|
|
1604
|
-
if (t instanceof
|
|
2413
|
+
if (t instanceof L) {
|
|
1605
2414
|
const s = t;
|
|
1606
2415
|
let o = s.getAllRows();
|
|
1607
2416
|
s.setRows([...o, ...e]);
|
|
@@ -1626,7 +2435,7 @@ class st {
|
|
|
1626
2435
|
*/
|
|
1627
2436
|
addRowsAt(e, t) {
|
|
1628
2437
|
const s = this.getBodyModel();
|
|
1629
|
-
if (s instanceof
|
|
2438
|
+
if (s instanceof L) {
|
|
1630
2439
|
const o = s;
|
|
1631
2440
|
let i = o.getAllRows();
|
|
1632
2441
|
o.setRows([...i.slice(0, t), ...e, ...i.slice(t)]);
|
|
@@ -1652,7 +2461,7 @@ class st {
|
|
|
1652
2461
|
*/
|
|
1653
2462
|
removeRows(e, t = (s, o) => s === o) {
|
|
1654
2463
|
const s = this.getBodyModel();
|
|
1655
|
-
if (s instanceof
|
|
2464
|
+
if (s instanceof L) {
|
|
1656
2465
|
const o = s, i = o.getAllRows().filter((r) => !e.some((n) => t(r, n)));
|
|
1657
2466
|
o.setRows(i);
|
|
1658
2467
|
} else
|
|
@@ -1693,7 +2502,7 @@ class st {
|
|
|
1693
2502
|
*/
|
|
1694
2503
|
findRows(e, t = (s, o) => s === o) {
|
|
1695
2504
|
const s = this.getBodyModel();
|
|
1696
|
-
return s instanceof
|
|
2505
|
+
return s instanceof L ? 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), []);
|
|
1697
2506
|
}
|
|
1698
2507
|
/**
|
|
1699
2508
|
* Searches through the filtered rows of the table to find a row that matches specific criteria.
|
|
@@ -1750,7 +2559,7 @@ class st {
|
|
|
1750
2559
|
*/
|
|
1751
2560
|
findRowFromFilteredRowsByAllCriteria(e, t) {
|
|
1752
2561
|
const s = this.getBodyModel();
|
|
1753
|
-
if (s instanceof
|
|
2562
|
+
if (s instanceof L)
|
|
1754
2563
|
return s.getFilteredRows().find((i) => t(e, i));
|
|
1755
2564
|
console.warn("findRowFromFilteredRowsByAllCriteria(...) only works with AreaModelObjectArray<T>, but this body area model is ", typeof s, s);
|
|
1756
2565
|
}
|
|
@@ -1797,7 +2606,7 @@ class st {
|
|
|
1797
2606
|
*/
|
|
1798
2607
|
findRowFromAllRowsByAllCriteria(e, t) {
|
|
1799
2608
|
const s = this.getBodyModel();
|
|
1800
|
-
if (s instanceof
|
|
2609
|
+
if (s instanceof L)
|
|
1801
2610
|
return s.getAllRows().find((i) => t(e, i));
|
|
1802
2611
|
console.warn("findRowFromAllRowsByAllCriteria(...) only works with AreaModelObjectArray<T>, but this body area model is ", typeof s, s);
|
|
1803
2612
|
}
|
|
@@ -1822,7 +2631,7 @@ class st {
|
|
|
1822
2631
|
*/
|
|
1823
2632
|
updateRows(e, t = (s, o) => s === o) {
|
|
1824
2633
|
const s = this.getBodyModel();
|
|
1825
|
-
if (s instanceof
|
|
2634
|
+
if (s instanceof L) {
|
|
1826
2635
|
let i = s.getAllRows();
|
|
1827
2636
|
for (const r of i)
|
|
1828
2637
|
for (const n of e)
|
|
@@ -1975,21 +2784,199 @@ class st {
|
|
|
1975
2784
|
* @returns {number} The index of the first visible row in the table's viewport.
|
|
1976
2785
|
* Returns -1 if no rows are visible or if the table is not yet rendered.
|
|
1977
2786
|
*
|
|
1978
|
-
* @example
|
|
1979
|
-
* ```typescript
|
|
1980
|
-
* // Get the first visible row index
|
|
1981
|
-
* const tableApi = new TableApi(tableScope);
|
|
1982
|
-
* const firstVisibleIndex = tableApi.getFirstVisibleRowIndex();
|
|
2787
|
+
* @example
|
|
2788
|
+
* ```typescript
|
|
2789
|
+
* // Get the first visible row index
|
|
2790
|
+
* const tableApi = new TableApi(tableScope);
|
|
2791
|
+
* const firstVisibleIndex = tableApi.getFirstVisibleRowIndex();
|
|
2792
|
+
*
|
|
2793
|
+
* // Use the index for scroll position calculations
|
|
2794
|
+
* if (firstVisibleIndex >= 0) {
|
|
2795
|
+
* // Perform operations with the first visible row
|
|
2796
|
+
* console.log(`First visible row index: ${firstVisibleIndex}`);
|
|
2797
|
+
* }
|
|
2798
|
+
* ```
|
|
2799
|
+
*/
|
|
2800
|
+
getFirstVisibleRowIndex() {
|
|
2801
|
+
return this.tableScope.getFirstVisibleRowIndex();
|
|
2802
|
+
}
|
|
2803
|
+
/**
|
|
2804
|
+
* Retrieves the index of the first fully visible row in the table's viewport.
|
|
2805
|
+
*
|
|
2806
|
+
* A row is considered "fully visible" when it's completely within the visible area of the table.
|
|
2807
|
+
* This differs from the regular "visible" row, which might be partially visible at the edges of the viewport.
|
|
2808
|
+
*
|
|
2809
|
+
* This method is useful for:
|
|
2810
|
+
* - Determining which rows are completely in view for operations that require full visibility
|
|
2811
|
+
* - Implementing pagination or virtualization logic that needs to know complete row visibility
|
|
2812
|
+
* - Supporting keyboard navigation that should skip partially visible rows
|
|
2813
|
+
*
|
|
2814
|
+
* @returns {number} The index of the first fully visible row, or -1 if no rows are fully visible
|
|
2815
|
+
*
|
|
2816
|
+
* @example
|
|
2817
|
+
* // Get the first fully visible row index
|
|
2818
|
+
* const firstFullVisibleRow = tableApi.getFirstFullVisibleRowIndex();
|
|
2819
|
+
*
|
|
2820
|
+
* // Check if a specific row is fully visible
|
|
2821
|
+
* const isRowFullyVisible = (rowIndex) => {
|
|
2822
|
+
* const firstFullVisible = tableApi.getFirstFullVisibleRowIndex();
|
|
2823
|
+
* const lastFullVisible = tableApi.getLastFullVisibleRowIndex();
|
|
2824
|
+
* return rowIndex >= firstFullVisible && rowIndex <= lastFullVisible;
|
|
2825
|
+
* };
|
|
2826
|
+
*/
|
|
2827
|
+
getFirstFullVisibleRowIndex() {
|
|
2828
|
+
return this.tableScope.getFirstFullVisibleRowIndex();
|
|
2829
|
+
}
|
|
2830
|
+
/**
|
|
2831
|
+
* Returns the index of the last row that is visible in the table's viewport.
|
|
2832
|
+
*
|
|
2833
|
+
* This method retrieves the last visible row index from the table scope, which keeps
|
|
2834
|
+
* track of which rows are currently visible as the user scrolls through the table.
|
|
2835
|
+
*
|
|
2836
|
+
* This can be useful for:
|
|
2837
|
+
* - Implementing virtualized scrolling optimizations
|
|
2838
|
+
* - Determining if specific rows are currently in view
|
|
2839
|
+
* - Implementing features that need to know the visible range of rows
|
|
2840
|
+
*
|
|
2841
|
+
* @returns {number} The index of the last visible row in the table viewport
|
|
2842
|
+
*
|
|
2843
|
+
* @example
|
|
2844
|
+
* // Check if a specific row is currently visible in the viewport
|
|
2845
|
+
* const lastVisibleIndex = tableApi.getLastVisibleRowIndex();
|
|
2846
|
+
* const firstVisibleIndex = tableApi.getFirstVisibleRowIndex();
|
|
2847
|
+
* const isRowVisible = rowIndex >= firstVisibleIndex && rowIndex <= lastVisibleIndex;
|
|
2848
|
+
*
|
|
2849
|
+
* @example
|
|
2850
|
+
* // Get the range of visible rows
|
|
2851
|
+
* const visibleRowsRange = {
|
|
2852
|
+
* first: tableApi.getFirstVisibleRowIndex(),
|
|
2853
|
+
* last: tableApi.getLastVisibleRowIndex()
|
|
2854
|
+
* };
|
|
2855
|
+
* console.log(`Visible rows: ${visibleRowsRange.first} to ${visibleRowsRange.last}`);
|
|
2856
|
+
*/
|
|
2857
|
+
getLastVisibleRowIndex() {
|
|
2858
|
+
return this.tableScope.getLastVisibleRowIndex();
|
|
2859
|
+
}
|
|
2860
|
+
/**
|
|
2861
|
+
* Returns the index of the last fully visible row in the table's viewport.
|
|
2862
|
+
*
|
|
2863
|
+
* This method retrieves the last row that is completely visible within the current
|
|
2864
|
+
* viewport of the table. A row is considered "fully visible" when its entire height
|
|
2865
|
+
* is visible without any portion being cut off by the viewport boundaries.
|
|
2866
|
+
*
|
|
2867
|
+
* The distinction between "visible" and "fully visible" is important when scrolling:
|
|
2868
|
+
* - A row can be partially visible (some portion is in view)
|
|
2869
|
+
* - A row can be fully visible (the entire row is in view)
|
|
2870
|
+
*
|
|
2871
|
+
* @returns {number} The index of the last fully visible row in the table.
|
|
2872
|
+
* If no row is fully visible or the table is empty, the method might return -1.
|
|
2873
|
+
*
|
|
2874
|
+
* @example
|
|
2875
|
+
* ```typescript
|
|
2876
|
+
* // Get the index of the last fully visible row
|
|
2877
|
+
* const lastVisibleRowIndex = tableApi.getLastFullVisibleRowIndex();
|
|
2878
|
+
*
|
|
2879
|
+
* // Use this information to determine if a specific row is fully visible
|
|
2880
|
+
* const isRowFullyVisible = rowIndex <= lastVisibleRowIndex && rowIndex >= tableApi.getFirstFullVisibleRowIndex();
|
|
2881
|
+
*
|
|
2882
|
+
* // Can be used with scrolling operations to ensure certain rows are visible
|
|
2883
|
+
* if (rowIndex > lastVisibleRowIndex) {
|
|
2884
|
+
* tableApi.ensureRowIsVisible(rowIndex);
|
|
2885
|
+
* }
|
|
2886
|
+
* ```
|
|
2887
|
+
*/
|
|
2888
|
+
getLastFullVisibleRowIndex() {
|
|
2889
|
+
return this.tableScope.getLastFullVisibleRowIndex();
|
|
2890
|
+
}
|
|
2891
|
+
/**
|
|
2892
|
+
* Checks whether logging is currently active for the table component.
|
|
2893
|
+
*
|
|
2894
|
+
* This method returns the current state of logging for the table. When logging is active,
|
|
2895
|
+
* the table outputs detailed information about its operations to the console, including:
|
|
2896
|
+
*
|
|
2897
|
+
* - Rendering processes and lifecycle events
|
|
2898
|
+
* - Data modifications and updates
|
|
2899
|
+
* - Event handling and user interactions
|
|
2900
|
+
* - Performance metrics and state changes
|
|
2901
|
+
*
|
|
2902
|
+
* Logging can be toggled using the `setLoggingActive(boolean)` method.
|
|
2903
|
+
*
|
|
2904
|
+
* @returns {boolean} True if logging is currently enabled, false otherwise.
|
|
2905
|
+
*
|
|
2906
|
+
* @example
|
|
2907
|
+
* // Check if logging is enabled
|
|
2908
|
+
* if (tableApi.isLoggingActive()) {
|
|
2909
|
+
* console.log("Table logging is currently active");
|
|
2910
|
+
* }
|
|
2911
|
+
*
|
|
2912
|
+
* // Conditionally enable logging only if it's not already active
|
|
2913
|
+
* if (!tableApi.isLoggingActive()) {
|
|
2914
|
+
* tableApi.setLoggingActive(true);
|
|
2915
|
+
*
|
|
2916
|
+
* // Perform operations that need debugging
|
|
2917
|
+
* tableApi.updateCells([
|
|
2918
|
+
* {
|
|
2919
|
+
* area: "body",
|
|
2920
|
+
* rowIndex: 2,
|
|
2921
|
+
* columnIndex: 3,
|
|
2922
|
+
* value: "New Value",
|
|
2923
|
+
* cssClasses: { "highlight": true }
|
|
2924
|
+
* }
|
|
2925
|
+
* ]);
|
|
2926
|
+
*
|
|
2927
|
+
* // Run some additional operations...
|
|
2928
|
+
*
|
|
2929
|
+
* // Disable logging when finished
|
|
2930
|
+
* tableApi.setLoggingActive(false);
|
|
2931
|
+
* }
|
|
2932
|
+
*/
|
|
2933
|
+
setLoggingActive(e) {
|
|
2934
|
+
this.tableScope.loggingActive = e;
|
|
2935
|
+
}
|
|
2936
|
+
/**
|
|
2937
|
+
* Checks whether logging is currently active for the table component.
|
|
2938
|
+
*
|
|
2939
|
+
* This method returns the current state of logging for the table. When logging is active,
|
|
2940
|
+
* the table outputs detailed information about its operations to the console, including:
|
|
2941
|
+
*
|
|
2942
|
+
* - Rendering processes and lifecycle events
|
|
2943
|
+
* - Data modifications and updates
|
|
2944
|
+
* - Event handling and user interactions
|
|
2945
|
+
* - Performance metrics and state changes
|
|
2946
|
+
*
|
|
2947
|
+
* Logging can be toggled using the `setLoggingActive(boolean)` method.
|
|
2948
|
+
*
|
|
2949
|
+
* @returns {boolean} True if logging is currently enabled, false otherwise.
|
|
2950
|
+
*
|
|
2951
|
+
* @example
|
|
2952
|
+
* // Check if logging is enabled
|
|
2953
|
+
* if (tableApi.isLoggingActive()) {
|
|
2954
|
+
* console.log("Table logging is currently active");
|
|
2955
|
+
* }
|
|
2956
|
+
*
|
|
2957
|
+
* // Conditionally enable logging only if it's not already active
|
|
2958
|
+
* if (!tableApi.isLoggingActive()) {
|
|
2959
|
+
* tableApi.setLoggingActive(true);
|
|
2960
|
+
*
|
|
2961
|
+
* // Perform operations that need debugging
|
|
2962
|
+
* tableApi.updateCells([
|
|
2963
|
+
* {
|
|
2964
|
+
* area: "body",
|
|
2965
|
+
* rowIndex: 2,
|
|
2966
|
+
* columnIndex: 3,
|
|
2967
|
+
* value: "New Value",
|
|
2968
|
+
* cssClasses: { "highlight": true }
|
|
2969
|
+
* }
|
|
2970
|
+
* ]);
|
|
2971
|
+
*
|
|
2972
|
+
* // Run some additional operations...
|
|
1983
2973
|
*
|
|
1984
|
-
*
|
|
1985
|
-
*
|
|
1986
|
-
* // Perform operations with the first visible row
|
|
1987
|
-
* console.log(`First visible row index: ${firstVisibleIndex}`);
|
|
2974
|
+
* // Disable logging when finished
|
|
2975
|
+
* tableApi.setLoggingActive(false);
|
|
1988
2976
|
* }
|
|
1989
|
-
* ```
|
|
1990
2977
|
*/
|
|
1991
|
-
|
|
1992
|
-
return this.tableScope.
|
|
2978
|
+
isLoggingActive() {
|
|
2979
|
+
return this.tableScope.loggingActive;
|
|
1993
2980
|
}
|
|
1994
2981
|
}
|
|
1995
2982
|
class pe {
|
|
@@ -2141,14 +3128,14 @@ class nt extends pe {
|
|
|
2141
3128
|
}
|
|
2142
3129
|
}
|
|
2143
3130
|
}
|
|
2144
|
-
class
|
|
3131
|
+
class O {
|
|
2145
3132
|
constructor(e = 0, t = 0, s = 0, o = 0, i) {
|
|
2146
3133
|
this.left = e, this.width = t, this.height = s, this.top = o, this.index = i;
|
|
2147
3134
|
}
|
|
2148
3135
|
}
|
|
2149
3136
|
class lt {
|
|
2150
3137
|
constructor(e, t, s, o) {
|
|
2151
|
-
this.hostElement = e, this.tableModel = t, this.dom = s, this.tableOptions = o, this.scrollTop = 0, this.areaBodyWestGeo = new
|
|
3138
|
+
this.hostElement = e, this.tableModel = t, this.dom = s, this.tableOptions = o, this.scrollTop = 0, this.areaBodyWestGeo = new O(), this.areaBodyCenterGeo = new O(), this.areaBodyEastGeo = new O();
|
|
2152
3139
|
const i = this.hostElement;
|
|
2153
3140
|
i.innerText = "", this.dom.setAttribute(i, "tabindex", "0"), this.dom.setStyle(
|
|
2154
3141
|
this.dom.addClass("ge-table", i),
|
|
@@ -2393,11 +3380,11 @@ class I {
|
|
|
2393
3380
|
class ct extends lt {
|
|
2394
3381
|
constructor(e, t, s, o) {
|
|
2395
3382
|
var r, n;
|
|
2396
|
-
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 = {
|
|
3383
|
+
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 = {
|
|
2397
3384
|
header: [],
|
|
2398
3385
|
body: [],
|
|
2399
3386
|
footer: []
|
|
2400
|
-
}, this.tree = !1, this.colAndRowspanModels = new I(), this.
|
|
3387
|
+
}, this.tree = !1, this.colAndRowspanModels = new I(), this.draggingTargetColumnIndex = -1, this.removables = [], this.tableModel.getSelectionModel ? this.getSelectionModel = this.tableModel.getSelectionModel : (r = this.tableOptions) != null && r.getSelectionModel && (this.getSelectionModel = this.tableOptions.getSelectionModel), (n = this.tableOptions) != null && n.getFocusModel && (this.getFocusModel = this.tableOptions.getFocusModel), re(t.getAreaModel("body")) && (this.tree = !0), ["header", "body", "footer"].forEach(
|
|
2401
3388
|
(l) => {
|
|
2402
3389
|
var a;
|
|
2403
3390
|
this.colAndRowspanModels[l] = new at(t, t.getAreaModel(l)), (a = this.colAndRowspanModels[l]) == null || a.init();
|
|
@@ -2486,19 +3473,19 @@ class ct extends lt {
|
|
|
2486
3473
|
for (const t of this.removables)
|
|
2487
3474
|
t.remove();
|
|
2488
3475
|
this.hideHoverRow(), this.hideHoverColumn(), this.scrollTop = this.scrollViewport.scrollTop, this.scrollLeft = this.scrollViewport.scrollLeft, this.debounce(this.checkForScrollPosSaving.bind(this)), this.scrollFactorY = this.scrollTop / (this.scrollViewport.scrollHeight - this.scrollViewport.clientHeight), this.scrollFactorX = this.scrollLeft / (this.scrollViewport.scrollWidth - this.scrollViewport.clientWidth), isNaN(this.scrollFactorY) && (this.scrollFactorY = 0), isNaN(this.scrollFactorX) && (this.scrollFactorX = 0), this.adjustBody(), this.adjustArea("footer"), this.adjustArea("header"), this.tableOptions.tableTopBorderVisible && this.removables.push(this.dom.addHorizontalBorder(
|
|
2489
|
-
new
|
|
3476
|
+
new O(0, this.hostElement.clientWidth, 1, 0),
|
|
2490
3477
|
this.hostElement,
|
|
2491
3478
|
"ge-table-border"
|
|
2492
3479
|
)), this.tableOptions.tableBottomBorderVisible && this.removables.push(this.dom.addHorizontalBorder(
|
|
2493
|
-
new
|
|
3480
|
+
new O(0, this.hostElement.clientWidth, 1, this.hostElement.clientHeight - 1),
|
|
2494
3481
|
this.hostElement,
|
|
2495
3482
|
"ge-table-border"
|
|
2496
3483
|
)), this.tableModel.getFixedLeftColumnCount() > 0 && this.removables.push(this.dom.addVerticalBorder(
|
|
2497
|
-
new
|
|
3484
|
+
new O(this.areaBodyWest.child.clientWidth, 1, this.hostElement.clientHeight, 0),
|
|
2498
3485
|
this.hostElement,
|
|
2499
3486
|
"ge-table-body-west-vertical-border"
|
|
2500
3487
|
)), ((e = this.tableModel.getAreaModel("header")) == null ? void 0 : e.getRowCount()) > 0 && this.removables.push(this.dom.addHorizontalBorder(
|
|
2501
|
-
new
|
|
3488
|
+
new O(0, this.hostElement.clientWidth, 1, this.areaHeaderCenter.child.clientHeight),
|
|
2502
3489
|
this.hostElement,
|
|
2503
3490
|
"ge-table-body-west-vertical-border"
|
|
2504
3491
|
));
|
|
@@ -2556,6 +3543,21 @@ class ct extends lt {
|
|
|
2556
3543
|
this.dom.setStyle(l, p, g[p]);
|
|
2557
3544
|
}
|
|
2558
3545
|
}
|
|
3546
|
+
getFirstVisibleRowIndex() {
|
|
3547
|
+
return this.firstVisibleRowIndex;
|
|
3548
|
+
}
|
|
3549
|
+
getLastVisibleRowIndex() {
|
|
3550
|
+
return this.lastVisibleRowIndex;
|
|
3551
|
+
}
|
|
3552
|
+
getFirstFullVisibleRowIndex() {
|
|
3553
|
+
return this.firstFullVisibleRowIndex;
|
|
3554
|
+
}
|
|
3555
|
+
getLastFullVisibleRowIndex() {
|
|
3556
|
+
return this.lastFullVisibleRowIndex;
|
|
3557
|
+
}
|
|
3558
|
+
getDisplayedRowCount() {
|
|
3559
|
+
return this.displayedRowCount;
|
|
3560
|
+
}
|
|
2559
3561
|
/**
|
|
2560
3562
|
* Stores the widths of all columns in the table.
|
|
2561
3563
|
*
|
|
@@ -2661,10 +3663,11 @@ class ct extends lt {
|
|
|
2661
3663
|
}
|
|
2662
3664
|
let u = t;
|
|
2663
3665
|
const g = this.tableModel.getColumnCount(), p = this.tableModel.getFixedRightColumnCount(), m = this.tableModel.getFixedLeftColumnCount();
|
|
3666
|
+
e === "body" && (this.firstVisibleRowIndex = -1, this.firstFullVisibleRowIndex = -1, this.lastVisibleRowIndex = -1, this.lastFullVisibleRowIndex = -1);
|
|
2664
3667
|
for (let b = 0; b < h; b++) {
|
|
2665
3668
|
const w = u, S = b === h - 1, R = this.tableModel.getRowHeight(e, b);
|
|
2666
3669
|
if (w + R > 0) {
|
|
2667
|
-
this.firstVisibleRowIndex = b;
|
|
3670
|
+
e === "body" && this.firstVisibleRowIndex === -1 && (this.firstVisibleRowIndex = b, this.firstFullVisibleRowIndex = w < -this.pixelLimitForFullVisible ? this.firstVisibleRowIndex + 1 : this.firstVisibleRowIndex);
|
|
2668
3671
|
let C = { left: n, width: l, height: R, top: w, index: b }, x = this.dom.addRowDiv(o, C, b, e, "center");
|
|
2669
3672
|
const k = m;
|
|
2670
3673
|
if (this.adjustColumnsToRowParent({
|
|
@@ -2703,7 +3706,7 @@ class ct extends lt {
|
|
|
2703
3706
|
})), e === "header" && this.tree && b === h - 1) {
|
|
2704
3707
|
const E = this.dom.applyStyle(
|
|
2705
3708
|
this.dom.setAttribute(
|
|
2706
|
-
this.dom.addDiv(x, new
|
|
3709
|
+
this.dom.addDiv(x, new O(16, 20, 20, 8)),
|
|
2707
3710
|
"data-ge-action",
|
|
2708
3711
|
"toggleExpandCollapseAll"
|
|
2709
3712
|
),
|
|
@@ -2716,11 +3719,14 @@ class ct extends lt {
|
|
|
2716
3719
|
}
|
|
2717
3720
|
}
|
|
2718
3721
|
if (u = u + R, u > r) {
|
|
2719
|
-
e === "body" && (this.displayedRowCount = this.
|
|
3722
|
+
e === "body" && (this.lastVisibleRowIndex = b, this.lastFullVisibleRowIndex = r - u < -this.pixelLimitForFullVisible ? b - 1 : b, this.displayedRowCount = this.lastFullVisibleRowIndex - this.firstFullVisibleRowIndex + 1);
|
|
2720
3723
|
break;
|
|
2721
3724
|
}
|
|
2722
3725
|
}
|
|
2723
|
-
if (this.
|
|
3726
|
+
if (this.loggingActive && e === "body" && console.log("render scope: this.firstVisibleRowIndex <- " + this.firstVisibleRowIndex + `
|
|
3727
|
+
render scope: this.firstFullVisibleRowIndex <- ` + this.firstFullVisibleRowIndex + `
|
|
3728
|
+
render scope: this.lastVisibleRowIndex <- ` + this.lastVisibleRowIndex + `
|
|
3729
|
+
render scope: this.lastFullVisibleRowIndex <- ` + this.lastFullVisibleRowIndex), this.colAndRowspanModels && this.colAndRowspanModels[e]) {
|
|
2724
3730
|
const b = ((f = this.colAndRowspanModels[e]) == null ? void 0 : f.getRanges()) ?? [];
|
|
2725
3731
|
if (b.length)
|
|
2726
3732
|
for (const w of b) {
|
|
@@ -2883,7 +3889,7 @@ class ct extends lt {
|
|
|
2883
3889
|
if (p = p + w, p > this.areaBodyCenterGeo.width)
|
|
2884
3890
|
break;
|
|
2885
3891
|
}
|
|
2886
|
-
this.tableOptions.verticalBorderVisible && this.dom.addVerticalBorder(new
|
|
3892
|
+
this.tableOptions.verticalBorderVisible && this.dom.addVerticalBorder(new O(p - 1, 1, o.height, 0), i);
|
|
2887
3893
|
}
|
|
2888
3894
|
/**
|
|
2889
3895
|
* Retrieves the column index of the tree arrow column in the table.
|
|
@@ -3713,7 +4719,7 @@ class J {
|
|
|
3713
4719
|
header: 34,
|
|
3714
4720
|
body: 34,
|
|
3715
4721
|
footer: 34
|
|
3716
|
-
}, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new $e(), this.headerGroupOptions = new me(), this.showCheckboxWihoutExtraColumn = !1, this.externalFilterFunction = void 0, this.sortedOptions = new
|
|
4722
|
+
}, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new $e(), this.headerGroupOptions = new me(), this.showCheckboxWihoutExtraColumn = !1, this.externalFilterFunction = void 0, this.sortedOptions = new Ve(), this.sortOrder = ["asc", "desc"], this.shortcutActionsDisabled = !1, this.resizeEventDebounceDelay = 500, this.getEditRenderer = (e, t) => new wt(), this.getSelectionModel = () => St, this.getFocusModel = () => Ct;
|
|
3717
4723
|
}
|
|
3718
4724
|
}
|
|
3719
4725
|
const N = class N {
|
|
@@ -4344,9 +5350,6 @@ class He extends ct {
|
|
|
4344
5350
|
sort(e) {
|
|
4345
5351
|
this.tableModel.sort(e);
|
|
4346
5352
|
}
|
|
4347
|
-
getDisplayedRowCount() {
|
|
4348
|
-
return this.displayedRowCount;
|
|
4349
|
-
}
|
|
4350
5353
|
/**
|
|
4351
5354
|
* Ensures that a specific row is visible in the viewport by scrolling if necessary.
|
|
4352
5355
|
* This method checks if the target row is within the currently visible range and
|
|
@@ -4399,11 +5402,8 @@ class He extends ct {
|
|
|
4399
5402
|
* @see {@link getDisplayedRowCount} - Related method for getting visible row count
|
|
4400
5403
|
*/
|
|
4401
5404
|
ensureRowIsVisible(e) {
|
|
4402
|
-
const t = this.
|
|
4403
|
-
return e < t ? (this.scrollToIndex(0, e
|
|
4404
|
-
}
|
|
4405
|
-
getFirstVisibleRowIndex() {
|
|
4406
|
-
return this.firstVisibleRowIndex;
|
|
5405
|
+
const t = this.getFirstFullVisibleRowIndex(), s = this.getLastFullVisibleRowIndex(), o = this.getDisplayedRowCount();
|
|
5406
|
+
return e < t ? (this.scrollToIndex(0, e), !0) : e > s ? (this.scrollToIndex(0, e - o + 1), !0) : !1;
|
|
4407
5407
|
}
|
|
4408
5408
|
}
|
|
4409
5409
|
class Gt extends ne {
|
|
@@ -4734,7 +5734,7 @@ class H {
|
|
|
4734
5734
|
}
|
|
4735
5735
|
}
|
|
4736
5736
|
const zt = new y(500, "px"), jt = new y(400, "px"), Et = new y(300, "px"), Ut = new y(290, "px"), Yt = new y(280, "px"), Kt = new y(270, "px"), Xt = new y(260, "px"), Jt = new y(250, "px"), qt = new y(240, "px"), Zt = new y(230, "px"), Qt = new y(220, "px"), es = new y(210, "px"), Re = new y(200, "px"), ts = new y(190, "px"), ss = new y(180, "px"), os = new y(170, "px"), is = new y(160, "px"), rs = new y(150, "px"), ns = new y(140, "px"), ls = new y(130, "px"), as = new y(120, "px"), cs = new y(110, "px"), ds = new y(100, "px"), hs = new y(90, "px"), us = new y(80, "px"), ps = new y(70, "px"), fs = new y(60, "px"), gs = new y(50, "px"), ms = new y(40, "px"), bs = new y(30, "px"), ys = new y(20, "px"), ws = new y(10, "px"), xs = new y(0, "px");
|
|
4737
|
-
class
|
|
5737
|
+
class F extends ue {
|
|
4738
5738
|
constructor(e, t, s, o = []) {
|
|
4739
5739
|
super(e, o, s), this.areaIdent = e, this.arr = t, this.defaultRowHeight = s, this.columnDefs = o, this.filteredArr = [...t];
|
|
4740
5740
|
}
|
|
@@ -4762,7 +5762,7 @@ class P extends ue {
|
|
|
4762
5762
|
this.filteredArr.forEach((s) => this.arrayMove(s, e, t)), super.changeColumnOrder(e, t);
|
|
4763
5763
|
}
|
|
4764
5764
|
}
|
|
4765
|
-
class
|
|
5765
|
+
class P {
|
|
4766
5766
|
constructor(e = "body") {
|
|
4767
5767
|
this.areaIdent = e, this.rowSelectionModel = void 0;
|
|
4768
5768
|
}
|
|
@@ -4849,7 +5849,7 @@ class Mt {
|
|
|
4849
5849
|
}
|
|
4850
5850
|
class Ae extends ue {
|
|
4851
5851
|
constructor(e, t, s, o = []) {
|
|
4852
|
-
super(e, o, s), this.areaIdent = e, this.rows = t, this.defaultRowHeight = s, this.columnDefs = o, this.type = "AreaModelTree", this.sorterService = new
|
|
5852
|
+
super(e, o, s), this.areaIdent = e, this.rows = t, this.defaultRowHeight = s, this.columnDefs = o, this.type = "AreaModelTree", this.sorterService = new Be(), this.service = new Mt(), this.properties = o.map((i) => i.property), this.flattenRows = this.service.flattenTree(t), this.filteredFlattenRows = [...this.flattenRows];
|
|
4853
5853
|
}
|
|
4854
5854
|
changeColumnOrder(e, t) {
|
|
4855
5855
|
this.arrayMove(this.properties, e, t), super.changeColumnOrder(e, t);
|
|
@@ -5442,7 +6442,36 @@ class oe {
|
|
|
5442
6442
|
return this.tableScope;
|
|
5443
6443
|
}
|
|
5444
6444
|
}
|
|
5445
|
-
class Te extends
|
|
6445
|
+
class Te extends L {
|
|
6446
|
+
/**
|
|
6447
|
+
* Creates an instance of AreaModelObjectArrayWithColumndefs.
|
|
6448
|
+
*
|
|
6449
|
+
* @param {AreaIdent} areaIdent - Identifies which area of the table this model represents ('header', 'body', or 'footer')
|
|
6450
|
+
* @param {T[]} rows - The array of objects that represent the rows in this area
|
|
6451
|
+
* @param {ColumnDefIf[]} columnDefs - Definitions for the columns in this area (required parameter)
|
|
6452
|
+
* @param {number} defaultRowHeight - The default height for rows in this area (in pixels)
|
|
6453
|
+
* @param {string} [selectedRowClass='ge-selected-row'] - CSS class to apply to selected rows
|
|
6454
|
+
* @param {string} [focusedRowClass='ge-focused-row'] - CSS class to apply to the focused row
|
|
6455
|
+
*
|
|
6456
|
+
* @example
|
|
6457
|
+
* const rows = [
|
|
6458
|
+
* { id: 1, name: 'John', age: 30 },
|
|
6459
|
+
* { id: 2, name: 'Jane', age: 25 }
|
|
6460
|
+
* ];
|
|
6461
|
+
*
|
|
6462
|
+
* const columnDefs = [
|
|
6463
|
+
* { property: 'id', headerLabel: 'ID', width: new Size(50, 'px') },
|
|
6464
|
+
* { property: 'name', headerLabel: 'Name', width: new Size(150, 'px') },
|
|
6465
|
+
* { property: 'age', headerLabel: 'Age', width: new Size(100, 'px') }
|
|
6466
|
+
* ];
|
|
6467
|
+
*
|
|
6468
|
+
* const bodyAreaModel = new AreaModelObjectArrayWithColumndefs(
|
|
6469
|
+
* 'body',
|
|
6470
|
+
* rows,
|
|
6471
|
+
* columnDefs,
|
|
6472
|
+
* 30
|
|
6473
|
+
* );
|
|
6474
|
+
*/
|
|
5446
6475
|
constructor(e, t, s, o, i = "ge-selected-row", r = "ge-focused-row") {
|
|
5447
6476
|
super(
|
|
5448
6477
|
e,
|
|
@@ -5454,7 +6483,7 @@ class Te extends O {
|
|
|
5454
6483
|
), this.areaIdent = e, this.rows = t, this.columnDefs = s, this.defaultRowHeight = o;
|
|
5455
6484
|
}
|
|
5456
6485
|
}
|
|
5457
|
-
class
|
|
6486
|
+
class V {
|
|
5458
6487
|
/**
|
|
5459
6488
|
* TableFactory
|
|
5460
6489
|
*
|
|
@@ -5510,22 +6539,22 @@ class B {
|
|
|
5510
6539
|
f > -1 && (e.defaultRowHeights.footer = f);
|
|
5511
6540
|
}
|
|
5512
6541
|
}
|
|
5513
|
-
if (e.columnDefs === void 0 && ((s = e.properties) != null && s.length ? e.columnDefs = e.properties.map((f) => new H(f, f.toUpperCase(), Re)) : (o = e.rows) != null && o.length ? e.columnDefs = Object.keys(e.rows[0]).map((f) => new H(f, f.toUpperCase(), Re)) : e.columnDefs = []), e.columnCount === void 0 && ((i = e.columnDefs) != null && i.length ? e.columnCount = e.columnDefs.length : (r = e.headerData) != null && r.length ? e.columnCount = e.headerData[0].length : (n = e.columnSizes) != null && n.length ? e.columnCount = (l = e.columnSizes) == null ? void 0 : l.length : console.warn('Property "columnCount" is missing and cannot be derived from other properties.')), e.headerAreaModel || ((a = e.headerData) != null && a.length ? e.headerAreaModel = new
|
|
6542
|
+
if (e.columnDefs === void 0 && ((s = e.properties) != null && s.length ? e.columnDefs = e.properties.map((f) => new H(f, f.toUpperCase(), Re)) : (o = e.rows) != null && o.length ? e.columnDefs = Object.keys(e.rows[0]).map((f) => new H(f, f.toUpperCase(), Re)) : e.columnDefs = []), e.columnCount === void 0 && ((i = e.columnDefs) != null && i.length ? e.columnCount = e.columnDefs.length : (r = e.headerData) != null && r.length ? e.columnCount = e.headerData[0].length : (n = e.columnSizes) != null && n.length ? e.columnCount = (l = e.columnSizes) == null ? void 0 : l.length : console.warn('Property "columnCount" is missing and cannot be derived from other properties.')), e.headerAreaModel || ((a = e.headerData) != null && a.length ? e.headerAreaModel = new F(
|
|
5514
6543
|
"header",
|
|
5515
6544
|
e.headerData,
|
|
5516
6545
|
e.defaultRowHeights.header,
|
|
5517
6546
|
e.columnDefs
|
|
5518
|
-
) : (c = e.columnDefs) != null && c.length ? e.headerAreaModel = new
|
|
6547
|
+
) : (c = e.columnDefs) != null && c.length ? e.headerAreaModel = new F(
|
|
5519
6548
|
"header",
|
|
5520
6549
|
[e.columnDefs.map((f) => f.headerLabel)],
|
|
5521
6550
|
e.defaultRowHeights.header,
|
|
5522
6551
|
e.columnDefs
|
|
5523
|
-
) : e.headerAreaModel = new
|
|
6552
|
+
) : e.headerAreaModel = new P("header")), e.footerAreaModel || ((h = e.footerData) != null && h.length ? e.footerAreaModel = new F(
|
|
5524
6553
|
"footer",
|
|
5525
6554
|
e.footerData,
|
|
5526
6555
|
e.defaultRowHeights.footer,
|
|
5527
6556
|
e.columnDefs
|
|
5528
|
-
) : e.footerAreaModel = new
|
|
6557
|
+
) : e.footerAreaModel = new P("footer")), !e.bodyAreaModel)
|
|
5529
6558
|
if (e.rows)
|
|
5530
6559
|
if ((u = e.rows) != null && u.length && G(e.rows[0])) {
|
|
5531
6560
|
const f = e.rows;
|
|
@@ -5542,11 +6571,11 @@ class B {
|
|
|
5542
6571
|
e.columnDefs,
|
|
5543
6572
|
e.defaultRowHeights.body
|
|
5544
6573
|
);
|
|
5545
|
-
else e.bodyData ? e.bodyAreaModel = new
|
|
6574
|
+
else e.bodyData ? e.bodyAreaModel = new F(
|
|
5546
6575
|
"body",
|
|
5547
6576
|
e.bodyData,
|
|
5548
6577
|
e.defaultRowHeights.body
|
|
5549
|
-
) : e.bodyAreaModel = new
|
|
6578
|
+
) : e.bodyAreaModel = new P("body");
|
|
5550
6579
|
return e.fixedLeftColumnCount === void 0 && (e.fixedLeftColumnCount = 0), e.fixedRightColumnCount === void 0 && (e.fixedRightColumnCount = 0), e.rowCheckboxVisible === void 0 && (e.rowCheckboxVisible = !1), e.overridingColumnWidth === void 0 && (e.overridingColumnWidth = -1), !e.getSelectionModel && ((p = e.tableOptions) != null && p.getSelectionModel) && (e.getSelectionModel = (m = e.tableOptions) == null ? void 0 : m.getSelectionModel), new oe(
|
|
5551
6580
|
e.headerAreaModel,
|
|
5552
6581
|
e.bodyAreaModel,
|
|
@@ -5581,7 +6610,7 @@ class B {
|
|
|
5581
6610
|
* @method
|
|
5582
6611
|
*/
|
|
5583
6612
|
static buildByTypedRowsParam(e) {
|
|
5584
|
-
return
|
|
6613
|
+
return V.buildByTypedRows(
|
|
5585
6614
|
e.rows ?? [],
|
|
5586
6615
|
e.columnDefs,
|
|
5587
6616
|
e.tableOptions ?? new J(),
|
|
@@ -5634,10 +6663,10 @@ class B {
|
|
|
5634
6663
|
r.body,
|
|
5635
6664
|
t
|
|
5636
6665
|
);
|
|
5637
|
-
return (n || s.showCheckboxWihoutExtraColumn) && (c.rowSelectionModel = new Ee(a)),
|
|
5638
|
-
headerAreaModel: new
|
|
6666
|
+
return (n || s.showCheckboxWihoutExtraColumn) && (c.rowSelectionModel = new Ee(a)), V.createByAreaModelsParam({
|
|
6667
|
+
headerAreaModel: new F("header", [t.map((h) => h.headerLabel)], r.header),
|
|
5639
6668
|
bodyAreaModel: c,
|
|
5640
|
-
footerAreaModel: new
|
|
6669
|
+
footerAreaModel: new F("footer", [], r.footer),
|
|
5641
6670
|
columnDefs: t,
|
|
5642
6671
|
fixedLeftColumnCount: o,
|
|
5643
6672
|
fixedRightColumnCount: i,
|
|
@@ -5648,7 +6677,7 @@ class B {
|
|
|
5648
6677
|
overridingColumnWidth: -1
|
|
5649
6678
|
});
|
|
5650
6679
|
}
|
|
5651
|
-
return
|
|
6680
|
+
return V.createByObjectArrayParam({
|
|
5652
6681
|
rows: e,
|
|
5653
6682
|
columnDefs: t,
|
|
5654
6683
|
fixedLeftColumnCount: o,
|
|
@@ -5702,7 +6731,7 @@ class B {
|
|
|
5702
6731
|
*/
|
|
5703
6732
|
static createByObjectArrayParam(e) {
|
|
5704
6733
|
const t = e.rowCheckboxVisible !== void 0 ? e.rowCheckboxVisible : !1;
|
|
5705
|
-
return
|
|
6734
|
+
return V.createByObjectArray(
|
|
5706
6735
|
e.rows,
|
|
5707
6736
|
e.header ?? [],
|
|
5708
6737
|
e.footer ?? [],
|
|
@@ -5755,7 +6784,7 @@ class B {
|
|
|
5755
6784
|
* @return A new instance of `TableModel` is created using the provided parameters.
|
|
5756
6785
|
* If a parameter isn't provided, the default value is used.
|
|
5757
6786
|
*/
|
|
5758
|
-
static createByAreaModels(e = new
|
|
6787
|
+
static createByAreaModels(e = new P(), t, s = new P(), o = 0, i = 0, r = !1, n = new z(), l, a = [], c = -1, h) {
|
|
5759
6788
|
return new oe(
|
|
5760
6789
|
e,
|
|
5761
6790
|
t,
|
|
@@ -5807,10 +6836,10 @@ class B {
|
|
|
5807
6836
|
* });
|
|
5808
6837
|
*/
|
|
5809
6838
|
static createByAreaModelsParam(e) {
|
|
5810
|
-
return
|
|
5811
|
-
e.headerAreaModel ?? new
|
|
6839
|
+
return V.createByAreaModels(
|
|
6840
|
+
e.headerAreaModel ?? new P(),
|
|
5812
6841
|
e.bodyAreaModel,
|
|
5813
|
-
e.footerAreaModel ?? new
|
|
6842
|
+
e.footerAreaModel ?? new P(),
|
|
5814
6843
|
e.fixedLeftColumnCount ?? 0,
|
|
5815
6844
|
e.fixedRightColumnCount ?? 0,
|
|
5816
6845
|
e.rowCheckboxVisible === void 0 ? !1 : e.rowCheckboxVisible,
|
|
@@ -5871,8 +6900,8 @@ class B {
|
|
|
5871
6900
|
*/
|
|
5872
6901
|
static createByObjectArray(e, t = [], s = [], o = 0, i = 0, r = !1, n = new z(), l, a = []) {
|
|
5873
6902
|
let c;
|
|
5874
|
-
t != null && t.length ? c = new
|
|
5875
|
-
const h = s ? new
|
|
6903
|
+
t != null && t.length ? c = new F("header", t, n.header, l) : l != null && l.length ? c = new F("header", [l.map((g) => g.headerLabel)], n.header, l) : c = new P();
|
|
6904
|
+
const h = s ? new F("footer", s, n.footer, l) : new P(), u = new Te("body", e, l, n.body);
|
|
5876
6905
|
return new oe(
|
|
5877
6906
|
c,
|
|
5878
6907
|
u,
|
|
@@ -5992,17 +7021,17 @@ class Ds {
|
|
|
5992
7021
|
);
|
|
5993
7022
|
}
|
|
5994
7023
|
}
|
|
5995
|
-
class
|
|
7024
|
+
class Fs {
|
|
5996
7025
|
constructor(e = "down", t) {
|
|
5997
7026
|
this.status = e, this.originalEvent = t;
|
|
5998
7027
|
}
|
|
5999
7028
|
}
|
|
6000
|
-
class
|
|
7029
|
+
class Ps {
|
|
6001
7030
|
constructor(e, t, s, o, i = {}) {
|
|
6002
7031
|
this.area = e, this.rowIndex = t, this.columnIndex = s, this.value = o, this.cssClasses = i;
|
|
6003
7032
|
}
|
|
6004
7033
|
}
|
|
6005
|
-
class
|
|
7034
|
+
class Ls {
|
|
6006
7035
|
constructor() {
|
|
6007
7036
|
this.autoRestoreSortingState = !1, this.autoRestoreCollapsedExpandedState = !1, this.autoRestoreScrollPosition = !1, this.autoRestoreCheckedState = !1, this.autoRestoreSelectedState = !1, this.getStorageKeyFn = void 0, this.isSame = (e, t, s) => {
|
|
6008
7037
|
if (e && t && s.getRowId) {
|
|
@@ -6027,12 +7056,12 @@ class Os {
|
|
|
6027
7056
|
};
|
|
6028
7057
|
}
|
|
6029
7058
|
}
|
|
6030
|
-
class
|
|
7059
|
+
class Ft {
|
|
6031
7060
|
constructor(e, t, s, o = !1, i = "normal", r = void 0) {
|
|
6032
7061
|
this.data = e, this.property = t, this.toggle = s, this.closed = o, this.visibility = i, this.children = r, this.impl = "CellGroup";
|
|
6033
7062
|
}
|
|
6034
7063
|
}
|
|
6035
|
-
class
|
|
7064
|
+
class Pt extends Ft {
|
|
6036
7065
|
constructor(e, t = 0, s = 0, o) {
|
|
6037
7066
|
super(
|
|
6038
7067
|
e.data,
|
|
@@ -6157,7 +7186,7 @@ class T {
|
|
|
6157
7186
|
static buildGroupExts(e, t = [], s = 0, o) {
|
|
6158
7187
|
let i;
|
|
6159
7188
|
for (let r = 0; r < e.length; r++) {
|
|
6160
|
-
const n = e[r], l = new
|
|
7189
|
+
const n = e[r], l = new Pt(n, s, r, o);
|
|
6161
7190
|
i && (l.leftNeighbour = i, i.rightNeighbour = l), t.push(l), n.children && (l.children = T.buildGroupExts(n.children, [], s + 1, l)), i = l;
|
|
6162
7191
|
}
|
|
6163
7192
|
return t;
|
|
@@ -6199,74 +7228,624 @@ class T {
|
|
|
6199
7228
|
e.push(o.data + " rowIndex:" + o.rowIndex), (s = o.children) != null && s.length && T.iterateThrowColumns(e, o.children);
|
|
6200
7229
|
}
|
|
6201
7230
|
}
|
|
6202
|
-
class
|
|
7231
|
+
class Os {
|
|
6203
7232
|
constructor() {
|
|
6204
7233
|
this.areaIdent = "body", this.rowSelectionModel = void 0;
|
|
6205
7234
|
}
|
|
7235
|
+
/**
|
|
7236
|
+
* Changes the order of columns by moving a column from one position to another.
|
|
7237
|
+
* This method is called when the user drags a column to a new position.
|
|
7238
|
+
* The base implementation does nothing and should be overridden by subclasses
|
|
7239
|
+
* that support column reordering.
|
|
7240
|
+
*
|
|
7241
|
+
* @param {number} _sourceColumnIndex - The index of the column to move
|
|
7242
|
+
* @param {number} _targetColumnIndex - The index where the column should be moved to
|
|
7243
|
+
* @returns {void}
|
|
7244
|
+
*
|
|
7245
|
+
* @example
|
|
7246
|
+
* // Override in a subclass to implement column reordering
|
|
7247
|
+
* changeColumnOrder(sourceColumnIndex: number, targetColumnIndex: number): void {
|
|
7248
|
+
* // Move the column in the internal data structure
|
|
7249
|
+
* this.arrayMove(this.columns, sourceColumnIndex, targetColumnIndex);
|
|
7250
|
+
* }
|
|
7251
|
+
*/
|
|
6206
7252
|
changeColumnOrder(e, t) {
|
|
6207
7253
|
}
|
|
7254
|
+
/**
|
|
7255
|
+
* Sorts the rows in this area based on the provided sort items.
|
|
7256
|
+
* This method is called when the user clicks on a sortable column header.
|
|
7257
|
+
* The base implementation returns false (no sorting performed) and should be
|
|
7258
|
+
* overridden by subclasses that support sorting.
|
|
7259
|
+
*
|
|
7260
|
+
* @param {SortItem[]} _sortItems - An array of sort items, each containing a column index and sort direction
|
|
7261
|
+
* @returns {boolean} True if sorting was performed, false otherwise
|
|
7262
|
+
*
|
|
7263
|
+
* @example
|
|
7264
|
+
* // Override in a subclass to implement sorting
|
|
7265
|
+
* doSort(sortItems: SortItem[]): boolean {
|
|
7266
|
+
* if (!sortItems.length) return false;
|
|
7267
|
+
*
|
|
7268
|
+
* // Apply sorting to the rows
|
|
7269
|
+
* this.rows.sort((a, b) => {
|
|
7270
|
+
* const { columnIndex, sortState } = sortItems[0];
|
|
7271
|
+
* const valueA = this.getValueAt(this.rows.indexOf(a), columnIndex);
|
|
7272
|
+
* const valueB = this.getValueAt(this.rows.indexOf(b), columnIndex);
|
|
7273
|
+
*
|
|
7274
|
+
* const direction = sortState === 'asc' ? 1 : -1;
|
|
7275
|
+
* if (valueA < valueB) return -1 * direction;
|
|
7276
|
+
* if (valueA > valueB) return 1 * direction;
|
|
7277
|
+
* return 0;
|
|
7278
|
+
* });
|
|
7279
|
+
*
|
|
7280
|
+
* return true;
|
|
7281
|
+
* }
|
|
7282
|
+
*/
|
|
6208
7283
|
doSort(e) {
|
|
6209
7284
|
return !1;
|
|
6210
7285
|
}
|
|
7286
|
+
/**
|
|
7287
|
+
* Sorts the rows in this area using a custom comparator function.
|
|
7288
|
+
* This method provides more flexibility than doSort for complex sorting logic.
|
|
7289
|
+
* The base implementation does nothing and should be overridden by subclasses
|
|
7290
|
+
* that support custom sorting.
|
|
7291
|
+
*
|
|
7292
|
+
* @param {(a: any, b: any) => number} [_compareFn] - A function that compares two rows and returns a number:
|
|
7293
|
+
* - Negative if a should come before b
|
|
7294
|
+
* - Positive if a should come after b
|
|
7295
|
+
* - Zero if they are equivalent for sorting purposes
|
|
7296
|
+
* @returns {void}
|
|
7297
|
+
*
|
|
7298
|
+
* @example
|
|
7299
|
+
* // Override in a subclass to implement custom sorting
|
|
7300
|
+
* sort(compareFn?: (a: any, b: any) => number): void {
|
|
7301
|
+
* if (!compareFn) return;
|
|
7302
|
+
*
|
|
7303
|
+
* // Apply the custom sort function
|
|
7304
|
+
* this.rows.sort(compareFn);
|
|
7305
|
+
* }
|
|
7306
|
+
*/
|
|
6211
7307
|
sort(e) {
|
|
6212
7308
|
}
|
|
7309
|
+
/**
|
|
7310
|
+
* Applies a filter function to the rows in this area.
|
|
7311
|
+
* This method is called when a filter is applied to the table.
|
|
7312
|
+
* The base implementation does nothing and should be overridden by subclasses
|
|
7313
|
+
* that support filtering.
|
|
7314
|
+
*
|
|
7315
|
+
* @param {FilterFunction<T>} _predictFn - A function that takes a row and returns true if the row should be visible
|
|
7316
|
+
* @returns {void}
|
|
7317
|
+
*
|
|
7318
|
+
* @example
|
|
7319
|
+
* // Override in a subclass to implement filtering
|
|
7320
|
+
* externalFilterChanged<T>(predictFn: FilterFunction<T>): void {
|
|
7321
|
+
* // Apply the filter to the rows
|
|
7322
|
+
* this.filteredRows = this.rows.filter(predictFn);
|
|
7323
|
+
* }
|
|
7324
|
+
*/
|
|
6213
7325
|
externalFilterChanged(e) {
|
|
6214
7326
|
}
|
|
7327
|
+
/**
|
|
7328
|
+
* Returns a cell renderer for the cell at the specified row and column indices.
|
|
7329
|
+
* A cell renderer is responsible for rendering the cell content in a custom way.
|
|
7330
|
+
* The base implementation returns undefined (default rendering) and should be
|
|
7331
|
+
* overridden by subclasses that support custom cell rendering.
|
|
7332
|
+
*
|
|
7333
|
+
* @param {number} _rowIndex - The index of the row
|
|
7334
|
+
* @param {number} _columnIndex - The index of the column
|
|
7335
|
+
* @returns {CellRendererIf | undefined} A cell renderer instance, or undefined for default rendering
|
|
7336
|
+
*
|
|
7337
|
+
* @example
|
|
7338
|
+
* // Override in a subclass to provide custom cell renderers
|
|
7339
|
+
* getCellRenderer(rowIndex: number, columnIndex: number): CellRendererIf | undefined {
|
|
7340
|
+
* // Get renderer from column definition
|
|
7341
|
+
* const columnDef = this.columnDefs[columnIndex];
|
|
7342
|
+
* return columnDef?.rendererMap?.[this.areaIdent];
|
|
7343
|
+
* }
|
|
7344
|
+
*/
|
|
6215
7345
|
getCellRenderer(e, t) {
|
|
6216
7346
|
}
|
|
7347
|
+
/**
|
|
7348
|
+
* Returns the column span value for the cell at the specified row and column indices.
|
|
7349
|
+
* A colspan value of N means the cell spans N columns horizontally.
|
|
7350
|
+
* The base implementation returns 0 (no spanning) and should be overridden by
|
|
7351
|
+
* subclasses that support column spanning.
|
|
7352
|
+
*
|
|
7353
|
+
* @param {number} _rowIndex - The index of the row
|
|
7354
|
+
* @param {number} _columnIndex - The index of the column
|
|
7355
|
+
* @returns {number} The colspan value (number of columns the cell spans)
|
|
7356
|
+
*
|
|
7357
|
+
* @example
|
|
7358
|
+
* // Override in a subclass to implement column spanning
|
|
7359
|
+
* getColspanAt(rowIndex: number, columnIndex: number): number {
|
|
7360
|
+
* // Special case: first row, first column spans 3 columns
|
|
7361
|
+
* if (rowIndex === 0 && columnIndex === 0) return 3;
|
|
7362
|
+
*
|
|
7363
|
+
* // No spanning for other cells
|
|
7364
|
+
* return 1;
|
|
7365
|
+
* }
|
|
7366
|
+
*/
|
|
6217
7367
|
getColspanAt(e, t) {
|
|
6218
7368
|
return 0;
|
|
6219
7369
|
}
|
|
7370
|
+
/**
|
|
7371
|
+
* Returns an array of CSS class names to apply to the cell at the specified row and column indices.
|
|
7372
|
+
* This method allows for custom styling of individual cells.
|
|
7373
|
+
* The base implementation returns an empty array (no custom classes) and should be
|
|
7374
|
+
* overridden by subclasses that support custom cell styling.
|
|
7375
|
+
*
|
|
7376
|
+
* @param {number} _rowIndex - The index of the row
|
|
7377
|
+
* @param {number} _columnIndex - The index of the column
|
|
7378
|
+
* @returns {string[]} An array of CSS class names
|
|
7379
|
+
*
|
|
7380
|
+
* @example
|
|
7381
|
+
* // Override in a subclass to implement custom cell classes
|
|
7382
|
+
* getCustomClassesAt(rowIndex: number, columnIndex: number): string[] {
|
|
7383
|
+
* const classes: string[] = [];
|
|
7384
|
+
*
|
|
7385
|
+
* // Add classes based on row index
|
|
7386
|
+
* if (rowIndex % 2 === 0) {
|
|
7387
|
+
* classes.push('even-row');
|
|
7388
|
+
* } else {
|
|
7389
|
+
* classes.push('odd-row');
|
|
7390
|
+
* }
|
|
7391
|
+
*
|
|
7392
|
+
* // Add classes based on cell value
|
|
7393
|
+
* const value = this.getValueAt(rowIndex, columnIndex);
|
|
7394
|
+
* if (typeof value === 'number' && value < 0) {
|
|
7395
|
+
* classes.push('negative-value');
|
|
7396
|
+
* }
|
|
7397
|
+
*
|
|
7398
|
+
* return classes;
|
|
7399
|
+
* }
|
|
7400
|
+
*/
|
|
6220
7401
|
getCustomClassesAt(e, t) {
|
|
6221
7402
|
return [];
|
|
6222
7403
|
}
|
|
7404
|
+
/**
|
|
7405
|
+
* Returns an object containing CSS style properties to apply to the cell at the specified row and column indices.
|
|
7406
|
+
* This method allows for inline styling of individual cells.
|
|
7407
|
+
* The base implementation returns undefined (no custom styles) and should be
|
|
7408
|
+
* overridden by subclasses that support custom cell styling.
|
|
7409
|
+
*
|
|
7410
|
+
* @param {number} _rowIndex - The index of the row
|
|
7411
|
+
* @param {number} _columnIndex - The index of the column
|
|
7412
|
+
* @returns {{ [key: string]: string } | undefined} An object with CSS style properties, or undefined if no custom styles
|
|
7413
|
+
*
|
|
7414
|
+
* @example
|
|
7415
|
+
* // Override in a subclass to implement custom cell styles
|
|
7416
|
+
* getCustomStyleAt(rowIndex: number, columnIndex: number): { [key: string]: string } | undefined {
|
|
7417
|
+
* // Apply background color based on value
|
|
7418
|
+
* const value = this.getValueAt(rowIndex, columnIndex);
|
|
7419
|
+
*
|
|
7420
|
+
* if (typeof value === 'number') {
|
|
7421
|
+
* // Color gradient based on value
|
|
7422
|
+
* if (value < 0) {
|
|
7423
|
+
* return { 'background-color': `rgba(255, 0, 0, ${Math.min(Math.abs(value) / 100, 0.5)})` };
|
|
7424
|
+
* } else if (value > 0) {
|
|
7425
|
+
* return { 'background-color': `rgba(0, 255, 0, ${Math.min(value / 100, 0.5)})` };
|
|
7426
|
+
* }
|
|
7427
|
+
* }
|
|
7428
|
+
*
|
|
7429
|
+
* return undefined; // No custom styles
|
|
7430
|
+
* }
|
|
7431
|
+
*/
|
|
6223
7432
|
getCustomStyleAt(e, t) {
|
|
6224
7433
|
}
|
|
7434
|
+
/**
|
|
7435
|
+
* Returns the maximum colspan value that can occur in this area model.
|
|
7436
|
+
* This value is used to optimize rendering performance.
|
|
7437
|
+
* The base implementation returns 0 (no colspans) and should be overridden by
|
|
7438
|
+
* subclasses that support column spanning.
|
|
7439
|
+
*
|
|
7440
|
+
* @returns {number} The maximum possible colspan value in this area
|
|
7441
|
+
*
|
|
7442
|
+
* @example
|
|
7443
|
+
* // Override in a subclass to specify maximum colspan
|
|
7444
|
+
* getMaxColspan(): number {
|
|
7445
|
+
* // If the model has colspans, return the maximum possible value
|
|
7446
|
+
* return 3; // If some cells span up to 3 columns
|
|
7447
|
+
* }
|
|
7448
|
+
*/
|
|
6225
7449
|
getMaxColspan() {
|
|
6226
7450
|
return 0;
|
|
6227
7451
|
}
|
|
7452
|
+
/**
|
|
7453
|
+
* Returns the maximum rowspan value that can occur in this area model.
|
|
7454
|
+
* This value is used to optimize rendering performance.
|
|
7455
|
+
* The base implementation returns 0 (no rowspans) and should be overridden by
|
|
7456
|
+
* subclasses that support row spanning.
|
|
7457
|
+
*
|
|
7458
|
+
* @returns {number} The maximum possible rowspan value in this area
|
|
7459
|
+
*
|
|
7460
|
+
* @example
|
|
7461
|
+
* // Override in a subclass to specify maximum rowspan
|
|
7462
|
+
* getMaxRowspan(): number {
|
|
7463
|
+
* // If the model has rowspans, return the maximum possible value
|
|
7464
|
+
* return 2; // If some cells span up to 2 rows
|
|
7465
|
+
* }
|
|
7466
|
+
*/
|
|
6228
7467
|
getMaxRowspan() {
|
|
6229
7468
|
return 0;
|
|
6230
7469
|
}
|
|
7470
|
+
/**
|
|
7471
|
+
* Returns the row object at the specified index.
|
|
7472
|
+
* This method provides access to the underlying data structure.
|
|
7473
|
+
* The base implementation returns undefined and should be overridden by
|
|
7474
|
+
* subclasses that have a row-based data structure.
|
|
7475
|
+
*
|
|
7476
|
+
* @param {number} _rowIndex - The index of the row
|
|
7477
|
+
* @returns {any} The row object, or undefined if the row doesn't exist
|
|
7478
|
+
*
|
|
7479
|
+
* @example
|
|
7480
|
+
* // Override in a subclass to provide access to row data
|
|
7481
|
+
* getRowByIndex(rowIndex: number): any {
|
|
7482
|
+
* if (rowIndex < 0 || rowIndex >= this.data.length) return undefined;
|
|
7483
|
+
* return this.data[rowIndex];
|
|
7484
|
+
* }
|
|
7485
|
+
*/
|
|
6231
7486
|
getRowByIndex(e) {
|
|
6232
7487
|
}
|
|
7488
|
+
/**
|
|
7489
|
+
* Returns the number of rows in this area.
|
|
7490
|
+
* This is a fundamental method that determines the vertical size of the area.
|
|
7491
|
+
* The base implementation returns 0 (no rows) and should be overridden by
|
|
7492
|
+
* all subclasses.
|
|
7493
|
+
*
|
|
7494
|
+
* @returns {number} The number of rows in the area
|
|
7495
|
+
*
|
|
7496
|
+
* @example
|
|
7497
|
+
* // Override in a subclass to provide the row count
|
|
7498
|
+
* getRowCount(): number {
|
|
7499
|
+
* return this.data.length;
|
|
7500
|
+
* }
|
|
7501
|
+
*/
|
|
6233
7502
|
getRowCount() {
|
|
6234
7503
|
return 0;
|
|
6235
7504
|
}
|
|
7505
|
+
/**
|
|
7506
|
+
* Returns the height of the row at the specified index, in pixels.
|
|
7507
|
+
* This method allows for variable row heights in the table.
|
|
7508
|
+
* The base implementation returns 0 and should be overridden by
|
|
7509
|
+
* all subclasses.
|
|
7510
|
+
*
|
|
7511
|
+
* @param {number} _rowIndex - The index of the row
|
|
7512
|
+
* @returns {number} The height of the row in pixels
|
|
7513
|
+
*
|
|
7514
|
+
* @example
|
|
7515
|
+
* // Override in a subclass to provide fixed row heights
|
|
7516
|
+
* getRowHeight(rowIndex: number): number {
|
|
7517
|
+
* return 30; // 30px for all rows
|
|
7518
|
+
* }
|
|
7519
|
+
*
|
|
7520
|
+
* @example
|
|
7521
|
+
* // Override in a subclass to provide variable row heights
|
|
7522
|
+
* getRowHeight(rowIndex: number): number {
|
|
7523
|
+
* // First row is taller
|
|
7524
|
+
* if (rowIndex === 0) return 50;
|
|
7525
|
+
*
|
|
7526
|
+
* // Default height for other rows
|
|
7527
|
+
* return 30;
|
|
7528
|
+
* }
|
|
7529
|
+
*/
|
|
6236
7530
|
getRowHeight(e) {
|
|
6237
7531
|
return 0;
|
|
6238
7532
|
}
|
|
7533
|
+
/**
|
|
7534
|
+
* Returns the row span value for the cell at the specified row and column indices.
|
|
7535
|
+
* A rowspan value of N means the cell spans N rows vertically.
|
|
7536
|
+
* The base implementation returns 0 (no spanning) and should be overridden by
|
|
7537
|
+
* subclasses that support row spanning.
|
|
7538
|
+
*
|
|
7539
|
+
* @param {number} _rowIndex - The index of the row
|
|
7540
|
+
* @param {number} _columnIndex - The index of the column
|
|
7541
|
+
* @returns {number} The rowspan value (number of rows the cell spans)
|
|
7542
|
+
*
|
|
7543
|
+
* @example
|
|
7544
|
+
* // Override in a subclass to implement row spanning
|
|
7545
|
+
* getRowspanAt(rowIndex: number, columnIndex: number): number {
|
|
7546
|
+
* // Special case: first column spans 2 rows at the beginning
|
|
7547
|
+
* if (columnIndex === 0 && rowIndex % 2 === 0) return 2;
|
|
7548
|
+
*
|
|
7549
|
+
* // No spanning for other cells
|
|
7550
|
+
* return 1;
|
|
7551
|
+
* }
|
|
7552
|
+
*/
|
|
6239
7553
|
getRowspanAt(e, t) {
|
|
6240
7554
|
return 0;
|
|
6241
7555
|
}
|
|
7556
|
+
/**
|
|
7557
|
+
* Returns the tooltip text for the cell at the specified row and column indices.
|
|
7558
|
+
* This tooltip will be displayed when the user hovers over the cell.
|
|
7559
|
+
* The base implementation returns undefined (no tooltip) and should be overridden by
|
|
7560
|
+
* subclasses that support tooltips.
|
|
7561
|
+
*
|
|
7562
|
+
* @param {number} _rowIndex - The index of the row
|
|
7563
|
+
* @param {number} _columnIndex - The index of the column
|
|
7564
|
+
* @returns {any} The tooltip content (usually a string)
|
|
7565
|
+
*
|
|
7566
|
+
* @example
|
|
7567
|
+
* // Override in a subclass to provide tooltips
|
|
7568
|
+
* getTooltipAt(rowIndex: number, columnIndex: number): any {
|
|
7569
|
+
* // Use the cell value as the tooltip
|
|
7570
|
+
* return this.getValueAt(rowIndex, columnIndex);
|
|
7571
|
+
*
|
|
7572
|
+
* // Or provide a more detailed tooltip
|
|
7573
|
+
* // const value = this.getValueAt(rowIndex, columnIndex);
|
|
7574
|
+
* // return `Value: ${value}\nRow: ${rowIndex}\nColumn: ${columnIndex}`;
|
|
7575
|
+
* }
|
|
7576
|
+
*/
|
|
6242
7577
|
getTooltipAt(e, t) {
|
|
6243
7578
|
}
|
|
7579
|
+
/**
|
|
7580
|
+
* Returns the value of the cell at the specified row and column indices.
|
|
7581
|
+
* This is one of the most important methods in the area model, as it provides
|
|
7582
|
+
* the actual data to be displayed in each cell.
|
|
7583
|
+
* The base implementation returns undefined and should be overridden by
|
|
7584
|
+
* all subclasses.
|
|
7585
|
+
*
|
|
7586
|
+
* @param {number} _rowIndex - The index of the row
|
|
7587
|
+
* @param {number} _columnIndex - The index of the column
|
|
7588
|
+
* @returns {any} The value at the specified cell
|
|
7589
|
+
*
|
|
7590
|
+
* @example
|
|
7591
|
+
* // Override in a subclass for a 2D array model
|
|
7592
|
+
* getValueAt(rowIndex: number, columnIndex: number): any {
|
|
7593
|
+
* if (rowIndex < 0 || rowIndex >= this.data.length) return undefined;
|
|
7594
|
+
* const row = this.data[rowIndex];
|
|
7595
|
+
* if (columnIndex < 0 || columnIndex >= row.length) return undefined;
|
|
7596
|
+
* return row[columnIndex];
|
|
7597
|
+
* }
|
|
7598
|
+
*
|
|
7599
|
+
* @example
|
|
7600
|
+
* // Override in a subclass for an object array model
|
|
7601
|
+
* getValueAt(rowIndex: number, columnIndex: number): any {
|
|
7602
|
+
* const row = this.getRowByIndex(rowIndex);
|
|
7603
|
+
* if (!row) return undefined;
|
|
7604
|
+
*
|
|
7605
|
+
* const property = this.columnDefs[columnIndex].property;
|
|
7606
|
+
* return row[property];
|
|
7607
|
+
* }
|
|
7608
|
+
*/
|
|
6244
7609
|
getValueAt(e, t) {
|
|
6245
7610
|
}
|
|
7611
|
+
/**
|
|
7612
|
+
* Returns a string representation of the cell value at the specified row and column indices.
|
|
7613
|
+
* This method is used when exporting the table data or copying to clipboard.
|
|
7614
|
+
* The base implementation returns an empty string and should be overridden by
|
|
7615
|
+
* subclasses that need custom text conversion.
|
|
7616
|
+
*
|
|
7617
|
+
* @param {number} _rowIndex - The index of the row
|
|
7618
|
+
* @param {number} _columnIndex - The index of the column
|
|
7619
|
+
* @returns {string} The text value of the specified cell
|
|
7620
|
+
*
|
|
7621
|
+
* @example
|
|
7622
|
+
* // Override in a subclass to provide text representation
|
|
7623
|
+
* getTextValueAt(rowIndex: number, columnIndex: number): string {
|
|
7624
|
+
* const value = this.getValueAt(rowIndex, columnIndex);
|
|
7625
|
+
*
|
|
7626
|
+
* // Handle different data types appropriately
|
|
7627
|
+
* if (value === null || value === undefined) return '';
|
|
7628
|
+
* if (value instanceof Date) return value.toISOString();
|
|
7629
|
+
* return String(value);
|
|
7630
|
+
* }
|
|
7631
|
+
*/
|
|
6246
7632
|
getTextValueAt(e, t) {
|
|
6247
7633
|
return "";
|
|
6248
7634
|
}
|
|
7635
|
+
/**
|
|
7636
|
+
* Returns the Y-coordinate (in pixels) of the top of the row at the specified index.
|
|
7637
|
+
* This method is used for scrolling and positioning rows in the viewport.
|
|
7638
|
+
* The base implementation returns 0 and should be overridden by
|
|
7639
|
+
* subclasses that support scrolling.
|
|
7640
|
+
*
|
|
7641
|
+
* @param {number} _rowIndex - The index of the row
|
|
7642
|
+
* @returns {number} The Y-coordinate of the top of the row, in pixels
|
|
7643
|
+
*
|
|
7644
|
+
* @example
|
|
7645
|
+
* // Override in a subclass with fixed row heights
|
|
7646
|
+
* getYPosByRowIndex(rowIndex: number): number {
|
|
7647
|
+
* return rowIndex * this.defaultRowHeight;
|
|
7648
|
+
* }
|
|
7649
|
+
*
|
|
7650
|
+
* @example
|
|
7651
|
+
* // Override in a subclass with variable row heights
|
|
7652
|
+
* getYPosByRowIndex(rowIndex: number): number {
|
|
7653
|
+
* // Use a pre-calculated array of Y-positions
|
|
7654
|
+
* return this.yPositions[rowIndex];
|
|
7655
|
+
*
|
|
7656
|
+
* // Or calculate on-the-fly
|
|
7657
|
+
* // let yPos = 0;
|
|
7658
|
+
* // for (let i = 0; i < rowIndex; i++) {
|
|
7659
|
+
* // yPos += this.getRowHeight(i);
|
|
7660
|
+
* // }
|
|
7661
|
+
* // return yPos;
|
|
7662
|
+
* }
|
|
7663
|
+
*/
|
|
6249
7664
|
getYPosByRowIndex(e) {
|
|
6250
7665
|
return 0;
|
|
6251
7666
|
}
|
|
7667
|
+
/**
|
|
7668
|
+
* Initializes the area model.
|
|
7669
|
+
* This method is called internally by the TableModel during initialization.
|
|
7670
|
+
* It can be used to perform any necessary setup, such as calculating row positions.
|
|
7671
|
+
* The base implementation does nothing and can be overridden by
|
|
7672
|
+
* subclasses that need initialization.
|
|
7673
|
+
*
|
|
7674
|
+
* @returns {void}
|
|
7675
|
+
*
|
|
7676
|
+
* @example
|
|
7677
|
+
* // Override in a subclass to perform initialization
|
|
7678
|
+
* init(): void {
|
|
7679
|
+
* // Calculate y-positions for all rows
|
|
7680
|
+
* this.yPositions = [];
|
|
7681
|
+
* let currentY = 0;
|
|
7682
|
+
*
|
|
7683
|
+
* for (let i = 0; i < this.getRowCount(); i++) {
|
|
7684
|
+
* this.yPositions[i] = currentY;
|
|
7685
|
+
* currentY += this.getRowHeight(i);
|
|
7686
|
+
* }
|
|
7687
|
+
* }
|
|
7688
|
+
*/
|
|
6252
7689
|
init() {
|
|
6253
7690
|
}
|
|
7691
|
+
/**
|
|
7692
|
+
* Determines whether the cell at the specified row and column indices is editable.
|
|
7693
|
+
* If true, the user can edit the cell content.
|
|
7694
|
+
* The base implementation returns false (not editable) and should be overridden by
|
|
7695
|
+
* subclasses that support cell editing.
|
|
7696
|
+
*
|
|
7697
|
+
* @param {number} _rowIndex - The index of the row
|
|
7698
|
+
* @param {number} _columnIndex - The index of the column
|
|
7699
|
+
* @returns {boolean} True if the cell is editable, false otherwise
|
|
7700
|
+
*
|
|
7701
|
+
* @example
|
|
7702
|
+
* // Override in a subclass to implement cell editability
|
|
7703
|
+
* isEditable(rowIndex: number, columnIndex: number): boolean {
|
|
7704
|
+
* // Header cells are not editable
|
|
7705
|
+
* if (this.areaIdent === 'header') return false;
|
|
7706
|
+
*
|
|
7707
|
+
* // First column is not editable (e.g., ID column)
|
|
7708
|
+
* if (columnIndex === 0) return false;
|
|
7709
|
+
*
|
|
7710
|
+
* // Other cells in the body are editable
|
|
7711
|
+
* return this.areaIdent === 'body';
|
|
7712
|
+
* }
|
|
7713
|
+
*/
|
|
6254
7714
|
isEditable(e, t) {
|
|
6255
7715
|
return !1;
|
|
6256
7716
|
}
|
|
7717
|
+
/**
|
|
7718
|
+
* Determines whether this area supports filtering.
|
|
7719
|
+
* If true, the area can be filtered using the externalFilterChanged method.
|
|
7720
|
+
* The base implementation returns false (not filterable) and should be overridden by
|
|
7721
|
+
* subclasses that support filtering.
|
|
7722
|
+
*
|
|
7723
|
+
* @returns {boolean} True if the area is filterable, false otherwise
|
|
7724
|
+
*
|
|
7725
|
+
* @example
|
|
7726
|
+
* // Override in a subclass to enable filtering
|
|
7727
|
+
* isFilterable(): boolean {
|
|
7728
|
+
* // Only the body area is filterable
|
|
7729
|
+
* return this.areaIdent === 'body';
|
|
7730
|
+
* }
|
|
7731
|
+
*/
|
|
6257
7732
|
isFilterable() {
|
|
6258
7733
|
return !1;
|
|
6259
7734
|
}
|
|
7735
|
+
/**
|
|
7736
|
+
* Determines whether the row at the specified index is checkable.
|
|
7737
|
+
* If true, a checkbox will be rendered at the beginning of the row.
|
|
7738
|
+
* The base implementation returns false (not checkable) and should be overridden by
|
|
7739
|
+
* subclasses that support row selection.
|
|
7740
|
+
*
|
|
7741
|
+
* @param {number} _rowIndex - The index of the row
|
|
7742
|
+
* @returns {boolean} True if the row is checkable, false otherwise
|
|
7743
|
+
*
|
|
7744
|
+
* @example
|
|
7745
|
+
* // Override in a subclass to implement row checkability
|
|
7746
|
+
* isRowCheckable(rowIndex: number): boolean {
|
|
7747
|
+
* // All rows in the body are checkable
|
|
7748
|
+
* if (this.areaIdent !== 'body') return false;
|
|
7749
|
+
*
|
|
7750
|
+
* // Except for special rows
|
|
7751
|
+
* const row = this.getRowByIndex(rowIndex);
|
|
7752
|
+
* return row && !row.locked;
|
|
7753
|
+
* }
|
|
7754
|
+
*/
|
|
6260
7755
|
isRowCheckable(e) {
|
|
6261
7756
|
return !1;
|
|
6262
7757
|
}
|
|
7758
|
+
/**
|
|
7759
|
+
* Returns the checked state of the row at the specified index.
|
|
7760
|
+
* The base implementation returns undefined (not checked) and should be overridden by
|
|
7761
|
+
* subclasses that support row selection.
|
|
7762
|
+
*
|
|
7763
|
+
* @param {number} _rowIndex - The index of the row
|
|
7764
|
+
* @returns {CheckedType | undefined} The checked state of the row (true, false, or 'indeterminate'),
|
|
7765
|
+
* or undefined if the row is not checkable
|
|
7766
|
+
*
|
|
7767
|
+
* @example
|
|
7768
|
+
* // Override in a subclass to implement row checked state
|
|
7769
|
+
* isRowChecked(rowIndex: number): CheckedType | undefined {
|
|
7770
|
+
* if (!this.rowSelectionModel) return undefined;
|
|
7771
|
+
*
|
|
7772
|
+
* const row = this.getRowByIndex(rowIndex);
|
|
7773
|
+
* return this.rowSelectionModel.isRowChecked(row);
|
|
7774
|
+
* }
|
|
7775
|
+
*/
|
|
6263
7776
|
isRowChecked(e) {
|
|
6264
7777
|
}
|
|
7778
|
+
/**
|
|
7779
|
+
* Determines whether the cell at the specified row and column indices is selectable.
|
|
7780
|
+
* If true, the user can select the cell.
|
|
7781
|
+
* The base implementation returns false (not selectable) and should be overridden by
|
|
7782
|
+
* subclasses that support cell selection.
|
|
7783
|
+
*
|
|
7784
|
+
* @param {number} _rowIndex - The index of the row
|
|
7785
|
+
* @param {number} _columnIndex - The index of the column
|
|
7786
|
+
* @returns {boolean} True if the cell is selectable, false otherwise
|
|
7787
|
+
*
|
|
7788
|
+
* @example
|
|
7789
|
+
* // Override in a subclass to implement cell selectability
|
|
7790
|
+
* isSelectable(rowIndex: number, columnIndex: number): boolean {
|
|
7791
|
+
* // All cells in the body are selectable
|
|
7792
|
+
* return this.areaIdent === 'body';
|
|
7793
|
+
* }
|
|
7794
|
+
*/
|
|
6265
7795
|
isSelectable(e, t) {
|
|
6266
7796
|
return !1;
|
|
6267
7797
|
}
|
|
7798
|
+
/**
|
|
7799
|
+
* Sets the checked state of the row at the specified index.
|
|
7800
|
+
* The base implementation does nothing and should be overridden by
|
|
7801
|
+
* subclasses that support row selection.
|
|
7802
|
+
*
|
|
7803
|
+
* @param {number} _rowIndex - The index of the row
|
|
7804
|
+
* @param {boolean} _checked - The new checked state
|
|
7805
|
+
* @returns {void}
|
|
7806
|
+
*
|
|
7807
|
+
* @example
|
|
7808
|
+
* // Override in a subclass to implement row checking
|
|
7809
|
+
* setRowChecked(rowIndex: number, checked: boolean): void {
|
|
7810
|
+
* if (!this.rowSelectionModel) return;
|
|
7811
|
+
*
|
|
7812
|
+
* const row = this.getRowByIndex(rowIndex);
|
|
7813
|
+
* if (row) {
|
|
7814
|
+
* this.rowSelectionModel.checkRow(row, checked);
|
|
7815
|
+
* }
|
|
7816
|
+
* }
|
|
7817
|
+
*/
|
|
6268
7818
|
setRowChecked(e, t) {
|
|
6269
7819
|
}
|
|
7820
|
+
/**
|
|
7821
|
+
* Sets the value of a cell at the specified row and column indices.
|
|
7822
|
+
* This method is called when a cell is edited by the user or programmatically.
|
|
7823
|
+
* The base implementation returns false (value not set) and should be overridden by
|
|
7824
|
+
* subclasses that support cell editing.
|
|
7825
|
+
*
|
|
7826
|
+
* @param {number} _rowIndex - The index of the row containing the cell
|
|
7827
|
+
* @param {number} _columnIndex - The index of the column containing the cell
|
|
7828
|
+
* @param {any} _value - The new value to set
|
|
7829
|
+
* @returns {boolean} - True if the value was successfully set, false otherwise
|
|
7830
|
+
*
|
|
7831
|
+
* @example
|
|
7832
|
+
* // Override in a subclass to implement cell value setting
|
|
7833
|
+
* setValue(rowIndex: number, columnIndex: number, value: any): boolean {
|
|
7834
|
+
* // Check if the cell is editable
|
|
7835
|
+
* if (!this.isEditable(rowIndex, columnIndex)) return false;
|
|
7836
|
+
*
|
|
7837
|
+
* // For a 2D array model
|
|
7838
|
+
* if (rowIndex >= 0 && rowIndex < this.data.length) {
|
|
7839
|
+
* const row = this.data[rowIndex];
|
|
7840
|
+
* if (columnIndex >= 0 && columnIndex < row.length) {
|
|
7841
|
+
* row[columnIndex] = value;
|
|
7842
|
+
* return true;
|
|
7843
|
+
* }
|
|
7844
|
+
* }
|
|
7845
|
+
*
|
|
7846
|
+
* return false;
|
|
7847
|
+
* }
|
|
7848
|
+
*/
|
|
6270
7849
|
setValue(e, t, s) {
|
|
6271
7850
|
return !1;
|
|
6272
7851
|
}
|
|
@@ -6468,12 +8047,12 @@ class $s {
|
|
|
6468
8047
|
return t.join(" ").toLowerCase();
|
|
6469
8048
|
}
|
|
6470
8049
|
}
|
|
6471
|
-
class
|
|
8050
|
+
class Vs {
|
|
6472
8051
|
static bodyRenderer(e) {
|
|
6473
8052
|
return new I(void 0, e, void 0);
|
|
6474
8053
|
}
|
|
6475
8054
|
}
|
|
6476
|
-
class
|
|
8055
|
+
class Bs {
|
|
6477
8056
|
constructor(e, t = !0, s = !1) {
|
|
6478
8057
|
this.property = e, this.skipCheckableCheck = t, this.readonly = s;
|
|
6479
8058
|
}
|
|
@@ -6681,7 +8260,7 @@ class $ {
|
|
|
6681
8260
|
this.action = e, this.label = t, this.icon = s, this.elementClass = o, this.elementType = i, this.enabled = r;
|
|
6682
8261
|
}
|
|
6683
8262
|
}
|
|
6684
|
-
class
|
|
8263
|
+
class Lt {
|
|
6685
8264
|
constructor(e, t) {
|
|
6686
8265
|
this.actionEventListener = e, this.crudActions = t;
|
|
6687
8266
|
}
|
|
@@ -6891,7 +8470,7 @@ class to {
|
|
|
6891
8470
|
this.minValue = e, this.minColor = t, this.middleValue = s, this.middleColor = o, this.maxValue = i, this.maxColor = r;
|
|
6892
8471
|
}
|
|
6893
8472
|
}
|
|
6894
|
-
class
|
|
8473
|
+
class Ot {
|
|
6895
8474
|
constructor(e = !0, t = !0, s = (r, n) => r * 10 + 10, o = 50, i = 450) {
|
|
6896
8475
|
this.autoCalc = e, this.takeHeaderLabelsIntoAccount = t, this.charCountToWidth = s, this.minWidth = o, this.maxWidth = i;
|
|
6897
8476
|
}
|
|
@@ -7044,7 +8623,7 @@ class $t {
|
|
|
7044
8623
|
], this.tableActions = [
|
|
7045
8624
|
new $("CREATE", "Create", "", "", "button"),
|
|
7046
8625
|
new $("DELETE_SELECTED", "Delete Selected", "", "", "button")
|
|
7047
|
-
], this.autoAddActionColumn = !0, this.columnWidths = new
|
|
8626
|
+
], this.autoAddActionColumn = !0, this.columnWidths = new Ot(), this.calcFixedRightColumnCount = (e) => e > 6 ? 1 : 0, this.getHeadersInit = () => ({}), this.getIdKey = () => "id", this.getIdByObject = (e) => (this.getIdKey() ?? "id") in e ? e.id : e, this.fetchList = (e) => {
|
|
7048
8627
|
const t = e.getHeadersInit ? e.getHeadersInit() : {};
|
|
7049
8628
|
let s = e.urls.list.url, o = e.urls.list.method ?? "GET";
|
|
7050
8629
|
return fetch(s, {
|
|
@@ -7128,12 +8707,12 @@ class so {
|
|
|
7128
8707
|
);
|
|
7129
8708
|
w.rendererMap = new I(
|
|
7130
8709
|
void 0,
|
|
7131
|
-
new
|
|
8710
|
+
new Lt(this, e.singleRowActions),
|
|
7132
8711
|
void 0
|
|
7133
8712
|
), p.push(w);
|
|
7134
8713
|
}
|
|
7135
8714
|
const m = 0, f = e.calcFixedRightColumnCount(p.length);
|
|
7136
|
-
this.tableModel =
|
|
8715
|
+
this.tableModel = V.buildByTypedRowsParam({
|
|
7137
8716
|
rows: i,
|
|
7138
8717
|
columnDefs: p,
|
|
7139
8718
|
tableOptions: this.tableOptions,
|
|
@@ -7244,27 +8823,27 @@ class oo {
|
|
|
7244
8823
|
export {
|
|
7245
8824
|
ue as AbstractAreaModel,
|
|
7246
8825
|
We as ActionEvent,
|
|
7247
|
-
|
|
7248
|
-
|
|
8826
|
+
Lt as ActionsCellRenderer,
|
|
8827
|
+
Oe as AnyPropertyType,
|
|
7249
8828
|
Ds as AreaMapFactory,
|
|
7250
|
-
|
|
7251
|
-
|
|
8829
|
+
Os as AreaModel,
|
|
8830
|
+
F as AreaModelArrayOfArrays,
|
|
7252
8831
|
_s as AreaModelCellGroups,
|
|
7253
|
-
|
|
7254
|
-
|
|
8832
|
+
P as AreaModelHidden,
|
|
8833
|
+
L as AreaModelObjectArray,
|
|
7255
8834
|
Te as AreaModelObjectArrayWithColumndefs,
|
|
7256
8835
|
Ae as AreaModelTree,
|
|
7257
8836
|
I as AreaObjectMap,
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
8837
|
+
B as ArrayPropertyType,
|
|
8838
|
+
Ls as AutoRestoreOptions,
|
|
8839
|
+
Bt as AvoidDoubleExecution,
|
|
7261
8840
|
Ye as BooleanPropertyType,
|
|
7262
|
-
|
|
7263
|
-
|
|
8841
|
+
Ft as CellGroup,
|
|
8842
|
+
Pt as CellGroupExt,
|
|
7264
8843
|
ae as CellGroupExtCellRenderer,
|
|
7265
8844
|
A as CellRange,
|
|
7266
8845
|
T as CellgroupFactory,
|
|
7267
|
-
|
|
8846
|
+
Bs as CheckboxBooleanPropertyCellRenderer,
|
|
7268
8847
|
Ie as CheckboxCellRenderer,
|
|
7269
8848
|
ks as CheckboxColumnDef,
|
|
7270
8849
|
Tt as CheckboxModel,
|
|
@@ -7274,7 +8853,7 @@ export {
|
|
|
7274
8853
|
eo as ColorRgb,
|
|
7275
8854
|
H as ColumnDef,
|
|
7276
8855
|
Ht as ColumnDefGenerator,
|
|
7277
|
-
|
|
8856
|
+
Ot as ColumnWidths,
|
|
7278
8857
|
Qe as ConvenienceDomService,
|
|
7279
8858
|
q as CopyService,
|
|
7280
8859
|
$ as CrudAction,
|
|
@@ -7297,10 +8876,10 @@ export {
|
|
|
7297
8876
|
ut as GeCellIndices,
|
|
7298
8877
|
K as GeCssColorUtil,
|
|
7299
8878
|
$s as GeFilterService,
|
|
7300
|
-
|
|
8879
|
+
Fs as GeKeyEvent,
|
|
7301
8880
|
fe as GeModelChangeEvent,
|
|
7302
8881
|
he as GeMouseEvent,
|
|
7303
|
-
|
|
8882
|
+
O as GeoData,
|
|
7304
8883
|
_ as Icon,
|
|
7305
8884
|
vs as IndexAndPx,
|
|
7306
8885
|
wt as InputCellRenderer,
|
|
@@ -7318,12 +8897,12 @@ export {
|
|
|
7318
8897
|
D as ObjectPropertyType,
|
|
7319
8898
|
gt as OsxShortcutActionIdMapping,
|
|
7320
8899
|
De as PROPERTY_TYPE_KEY_ANY,
|
|
7321
|
-
|
|
8900
|
+
Le as PROPERTY_TYPE_KEY_ARRAY,
|
|
7322
8901
|
de as PROPERTY_TYPE_KEY_BOOLEAN,
|
|
7323
|
-
|
|
8902
|
+
Fe as PROPERTY_TYPE_KEY_NULL,
|
|
7324
8903
|
ce as PROPERTY_TYPE_KEY_NUMBER,
|
|
7325
8904
|
U as PROPERTY_TYPE_KEY_OBJECT,
|
|
7326
|
-
|
|
8905
|
+
Pe as PROPERTY_TYPE_KEY_STRING,
|
|
7327
8906
|
j as PROPERTY_TYPE_KEY_UNDEFINED,
|
|
7328
8907
|
Me as Padding,
|
|
7329
8908
|
qs as PositiveAndNegativeNumberRenderer,
|
|
@@ -7331,7 +8910,7 @@ export {
|
|
|
7331
8910
|
_e as PropertyItem,
|
|
7332
8911
|
Wt as PropertyTypeService,
|
|
7333
8912
|
ct as RenderScope,
|
|
7334
|
-
|
|
8913
|
+
Vs as Renderer,
|
|
7335
8914
|
kt as RequestChunk,
|
|
7336
8915
|
vt as ResizeHandler,
|
|
7337
8916
|
Nt as SchemeGenerator,
|
|
@@ -7343,15 +8922,15 @@ export {
|
|
|
7343
8922
|
yt as SimpleDomService,
|
|
7344
8923
|
y as Size,
|
|
7345
8924
|
dt as SortItem,
|
|
7346
|
-
|
|
8925
|
+
Ve as SortedOptions,
|
|
7347
8926
|
Ks as StarRatingCellRenderer,
|
|
7348
8927
|
rt as StoreStateCollapsedExpandService,
|
|
7349
8928
|
ot as StoreStateScrollPosService,
|
|
7350
8929
|
nt as StoreStateSortingService,
|
|
7351
8930
|
je as StringPropertyType,
|
|
7352
8931
|
st as TableApi,
|
|
7353
|
-
|
|
7354
|
-
|
|
8932
|
+
Ps as TableCellUpdateEvent,
|
|
8933
|
+
V as TableFactory,
|
|
7355
8934
|
oe as TableModel,
|
|
7356
8935
|
It as TableModelAndOptions,
|
|
7357
8936
|
J as TableOptions,
|
|
@@ -7422,6 +9001,6 @@ export {
|
|
|
7422
9001
|
ps as px70,
|
|
7423
9002
|
us as px80,
|
|
7424
9003
|
hs as px90,
|
|
7425
|
-
|
|
9004
|
+
Vt as throttle,
|
|
7426
9005
|
Je as trimArraySuffixes
|
|
7427
9006
|
};
|