@guiexpert/table 1.1.79 → 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.js CHANGED
@@ -1198,28 +1198,128 @@ class Be {
1198
1198
  }
1199
1199
  }
1200
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
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
- * return row count of filtered rows
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 L 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
- * @return {T[]} An array containing the filtered (and sorted) rows.
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 L 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 L 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 based on the provided events.
1639
+ * Updates the cells in the table with the provided cell update events.
1310
1640
  *
1311
- * @param {TableCellUpdateEventIf[]} events - The array of events representing the updates to perform on the cells.
1312
- * @param {boolean} [repaintAll=false] - Optional parameter indicating whether to repaint all cells or not. Default value is false. If true, the full table will be rendered. If false, the table cell will be rendered immediately.
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
- * @return {void} - This method doesn't return anything.
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 the external filter has changed.
1723
+ * Notifies the table that an external filter has been changed and needs to be applied.
1321
1724
  *
1322
- * @return {void}
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 body to the specified pixel coordinates.
1767
+ * Scrolls the table content to the specified pixel coordinates.
1329
1768
  *
1330
- * @param {number} px - The horizontal pixel coordinate to scroll to. Defaults to 0.
1331
- * @param {number} py - The vertical pixel coordinate to scroll to. Defaults to 0.
1332
- * @return {void}
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 index in both horizontal and vertical directions.
1871
+ * Scrolls the table to display the specified row and column indices at the top-left corner of the viewport.
1339
1872
  *
1340
- * @param {number} indexX - The index of the column to scroll to in the horizontal direction. Default is 0.
1341
- * @param {number} indexY - The index of the row to scroll to in the vertical direction. Default is 0.
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
- * @return undefined
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 calls the repaint method of the tableScope object
1405
- * to update and redraw the table based on the latest data.
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
- * Repaints the table scope with hard repaint.
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
- * @return {void}
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 of the table.
1433
- * The table will be rendered automatically.
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 scope.
2106
+ * Sets the selection model for the table.
1442
2107
  *
1443
- * @param {SelectionModel} sm - The selection model to be set.
1444
- * @param {boolean} [repaint=true] - Indicates whether the table should be repainted after setting the selection model. Default value is true.
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
- * @return {void}
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 mapping of shortcuts to corresponding action in the current table scope.
2146
+ * Retrieves the shortcut action mapping from the table's shortcut service.
1463
2147
  *
1464
- * @return {ShortcutActionIdMapping} The mapping of shortcuts to corresponding action.
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
+ * }
2171
+ *
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
- * @return {Promise<string>} - A promise that resolves with the copied data as a string.
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
- * Generates and downloads an Excel file based on the table data.
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.
1483
2225
  *
1484
- * @param {string} fileName - The name of the Excel file to be downloaded. Defaults to 'table.xlsx'.
1485
- * @param {string} author - The author of the Excel file. If not provided, it will remain empty.
1486
- * @return {void} No return value. Initiates a file download of the Excel document.
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: '')
2234
+ *
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
- * Retrieves the current scope of the table.
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
- * @returns {TableScope} The current scope of the table.
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
- * Retrieves the selection model of the table.
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
- * @return {SelectionModelIf | undefined} The selection model of the table,
1513
- * or undefined if no selection model is available.
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();
@@ -1981,28 +2790,191 @@ class st {
1981
2790
  * const tableApi = new TableApi(tableScope);
1982
2791
  * const firstVisibleIndex = tableApi.getFirstVisibleRowIndex();
1983
2792
  *
1984
- * // Use the index for scroll position calculations
1985
- * if (firstVisibleIndex >= 0) {
1986
- * // Perform operations with the first visible row
1987
- * console.log(`First visible row index: ${firstVisibleIndex}`);
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);
1988
2885
  * }
1989
2886
  * ```
1990
2887
  */
1991
- getFirstVisibleRowIndex() {
1992
- return this.tableScope.getFirstVisibleRowIndex();
1993
- }
1994
- getFirstFullVisibleRowIndex() {
1995
- return this.tableScope.getFirstFullVisibleRowIndex();
1996
- }
1997
- getLastVisibleRowIndex() {
1998
- return this.tableScope.getLastVisibleRowIndex();
1999
- }
2000
2888
  getLastFullVisibleRowIndex() {
2001
2889
  return this.tableScope.getLastFullVisibleRowIndex();
2002
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
+ */
2003
2933
  setLoggingActive(e) {
2004
2934
  this.tableScope.loggingActive = e;
2005
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...
2973
+ *
2974
+ * // Disable logging when finished
2975
+ * tableApi.setLoggingActive(false);
2976
+ * }
2977
+ */
2006
2978
  isLoggingActive() {
2007
2979
  return this.tableScope.loggingActive;
2008
2980
  }
@@ -5471,6 +6443,35 @@ class oe {
5471
6443
  }
5472
6444
  }
5473
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
+ */
5474
6475
  constructor(e, t, s, o, i = "ge-selected-row", r = "ge-focused-row") {
5475
6476
  super(
5476
6477
  e,
@@ -6231,70 +7232,620 @@ class Os {
6231
7232
  constructor() {
6232
7233
  this.areaIdent = "body", this.rowSelectionModel = void 0;
6233
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
+ */
6234
7252
  changeColumnOrder(e, t) {
6235
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
+ */
6236
7283
  doSort(e) {
6237
7284
  return !1;
6238
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
+ */
6239
7307
  sort(e) {
6240
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
+ */
6241
7325
  externalFilterChanged(e) {
6242
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
+ */
6243
7345
  getCellRenderer(e, t) {
6244
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
+ */
6245
7367
  getColspanAt(e, t) {
6246
7368
  return 0;
6247
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
+ */
6248
7401
  getCustomClassesAt(e, t) {
6249
7402
  return [];
6250
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
+ */
6251
7432
  getCustomStyleAt(e, t) {
6252
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
+ */
6253
7449
  getMaxColspan() {
6254
7450
  return 0;
6255
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
+ */
6256
7467
  getMaxRowspan() {
6257
7468
  return 0;
6258
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
+ */
6259
7486
  getRowByIndex(e) {
6260
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
+ */
6261
7502
  getRowCount() {
6262
7503
  return 0;
6263
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
+ */
6264
7530
  getRowHeight(e) {
6265
7531
  return 0;
6266
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
+ */
6267
7553
  getRowspanAt(e, t) {
6268
7554
  return 0;
6269
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
+ */
6270
7577
  getTooltipAt(e, t) {
6271
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
+ */
6272
7609
  getValueAt(e, t) {
6273
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
+ */
6274
7632
  getTextValueAt(e, t) {
6275
7633
  return "";
6276
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
+ */
6277
7664
  getYPosByRowIndex(e) {
6278
7665
  return 0;
6279
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
+ */
6280
7689
  init() {
6281
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
+ */
6282
7714
  isEditable(e, t) {
6283
7715
  return !1;
6284
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
+ */
6285
7732
  isFilterable() {
6286
7733
  return !1;
6287
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
+ */
6288
7755
  isRowCheckable(e) {
6289
7756
  return !1;
6290
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
+ */
6291
7776
  isRowChecked(e) {
6292
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
+ */
6293
7795
  isSelectable(e, t) {
6294
7796
  return !1;
6295
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
+ */
6296
7818
  setRowChecked(e, t) {
6297
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
+ */
6298
7849
  setValue(e, t, s) {
6299
7850
  return !1;
6300
7851
  }