@toolbox-web/grid-angular 1.3.1 → 1.4.1

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 (102) hide show
  1. package/README.md +146 -54
  2. package/fesm2022/toolbox-web-grid-angular-features-clipboard.mjs +58 -0
  3. package/fesm2022/toolbox-web-grid-angular-features-clipboard.mjs.map +1 -1
  4. package/fesm2022/toolbox-web-grid-angular-features-column-virtualization.mjs +37 -0
  5. package/fesm2022/toolbox-web-grid-angular-features-column-virtualization.mjs.map +1 -1
  6. package/fesm2022/toolbox-web-grid-angular-features-context-menu.mjs +51 -0
  7. package/fesm2022/toolbox-web-grid-angular-features-context-menu.mjs.map +1 -1
  8. package/fesm2022/toolbox-web-grid-angular-features-editing.mjs +115 -1
  9. package/fesm2022/toolbox-web-grid-angular-features-editing.mjs.map +1 -1
  10. package/fesm2022/toolbox-web-grid-angular-features-export.mjs +55 -2
  11. package/fesm2022/toolbox-web-grid-angular-features-export.mjs.map +1 -1
  12. package/fesm2022/toolbox-web-grid-angular-features-filtering.mjs +159 -5
  13. package/fesm2022/toolbox-web-grid-angular-features-filtering.mjs.map +1 -1
  14. package/fesm2022/toolbox-web-grid-angular-features-grouping-columns.mjs +83 -0
  15. package/fesm2022/toolbox-web-grid-angular-features-grouping-columns.mjs.map +1 -1
  16. package/fesm2022/toolbox-web-grid-angular-features-grouping-rows.mjs +82 -0
  17. package/fesm2022/toolbox-web-grid-angular-features-grouping-rows.mjs.map +1 -1
  18. package/fesm2022/toolbox-web-grid-angular-features-master-detail.mjs +115 -2
  19. package/fesm2022/toolbox-web-grid-angular-features-master-detail.mjs.map +1 -1
  20. package/fesm2022/toolbox-web-grid-angular-features-multi-sort.mjs +38 -0
  21. package/fesm2022/toolbox-web-grid-angular-features-multi-sort.mjs.map +1 -1
  22. package/fesm2022/toolbox-web-grid-angular-features-pinned-columns.mjs +37 -0
  23. package/fesm2022/toolbox-web-grid-angular-features-pinned-columns.mjs.map +1 -1
  24. package/fesm2022/toolbox-web-grid-angular-features-pinned-rows.mjs +103 -0
  25. package/fesm2022/toolbox-web-grid-angular-features-pinned-rows.mjs.map +1 -1
  26. package/fesm2022/toolbox-web-grid-angular-features-pivot.mjs +36 -0
  27. package/fesm2022/toolbox-web-grid-angular-features-pivot.mjs.map +1 -1
  28. package/fesm2022/toolbox-web-grid-angular-features-print.mjs +58 -2
  29. package/fesm2022/toolbox-web-grid-angular-features-print.mjs.map +1 -1
  30. package/fesm2022/toolbox-web-grid-angular-features-reorder-columns.mjs +52 -0
  31. package/fesm2022/toolbox-web-grid-angular-features-reorder-columns.mjs.map +1 -1
  32. package/fesm2022/toolbox-web-grid-angular-features-reorder-rows.mjs +41 -0
  33. package/fesm2022/toolbox-web-grid-angular-features-reorder-rows.mjs.map +1 -1
  34. package/fesm2022/toolbox-web-grid-angular-features-responsive.mjs +112 -2
  35. package/fesm2022/toolbox-web-grid-angular-features-responsive.mjs.map +1 -1
  36. package/fesm2022/toolbox-web-grid-angular-features-row-drag-drop.mjs +77 -0
  37. package/fesm2022/toolbox-web-grid-angular-features-row-drag-drop.mjs.map +1 -1
  38. package/fesm2022/toolbox-web-grid-angular-features-selection.mjs +52 -2
  39. package/fesm2022/toolbox-web-grid-angular-features-selection.mjs.map +1 -1
  40. package/fesm2022/toolbox-web-grid-angular-features-server-side.mjs +36 -0
  41. package/fesm2022/toolbox-web-grid-angular-features-server-side.mjs.map +1 -1
  42. package/fesm2022/toolbox-web-grid-angular-features-tooltip.mjs +36 -0
  43. package/fesm2022/toolbox-web-grid-angular-features-tooltip.mjs.map +1 -1
  44. package/fesm2022/toolbox-web-grid-angular-features-tree.mjs +53 -0
  45. package/fesm2022/toolbox-web-grid-angular-features-tree.mjs.map +1 -1
  46. package/fesm2022/toolbox-web-grid-angular-features-undo-redo.mjs +57 -2
  47. package/fesm2022/toolbox-web-grid-angular-features-undo-redo.mjs.map +1 -1
  48. package/fesm2022/toolbox-web-grid-angular-features-visibility.mjs +53 -0
  49. package/fesm2022/toolbox-web-grid-angular-features-visibility.mjs.map +1 -1
  50. package/fesm2022/toolbox-web-grid-angular.mjs +1274 -727
  51. package/fesm2022/toolbox-web-grid-angular.mjs.map +1 -1
  52. package/package.json +1 -1
  53. package/types/toolbox-web-grid-angular-features-clipboard.d.ts +23 -0
  54. package/types/toolbox-web-grid-angular-features-clipboard.d.ts.map +1 -1
  55. package/types/toolbox-web-grid-angular-features-column-virtualization.d.ts +19 -0
  56. package/types/toolbox-web-grid-angular-features-column-virtualization.d.ts.map +1 -1
  57. package/types/toolbox-web-grid-angular-features-context-menu.d.ts +22 -0
  58. package/types/toolbox-web-grid-angular-features-context-menu.d.ts.map +1 -1
  59. package/types/toolbox-web-grid-angular-features-editing.d.ts +32 -0
  60. package/types/toolbox-web-grid-angular-features-editing.d.ts.map +1 -1
  61. package/types/toolbox-web-grid-angular-features-export.d.ts +21 -3
  62. package/types/toolbox-web-grid-angular-features-export.d.ts.map +1 -1
  63. package/types/toolbox-web-grid-angular-features-filtering.d.ts +67 -6
  64. package/types/toolbox-web-grid-angular-features-filtering.d.ts.map +1 -1
  65. package/types/toolbox-web-grid-angular-features-grouping-columns.d.ts +19 -0
  66. package/types/toolbox-web-grid-angular-features-grouping-columns.d.ts.map +1 -1
  67. package/types/toolbox-web-grid-angular-features-grouping-rows.d.ts +25 -0
  68. package/types/toolbox-web-grid-angular-features-grouping-rows.d.ts.map +1 -1
  69. package/types/toolbox-web-grid-angular-features-master-detail.d.ts +23 -0
  70. package/types/toolbox-web-grid-angular-features-master-detail.d.ts.map +1 -1
  71. package/types/toolbox-web-grid-angular-features-multi-sort.d.ts +19 -0
  72. package/types/toolbox-web-grid-angular-features-multi-sort.d.ts.map +1 -1
  73. package/types/toolbox-web-grid-angular-features-pinned-columns.d.ts +18 -0
  74. package/types/toolbox-web-grid-angular-features-pinned-columns.d.ts.map +1 -1
  75. package/types/toolbox-web-grid-angular-features-pinned-rows.d.ts +19 -0
  76. package/types/toolbox-web-grid-angular-features-pinned-rows.d.ts.map +1 -1
  77. package/types/toolbox-web-grid-angular-features-pivot.d.ts +19 -0
  78. package/types/toolbox-web-grid-angular-features-pivot.d.ts.map +1 -1
  79. package/types/toolbox-web-grid-angular-features-print.d.ts +22 -3
  80. package/types/toolbox-web-grid-angular-features-print.d.ts.map +1 -1
  81. package/types/toolbox-web-grid-angular-features-reorder-columns.d.ts +22 -0
  82. package/types/toolbox-web-grid-angular-features-reorder-columns.d.ts.map +1 -1
  83. package/types/toolbox-web-grid-angular-features-reorder-rows.d.ts +19 -0
  84. package/types/toolbox-web-grid-angular-features-reorder-rows.d.ts.map +1 -1
  85. package/types/toolbox-web-grid-angular-features-responsive.d.ts +22 -0
  86. package/types/toolbox-web-grid-angular-features-responsive.d.ts.map +1 -1
  87. package/types/toolbox-web-grid-angular-features-row-drag-drop.d.ts +27 -0
  88. package/types/toolbox-web-grid-angular-features-row-drag-drop.d.ts.map +1 -1
  89. package/types/toolbox-web-grid-angular-features-selection.d.ts +21 -3
  90. package/types/toolbox-web-grid-angular-features-selection.d.ts.map +1 -1
  91. package/types/toolbox-web-grid-angular-features-server-side.d.ts +19 -0
  92. package/types/toolbox-web-grid-angular-features-server-side.d.ts.map +1 -1
  93. package/types/toolbox-web-grid-angular-features-tooltip.d.ts +19 -0
  94. package/types/toolbox-web-grid-angular-features-tooltip.d.ts.map +1 -1
  95. package/types/toolbox-web-grid-angular-features-tree.d.ts +22 -0
  96. package/types/toolbox-web-grid-angular-features-tree.d.ts.map +1 -1
  97. package/types/toolbox-web-grid-angular-features-undo-redo.d.ts +22 -3
  98. package/types/toolbox-web-grid-angular-features-undo-redo.d.ts.map +1 -1
  99. package/types/toolbox-web-grid-angular-features-visibility.d.ts +22 -0
  100. package/types/toolbox-web-grid-angular-features-visibility.d.ts.map +1 -1
  101. package/types/toolbox-web-grid-angular.d.ts +939 -128
  102. package/types/toolbox-web-grid-angular.d.ts.map +1 -1
@@ -1,4 +1,38 @@
1
+ import { registerFeatureClaim, unregisterFeatureClaim, isComponentClass, registerFeatureConfigPreprocessor } from '@toolbox-web/grid-angular';
1
2
  import '@toolbox-web/grid/features/pinned-rows';
3
+ import * as i0 from '@angular/core';
4
+ import { inject, ElementRef, input, Directive } from '@angular/core';
5
+
6
+ /**
7
+ * `GridPinnedRowsDirective` — owns `[pinnedRows]` on `<tbw-grid>`. No
8
+ * event outputs. See `GridFilteringDirective` for the full rationale.
9
+ *
10
+ * @category Directive
11
+ */
12
+ /**
13
+ * Owns the binding(s) `[pinnedRows]` on `<tbw-grid>` for the matching feature plugin. See {@link GridFilteringDirective} for the full rationale.
14
+ *
15
+ * @category Directive
16
+ */
17
+ class GridPinnedRowsDirective {
18
+ elementRef = inject((ElementRef));
19
+ pinnedRows = input(...(ngDevMode ? [undefined, { debugName: "pinnedRows" }] : /* istanbul ignore next */ []));
20
+ constructor() {
21
+ registerFeatureClaim(this.elementRef.nativeElement, 'pinnedRows', () => this.pinnedRows());
22
+ }
23
+ ngOnDestroy() {
24
+ unregisterFeatureClaim(this.elementRef.nativeElement, 'pinnedRows');
25
+ }
26
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: GridPinnedRowsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
27
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: GridPinnedRowsDirective, isStandalone: true, selector: "tbw-grid[pinnedRows]", inputs: { pinnedRows: { classPropertyName: "pinnedRows", publicName: "pinnedRows", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
28
+ }
29
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: GridPinnedRowsDirective, decorators: [{
30
+ type: Directive,
31
+ args: [{
32
+ selector: 'tbw-grid[pinnedRows]',
33
+ standalone: true,
34
+ }]
35
+ }], ctorParameters: () => [], propDecorators: { pinnedRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "pinnedRows", required: false }] }] } });
2
36
 
3
37
  /**
4
38
  * Pinned rows feature for @toolbox-web/grid-angular
@@ -14,8 +48,77 @@ import '@toolbox-web/grid/features/pinned-rows';
14
48
  *
15
49
  * @packageDocumentation
16
50
  */
51
+ /**
52
+ * Build a pinned-rows panel renderer function from an Angular component class.
53
+ * The component should accept inputs from PinnedRowsContext.
54
+ */
55
+ function buildPanelRenderer(adapter, componentClass) {
56
+ const mount = adapter.mountComponentRenderer(componentClass, (ctx) => ({
57
+ totalRows: ctx.totalRows,
58
+ filteredRows: ctx.filteredRows,
59
+ selectedRows: ctx.selectedRows,
60
+ columns: ctx.columns,
61
+ rows: ctx.rows,
62
+ grid: ctx.grid,
63
+ }));
64
+ return (ctx) => mount(ctx).hostElement;
65
+ }
66
+ /**
67
+ * Bridge a single pinned-row slot. Aggregation slots (no `render`) pass through.
68
+ * For panel slots, wrap any component-class `render` (or array entry's `render`)
69
+ * with the Angular component renderer.
70
+ */
71
+ function bridgeSlot(adapter, slot) {
72
+ if (!('render' in slot) || slot.render == null)
73
+ return slot;
74
+ if (Array.isArray(slot.render)) {
75
+ const zoned = slot.render.map((entry) => {
76
+ if (entry?.render == null)
77
+ return entry;
78
+ if (isComponentClass(entry.render)) {
79
+ return { zone: entry.zone, render: buildPanelRenderer(adapter, entry.render) };
80
+ }
81
+ return entry;
82
+ });
83
+ return { ...slot, render: zoned };
84
+ }
85
+ if (isComponentClass(slot.render)) {
86
+ return { ...slot, render: buildPanelRenderer(adapter, slot.render) };
87
+ }
88
+ return slot;
89
+ }
90
+ // Bridge any Angular component classes embedded in `customPanels` and `slots`
91
+ // to plain renderer functions before the core plugin factory consumes the config.
92
+ registerFeatureConfigPreprocessor('pinnedRows', (config, adapter) => {
93
+ if (!config || typeof config !== 'object')
94
+ return config;
95
+ const cfg = config;
96
+ let next = cfg;
97
+ // Legacy customPanels bridging.
98
+ if (Array.isArray(cfg.customPanels)) {
99
+ const hasComponentRender = cfg.customPanels.some((panel) => isComponentClass(panel.render));
100
+ if (hasComponentRender) {
101
+ next = {
102
+ ...next,
103
+ customPanels: cfg.customPanels.map((panel) => {
104
+ if (!isComponentClass(panel.render))
105
+ return panel;
106
+ return { ...panel, render: buildPanelRenderer(adapter, panel.render) };
107
+ }),
108
+ };
109
+ }
110
+ }
111
+ // Slots[] bridging \u2014 each PanelSlot.render may be a component class, or an
112
+ // array of { zone?, render } where each render may be a component class.
113
+ if (Array.isArray(cfg.slots)) {
114
+ next = { ...next, slots: cfg.slots.map((slot) => bridgeSlot(adapter, slot)) };
115
+ }
116
+ return next;
117
+ });
17
118
 
18
119
  /**
19
120
  * Generated bundle index. Do not edit.
20
121
  */
122
+
123
+ export { GridPinnedRowsDirective };
21
124
  //# sourceMappingURL=toolbox-web-grid-angular-features-pinned-rows.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolbox-web-grid-angular-features-pinned-rows.mjs","sources":["../../../../libs/grid-angular/features/pinned-rows/src/index.ts","../../../../libs/grid-angular/features/pinned-rows/src/toolbox-web-grid-angular-features-pinned-rows.ts"],"sourcesContent":["/**\n * Pinned rows feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `pinnedRows` input on Grid directive.\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid-angular/features/pinned-rows';\n *\n * <tbw-grid [pinnedRows]=\"{ bottom: [{ type: 'aggregation' }] }\" />\n * ```\n *\n * @packageDocumentation\n */\n\nimport '@toolbox-web/grid/features/pinned-rows';\nexport type { _Augmentation as _PinnedRowsAugmentation } from '@toolbox-web/grid/features/pinned-rows';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;AAaG;;ACbH;;AAEG"}
1
+ {"version":3,"file":"toolbox-web-grid-angular-features-pinned-rows.mjs","sources":["../../../../libs/grid-angular/features/pinned-rows/src/grid-pinned-rows.directive.ts","../../../../libs/grid-angular/features/pinned-rows/src/index.ts","../../../../libs/grid-angular/features/pinned-rows/src/toolbox-web-grid-angular-features-pinned-rows.ts"],"sourcesContent":["/**\n * `GridPinnedRowsDirective` — owns `[pinnedRows]` on `<tbw-grid>`. No\n * event outputs. See `GridFilteringDirective` for the full rationale.\n *\n * @category Directive\n */\nimport { Directive, ElementRef, inject, input, OnDestroy } from '@angular/core';\nimport type { DataGridElement } from '@toolbox-web/grid';\nimport { registerFeatureClaim, unregisterFeatureClaim } from '@toolbox-web/grid-angular';\nimport type { PinnedRowsConfig } from '@toolbox-web/grid/plugins/pinned-rows';\n\n/**\n * Owns the binding(s) `[pinnedRows]` 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[pinnedRows]',\n standalone: true,\n})\nexport class GridPinnedRowsDirective implements OnDestroy {\n private readonly elementRef = inject(ElementRef<DataGridElement>);\n\n readonly pinnedRows = input<boolean | PinnedRowsConfig>();\n\n constructor() {\n registerFeatureClaim(this.elementRef.nativeElement, 'pinnedRows', () => this.pinnedRows());\n }\n\n ngOnDestroy(): void {\n unregisterFeatureClaim(this.elementRef.nativeElement, 'pinnedRows');\n }\n}\n","/**\n * Pinned rows feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `pinnedRows` input on Grid directive.\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid-angular/features/pinned-rows';\n *\n * <tbw-grid [pinnedRows]=\"{ bottom: [{ type: 'aggregation' }] }\" />\n * ```\n *\n * @packageDocumentation\n */\n\nimport type { Type } from '@angular/core';\nimport { isComponentClass, registerFeatureConfigPreprocessor, type GridAdapter } from '@toolbox-web/grid-angular';\nimport '@toolbox-web/grid/features/pinned-rows';\nimport type {\n PinnedRowsConfig,\n PinnedRowsContext,\n PinnedRowSlot,\n ZonedPanelRender,\n} from '@toolbox-web/grid/plugins/pinned-rows';\nexport { GridPinnedRowsDirective } from './grid-pinned-rows.directive';\nexport type { _Augmentation as _PinnedRowsAugmentation } from '@toolbox-web/grid/features/pinned-rows';\n\n/**\n * Build a pinned-rows panel renderer function from an Angular component class.\n * The component should accept inputs from PinnedRowsContext.\n */\nfunction buildPanelRenderer(\n adapter: GridAdapter,\n componentClass: Type<unknown>,\n): (ctx: PinnedRowsContext) => HTMLElement {\n const mount = adapter.mountComponentRenderer<PinnedRowsContext>(componentClass, (ctx) => ({\n totalRows: ctx.totalRows,\n filteredRows: ctx.filteredRows,\n selectedRows: ctx.selectedRows,\n columns: ctx.columns,\n rows: ctx.rows,\n grid: ctx.grid,\n }));\n return (ctx) => mount(ctx).hostElement;\n}\n\n/**\n * Bridge a single pinned-row slot. Aggregation slots (no `render`) pass through.\n * For panel slots, wrap any component-class `render` (or array entry's `render`)\n * with the Angular component renderer.\n */\nfunction bridgeSlot(adapter: GridAdapter, slot: PinnedRowSlot): PinnedRowSlot {\n if (!('render' in slot) || slot.render == null) return slot;\n\n if (Array.isArray(slot.render)) {\n const zoned: ZonedPanelRender[] = slot.render.map((entry) => {\n if (entry?.render == null) return entry;\n if (isComponentClass(entry.render)) {\n return { zone: entry.zone, render: buildPanelRenderer(adapter, entry.render as Type<unknown>) };\n }\n return entry;\n });\n return { ...slot, render: zoned };\n }\n\n if (isComponentClass(slot.render)) {\n return { ...slot, render: buildPanelRenderer(adapter, slot.render as Type<unknown>) };\n }\n return slot;\n}\n\n// Bridge any Angular component classes embedded in `customPanels` and `slots`\n// to plain renderer functions before the core plugin factory consumes the config.\nregisterFeatureConfigPreprocessor('pinnedRows', (config, adapter) => {\n if (!config || typeof config !== 'object') return config;\n const cfg = config as PinnedRowsConfig;\n let next: PinnedRowsConfig = cfg;\n\n // Legacy customPanels bridging.\n if (Array.isArray(cfg.customPanels)) {\n const hasComponentRender = cfg.customPanels.some((panel) => isComponentClass(panel.render));\n if (hasComponentRender) {\n next = {\n ...next,\n customPanels: cfg.customPanels.map((panel) => {\n if (!isComponentClass(panel.render)) return panel;\n return { ...panel, render: buildPanelRenderer(adapter, panel.render) };\n }),\n };\n }\n }\n\n // Slots[] bridging \\u2014 each PanelSlot.render may be a component class, or an\n // array of { zone?, render } where each render may be a component class.\n if (Array.isArray(cfg.slots)) {\n next = { ...next, slots: cfg.slots.map((slot) => bridgeSlot(adapter, slot)) };\n }\n\n return next;\n});\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;;;;;AAKG;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;AAEzD,IAAA,WAAA,GAAA;AACE,QAAA,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;IAC5F;IAEA,WAAW,GAAA;QACT,sBAAsB,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,YAAY,CAAC;IACrE;uGAXW,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAvB,uBAAuB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,sBAAA,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,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAvB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAJnC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;;ACn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ACb,CAAC,CAAC;;ACnGF;;AAEG;;;;"}
@@ -1,4 +1,38 @@
1
1
  import '@toolbox-web/grid/features/pivot';
2
+ import * as i0 from '@angular/core';
3
+ import { inject, ElementRef, input, Directive } from '@angular/core';
4
+ import { registerFeatureClaim, unregisterFeatureClaim } from '@toolbox-web/grid-angular';
5
+
6
+ /**
7
+ * `GridPivotDirective` — owns `[pivot]` on `<tbw-grid>`. No event outputs.
8
+ * See `GridFilteringDirective` for the full rationale.
9
+ *
10
+ * @category Directive
11
+ */
12
+ /**
13
+ * Owns the binding(s) `[pivot]` on `<tbw-grid>` for the matching feature plugin. See {@link GridFilteringDirective} for the full rationale.
14
+ *
15
+ * @category Directive
16
+ */
17
+ class GridPivotDirective {
18
+ elementRef = inject((ElementRef));
19
+ pivot = input(...(ngDevMode ? [undefined, { debugName: "pivot" }] : /* istanbul ignore next */ []));
20
+ constructor() {
21
+ registerFeatureClaim(this.elementRef.nativeElement, 'pivot', () => this.pivot());
22
+ }
23
+ ngOnDestroy() {
24
+ unregisterFeatureClaim(this.elementRef.nativeElement, 'pivot');
25
+ }
26
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: GridPivotDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
27
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: GridPivotDirective, isStandalone: true, selector: "tbw-grid[pivot]", inputs: { pivot: { classPropertyName: "pivot", publicName: "pivot", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
28
+ }
29
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: GridPivotDirective, decorators: [{
30
+ type: Directive,
31
+ args: [{
32
+ selector: 'tbw-grid[pivot]',
33
+ standalone: true,
34
+ }]
35
+ }], ctorParameters: () => [], propDecorators: { pivot: [{ type: i0.Input, args: [{ isSignal: true, alias: "pivot", required: false }] }] } });
2
36
 
3
37
  /**
4
38
  * Pivot feature for @toolbox-web/grid-angular
@@ -18,4 +52,6 @@ import '@toolbox-web/grid/features/pivot';
18
52
  /**
19
53
  * Generated bundle index. Do not edit.
20
54
  */
55
+
56
+ export { GridPivotDirective };
21
57
  //# sourceMappingURL=toolbox-web-grid-angular-features-pivot.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolbox-web-grid-angular-features-pivot.mjs","sources":["../../../../libs/grid-angular/features/pivot/src/index.ts","../../../../libs/grid-angular/features/pivot/src/toolbox-web-grid-angular-features-pivot.ts"],"sourcesContent":["/**\n * Pivot feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `pivot` input on Grid directive.\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid-angular/features/pivot';\n *\n * <tbw-grid [pivot]=\"{ rowFields: ['category'], valueField: 'sales' }\" />\n * ```\n *\n * @packageDocumentation\n */\n\nimport '@toolbox-web/grid/features/pivot';\nexport type { _Augmentation as _PivotAugmentation } from '@toolbox-web/grid/features/pivot';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;AAaG;;ACbH;;AAEG"}
1
+ {"version":3,"file":"toolbox-web-grid-angular-features-pivot.mjs","sources":["../../../../libs/grid-angular/features/pivot/src/grid-pivot.directive.ts","../../../../libs/grid-angular/features/pivot/src/index.ts","../../../../libs/grid-angular/features/pivot/src/toolbox-web-grid-angular-features-pivot.ts"],"sourcesContent":["/**\n * `GridPivotDirective` — owns `[pivot]` on `<tbw-grid>`. No event outputs.\n * See `GridFilteringDirective` for the full rationale.\n *\n * @category Directive\n */\nimport { Directive, ElementRef, inject, input, OnDestroy } from '@angular/core';\nimport type { DataGridElement } from '@toolbox-web/grid';\nimport { registerFeatureClaim, unregisterFeatureClaim } from '@toolbox-web/grid-angular';\nimport type { PivotConfig } from '@toolbox-web/grid/plugins/pivot';\n\n/**\n * Owns the binding(s) `[pivot]` 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[pivot]',\n standalone: true,\n})\nexport class GridPivotDirective implements OnDestroy {\n private readonly elementRef = inject(ElementRef<DataGridElement>);\n\n readonly pivot = input<PivotConfig>();\n\n constructor() {\n registerFeatureClaim(this.elementRef.nativeElement, 'pivot', () => this.pivot());\n }\n\n ngOnDestroy(): void {\n unregisterFeatureClaim(this.elementRef.nativeElement, 'pivot');\n }\n}\n","/**\n * Pivot feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `pivot` input on Grid directive.\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid-angular/features/pivot';\n *\n * <tbw-grid [pivot]=\"{ rowFields: ['category'], valueField: 'sales' }\" />\n * ```\n *\n * @packageDocumentation\n */\n\nimport '@toolbox-web/grid/features/pivot';\nexport { GridPivotDirective } from './grid-pivot.directive';\nexport type { _Augmentation as _PivotAugmentation } from '@toolbox-web/grid/features/pivot';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;;;;;AAKG;AAMH;;;;AAIG;MAKU,kBAAkB,CAAA;AACZ,IAAA,UAAU,GAAG,MAAM,EAAC,UAA2B,EAAC;IAExD,KAAK,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,OAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAe;AAErC,IAAA,WAAA,GAAA;AACE,QAAA,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IAClF;IAEA,WAAW,GAAA;QACT,sBAAsB,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,OAAO,CAAC;IAChE;uGAXW,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAlB,kBAAkB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,iBAAiB;AAC3B,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;;ACnBD;;;;;;;;;;;;;AAaG;;ACbH;;AAEG;;;;"}
@@ -1,5 +1,61 @@
1
- import { inject, ElementRef, DestroyRef, signal, afterNextRender } from '@angular/core';
1
+ import * as i0 from '@angular/core';
2
+ import { inject, ElementRef, input, output, Directive, DestroyRef, signal, afterNextRender } from '@angular/core';
2
3
  import '@toolbox-web/grid/features/print';
4
+ import { registerFeatureClaim, claimEvent, unregisterFeatureClaim, unclaimEvent } from '@toolbox-web/grid-angular';
5
+
6
+ /**
7
+ * `GridPrintDirective` — owns `[print]`, `(printStart)` and
8
+ * `(printComplete)` on `<tbw-grid>`. See `GridFilteringDirective` for the
9
+ * full rationale.
10
+ *
11
+ * @category Directive
12
+ */
13
+ /**
14
+ * Owns the binding(s) `[print], [printStart], [printComplete]` on `<tbw-grid>` for the matching feature plugin. See {@link GridFilteringDirective} for the full rationale.
15
+ *
16
+ * @category Directive
17
+ */
18
+ class GridPrintDirective {
19
+ elementRef = inject((ElementRef));
20
+ print = input(...(ngDevMode ? [undefined, { debugName: "print" }] : /* istanbul ignore next */ []));
21
+ printStart = output();
22
+ printComplete = output();
23
+ listeners = new Map();
24
+ constructor() {
25
+ const grid = this.elementRef.nativeElement;
26
+ registerFeatureClaim(grid, 'print', () => this.print());
27
+ claimEvent(grid, 'print-start');
28
+ claimEvent(grid, 'print-complete');
29
+ }
30
+ ngOnInit() {
31
+ const grid = this.elementRef.nativeElement;
32
+ const wire = (name, out) => {
33
+ const l = (e) => out.emit(e.detail);
34
+ grid.addEventListener(name, l);
35
+ this.listeners.set(name, l);
36
+ };
37
+ wire('print-start', this.printStart);
38
+ wire('print-complete', this.printComplete);
39
+ }
40
+ ngOnDestroy() {
41
+ const grid = this.elementRef.nativeElement;
42
+ for (const [name, l] of this.listeners)
43
+ grid.removeEventListener(name, l);
44
+ this.listeners.clear();
45
+ unregisterFeatureClaim(grid, 'print');
46
+ unclaimEvent(grid, 'print-start');
47
+ unclaimEvent(grid, 'print-complete');
48
+ }
49
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: GridPrintDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
50
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: GridPrintDirective, isStandalone: true, selector: "tbw-grid[print], tbw-grid[printStart], tbw-grid[printComplete]", inputs: { print: { classPropertyName: "print", publicName: "print", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { printStart: "printStart", printComplete: "printComplete" }, ngImport: i0 });
51
+ }
52
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: GridPrintDirective, decorators: [{
53
+ type: Directive,
54
+ args: [{
55
+ selector: 'tbw-grid[print], tbw-grid[printStart], tbw-grid[printComplete]',
56
+ standalone: true,
57
+ }]
58
+ }], ctorParameters: () => [], propDecorators: { print: [{ type: i0.Input, args: [{ isSignal: true, alias: "print", required: false }] }], printStart: [{ type: i0.Output, args: ["printStart"] }], printComplete: [{ type: i0.Output, args: ["printComplete"] }] } });
3
59
 
4
60
  /**
5
61
  * Print feature for @toolbox-web/grid-angular
@@ -130,5 +186,5 @@ function injectGridPrint(selector = 'tbw-grid') {
130
186
  * Generated bundle index. Do not edit.
131
187
  */
132
188
 
133
- export { injectGridPrint };
189
+ export { GridPrintDirective, injectGridPrint };
134
190
  //# sourceMappingURL=toolbox-web-grid-angular-features-print.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolbox-web-grid-angular-features-print.mjs","sources":["../../../../libs/grid-angular/features/print/src/index.ts","../../../../libs/grid-angular/features/print/src/toolbox-web-grid-angular-features-print.ts"],"sourcesContent":["/**\n * Print feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `print` input on Grid directive.\n * Also exports `injectGridPrint()` for programmatic print control.\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid-angular/features/print';\n *\n * <tbw-grid [print]=\"true\" />\n * ```\n *\n * @example Using injectGridPrint\n * ```typescript\n * import { injectGridPrint } from '@toolbox-web/grid-angular/features/print';\n *\n * @Component({...})\n * export class MyComponent {\n * private gridPrint = injectGridPrint();\n *\n * printReport() {\n * this.gridPrint.print({ title: 'My Report' });\n * }\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/print';\nimport { PrintPlugin, type PrintParams } from '@toolbox-web/grid/plugins/print';\nexport type { _Augmentation as _PrintAugmentation } from '@toolbox-web/grid/features/print';\n\n/**\n * Print methods returned from injectGridPrint.\n *\n * Uses lazy discovery - the grid is found on first method call, not during initialization.\n */\nexport interface PrintMethods {\n /**\n * Print the grid.\n * Opens browser print dialog after preparing the grid for printing.\n * @param params - Optional print parameters\n */\n print: (params?: PrintParams) => Promise<void>;\n\n /**\n * Check if a print operation is currently in progress.\n */\n isPrinting: () => boolean;\n\n /**\n * Signal indicating if grid is ready.\n */\n isReady: Signal<boolean>;\n}\n\n/**\n * Angular inject function for programmatic print 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/print';\n * import { injectGridPrint } from '@toolbox-web/grid-angular/features/print';\n *\n * @Component({\n * selector: 'app-my-grid',\n * imports: [Grid],\n * template: `\n * <button (click)=\"handlePrint()\" [disabled]=\"gridPrint.isPrinting()\">\n * {{ gridPrint.isPrinting() ? 'Printing...' : 'Print' }}\n * </button>\n * <tbw-grid [rows]=\"rows\" [print]=\"true\"></tbw-grid>\n * `\n * })\n * export class MyGridComponent {\n * gridPrint = injectGridPrint();\n *\n * async handlePrint() {\n * await this.gridPrint.print({ title: 'Employee Report', isolate: true });\n * console.log('Print dialog closed');\n * }\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 injectGridPrint(selector = 'tbw-grid'): PrintMethods {\n const elementRef = inject(ElementRef);\n const destroyRef = inject(DestroyRef);\n const isReady = signal(false);\n\n let cachedGrid: DataGridElement | null = null;\n let readyPromiseStarted = false;\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 if (!readyPromiseStarted) {\n readyPromiseStarted = true;\n grid.ready?.().then(() => {\n if (grid.getPluginByName('print')) {\n isReady.set(true);\n } else {\n setTimeout(() => isReady.set(true), 0);\n }\n });\n }\n }\n return grid;\n };\n\n const getPlugin = (): PrintPlugin | undefined => {\n return getGrid()?.getPluginByName('print') as PrintPlugin | undefined;\n };\n\n // Eagerly discover the grid after the first render so isReady updates\n // without requiring a programmatic method call. Falls back to a\n // MutationObserver for lazy-rendered tabs, *ngIf, @defer, etc.\n afterNextRender(() => {\n if (getGrid()) return;\n\n const host = elementRef.nativeElement as HTMLElement;\n const observer = new MutationObserver(() => {\n if (getGrid()) observer.disconnect();\n });\n observer.observe(host, { childList: true, subtree: true });\n\n destroyRef.onDestroy(() => observer.disconnect());\n });\n\n return {\n isReady: isReady.asReadonly(),\n\n print: async (params?: PrintParams) => {\n const plugin = getPlugin();\n if (!plugin) {\n console.warn(\n `[tbw-grid:print] PrintPlugin not found.\\n\\n` +\n ` → Enable print on the grid:\\n` +\n ` <tbw-grid [print]=\"true\" />`,\n );\n return;\n }\n await plugin.print(params);\n },\n\n isPrinting: () => getPlugin()?.isPrinting() ?? false,\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AAgCH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCG;AACG,SAAU,eAAe,CAAC,QAAQ,GAAG,UAAU,EAAA;AACnD,IAAA,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AACrC,IAAA,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AACrC,IAAA,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,8EAAC;IAE7B,IAAI,UAAU,GAA2B,IAAI;IAC7C,IAAI,mBAAmB,GAAG,KAAK;IAE/B,MAAM,OAAO,GAAG,MAA6B;AAC3C,QAAA,IAAI,UAAU;AAAE,YAAA,OAAO,UAAU;QAEjC,MAAM,IAAI,GAAG,UAAU,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,CAA2B;QACvF,IAAI,IAAI,EAAE;YACR,UAAU,GAAG,IAAI;YACjB,IAAI,CAAC,mBAAmB,EAAE;gBACxB,mBAAmB,GAAG,IAAI;gBAC1B,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,MAAK;AACvB,oBAAA,IAAI,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE;AACjC,wBAAA,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;oBACnB;yBAAO;AACL,wBAAA,UAAU,CAAC,MAAM,OAA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/features/print/src/grid-print.directive.ts","../../../../libs/grid-angular/features/print/src/index.ts","../../../../libs/grid-angular/features/print/src/toolbox-web-grid-angular-features-print.ts"],"sourcesContent":["/**\n * `GridPrintDirective` — owns `[print]`, `(printStart)` and\n * `(printComplete)` on `<tbw-grid>`. See `GridFilteringDirective` for the\n * 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 { PrintCompleteDetail, PrintConfig, PrintStartDetail } from '@toolbox-web/grid/plugins/print';\n\n/**\n * Owns the binding(s) `[print], [printStart], [printComplete]` 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[print], tbw-grid[printStart], tbw-grid[printComplete]',\n standalone: true,\n})\nexport class GridPrintDirective implements OnInit, OnDestroy {\n private readonly elementRef = inject(ElementRef<DataGridElement>);\n\n readonly print = input<boolean | PrintConfig>();\n readonly printStart = output<PrintStartDetail>();\n readonly printComplete = output<PrintCompleteDetail>();\n\n private readonly listeners = new Map<string, (e: Event) => void>();\n\n constructor() {\n const grid = this.elementRef.nativeElement;\n registerFeatureClaim(grid, 'print', () => this.print());\n claimEvent(grid, 'print-start');\n claimEvent(grid, 'print-complete');\n }\n\n ngOnInit(): void {\n const grid = this.elementRef.nativeElement;\n const wire = <T>(name: string, out: { emit: (v: T) => void }): void => {\n const l = (e: Event): void => out.emit((e as CustomEvent<T>).detail);\n grid.addEventListener(name, l);\n this.listeners.set(name, l);\n };\n wire<PrintStartDetail>('print-start', this.printStart);\n wire<PrintCompleteDetail>('print-complete', this.printComplete);\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, 'print');\n unclaimEvent(grid, 'print-start');\n unclaimEvent(grid, 'print-complete');\n }\n}\n","/**\n * Print feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `print` input on Grid directive.\n * Also exports `injectGridPrint()` for programmatic print control.\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid-angular/features/print';\n *\n * <tbw-grid [print]=\"true\" />\n * ```\n *\n * @example Using injectGridPrint\n * ```typescript\n * import { injectGridPrint } from '@toolbox-web/grid-angular/features/print';\n *\n * @Component({...})\n * export class MyComponent {\n * private gridPrint = injectGridPrint();\n *\n * printReport() {\n * this.gridPrint.print({ title: 'My Report' });\n * }\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/print';\nimport { PrintPlugin, type PrintParams } from '@toolbox-web/grid/plugins/print';\nexport { GridPrintDirective } from './grid-print.directive';\nexport type { _Augmentation as _PrintAugmentation } from '@toolbox-web/grid/features/print';\n\n/**\n * Print methods returned from injectGridPrint.\n *\n * Uses lazy discovery - the grid is found on first method call, not during initialization.\n */\nexport interface PrintMethods {\n /**\n * Print the grid.\n * Opens browser print dialog after preparing the grid for printing.\n * @param params - Optional print parameters\n */\n print: (params?: PrintParams) => Promise<void>;\n\n /**\n * Check if a print operation is currently in progress.\n */\n isPrinting: () => boolean;\n\n /**\n * Signal indicating if grid is ready.\n */\n isReady: Signal<boolean>;\n}\n\n/**\n * Angular inject function for programmatic print 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/print';\n * import { injectGridPrint } from '@toolbox-web/grid-angular/features/print';\n *\n * @Component({\n * selector: 'app-my-grid',\n * imports: [Grid],\n * template: `\n * <button (click)=\"handlePrint()\" [disabled]=\"gridPrint.isPrinting()\">\n * {{ gridPrint.isPrinting() ? 'Printing...' : 'Print' }}\n * </button>\n * <tbw-grid [rows]=\"rows\" [print]=\"true\"></tbw-grid>\n * `\n * })\n * export class MyGridComponent {\n * gridPrint = injectGridPrint();\n *\n * async handlePrint() {\n * await this.gridPrint.print({ title: 'Employee Report', isolate: true });\n * console.log('Print dialog closed');\n * }\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 injectGridPrint(selector = 'tbw-grid'): PrintMethods {\n const elementRef = inject(ElementRef);\n const destroyRef = inject(DestroyRef);\n const isReady = signal(false);\n\n let cachedGrid: DataGridElement | null = null;\n let readyPromiseStarted = false;\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 if (!readyPromiseStarted) {\n readyPromiseStarted = true;\n grid.ready?.().then(() => {\n if (grid.getPluginByName('print')) {\n isReady.set(true);\n } else {\n setTimeout(() => isReady.set(true), 0);\n }\n });\n }\n }\n return grid;\n };\n\n const getPlugin = (): PrintPlugin | undefined => {\n return getGrid()?.getPluginByName('print') as PrintPlugin | undefined;\n };\n\n // Eagerly discover the grid after the first render so isReady updates\n // without requiring a programmatic method call. Falls back to a\n // MutationObserver for lazy-rendered tabs, *ngIf, @defer, etc.\n afterNextRender(() => {\n if (getGrid()) return;\n\n const host = elementRef.nativeElement as HTMLElement;\n const observer = new MutationObserver(() => {\n if (getGrid()) observer.disconnect();\n });\n observer.observe(host, { childList: true, subtree: true });\n\n destroyRef.onDestroy(() => observer.disconnect());\n });\n\n return {\n isReady: isReady.asReadonly(),\n\n print: async (params?: PrintParams) => {\n const plugin = getPlugin();\n if (!plugin) {\n console.warn(\n `[tbw-grid:print] PrintPlugin not found.\\n\\n` +\n ` → Enable print on the grid:\\n` +\n ` <tbw-grid [print]=\"true\" />`,\n );\n return;\n }\n await plugin.print(params);\n },\n\n isPrinting: () => getPlugin()?.isPrinting() ?? false,\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;;;;;;AAMG;AAMH;;;;AAIG;MAKU,kBAAkB,CAAA;AACZ,IAAA,UAAU,GAAG,MAAM,EAAC,UAA2B,EAAC;IAExD,KAAK,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,OAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAyB;IACtC,UAAU,GAAG,MAAM,EAAoB;IACvC,aAAa,GAAG,MAAM,EAAuB;AAErC,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,OAAO,EAAE,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;AACvD,QAAA,UAAU,CAAC,IAAI,EAAE,aAAa,CAAC;AAC/B,QAAA,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC;IACpC;IAEA,QAAQ,GAAA;AACN,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa;AAC1C,QAAA,MAAM,IAAI,GAAG,CAAI,IAAY,EAAE,GAA6B,KAAU;AACpE,YAAA,MAAM,CAAC,GAAG,CAAC,CAAQ,KAAW,GAAG,CAAC,IAAI,CAAE,CAAoB,CAAC,MAAM,CAAC;AACpE,YAAA,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC;YAC9B,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;AAC7B,QAAA,CAAC;AACD,QAAA,IAAI,CAAmB,aAAa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,EAAE;AACtC,QAAA,CAAC,CAAC;AACF,QAAA,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAE1D,UAAU,CAAC,SAAS,CAAC,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC;AACnD,IAAA,CAAC,CAAC;IAEF,OAAO;AACL,QAAA,OAAO,EAAE,OAAO,CAAC,UAAU,EAAE;AAE7B,QAAA,KAAK,EAAE,OAAO,MAAoB,KAAI;AACpC,YAAA,MAAM,MAAM,GAAG,SAAS,EAAE;YAC1B,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO,CAAC,IAAI,CACV,CAAA,2CAAA,CAA6C;oBAC3C,CAAA,+BAAA,CAAiC;AACjC,oBAAA,CAAA,+BAAA,CAAiC,CACpC;gBACD;YACF;AACA,YAAA,MAAM,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;QAC5B,CAAC;QAED,UAAU,EAAE,MAAM,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,KAAK;KACrD;AACH;;ACnKA;;AAEG;;;;"}
@@ -1,4 +1,54 @@
1
1
  import '@toolbox-web/grid/features/reorder-columns';
2
+ import * as i0 from '@angular/core';
3
+ import { inject, ElementRef, input, output, Directive } from '@angular/core';
4
+ import { registerFeatureClaim, claimEvent, unregisterFeatureClaim, unclaimEvent } from '@toolbox-web/grid-angular';
5
+
6
+ /**
7
+ * `GridReorderColumnsDirective` — owns `[reorderColumns]` and
8
+ * `(columnMove)` on `<tbw-grid>`. See `GridFilteringDirective` for the
9
+ * full rationale.
10
+ *
11
+ * @category Directive
12
+ */
13
+ /**
14
+ * Owns the binding(s) `[reorderColumns], [columnMove]` on `<tbw-grid>` for the matching feature plugin. See {@link GridFilteringDirective} for the full rationale.
15
+ *
16
+ * @category Directive
17
+ */
18
+ class GridReorderColumnsDirective {
19
+ elementRef = inject((ElementRef));
20
+ reorderColumns = input(...(ngDevMode ? [undefined, { debugName: "reorderColumns" }] : /* istanbul ignore next */ []));
21
+ columnMove = output();
22
+ listener;
23
+ constructor() {
24
+ const grid = this.elementRef.nativeElement;
25
+ registerFeatureClaim(grid, 'reorderColumns', () => this.reorderColumns());
26
+ claimEvent(grid, 'column-move');
27
+ }
28
+ ngOnInit() {
29
+ const grid = this.elementRef.nativeElement;
30
+ this.listener = (e) => this.columnMove.emit(e.detail);
31
+ grid.addEventListener('column-move', this.listener);
32
+ }
33
+ ngOnDestroy() {
34
+ const grid = this.elementRef.nativeElement;
35
+ if (this.listener) {
36
+ grid.removeEventListener('column-move', this.listener);
37
+ this.listener = undefined;
38
+ }
39
+ unregisterFeatureClaim(grid, 'reorderColumns');
40
+ unclaimEvent(grid, 'column-move');
41
+ }
42
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: GridReorderColumnsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
43
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: GridReorderColumnsDirective, isStandalone: true, selector: "tbw-grid[reorderColumns], tbw-grid[columnMove]", inputs: { reorderColumns: { classPropertyName: "reorderColumns", publicName: "reorderColumns", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { columnMove: "columnMove" }, ngImport: i0 });
44
+ }
45
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: GridReorderColumnsDirective, decorators: [{
46
+ type: Directive,
47
+ args: [{
48
+ selector: 'tbw-grid[reorderColumns], tbw-grid[columnMove]',
49
+ standalone: true,
50
+ }]
51
+ }], ctorParameters: () => [], propDecorators: { reorderColumns: [{ type: i0.Input, args: [{ isSignal: true, alias: "reorderColumns", required: false }] }], columnMove: [{ type: i0.Output, args: ["columnMove"] }] } });
2
52
 
3
53
  /**
4
54
  * Column reorder feature for @toolbox-web/grid-angular
@@ -18,4 +68,6 @@ import '@toolbox-web/grid/features/reorder-columns';
18
68
  /**
19
69
  * Generated bundle index. Do not edit.
20
70
  */
71
+
72
+ export { GridReorderColumnsDirective };
21
73
  //# sourceMappingURL=toolbox-web-grid-angular-features-reorder-columns.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolbox-web-grid-angular-features-reorder-columns.mjs","sources":["../../../../libs/grid-angular/features/reorder-columns/src/index.ts","../../../../libs/grid-angular/features/reorder-columns/src/toolbox-web-grid-angular-features-reorder-columns.ts"],"sourcesContent":["/**\n * Column reorder feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `reorderColumns` input on Grid directive.\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid-angular/features/reorder-columns';\n *\n * <tbw-grid [reorderColumns]=\"true\" />\n * ```\n *\n * @packageDocumentation\n */\n\nimport '@toolbox-web/grid/features/reorder-columns';\nexport type { _Augmentation as _ReorderColumnsAugmentation } from '@toolbox-web/grid/features/reorder-columns';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;AAaG;;ACbH;;AAEG"}
1
+ {"version":3,"file":"toolbox-web-grid-angular-features-reorder-columns.mjs","sources":["../../../../libs/grid-angular/features/reorder-columns/src/grid-reorder-columns.directive.ts","../../../../libs/grid-angular/features/reorder-columns/src/index.ts","../../../../libs/grid-angular/features/reorder-columns/src/toolbox-web-grid-angular-features-reorder-columns.ts"],"sourcesContent":["/**\n * `GridReorderColumnsDirective` — owns `[reorderColumns]` and\n * `(columnMove)` on `<tbw-grid>`. See `GridFilteringDirective` for the\n * 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 { ColumnMoveDetail, ReorderConfig } from '@toolbox-web/grid/plugins/reorder-columns';\n\n/**\n * Owns the binding(s) `[reorderColumns], [columnMove]` 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[reorderColumns], tbw-grid[columnMove]',\n standalone: true,\n})\nexport class GridReorderColumnsDirective implements OnInit, OnDestroy {\n private readonly elementRef = inject(ElementRef<DataGridElement>);\n\n readonly reorderColumns = input<boolean | ReorderConfig>();\n readonly columnMove = output<ColumnMoveDetail>();\n\n private listener?: (e: Event) => void;\n\n constructor() {\n const grid = this.elementRef.nativeElement;\n registerFeatureClaim(grid, 'reorderColumns', () => this.reorderColumns());\n claimEvent(grid, 'column-move');\n }\n\n ngOnInit(): void {\n const grid = this.elementRef.nativeElement;\n this.listener = (e: Event): void => this.columnMove.emit((e as CustomEvent<ColumnMoveDetail>).detail);\n grid.addEventListener('column-move', this.listener);\n }\n\n ngOnDestroy(): void {\n const grid = this.elementRef.nativeElement;\n if (this.listener) {\n grid.removeEventListener('column-move', this.listener);\n this.listener = undefined;\n }\n unregisterFeatureClaim(grid, 'reorderColumns');\n unclaimEvent(grid, 'column-move');\n }\n}\n","/**\n * Column reorder feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `reorderColumns` input on Grid directive.\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid-angular/features/reorder-columns';\n *\n * <tbw-grid [reorderColumns]=\"true\" />\n * ```\n *\n * @packageDocumentation\n */\n\nimport '@toolbox-web/grid/features/reorder-columns';\nexport { GridReorderColumnsDirective } from './grid-reorder-columns.directive';\nexport type { _Augmentation as _ReorderColumnsAugmentation } from '@toolbox-web/grid/features/reorder-columns';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;;;;;;AAMG;AAMH;;;;AAIG;MAKU,2BAA2B,CAAA;AACrB,IAAA,UAAU,GAAG,MAAM,EAAC,UAA2B,EAAC;IAExD,cAAc,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,S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AAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,UAAA,EAAA,YAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAA3B,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBAJvC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,gDAAgD;AAC1D,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;;ACpBD;;;;;;;;;;;;;AAaG;;ACbH;;AAEG;;;;"}
@@ -1,4 +1,43 @@
1
1
  import '@toolbox-web/grid/features/reorder-rows';
2
+ import * as i0 from '@angular/core';
3
+ import { inject, ElementRef, input, Directive } from '@angular/core';
4
+ import { registerFeatureClaim, unregisterFeatureClaim } from '@toolbox-web/grid-angular';
5
+
6
+ /**
7
+ * `GridReorderRowsDirective` — owns `[reorderRows]` on `<tbw-grid>`.
8
+ *
9
+ * `reorderRows` is a deprecated alias of `rowDragDrop`. This directive
10
+ * claims the alias input only — it does NOT claim any row-drag-drop
11
+ * events. The `GridRowDragDropDirective` owns all row-* events. This
12
+ * keeps event ownership single-source and avoids duplicate listeners
13
+ * when both directives are imported (which is harmless but wasteful).
14
+ *
15
+ * @category Directive
16
+ */
17
+ /**
18
+ * Owns the binding(s) `[reorderRows]` on `<tbw-grid>` for the matching feature plugin. See {@link GridFilteringDirective} for the full rationale.
19
+ *
20
+ * @category Directive
21
+ */
22
+ class GridReorderRowsDirective {
23
+ elementRef = inject((ElementRef));
24
+ reorderRows = input(...(ngDevMode ? [undefined, { debugName: "reorderRows" }] : /* istanbul ignore next */ []));
25
+ constructor() {
26
+ registerFeatureClaim(this.elementRef.nativeElement, 'reorderRows', () => this.reorderRows());
27
+ }
28
+ ngOnDestroy() {
29
+ unregisterFeatureClaim(this.elementRef.nativeElement, 'reorderRows');
30
+ }
31
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: GridReorderRowsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
32
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: GridReorderRowsDirective, isStandalone: true, selector: "tbw-grid[reorderRows]", inputs: { reorderRows: { classPropertyName: "reorderRows", publicName: "reorderRows", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
33
+ }
34
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: GridReorderRowsDirective, decorators: [{
35
+ type: Directive,
36
+ args: [{
37
+ selector: 'tbw-grid[reorderRows]',
38
+ standalone: true,
39
+ }]
40
+ }], ctorParameters: () => [], propDecorators: { reorderRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "reorderRows", required: false }] }] } });
2
41
 
3
42
  /**
4
43
  * Row reorder feature for @toolbox-web/grid-angular
@@ -18,4 +57,6 @@ import '@toolbox-web/grid/features/reorder-rows';
18
57
  /**
19
58
  * Generated bundle index. Do not edit.
20
59
  */
60
+
61
+ export { GridReorderRowsDirective };
21
62
  //# sourceMappingURL=toolbox-web-grid-angular-features-reorder-rows.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolbox-web-grid-angular-features-reorder-rows.mjs","sources":["../../../../libs/grid-angular/features/reorder-rows/src/index.ts","../../../../libs/grid-angular/features/reorder-rows/src/toolbox-web-grid-angular-features-reorder-rows.ts"],"sourcesContent":["/**\n * Row reorder feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `reorderRows` input on Grid directive.\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid-angular/features/reorder-rows';\n *\n * <tbw-grid [reorderRows]=\"true\" />\n * ```\n *\n * @packageDocumentation\n */\n\nimport '@toolbox-web/grid/features/reorder-rows';\nexport type { _Augmentation as _ReorderRowsAugmentation } from '@toolbox-web/grid/features/reorder-rows';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;AAaG;;ACbH;;AAEG"}
1
+ {"version":3,"file":"toolbox-web-grid-angular-features-reorder-rows.mjs","sources":["../../../../libs/grid-angular/features/reorder-rows/src/grid-reorder-rows.directive.ts","../../../../libs/grid-angular/features/reorder-rows/src/index.ts","../../../../libs/grid-angular/features/reorder-rows/src/toolbox-web-grid-angular-features-reorder-rows.ts"],"sourcesContent":["/**\n * `GridReorderRowsDirective` — owns `[reorderRows]` on `<tbw-grid>`.\n *\n * `reorderRows` is a deprecated alias of `rowDragDrop`. This directive\n * claims the alias input only — it does NOT claim any row-drag-drop\n * events. The `GridRowDragDropDirective` owns all row-* events. This\n * keeps event ownership single-source and avoids duplicate listeners\n * when both directives are imported (which is harmless but wasteful).\n *\n * @category Directive\n */\nimport { Directive, ElementRef, inject, input, OnDestroy } from '@angular/core';\nimport type { DataGridElement } from '@toolbox-web/grid';\nimport { registerFeatureClaim, unregisterFeatureClaim } from '@toolbox-web/grid-angular';\nimport type { RowReorderConfig } from '@toolbox-web/grid/plugins/reorder-rows';\n\n/**\n * Owns the binding(s) `[reorderRows]` 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[reorderRows]',\n standalone: true,\n})\nexport class GridReorderRowsDirective implements OnDestroy {\n private readonly elementRef = inject(ElementRef<DataGridElement>);\n\n readonly reorderRows = input<boolean | RowReorderConfig>();\n\n constructor() {\n registerFeatureClaim(this.elementRef.nativeElement, 'reorderRows', () => this.reorderRows());\n }\n\n ngOnDestroy(): void {\n unregisterFeatureClaim(this.elementRef.nativeElement, 'reorderRows');\n }\n}\n","/**\n * Row reorder feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `reorderRows` input on Grid directive.\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid-angular/features/reorder-rows';\n *\n * <tbw-grid [reorderRows]=\"true\" />\n * ```\n *\n * @packageDocumentation\n */\n\nimport '@toolbox-web/grid/features/reorder-rows';\nexport { GridReorderRowsDirective } from './grid-reorder-rows.directive';\nexport type { _Augmentation as _ReorderRowsAugmentation } from '@toolbox-web/grid/features/reorder-rows';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;AAUG;AAMH;;;;AAIG;MAKU,wBAAwB,CAAA;AAClB,IAAA,UAAU,GAAG,MAAM,EAAC,UAA2B,EAAC;IAExD,WAAW,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,aAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAA8B;AAE1D,IAAA,WAAA,GAAA;AACE,QAAA,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;IAC9F;IAEA,WAAW,GAAA;QACT,sBAAsB,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,aAAa,CAAC;IACtE;uGAXW,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAxB,wBAAwB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,uBAAA,EAAA,MAAA,EAAA,EAAA,WAAA,EAAA,EAAA,iBAAA,EAAA,aAAA,EAAA,UAAA,EAAA,aAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAxB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBAJpC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,uBAAuB;AACjC,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;;ACxBD;;;;;;;;;;;;;AAaG;;ACbH;;AAEG;;;;"}
@@ -1,21 +1,131 @@
1
+ import { registerFeatureClaim, claimEvent, unregisterFeatureClaim, unclaimEvent, registerResponsiveCardRendererBridge, getResponsiveCardTemplate, registerTemplateBridge } from '@toolbox-web/grid-angular';
1
2
  import '@toolbox-web/grid/features/responsive';
3
+ import * as i0 from '@angular/core';
4
+ import { inject, ElementRef, input, output, Directive } from '@angular/core';
5
+
6
+ /**
7
+ * `GridResponsiveDirective` — owns `[responsive]` and `(responsiveChange)`
8
+ * on `<tbw-grid>`. See `GridFilteringDirective` for the full rationale.
9
+ *
10
+ * @category Directive
11
+ */
12
+ /**
13
+ * Owns the binding(s) `[responsive], [responsiveChange]` on `<tbw-grid>` for the matching feature plugin. See {@link GridFilteringDirective} for the full rationale.
14
+ *
15
+ * @category Directive
16
+ */
17
+ class GridResponsiveDirective {
18
+ elementRef = inject((ElementRef));
19
+ responsive = input(...(ngDevMode ? [undefined, { debugName: "responsive" }] : /* istanbul ignore next */ []));
20
+ responsiveChange = output();
21
+ listener;
22
+ constructor() {
23
+ const grid = this.elementRef.nativeElement;
24
+ registerFeatureClaim(grid, 'responsive', () => this.responsive());
25
+ claimEvent(grid, 'responsive-change');
26
+ }
27
+ ngOnInit() {
28
+ const grid = this.elementRef.nativeElement;
29
+ this.listener = (e) => this.responsiveChange.emit(e.detail);
30
+ grid.addEventListener('responsive-change', this.listener);
31
+ }
32
+ ngOnDestroy() {
33
+ const grid = this.elementRef.nativeElement;
34
+ if (this.listener) {
35
+ grid.removeEventListener('responsive-change', this.listener);
36
+ this.listener = undefined;
37
+ }
38
+ unregisterFeatureClaim(grid, 'responsive');
39
+ unclaimEvent(grid, 'responsive-change');
40
+ }
41
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: GridResponsiveDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
42
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: GridResponsiveDirective, isStandalone: true, selector: "tbw-grid[responsive], tbw-grid[responsiveChange]", inputs: { responsive: { classPropertyName: "responsive", publicName: "responsive", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { responsiveChange: "responsiveChange" }, ngImport: i0 });
43
+ }
44
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: GridResponsiveDirective, decorators: [{
45
+ type: Directive,
46
+ args: [{
47
+ selector: 'tbw-grid[responsive], tbw-grid[responsiveChange]',
48
+ standalone: true,
49
+ }]
50
+ }], ctorParameters: () => [], propDecorators: { responsive: [{ type: i0.Input, args: [{ isSignal: true, alias: "responsive", required: false }] }], responsiveChange: [{ type: i0.Output, args: ["responsiveChange"] }] } });
2
51
 
3
52
  /**
4
53
  * Responsive feature for @toolbox-web/grid-angular
5
54
  *
6
- * Import this module to enable the `responsive` input on Grid directive.
55
+ * Import this module to enable the `[responsive]` input on the `Grid`
56
+ * directive AND to wire `<tbw-grid-responsive-card>` Angular templates into
57
+ * the ResponsivePlugin's `cardRenderer`.
7
58
  *
8
59
  * @example
9
60
  * ```typescript
61
+ * // In your bootstrap (e.g. main.ts or app.component.ts):
10
62
  * import '@toolbox-web/grid-angular/features/responsive';
63
+ * ```
11
64
  *
12
- * <tbw-grid [responsive]="{ breakpoint: 768 }" />
65
+ * ```html
66
+ * <tbw-grid [responsive]="{ breakpoint: 768 }">
67
+ * <tbw-grid-responsive-card>
68
+ * <ng-template let-row>...</ng-template>
69
+ * </tbw-grid-responsive-card>
70
+ * </tbw-grid>
13
71
  * ```
14
72
  *
15
73
  * @packageDocumentation
16
74
  */
75
+ // Install the row renderer bridge on the adapter. This is what
76
+ // `adapter.createResponsiveCardRenderer(grid)` and
77
+ // `adapter.parseResponsiveCardElement(el)` delegate to. Without this import,
78
+ // both methods return undefined.
79
+ registerResponsiveCardRendererBridge((gridElement, adapter) => {
80
+ // Type inferred from `getResponsiveCardTemplate` (same package instance as
81
+ // `adapter`), not from a local `import type { TemplateRef } from '@angular/core'`
82
+ // — the latter resolves through Bun's `.bun/` cache during ng-packagr build
83
+ // and produces a brand-incompatible TemplateRef vs the built adapter `.d.ts`.
84
+ const template = getResponsiveCardTemplate(gridElement);
85
+ if (!template)
86
+ return undefined;
87
+ return (row, rowIndex) => {
88
+ const context = { $implicit: row, row, index: rowIndex };
89
+ const viewRef = adapter.createTrackedEmbeddedView(template, context);
90
+ const container = document.createElement('div');
91
+ viewRef.rootNodes.forEach((node) => container.appendChild(node));
92
+ return container;
93
+ };
94
+ });
95
+ // Wire <tbw-grid-responsive-card> Angular templates into the ResponsivePlugin
96
+ // once content templates are registered. Runs from `Grid.ngAfterContentInit`
97
+ // via the template-bridge registry.
98
+ registerTemplateBridge(({ grid, adapter }) => {
99
+ // Only act when the user actually placed a <tbw-grid-responsive-card> in light DOM.
100
+ const cardElement = grid.querySelector('tbw-grid-responsive-card');
101
+ if (!cardElement)
102
+ return;
103
+ // Build a card renderer from the Angular template.
104
+ const cardRenderer = adapter.createResponsiveCardRenderer(grid);
105
+ if (!cardRenderer)
106
+ return;
107
+ // The plugin must already have been attached (via [responsive] input,
108
+ // gridConfig.features.responsive, or gridConfig.plugins). Use the runtime
109
+ // lookup so we don't miss plugins instantiated from `gridConfig.features`,
110
+ // which never appear in `gridConfig.plugins`.
111
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
112
+ const existingPlugin = grid.getPluginByName?.('responsive');
113
+ if (!existingPlugin) {
114
+ // eslint-disable-next-line no-console
115
+ console.warn('[tbw-grid-angular] <tbw-grid-responsive-card> found but ResponsivePlugin is not configured.\n' +
116
+ 'Add the [responsive] input, set gridConfig.features.responsive, or include\n' +
117
+ 'ResponsivePlugin in gridConfig.plugins:\n\n' +
118
+ ' <tbw-grid [responsive]="{ breakpoint: 600 }">...</tbw-grid>\n\n' +
119
+ 'or:\n\n' +
120
+ ' gridConfig = { features: { responsive: { breakpoint: 600 } } };');
121
+ return;
122
+ }
123
+ existingPlugin.setCardRenderer?.(cardRenderer);
124
+ });
17
125
 
18
126
  /**
19
127
  * Generated bundle index. Do not edit.
20
128
  */
129
+
130
+ export { GridResponsiveDirective };
21
131
  //# sourceMappingURL=toolbox-web-grid-angular-features-responsive.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolbox-web-grid-angular-features-responsive.mjs","sources":["../../../../libs/grid-angular/features/responsive/src/index.ts","../../../../libs/grid-angular/features/responsive/src/toolbox-web-grid-angular-features-responsive.ts"],"sourcesContent":["/**\n * Responsive feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `responsive` input on Grid directive.\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid-angular/features/responsive';\n *\n * <tbw-grid [responsive]=\"{ breakpoint: 768 }\" />\n * ```\n *\n * @packageDocumentation\n */\n\nimport '@toolbox-web/grid/features/responsive';\nexport type { _Augmentation as _ResponsiveAugmentation } from '@toolbox-web/grid/features/responsive';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;AAaG;;ACbH;;AAEG"}
1
+ {"version":3,"file":"toolbox-web-grid-angular-features-responsive.mjs","sources":["../../../../libs/grid-angular/features/responsive/src/grid-responsive.directive.ts","../../../../libs/grid-angular/features/responsive/src/index.ts","../../../../libs/grid-angular/features/responsive/src/toolbox-web-grid-angular-features-responsive.ts"],"sourcesContent":["/**\n * `GridResponsiveDirective` — owns `[responsive]` and `(responsiveChange)`\n * on `<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 { ResponsiveChangeDetail, ResponsivePluginConfig } from '@toolbox-web/grid/plugins/responsive';\n\n/**\n * Owns the binding(s) `[responsive], [responsiveChange]` 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[responsive], tbw-grid[responsiveChange]',\n standalone: true,\n})\nexport class GridResponsiveDirective implements OnInit, OnDestroy {\n private readonly elementRef = inject(ElementRef<DataGridElement>);\n\n readonly responsive = input<boolean | ResponsivePluginConfig>();\n readonly responsiveChange = output<ResponsiveChangeDetail>();\n\n private listener?: (e: Event) => void;\n\n constructor() {\n const grid = this.elementRef.nativeElement;\n registerFeatureClaim(grid, 'responsive', () => this.responsive());\n claimEvent(grid, 'responsive-change');\n }\n\n ngOnInit(): void {\n const grid = this.elementRef.nativeElement;\n this.listener = (e: Event): void => this.responsiveChange.emit((e as CustomEvent<ResponsiveChangeDetail>).detail);\n grid.addEventListener('responsive-change', this.listener);\n }\n\n ngOnDestroy(): void {\n const grid = this.elementRef.nativeElement;\n if (this.listener) {\n grid.removeEventListener('responsive-change', this.listener);\n this.listener = undefined;\n }\n unregisterFeatureClaim(grid, 'responsive');\n unclaimEvent(grid, 'responsive-change');\n }\n}\n","/**\n * Responsive feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `[responsive]` input on the `Grid`\n * directive AND to wire `<tbw-grid-responsive-card>` Angular templates into\n * the ResponsivePlugin's `cardRenderer`.\n *\n * @example\n * ```typescript\n * // In your bootstrap (e.g. main.ts or app.component.ts):\n * import '@toolbox-web/grid-angular/features/responsive';\n * ```\n *\n * ```html\n * <tbw-grid [responsive]=\"{ breakpoint: 768 }\">\n * <tbw-grid-responsive-card>\n * <ng-template let-row>...</ng-template>\n * </tbw-grid-responsive-card>\n * </tbw-grid>\n * ```\n *\n * @packageDocumentation\n */\n\nimport {\n getResponsiveCardTemplate,\n registerResponsiveCardRendererBridge,\n registerTemplateBridge,\n type GridAdapter,\n type GridResponsiveCardContext,\n} from '@toolbox-web/grid-angular';\nimport '@toolbox-web/grid/features/responsive';\nexport { GridResponsiveDirective } from './grid-responsive.directive';\nexport type { _Augmentation as _ResponsiveAugmentation } from '@toolbox-web/grid/features/responsive';\n\n/**\n * Subset of `ResponsivePlugin` we touch from the bridge. Avoids importing\n * the plugin class itself.\n */\ninterface ResponsivePluginLike {\n setCardRenderer?: (renderer: (row: unknown, rowIndex: number) => HTMLElement) => void;\n}\n\n// Install the row renderer bridge on the adapter. This is what\n// `adapter.createResponsiveCardRenderer(grid)` and\n// `adapter.parseResponsiveCardElement(el)` delegate to. Without this import,\n// both methods return undefined.\nregisterResponsiveCardRendererBridge(<TRow = unknown>(gridElement: HTMLElement, adapter: GridAdapter) => {\n // Type inferred from `getResponsiveCardTemplate` (same package instance as\n // `adapter`), not from a local `import type { TemplateRef } from '@angular/core'`\n // — the latter resolves through Bun's `.bun/` cache during ng-packagr build\n // and produces a brand-incompatible TemplateRef vs the built adapter `.d.ts`.\n const template = getResponsiveCardTemplate(gridElement);\n if (!template) return undefined;\n\n return (row: TRow, rowIndex: number) => {\n const context: GridResponsiveCardContext<TRow> = { $implicit: row, row, index: rowIndex };\n const viewRef = adapter.createTrackedEmbeddedView(template, context);\n const container = document.createElement('div');\n viewRef.rootNodes.forEach((node: Node) => container.appendChild(node));\n return container;\n };\n});\n\n// Wire <tbw-grid-responsive-card> Angular templates into the ResponsivePlugin\n// once content templates are registered. Runs from `Grid.ngAfterContentInit`\n// via the template-bridge registry.\nregisterTemplateBridge(({ grid, adapter }) => {\n // Only act when the user actually placed a <tbw-grid-responsive-card> in light DOM.\n const cardElement = grid.querySelector('tbw-grid-responsive-card');\n if (!cardElement) return;\n\n // Build a card renderer from the Angular template.\n const cardRenderer = adapter.createResponsiveCardRenderer(grid);\n if (!cardRenderer) return;\n\n // The plugin must already have been attached (via [responsive] input,\n // gridConfig.features.responsive, or gridConfig.plugins). Use the runtime\n // lookup so we don't miss plugins instantiated from `gridConfig.features`,\n // which never appear in `gridConfig.plugins`.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const existingPlugin = (grid as any).getPluginByName?.('responsive') as ResponsivePluginLike | undefined;\n\n if (!existingPlugin) {\n // eslint-disable-next-line no-console\n console.warn(\n '[tbw-grid-angular] <tbw-grid-responsive-card> found but ResponsivePlugin is not configured.\\n' +\n 'Add the [responsive] input, set gridConfig.features.responsive, or include\\n' +\n 'ResponsivePlugin in gridConfig.plugins:\\n\\n' +\n ' <tbw-grid [responsive]=\"{ breakpoint: 600 }\">...</tbw-grid>\\n\\n' +\n 'or:\\n\\n' +\n ' gridConfig = { features: { responsive: { breakpoint: 600 } } };',\n );\n return;\n }\n\n existingPlugin.setCardRenderer?.(cardRenderer as (row: unknown, rowIndex: number) => HTMLElement);\n});\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;;;;;AAKG;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,CAAoC;IACtD,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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