@toolbox-web/grid-angular 1.5.0 → 1.6.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 (78) hide show
  1. package/fesm2022/toolbox-web-grid-angular-features-clipboard.mjs +1 -1
  2. package/fesm2022/toolbox-web-grid-angular-features-clipboard.mjs.map +1 -1
  3. package/fesm2022/toolbox-web-grid-angular-features-column-virtualization.mjs +1 -1
  4. package/fesm2022/toolbox-web-grid-angular-features-column-virtualization.mjs.map +1 -1
  5. package/fesm2022/toolbox-web-grid-angular-features-context-menu.mjs +1 -1
  6. package/fesm2022/toolbox-web-grid-angular-features-context-menu.mjs.map +1 -1
  7. package/fesm2022/toolbox-web-grid-angular-features-editing.mjs +1 -1
  8. package/fesm2022/toolbox-web-grid-angular-features-editing.mjs.map +1 -1
  9. package/fesm2022/toolbox-web-grid-angular-features-export.mjs +1 -1
  10. package/fesm2022/toolbox-web-grid-angular-features-export.mjs.map +1 -1
  11. package/fesm2022/toolbox-web-grid-angular-features-grouping-columns.mjs +1 -1
  12. package/fesm2022/toolbox-web-grid-angular-features-grouping-columns.mjs.map +1 -1
  13. package/fesm2022/toolbox-web-grid-angular-features-grouping-rows.mjs +1 -1
  14. package/fesm2022/toolbox-web-grid-angular-features-grouping-rows.mjs.map +1 -1
  15. package/fesm2022/toolbox-web-grid-angular-features-master-detail.mjs +1 -2
  16. package/fesm2022/toolbox-web-grid-angular-features-master-detail.mjs.map +1 -1
  17. package/fesm2022/toolbox-web-grid-angular-features-multi-sort.mjs +1 -1
  18. package/fesm2022/toolbox-web-grid-angular-features-multi-sort.mjs.map +1 -1
  19. package/fesm2022/toolbox-web-grid-angular-features-pinned-columns.mjs +1 -1
  20. package/fesm2022/toolbox-web-grid-angular-features-pinned-columns.mjs.map +1 -1
  21. package/fesm2022/toolbox-web-grid-angular-features-pinned-rows.mjs +1 -1
  22. package/fesm2022/toolbox-web-grid-angular-features-pinned-rows.mjs.map +1 -1
  23. package/fesm2022/toolbox-web-grid-angular-features-pivot.mjs +1 -1
  24. package/fesm2022/toolbox-web-grid-angular-features-pivot.mjs.map +1 -1
  25. package/fesm2022/toolbox-web-grid-angular-features-print.mjs +1 -1
  26. package/fesm2022/toolbox-web-grid-angular-features-print.mjs.map +1 -1
  27. package/fesm2022/toolbox-web-grid-angular-features-reorder-columns.mjs +1 -1
  28. package/fesm2022/toolbox-web-grid-angular-features-reorder-columns.mjs.map +1 -1
  29. package/fesm2022/toolbox-web-grid-angular-features-reorder-rows.mjs +1 -1
  30. package/fesm2022/toolbox-web-grid-angular-features-reorder-rows.mjs.map +1 -1
  31. package/fesm2022/toolbox-web-grid-angular-features-responsive.mjs +1 -2
  32. package/fesm2022/toolbox-web-grid-angular-features-responsive.mjs.map +1 -1
  33. package/fesm2022/toolbox-web-grid-angular-features-row-drag-drop.mjs +1 -1
  34. package/fesm2022/toolbox-web-grid-angular-features-row-drag-drop.mjs.map +1 -1
  35. package/fesm2022/toolbox-web-grid-angular-features-selection.mjs +1 -1
  36. package/fesm2022/toolbox-web-grid-angular-features-selection.mjs.map +1 -1
  37. package/fesm2022/toolbox-web-grid-angular-features-server-side.mjs +1 -1
  38. package/fesm2022/toolbox-web-grid-angular-features-server-side.mjs.map +1 -1
  39. package/fesm2022/toolbox-web-grid-angular-features-sticky-rows.mjs +58 -0
  40. package/fesm2022/toolbox-web-grid-angular-features-sticky-rows.mjs.map +1 -0
  41. package/fesm2022/toolbox-web-grid-angular-features-tooltip.mjs +1 -1
  42. package/fesm2022/toolbox-web-grid-angular-features-tooltip.mjs.map +1 -1
  43. package/fesm2022/toolbox-web-grid-angular-features-tree.mjs +1 -1
  44. package/fesm2022/toolbox-web-grid-angular-features-tree.mjs.map +1 -1
  45. package/fesm2022/toolbox-web-grid-angular-features-undo-redo.mjs +1 -1
  46. package/fesm2022/toolbox-web-grid-angular-features-undo-redo.mjs.map +1 -1
  47. package/fesm2022/toolbox-web-grid-angular-features-visibility.mjs +1 -1
  48. package/fesm2022/toolbox-web-grid-angular-features-visibility.mjs.map +1 -1
  49. package/fesm2022/toolbox-web-grid-angular.mjs +29 -11
  50. package/fesm2022/toolbox-web-grid-angular.mjs.map +1 -1
  51. package/package.json +5 -1
  52. package/types/toolbox-web-grid-angular-features-clipboard.d.ts +1 -1
  53. package/types/toolbox-web-grid-angular-features-column-virtualization.d.ts +1 -1
  54. package/types/toolbox-web-grid-angular-features-context-menu.d.ts +1 -1
  55. package/types/toolbox-web-grid-angular-features-editing.d.ts +1 -1
  56. package/types/toolbox-web-grid-angular-features-export.d.ts +1 -1
  57. package/types/toolbox-web-grid-angular-features-grouping-columns.d.ts +1 -1
  58. package/types/toolbox-web-grid-angular-features-grouping-rows.d.ts +1 -1
  59. package/types/toolbox-web-grid-angular-features-master-detail.d.ts +1 -1
  60. package/types/toolbox-web-grid-angular-features-multi-sort.d.ts +1 -1
  61. package/types/toolbox-web-grid-angular-features-pinned-columns.d.ts +1 -1
  62. package/types/toolbox-web-grid-angular-features-pinned-rows.d.ts +1 -1
  63. package/types/toolbox-web-grid-angular-features-pivot.d.ts +1 -1
  64. package/types/toolbox-web-grid-angular-features-print.d.ts +1 -1
  65. package/types/toolbox-web-grid-angular-features-reorder-columns.d.ts +1 -1
  66. package/types/toolbox-web-grid-angular-features-reorder-rows.d.ts +1 -1
  67. package/types/toolbox-web-grid-angular-features-responsive.d.ts +1 -1
  68. package/types/toolbox-web-grid-angular-features-row-drag-drop.d.ts +1 -1
  69. package/types/toolbox-web-grid-angular-features-selection.d.ts +1 -1
  70. package/types/toolbox-web-grid-angular-features-server-side.d.ts +1 -1
  71. package/types/toolbox-web-grid-angular-features-sticky-rows.d.ts +22 -0
  72. package/types/toolbox-web-grid-angular-features-sticky-rows.d.ts.map +1 -0
  73. package/types/toolbox-web-grid-angular-features-tooltip.d.ts +1 -1
  74. package/types/toolbox-web-grid-angular-features-tree.d.ts +1 -1
  75. package/types/toolbox-web-grid-angular-features-undo-redo.d.ts +1 -1
  76. package/types/toolbox-web-grid-angular-features-visibility.d.ts +1 -1
  77. package/types/toolbox-web-grid-angular.d.ts +15 -2
  78. package/types/toolbox-web-grid-angular.d.ts.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"toolbox-web-grid-angular-features-undo-redo.mjs","sources":["../../../../libs/grid-angular/features/undo-redo/src/grid-undo-redo.directive.ts","../../../../libs/grid-angular/features/undo-redo/src/index.ts","../../../../libs/grid-angular/features/undo-redo/src/toolbox-web-grid-angular-features-undo-redo.ts"],"sourcesContent":["/**\n * `GridUndoRedoDirective` — owns `[undoRedo]`, `(undo)` and `(redo)` on\n * `<tbw-grid>`. See `GridFilteringDirective` for the full rationale.\n *\n * @category Directive\n */\nimport { Directive, ElementRef, inject, input, OnDestroy, OnInit, output } from '@angular/core';\nimport type { DataGridElement } from '@toolbox-web/grid';\nimport { claimEvent, registerFeatureClaim, unclaimEvent, unregisterFeatureClaim } from '@toolbox-web/grid-angular';\nimport type { UndoRedoConfig, UndoRedoDetail } from '@toolbox-web/grid/plugins/undo-redo';\n\n/**\n * Owns the binding(s) `[undoRedo], [undo], [redo]` on `<tbw-grid>` for the matching feature plugin. See {@link GridFilteringDirective} for the full rationale.\n *\n * @category Directive\n */\n@Directive({\n selector: 'tbw-grid[undoRedo], tbw-grid[undo], tbw-grid[redo]',\n standalone: true,\n})\nexport class GridUndoRedoDirective implements OnInit, OnDestroy {\n private readonly elementRef = inject(ElementRef<DataGridElement>);\n\n readonly undoRedo = input<boolean | UndoRedoConfig>();\n readonly undo = output<UndoRedoDetail>();\n readonly redo = output<UndoRedoDetail>();\n\n private readonly listeners = new Map<string, (e: Event) => void>();\n\n constructor() {\n const grid = this.elementRef.nativeElement;\n registerFeatureClaim(grid, 'undoRedo', () => this.undoRedo());\n claimEvent(grid, 'undo');\n claimEvent(grid, 'redo');\n }\n\n ngOnInit(): void {\n const grid = this.elementRef.nativeElement;\n const wire = (name: string, out: { emit: (v: UndoRedoDetail) => void }): void => {\n const l = (e: Event): void => out.emit((e as CustomEvent<UndoRedoDetail>).detail);\n grid.addEventListener(name, l);\n this.listeners.set(name, l);\n };\n wire('undo', this.undo);\n wire('redo', this.redo);\n }\n\n ngOnDestroy(): void {\n const grid = this.elementRef.nativeElement;\n for (const [name, l] of this.listeners) grid.removeEventListener(name, l);\n this.listeners.clear();\n unregisterFeatureClaim(grid, 'undoRedo');\n unclaimEvent(grid, 'undo');\n unclaimEvent(grid, 'redo');\n }\n}\n","/**\n * Undo/Redo feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `undoRedo` input on Grid directive.\n * Also exports `injectGridUndoRedo()` for programmatic undo/redo control.\n * Requires editing feature to be enabled.\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid-angular/features/editing';\n * import '@toolbox-web/grid-angular/features/undo-redo';\n *\n * <tbw-grid [editing]=\"'dblclick'\" [undoRedo]=\"true\" />\n * ```\n *\n * @example Using injectGridUndoRedo\n * ```typescript\n * import { injectGridUndoRedo } from '@toolbox-web/grid-angular/features/undo-redo';\n *\n * @Component({...})\n * export class MyComponent {\n * private undoRedo = injectGridUndoRedo();\n *\n * undo() { this.undoRedo.undo(); }\n * redo() { this.undoRedo.redo(); }\n * }\n * ```\n *\n * @packageDocumentation\n */\n\nimport { afterNextRender, DestroyRef, ElementRef, inject, signal, type Signal } from '@angular/core';\nimport type { DataGridElement } from '@toolbox-web/grid';\nimport '@toolbox-web/grid/features/undo-redo';\nimport { UndoRedoPlugin, type UndoRedoAction } from '@toolbox-web/grid/plugins/undo-redo';\nexport { GridUndoRedoDirective } from './grid-undo-redo.directive';\nexport type { _Augmentation as _UndoRedoAugmentation } from '@toolbox-web/grid/features/undo-redo';\n\n/**\n * Undo/Redo methods returned from injectGridUndoRedo.\n *\n * Uses lazy discovery - the grid is found on first method call, not during initialization.\n */\nexport interface UndoRedoMethods {\n /**\n * Undo the last edit action.\n * @returns The undone action (or compound action), or null if nothing to undo\n */\n undo: () => UndoRedoAction | null;\n\n /**\n * Redo the last undone action.\n * @returns The redone action (or compound action), or null if nothing to redo\n */\n redo: () => UndoRedoAction | null;\n\n /**\n * Reactive signal indicating whether undo is available.\n * Updates automatically when edits are made, undone, redone, or history is cleared.\n *\n * @example\n * ```typescript\n * // In template:\n * // <button [disabled]=\"!undoRedo.canUndo()\">Undo</button>\n *\n * // In computed:\n * readonly undoAvailable = computed(() => this.undoRedo.canUndo());\n * ```\n */\n canUndo: Signal<boolean>;\n\n /**\n * Reactive signal indicating whether redo is available.\n * Updates automatically when edits are made, undone, redone, or history is cleared.\n *\n * @example\n * ```typescript\n * // In template:\n * // <button [disabled]=\"!undoRedo.canRedo()\">Redo</button>\n *\n * // In computed:\n * readonly redoAvailable = computed(() => this.undoRedo.canRedo());\n * ```\n */\n canRedo: Signal<boolean>;\n\n /**\n * Clear all undo/redo history.\n */\n clearHistory: () => void;\n\n /**\n * Get a copy of the current undo stack.\n */\n getUndoStack: () => UndoRedoAction[];\n\n /**\n * Get a copy of the current redo stack.\n */\n getRedoStack: () => UndoRedoAction[];\n\n /**\n * Manually record an edit action.\n * If a transaction is active, the action is buffered; otherwise it's pushed to the undo stack.\n */\n recordEdit: (rowIndex: number, field: string, oldValue: unknown, newValue: unknown) => void;\n\n /**\n * Begin a transaction. All edits recorded until `endTransaction()` are grouped\n * into a single compound action for undo/redo.\n * @throws If a transaction is already active\n */\n beginTransaction: () => void;\n\n /**\n * End the active transaction and push the compound action to the undo stack.\n * If only one edit was recorded, it's pushed as a plain EditAction.\n * If no edits were recorded, the transaction is discarded.\n * @throws If no transaction is active\n */\n endTransaction: () => void;\n\n /**\n * Signal indicating if grid is ready.\n */\n isReady: Signal<boolean>;\n}\n\n/**\n * Angular inject function for programmatic undo/redo control.\n *\n * Uses **lazy grid discovery** - the grid element is found when methods are called,\n * not during initialization.\n *\n * @example\n * ```typescript\n * import { Component } from '@angular/core';\n * import { Grid } from '@toolbox-web/grid-angular';\n * import '@toolbox-web/grid-angular/features/editing';\n * import '@toolbox-web/grid-angular/features/undo-redo';\n * import { injectGridUndoRedo } from '@toolbox-web/grid-angular/features/undo-redo';\n *\n * @Component({\n * selector: 'app-my-grid',\n * imports: [Grid],\n * template: `\n * <button (click)=\"undoRedo.undo()\" [disabled]=\"!undoRedo.canUndo()\">Undo</button>\n * <button (click)=\"undoRedo.redo()\" [disabled]=\"!undoRedo.canRedo()\">Redo</button>\n * <tbw-grid [rows]=\"rows\" [editing]=\"'dblclick'\" [undoRedo]=\"true\"></tbw-grid>\n * `\n * })\n * export class MyGridComponent {\n * undoRedo = injectGridUndoRedo();\n * }\n * ```\n *\n * @param selector - Optional CSS selector to target a specific grid element.\n * Defaults to `'tbw-grid'` (first grid in the component). Use when the\n * component contains multiple grids, e.g. `'tbw-grid.primary'` or `'#my-grid'`.\n */\nexport function injectGridUndoRedo(selector = 'tbw-grid'): UndoRedoMethods {\n const elementRef = inject(ElementRef);\n const destroyRef = inject(DestroyRef);\n const isReady = signal(false);\n\n // Reactive undo/redo availability signals\n const canUndoSignal = signal(false);\n const canRedoSignal = signal(false);\n\n let cachedGrid: DataGridElement | null = null;\n let readyPromiseStarted = false;\n let listenerAttached = false;\n\n /**\n * Sync canUndo/canRedo signals with the current plugin state.\n */\n const syncSignals = (): void => {\n const plugin = getPlugin();\n if (plugin) {\n canUndoSignal.set(plugin.canUndo());\n canRedoSignal.set(plugin.canRedo());\n }\n };\n\n /**\n * Attach event listeners to the grid for undo/redo state changes.\n * Listens for `undo`, `redo`, and `cell-commit` DOM events.\n */\n const attachListeners = (grid: DataGridElement): void => {\n if (listenerAttached) return;\n listenerAttached = true;\n\n const unsubs = [grid.on('undo', syncSignals), grid.on('redo', syncSignals), grid.on('cell-commit', syncSignals)];\n\n destroyRef.onDestroy(() => {\n unsubs.forEach((fn) => fn());\n });\n };\n\n const getGrid = (): DataGridElement | null => {\n if (cachedGrid) return cachedGrid;\n\n const grid = elementRef.nativeElement.querySelector(selector) as DataGridElement | null;\n if (grid) {\n cachedGrid = grid;\n attachListeners(grid);\n if (!readyPromiseStarted) {\n readyPromiseStarted = true;\n grid.ready?.().then(() => {\n if (grid.getPluginByName('undoRedo')) {\n isReady.set(true);\n } else {\n setTimeout(() => isReady.set(true), 0);\n }\n });\n }\n }\n return grid;\n };\n\n const getPlugin = (): UndoRedoPlugin | undefined => {\n return getGrid()?.getPluginByName('undoRedo') as UndoRedoPlugin | undefined;\n };\n\n // Eagerly discover the grid after the first render so event listeners\n // are attached and isReady updates without requiring a programmatic\n // method call. Falls back to MutationObserver for lazy-rendered content.\n afterNextRender(() => {\n const grid = getGrid();\n if (grid) {\n grid.ready?.().then(() => {\n if (grid.getPluginByName('undoRedo')) {\n syncSignals();\n } else {\n setTimeout(syncSignals, 0);\n }\n });\n return;\n }\n\n const host = elementRef.nativeElement as HTMLElement;\n const observer = new MutationObserver(() => {\n const discovered = getGrid();\n if (discovered) {\n observer.disconnect();\n discovered.ready?.().then(() => {\n if (discovered.getPluginByName('undoRedo')) {\n syncSignals();\n } else {\n setTimeout(syncSignals, 0);\n }\n });\n }\n });\n observer.observe(host, { childList: true, subtree: true });\n\n destroyRef.onDestroy(() => observer.disconnect());\n });\n\n return {\n isReady: isReady.asReadonly(),\n canUndo: canUndoSignal.asReadonly(),\n canRedo: canRedoSignal.asReadonly(),\n\n undo: () => {\n const plugin = getPlugin();\n if (!plugin) {\n console.warn(\n `[tbw-grid:undoRedo] UndoRedoPlugin not found.\\n\\n` +\n ` → Enable undo/redo on the grid:\\n` +\n ` <tbw-grid [editing]=\"'dblclick'\" [undoRedo]=\"true\" />`,\n );\n return null;\n }\n const result = plugin.undo();\n syncSignals();\n return result;\n },\n\n redo: () => {\n const plugin = getPlugin();\n if (!plugin) {\n console.warn(\n `[tbw-grid:undoRedo] UndoRedoPlugin not found.\\n\\n` +\n ` → Enable undo/redo on the grid:\\n` +\n ` <tbw-grid [editing]=\"'dblclick'\" [undoRedo]=\"true\" />`,\n );\n return null;\n }\n const result = plugin.redo();\n syncSignals();\n return result;\n },\n\n clearHistory: () => {\n const plugin = getPlugin();\n if (!plugin) {\n console.warn(\n `[tbw-grid:undoRedo] UndoRedoPlugin not found.\\n\\n` +\n ` → Enable undo/redo on the grid:\\n` +\n ` <tbw-grid [editing]=\"'dblclick'\" [undoRedo]=\"true\" />`,\n );\n return;\n }\n plugin.clearHistory();\n syncSignals();\n },\n\n getUndoStack: () => getPlugin()?.getUndoStack() ?? [],\n\n getRedoStack: () => getPlugin()?.getRedoStack() ?? [],\n\n recordEdit: (rowIndex: number, field: string, oldValue: unknown, newValue: unknown) => {\n const plugin = getPlugin();\n if (!plugin) {\n console.warn(\n `[tbw-grid:undoRedo] UndoRedoPlugin not found.\\n\\n` +\n ` → Enable undo/redo on the grid:\\n` +\n ` <tbw-grid [editing]=\"'dblclick'\" [undoRedo]=\"true\" />`,\n );\n return;\n }\n plugin.recordEdit(rowIndex, field, oldValue, newValue);\n syncSignals();\n },\n\n beginTransaction: () => {\n const plugin = getPlugin();\n if (!plugin) {\n console.warn(\n `[tbw-grid:undoRedo] UndoRedoPlugin not found.\\n\\n` +\n ` → Enable undo/redo on the grid:\\n` +\n ` <tbw-grid [editing]=\"'dblclick'\" [undoRedo]=\"true\" />`,\n );\n return;\n }\n plugin.beginTransaction();\n },\n\n endTransaction: () => {\n const plugin = getPlugin();\n if (!plugin) {\n console.warn(\n `[tbw-grid:undoRedo] UndoRedoPlugin not found.\\n\\n` +\n ` → Enable undo/redo on the grid:\\n` +\n ` <tbw-grid [editing]=\"'dblclick'\" [undoRedo]=\"true\" />`,\n );\n return;\n }\n plugin.endTransaction();\n syncSignals();\n },\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;;;;;AAKG;AAMH;;;;AAIG;MAKU,qBAAqB,CAAA;AACf,IAAA,UAAU,GAAG,MAAM,EAAC,UAA2B,EAAC;IAExD,QAAQ,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,UAAA,EAA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,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;QAErD,YAAY,EAAE,MAAM,SAAS,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;QAErD,UAAU,EAAE,CAAC,QAAgB,EAAE,KAAa,EAAE,QAAiB,EAAE,QAAiB,KAAI;AACpF,YAAA,MAAM,MAAM,GAAG,SAAS,EAAE;YAC1B,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO,CAAC,IAAI,CACV,CAAA,iDAAA,CAAmD;oBACjD,CAAA,mCAAA,CAAqC;AACrC,oBAAA,CAAA,yDAAA,CAA2D,CAC9D;gBACD;YACF;YACA,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC;AACtD,YAAA,WAAW,EAAE;QACf,CAAC;QAED,gBAAgB,EAAE,MAAK;AACrB,YAAA,MAAM,MAAM,GAAG,SAAS,EAAE;YAC1B,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO,CAAC,IAAI,CACV,CAAA,iDAAA,CAAmD;oBACjD,CAAA,mCAAA,CAAqC;AACrC,oBAAA,CAAA,yDAAA,CAA2D,CAC9D;gBACD;YACF;YACA,MAAM,CAAC,gBAAgB,EAAE;QAC3B,CAAC;QAED,cAAc,EAAE,MAAK;AACnB,YAAA,MAAM,MAAM,GAAG,SAAS,EAAE;YAC1B,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO,CAAC,IAAI,CACV,CAAA,iDAAA,CAAmD;oBACjD,CAAA,mCAAA,CAAqC;AACrC,oBAAA,CAAA,yDAAA,CAA2D,CAC9D;gBACD;YACF;YACA,MAAM,CAAC,cAAc,EAAE;AACvB,YAAA,WAAW,EAAE;QACf,CAAC;KACF;AACH;;ACjWA;;AAEG;;;;"}
1
+ {"version":3,"file":"toolbox-web-grid-angular-features-undo-redo.mjs","sources":["../../../../libs/grid-angular/features/undo-redo/src/grid-undo-redo.directive.ts","../../../../libs/grid-angular/features/undo-redo/src/index.ts","../../../../libs/grid-angular/features/undo-redo/src/toolbox-web-grid-angular-features-undo-redo.ts"],"sourcesContent":["/**\n * `GridUndoRedoDirective` — owns `[undoRedo]`, `(undo)` and `(redo)` on\n * `<tbw-grid>`. See `GridFilteringDirective` for the full rationale.\n *\n * @category Directive\n */\nimport { Directive, ElementRef, inject, input, OnDestroy, OnInit, output } from '@angular/core';\nimport type { DataGridElement } from '@toolbox-web/grid';\nimport { claimEvent, registerFeatureClaim, unclaimEvent, unregisterFeatureClaim } from '@toolbox-web/grid-angular';\nimport type { UndoRedoConfig, UndoRedoDetail } from '@toolbox-web/grid/plugins/undo-redo';\n\n/**\n * Owns the binding(s) `[undoRedo], [undo], [redo]` on `<tbw-grid>` for the matching feature plugin. See `GridFilteringDirective` for the full rationale.\n *\n * @category Directive\n */\n@Directive({\n selector: 'tbw-grid[undoRedo], tbw-grid[undo], tbw-grid[redo]',\n standalone: true,\n})\nexport class GridUndoRedoDirective implements OnInit, OnDestroy {\n private readonly elementRef = inject(ElementRef<DataGridElement>);\n\n readonly undoRedo = input<boolean | UndoRedoConfig>();\n readonly undo = output<UndoRedoDetail>();\n readonly redo = output<UndoRedoDetail>();\n\n private readonly listeners = new Map<string, (e: Event) => void>();\n\n constructor() {\n const grid = this.elementRef.nativeElement;\n registerFeatureClaim(grid, 'undoRedo', () => this.undoRedo());\n claimEvent(grid, 'undo');\n claimEvent(grid, 'redo');\n }\n\n ngOnInit(): void {\n const grid = this.elementRef.nativeElement;\n const wire = (name: string, out: { emit: (v: UndoRedoDetail) => void }): void => {\n const l = (e: Event): void => out.emit((e as CustomEvent<UndoRedoDetail>).detail);\n grid.addEventListener(name, l);\n this.listeners.set(name, l);\n };\n wire('undo', this.undo);\n wire('redo', this.redo);\n }\n\n ngOnDestroy(): void {\n const grid = this.elementRef.nativeElement;\n for (const [name, l] of this.listeners) grid.removeEventListener(name, l);\n this.listeners.clear();\n unregisterFeatureClaim(grid, 'undoRedo');\n unclaimEvent(grid, 'undo');\n unclaimEvent(grid, 'redo');\n }\n}\n","/**\n * Undo/Redo feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `undoRedo` input on Grid directive.\n * Also exports `injectGridUndoRedo()` for programmatic undo/redo control.\n * Requires editing feature to be enabled.\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid-angular/features/editing';\n * import '@toolbox-web/grid-angular/features/undo-redo';\n *\n * <tbw-grid [editing]=\"'dblclick'\" [undoRedo]=\"true\" />\n * ```\n *\n * @example Using injectGridUndoRedo\n * ```typescript\n * import { injectGridUndoRedo } from '@toolbox-web/grid-angular/features/undo-redo';\n *\n * @Component({...})\n * export class MyComponent {\n * private undoRedo = injectGridUndoRedo();\n *\n * undo() { this.undoRedo.undo(); }\n * redo() { this.undoRedo.redo(); }\n * }\n * ```\n *\n * @packageDocumentation\n */\n\nimport { afterNextRender, DestroyRef, ElementRef, inject, signal, type Signal } from '@angular/core';\nimport type { DataGridElement } from '@toolbox-web/grid';\nimport '@toolbox-web/grid/features/undo-redo';\nimport { UndoRedoPlugin, type UndoRedoAction } from '@toolbox-web/grid/plugins/undo-redo';\nexport { GridUndoRedoDirective } from './grid-undo-redo.directive';\nexport type { _Augmentation as _UndoRedoAugmentation } from '@toolbox-web/grid/features/undo-redo';\n\n/**\n * Undo/Redo methods returned from injectGridUndoRedo.\n *\n * Uses lazy discovery - the grid is found on first method call, not during initialization.\n */\nexport interface UndoRedoMethods {\n /**\n * Undo the last edit action.\n * @returns The undone action (or compound action), or null if nothing to undo\n */\n undo: () => UndoRedoAction | null;\n\n /**\n * Redo the last undone action.\n * @returns The redone action (or compound action), or null if nothing to redo\n */\n redo: () => UndoRedoAction | null;\n\n /**\n * Reactive signal indicating whether undo is available.\n * Updates automatically when edits are made, undone, redone, or history is cleared.\n *\n * @example\n * ```typescript\n * // In template:\n * // <button [disabled]=\"!undoRedo.canUndo()\">Undo</button>\n *\n * // In computed:\n * readonly undoAvailable = computed(() => this.undoRedo.canUndo());\n * ```\n */\n canUndo: Signal<boolean>;\n\n /**\n * Reactive signal indicating whether redo is available.\n * Updates automatically when edits are made, undone, redone, or history is cleared.\n *\n * @example\n * ```typescript\n * // In template:\n * // <button [disabled]=\"!undoRedo.canRedo()\">Redo</button>\n *\n * // In computed:\n * readonly redoAvailable = computed(() => this.undoRedo.canRedo());\n * ```\n */\n canRedo: Signal<boolean>;\n\n /**\n * Clear all undo/redo history.\n */\n clearHistory: () => void;\n\n /**\n * Get a copy of the current undo stack.\n */\n getUndoStack: () => UndoRedoAction[];\n\n /**\n * Get a copy of the current redo stack.\n */\n getRedoStack: () => UndoRedoAction[];\n\n /**\n * Manually record an edit action.\n * If a transaction is active, the action is buffered; otherwise it's pushed to the undo stack.\n */\n recordEdit: (rowIndex: number, field: string, oldValue: unknown, newValue: unknown) => void;\n\n /**\n * Begin a transaction. All edits recorded until `endTransaction()` are grouped\n * into a single compound action for undo/redo.\n * @throws If a transaction is already active\n */\n beginTransaction: () => void;\n\n /**\n * End the active transaction and push the compound action to the undo stack.\n * If only one edit was recorded, it's pushed as a plain EditAction.\n * If no edits were recorded, the transaction is discarded.\n * @throws If no transaction is active\n */\n endTransaction: () => void;\n\n /**\n * Signal indicating if grid is ready.\n */\n isReady: Signal<boolean>;\n}\n\n/**\n * Angular inject function for programmatic undo/redo control.\n *\n * Uses **lazy grid discovery** - the grid element is found when methods are called,\n * not during initialization.\n *\n * @example\n * ```typescript\n * import { Component } from '@angular/core';\n * import { Grid } from '@toolbox-web/grid-angular';\n * import '@toolbox-web/grid-angular/features/editing';\n * import '@toolbox-web/grid-angular/features/undo-redo';\n * import { injectGridUndoRedo } from '@toolbox-web/grid-angular/features/undo-redo';\n *\n * @Component({\n * selector: 'app-my-grid',\n * imports: [Grid],\n * template: `\n * <button (click)=\"undoRedo.undo()\" [disabled]=\"!undoRedo.canUndo()\">Undo</button>\n * <button (click)=\"undoRedo.redo()\" [disabled]=\"!undoRedo.canRedo()\">Redo</button>\n * <tbw-grid [rows]=\"rows\" [editing]=\"'dblclick'\" [undoRedo]=\"true\"></tbw-grid>\n * `\n * })\n * export class MyGridComponent {\n * undoRedo = injectGridUndoRedo();\n * }\n * ```\n *\n * @param selector - Optional CSS selector to target a specific grid element.\n * Defaults to `'tbw-grid'` (first grid in the component). Use when the\n * component contains multiple grids, e.g. `'tbw-grid.primary'` or `'#my-grid'`.\n */\nexport function injectGridUndoRedo(selector = 'tbw-grid'): UndoRedoMethods {\n const elementRef = inject(ElementRef);\n const destroyRef = inject(DestroyRef);\n const isReady = signal(false);\n\n // Reactive undo/redo availability signals\n const canUndoSignal = signal(false);\n const canRedoSignal = signal(false);\n\n let cachedGrid: DataGridElement | null = null;\n let readyPromiseStarted = false;\n let listenerAttached = false;\n\n /**\n * Sync canUndo/canRedo signals with the current plugin state.\n */\n const syncSignals = (): void => {\n const plugin = getPlugin();\n if (plugin) {\n canUndoSignal.set(plugin.canUndo());\n canRedoSignal.set(plugin.canRedo());\n }\n };\n\n /**\n * Attach event listeners to the grid for undo/redo state changes.\n * Listens for `undo`, `redo`, and `cell-commit` DOM events.\n */\n const attachListeners = (grid: DataGridElement): void => {\n if (listenerAttached) return;\n listenerAttached = true;\n\n const unsubs = [grid.on('undo', syncSignals), grid.on('redo', syncSignals), grid.on('cell-commit', syncSignals)];\n\n destroyRef.onDestroy(() => {\n unsubs.forEach((fn) => fn());\n });\n };\n\n const getGrid = (): DataGridElement | null => {\n if (cachedGrid) return cachedGrid;\n\n const grid = elementRef.nativeElement.querySelector(selector) as DataGridElement | null;\n if (grid) {\n cachedGrid = grid;\n attachListeners(grid);\n if (!readyPromiseStarted) {\n readyPromiseStarted = true;\n grid.ready?.().then(() => {\n if (grid.getPluginByName('undoRedo')) {\n isReady.set(true);\n } else {\n setTimeout(() => isReady.set(true), 0);\n }\n });\n }\n }\n return grid;\n };\n\n const getPlugin = (): UndoRedoPlugin | undefined => {\n return getGrid()?.getPluginByName('undoRedo') as UndoRedoPlugin | undefined;\n };\n\n // Eagerly discover the grid after the first render so event listeners\n // are attached and isReady updates without requiring a programmatic\n // method call. Falls back to MutationObserver for lazy-rendered content.\n afterNextRender(() => {\n const grid = getGrid();\n if (grid) {\n grid.ready?.().then(() => {\n if (grid.getPluginByName('undoRedo')) {\n syncSignals();\n } else {\n setTimeout(syncSignals, 0);\n }\n });\n return;\n }\n\n const host = elementRef.nativeElement as HTMLElement;\n const observer = new MutationObserver(() => {\n const discovered = getGrid();\n if (discovered) {\n observer.disconnect();\n discovered.ready?.().then(() => {\n if (discovered.getPluginByName('undoRedo')) {\n syncSignals();\n } else {\n setTimeout(syncSignals, 0);\n }\n });\n }\n });\n observer.observe(host, { childList: true, subtree: true });\n\n destroyRef.onDestroy(() => observer.disconnect());\n });\n\n return {\n isReady: isReady.asReadonly(),\n canUndo: canUndoSignal.asReadonly(),\n canRedo: canRedoSignal.asReadonly(),\n\n undo: () => {\n const plugin = getPlugin();\n if (!plugin) {\n console.warn(\n `[tbw-grid:undoRedo] UndoRedoPlugin not found.\\n\\n` +\n ` → Enable undo/redo on the grid:\\n` +\n ` <tbw-grid [editing]=\"'dblclick'\" [undoRedo]=\"true\" />`,\n );\n return null;\n }\n const result = plugin.undo();\n syncSignals();\n return result;\n },\n\n redo: () => {\n const plugin = getPlugin();\n if (!plugin) {\n console.warn(\n `[tbw-grid:undoRedo] UndoRedoPlugin not found.\\n\\n` +\n ` → Enable undo/redo on the grid:\\n` +\n ` <tbw-grid [editing]=\"'dblclick'\" [undoRedo]=\"true\" />`,\n );\n return null;\n }\n const result = plugin.redo();\n syncSignals();\n return result;\n },\n\n clearHistory: () => {\n const plugin = getPlugin();\n if (!plugin) {\n console.warn(\n `[tbw-grid:undoRedo] UndoRedoPlugin not found.\\n\\n` +\n ` → Enable undo/redo on the grid:\\n` +\n ` <tbw-grid [editing]=\"'dblclick'\" [undoRedo]=\"true\" />`,\n );\n return;\n }\n plugin.clearHistory();\n syncSignals();\n },\n\n getUndoStack: () => getPlugin()?.getUndoStack() ?? [],\n\n getRedoStack: () => getPlugin()?.getRedoStack() ?? [],\n\n recordEdit: (rowIndex: number, field: string, oldValue: unknown, newValue: unknown) => {\n const plugin = getPlugin();\n if (!plugin) {\n console.warn(\n `[tbw-grid:undoRedo] UndoRedoPlugin not found.\\n\\n` +\n ` → Enable undo/redo on the grid:\\n` +\n ` <tbw-grid [editing]=\"'dblclick'\" [undoRedo]=\"true\" />`,\n );\n return;\n }\n plugin.recordEdit(rowIndex, field, oldValue, newValue);\n syncSignals();\n },\n\n beginTransaction: () => {\n const plugin = getPlugin();\n if (!plugin) {\n console.warn(\n `[tbw-grid:undoRedo] UndoRedoPlugin not found.\\n\\n` +\n ` → Enable undo/redo on the grid:\\n` +\n ` <tbw-grid [editing]=\"'dblclick'\" [undoRedo]=\"true\" />`,\n );\n return;\n }\n plugin.beginTransaction();\n },\n\n endTransaction: () => {\n const plugin = getPlugin();\n if (!plugin) {\n console.warn(\n `[tbw-grid:undoRedo] UndoRedoPlugin not found.\\n\\n` +\n ` → Enable undo/redo on the grid:\\n` +\n ` <tbw-grid [editing]=\"'dblclick'\" [undoRedo]=\"true\" />`,\n );\n return;\n }\n plugin.endTransaction();\n syncSignals();\n },\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;;;;;AAKG;AAMH;;;;AAIG;MAKU,qBAAqB,CAAA;AACf,IAAA,UAAU,GAAG,MAAM,EAAC,UAA2B,EAAC;IAExD,QAAQ,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,UAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAA4B;IAC5C,IAAI,GAAG,MAAM,EAAkB;IAC/B,IAAI,GAAG,MAAM,EAAkB;AAEvB,IAAA,SAAS,GAAG,IAAI,GAAG,EAA8B;AAElE,IAAA,WAAA,GAAA;AACE,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa;AAC1C,QAAA,oBAAoB,CAAC,IAAI,EAAE,U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C,IAAI,CACV,CAAA,iDAAA,CAAmD;oBACjD,CAAA,mCAAA,CAAqC;AACrC,oBAAA,CAAA,yDAAA,CAA2D,CAC9D;gBACD;YACF;YACA,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC;AACtD,YAAA,WAAW,EAAE;QACf,CAAC;QAED,gBAAgB,EAAE,MAAK;AACrB,YAAA,MAAM,MAAM,GAAG,SAAS,EAAE;YAC1B,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO,CAAC,IAAI,CACV,CAAA,iDAAA,CAAmD;oBACjD,CAAA,mCAAA,CAAqC;AACrC,oBAAA,CAAA,yDAAA,CAA2D,CAC9D;gBACD;YACF;YACA,MAAM,CAAC,gBAAgB,EAAE;QAC3B,CAAC;QAED,cAAc,EAAE,MAAK;AACnB,YAAA,MAAM,MAAM,GAAG,SAAS,EAAE;YAC1B,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO,CAAC,IAAI,CACV,CAAA,iDAAA,CAAmD;oBACjD,CAAA,mCAAA,CAAqC;AACrC,oBAAA,CAAA,yDAAA,CAA2D,CAC9D;gBACD;YACF;YACA,MAAM,CAAC,cAAc,EAAE;AACvB,YAAA,WAAW,EAAE;QACf,CAAC;KACF;AACH;;ACjWA;;AAEG;;;;"}
@@ -12,7 +12,7 @@ import { registerFeatureClaim, claimEvent, unregisterFeatureClaim, unclaimEvent
12
12
  * @category Directive
13
13
  */
14
14
  /**
15
- * Owns the binding(s) `[visibility], [columnVisibility]` on `<tbw-grid>` for the matching feature plugin. See {@link GridFilteringDirective} for the full rationale.
15
+ * Owns the binding(s) `[visibility], [columnVisibility]` on `<tbw-grid>` for the matching feature plugin. See `GridFilteringDirective` for the full rationale.
16
16
  *
17
17
  * @category Directive
18
18
  */
@@ -1 +1 @@
1
- {"version":3,"file":"toolbox-web-grid-angular-features-visibility.mjs","sources":["../../../../libs/grid-angular/features/visibility/src/grid-visibility.directive.ts","../../../../libs/grid-angular/features/visibility/src/index.ts","../../../../libs/grid-angular/features/visibility/src/toolbox-web-grid-angular-features-visibility.ts"],"sourcesContent":["/**\n * `GridVisibilityDirective` — owns `[visibility]` and `(columnVisibility)`\n * on `<tbw-grid>`. The `(columnStateChange)` output stays on `Grid`\n * because it covers a broader set of column-state mutations beyond just\n * visibility toggles. See `GridFilteringDirective` for the full rationale.\n *\n * @category Directive\n */\nimport { Directive, ElementRef, inject, input, OnDestroy, OnInit, output } from '@angular/core';\nimport type { DataGridElement } from '@toolbox-web/grid';\nimport { claimEvent, registerFeatureClaim, unclaimEvent, unregisterFeatureClaim } from '@toolbox-web/grid-angular';\nimport type { ColumnVisibilityDetail, VisibilityConfig } from '@toolbox-web/grid/plugins/visibility';\n\n/**\n * Owns the binding(s) `[visibility], [columnVisibility]` on `<tbw-grid>` for the matching feature plugin. See {@link GridFilteringDirective} for the full rationale.\n *\n * @category Directive\n */\n@Directive({\n selector: 'tbw-grid[visibility], tbw-grid[columnVisibility]',\n standalone: true,\n})\nexport class GridVisibilityDirective implements OnInit, OnDestroy {\n private readonly elementRef = inject(ElementRef<DataGridElement>);\n\n readonly visibility = input<boolean | VisibilityConfig>();\n readonly columnVisibility = output<ColumnVisibilityDetail>();\n\n private listener?: (e: Event) => void;\n\n constructor() {\n const grid = this.elementRef.nativeElement;\n registerFeatureClaim(grid, 'visibility', () => this.visibility());\n claimEvent(grid, 'column-visibility');\n }\n\n ngOnInit(): void {\n const grid = this.elementRef.nativeElement;\n this.listener = (e: Event): void => this.columnVisibility.emit((e as CustomEvent<ColumnVisibilityDetail>).detail);\n grid.addEventListener('column-visibility', this.listener);\n }\n\n ngOnDestroy(): void {\n const grid = this.elementRef.nativeElement;\n if (this.listener) {\n grid.removeEventListener('column-visibility', this.listener);\n this.listener = undefined;\n }\n unregisterFeatureClaim(grid, 'visibility');\n unclaimEvent(grid, 'column-visibility');\n }\n}\n","/**\n * Column visibility feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `visibility` input on Grid directive.\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid-angular/features/visibility';\n *\n * <tbw-grid [visibility]=\"true\" />\n * ```\n *\n * @packageDocumentation\n */\n\nimport '@toolbox-web/grid/features/visibility';\nexport { GridVisibilityDirective } from './grid-visibility.directive';\nexport type { _Augmentation as _VisibilityAugmentation } from '@toolbox-web/grid/features/visibility';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;AAOG;AAMH;;;;AAIG;MAKU,uBAAuB,CAAA;AACjB,IAAA,UAAU,GAAG,MAAM,EAAC,UAA2B,EAAC;IAExD,UAAU,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,YAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAA8B;IAChD,gBAAgB,GAAG,MAAM,EAA0B;AAEpD,IAAA,QAAQ;AAEhB,IAAA,WAAA,GAAA;AACE,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa;AAC1C,QAAA,oBAAoB,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;AACjE,QAAA,UAAU,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACvC;IAEA,QAAQ,GAAA;AACN,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa;AAC1C,QAAA,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAQ,KAAW,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAE,CAAyC,CAAC,MAAM,CAAC;QACjH,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,IAAI,CAAC,QAAQ,CAAC;IAC3D;IAEA,WAAW,GAAA;AACT,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa;AAC1C,QAAA,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,IAAI,CAAC,mBAAmB,CAAC,mBAAmB,EAAE,IAAI,CAAC,QAAQ,CAAC;AAC5D,YAAA,IAAI,CAAC,QAAQ,GAAG,SAAS;QAC3B;AACA,QAAA,sBAAsB,CAAC,IAAI,EAAE,YAAY,CAAC;AAC1C,QAAA,YAAY,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACzC;uGA5BW,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAvB,uBAAuB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kDAAA,EAAA,MAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,YAAA,EAAA,UAAA,EAAA,YAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,gBAAA,EAAA,kBAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAvB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAJnC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,kDAAkD;AAC5D,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;;ACrBD;;;;;;;;;;;;;AAaG;;ACbH;;AAEG;;;;"}
1
+ {"version":3,"file":"toolbox-web-grid-angular-features-visibility.mjs","sources":["../../../../libs/grid-angular/features/visibility/src/grid-visibility.directive.ts","../../../../libs/grid-angular/features/visibility/src/index.ts","../../../../libs/grid-angular/features/visibility/src/toolbox-web-grid-angular-features-visibility.ts"],"sourcesContent":["/**\n * `GridVisibilityDirective` — owns `[visibility]` and `(columnVisibility)`\n * on `<tbw-grid>`. The `(columnStateChange)` output stays on `Grid`\n * because it covers a broader set of column-state mutations beyond just\n * visibility toggles. See `GridFilteringDirective` for the full rationale.\n *\n * @category Directive\n */\nimport { Directive, ElementRef, inject, input, OnDestroy, OnInit, output } from '@angular/core';\nimport type { DataGridElement } from '@toolbox-web/grid';\nimport { claimEvent, registerFeatureClaim, unclaimEvent, unregisterFeatureClaim } from '@toolbox-web/grid-angular';\nimport type { ColumnVisibilityDetail, VisibilityConfig } from '@toolbox-web/grid/plugins/visibility';\n\n/**\n * Owns the binding(s) `[visibility], [columnVisibility]` on `<tbw-grid>` for the matching feature plugin. See `GridFilteringDirective` for the full rationale.\n *\n * @category Directive\n */\n@Directive({\n selector: 'tbw-grid[visibility], tbw-grid[columnVisibility]',\n standalone: true,\n})\nexport class GridVisibilityDirective implements OnInit, OnDestroy {\n private readonly elementRef = inject(ElementRef<DataGridElement>);\n\n readonly visibility = input<boolean | VisibilityConfig>();\n readonly columnVisibility = output<ColumnVisibilityDetail>();\n\n private listener?: (e: Event) => void;\n\n constructor() {\n const grid = this.elementRef.nativeElement;\n registerFeatureClaim(grid, 'visibility', () => this.visibility());\n claimEvent(grid, 'column-visibility');\n }\n\n ngOnInit(): void {\n const grid = this.elementRef.nativeElement;\n this.listener = (e: Event): void => this.columnVisibility.emit((e as CustomEvent<ColumnVisibilityDetail>).detail);\n grid.addEventListener('column-visibility', this.listener);\n }\n\n ngOnDestroy(): void {\n const grid = this.elementRef.nativeElement;\n if (this.listener) {\n grid.removeEventListener('column-visibility', this.listener);\n this.listener = undefined;\n }\n unregisterFeatureClaim(grid, 'visibility');\n unclaimEvent(grid, 'column-visibility');\n }\n}\n","/**\n * Column visibility feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `visibility` input on Grid directive.\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid-angular/features/visibility';\n *\n * <tbw-grid [visibility]=\"true\" />\n * ```\n *\n * @packageDocumentation\n */\n\nimport '@toolbox-web/grid/features/visibility';\nexport { GridVisibilityDirective } from './grid-visibility.directive';\nexport type { _Augmentation as _VisibilityAugmentation } from '@toolbox-web/grid/features/visibility';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"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AA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAvB,uBAAuB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kDAAA,EAAA,MAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,YAAA,EAAA,UAAA,EAAA,YAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,gBAAA,EAAA,kBAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAvB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAJnC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,kDAAkD;AAC5D,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;;ACrBD;;;;;;;;;;;;;AAaG;;ACbH;;AAEG;;;;"}
@@ -1450,13 +1450,11 @@ function runTemplateBridges(ctx) {
1450
1450
  const result = bridge(ctx);
1451
1451
  if (result && typeof result.catch === 'function') {
1452
1452
  result.catch((err) => {
1453
- // eslint-disable-next-line no-console
1454
1453
  console.error('[tbw-grid-angular] template bridge threw:', err);
1455
1454
  });
1456
1455
  }
1457
1456
  }
1458
1457
  catch (err) {
1459
- // eslint-disable-next-line no-console
1460
1458
  console.error('[tbw-grid-angular] template bridge threw:', err);
1461
1459
  }
1462
1460
  }
@@ -1851,7 +1849,7 @@ class GridAdapter {
1851
1849
  createEditor(element) {
1852
1850
  const template = getAnyEditorTemplate(element);
1853
1851
  // Find the parent grid element for FormArray context access
1854
- const gridElement = element.closest('tbw-grid');
1852
+ const gridElement = element.closest('tbw-grid, [data-tbw-grid]');
1855
1853
  if (!template) {
1856
1854
  // No template registered - return undefined to let the grid use its default editor.
1857
1855
  // This allows columns with only *tbwRenderer (no *tbwEditor) to still be editable
@@ -1942,7 +1940,7 @@ class GridAdapter {
1942
1940
  * to {@link createDetailRenderer} (bridge installed by master-detail feature).
1943
1941
  */
1944
1942
  parseDetailElement(detailElement) {
1945
- const gridElement = detailElement.closest('tbw-grid');
1943
+ const gridElement = detailElement.closest('tbw-grid, [data-tbw-grid]');
1946
1944
  if (!gridElement)
1947
1945
  return undefined;
1948
1946
  return getDetailRendererBridge()?.(gridElement, this);
@@ -1959,7 +1957,7 @@ class GridAdapter {
1959
1957
  * to {@link createResponsiveCardRenderer} (bridge installed by responsive feature).
1960
1958
  */
1961
1959
  parseResponsiveCardElement(cardElement) {
1962
- const gridElement = cardElement.closest('tbw-grid');
1960
+ const gridElement = cardElement.closest('tbw-grid, [data-tbw-grid]');
1963
1961
  if (!gridElement)
1964
1962
  return undefined;
1965
1963
  return getResponsiveCardRendererBridge()?.(gridElement, this);
@@ -1974,7 +1972,7 @@ class GridAdapter {
1974
1972
  return undefined;
1975
1973
  }
1976
1974
  // Find the parent grid element for context
1977
- const gridElement = element.closest('tbw-grid');
1975
+ const gridElement = element.closest('tbw-grid, [data-tbw-grid]');
1978
1976
  return (container) => {
1979
1977
  // Create the context for the template
1980
1978
  const context = {
@@ -2307,6 +2305,23 @@ class GridAdapter {
2307
2305
  }
2308
2306
  }
2309
2307
  }
2308
+ /**
2309
+ * Open a teardown batch. No-op for the Angular adapter — `viewRef.destroy()`
2310
+ * and `componentRef.destroy()` are synchronous DOM operations with no
2311
+ * deferred-commit warning analogous to React's `flushSync`. Implemented
2312
+ * for {@link FrameworkAdapter} parity so grid core's bulk-teardown
2313
+ * wrappers work uniformly across adapters.
2314
+ */
2315
+ beginBatch(_gridEl) {
2316
+ // intentionally empty
2317
+ }
2318
+ /**
2319
+ * Close a teardown batch opened by {@link beginBatch}. No-op for Angular —
2320
+ * see {@link beginBatch}.
2321
+ */
2322
+ endBatch(_gridEl) {
2323
+ // intentionally empty
2324
+ }
2310
2325
  /**
2311
2326
  * Unmount a specific container (e.g., detail panel, tool panel).
2312
2327
  * Finds the matching view or component ref whose DOM nodes are inside
@@ -2361,7 +2376,7 @@ class GridAdapter {
2361
2376
  */
2362
2377
  runEditorMountHooks(host) {
2363
2378
  queueMicrotask(() => {
2364
- const gridEl = host.closest('tbw-grid');
2379
+ const gridEl = host.closest('tbw-grid, [data-tbw-grid]');
2365
2380
  if (!gridEl)
2366
2381
  return;
2367
2382
  this.editorMountTeardowns.set(host, notifyEditorMounted(host, gridEl));
@@ -2941,7 +2956,7 @@ class BaseGridEditor {
2941
2956
  });
2942
2957
  }
2943
2958
  _initEditCloseListener() {
2944
- const grid = this.elementRef.nativeElement.closest('tbw-grid');
2959
+ const grid = this.elementRef.nativeElement.closest('tbw-grid, [data-tbw-grid]');
2945
2960
  if (!grid)
2946
2961
  return;
2947
2962
  let unsubBefore;
@@ -3672,7 +3687,7 @@ class BaseOverlayEditor extends BaseGridEditor {
3672
3687
  }
3673
3688
  /** Find the parent `<tbw-grid>` element for this editor. */
3674
3689
  _getGridElement() {
3675
- return this._elementRef.nativeElement.closest('tbw-grid') ?? null;
3690
+ return this._elementRef.nativeElement.closest('tbw-grid, [data-tbw-grid]') ?? null;
3676
3691
  }
3677
3692
  /**
3678
3693
  * JS fallback positioning for browsers without CSS Anchor Positioning.
@@ -6157,7 +6172,6 @@ class Grid {
6157
6172
  _intentionallyOmittedEvents;
6158
6173
  _assertEventOutputMapCoversCore;
6159
6174
  // Store event listeners for cleanup
6160
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6161
6175
  eventListeners = new Map();
6162
6176
  ngOnInit() {
6163
6177
  // Create and register the adapter
@@ -6214,7 +6228,6 @@ class Grid {
6214
6228
  * Returns the array of created plugins (doesn't modify grid).
6215
6229
  */
6216
6230
  createFeaturePlugins() {
6217
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6218
6231
  const plugins = [];
6219
6232
  const adapter = this.adapter;
6220
6233
  const grid = this.elementRef.nativeElement;
@@ -6262,6 +6275,11 @@ class Grid {
6262
6275
  addPlugin('print', this.print());
6263
6276
  addPlugin('pivot', this.pivot());
6264
6277
  addPlugin('serverSide', this.serverSide());
6278
+ // `stickyRows` has no deprecated `Grid` input — `GridStickyRowsDirective`
6279
+ // is the only owner. Iterate it here so the directive's feature claim is
6280
+ // consulted; without this call the directive would set a claim that
6281
+ // nobody reads and `[stickyRows]` would silently do nothing.
6282
+ addPlugin('stickyRows', undefined);
6265
6283
  addPlugin('tooltip', this.tooltip());
6266
6284
  return plugins;
6267
6285
  }