@toolbox-web/grid-angular 2.0.0-rc.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/toolbox-web-grid-angular-features-clipboard.mjs +15 -9
- package/fesm2022/toolbox-web-grid-angular-features-clipboard.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-column-virtualization.mjs +5 -4
- package/fesm2022/toolbox-web-grid-angular-features-column-virtualization.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-context-menu.mjs +5 -4
- package/fesm2022/toolbox-web-grid-angular-features-context-menu.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-editing.mjs +1537 -1510
- package/fesm2022/toolbox-web-grid-angular-features-editing.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-export.mjs +5 -4
- package/fesm2022/toolbox-web-grid-angular-features-export.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-filtering.mjs +12 -9
- package/fesm2022/toolbox-web-grid-angular-features-filtering.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-grouping-columns.mjs +5 -4
- package/fesm2022/toolbox-web-grid-angular-features-grouping-columns.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-grouping-rows.mjs +5 -4
- package/fesm2022/toolbox-web-grid-angular-features-grouping-rows.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-master-detail.mjs +16 -11
- package/fesm2022/toolbox-web-grid-angular-features-master-detail.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-multi-sort.mjs +5 -4
- package/fesm2022/toolbox-web-grid-angular-features-multi-sort.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-pinned-columns.mjs +5 -4
- package/fesm2022/toolbox-web-grid-angular-features-pinned-columns.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-pinned-rows.mjs +5 -4
- package/fesm2022/toolbox-web-grid-angular-features-pinned-rows.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-pivot.mjs +5 -4
- package/fesm2022/toolbox-web-grid-angular-features-pivot.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-print.mjs +7 -5
- package/fesm2022/toolbox-web-grid-angular-features-print.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-reorder-columns.mjs +5 -4
- package/fesm2022/toolbox-web-grid-angular-features-reorder-columns.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-responsive.mjs +16 -11
- package/fesm2022/toolbox-web-grid-angular-features-responsive.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-row-drag-drop.mjs +5 -4
- package/fesm2022/toolbox-web-grid-angular-features-row-drag-drop.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-selection.mjs +13 -8
- package/fesm2022/toolbox-web-grid-angular-features-selection.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-server-side.mjs +5 -4
- package/fesm2022/toolbox-web-grid-angular-features-server-side.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-shell.mjs +31 -20
- package/fesm2022/toolbox-web-grid-angular-features-shell.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-sticky-rows.mjs +5 -4
- package/fesm2022/toolbox-web-grid-angular-features-sticky-rows.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-tooltip.mjs +5 -4
- package/fesm2022/toolbox-web-grid-angular-features-tooltip.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-tree.mjs +5 -4
- package/fesm2022/toolbox-web-grid-angular-features-tree.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-undo-redo.mjs +11 -7
- package/fesm2022/toolbox-web-grid-angular-features-undo-redo.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-visibility.mjs +5 -4
- package/fesm2022/toolbox-web-grid-angular-features-visibility.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular.mjs +61 -71
- package/fesm2022/toolbox-web-grid-angular.mjs.map +1 -1
- package/package.json +2 -2
- package/types/toolbox-web-grid-angular-features-clipboard.d.ts +4 -3
- package/types/toolbox-web-grid-angular-features-clipboard.d.ts.map +1 -1
- package/types/toolbox-web-grid-angular.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbox-web-grid-angular-features-responsive.mjs","sources":["../../../../libs/grid-angular/features/responsive/src/grid-responsive-card.directive.ts","../../../../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":["import { contentChild, Directive, effect, ElementRef, inject, input, TemplateRef } from '@angular/core';\n\n/**\n * Context object passed to the responsive card template.\n *\n * @template TRow - The type of row data\n *\n * @example\n * ```html\n * <tbw-grid-responsive-card>\n * <ng-template let-row let-index=\"index\">\n * <div class=\"card-content\">\n * <span>{{ row.name }}</span>\n * <span>Row #{{ index }}</span>\n * </div>\n * </ng-template>\n * </tbw-grid-responsive-card>\n * ```\n * @since 0.4.0\n */\nexport interface GridResponsiveCardContext<TRow = unknown> {\n /**\n * The row data (available as `let-row` or `let-myVar`).\n */\n $implicit: TRow;\n\n /**\n * The row data (explicit access via `let-row=\"row\"`).\n */\n row: TRow;\n\n /**\n * The row index (zero-based).\n */\n index: number;\n}\n\n/**\n * Registry to store responsive card templates by grid element.\n * Used by AngularGridAdapter to create card renderers.\n */\nexport const responsiveCardTemplateRegistry = new Map<HTMLElement, TemplateRef<GridResponsiveCardContext>>();\n\n/**\n * Retrieves the responsive card template for a grid element.\n *\n * @param gridElement - The grid element to look up\n * @returns The template reference or undefined if not found\n * @since 0.4.0\n */\nexport function getResponsiveCardTemplate(\n gridElement: HTMLElement,\n): TemplateRef<GridResponsiveCardContext> | undefined {\n // Find the tbw-grid-responsive-card element inside the grid\n const cardElement = gridElement.querySelector('tbw-grid-responsive-card');\n if (!cardElement) return undefined;\n return responsiveCardTemplateRegistry.get(cardElement as HTMLElement);\n}\n\n/**\n * Directive for providing custom Angular templates for responsive card layout.\n *\n * Use this directive to define how each row should render when the grid\n * is in responsive/mobile mode. The template receives the row data and index.\n *\n * ## Usage\n *\n * ```html\n * <tbw-grid [rows]=\"employees\">\n * <tbw-grid-responsive-card>\n * <ng-template let-employee let-idx=\"index\">\n * <div class=\"employee-card\">\n * <img [src]=\"employee.avatar\" alt=\"\">\n * <div class=\"info\">\n * <strong>{{ employee.name }}</strong>\n * <span>{{ employee.department }}</span>\n * </div>\n * </div>\n * </ng-template>\n * </tbw-grid-responsive-card>\n * </tbw-grid>\n * ```\n *\n * ## Important Notes\n *\n * - The ResponsivePlugin must be added to your grid config\n * - The Grid directive will automatically configure the plugin's cardRenderer\n * - Template context provides `$implicit` (row), `row`, and `index`\n *\n * @see ResponsivePlugin\n * @category Directive\n * @since 0.4.0\n */\n@Directive({\n selector: 'tbw-grid-responsive-card',\n})\nexport class GridResponsiveCard<TRow = unknown> {\n private elementRef = inject(ElementRef<HTMLElement>);\n\n /**\n * Card row height in pixels. Use `'auto'` for dynamic height based on content.\n *\n * Mirrors to the `card-row-height` attribute on the underlying\n * `<tbw-grid-responsive-card>` element which the ResponsivePlugin reads.\n *\n * @default 'auto'\n */\n cardRowHeight = input<number | 'auto'>();\n\n /**\n * The ng-template containing the card content.\n */\n template = contentChild(TemplateRef<GridResponsiveCardContext<TRow>>);\n\n /**\n * Effect that registers the template when it becomes available.\n */\n private onTemplateReceived = effect(() => {\n const template = this.template();\n if (template) {\n responsiveCardTemplateRegistry.set(\n this.elementRef.nativeElement,\n template as TemplateRef<GridResponsiveCardContext>,\n );\n }\n });\n\n /**\n * Effect that mirrors the `cardRowHeight` input to the kebab-cased attribute\n * read by the ResponsivePlugin.\n */\n private onCardRowHeightChange = effect(() => {\n const value = this.cardRowHeight();\n const element = this.elementRef.nativeElement;\n if (value === undefined) {\n element.removeAttribute('card-row-height');\n return;\n }\n element.setAttribute('card-row-height', value === 'auto' ? 'auto' : String(value));\n });\n\n /**\n * Type guard for template context inference.\n */\n static ngTemplateContextGuard<T>(\n _directive: GridResponsiveCard<T>,\n context: unknown,\n ): context is GridResponsiveCardContext<T> {\n return true;\n }\n}\n","/**\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, type Type } from '@angular/core';\nimport type { DataGridElement } from '@toolbox-web/grid';\nimport { claimEvent, registerFeatureClaim, unclaimEvent, unregisterFeatureClaim } from '@toolbox-web/grid-angular';\nimport type {\n ResponsivePluginConfig as CoreResponsivePluginConfig,\n ResponsiveChangeDetail,\n} from '@toolbox-web/grid/plugins/responsive';\n\n/**\n * Angular-specific responsive config that allows an Angular component class\n * as `cardRenderer`.\n *\n * Extends the core `ResponsivePluginConfig` to accept a `Type<unknown>` for\n * `cardRenderer` in addition to the vanilla\n * `(row, rowIndex, column?) => HTMLElement` signature. Bridging to vanilla\n * DOM is handled by the side-effect import\n * `@toolbox-web/grid-angular/features/responsive`.\n *\n * Re-exported from the feature entry under the same name as the core type\n * so Angular consumers see a single canonical `ResponsivePluginConfig` from\n * `@toolbox-web/grid-angular/features/responsive`.\n *\n * @since 1.7.1\n */\nexport type ResponsivePluginConfig<TRow = unknown> = Omit<CoreResponsivePluginConfig<TRow>, 'cardRenderer'> & {\n cardRenderer?: CoreResponsivePluginConfig<TRow>['cardRenderer'] | Type<unknown>;\n};\n\n/**\n * Owns the binding(s) `[responsive], [responsiveChange]` 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[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 type { Type } from '@angular/core';\nimport {\n isComponentClass,\n registerFeatureConfigPreprocessor,\n registerResponsiveCardRendererBridge,\n registerTemplateBridge,\n type GridAdapter,\n} from '@toolbox-web/grid-angular';\nimport '@toolbox-web/grid/features/responsive';\nimport { getResponsiveCardTemplate, type GridResponsiveCardContext } from './grid-responsive-card.directive';\nimport type { ResponsivePluginConfig } from './grid-responsive.directive';\nexport { GridResponsiveDirective } from './grid-responsive.directive';\nexport type { ResponsivePluginConfig } from './grid-responsive.directive';\nexport type { _Augmentation as _ResponsiveAugmentation } from '@toolbox-web/grid/features/responsive';\n\n// ---------------------------------------------------------------------------\n// Responsive-owned directive + helpers. These physically live in this\n// secondary entry (the runtime behaviour lives here too).\n// ---------------------------------------------------------------------------\nexport { getResponsiveCardTemplate, GridResponsiveCard } from './grid-responsive-card.directive';\nexport type { GridResponsiveCardContext } from './grid-responsive-card.directive';\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 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/**\n * Bridge any Angular component class used as `responsive.cardRenderer` to a\n * plain `(row, rowIndex, column?) => HTMLElement` function before the core\n * plugin factory consumes the config. Without this preprocessor, a component\n * class passed as `cardRenderer` would be invoked as a function at render\n * time and crash. Light-DOM `<tbw-grid-responsive-card>` templates continue\n * to win via the post-mount template bridge above.\n *\n * @since 1.7.1\n */\nregisterFeatureConfigPreprocessor('responsive', (config, adapter) => {\n if (!config || typeof config !== 'object') return config;\n const cfg = config as ResponsivePluginConfig;\n if (!isComponentClass(cfg.cardRenderer)) return config;\n\n const componentClass = cfg.cardRenderer as Type<unknown>;\n const mount = adapter.mountComponentRenderer<{ row: unknown; rowIndex: number; column?: unknown }>(\n componentClass,\n (ctx) => ({ row: ctx.row, rowIndex: ctx.rowIndex, column: ctx.column }),\n );\n const cached = new Map<unknown, HTMLElement>();\n const cardRenderer: NonNullable<ResponsivePluginConfig['cardRenderer']> = (row, rowIndex, column) => {\n const existing = cached.get(row);\n if (existing) return existing;\n const { hostElement } = mount({ row, rowIndex, column });\n cached.set(row, hostElement);\n return hostElement;\n };\n return { ...cfg, cardRenderer };\n});\n","/**\n *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EAAE,WAAW,CAAC;AAC5B,QAAA,OAAO,WAAW;AACpB,IAAA,CAAC;AACD,IAAA,OAAO,EAAE,GAAG,GAAG,EAAE,YAAY,EAAE;AACjC,CAAC,CAAC;;AC1IF;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"toolbox-web-grid-angular-features-responsive.mjs","sources":["../../../../libs/grid-angular/features/responsive/src/grid-responsive-card.directive.ts","../../../../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":["import { contentChild, Directive, effect, ElementRef, inject, input, TemplateRef } from '@angular/core';\n\n/**\n * Context object passed to the responsive card template.\n *\n * @template TRow - The type of row data\n *\n * @example\n * ```html\n * <tbw-grid-responsive-card>\n * <ng-template let-row let-index=\"index\">\n * <div class=\"card-content\">\n * <span>{{ row.name }}</span>\n * <span>Row #{{ index }}</span>\n * </div>\n * </ng-template>\n * </tbw-grid-responsive-card>\n * ```\n * @since 0.4.0\n */\nexport interface GridResponsiveCardContext<TRow = unknown> {\n /**\n * The row data (available as `let-row` or `let-myVar`).\n */\n $implicit: TRow;\n\n /**\n * The row data (explicit access via `let-row=\"row\"`).\n */\n row: TRow;\n\n /**\n * The row index (zero-based).\n */\n index: number;\n}\n\n/**\n * Registry to store responsive card templates by grid element.\n * Used by AngularGridAdapter to create card renderers.\n */\nexport const responsiveCardTemplateRegistry = new Map<HTMLElement, TemplateRef<GridResponsiveCardContext>>();\n\n/**\n * Retrieves the responsive card template for a grid element.\n *\n * @param gridElement - The grid element to look up\n * @returns The template reference or undefined if not found\n * @since 0.4.0\n */\nexport function getResponsiveCardTemplate(\n gridElement: HTMLElement,\n): TemplateRef<GridResponsiveCardContext> | undefined {\n // Find the tbw-grid-responsive-card element inside the grid\n const cardElement = gridElement.querySelector('tbw-grid-responsive-card');\n if (!cardElement) return undefined;\n return responsiveCardTemplateRegistry.get(cardElement as HTMLElement);\n}\n\n/**\n * Directive for providing custom Angular templates for responsive card layout.\n *\n * Use this directive to define how each row should render when the grid\n * is in responsive/mobile mode. The template receives the row data and index.\n *\n * ## Usage\n *\n * ```html\n * <tbw-grid [rows]=\"employees\">\n * <tbw-grid-responsive-card>\n * <ng-template let-employee let-idx=\"index\">\n * <div class=\"employee-card\">\n * <img [src]=\"employee.avatar\" alt=\"\">\n * <div class=\"info\">\n * <strong>{{ employee.name }}</strong>\n * <span>{{ employee.department }}</span>\n * </div>\n * </div>\n * </ng-template>\n * </tbw-grid-responsive-card>\n * </tbw-grid>\n * ```\n *\n * ## Important Notes\n *\n * - The ResponsivePlugin must be added to your grid config\n * - The Grid directive will automatically configure the plugin's cardRenderer\n * - Template context provides `$implicit` (row), `row`, and `index`\n *\n * @see ResponsivePlugin\n * @category Directive\n * @since 0.4.0\n */\n@Directive({\n selector: 'tbw-grid-responsive-card',\n})\nexport class GridResponsiveCard<TRow = unknown> {\n private elementRef = inject(ElementRef<HTMLElement>);\n\n /**\n * Card row height in pixels. Use `'auto'` for dynamic height based on content.\n *\n * Mirrors to the `card-row-height` attribute on the underlying\n * `<tbw-grid-responsive-card>` element which the ResponsivePlugin reads.\n *\n * @default 'auto'\n */\n cardRowHeight = input<number | 'auto'>();\n\n /**\n * The ng-template containing the card content.\n */\n template = contentChild(TemplateRef<GridResponsiveCardContext<TRow>>);\n\n /**\n * Effect that registers the template when it becomes available.\n */\n private onTemplateReceived = effect(() => {\n const template = this.template();\n if (template) {\n responsiveCardTemplateRegistry.set(\n this.elementRef.nativeElement,\n template as TemplateRef<GridResponsiveCardContext>,\n );\n }\n });\n\n /**\n * Effect that mirrors the `cardRowHeight` input to the kebab-cased attribute\n * read by the ResponsivePlugin.\n */\n private onCardRowHeightChange = effect(() => {\n const value = this.cardRowHeight();\n const element = this.elementRef.nativeElement;\n if (value === undefined) {\n element.removeAttribute('card-row-height');\n return;\n }\n element.setAttribute('card-row-height', value === 'auto' ? 'auto' : String(value));\n });\n\n /**\n * Type guard for template context inference.\n */\n static ngTemplateContextGuard<T>(\n _directive: GridResponsiveCard<T>,\n context: unknown,\n ): context is GridResponsiveCardContext<T> {\n return true;\n }\n}\n","/**\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, type Type } from '@angular/core';\nimport type { DataGridElement } from '@toolbox-web/grid';\nimport { claimEvent, registerFeatureClaim, unclaimEvent, unregisterFeatureClaim } from '@toolbox-web/grid-angular';\nimport type {\n ResponsivePluginConfig as CoreResponsivePluginConfig,\n ResponsiveChangeDetail,\n} from '@toolbox-web/grid/plugins/responsive';\n\n/**\n * Angular-specific responsive config that allows an Angular component class\n * as `cardRenderer`.\n *\n * Extends the core `ResponsivePluginConfig` to accept a `Type<unknown>` for\n * `cardRenderer` in addition to the vanilla\n * `(row, rowIndex, column?) => HTMLElement` signature. Bridging to vanilla\n * DOM is handled by the side-effect import\n * `@toolbox-web/grid-angular/features/responsive`.\n *\n * Re-exported from the feature entry under the same name as the core type\n * so Angular consumers see a single canonical `ResponsivePluginConfig` from\n * `@toolbox-web/grid-angular/features/responsive`.\n *\n * @since 1.7.1\n */\nexport type ResponsivePluginConfig<TRow = unknown> = Omit<CoreResponsivePluginConfig<TRow>, 'cardRenderer'> & {\n cardRenderer?: CoreResponsivePluginConfig<TRow>['cardRenderer'] | Type<unknown>;\n};\n\n/**\n * Owns the binding(s) `[responsive], [responsiveChange]` 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[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 type { Type } from '@angular/core';\nimport {\n isComponentClass,\n registerFeatureConfigPreprocessor,\n registerResponsiveCardRendererBridge,\n registerTemplateBridge,\n type GridAdapter,\n} from '@toolbox-web/grid-angular';\nimport '@toolbox-web/grid/features/responsive';\nimport { getResponsiveCardTemplate, type GridResponsiveCardContext } from './grid-responsive-card.directive';\nimport type { ResponsivePluginConfig } from './grid-responsive.directive';\nexport { GridResponsiveDirective } from './grid-responsive.directive';\nexport type { ResponsivePluginConfig } from './grid-responsive.directive';\nexport type { _Augmentation as _ResponsiveAugmentation } from '@toolbox-web/grid/features/responsive';\n\n// ---------------------------------------------------------------------------\n// Responsive-owned directive + helpers. These physically live in this\n// secondary entry (the runtime behaviour lives here too).\n// ---------------------------------------------------------------------------\nexport { getResponsiveCardTemplate, GridResponsiveCard } from './grid-responsive-card.directive';\nexport type { GridResponsiveCardContext } from './grid-responsive-card.directive';\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 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/**\n * Bridge any Angular component class used as `responsive.cardRenderer` to a\n * plain `(row, rowIndex, column?) => HTMLElement` function before the core\n * plugin factory consumes the config. Without this preprocessor, a component\n * class passed as `cardRenderer` would be invoked as a function at render\n * time and crash. Light-DOM `<tbw-grid-responsive-card>` templates continue\n * to win via the post-mount template bridge above.\n *\n * @since 1.7.1\n */\nregisterFeatureConfigPreprocessor('responsive', (config, adapter) => {\n if (!config || typeof config !== 'object') return config;\n const cfg = config as ResponsivePluginConfig;\n if (!isComponentClass(cfg.cardRenderer)) return config;\n\n const componentClass = cfg.cardRenderer as Type<unknown>;\n const mount = adapter.mountComponentRenderer<{ row: unknown; rowIndex: number; column?: unknown }>(\n componentClass,\n (ctx) => ({ row: ctx.row, rowIndex: ctx.rowIndex, column: ctx.column }),\n );\n const cached = new Map<unknown, HTMLElement>();\n const cardRenderer: NonNullable<ResponsivePluginConfig['cardRenderer']> = (row, rowIndex, column) => {\n const existing = cached.get(row);\n if (existing) return existing;\n const { hostElement } = mount({ row, rowIndex, column });\n cached.set(row, hostElement);\n return hostElement;\n };\n return { ...cfg, cardRenderer };\n});\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAqCA;;;AAGG;AACI,MAAM,8B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ElementRef));
|
|
20
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
-
rowDragDrop = input(
|
|
21
|
+
rowDragDrop = input(/* @ts-ignore */
|
|
22
|
+
...(ngDevMode ? [undefined, { debugName: "rowDragDrop" }] : /* istanbul ignore next */ []));
|
|
22
23
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
24
|
rowMove = output();
|
|
24
25
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -64,10 +65,10 @@ class GridRowDragDropDirective {
|
|
|
64
65
|
for (const ev of GridRowDragDropDirective.EVENTS)
|
|
65
66
|
unclaimEvent(grid, ev);
|
|
66
67
|
}
|
|
67
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
68
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
68
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridRowDragDropDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
69
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: GridRowDragDropDirective, isStandalone: true, selector: "tbw-grid[rowDragDrop], tbw-grid[rowMove], tbw-grid[rowDragStart], tbw-grid[rowDragEnd], tbw-grid[rowDrop], tbw-grid[rowTransfer]", inputs: { rowDragDrop: { classPropertyName: "rowDragDrop", publicName: "rowDragDrop", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { rowMove: "rowMove", rowDragStart: "rowDragStart", rowDragEnd: "rowDragEnd", rowDrop: "rowDrop", rowTransfer: "rowTransfer" }, ngImport: i0 });
|
|
69
70
|
}
|
|
70
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
71
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridRowDragDropDirective, decorators: [{
|
|
71
72
|
type: Directive,
|
|
72
73
|
args: [{
|
|
73
74
|
selector: 'tbw-grid[rowDragDrop], tbw-grid[rowMove], tbw-grid[rowDragStart], tbw-grid[rowDragEnd], tbw-grid[rowDrop], tbw-grid[rowTransfer]',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbox-web-grid-angular-features-row-drag-drop.mjs","sources":["../../../../libs/grid-angular/features/row-drag-drop/src/grid-row-drag-drop.directive.ts","../../../../libs/grid-angular/features/row-drag-drop/src/index.ts","../../../../libs/grid-angular/features/row-drag-drop/src/toolbox-web-grid-angular-features-row-drag-drop.ts"],"sourcesContent":["/**\n * `GridRowDragDropDirective` — owns `[rowDragDrop]` and the row drag-drop\n * outputs on `<tbw-grid>`. See `GridFilteringDirective` for the full\n * 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 {\n RowDragDropConfig,\n RowDragEndDetail,\n RowDragStartDetail,\n RowDropDetail,\n RowMoveDetail,\n RowTransferDetail,\n} from '@toolbox-web/grid/plugins/row-drag-drop';\n\n/**\n * Owns the binding(s) `[rowDragDrop], [rowMove], [rowDragStart], [rowDragEnd], [rowDrop], [rowTransfer]` on `<tbw-grid>` for the matching feature plugin. See `GridFilteringDirective` for the full rationale.\n *\n * @category Directive\n */\n@Directive({\n selector:\n 'tbw-grid[rowDragDrop], tbw-grid[rowMove], tbw-grid[rowDragStart], tbw-grid[rowDragEnd], tbw-grid[rowDrop], tbw-grid[rowTransfer]',\n standalone: true,\n})\nexport class GridRowDragDropDirective implements OnInit, OnDestroy {\n private readonly elementRef = inject(ElementRef<DataGridElement>);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly rowDragDrop = input<boolean | RowDragDropConfig<any>>();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly rowMove = output<RowMoveDetail<any>>();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly rowDragStart = output<RowDragStartDetail<any>>();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly rowDragEnd = output<RowDragEndDetail<any>>();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly rowDrop = output<RowDropDetail<any>>();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly rowTransfer = output<RowTransferDetail<any>>();\n\n private readonly listeners = new Map<string, (e: Event) => void>();\n private static readonly EVENTS = ['row-move', 'row-drag-start', 'row-drag-end', 'row-drop', 'row-transfer'] as const;\n\n constructor() {\n const grid = this.elementRef.nativeElement;\n registerFeatureClaim(grid, 'rowDragDrop', () => this.rowDragDrop());\n for (const ev of GridRowDragDropDirective.EVENTS) claimEvent(grid, ev);\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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n wire<RowMoveDetail<any>>('row-move', this.rowMove);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n wire<RowDragStartDetail<any>>('row-drag-start', this.rowDragStart);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n wire<RowDragEndDetail<any>>('row-drag-end', this.rowDragEnd);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n wire<RowDropDetail<any>>('row-drop', this.rowDrop);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n wire<RowTransferDetail<any>>('row-transfer', this.rowTransfer);\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, 'rowDragDrop');\n for (const ev of GridRowDragDropDirective.EVENTS) unclaimEvent(grid, ev);\n }\n}\n","/**\n * Row drag & drop feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `rowDragDrop` input on Grid directive\n * along with the `(rowDragStart)`, `(rowDragEnd)`, `(rowDrop)`, and\n * `(rowTransfer)` outputs. Supports both intra-grid reorder and cross-grid\n * transfer.\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid-angular/features/row-drag-drop';\n *\n * <tbw-grid [rowDragDrop]=\"{ dropZone: 'employees' }\" />\n * ```\n *\n * @packageDocumentation\n */\n\nimport '@toolbox-web/grid/features/row-drag-drop';\nexport { GridRowDragDropDirective } from './grid-row-drag-drop.directive';\nexport type { _Augmentation as _RowDragDropAugmentation } from '@toolbox-web/grid/features/row-drag-drop';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;;;;;;AAMG;AAaH;;;;AAIG;MAMU,wBAAwB,CAAA;AAClB,IAAA,UAAU,GAAG,MAAM,EAAC,UAA2B,EAAC;;
|
|
1
|
+
{"version":3,"file":"toolbox-web-grid-angular-features-row-drag-drop.mjs","sources":["../../../../libs/grid-angular/features/row-drag-drop/src/grid-row-drag-drop.directive.ts","../../../../libs/grid-angular/features/row-drag-drop/src/index.ts","../../../../libs/grid-angular/features/row-drag-drop/src/toolbox-web-grid-angular-features-row-drag-drop.ts"],"sourcesContent":["/**\n * `GridRowDragDropDirective` — owns `[rowDragDrop]` and the row drag-drop\n * outputs on `<tbw-grid>`. See `GridFilteringDirective` for the full\n * 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 {\n RowDragDropConfig,\n RowDragEndDetail,\n RowDragStartDetail,\n RowDropDetail,\n RowMoveDetail,\n RowTransferDetail,\n} from '@toolbox-web/grid/plugins/row-drag-drop';\n\n/**\n * Owns the binding(s) `[rowDragDrop], [rowMove], [rowDragStart], [rowDragEnd], [rowDrop], [rowTransfer]` on `<tbw-grid>` for the matching feature plugin. See `GridFilteringDirective` for the full rationale.\n *\n * @category Directive\n */\n@Directive({\n selector:\n 'tbw-grid[rowDragDrop], tbw-grid[rowMove], tbw-grid[rowDragStart], tbw-grid[rowDragEnd], tbw-grid[rowDrop], tbw-grid[rowTransfer]',\n standalone: true,\n})\nexport class GridRowDragDropDirective implements OnInit, OnDestroy {\n private readonly elementRef = inject(ElementRef<DataGridElement>);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly rowDragDrop = input<boolean | RowDragDropConfig<any>>();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly rowMove = output<RowMoveDetail<any>>();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly rowDragStart = output<RowDragStartDetail<any>>();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly rowDragEnd = output<RowDragEndDetail<any>>();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly rowDrop = output<RowDropDetail<any>>();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly rowTransfer = output<RowTransferDetail<any>>();\n\n private readonly listeners = new Map<string, (e: Event) => void>();\n private static readonly EVENTS = ['row-move', 'row-drag-start', 'row-drag-end', 'row-drop', 'row-transfer'] as const;\n\n constructor() {\n const grid = this.elementRef.nativeElement;\n registerFeatureClaim(grid, 'rowDragDrop', () => this.rowDragDrop());\n for (const ev of GridRowDragDropDirective.EVENTS) claimEvent(grid, ev);\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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n wire<RowMoveDetail<any>>('row-move', this.rowMove);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n wire<RowDragStartDetail<any>>('row-drag-start', this.rowDragStart);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n wire<RowDragEndDetail<any>>('row-drag-end', this.rowDragEnd);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n wire<RowDropDetail<any>>('row-drop', this.rowDrop);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n wire<RowTransferDetail<any>>('row-transfer', this.rowTransfer);\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, 'rowDragDrop');\n for (const ev of GridRowDragDropDirective.EVENTS) unclaimEvent(grid, ev);\n }\n}\n","/**\n * Row drag & drop feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `rowDragDrop` input on Grid directive\n * along with the `(rowDragStart)`, `(rowDragEnd)`, `(rowDrop)`, and\n * `(rowTransfer)` outputs. Supports both intra-grid reorder and cross-grid\n * transfer.\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid-angular/features/row-drag-drop';\n *\n * <tbw-grid [rowDragDrop]=\"{ dropZone: 'employees' }\" />\n * ```\n *\n * @packageDocumentation\n */\n\nimport '@toolbox-web/grid/features/row-drag-drop';\nexport { GridRowDragDropDirective } from './grid-row-drag-drop.directive';\nexport type { _Augmentation as _RowDragDropAugmentation } from '@toolbox-web/grid/features/row-drag-drop';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;;;;;;AAMG;AAaH;;;;AAIG;MAMU,wBAAwB,CAAA;AAClB,IAAA,UAAU,GAAG,MAAM,EAAC,UAA2B,EAAC;;AAGxD,IAAA,WAAW,GAAG,KAAK;+FAAoC;;IAEvD,OAAO,GAAG,MAAM,EAAsB;;IAEtC,YAAY,GAAG,MAAM,EAA2B;;IAEhD,UAAU,GAAG,MAAM,EAAyB;;IAE5C,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
19
|
elementRef = inject((ElementRef));
|
|
20
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
-
selection = input(
|
|
21
|
+
selection = input(/* @ts-ignore */
|
|
22
|
+
...(ngDevMode ? [undefined, { debugName: "selection" }] : /* istanbul ignore next */ []));
|
|
22
23
|
selectionChange = output();
|
|
23
24
|
listener;
|
|
24
25
|
constructor() {
|
|
@@ -40,10 +41,10 @@ class GridSelectionDirective {
|
|
|
40
41
|
unregisterFeatureClaim(grid, 'selection');
|
|
41
42
|
unclaimEvent(grid, 'selection-change');
|
|
42
43
|
}
|
|
43
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
44
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
44
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridSelectionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
45
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: GridSelectionDirective, isStandalone: true, selector: "tbw-grid[selection], tbw-grid[selectionChange]", inputs: { selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectionChange: "selectionChange" }, ngImport: i0 });
|
|
45
46
|
}
|
|
46
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
47
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridSelectionDirective, decorators: [{
|
|
47
48
|
type: Directive,
|
|
48
49
|
args: [{
|
|
49
50
|
selector: 'tbw-grid[selection], tbw-grid[selectionChange]',
|
|
@@ -130,11 +131,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
130
131
|
function injectGridSelection(selector = 'tbw-grid') {
|
|
131
132
|
const elementRef = inject(ElementRef);
|
|
132
133
|
const destroyRef = inject(DestroyRef);
|
|
133
|
-
const isReady = signal(false,
|
|
134
|
+
const isReady = signal(false, /* @ts-ignore */
|
|
135
|
+
...(ngDevMode ? [{ debugName: "isReady" }] : /* istanbul ignore next */ []));
|
|
134
136
|
// Reactive selection state
|
|
135
|
-
const selectionSignal = signal(null,
|
|
136
|
-
|
|
137
|
-
const
|
|
137
|
+
const selectionSignal = signal(null, /* @ts-ignore */
|
|
138
|
+
...(ngDevMode ? [{ debugName: "selectionSignal" }] : /* istanbul ignore next */ []));
|
|
139
|
+
const selectedRowIndicesSignal = signal([], /* @ts-ignore */
|
|
140
|
+
...(ngDevMode ? [{ debugName: "selectedRowIndicesSignal" }] : /* istanbul ignore next */ []));
|
|
141
|
+
const selectedRowsSignal = signal([], /* @ts-ignore */
|
|
142
|
+
...(ngDevMode ? [{ debugName: "selectedRowsSignal" }] : /* istanbul ignore next */ []));
|
|
138
143
|
// Lazy discovery: cached grid reference
|
|
139
144
|
let cachedGrid = null;
|
|
140
145
|
let readyPromiseStarted = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbox-web-grid-angular-features-selection.mjs","sources":["../../../../libs/grid-angular/features/selection/src/grid-selection.directive.ts","../../../../libs/grid-angular/features/selection/src/index.ts","../../../../libs/grid-angular/features/selection/src/toolbox-web-grid-angular-features-selection.ts"],"sourcesContent":["/**\n * `GridSelectionDirective` — owns `[selection]` and `(selectionChange)` on\n * `<tbw-grid>`. See `GridFilteringDirective` for the full rationale and\n * lifecycle contract; the same patterns apply here.\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 { SelectionChangeDetail, SelectionConfig } from '@toolbox-web/grid/plugins/selection';\n\n/**\n * Owns the binding(s) `[selection], [selectionChange]` 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[selection], tbw-grid[selectionChange]',\n standalone: true,\n})\nexport class GridSelectionDirective implements OnInit, OnDestroy {\n private readonly elementRef = inject(ElementRef<DataGridElement>);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly selection = input<'cell' | 'row' | 'range' | SelectionConfig<any>>();\n readonly selectionChange = output<SelectionChangeDetail>();\n\n private listener?: (e: Event) => void;\n\n constructor() {\n const grid = this.elementRef.nativeElement;\n registerFeatureClaim(grid, 'selection', () => this.selection());\n claimEvent(grid, 'selection-change');\n }\n\n ngOnInit(): void {\n const grid = this.elementRef.nativeElement;\n this.listener = (e: Event) => this.selectionChange.emit((e as CustomEvent<SelectionChangeDetail>).detail);\n grid.addEventListener('selection-change', this.listener);\n }\n\n ngOnDestroy(): void {\n const grid = this.elementRef.nativeElement;\n if (this.listener) {\n grid.removeEventListener('selection-change', this.listener);\n this.listener = undefined;\n }\n unregisterFeatureClaim(grid, 'selection');\n unclaimEvent(grid, 'selection-change');\n }\n}\n","/**\n * Selection feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `selection` input on Grid directive.\n * Also exports `injectGridSelection()` for programmatic selection control.\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid-angular/features/selection';\n *\n * <tbw-grid [selection]=\"'range'\" />\n * ```\n *\n * @example Using injectGridSelection\n * ```typescript\n * import { injectGridSelection } from '@toolbox-web/grid-angular/features/selection';\n *\n * @Component({...})\n * export class MyComponent {\n * private selection = injectGridSelection<Employee>();\n *\n * selectAll() {\n * this.selection.selectAll();\n * }\n *\n * getSelected() {\n * return this.selection.getSelection();\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/selection';\nimport {\n SelectionPlugin,\n type CellRange,\n type SelectionChangeDetail,\n type SelectionResult,\n} from '@toolbox-web/grid/plugins/selection';\nexport { GridSelectionDirective } from './grid-selection.directive';\nexport type { _Augmentation as _SelectionAugmentation } from '@toolbox-web/grid/features/selection';\n\n/**\n * Selection methods returned from injectGridSelection.\n *\n * Uses lazy discovery - the grid is found on first method call, not during initialization.\n * This ensures it works with lazy-rendered tabs, conditional rendering, etc.\n */\nexport interface SelectionMethods<TRow = unknown> {\n /**\n * Select all rows (row mode) or all cells (range mode).\n */\n selectAll: () => void;\n\n /**\n * Clear all selection.\n */\n clearSelection: () => void;\n\n /**\n * Get the current selection state (imperative, point-in-time snapshot).\n * For reactive selection state, use the `selection` signal instead.\n */\n getSelection: () => SelectionResult | null;\n\n /**\n * Check if a specific cell is selected.\n */\n isCellSelected: (row: number, col: number) => boolean;\n\n /**\n * Set selection ranges programmatically.\n */\n setRanges: (ranges: CellRange[]) => void;\n\n /**\n * Reactive selection state. Updates automatically whenever the selection changes.\n * Null when no SelectionPlugin is active or no selection has been made yet.\n *\n * @example\n * ```typescript\n * readonly selection = injectGridSelection();\n *\n * // In template:\n * // {{ selection.selection()?.ranges?.length ?? 0 }} cells selected\n *\n * // In computed:\n * readonly hasSelection = computed(() => (this.selection.selection()?.ranges?.length ?? 0) > 0);\n * ```\n */\n selection: Signal<SelectionResult | null>;\n\n /**\n * Reactive selected row indices (sorted ascending). Updates automatically.\n * Convenience signal for row-mode selection — returns `[]` in cell/range modes\n * or when nothing is selected.\n *\n * **Prefer `selectedRows`** for getting actual row objects — it handles\n * index-to-object resolution correctly regardless of sorting/filtering.\n *\n * @example\n * ```typescript\n * readonly selection = injectGridSelection();\n *\n * // In template:\n * // {{ selection.selectedRowIndices().length }} rows selected\n * ```\n */\n selectedRowIndices: Signal<number[]>;\n\n /**\n * Reactive selected row objects. Updates automatically whenever the selection changes.\n * Works in all selection modes (row, cell, range) — returns the actual row objects\n * from the grid's processed (sorted/filtered) rows.\n *\n * This is the recommended way to get selected rows. Unlike manual index mapping,\n * it correctly resolves rows even when the grid is sorted or filtered.\n *\n * @example\n * ```typescript\n * readonly selection = injectGridSelection<Employee>();\n *\n * // In template:\n * // {{ selection.selectedRows().length }} rows selected\n *\n * // In computed:\n * readonly hasSelection = computed(() => this.selection.selectedRows().length > 0);\n * ```\n */\n selectedRows: Signal<TRow[]>;\n\n /**\n * Signal indicating if grid is ready.\n * The grid is discovered lazily, so this updates when first method call succeeds.\n */\n isReady: Signal<boolean>;\n}\n\n/**\n * Angular inject function for programmatic selection control.\n *\n * Uses **lazy grid discovery** - the grid element is found when methods are called,\n * not during initialization. This ensures it works reliably with:\n * - Lazy-rendered tabs\n * - Conditional rendering (*ngIf)\n * - Dynamic component loading\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/selection';\n * import { injectGridSelection } from '@toolbox-web/grid-angular/features/selection';\n *\n * @Component({\n * selector: 'app-my-grid',\n * imports: [Grid],\n * template: `\n * <button (click)=\"handleSelectAll()\">Select All</button>\n * <tbw-grid [rows]=\"rows\" [selection]=\"'range'\"></tbw-grid>\n * `\n * })\n * export class MyGridComponent {\n * selection = injectGridSelection();\n *\n * handleSelectAll() {\n * this.selection.selectAll();\n * }\n *\n * getSelectedRows() {\n * const selection = this.selection.getSelection();\n * if (!selection) return [];\n * // Derive rows from selection.ranges as needed\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 injectGridSelection<TRow = unknown>(selector = 'tbw-grid'): SelectionMethods<TRow> {\n const elementRef = inject(ElementRef);\n const destroyRef = inject(DestroyRef);\n const isReady = signal(false);\n\n // Reactive selection state\n const selectionSignal = signal<SelectionResult | null>(null);\n const selectedRowIndicesSignal = signal<number[]>([]);\n const selectedRowsSignal = signal<TRow[]>([]);\n\n // Lazy discovery: cached grid reference\n let cachedGrid: DataGridElement<TRow> | null = null;\n let readyPromiseStarted = false;\n let listenerAttached = false;\n\n /**\n * Handle selection-change events from the grid.\n * Updates both reactive signals.\n */\n const onSelectionChange = (detail: unknown): void => {\n const selectionDetail = detail as SelectionChangeDetail;\n const plugin = getPlugin();\n if (plugin) {\n selectionSignal.set(plugin.getSelection());\n selectedRowIndicesSignal.set(selectionDetail.mode === 'row' ? plugin.getSelectedRowIndices() : []);\n selectedRowsSignal.set(plugin.getSelectedRows<TRow>());\n }\n };\n\n /**\n * Attach the selection-change event listener to the grid element.\n * Called once when the grid is first discovered.\n */\n const attachListener = (grid: DataGridElement<TRow>): void => {\n if (listenerAttached) return;\n listenerAttached = true;\n\n const unsub = grid.on('selection-change', onSelectionChange);\n\n destroyRef.onDestroy(() => {\n unsub();\n });\n };\n\n /**\n * Lazily find the grid element. Called on each method invocation.\n * Caches the reference once found and triggers ready() check.\n */\n const getGrid = (): DataGridElement<TRow> | null => {\n if (cachedGrid) return cachedGrid;\n\n const grid = elementRef.nativeElement.querySelector(selector) as DataGridElement<TRow> | null;\n if (grid) {\n cachedGrid = grid;\n attachListener(grid);\n // Start ready() check only once\n if (!readyPromiseStarted) {\n readyPromiseStarted = true;\n grid.ready?.().then(() => {\n if (grid.getPluginByName('selection')) {\n isReady.set(true);\n } else {\n setTimeout(() => isReady.set(true), 0);\n }\n });\n }\n }\n return grid;\n };\n\n const getPlugin = (): SelectionPlugin | undefined => {\n return getGrid()?.getPluginByName('selection') as SelectionPlugin | undefined;\n };\n\n /**\n * Sync reactive signals with the current plugin state.\n * Called once when the grid is first discovered and ready.\n */\n const syncSignals = (): void => {\n const plugin = getPlugin();\n if (plugin) {\n selectionSignal.set(plugin.getSelection());\n const mode = (plugin as any).config?.mode;\n selectedRowIndicesSignal.set(mode === 'row' ? plugin.getSelectedRowIndices() : []);\n selectedRowsSignal.set(plugin.getSelectedRows<TRow>());\n }\n };\n\n // Discover the grid after the first render so the selection-change\n // listener is attached without requiring a programmatic method call.\n // Uses a MutationObserver as fallback for lazy-rendered tabs, *ngIf,\n // @defer, etc. where the grid may not be in the DOM on first render.\n afterNextRender(() => {\n const grid = getGrid();\n if (grid) {\n grid.ready?.().then(() => {\n if (grid.getPluginByName('selection')) {\n syncSignals();\n } else {\n setTimeout(syncSignals, 0);\n }\n });\n return;\n }\n\n // Grid not in DOM yet — watch for it to appear.\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('selection')) {\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 selection: selectionSignal.asReadonly(),\n selectedRowIndices: selectedRowIndicesSignal.asReadonly(),\n selectedRows: selectedRowsSignal.asReadonly(),\n\n selectAll: () => {\n const plugin = getPlugin();\n if (!plugin) {\n console.warn(\n `[tbw-grid:selection] SelectionPlugin not found.\\n\\n` +\n ` → Enable selection on the grid:\\n` +\n ` <tbw-grid [selection]=\"'range'\" />`,\n );\n return;\n }\n const grid = getGrid();\n // Cast to any to access protected config\n const mode = (plugin as any).config?.mode;\n\n if (mode === 'row') {\n const rowCount = grid?.rows?.length ?? 0;\n const allIndices = new Set<number>();\n for (let i = 0; i < rowCount; i++) allIndices.add(i);\n (plugin as any).selected = allIndices;\n (plugin as any).requestAfterRender?.();\n } else if (mode === 'range') {\n const rowCount = grid?.rows?.length ?? 0;\n const colCount = (grid as any)?._columns?.length ?? 0;\n if (rowCount > 0 && colCount > 0) {\n plugin.setRanges([{ from: { row: 0, col: 0 }, to: { row: rowCount - 1, col: colCount - 1 } }]);\n }\n }\n },\n\n clearSelection: () => {\n getPlugin()?.clearSelection();\n },\n\n getSelection: () => {\n return getPlugin()?.getSelection() ?? null;\n },\n\n isCellSelected: (row: number, col: number) => {\n return getPlugin()?.isCellSelected(row, col) ?? false;\n },\n\n setRanges: (ranges: CellRange[]) => {\n getPlugin()?.setRanges(ranges);\n },\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;;;;;;AAMG;AAMH;;;;AAIG;MAKU,sBAAsB,CAAA;AAChB,IAAA,UAAU,GAAG,MAAM,EAAC,UAA2B,EAAC;;IAGxD,SAAS,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,WAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAmD;IACpE,eAAe,GAAG,MAAM,EAAyB;AAElD,IAAA,QAAQ;AAEhB,IAAA,WAAA,GAAA;AACE,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa;AAC1C,QAAA,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;AAC/D,QAAA,UAAU,CAAC,IAAI,EAAE,kBAAkB,CAAC;IACtC;IAEA,QAAQ,GAAA;AACN,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa;AAC1C,QAAA,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAQ,KAAK,IAAI,CAAC,eAAe,CAAC,IAAI,CAAE,CAAwC,CAAC,MAAM,CAAC;QACzG,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,IAAI,CAAC,QAAQ,CAAC;IAC1D;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,kBAAkB,EAAE,IAAI,CAAC,QAAQ,CAAC;AAC3D,YAAA,IAAI,CAAC,QAAQ,GAAG,SAAS;QA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grid-angular-features-selection.mjs","sources":["../../../../libs/grid-angular/features/selection/src/grid-selection.directive.ts","../../../../libs/grid-angular/features/selection/src/index.ts","../../../../libs/grid-angular/features/selection/src/toolbox-web-grid-angular-features-selection.ts"],"sourcesContent":["/**\n * `GridSelectionDirective` — owns `[selection]` and `(selectionChange)` on\n * `<tbw-grid>`. See `GridFilteringDirective` for the full rationale and\n * lifecycle contract; the same patterns apply here.\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 { SelectionChangeDetail, SelectionConfig } from '@toolbox-web/grid/plugins/selection';\n\n/**\n * Owns the binding(s) `[selection], [selectionChange]` 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[selection], tbw-grid[selectionChange]',\n standalone: true,\n})\nexport class GridSelectionDirective implements OnInit, OnDestroy {\n private readonly elementRef = inject(ElementRef<DataGridElement>);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly selection = input<'cell' | 'row' | 'range' | SelectionConfig<any>>();\n readonly selectionChange = output<SelectionChangeDetail>();\n\n private listener?: (e: Event) => void;\n\n constructor() {\n const grid = this.elementRef.nativeElement;\n registerFeatureClaim(grid, 'selection', () => this.selection());\n claimEvent(grid, 'selection-change');\n }\n\n ngOnInit(): void {\n const grid = this.elementRef.nativeElement;\n this.listener = (e: Event) => this.selectionChange.emit((e as CustomEvent<SelectionChangeDetail>).detail);\n grid.addEventListener('selection-change', this.listener);\n }\n\n ngOnDestroy(): void {\n const grid = this.elementRef.nativeElement;\n if (this.listener) {\n grid.removeEventListener('selection-change', this.listener);\n this.listener = undefined;\n }\n unregisterFeatureClaim(grid, 'selection');\n unclaimEvent(grid, 'selection-change');\n }\n}\n","/**\n * Selection feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `selection` input on Grid directive.\n * Also exports `injectGridSelection()` for programmatic selection control.\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid-angular/features/selection';\n *\n * <tbw-grid [selection]=\"'range'\" />\n * ```\n *\n * @example Using injectGridSelection\n * ```typescript\n * import { injectGridSelection } from '@toolbox-web/grid-angular/features/selection';\n *\n * @Component({...})\n * export class MyComponent {\n * private selection = injectGridSelection<Employee>();\n *\n * selectAll() {\n * this.selection.selectAll();\n * }\n *\n * getSelected() {\n * return this.selection.getSelection();\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/selection';\nimport {\n SelectionPlugin,\n type CellRange,\n type SelectionChangeDetail,\n type SelectionResult,\n} from '@toolbox-web/grid/plugins/selection';\nexport { GridSelectionDirective } from './grid-selection.directive';\nexport type { _Augmentation as _SelectionAugmentation } from '@toolbox-web/grid/features/selection';\n\n/**\n * Selection methods returned from injectGridSelection.\n *\n * Uses lazy discovery - the grid is found on first method call, not during initialization.\n * This ensures it works with lazy-rendered tabs, conditional rendering, etc.\n */\nexport interface SelectionMethods<TRow = unknown> {\n /**\n * Select all rows (row mode) or all cells (range mode).\n */\n selectAll: () => void;\n\n /**\n * Clear all selection.\n */\n clearSelection: () => void;\n\n /**\n * Get the current selection state (imperative, point-in-time snapshot).\n * For reactive selection state, use the `selection` signal instead.\n */\n getSelection: () => SelectionResult | null;\n\n /**\n * Check if a specific cell is selected.\n */\n isCellSelected: (row: number, col: number) => boolean;\n\n /**\n * Set selection ranges programmatically.\n */\n setRanges: (ranges: CellRange[]) => void;\n\n /**\n * Reactive selection state. Updates automatically whenever the selection changes.\n * Null when no SelectionPlugin is active or no selection has been made yet.\n *\n * @example\n * ```typescript\n * readonly selection = injectGridSelection();\n *\n * // In template:\n * // {{ selection.selection()?.ranges?.length ?? 0 }} cells selected\n *\n * // In computed:\n * readonly hasSelection = computed(() => (this.selection.selection()?.ranges?.length ?? 0) > 0);\n * ```\n */\n selection: Signal<SelectionResult | null>;\n\n /**\n * Reactive selected row indices (sorted ascending). Updates automatically.\n * Convenience signal for row-mode selection — returns `[]` in cell/range modes\n * or when nothing is selected.\n *\n * **Prefer `selectedRows`** for getting actual row objects — it handles\n * index-to-object resolution correctly regardless of sorting/filtering.\n *\n * @example\n * ```typescript\n * readonly selection = injectGridSelection();\n *\n * // In template:\n * // {{ selection.selectedRowIndices().length }} rows selected\n * ```\n */\n selectedRowIndices: Signal<number[]>;\n\n /**\n * Reactive selected row objects. Updates automatically whenever the selection changes.\n * Works in all selection modes (row, cell, range) — returns the actual row objects\n * from the grid's processed (sorted/filtered) rows.\n *\n * This is the recommended way to get selected rows. Unlike manual index mapping,\n * it correctly resolves rows even when the grid is sorted or filtered.\n *\n * @example\n * ```typescript\n * readonly selection = injectGridSelection<Employee>();\n *\n * // In template:\n * // {{ selection.selectedRows().length }} rows selected\n *\n * // In computed:\n * readonly hasSelection = computed(() => this.selection.selectedRows().length > 0);\n * ```\n */\n selectedRows: Signal<TRow[]>;\n\n /**\n * Signal indicating if grid is ready.\n * The grid is discovered lazily, so this updates when first method call succeeds.\n */\n isReady: Signal<boolean>;\n}\n\n/**\n * Angular inject function for programmatic selection control.\n *\n * Uses **lazy grid discovery** - the grid element is found when methods are called,\n * not during initialization. This ensures it works reliably with:\n * - Lazy-rendered tabs\n * - Conditional rendering (*ngIf)\n * - Dynamic component loading\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/selection';\n * import { injectGridSelection } from '@toolbox-web/grid-angular/features/selection';\n *\n * @Component({\n * selector: 'app-my-grid',\n * imports: [Grid],\n * template: `\n * <button (click)=\"handleSelectAll()\">Select All</button>\n * <tbw-grid [rows]=\"rows\" [selection]=\"'range'\"></tbw-grid>\n * `\n * })\n * export class MyGridComponent {\n * selection = injectGridSelection();\n *\n * handleSelectAll() {\n * this.selection.selectAll();\n * }\n *\n * getSelectedRows() {\n * const selection = this.selection.getSelection();\n * if (!selection) return [];\n * // Derive rows from selection.ranges as needed\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 injectGridSelection<TRow = unknown>(selector = 'tbw-grid'): SelectionMethods<TRow> {\n const elementRef = inject(ElementRef);\n const destroyRef = inject(DestroyRef);\n const isReady = signal(false);\n\n // Reactive selection state\n const selectionSignal = signal<SelectionResult | null>(null);\n const selectedRowIndicesSignal = signal<number[]>([]);\n const selectedRowsSignal = signal<TRow[]>([]);\n\n // Lazy discovery: cached grid reference\n let cachedGrid: DataGridElement<TRow> | null = null;\n let readyPromiseStarted = false;\n let listenerAttached = false;\n\n /**\n * Handle selection-change events from the grid.\n * Updates both reactive signals.\n */\n const onSelectionChange = (detail: unknown): void => {\n const selectionDetail = detail as SelectionChangeDetail;\n const plugin = getPlugin();\n if (plugin) {\n selectionSignal.set(plugin.getSelection());\n selectedRowIndicesSignal.set(selectionDetail.mode === 'row' ? plugin.getSelectedRowIndices() : []);\n selectedRowsSignal.set(plugin.getSelectedRows<TRow>());\n }\n };\n\n /**\n * Attach the selection-change event listener to the grid element.\n * Called once when the grid is first discovered.\n */\n const attachListener = (grid: DataGridElement<TRow>): void => {\n if (listenerAttached) return;\n listenerAttached = true;\n\n const unsub = grid.on('selection-change', onSelectionChange);\n\n destroyRef.onDestroy(() => {\n unsub();\n });\n };\n\n /**\n * Lazily find the grid element. Called on each method invocation.\n * Caches the reference once found and triggers ready() check.\n */\n const getGrid = (): DataGridElement<TRow> | null => {\n if (cachedGrid) return cachedGrid;\n\n const grid = elementRef.nativeElement.querySelector(selector) as DataGridElement<TRow> | null;\n if (grid) {\n cachedGrid = grid;\n attachListener(grid);\n // Start ready() check only once\n if (!readyPromiseStarted) {\n readyPromiseStarted = true;\n grid.ready?.().then(() => {\n if (grid.getPluginByName('selection')) {\n isReady.set(true);\n } else {\n setTimeout(() => isReady.set(true), 0);\n }\n });\n }\n }\n return grid;\n };\n\n const getPlugin = (): SelectionPlugin | undefined => {\n return getGrid()?.getPluginByName('selection') as SelectionPlugin | undefined;\n };\n\n /**\n * Sync reactive signals with the current plugin state.\n * Called once when the grid is first discovered and ready.\n */\n const syncSignals = (): void => {\n const plugin = getPlugin();\n if (plugin) {\n selectionSignal.set(plugin.getSelection());\n const mode = (plugin as any).config?.mode;\n selectedRowIndicesSignal.set(mode === 'row' ? plugin.getSelectedRowIndices() : []);\n selectedRowsSignal.set(plugin.getSelectedRows<TRow>());\n }\n };\n\n // Discover the grid after the first render so the selection-change\n // listener is attached without requiring a programmatic method call.\n // Uses a MutationObserver as fallback for lazy-rendered tabs, *ngIf,\n // @defer, etc. where the grid may not be in the DOM on first render.\n afterNextRender(() => {\n const grid = getGrid();\n if (grid) {\n grid.ready?.().then(() => {\n if (grid.getPluginByName('selection')) {\n syncSignals();\n } else {\n setTimeout(syncSignals, 0);\n }\n });\n return;\n }\n\n // Grid not in DOM yet — watch for it to appear.\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('selection')) {\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 selection: selectionSignal.asReadonly(),\n selectedRowIndices: selectedRowIndicesSignal.asReadonly(),\n selectedRows: selectedRowsSignal.asReadonly(),\n\n selectAll: () => {\n const plugin = getPlugin();\n if (!plugin) {\n console.warn(\n `[tbw-grid:selection] SelectionPlugin not found.\\n\\n` +\n ` → Enable selection on the grid:\\n` +\n ` <tbw-grid [selection]=\"'range'\" />`,\n );\n return;\n }\n const grid = getGrid();\n // Cast to any to access protected config\n const mode = (plugin as any).config?.mode;\n\n if (mode === 'row') {\n const rowCount = grid?.rows?.length ?? 0;\n const allIndices = new Set<number>();\n for (let i = 0; i < rowCount; i++) allIndices.add(i);\n (plugin as any).selected = allIndices;\n (plugin as any).requestAfterRender?.();\n } else if (mode === 'range') {\n const rowCount = grid?.rows?.length ?? 0;\n const colCount = (grid as any)?._columns?.length ?? 0;\n if (rowCount > 0 && colCount > 0) {\n plugin.setRanges([{ from: { row: 0, col: 0 }, to: { row: rowCount - 1, col: colCount - 1 } }]);\n }\n }\n },\n\n clearSelection: () => {\n getPlugin()?.clearSelection();\n },\n\n getSelection: () => {\n return getPlugin()?.getSelection() ?? null;\n },\n\n isCellSelected: (row: number, col: number) => {\n return getPlugin()?.isCellSelected(row, col) ?? false;\n },\n\n setRanges: (ranges: CellRange[]) => {\n getPlugin()?.setRanges(ranges);\n },\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;;;;;;AAMG;AAMH;;;;AAIG;MAKU,sBAAsB,CAAA;AAChB,IAAA,UAAU,GAAG,MAAM,EAAC,UAA2B,EAAC;;AAGxD,IAAA,SAAS,GAAG,KAAK;6FAAmD;IACpE,eAAe,GAAG,MAAM,EAAyB;AAElD,IAAA,QAAQ;AAEhB,IAAA,WAAA,GAAA;AACE,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa;AAC1C,QAAA,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;AAC/D,QAAA,UAAU,CAAC,IAAI,EAAE,kBAAkB,CAAC;IACtC;IAEA,QAAQ,GAAA;AACN,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa;AAC1C,QAAA,IAAI,CA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AC;QAED,YAAY,EAAE,MAAK;AACjB,YAAA,OAAO,SAAS,EAAE,EAAE,YAAY,EAAE,IAAI,IAAI;QAC5C,CAAC;AAED,QAAA,cAAc,EAAE,CAAC,GAAW,EAAE,GAAW,KAAI;YAC3C,OAAO,SAAS,EAAE,EAAE,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,KAAK;QACvD,CAAC;AAED,QAAA,SAAS,EAAE,CAAC,MAAmB,KAAI;AACjC,YAAA,SAAS,EAAE,EAAE,SAAS,CAAC,MAAM,CAAC;QAChC,CAAC;KACF;AACH;;ACzWA;;AAEG;;;;"}
|
|
@@ -16,17 +16,18 @@ import { registerFeatureClaim, unregisterFeatureClaim } from '@toolbox-web/grid-
|
|
|
16
16
|
*/
|
|
17
17
|
class GridServerSideDirective {
|
|
18
18
|
elementRef = inject((ElementRef));
|
|
19
|
-
serverSide = input(
|
|
19
|
+
serverSide = input(/* @ts-ignore */
|
|
20
|
+
...(ngDevMode ? [undefined, { debugName: "serverSide" }] : /* istanbul ignore next */ []));
|
|
20
21
|
constructor() {
|
|
21
22
|
registerFeatureClaim(this.elementRef.nativeElement, 'serverSide', () => this.serverSide());
|
|
22
23
|
}
|
|
23
24
|
ngOnDestroy() {
|
|
24
25
|
unregisterFeatureClaim(this.elementRef.nativeElement, 'serverSide');
|
|
25
26
|
}
|
|
26
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
27
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
27
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridServerSideDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
28
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: GridServerSideDirective, isStandalone: true, selector: "tbw-grid[serverSide]", inputs: { serverSide: { classPropertyName: "serverSide", publicName: "serverSide", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
28
29
|
}
|
|
29
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
30
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridServerSideDirective, decorators: [{
|
|
30
31
|
type: Directive,
|
|
31
32
|
args: [{
|
|
32
33
|
selector: 'tbw-grid[serverSide]',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbox-web-grid-angular-features-server-side.mjs","sources":["../../../../libs/grid-angular/features/server-side/src/grid-server-side.directive.ts","../../../../libs/grid-angular/features/server-side/src/index.ts","../../../../libs/grid-angular/features/server-side/src/toolbox-web-grid-angular-features-server-side.ts"],"sourcesContent":["/**\n * `GridServerSideDirective` — owns `[serverSide]` 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 { ServerSideConfig } from '@toolbox-web/grid/plugins/server-side';\n\n/**\n * Owns the binding(s) `[serverSide]` 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[serverSide]',\n standalone: true,\n})\nexport class GridServerSideDirective implements OnDestroy {\n private readonly elementRef = inject(ElementRef<DataGridElement>);\n\n readonly serverSide = input<ServerSideConfig>();\n\n constructor() {\n registerFeatureClaim(this.elementRef.nativeElement, 'serverSide', () => this.serverSide());\n }\n\n ngOnDestroy(): void {\n unregisterFeatureClaim(this.elementRef.nativeElement, 'serverSide');\n }\n}\n","/**\n * Server-side feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `serverSide` input on Grid directive.\n *\n * The grid's `ServerSideDataSource.getRows()` accepts either a `Promise` or an\n * RxJS-style `Observable` (any `Subscribable`) directly — Angular `HttpClient`\n * results work without any wrapper. Superseded requests are cancelled by the\n * grid via `unsubscribe()`, which is what causes `HttpClient` to abort the\n * underlying XHR.\n *\n * @example\n * ```typescript\n * import { Component, inject } from '@angular/core';\n * import { HttpClient } from '@angular/common/http';\n * import { map } from 'rxjs/operators';\n * import { Grid } from '@toolbox-web/grid-angular';\n * import '@toolbox-web/grid-angular/features/server-side';\n * import type { ServerSideDataSource } from '@toolbox-web/grid/plugins/server-side';\n *\n * @Component({\n * imports: [Grid],\n * template: `<tbw-grid [serverSide]=\"{ dataSource }\" />`,\n * })\n * class MyGrid {\n * private http = inject(HttpClient);\n * dataSource: ServerSideDataSource = {\n * getRows: (params) =>\n * this.http.get<{ items: unknown[]; total: number }>('/api/data', {\n * params: { offset: params.startNode, limit: params.endNode - params.startNode },\n * }).pipe(map((d) => ({ rows: d.items, totalNodeCount: d.total }))),\n * };\n * }\n * ```\n *\n * @packageDocumentation\n */\n\nimport '@toolbox-web/grid/features/server-side';\nexport { GridServerSideDirective } from './grid-server-side.directive';\nexport type { _Augmentation as _ServerSideAugmentation } from '@toolbox-web/grid/features/server-side';\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;
|
|
1
|
+
{"version":3,"file":"toolbox-web-grid-angular-features-server-side.mjs","sources":["../../../../libs/grid-angular/features/server-side/src/grid-server-side.directive.ts","../../../../libs/grid-angular/features/server-side/src/index.ts","../../../../libs/grid-angular/features/server-side/src/toolbox-web-grid-angular-features-server-side.ts"],"sourcesContent":["/**\n * `GridServerSideDirective` — owns `[serverSide]` 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 { ServerSideConfig } from '@toolbox-web/grid/plugins/server-side';\n\n/**\n * Owns the binding(s) `[serverSide]` 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[serverSide]',\n standalone: true,\n})\nexport class GridServerSideDirective implements OnDestroy {\n private readonly elementRef = inject(ElementRef<DataGridElement>);\n\n readonly serverSide = input<ServerSideConfig>();\n\n constructor() {\n registerFeatureClaim(this.elementRef.nativeElement, 'serverSide', () => this.serverSide());\n }\n\n ngOnDestroy(): void {\n unregisterFeatureClaim(this.elementRef.nativeElement, 'serverSide');\n }\n}\n","/**\n * Server-side feature for @toolbox-web/grid-angular\n *\n * Import this module to enable the `serverSide` input on Grid directive.\n *\n * The grid's `ServerSideDataSource.getRows()` accepts either a `Promise` or an\n * RxJS-style `Observable` (any `Subscribable`) directly — Angular `HttpClient`\n * results work without any wrapper. Superseded requests are cancelled by the\n * grid via `unsubscribe()`, which is what causes `HttpClient` to abort the\n * underlying XHR.\n *\n * @example\n * ```typescript\n * import { Component, inject } from '@angular/core';\n * import { HttpClient } from '@angular/common/http';\n * import { map } from 'rxjs/operators';\n * import { Grid } from '@toolbox-web/grid-angular';\n * import '@toolbox-web/grid-angular/features/server-side';\n * import type { ServerSideDataSource } from '@toolbox-web/grid/plugins/server-side';\n *\n * @Component({\n * imports: [Grid],\n * template: `<tbw-grid [serverSide]=\"{ dataSource }\" />`,\n * })\n * class MyGrid {\n * private http = inject(HttpClient);\n * dataSource: ServerSideDataSource = {\n * getRows: (params) =>\n * this.http.get<{ items: unknown[]; total: number }>('/api/data', {\n * params: { offset: params.startNode, limit: params.endNode - params.startNode },\n * }).pipe(map((d) => ({ rows: d.items, totalNodeCount: d.total }))),\n * };\n * }\n * ```\n *\n * @packageDocumentation\n */\n\nimport '@toolbox-web/grid/features/server-side';\nexport { GridServerSideDirective } from './grid-server-side.directive';\nexport type { _Augmentation as _ServerSideAugmentation } from '@toolbox-web/grid/features/server-side';\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;AAExD,IAAA,UAAU,GAAG,KAAK;8FAAoB;AAE/C,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;;;ACnBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCG;;ACpCH;;AAEG;;;;"}
|
|
@@ -86,15 +86,19 @@ class GridToolPanel {
|
|
|
86
86
|
/** Panel title shown in accordion header (required) */
|
|
87
87
|
title = input.required({ ...(ngDevMode ? { debugName: "title" } : /* istanbul ignore next */ {}), alias: 'title' });
|
|
88
88
|
/** Icon for accordion section header (emoji or text) */
|
|
89
|
-
icon = input(
|
|
89
|
+
icon = input(/* @ts-ignore */
|
|
90
|
+
...(ngDevMode ? [undefined, { debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
90
91
|
/** Tooltip for accordion section header */
|
|
91
|
-
tooltip = input(
|
|
92
|
+
tooltip = input(/* @ts-ignore */
|
|
93
|
+
...(ngDevMode ? [undefined, { debugName: "tooltip" }] : /* istanbul ignore next */ []));
|
|
92
94
|
/** Panel order priority (lower = first, default: 100) */
|
|
93
|
-
order = input(100,
|
|
95
|
+
order = input(100, /* @ts-ignore */
|
|
96
|
+
...(ngDevMode ? [{ debugName: "order" }] : /* istanbul ignore next */ []));
|
|
94
97
|
/**
|
|
95
98
|
* Query for the ng-template content child.
|
|
96
99
|
*/
|
|
97
|
-
template = contentChild((TemplateRef),
|
|
100
|
+
template = contentChild((TemplateRef), /* @ts-ignore */
|
|
101
|
+
...(ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []));
|
|
98
102
|
/** Effect that triggers when the template is available */
|
|
99
103
|
onTemplateReceived = effect(() => {
|
|
100
104
|
const template = this.template();
|
|
@@ -113,7 +117,8 @@ class GridToolPanel {
|
|
|
113
117
|
// Register the template for this element
|
|
114
118
|
toolPanelTemplateRegistry.set(element, template);
|
|
115
119
|
}
|
|
116
|
-
},
|
|
120
|
+
}, /* @ts-ignore */
|
|
121
|
+
...(ngDevMode ? [{ debugName: "onTemplateReceived" }] : /* istanbul ignore next */ []));
|
|
117
122
|
/**
|
|
118
123
|
* Static type guard for template context.
|
|
119
124
|
* Enables type inference in templates.
|
|
@@ -121,10 +126,10 @@ class GridToolPanel {
|
|
|
121
126
|
static ngTemplateContextGuard(dir, ctx) {
|
|
122
127
|
return true;
|
|
123
128
|
}
|
|
124
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
125
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "
|
|
129
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridToolPanel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
130
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "22.0.6", type: GridToolPanel, isStandalone: true, selector: "tbw-grid-tool-panel", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: true, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", isSignal: true, isRequired: false, transformFunction: null }, order: { classPropertyName: "order", publicName: "order", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "template", first: true, predicate: (TemplateRef), descendants: true, isSignal: true }], ngImport: i0 });
|
|
126
131
|
}
|
|
127
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
132
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridToolPanel, decorators: [{
|
|
128
133
|
type: Directive,
|
|
129
134
|
args: [{ selector: 'tbw-grid-tool-panel' }]
|
|
130
135
|
}], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: true }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: true }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], tooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltip", required: false }] }], order: [{ type: i0.Input, args: [{ isSignal: true, alias: "order", required: false }] }], template: [{ type: i0.ContentChild, args: [i0.forwardRef(() => TemplateRef), { isSignal: true }] }] } });
|
|
@@ -158,11 +163,14 @@ class GridHeaderContent {
|
|
|
158
163
|
viewContainerRef = inject(ViewContainerRef);
|
|
159
164
|
destroyRef = inject(DestroyRef);
|
|
160
165
|
/** Unique identifier for this header content entry. Optional — defaults to a stable generated id. */
|
|
161
|
-
id = input(undefined,
|
|
166
|
+
id = input(undefined, /* @ts-ignore */
|
|
167
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
162
168
|
/** Render order priority. Lower values appear first. @default 100 */
|
|
163
|
-
order = input(100,
|
|
169
|
+
order = input(100, /* @ts-ignore */
|
|
170
|
+
...(ngDevMode ? [{ debugName: "order" }] : /* istanbul ignore next */ []));
|
|
164
171
|
/** The template to mount into the grid's header content slot. */
|
|
165
|
-
template = contentChild((TemplateRef),
|
|
172
|
+
template = contentChild((TemplateRef), /* @ts-ignore */
|
|
173
|
+
...(ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []));
|
|
166
174
|
viewRef = null;
|
|
167
175
|
registeredId = null;
|
|
168
176
|
resolvedId = `tbw-header-content-${++autoIdCounter$1}`;
|
|
@@ -275,10 +283,10 @@ class GridHeaderContent {
|
|
|
275
283
|
static ngTemplateContextGuard(_dir, ctx) {
|
|
276
284
|
return true;
|
|
277
285
|
}
|
|
278
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
279
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "
|
|
286
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridHeaderContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
287
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "22.0.6", type: GridHeaderContent, isStandalone: true, selector: "tbw-grid-header-content", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, order: { classPropertyName: "order", publicName: "order", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "template", first: true, predicate: (TemplateRef), descendants: true, isSignal: true }], ngImport: i0 });
|
|
280
288
|
}
|
|
281
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
289
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridHeaderContent, decorators: [{
|
|
282
290
|
type: Directive,
|
|
283
291
|
args: [{ selector: 'tbw-grid-header-content', standalone: true }]
|
|
284
292
|
}], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], order: [{ type: i0.Input, args: [{ isSignal: true, alias: "order", required: false }] }], template: [{ type: i0.ContentChild, args: [i0.forwardRef(() => TemplateRef), { isSignal: true }] }] } });
|
|
@@ -315,9 +323,12 @@ class GridToolbarContent {
|
|
|
315
323
|
elementRef = inject((ElementRef));
|
|
316
324
|
viewContainerRef = inject(ViewContainerRef);
|
|
317
325
|
destroyRef = inject(DestroyRef);
|
|
318
|
-
id = input(undefined,
|
|
319
|
-
|
|
320
|
-
|
|
326
|
+
id = input(undefined, /* @ts-ignore */
|
|
327
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
328
|
+
order = input(100, /* @ts-ignore */
|
|
329
|
+
...(ngDevMode ? [{ debugName: "order" }] : /* istanbul ignore next */ []));
|
|
330
|
+
template = contentChild((TemplateRef), /* @ts-ignore */
|
|
331
|
+
...(ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []));
|
|
321
332
|
viewRef = null;
|
|
322
333
|
registeredId = null;
|
|
323
334
|
resolvedId = `tbw-toolbar-content-${++autoIdCounter}`;
|
|
@@ -418,10 +429,10 @@ class GridToolbarContent {
|
|
|
418
429
|
static ngTemplateContextGuard(_dir, ctx) {
|
|
419
430
|
return true;
|
|
420
431
|
}
|
|
421
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
422
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "
|
|
432
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridToolbarContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
433
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "22.0.6", type: GridToolbarContent, isStandalone: true, selector: "tbw-grid-toolbar-content", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, order: { classPropertyName: "order", publicName: "order", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "template", first: true, predicate: (TemplateRef), descendants: true, isSignal: true }], ngImport: i0 });
|
|
423
434
|
}
|
|
424
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
435
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridToolbarContent, decorators: [{
|
|
425
436
|
type: Directive,
|
|
426
437
|
args: [{ selector: 'tbw-grid-toolbar-content', standalone: true }]
|
|
427
438
|
}], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], order: [{ type: i0.Input, args: [{ isSignal: true, alias: "order", required: false }] }], template: [{ type: i0.ContentChild, args: [i0.forwardRef(() => TemplateRef), { isSignal: true }] }] } });
|