@reforgium/data-grid 2.1.1 → 2.2.0

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.1.1",
2
+ "version": "2.2.0",
3
3
  "name": "@reforgium/data-grid",
4
4
  "description": "reforgium DataGrid component",
5
5
  "author": "rtommievich",
@@ -122,7 +122,7 @@ type GridTooltipContext<Data extends AnyDict = AnyDict> = {
122
122
  index: number;
123
123
  value: AnyType;
124
124
  };
125
- type GridColumnTooltip<Data extends AnyDict = AnyDict> = string | ((row: Data) => string) | TemplateRef<GridTooltipContext<AnyDict>>;
125
+ type GridColumnTooltip<Data extends AnyDict = AnyDict> = true | string | ((row: Data) => string) | TemplateRef<GridTooltipContext>;
126
126
  /**
127
127
  * Sticky column side.
128
128
  *
@@ -536,6 +536,13 @@ type GridPinnedPosition = 'top' | 'bottom';
536
536
  * - `'none'` - Disable row selection
537
537
  */
538
538
  type GridSelectMode = 'single' | 'multi' | 'none';
539
+ /**
540
+ * Sorting mode for grid columns.
541
+ *
542
+ * - `'single'` - Only one column can be sorted at a time
543
+ * - `'multi'` - Multiple columns can be sorted simultaneously
544
+ */
545
+ type GridSortMode = 'single' | 'multi';
539
546
  /**
540
547
  * Sort direction for grid columns.
541
548
  *
@@ -641,6 +648,8 @@ type DataGridConfigProvider = {
641
648
  selection: GridSelection;
642
649
  /** Number of items to display per page. */
643
650
  pageSize: number;
651
+ /** Sorting mode for grid columns. */
652
+ sortMode: GridSortMode;
644
653
  /** Height of each data row in pixels. */
645
654
  rowHeight: number;
646
655
  /** Height of the header row in pixels. */
@@ -715,6 +724,26 @@ type GridSortEvent<Data = AnyDict> = {
715
724
  key: DataKey<Data>;
716
725
  order?: GridSortOrder;
717
726
  };
727
+ /**
728
+ * Single sort item used for multi-column sorting.
729
+ *
730
+ * @template Data - Type of data objects in the grid
731
+ */
732
+ type GridSortItem<Data = AnyDict> = {
733
+ key: DataKey<Data>;
734
+ order: GridSortOrder;
735
+ };
736
+ /**
737
+ * Event emitted when multi-column sorting changes in the data grid.
738
+ *
739
+ * Contains an ordered list of sort items, where the order reflects
740
+ * the priority of sorting (first item has highest priority).
741
+ *
742
+ * @template Data - Type of data objects in the grid
743
+ */
744
+ type GridMultiSortEvent<Data = AnyDict> = {
745
+ sorts: ReadonlyArray<GridSortItem<Data>>;
746
+ };
718
747
  /**
719
748
  * Event emitted when row selection changes in the data grid.
720
749
  *
@@ -1036,6 +1065,7 @@ declare class Selector<Data extends AnyDict> {
1036
1065
  * Defaults to an empty array.
1037
1066
  */
1038
1067
  selectedKeys: _angular_core.WritableSignal<DataKey<Data>[]>;
1068
+ private selectedKeySet;
1039
1069
  /**
1040
1070
  * Computed signal indicating the overall selection state of all rows.
1041
1071
  *
@@ -1082,13 +1112,13 @@ declare class Selector<Data extends AnyDict> {
1082
1112
  * @returns The updated array of selected keys after the operation.
1083
1113
  * @throws {Error} If selection mode is `'none'`.
1084
1114
  */
1085
- select(row: Data): (string | Data[DataKey<Data>])[];
1115
+ select(row: Data): (string | (Data[DataKey<Data>] & {}))[];
1086
1116
  }
1087
1117
 
1088
1118
  type TooltipState = {
1089
1119
  text?: string;
1090
- tpl?: TemplateRef<GridTooltipContext<AnyDict>>;
1091
- ctx?: GridTooltipContext<AnyDict>;
1120
+ tpl?: TemplateRef<GridTooltipContext>;
1121
+ ctx?: GridTooltipContext;
1092
1122
  x: number;
1093
1123
  y: number;
1094
1124
  visible: boolean;
@@ -1152,6 +1182,7 @@ declare class DataGrid<Data extends AnyDict> {
1152
1182
  * of the scroll area as the user scrolls.
1153
1183
  */
1154
1184
  isRowSticky: _angular_core.InputSignal<((row: Data, index: number) => boolean) | undefined>;
1185
+ isRowDisabled: _angular_core.InputSignal<((row: Data, index: number) => boolean) | undefined>;
1155
1186
  /**
1156
1187
  * Function to choose a custom template for a row.
1157
1188
  *
@@ -1260,6 +1291,7 @@ declare class DataGrid<Data extends AnyDict> {
1260
1291
  * Default is true (0-based indexing).
1261
1292
  */
1262
1293
  pageStartFromZero: _angular_core.InputSignalWithTransform<boolean, string | boolean | undefined>;
1294
+ sortMode: _angular_core.InputSignal<GridSortMode>;
1263
1295
  /**
1264
1296
  * Event emitted when requesting data for a new page.
1265
1297
  *
@@ -1288,6 +1320,7 @@ declare class DataGrid<Data extends AnyDict> {
1288
1320
  * ```
1289
1321
  */
1290
1322
  sortChange: _angular_core.OutputEmitterRef<GridSortEvent<Data>>;
1323
+ multiSortChange: _angular_core.OutputEmitterRef<GridMultiSortEvent<Data>>;
1291
1324
  /**
1292
1325
  * Event emitted when selected rows change.
1293
1326
  *
@@ -1333,6 +1366,28 @@ declare class DataGrid<Data extends AnyDict> {
1333
1366
  cellDoubleClick: _angular_core.OutputEmitterRef<GridCellDoubleClickEvent<Data>>;
1334
1367
  vm: DataGridVm<Data>;
1335
1368
  selector: Selector<Data>;
1369
+ private sortFeature;
1370
+ private rowInteractionsFeature;
1371
+ private headerGroupsFeature;
1372
+ private infinityPageRequestFeature;
1373
+ private expanderFeature;
1374
+ private selectionReconcileFeature;
1375
+ private gridApiFeature;
1376
+ private tooltipAdapterFeature;
1377
+ private virtualScrollFeature;
1378
+ private resizeObserverFeature;
1379
+ private scrollLoopFeature;
1380
+ private lifecycleInitFeature;
1381
+ private stickyOrchestrationFeature;
1382
+ private headerMeasureFeature;
1383
+ private selectionFeatureRef?;
1384
+ private selectionFeaturePromise?;
1385
+ private tooltipFeatureRef?;
1386
+ private tooltipFeaturePromise?;
1387
+ private overlayScrollFeatureRef?;
1388
+ private overlayScrollFeaturePromise?;
1389
+ private stickyFeatureRef?;
1390
+ private stickyFeaturePromise?;
1336
1391
  private rootEl;
1337
1392
  private scrollEl;
1338
1393
  private headerEl;
@@ -1368,25 +1423,31 @@ declare class DataGrid<Data extends AnyDict> {
1368
1423
  protected expanderMap: _angular_core.WritableSignal<Map<DataKey<Data>, boolean>>;
1369
1424
  protected declarativeColumns: _angular_core.Signal<DeclarativeColumnsResult<Data>>;
1370
1425
  protected sourceColumns: _angular_core.Signal<GridColumn<Data>[]>;
1426
+ private slotsFeature;
1371
1427
  protected extendedColumns: _angular_core.Signal<GridColumn<Data>[]>;
1372
1428
  /**
1373
1429
  * Computed CSS height value based on height setting.
1374
1430
  */
1375
1431
  styleHeight: _angular_core.Signal<string>;
1376
1432
  private hideSbTimeout?;
1377
- private scrollRafId;
1378
1433
  private scrollbarRafId;
1379
1434
  private stickyRafId;
1380
- private lastInfinityPageRequested;
1381
- private lastInfinityTotal;
1382
1435
  currentSortField?: string;
1383
1436
  currentSortOrder: GridSortOrder;
1437
+ currentSorts: GridSortItem<Data>[];
1438
+ private currentSortMap;
1384
1439
  private subscription;
1385
- private observer;
1386
- private resizeSubject;
1387
- private lastResizeWidth;
1388
- private lastResizeHeight;
1389
1440
  constructor();
1441
+ /** Clears current selection and emits `selectChange`. */
1442
+ clearSelection(): void;
1443
+ /** Selects all currently loaded rows (multi mode only) and emits `selectChange`. */
1444
+ selectAllLoaded(): void;
1445
+ /** Resets sorting state and emits sort events. */
1446
+ resetSort(): void;
1447
+ /** Sets a single-column sorting state and emits sort events. */
1448
+ setSort(sort: GridSortEvent<Data>): void;
1449
+ /** Sets multi-column sorting state and emits sort events. */
1450
+ setMultiSort(sorts: ReadonlyArray<GridSortItem<Data>>): void;
1390
1451
  protected resolvePinnedData(pr: GridPinnedRow): Partial<Data>;
1391
1452
  /**
1392
1453
  * Handles column header click for sorting.
@@ -1410,8 +1471,15 @@ declare class DataGrid<Data extends AnyDict> {
1410
1471
  * @param event
1411
1472
  */
1412
1473
  protected onCellClick(row: Data, col: GridColumn<Data>, index: number, event: Event): void;
1474
+ protected onSelectAll(event?: Event): void;
1475
+ protected onCheckboxToggle(row: Data, index: number, event?: Event): void;
1476
+ protected onSelectAllKeydown(event: Event): void;
1477
+ protected onCheckboxKeydown(row: Data, index: number, event: Event): void;
1413
1478
  protected onCellContext(row: Data, col: GridColumn<Data>, index: number, event: MouseEvent): void;
1414
1479
  protected onCellDoubleClick(row: Data, col: GridColumn<Data>, index: number, event: MouseEvent): void;
1480
+ protected onRowClick(row: Data, index: number, event: Event): void;
1481
+ protected onRowContext(row: Data, index: number, event: MouseEvent): void;
1482
+ protected onRowDoubleClick(row: Data, index: number, event: MouseEvent): void;
1415
1483
  protected isExpandable(column: GridColumn<Data>): boolean;
1416
1484
  /**
1417
1485
  * Handles column expand/collapse toggle.
@@ -1446,9 +1514,11 @@ declare class DataGrid<Data extends AnyDict> {
1446
1514
  protected showScrollbar(): void;
1447
1515
  protected hideScrollbarSoon(delay?: number): void;
1448
1516
  protected trackPinnedRow: (row: GridPinnedRow) => number | undefined;
1517
+ protected isDisabledRow(row: Data, index: number): boolean;
1449
1518
  protected cellClass(col: GridColumn<Data>, row: Data): string | undefined;
1450
1519
  protected ariaSort(col: GridColumn<Data>): 'ascending' | 'descending' | 'none';
1451
- protected resolveTooltip(row: Data, col: GridColumn<Data>): string | TemplateRef<GridTooltipContext<AnyDict>> | null;
1520
+ protected sortOrderFor(col: GridColumn<Data>): GridSortOrder | undefined;
1521
+ protected isActiveSort(col: GridColumn<Data>): boolean;
1452
1522
  protected showTooltip(event: MouseEvent, row: Data, col: GridColumn<Data>, index: number): void;
1453
1523
  protected hideTooltip(): void;
1454
1524
  protected isStickyRowIndex(index: number): boolean;
@@ -1457,26 +1527,27 @@ declare class DataGrid<Data extends AnyDict> {
1457
1527
  private initSelector;
1458
1528
  private initRefs;
1459
1529
  private initSort;
1460
- private initHeader;
1461
1530
  private initScroll;
1462
1531
  private initObserver;
1463
1532
  private initExpander;
1533
+ private setCurrentSorts;
1534
+ private loadSelectionFeature;
1535
+ private loadTooltipFeature;
1536
+ private loadOverlayScrollFeature;
1537
+ private loadStickyFeature;
1464
1538
  private positionTooltip;
1465
1539
  private scheduleScrollbarUpdate;
1466
1540
  private finalizeScroll;
1467
- private scheduleScrollTick;
1468
1541
  private clearScrollRaf;
1469
- private ensureRenderSlots;
1470
1542
  private clearScrollbarRaf;
1471
1543
  private scheduleStickyUpdate;
1472
1544
  private clearStickyRaf;
1473
1545
  private updateStickyRow;
1474
1546
  private updateStickyFromScroll;
1475
- private findStickyIndexBefore;
1476
1547
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DataGrid<any>, never>;
1477
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<DataGrid<any>, "re-data-grid", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "columns": { "alias": "columns"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "pinnedRows": { "alias": "pinnedRows"; "required": false; "isSignal": true; }; "isRowSticky": { "alias": "isRowSticky"; "required": false; "isSignal": true; }; "getRowTemplate": { "alias": "getRowTemplate"; "required": false; "isSignal": true; }; "hasIndexColumn": { "alias": "hasIndexColumn"; "required": false; "isSignal": true; }; "selection": { "alias": "selection"; "required": false; "isSignal": true; }; "pageSize": { "alias": "pageSize"; "required": false; "isSignal": true; }; "rowHeight": { "alias": "rowHeight"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "virtualBuffer": { "alias": "virtualBuffer"; "required": false; "isSignal": true; }; "lockVerticalScroll": { "alias": "lockVerticalScroll"; "required": false; "isSignal": true; }; "headerGroups": { "alias": "headerGroups"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "loadingMode": { "alias": "loadingMode"; "required": false; "isSignal": true; }; "deferContent": { "alias": "deferContent"; "required": false; "isSignal": true; }; "deferHeader": { "alias": "deferHeader"; "required": false; "isSignal": true; }; "deferPinned": { "alias": "deferPinned"; "required": false; "isSignal": true; }; "deferCells": { "alias": "deferCells"; "required": false; "isSignal": true; }; "deferIcons": { "alias": "deferIcons"; "required": false; "isSignal": true; }; "deferTooltip": { "alias": "deferTooltip"; "required": false; "isSignal": true; }; "rowKey": { "alias": "rowKey"; "required": false; "isSignal": true; }; "pageStartFromZero": { "alias": "pageStartFromZero"; "required": false; "isSignal": true; }; }, { "pageChange": "pageChange"; "sortChange": "sortChange"; "selectChange": "selectChange"; "rowClick": "rowClick"; "rowContext": "rowContext"; "rowDoubleClick": "rowDoubleClick"; "cellClick": "cellClick"; "cellContext": "cellContext"; "cellDoubleClick": "cellDoubleClick"; }, ["cellTypedSlotRefs", "cellDataSlotRefs", "declarativeColumnRefs", "headerSlotRefs", "emptySlotRefs", "loadingSlotRefs", "sortIcSlotRefs", "expanderIcSlotRefs", "stickyRowSlotRefs", "rowSlotRefs"], never, true, never>;
1548
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<DataGrid<any>, "re-data-grid", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "columns": { "alias": "columns"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "pinnedRows": { "alias": "pinnedRows"; "required": false; "isSignal": true; }; "isRowSticky": { "alias": "isRowSticky"; "required": false; "isSignal": true; }; "isRowDisabled": { "alias": "isRowDisabled"; "required": false; "isSignal": true; }; "getRowTemplate": { "alias": "getRowTemplate"; "required": false; "isSignal": true; }; "hasIndexColumn": { "alias": "hasIndexColumn"; "required": false; "isSignal": true; }; "selection": { "alias": "selection"; "required": false; "isSignal": true; }; "pageSize": { "alias": "pageSize"; "required": false; "isSignal": true; }; "rowHeight": { "alias": "rowHeight"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "virtualBuffer": { "alias": "virtualBuffer"; "required": false; "isSignal": true; }; "lockVerticalScroll": { "alias": "lockVerticalScroll"; "required": false; "isSignal": true; }; "headerGroups": { "alias": "headerGroups"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "loadingMode": { "alias": "loadingMode"; "required": false; "isSignal": true; }; "deferContent": { "alias": "deferContent"; "required": false; "isSignal": true; }; "deferHeader": { "alias": "deferHeader"; "required": false; "isSignal": true; }; "deferPinned": { "alias": "deferPinned"; "required": false; "isSignal": true; }; "deferCells": { "alias": "deferCells"; "required": false; "isSignal": true; }; "deferIcons": { "alias": "deferIcons"; "required": false; "isSignal": true; }; "deferTooltip": { "alias": "deferTooltip"; "required": false; "isSignal": true; }; "rowKey": { "alias": "rowKey"; "required": false; "isSignal": true; }; "pageStartFromZero": { "alias": "pageStartFromZero"; "required": false; "isSignal": true; }; "sortMode": { "alias": "sortMode"; "required": false; "isSignal": true; }; }, { "pageChange": "pageChange"; "sortChange": "sortChange"; "multiSortChange": "multiSortChange"; "selectChange": "selectChange"; "rowClick": "rowClick"; "rowContext": "rowContext"; "rowDoubleClick": "rowDoubleClick"; "cellClick": "cellClick"; "cellContext": "cellContext"; "cellDoubleClick": "cellDoubleClick"; }, ["cellTypedSlotRefs", "cellDataSlotRefs", "declarativeColumnRefs", "headerSlotRefs", "emptySlotRefs", "loadingSlotRefs", "sortIcSlotRefs", "expanderIcSlotRefs", "stickyRowSlotRefs", "rowSlotRefs"], never, true, never>;
1478
1549
  }
1479
1550
 
1480
1551
  export { DATA_GRID_CONFIG, DEFAULT_DATA_GRID_DEFAULTS, DataGrid, DataGridCellEmptyDirective, DataGridCellLoadingDirective, DataGridCellTemplateDirective, DataGridDeclarativeCellDirective, DataGridDeclarativeColumn, DataGridDeclarativeHeaderDirective, DataGridExpanderIconDirective, DataGridHeaderTemplateDirective, DataGridRowDirective, DataGridSortIconDirective, DataGridStickyRowDirective, DataGridTypeCellTemplateDirective, provideDataGridDefaults };
1481
- export type { BaseGridColumn, DataGridConfigProvider, DataGridRowTemplateContext, DataGridStickyRowTemplateContext, DeclarativeColumnDef, GridCellAlign, GridCellClickEvent, GridCellContextEvent, GridCellDoubleClickEvent, GridCellRenderer, GridCellRendererType, GridColumn, GridColumnTooltip, GridColumns, GridHeaderGroup, GridPageChangeEvent, GridPaginationMode, GridPinnedPosition, GridPinnedRow, GridPinnedRows, GridRowClickEvent, GridRowContextEvent, GridRowDoubleClickEvent, GridSelectEvent, GridSelectMode, GridSelection, GridSortEvent, GridSortOrder, GridStickySide, GridTooltipContext, HeaderTemplateData, RenderTemplateData };
1552
+ export type { BaseGridColumn, DataGridConfigProvider, DataGridRowTemplateContext, DataGridStickyRowTemplateContext, DeclarativeColumnDef, GridCellAlign, GridCellClickEvent, GridCellContextEvent, GridCellDoubleClickEvent, GridCellRenderer, GridCellRendererType, GridColumn, GridColumnTooltip, GridColumns, GridHeaderGroup, GridMultiSortEvent, GridPageChangeEvent, GridPaginationMode, GridPinnedPosition, GridPinnedRow, GridPinnedRows, GridRowClickEvent, GridRowContextEvent, GridRowDoubleClickEvent, GridSelectEvent, GridSelectMode, GridSelection, GridSortEvent, GridSortItem, GridSortMode, GridSortOrder, GridStickySide, GridTooltipContext, HeaderTemplateData, RenderTemplateData };
1482
1553
  //# sourceMappingURL=reforgium-data-grid.d.ts.map