@nanahoshi/mona-ui 0.46.0 → 0.48.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.
Files changed (59) hide show
  1. package/docs/api/button.json +1 -1
  2. package/docs/api/button.md +1 -0
  3. package/docs/api/check-box.json +1 -1
  4. package/docs/api/check-box.md +1 -0
  5. package/docs/api/chip.json +1 -1
  6. package/docs/api/chip.md +1 -0
  7. package/docs/api/common.json +1 -1
  8. package/docs/api/common.md +1 -1
  9. package/docs/api/grid.json +1 -1
  10. package/docs/api/grid.md +18 -0
  11. package/docs/api/index.json +1 -1
  12. package/docs/api/radio-button.json +1 -1
  13. package/docs/api/radio-button.md +1 -0
  14. package/docs/api/ripple.json +1 -0
  15. package/docs/api/ripple.md +75 -0
  16. package/docs/api/sidebar.json +1 -1
  17. package/docs/api/sidebar.md +1 -0
  18. package/docs/api/switch.json +1 -1
  19. package/docs/api/switch.md +1 -0
  20. package/docs/grid-rows.md +36 -0
  21. package/docs/grid-server.md +6 -0
  22. package/docs/grid.md +3 -2
  23. package/docs/manifest.json +1 -1
  24. package/docs/ripple.md +360 -0
  25. package/docs/sidebar-menus.md +8 -0
  26. package/fesm2022/{grid-colgroup.component-B4jx10Yi.mjs → grid-colgroup.component-BFbiAvkG.mjs} +2 -2
  27. package/fesm2022/{grid-footer-row.component-CVUltI39.mjs → grid-footer-row.component-DpSu7jvG.mjs} +3 -2
  28. package/fesm2022/{grid-list.component-Cv1KB5VQ.mjs → grid-list.component-B-F4bvFL.mjs} +5 -5
  29. package/fesm2022/{grid-row.component-BauMmps5.mjs → grid-row.component-CuCQ_Z5F.mjs} +37 -9
  30. package/fesm2022/{grid-virtual-list.component-DNjoZfHq.mjs → grid-virtual-list.component-rIz5AUOU.mjs} +31 -12
  31. package/fesm2022/{grid.styles-BJHVTT_v.mjs → grid.styles-D6jP3vwD.mjs} +110 -35
  32. package/fesm2022/nanahoshi-mona-ui-button.mjs +20 -2
  33. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +11 -3
  34. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +30 -5
  35. package/fesm2022/nanahoshi-mona-ui-chip.mjs +13 -0
  36. package/fesm2022/nanahoshi-mona-ui-grid.mjs +16 -20
  37. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +9 -1
  38. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +9 -3
  39. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +12 -4
  40. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +11 -3
  41. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +27 -3
  42. package/fesm2022/nanahoshi-mona-ui-ripple.mjs +196 -0
  43. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +9 -3
  44. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +21 -1
  45. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +5 -1
  46. package/fesm2022/nanahoshi-mona-ui-switch.mjs +28 -3
  47. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +7 -1
  48. package/llms.txt +3 -1
  49. package/package.json +5 -1
  50. package/ripple/package.json +5 -0
  51. package/types/nanahoshi-mona-ui-button.d.ts +8 -1
  52. package/types/nanahoshi-mona-ui-calendar.d.ts +1 -0
  53. package/types/nanahoshi-mona-ui-check-box.d.ts +10 -1
  54. package/types/nanahoshi-mona-ui-chip.d.ts +8 -1
  55. package/types/nanahoshi-mona-ui-grid.d.ts +35 -4
  56. package/types/nanahoshi-mona-ui-radio-button.d.ts +9 -1
  57. package/types/nanahoshi-mona-ui-ripple.d.ts +72 -0
  58. package/types/nanahoshi-mona-ui-sidebar.d.ts +12 -0
  59. package/types/nanahoshi-mona-ui-switch.d.ts +10 -2
@@ -1,7 +1,7 @@
1
- import { I as gridRowDragPreviewThemeVariants, K as GridLockedCellDirective, P as gridListTableThemeVariants, j as gridListBaseThemeVariants, q as GridService } from "./grid.styles-BJHVTT_v.mjs";
2
- import { i as GridCellDirective, n as GridGroupRowComponent, r as GridAddRowComponent, t as GridRowComponent } from "./grid-row.component-BauMmps5.mjs";
3
- import { t as GridColgroupComponent } from "./grid-colgroup.component-B4jx10Yi.mjs";
4
- import { GridFooterRowComponent } from "./grid-footer-row.component-CVUltI39.mjs";
1
+ import { I as gridRowDragPreviewThemeVariants, K as GridLockedCellDirective, P as gridListTableThemeVariants, j as gridListBaseThemeVariants, q as GridService } from "./grid.styles-D6jP3vwD.mjs";
2
+ import { i as GridCellDirective, n as GridGroupRowComponent, r as GridAddRowComponent, t as GridRowComponent } from "./grid-row.component-CuCQ_Z5F.mjs";
3
+ import { t as GridColgroupComponent } from "./grid-colgroup.component-BFbiAvkG.mjs";
4
+ import { GridFooterRowComponent } from "./grid-footer-row.component-DpSu7jvG.mjs";
5
5
  import { NgTemplateOutlet } from "@angular/common";
6
6
  import * as i0 from "@angular/core";
7
7
  import { Component, DestroyRef, ElementRef, afterNextRender, afterRenderEffect, computed, effect, inject, input, untracked, viewChild } from "@angular/core";
@@ -471,4 +471,4 @@ i0.ɵɵngDeclareClassMetadata({
471
471
  });
472
472
  export { GridListComponent };
473
473
 
474
- //# sourceMappingURL=grid-list.component-Cv1KB5VQ.mjs.map
474
+ //# sourceMappingURL=grid-list.component-B-F4bvFL.mjs.map
@@ -1,5 +1,5 @@
1
- import { B as gridTreeLeafSpacerThemeVariants, H as GridLogicalCellDirective, K as GridLockedCellDirective, L as gridRowReorderHandleThemeVariants, M as gridListTableCellThemeVariants, N as gridListTableRowThemeVariants, Q as formatGridCellValue, U as GRID_CELL_FOCUSABLE_SELECTOR, V as gridTreeToggleThemeVariants, a as gridCellEditorBaseThemeVariants, b as gridGroupRowThemeVariants, i as gridCellDirtyIndicatorThemeVariants, n as gridCellBaseThemeVariants, o as gridCellEditorInputThemeVariants, q as GridService, r as gridCellContainerThemeVariants, s as gridCellTextThemeVariants, tt as GridNavigationService, z as gridSelectionCellThemeVariants } from "./grid.styles-BJHVTT_v.mjs";
2
- import { n as removeGridRow } from "./grid-colgroup.component-B4jx10Yi.mjs";
1
+ import { B as gridTreeLeafSpacerThemeVariants, H as GridLogicalCellDirective, K as GridLockedCellDirective, L as gridRowReorderHandleThemeVariants, M as gridListTableCellThemeVariants, N as gridListTableRowThemeVariants, Q as formatGridCellValue, U as GRID_CELL_FOCUSABLE_SELECTOR, V as gridTreeToggleThemeVariants, a as gridCellEditorBaseThemeVariants, b as gridGroupRowThemeVariants, i as gridCellDirtyIndicatorThemeVariants, n as gridCellBaseThemeVariants, o as gridCellEditorInputThemeVariants, q as GridService, r as gridCellContainerThemeVariants, s as gridCellTextThemeVariants, tt as GridNavigationService, z as gridSelectionCellThemeVariants } from "./grid.styles-D6jP3vwD.mjs";
2
+ import { n as removeGridRow } from "./grid-colgroup.component-BFbiAvkG.mjs";
3
3
  import { NgTemplateOutlet } from "@angular/common";
4
4
  import * as i0 from "@angular/core";
5
5
  import { Component, Directive, ElementRef, Injector, LOCALE_ID, afterNextRender, computed, effect, inject, input, isDevMode, model, output, signal, untracked, viewChild } from "@angular/core";
@@ -1028,6 +1028,7 @@ var GridAddRowComponent = class GridAddRowComponent {
1028
1028
  "treeCell"
1029
1029
  ],
1030
1030
  outputs: [
1031
+ "activate",
1031
1032
  "edit",
1032
1033
  "menuOpen",
1033
1034
  "toggleExpand"
@@ -1301,6 +1302,7 @@ var GridGroupRowComponent = class GridGroupRowComponent {
1301
1302
  "treeCell"
1302
1303
  ],
1303
1304
  outputs: [
1305
+ "activate",
1304
1306
  "edit",
1305
1307
  "menuOpen",
1306
1308
  "toggleExpand"
@@ -1459,7 +1461,10 @@ var GridCellComponent = class GridCellComponent {
1459
1461
  this.gridService.startRowEdit(this.row(), originalEvent, column.editable ? column.id : null);
1460
1462
  }
1461
1463
  onCellDoubleClick(event) {
1462
- if (this.gridService.editableOptions().mode === "cell") this.startEdit(event);
1464
+ if (this.gridService.editableOptions().mode === "cell" && this.canEdit()) {
1465
+ event.preventDefault();
1466
+ this.startEdit(event);
1467
+ }
1463
1468
  }
1464
1469
  onEditCancel() {
1465
1470
  if (this.gridService.editContext() != null && this.gridService.cancelEdit(void 0, "escape")) this.focusHostCell();
@@ -1486,6 +1491,10 @@ var GridCellComponent = class GridCellComponent {
1486
1491
  event.stopPropagation();
1487
1492
  this.gridService.toggleTreeRow(this.row());
1488
1493
  }
1494
+ canEdit() {
1495
+ const column = this.column();
1496
+ return !!this.gridService.editableOptions().enabled && column.editable && column.kind === "data";
1497
+ }
1489
1498
  focusHostCell() {
1490
1499
  this.#elementRef.nativeElement.closest("td")?.focus();
1491
1500
  }
@@ -1493,7 +1502,7 @@ var GridCellComponent = class GridCellComponent {
1493
1502
  this.#elementRef.nativeElement.querySelector(GRID_CELL_FOCUSABLE_SELECTOR)?.focus();
1494
1503
  }
1495
1504
  startEdit(originalEvent) {
1496
- if (!this.gridService.editableOptions().enabled || !this.column().editable || this.column().kind !== "data") return;
1505
+ if (!this.canEdit()) return;
1497
1506
  this.gridService.startCellEdit(this.cellUid(), this.row(), this.column(), originalEvent);
1498
1507
  }
1499
1508
  static {
@@ -1896,6 +1905,13 @@ i0.ɵɵngDeclareClassMetadata({
1896
1905
  }]
1897
1906
  }
1898
1907
  });
1908
+ const CELL_CONTROL_SELECTOR = `${GRID_CELL_FOCUSABLE_SELECTOR}, label, summary, [contenteditable]:not([contenteditable="false"])`;
1909
+ function isInCellControl(target) {
1910
+ if (!(target instanceof Element)) return false;
1911
+ const cell = target.closest("td");
1912
+ const control = target.closest(CELL_CONTROL_SELECTOR);
1913
+ return cell != null && control != null && control !== cell && cell.contains(control);
1914
+ }
1899
1915
  var GridRowComponent = class GridRowComponent {
1900
1916
  constructor() {
1901
1917
  this.ariaLevel = computed(() => {
@@ -1932,9 +1948,16 @@ var GridRowComponent = class GridRowComponent {
1932
1948
  this.row = input.required(...ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []);
1933
1949
  this.selected = computed(() => this.gridService.isRowSelected(this.row()), ...ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []);
1934
1950
  }
1951
+ onActivate(event) {
1952
+ this.gridService.activateRow(this.row(), event);
1953
+ }
1935
1954
  onClick(event) {
1936
1955
  this.gridService.handleRowClick(event, this.row());
1937
1956
  }
1957
+ onDoubleClick(event) {
1958
+ if (event.defaultPrevented || isInCellControl(event.target)) return;
1959
+ this.gridService.activateRow(this.row(), event);
1960
+ }
1938
1961
  toggleDetail() {
1939
1962
  this.gridService.setRowExpanded(this.row(), !this.expanded());
1940
1963
  }
@@ -1983,7 +2006,10 @@ var GridRowComponent = class GridRowComponent {
1983
2006
  },
1984
2007
  host: {
1985
2008
  attributes: { "role": "row" },
1986
- listeners: { "click": "onClick($event)" },
2009
+ listeners: {
2010
+ "click": "onClick($event)",
2011
+ "dblclick": "onDoubleClick($event)"
2012
+ },
1987
2013
  properties: {
1988
2014
  "class": "baseClass()",
1989
2015
  "attr.data-ruid": "row().uid",
@@ -1998,7 +2024,7 @@ var GridRowComponent = class GridRowComponent {
1998
2024
  },
1999
2025
  exportAs: ["monaGridRow"],
2000
2026
  ngImport: i0,
2001
- template: "@for (layoutColumn of gridService.layout(); track layoutColumn.key) {\n @if (layoutColumn.kind === \"column\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"layoutColumn.column.kind\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [columnId]=\"layoutColumn.column.id\"\n [editable]=\"cellEditMode() && layoutColumn.column.kind === 'data' && layoutColumn.column.editable === true\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n [readOnly]=\"editingEnabled() && layoutColumn.column.kind === 'data' ? !layoutColumn.column.editable : null\"\n [treeCell]=\"layoutColumn.column.id === gridService.treeColumnId()\"\n [expanded]=\"\n layoutColumn.column.id === gridService.treeColumnId() && treeInfo()?.hasChildren\n ? treeInfo()!.expanded\n : null\n \"\n (edit)=\"gridCell.handleLogicalCellEnter()\"\n (toggleExpand)=\"toggleTree()\">\n <mona-grid-cell #gridCell [column]=\"layoutColumn.column\" [row]=\"row()\" />\n </td>\n } @else if (layoutColumn.kind === \"group\") {\n <td monaGridCell [monaGridLockedCell]=\"layoutColumn.key\" [lockedCellHeader]=\"true\" [groupIndent]=\"true\"></td>\n } @else if (layoutColumn.kind === \"reorder\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'command'\"\n [columnId]=\"'$rowReorder'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\">\n <mona-grid-row-reorder-handle [row]=\"row()\" [pageIndex]=\"index()\" />\n </td>\n } @else if (layoutColumn.kind === \"detail\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'detail'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n (toggleExpand)=\"toggleDetail()\">\n <span [class]=\"detailToggleClass()\">\n <mona-grid-toggle\n [expanded]=\"expanded()\"\n [label]=\"detailToggleLabel()\"\n [type]=\"'detail'\"\n [width]=\"gridService.detailColumnWidth\"\n (expandedChange)=\"toggleDetail()\" />\n </span>\n </td>\n } @else if (layoutColumn.kind === \"selection\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'command'\"\n [columnId]=\"'$selection'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\">\n <mona-grid-selection-checkbox [row]=\"row()\" [rowIndex]=\"index()\" />\n </td>\n }\n}\n",
2027
+ template: "@for (layoutColumn of gridService.layout(); track layoutColumn.key) {\n @if (layoutColumn.kind === \"column\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"layoutColumn.column.kind\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [columnId]=\"layoutColumn.column.id\"\n [editable]=\"cellEditMode() && layoutColumn.column.kind === 'data' && layoutColumn.column.editable === true\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n [readOnly]=\"editingEnabled() && layoutColumn.column.kind === 'data' ? !layoutColumn.column.editable : null\"\n [treeCell]=\"layoutColumn.column.id === gridService.treeColumnId()\"\n [expanded]=\"\n layoutColumn.column.id === gridService.treeColumnId() && treeInfo()?.hasChildren\n ? treeInfo()!.expanded\n : null\n \"\n (activate)=\"onActivate($event)\"\n (edit)=\"gridCell.handleLogicalCellEnter()\"\n (toggleExpand)=\"toggleTree()\">\n <mona-grid-cell #gridCell [column]=\"layoutColumn.column\" [row]=\"row()\" />\n </td>\n } @else if (layoutColumn.kind === \"group\") {\n <td monaGridCell [monaGridLockedCell]=\"layoutColumn.key\" [lockedCellHeader]=\"true\" [groupIndent]=\"true\"></td>\n } @else if (layoutColumn.kind === \"reorder\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'command'\"\n [columnId]=\"'$rowReorder'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n (activate)=\"onActivate($event)\">\n <mona-grid-row-reorder-handle [row]=\"row()\" [pageIndex]=\"index()\" />\n </td>\n } @else if (layoutColumn.kind === \"detail\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'detail'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n (toggleExpand)=\"toggleDetail()\">\n <span [class]=\"detailToggleClass()\">\n <mona-grid-toggle\n [expanded]=\"expanded()\"\n [label]=\"detailToggleLabel()\"\n [type]=\"'detail'\"\n [width]=\"gridService.detailColumnWidth\"\n (expandedChange)=\"toggleDetail()\" />\n </span>\n </td>\n } @else if (layoutColumn.kind === \"selection\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'command'\"\n [columnId]=\"'$selection'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n (activate)=\"onActivate($event)\">\n <mona-grid-selection-checkbox [row]=\"row()\" [rowIndex]=\"index()\" />\n </td>\n }\n}\n",
2002
2028
  dependencies: [
2003
2029
  {
2004
2030
  kind: "component",
@@ -2049,6 +2075,7 @@ var GridRowComponent = class GridRowComponent {
2049
2075
  "treeCell"
2050
2076
  ],
2051
2077
  outputs: [
2078
+ "activate",
2052
2079
  "edit",
2053
2080
  "menuOpen",
2054
2081
  "toggleExpand"
@@ -2112,9 +2139,10 @@ i0.ɵɵngDeclareClassMetadata({
2112
2139
  "[attr.aria-expanded]": "treeInfo()?.hasChildren ? treeInfo()!.expanded : null",
2113
2140
  "[attr.aria-posinset]": "treeInfo()?.posInSet ?? null",
2114
2141
  "[attr.aria-setsize]": "treeInfo()?.setSize ?? null",
2115
- "(click)": "onClick($event)"
2142
+ "(click)": "onClick($event)",
2143
+ "(dblclick)": "onDoubleClick($event)"
2116
2144
  },
2117
- template: "@for (layoutColumn of gridService.layout(); track layoutColumn.key) {\n @if (layoutColumn.kind === \"column\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"layoutColumn.column.kind\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [columnId]=\"layoutColumn.column.id\"\n [editable]=\"cellEditMode() && layoutColumn.column.kind === 'data' && layoutColumn.column.editable === true\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n [readOnly]=\"editingEnabled() && layoutColumn.column.kind === 'data' ? !layoutColumn.column.editable : null\"\n [treeCell]=\"layoutColumn.column.id === gridService.treeColumnId()\"\n [expanded]=\"\n layoutColumn.column.id === gridService.treeColumnId() && treeInfo()?.hasChildren\n ? treeInfo()!.expanded\n : null\n \"\n (edit)=\"gridCell.handleLogicalCellEnter()\"\n (toggleExpand)=\"toggleTree()\">\n <mona-grid-cell #gridCell [column]=\"layoutColumn.column\" [row]=\"row()\" />\n </td>\n } @else if (layoutColumn.kind === \"group\") {\n <td monaGridCell [monaGridLockedCell]=\"layoutColumn.key\" [lockedCellHeader]=\"true\" [groupIndent]=\"true\"></td>\n } @else if (layoutColumn.kind === \"reorder\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'command'\"\n [columnId]=\"'$rowReorder'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\">\n <mona-grid-row-reorder-handle [row]=\"row()\" [pageIndex]=\"index()\" />\n </td>\n } @else if (layoutColumn.kind === \"detail\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'detail'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n (toggleExpand)=\"toggleDetail()\">\n <span [class]=\"detailToggleClass()\">\n <mona-grid-toggle\n [expanded]=\"expanded()\"\n [label]=\"detailToggleLabel()\"\n [type]=\"'detail'\"\n [width]=\"gridService.detailColumnWidth\"\n (expandedChange)=\"toggleDetail()\" />\n </span>\n </td>\n } @else if (layoutColumn.kind === \"selection\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'command'\"\n [columnId]=\"'$selection'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\">\n <mona-grid-selection-checkbox [row]=\"row()\" [rowIndex]=\"index()\" />\n </td>\n }\n}\n"
2145
+ template: "@for (layoutColumn of gridService.layout(); track layoutColumn.key) {\n @if (layoutColumn.kind === \"column\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"layoutColumn.column.kind\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [columnId]=\"layoutColumn.column.id\"\n [editable]=\"cellEditMode() && layoutColumn.column.kind === 'data' && layoutColumn.column.editable === true\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n [readOnly]=\"editingEnabled() && layoutColumn.column.kind === 'data' ? !layoutColumn.column.editable : null\"\n [treeCell]=\"layoutColumn.column.id === gridService.treeColumnId()\"\n [expanded]=\"\n layoutColumn.column.id === gridService.treeColumnId() && treeInfo()?.hasChildren\n ? treeInfo()!.expanded\n : null\n \"\n (activate)=\"onActivate($event)\"\n (edit)=\"gridCell.handleLogicalCellEnter()\"\n (toggleExpand)=\"toggleTree()\">\n <mona-grid-cell #gridCell [column]=\"layoutColumn.column\" [row]=\"row()\" />\n </td>\n } @else if (layoutColumn.kind === \"group\") {\n <td monaGridCell [monaGridLockedCell]=\"layoutColumn.key\" [lockedCellHeader]=\"true\" [groupIndent]=\"true\"></td>\n } @else if (layoutColumn.kind === \"reorder\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'command'\"\n [columnId]=\"'$rowReorder'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n (activate)=\"onActivate($event)\">\n <mona-grid-row-reorder-handle [row]=\"row()\" [pageIndex]=\"index()\" />\n </td>\n } @else if (layoutColumn.kind === \"detail\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'detail'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n (toggleExpand)=\"toggleDetail()\">\n <span [class]=\"detailToggleClass()\">\n <mona-grid-toggle\n [expanded]=\"expanded()\"\n [label]=\"detailToggleLabel()\"\n [type]=\"'detail'\"\n [width]=\"gridService.detailColumnWidth\"\n (expandedChange)=\"toggleDetail()\" />\n </span>\n </td>\n } @else if (layoutColumn.kind === \"selection\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'command'\"\n [columnId]=\"'$selection'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n (activate)=\"onActivate($event)\">\n <mona-grid-selection-checkbox [row]=\"row()\" [rowIndex]=\"index()\" />\n </td>\n }\n}\n"
2118
2146
  }]
2119
2147
  }],
2120
2148
  propDecorators: {
@@ -2146,4 +2174,4 @@ i0.ɵɵngDeclareClassMetadata({
2146
2174
  });
2147
2175
  export { GridCellDirective as i, GridGroupRowComponent as n, GridAddRowComponent as r, GridRowComponent as t };
2148
2176
 
2149
- //# sourceMappingURL=grid-row.component-BauMmps5.mjs.map
2177
+ //# sourceMappingURL=grid-row.component-CuCQ_Z5F.mjs.map
@@ -1,26 +1,30 @@
1
- import { P as gridListTableThemeVariants, _ as gridFooterThemeVariants, g as gridFooterTableThemeVariants, j as gridListBaseThemeVariants, q as GridService, tt as GridNavigationService } from "./grid.styles-BJHVTT_v.mjs";
2
- import { n as GridGroupRowComponent, r as GridAddRowComponent, t as GridRowComponent } from "./grid-row.component-BauMmps5.mjs";
3
- import { t as GridColgroupComponent } from "./grid-colgroup.component-B4jx10Yi.mjs";
4
- import { GridFooterRowComponent } from "./grid-footer-row.component-CVUltI39.mjs";
1
+ import { P as gridListTableThemeVariants, _ as gridFooterThemeVariants, g as gridFooterTableThemeVariants, j as gridListBaseThemeVariants, q as GridService, tt as GridNavigationService } from "./grid.styles-D6jP3vwD.mjs";
2
+ import { n as GridGroupRowComponent, r as GridAddRowComponent, t as GridRowComponent } from "./grid-row.component-CuCQ_Z5F.mjs";
3
+ import { t as GridColgroupComponent } from "./grid-colgroup.component-BFbiAvkG.mjs";
4
+ import { GridFooterRowComponent } from "./grid-footer-row.component-DpSu7jvG.mjs";
5
5
  import * as i0 from "@angular/core";
6
- import { Component, DestroyRef, ElementRef, Injector, afterNextRender, computed, effect, inject, input, untracked, viewChild } from "@angular/core";
6
+ import { Component, DestroyRef, ElementRef, Injector, afterNextRender, computed, effect, inject, input, signal, untracked, viewChild } from "@angular/core";
7
7
  import { takeUntilDestroyed, toObservable } from "@angular/core/rxjs-interop";
8
8
  import { rxTimeout } from "@nanahoshi/mona-ui/internal";
9
9
  import { ImmutableList } from "@mirei/ts-collections";
10
10
  import { ContextMenuComponent } from "@nanahoshi/mona-ui/contextmenu";
11
11
  import { CdkFixedSizeVirtualScroll, CdkVirtualForOf, CdkVirtualScrollViewport } from "@angular/cdk/scrolling";
12
+ const MIN_BUFFER_ROWS = 4;
13
+ const MAX_BUFFER_ROWS = 8;
12
14
  var GridVirtualListComponent = class GridVirtualListComponent {
13
15
  #destroyRef;
14
16
  #gridNavigationService;
15
17
  #groupColumns$;
16
18
  #hostElementRef;
17
19
  #injector;
20
+ #viewportHeight;
18
21
  constructor() {
19
22
  this.#destroyRef = inject(DestroyRef);
20
23
  this.#gridNavigationService = inject(GridNavigationService);
21
24
  this.#groupColumns$ = toObservable(inject(GridService).groupColumns);
22
25
  this.#hostElementRef = inject(ElementRef);
23
26
  this.#injector = inject(Injector);
27
+ this.#viewportHeight = signal(0, ...ngDevMode ? [{ debugName: "#viewportHeight" }] : /* istanbul ignore next */ []);
24
28
  this.addRowScrollElementRef = viewChild("addRowScrollElement", ...ngDevMode ? [{ debugName: "addRowScrollElementRef" }] : /* istanbul ignore next */ []);
25
29
  this.bodyTableElementRef = viewChild.required("bodyTable", ...ngDevMode ? [{ debugName: "bodyTableElementRef" }] : /* istanbul ignore next */ []);
26
30
  this.footerScrollElementRef = viewChild("footerScrollElement", ...ngDevMode ? [{ debugName: "footerScrollElementRef" }] : /* istanbul ignore next */ []);
@@ -36,9 +40,13 @@ var GridVirtualListComponent = class GridVirtualListComponent {
36
40
  }, ...ngDevMode ? [{ debugName: "footerTableClass" }] : /* istanbul ignore next */ []);
37
41
  this.gridAriaRowCount = computed(() => this.gridService.bodyAriaRowStart() + this.bodyRows().length + 1, ...ngDevMode ? [{ debugName: "gridAriaRowCount" }] : /* istanbul ignore next */ []);
38
42
  this.gridService = inject(GridService);
43
+ this.maxBufferPx = computed(() => this.rowHeight() * MAX_BUFFER_ROWS, ...ngDevMode ? [{ debugName: "maxBufferPx" }] : /* istanbul ignore next */ []);
44
+ this.minBufferPx = computed(() => this.rowHeight() * MIN_BUFFER_ROWS, ...ngDevMode ? [{ debugName: "minBufferPx" }] : /* istanbul ignore next */ []);
45
+ this.rowHeight = computed(() => this.gridService.virtualScrollOptions().height ?? 36, ...ngDevMode ? [{ debugName: "rowHeight" }] : /* istanbul ignore next */ []);
39
46
  this.tableClass = computed(() => {
40
47
  return gridListTableThemeVariants();
41
48
  }, ...ngDevMode ? [{ debugName: "tableClass" }] : /* istanbul ignore next */ []);
49
+ this.templateCacheSize = computed(() => Math.ceil(this.#viewportHeight() / this.rowHeight()) + 16 + 2, ...ngDevMode ? [{ debugName: "templateCacheSize" }] : /* istanbul ignore next */ []);
42
50
  this.viewport = viewChild.required(CdkVirtualScrollViewport, ...ngDevMode ? [{ debugName: "viewport" }] : /* istanbul ignore next */ []);
43
51
  this.data = input(ImmutableList.create(), ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
44
52
  effect(() => {
@@ -57,6 +65,7 @@ var GridVirtualListComponent = class GridVirtualListComponent {
57
65
  this.gridService.bodyScrollElement.set(bodyScrollElement);
58
66
  this.setRowScroller();
59
67
  this.setScrollEndSubscription();
68
+ this.setViewportResizeObserver(bodyScrollElement);
60
69
  this.#destroyRef.onDestroy(() => {
61
70
  if (this.gridService.bodyTableElement() === bodyTableElement) this.gridService.bodyTableElement.set(null);
62
71
  if (bodyScrollElement != null && this.gridService.bodyScrollElement() === bodyScrollElement) this.gridService.bodyScrollElement.set(null);
@@ -99,10 +108,9 @@ var GridVirtualListComponent = class GridVirtualListComponent {
99
108
  }
100
109
  setScrollEndSubscription() {
101
110
  const viewport = this.viewport();
102
- viewport.scrolledIndexChange.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
103
- const bottomOffset = viewport.measureScrollOffset("bottom");
104
- const itemHeight = this.gridService.virtualScrollOptions().height ?? 36;
105
- if (bottomOffset <= this.gridService.scrollEndThreshold() * itemHeight) this.gridService.scrollEnd$.next();
111
+ viewport.scrolledIndexChange.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((index) => {
112
+ const itemHeight = this.rowHeight();
113
+ if ((viewport.getDataLength() - index) * itemHeight - viewport.getViewportSize() <= this.gridService.scrollEndThreshold() * itemHeight) this.gridService.scrollEnd$.next();
106
114
  });
107
115
  }
108
116
  setSelectedKeysLoadSubscription() {
@@ -119,6 +127,17 @@ var GridVirtualListComponent = class GridVirtualListComponent {
119
127
  });
120
128
  });
121
129
  }
130
+ setViewportResizeObserver(viewportElement) {
131
+ if (viewportElement == null) return;
132
+ this.#viewportHeight.set(viewportElement.clientHeight);
133
+ if (typeof ResizeObserver === "undefined") return;
134
+ const observer = new ResizeObserver((entries) => {
135
+ this.#viewportHeight.set(entries[entries.length - 1]?.contentRect.height ?? 0);
136
+ this.viewport().checkViewportSize();
137
+ });
138
+ observer.observe(viewportElement);
139
+ this.#destroyRef.onDestroy(() => observer.disconnect());
140
+ }
122
141
  static {
123
142
  this.ɵfac = i0.ɵɵngDeclareFactory({
124
143
  minVersion: "12.0.0",
@@ -178,7 +197,7 @@ var GridVirtualListComponent = class GridVirtualListComponent {
178
197
  }
179
198
  ],
180
199
  ngImport: i0,
181
- template: "@if (gridService.addRowVisible()) {\n <div\n class=\"shrink-0 overflow-hidden border-b border-b-border\"\n [style.margin-inline-end.px]=\"gridService.scrollbarGutterWidth()\"\n #addRowScrollElement>\n <table role=\"presentation\" [class]=\"tableClass()\" [style.width.px]=\"gridService.tableWidth()\">\n <colgroup monaGridColgroup></colgroup>\n <tbody role=\"rowgroup\">\n <tr monaGridAddRow></tr>\n </tbody>\n </table>\n </div>\n}\n\n<cdk-virtual-scroll-viewport\n class=\"flex-1 min-h-0\"\n [itemSize]=\"gridService.virtualScrollOptions().height\"\n [minBufferPx]=\"gridService.virtualGridMinBuffer()\"\n [maxBufferPx]=\"gridService.virtualGridMaxBuffer()\">\n <table role=\"presentation\" #bodyTable [class]=\"tableClass()\" [style.width.px]=\"gridService.tableWidth()\">\n <colgroup monaGridColgroup></colgroup>\n <tbody role=\"rowgroup\" #bodyElement>\n <ng-container *cdkVirtualFor=\"let bodyRow of bodyRows(); let rowIndex = index; trackBy: trackBodyRow\">\n @let ariaRowIndex = gridService.bodyAriaRowStart() + rowIndex + 1;\n @if (bodyRow.type === \"group\") {\n <tr monaGridGroupRow [group]=\"bodyRow\" [rowIndex]=\"rowIndex\" [ariaRowIndex]=\"ariaRowIndex\"></tr>\n } @else if (bodyRow.type === \"groupFooter\") {\n <tr\n monaGridFooterRow\n [groupKey]=\"bodyRow.groupAggregate.groupKey\"\n [rowIndex]=\"rowIndex\"\n [section]=\"'body'\"\n [ariaLevel]=\"bodyRow.depth + 2\"\n [ariaRowIndex]=\"ariaRowIndex\"></tr>\n } @else {\n <!-- Detail rows aren't drawn with virtual scrolling: they would break the fixed row height. -->\n <tr monaGridRow [row]=\"bodyRow.row\" [index]=\"rowIndex\" [ariaRowIndex]=\"ariaRowIndex\"></tr>\n }\n </ng-container>\n </tbody>\n </table>\n</cdk-virtual-scroll-viewport>\n@if (gridService.contextMenuItems().length !== 0) {\n <mona-contextmenu [target]=\"bodyElement\" [items]=\"gridService.contextMenuItems()\" />\n}\n\n@if (gridService.hasFooter()) {\n <div [class]=\"footerClass()\" [style.margin-inline-end.px]=\"gridService.scrollbarGutterWidth()\" #footerScrollElement>\n <div>\n <table role=\"presentation\" [class]=\"footerTableClass()\" [style.width.px]=\"gridService.tableWidth()\">\n <colgroup monaGridColgroup></colgroup>\n <tfoot role=\"rowgroup\">\n <tr monaGridFooterRow [ariaRowIndex]=\"gridAriaRowCount()\"></tr>\n </tfoot>\n </table>\n </div>\n </div>\n}\n",
200
+ template: "@if (gridService.addRowVisible()) {\n <div\n class=\"shrink-0 overflow-hidden border-b border-b-border\"\n [style.margin-inline-end.px]=\"gridService.scrollbarGutterWidth()\"\n #addRowScrollElement>\n <table role=\"presentation\" [class]=\"tableClass()\" [style.width.px]=\"gridService.tableWidth()\">\n <colgroup monaGridColgroup></colgroup>\n <tbody role=\"rowgroup\">\n <tr monaGridAddRow></tr>\n </tbody>\n </table>\n </div>\n}\n\n<cdk-virtual-scroll-viewport\n class=\"flex-1 min-h-0\"\n [itemSize]=\"rowHeight()\"\n [minBufferPx]=\"minBufferPx()\"\n [maxBufferPx]=\"maxBufferPx()\">\n <table role=\"presentation\" #bodyTable [class]=\"tableClass()\" [style.width.px]=\"gridService.tableWidth()\">\n <colgroup monaGridColgroup></colgroup>\n <tbody role=\"rowgroup\" #bodyElement>\n <ng-container\n *cdkVirtualFor=\"\n let bodyRow of bodyRows();\n let rowIndex = index;\n trackBy: trackBodyRow;\n templateCacheSize: templateCacheSize()\n \">\n @let ariaRowIndex = gridService.bodyAriaRowStart() + rowIndex + 1;\n @if (bodyRow.type === \"group\") {\n <tr monaGridGroupRow [group]=\"bodyRow\" [rowIndex]=\"rowIndex\" [ariaRowIndex]=\"ariaRowIndex\"></tr>\n } @else if (bodyRow.type === \"groupFooter\") {\n <tr\n monaGridFooterRow\n [groupKey]=\"bodyRow.groupAggregate.groupKey\"\n [rowIndex]=\"rowIndex\"\n [section]=\"'body'\"\n [ariaLevel]=\"bodyRow.depth + 2\"\n [ariaRowIndex]=\"ariaRowIndex\"></tr>\n } @else {\n <!-- Detail rows aren't drawn with virtual scrolling: they would break the fixed row height. -->\n <tr monaGridRow [row]=\"bodyRow.row\" [index]=\"rowIndex\" [ariaRowIndex]=\"ariaRowIndex\"></tr>\n }\n </ng-container>\n </tbody>\n </table>\n</cdk-virtual-scroll-viewport>\n@if (gridService.contextMenuItems().length !== 0) {\n <mona-contextmenu [target]=\"bodyElement\" [items]=\"gridService.contextMenuItems()\" />\n}\n\n@if (gridService.hasFooter()) {\n <div [class]=\"footerClass()\" [style.margin-inline-end.px]=\"gridService.scrollbarGutterWidth()\" #footerScrollElement>\n <div>\n <table role=\"presentation\" [class]=\"footerTableClass()\" [style.width.px]=\"gridService.tableWidth()\">\n <colgroup monaGridColgroup></colgroup>\n <tfoot role=\"rowgroup\">\n <tr monaGridFooterRow [ariaRowIndex]=\"gridAriaRowCount()\"></tr>\n </tfoot>\n </table>\n </div>\n </div>\n}\n",
182
201
  dependencies: [
183
202
  {
184
203
  kind: "component",
@@ -294,7 +313,7 @@ i0.ɵɵngDeclareClassMetadata({
294
313
  "[class]": "baseClass()",
295
314
  "[style.--mona-grid-row-height]": "gridService.virtualScrollOptions().height + 'px'"
296
315
  },
297
- template: "@if (gridService.addRowVisible()) {\n <div\n class=\"shrink-0 overflow-hidden border-b border-b-border\"\n [style.margin-inline-end.px]=\"gridService.scrollbarGutterWidth()\"\n #addRowScrollElement>\n <table role=\"presentation\" [class]=\"tableClass()\" [style.width.px]=\"gridService.tableWidth()\">\n <colgroup monaGridColgroup></colgroup>\n <tbody role=\"rowgroup\">\n <tr monaGridAddRow></tr>\n </tbody>\n </table>\n </div>\n}\n\n<cdk-virtual-scroll-viewport\n class=\"flex-1 min-h-0\"\n [itemSize]=\"gridService.virtualScrollOptions().height\"\n [minBufferPx]=\"gridService.virtualGridMinBuffer()\"\n [maxBufferPx]=\"gridService.virtualGridMaxBuffer()\">\n <table role=\"presentation\" #bodyTable [class]=\"tableClass()\" [style.width.px]=\"gridService.tableWidth()\">\n <colgroup monaGridColgroup></colgroup>\n <tbody role=\"rowgroup\" #bodyElement>\n <ng-container *cdkVirtualFor=\"let bodyRow of bodyRows(); let rowIndex = index; trackBy: trackBodyRow\">\n @let ariaRowIndex = gridService.bodyAriaRowStart() + rowIndex + 1;\n @if (bodyRow.type === \"group\") {\n <tr monaGridGroupRow [group]=\"bodyRow\" [rowIndex]=\"rowIndex\" [ariaRowIndex]=\"ariaRowIndex\"></tr>\n } @else if (bodyRow.type === \"groupFooter\") {\n <tr\n monaGridFooterRow\n [groupKey]=\"bodyRow.groupAggregate.groupKey\"\n [rowIndex]=\"rowIndex\"\n [section]=\"'body'\"\n [ariaLevel]=\"bodyRow.depth + 2\"\n [ariaRowIndex]=\"ariaRowIndex\"></tr>\n } @else {\n <!-- Detail rows aren't drawn with virtual scrolling: they would break the fixed row height. -->\n <tr monaGridRow [row]=\"bodyRow.row\" [index]=\"rowIndex\" [ariaRowIndex]=\"ariaRowIndex\"></tr>\n }\n </ng-container>\n </tbody>\n </table>\n</cdk-virtual-scroll-viewport>\n@if (gridService.contextMenuItems().length !== 0) {\n <mona-contextmenu [target]=\"bodyElement\" [items]=\"gridService.contextMenuItems()\" />\n}\n\n@if (gridService.hasFooter()) {\n <div [class]=\"footerClass()\" [style.margin-inline-end.px]=\"gridService.scrollbarGutterWidth()\" #footerScrollElement>\n <div>\n <table role=\"presentation\" [class]=\"footerTableClass()\" [style.width.px]=\"gridService.tableWidth()\">\n <colgroup monaGridColgroup></colgroup>\n <tfoot role=\"rowgroup\">\n <tr monaGridFooterRow [ariaRowIndex]=\"gridAriaRowCount()\"></tr>\n </tfoot>\n </table>\n </div>\n </div>\n}\n"
316
+ template: "@if (gridService.addRowVisible()) {\n <div\n class=\"shrink-0 overflow-hidden border-b border-b-border\"\n [style.margin-inline-end.px]=\"gridService.scrollbarGutterWidth()\"\n #addRowScrollElement>\n <table role=\"presentation\" [class]=\"tableClass()\" [style.width.px]=\"gridService.tableWidth()\">\n <colgroup monaGridColgroup></colgroup>\n <tbody role=\"rowgroup\">\n <tr monaGridAddRow></tr>\n </tbody>\n </table>\n </div>\n}\n\n<cdk-virtual-scroll-viewport\n class=\"flex-1 min-h-0\"\n [itemSize]=\"rowHeight()\"\n [minBufferPx]=\"minBufferPx()\"\n [maxBufferPx]=\"maxBufferPx()\">\n <table role=\"presentation\" #bodyTable [class]=\"tableClass()\" [style.width.px]=\"gridService.tableWidth()\">\n <colgroup monaGridColgroup></colgroup>\n <tbody role=\"rowgroup\" #bodyElement>\n <ng-container\n *cdkVirtualFor=\"\n let bodyRow of bodyRows();\n let rowIndex = index;\n trackBy: trackBodyRow;\n templateCacheSize: templateCacheSize()\n \">\n @let ariaRowIndex = gridService.bodyAriaRowStart() + rowIndex + 1;\n @if (bodyRow.type === \"group\") {\n <tr monaGridGroupRow [group]=\"bodyRow\" [rowIndex]=\"rowIndex\" [ariaRowIndex]=\"ariaRowIndex\"></tr>\n } @else if (bodyRow.type === \"groupFooter\") {\n <tr\n monaGridFooterRow\n [groupKey]=\"bodyRow.groupAggregate.groupKey\"\n [rowIndex]=\"rowIndex\"\n [section]=\"'body'\"\n [ariaLevel]=\"bodyRow.depth + 2\"\n [ariaRowIndex]=\"ariaRowIndex\"></tr>\n } @else {\n <!-- Detail rows aren't drawn with virtual scrolling: they would break the fixed row height. -->\n <tr monaGridRow [row]=\"bodyRow.row\" [index]=\"rowIndex\" [ariaRowIndex]=\"ariaRowIndex\"></tr>\n }\n </ng-container>\n </tbody>\n </table>\n</cdk-virtual-scroll-viewport>\n@if (gridService.contextMenuItems().length !== 0) {\n <mona-contextmenu [target]=\"bodyElement\" [items]=\"gridService.contextMenuItems()\" />\n}\n\n@if (gridService.hasFooter()) {\n <div [class]=\"footerClass()\" [style.margin-inline-end.px]=\"gridService.scrollbarGutterWidth()\" #footerScrollElement>\n <div>\n <table role=\"presentation\" [class]=\"footerTableClass()\" [style.width.px]=\"gridService.tableWidth()\">\n <colgroup monaGridColgroup></colgroup>\n <tfoot role=\"rowgroup\">\n <tr monaGridFooterRow [ariaRowIndex]=\"gridAriaRowCount()\"></tr>\n </tfoot>\n </table>\n </div>\n </div>\n}\n"
298
317
  }]
299
318
  }],
300
319
  ctorParameters: () => [],
@@ -327,4 +346,4 @@ i0.ɵɵngDeclareClassMetadata({
327
346
  });
328
347
  export { GridVirtualListComponent };
329
348
 
330
- //# sourceMappingURL=grid-virtual-list.component-DNjoZfHq.mjs.map
349
+ //# sourceMappingURL=grid-virtual-list.component-rIz5AUOU.mjs.map
@@ -1164,8 +1164,13 @@ var GridRowFlattenerService = class GridRowFlattenerService {
1164
1164
  this.#flattenRecursive([...rows], columnArray, groupAggregates, 0, null, collapsedKeys, showFooter, orderGroups ? options : null, result);
1165
1165
  return result;
1166
1166
  }
1167
- toDataRows(rows) {
1168
- return Array.from(rows, (row) => this.#createDataRow(row, 0, null));
1167
+ toDataRows(rows, previous = []) {
1168
+ const dataRows = [];
1169
+ for (const row of rows) {
1170
+ const kept = previous[dataRows.length];
1171
+ dataRows.push(kept?.type === "data" && kept.row === row && kept.groupKey === null && kept.depth === 0 ? kept : this.#createDataRow(row, 0, null));
1172
+ }
1173
+ return dataRows;
1169
1174
  }
1170
1175
  #createDataRow(row, depth, groupKey) {
1171
1176
  return {
@@ -1457,7 +1462,9 @@ var GridService = class GridService {
1457
1462
  #dataStateEmissionPending;
1458
1463
  #groupRequest;
1459
1464
  #loadedSelectedKeys;
1465
+ #previousDataRows;
1460
1466
  #rowSource;
1467
+ #rowState;
1461
1468
  constructor() {
1462
1469
  this.#anchorRowKey = signal(null, ...ngDevMode ? [{ debugName: "#anchorRowKey" }] : /* istanbul ignore next */ []);
1463
1470
  this.#bulkSelectionRowKeys = computed(() => {
@@ -1544,7 +1551,9 @@ var GridService = class GridService {
1544
1551
  this.#dataStateEmissionPending = false;
1545
1552
  this.#groupRequest = [];
1546
1553
  this.#loadedSelectedKeys = null;
1554
+ this.#previousDataRows = [];
1547
1555
  this.#rowSource = null;
1556
+ this.#rowState = null;
1548
1557
  this.add$ = new Subject();
1549
1558
  this.addRowData = computed(() => {
1550
1559
  const session = this.#editSession();
@@ -1756,6 +1765,7 @@ var GridService = class GridService {
1756
1765
  this.renderedBodyRowCount = signal(0, ...ngDevMode ? [{ debugName: "renderedBodyRowCount" }] : /* istanbul ignore next */ []);
1757
1766
  this.reorderableOptions = this.#reorderableOptions.asReadonly();
1758
1767
  this.resizableOptions = this.#resizableOptions.asReadonly();
1768
+ this.rowActivate$ = new Subject();
1759
1769
  this.rowClass = signal(null, ...ngDevMode ? [{ debugName: "rowClass" }] : /* istanbul ignore next */ []);
1760
1770
  this.rowDragInProgress = computed(() => this.draggingRowUid() != null, ...ngDevMode ? [{ debugName: "rowDragInProgress" }] : /* istanbul ignore next */ []);
1761
1771
  this.rowEdit$ = new Subject();
@@ -1890,19 +1900,19 @@ var GridService = class GridService {
1890
1900
  if (tree != null) return ImmutableList.create(tree.rows);
1891
1901
  const rows = this.rows();
1892
1902
  if (this.serverBindingEnabled()) return rows;
1893
- let queryEnumerable = Query.from(rows, { locale: this.#i18n.localeId() });
1894
- for (const filter of this.getFilterDescriptors()) queryEnumerable = queryEnumerable.filter(filter, (r) => r.data);
1903
+ const filters = this.getFilterDescriptors();
1895
1904
  const groupSorts = this.getGroupDescriptors(this.groupColumns()).map((d) => ({
1896
1905
  field: d.field,
1897
1906
  dir: d.dir ?? "asc"
1898
1907
  }));
1899
1908
  const groupFields = new Set(groupSorts.map((sort) => sort.field));
1900
1909
  const columnSorts = this.#sortDescriptors().filter((sort) => !groupFields.has(sort.field));
1910
+ if (filters.length === 0 && groupSorts.length === 0 && columnSorts.length === 0) return rows;
1911
+ let queryEnumerable = Query.from(rows, { locale: this.#i18n.localeId() });
1912
+ for (const filter of filters) queryEnumerable = queryEnumerable.filter(filter, (r) => r.data);
1901
1913
  queryEnumerable = queryEnumerable.sort([...groupSorts, ...columnSorts], (r) => r.data);
1902
1914
  return ImmutableList.create(queryEnumerable.run());
1903
1915
  }, ...ngDevMode ? [{ debugName: "viewRows" }] : /* istanbul ignore next */ []);
1904
- this.virtualGridMaxBuffer = computed(() => this.virtualGridMinBuffer() * 1.42857, ...ngDevMode ? [{ debugName: "virtualGridMaxBuffer" }] : /* istanbul ignore next */ []);
1905
- this.virtualGridMinBuffer = signal(0, ...ngDevMode ? [{ debugName: "virtualGridMinBuffer" }] : /* istanbul ignore next */ []);
1906
1916
  this.virtualScrollOptions = signal({
1907
1917
  enabled: false,
1908
1918
  height: 36
@@ -1913,6 +1923,13 @@ var GridService = class GridService {
1913
1923
  this.setHorizontalScrollSyncEffects();
1914
1924
  this.setScrollbarGutterEffects();
1915
1925
  }
1926
+ activateRow(row, originalEvent) {
1927
+ if (this.isInEditMode()) return;
1928
+ this.rowActivate$.next({
1929
+ originalEvent,
1930
+ rowData: row.data
1931
+ });
1932
+ }
1916
1933
  addGroupColumn(column) {
1917
1934
  if (column.kind === "command" || this.#groupColumnIds().contains(column.id)) return;
1918
1935
  this.#groupColumnIds.update((ids) => ids.add(column.id));
@@ -2093,7 +2110,11 @@ var GridService = class GridService {
2093
2110
  }
2094
2111
  createBodyRows(rows) {
2095
2112
  const groupColumns = this.groupColumns();
2096
- if (groupColumns.length === 0) return this.#rowFlattener.toDataRows(rows);
2113
+ if (groupColumns.length === 0) {
2114
+ const dataRows = this.#rowFlattener.toDataRows(rows, this.#previousDataRows);
2115
+ this.#previousDataRows = dataRows;
2116
+ return dataRows;
2117
+ }
2097
2118
  return this.#rowFlattener.flatten(rows, groupColumns, new Set(this.collapsedGroupKeys()), this.groupableOptions().showFooter, this.groupAggregateMap(), this.serverBindingEnabled(), { locale: this.#i18n.localeId() });
2098
2119
  }
2099
2120
  deselectAllRows() {
@@ -2758,22 +2779,27 @@ var GridService = class GridService {
2758
2779
  data: value,
2759
2780
  rowKey
2760
2781
  };
2761
- const occurrences = /* @__PURE__ */ new Map();
2762
- let duplicateKey = false;
2782
+ const children = this.#treeOptions()?.children ?? null;
2783
+ if (children == null && Array.isArray(value) && this.appendRows(value, rowKey)) return;
2784
+ const state = {
2785
+ duplicateKey: false,
2786
+ items: [],
2787
+ keys: [],
2788
+ occurrences: /* @__PURE__ */ new Map(),
2789
+ rowKey,
2790
+ rows: ImmutableList.create(),
2791
+ seen: /* @__PURE__ */ new Set()
2792
+ };
2763
2793
  const rows = [];
2764
2794
  const parents = /* @__PURE__ */ new Map();
2765
- const children = this.#treeOptions()?.children ?? null;
2766
- const path = /* @__PURE__ */ new Set();
2767
- const addRows = (items, parentUid) => {
2768
- for (const data of items) {
2769
- if (path.has(data)) continue;
2770
- const uid = this.getRowUid(data, rowKey);
2771
- const occurrence = (occurrences.get(uid) ?? 0) + 1;
2772
- occurrences.set(uid, occurrence);
2773
- if (occurrence > 1 && rowKey) duplicateKey = true;
2774
- const row = new Row(data, occurrence === 1 ? uid : `${uid}#${occurrence}`);
2775
- rows.push(row);
2776
- if (children != null) {
2795
+ if (children == null) for (const data of value) rows.push(this.readRow(data, state, true));
2796
+ else {
2797
+ const path = /* @__PURE__ */ new Set();
2798
+ const addRows = (items, parentUid) => {
2799
+ for (const data of items) {
2800
+ if (path.has(data)) continue;
2801
+ const row = this.readRow(data, state, false);
2802
+ rows.push(row);
2777
2803
  parents.set(row.uid, parentUid);
2778
2804
  const childItems = getTreeChildren(data, children);
2779
2805
  if (childItems != null) {
@@ -2782,12 +2808,14 @@ var GridService = class GridService {
2782
2808
  path.delete(data);
2783
2809
  }
2784
2810
  }
2785
- }
2786
- };
2787
- addRows(value, null);
2788
- if (duplicateKey && isDevMode()) console.warn("mona-grid: several rows have the same rowKey value. Selection, editing and detail rows follow the key, so give every row a unique key.");
2811
+ };
2812
+ addRows(value, null);
2813
+ }
2814
+ this.warnDuplicateKeys(state);
2789
2815
  this.#treeParents.set(parents);
2790
- this.rows.set(ImmutableList.create(rows));
2816
+ state.rows = ImmutableList.create(rows);
2817
+ this.#rowState = children == null ? state : null;
2818
+ this.rows.set(state.rows);
2791
2819
  }
2792
2820
  setScrollEndThreshold(threshold) {
2793
2821
  this.scrollEndThreshold.set(threshold);
@@ -3003,6 +3031,21 @@ var GridService = class GridService {
3003
3031
  const message = (field != null ? [...field().errors(), ...session.form().errors()] : session.form().errorSummary()).find((error) => !!error.message)?.message || (field != null ? messages.fieldValidationError : messages.rowValidationError);
3004
3032
  if (message) this.#liveAnnouncer.announce(message, "polite");
3005
3033
  }
3034
+ appendRows(items, rowKey) {
3035
+ const state = this.#rowState;
3036
+ if (state == null || state.rowKey !== rowKey || state.rows !== this.rows() || items.length <= state.items.length) return false;
3037
+ const readCount = state.items.length;
3038
+ for (let index = 0; index < readCount; index++) if (items[index] !== state.items[index]) return false;
3039
+ if (rowKey) {
3040
+ for (let index = 0; index < readCount; index++) if (!Object.is(this.getRowUidKey(items[index], rowKey), state.keys[index])) return false;
3041
+ }
3042
+ const rows = [];
3043
+ for (let index = readCount; index < items.length; index++) rows.push(this.readRow(items[index], state, true));
3044
+ this.warnDuplicateKeys(state);
3045
+ state.rows = state.rows.addAll(rows);
3046
+ this.rows.set(state.rows);
3047
+ return true;
3048
+ }
3006
3049
  applyColumnIndexes(columns) {
3007
3050
  return this.withColumnIndices(columns);
3008
3051
  }
@@ -3177,8 +3220,7 @@ var GridService = class GridService {
3177
3220
  getRowSelectionKey(row) {
3178
3221
  return this.getRowDataItemSelectionKey(row.data);
3179
3222
  }
3180
- getRowUid(data, rowKey) {
3181
- const key = this.getRowUidKey(data, rowKey);
3223
+ getRowUid(data, key) {
3182
3224
  if (key != null) {
3183
3225
  if (typeof key === "object" || typeof key === "function") {
3184
3226
  const cachedKeyUid = this.#rowUidByKeyObject.get(key);
@@ -3229,6 +3271,25 @@ var GridService = class GridService {
3229
3271
  ...rightLockedColumns
3230
3272
  ];
3231
3273
  }
3274
+ readRow(data, state, flat) {
3275
+ const key = this.getRowUidKey(data, state.rowKey);
3276
+ const uid = this.getRowUid(data, key);
3277
+ const source = key == null ? data : typeof key === "symbol" ? uid : key;
3278
+ const seenCount = state.seen.size;
3279
+ state.seen.add(source);
3280
+ let rowUid = uid;
3281
+ if (state.seen.size === seenCount) {
3282
+ const occurrence = (state.occurrences.get(uid) ?? 1) + 1;
3283
+ state.occurrences.set(uid, occurrence);
3284
+ rowUid = `${uid}#${occurrence}`;
3285
+ if (state.rowKey) state.duplicateKey = true;
3286
+ }
3287
+ if (flat) {
3288
+ state.items.push(data);
3289
+ state.keys.push(key);
3290
+ }
3291
+ return new Row(data, rowUid);
3292
+ }
3232
3293
  reconcileColumn(config, previous) {
3233
3294
  const hidden = previous != null && previous.configuredHidden === config.hidden ? previous.hidden : config.hidden;
3234
3295
  return {
@@ -3426,6 +3487,9 @@ var GridService = class GridService {
3426
3487
  if (!valid && !field.pending()) this.announceInvalid(session);
3427
3488
  return valid;
3428
3489
  }
3490
+ warnDuplicateKeys(state) {
3491
+ if (state.duplicateKey && isDevMode()) console.warn("mona-grid: several rows have the same rowKey value. Selection, editing and detail rows follow the key, so give every row a unique key.");
3492
+ }
3429
3493
  withColumnIndices(columns) {
3430
3494
  return columns.map((column, index) => column.index === index ? column : {
3431
3495
  ...column,
@@ -3736,6 +3800,7 @@ var GridLogicalCellDirective = class GridLogicalCellDirective {
3736
3800
  if (section != null) return section;
3737
3801
  return this.#hostElementRef.nativeElement.tagName === "TH" ? "header" : "body";
3738
3802
  }, ...ngDevMode ? [{ debugName: "resolvedSection" }] : /* istanbul ignore next */ []);
3803
+ this.activate = output();
3739
3804
  this.ariaColIndex = input(null, ...ngDevMode ? [{ debugName: "ariaColIndex" }] : /* istanbul ignore next */ []);
3740
3805
  this.cellKind = input(null, ...ngDevMode ? [{ debugName: "cellKind" }] : /* istanbul ignore next */ []);
3741
3806
  this.colIndex = input.required(...ngDevMode ? [{ debugName: "colIndex" }] : /* istanbul ignore next */ []);
@@ -3910,20 +3975,25 @@ var GridLogicalCellDirective = class GridLogicalCellDirective {
3910
3975
  if (!cellKey) return false;
3911
3976
  return this.#gridNavigationService.navigate(cellKey, navigationKey);
3912
3977
  }
3913
- #onEnterKey() {
3978
+ #onEnterKey(event) {
3914
3979
  if (this.groupHeader() || this.resolvedSection() === "header" || this.resolvedCellKind() === "detail") {
3915
3980
  this.toggleExpand.emit();
3916
3981
  return;
3917
3982
  }
3918
- this.#onF2Key();
3983
+ if (!this.#onF2Key()) this.activate.emit(event);
3919
3984
  }
3920
3985
  #onF2Key() {
3921
3986
  if (this.editable()) {
3922
3987
  this.edit.emit();
3923
- return;
3988
+ return true;
3989
+ }
3990
+ if (this.#enterCell()) return true;
3991
+ const editableOptions = this.#gridService.editableOptions();
3992
+ if (this.resolvedCellKind() === "data" && editableOptions.enabled === true && editableOptions.mode === "row") {
3993
+ this.edit.emit();
3994
+ return true;
3924
3995
  }
3925
- if (this.#enterCell()) return;
3926
- if (this.resolvedCellKind() === "data") this.edit.emit();
3996
+ return false;
3927
3997
  }
3928
3998
  #onHostKeydown(event) {
3929
3999
  if (event.defaultPrevented || event.isComposing) return;
@@ -3964,7 +4034,7 @@ var GridLogicalCellDirective = class GridLogicalCellDirective {
3964
4034
  }
3965
4035
  case "Enter":
3966
4036
  event.preventDefault();
3967
- this.#onEnterKey();
4037
+ this.#onEnterKey(event);
3968
4038
  return;
3969
4039
  case "F2":
3970
4040
  event.preventDefault();
@@ -4138,6 +4208,7 @@ var GridLogicalCellDirective = class GridLogicalCellDirective {
4138
4208
  }
4139
4209
  },
4140
4210
  outputs: {
4211
+ activate: "activate",
4141
4212
  edit: "edit",
4142
4213
  menuOpen: "menuOpen",
4143
4214
  toggleExpand: "toggleExpand"
@@ -4171,6 +4242,10 @@ i0.ɵɵngDeclareClassMetadata({
4171
4242
  }],
4172
4243
  ctorParameters: () => [],
4173
4244
  propDecorators: {
4245
+ activate: [{
4246
+ type: i0.Output,
4247
+ args: ["activate"]
4248
+ }],
4174
4249
  ariaColIndex: [{
4175
4250
  type: i0.Input,
4176
4251
  args: [{
@@ -4601,4 +4676,4 @@ const gridNoDataThemeVariants = cva(`
4601
4676
  `);
4602
4677
  export { getGridCellText as $, gridHeaderThemeVariants as A, gridTreeLeafSpacerThemeVariants as B, gridHeaderGroupTableRowThemeVariants as C, gridHeaderTableColumnWrapThemeVariants as D, gridHeaderTableColumnTitleThemeVariants as E, gridNoDataThemeVariants as F, observeGridCellTabStops as G, GridLogicalCellDirective as H, gridRowDragPreviewThemeVariants as I, getColumnGroupDepth as J, GridLockedCellDirective as K, gridRowReorderHandleThemeVariants as L, gridListTableCellThemeVariants as M, gridListTableRowThemeVariants as N, gridHeaderTableRowThemeVariants as O, gridListTableThemeVariants as P, formatGridCellValue as Q, gridSelectAllCellThemeVariants as R, gridHeaderGroupSpacerCellThemeVariants as S, gridHeaderTableCellThemeVariants as T, GRID_CELL_FOCUSABLE_SELECTOR as U, gridTreeToggleThemeVariants as V, isKeyboardEntryElement as W, getColumnStepTarget as X, getColumnGroups as Y, getSiblingRuns as Z, gridFooterThemeVariants as _, gridCellEditorBaseThemeVariants as a, GridEditEvent as at, gridGroupRowThemeVariants as b, gridColumnActionsThemeVariants as c, RowEditEvent as ct, gridColumnResizerThemeVariants as d, RowReorderEvent as et, gridFilterRowCellThemeVariants as f, gridFooterTableThemeVariants as g, gridFooterTableRowThemeVariants as h, gridCellDirtyIndicatorThemeVariants as i, GridRemoveEvent as it, gridListBaseThemeVariants as j, gridHeaderTableThemeVariants as k, gridColumnDragPreviewThemeVariants as l, CellEditEvent as lt, gridFooterTableCellThemeVariants as m, gridCellBaseThemeVariants as n, GRID_DEFAULT_MESSAGES as nt, gridCellEditorInputThemeVariants as o, GridCancelEvent as ot, gridFilterRowHeaderCellThemeVariants as p, GridService as q, gridCellContainerThemeVariants as r, GridSaveEvent as rt, gridCellTextThemeVariants as s, GridAddEvent as st, gridBaseThemeVariants as t, GridNavigationService as tt, gridColumnDropHintThemeVariants as u, gridGroupPanelPlaceholderThemeVariants as v, gridHeaderGroupTitleThemeVariants as w, gridHeaderGroupCellThemeVariants as x, gridGroupPanelThemeVariants as y, gridSelectionCellThemeVariants as z };
4603
4678
 
4604
- //# sourceMappingURL=grid.styles-BJHVTT_v.mjs.map
4679
+ //# sourceMappingURL=grid.styles-D6jP3vwD.mjs.map