@toolbox-web/grid-angular 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/feature-registry-C-cKloXB.js +45 -0
- package/features/clipboard.d.ts +18 -0
- package/features/clipboard.d.ts.map +1 -0
- package/features/clipboard.js +3 -0
- package/features/column-virtualization.d.ts +16 -0
- package/features/column-virtualization.d.ts.map +1 -0
- package/features/column-virtualization.js +3 -0
- package/features/context-menu.d.ts +16 -0
- package/features/context-menu.d.ts.map +1 -0
- package/features/context-menu.js +3 -0
- package/features/editing.d.ts +16 -0
- package/features/editing.d.ts.map +1 -0
- package/features/editing.js +3 -0
- package/features/export.d.ts +17 -0
- package/features/export.d.ts.map +1 -0
- package/features/export.js +3 -0
- package/features/filtering.d.ts +17 -0
- package/features/filtering.d.ts.map +1 -0
- package/features/filtering.js +3 -0
- package/features/grouping-columns.d.ts +16 -0
- package/features/grouping-columns.d.ts.map +1 -0
- package/features/grouping-columns.js +3 -0
- package/features/grouping-rows.d.ts +16 -0
- package/features/grouping-rows.d.ts.map +1 -0
- package/features/grouping-rows.js +3 -0
- package/features/index.d.ts +1 -0
- package/features/index.d.ts.map +1 -0
- package/features/index.js +22 -0
- package/features/master-detail.d.ts +16 -0
- package/features/master-detail.d.ts.map +1 -0
- package/features/master-detail.js +3 -0
- package/features/pinned-columns.d.ts +19 -0
- package/features/pinned-columns.d.ts.map +1 -0
- package/features/pinned-columns.js +3 -0
- package/features/pinned-rows.d.ts +16 -0
- package/features/pinned-rows.d.ts.map +1 -0
- package/features/pinned-rows.js +3 -0
- package/features/pivot.d.ts +16 -0
- package/features/pivot.d.ts.map +1 -0
- package/features/pivot.js +3 -0
- package/features/print.d.ts +16 -0
- package/features/print.d.ts.map +1 -0
- package/features/print.js +3 -0
- package/features/reorder.d.ts +16 -0
- package/features/reorder.d.ts.map +1 -0
- package/features/reorder.js +3 -0
- package/features/responsive.d.ts +16 -0
- package/features/responsive.d.ts.map +1 -0
- package/features/responsive.js +3 -0
- package/features/row-reorder.d.ts +16 -0
- package/features/row-reorder.d.ts.map +1 -0
- package/features/row-reorder.js +3 -0
- package/features/selection.d.ts +16 -0
- package/features/selection.d.ts.map +1 -0
- package/features/selection.js +3 -0
- package/features/server-side.d.ts +16 -0
- package/features/server-side.d.ts.map +1 -0
- package/features/server-side.js +3 -0
- package/features/sorting.d.ts +16 -0
- package/features/sorting.d.ts.map +1 -0
- package/features/sorting.js +3 -0
- package/features/tree.d.ts +16 -0
- package/features/tree.d.ts.map +1 -0
- package/features/tree.js +3 -0
- package/features/undo-redo.d.ts +18 -0
- package/features/undo-redo.d.ts.map +1 -0
- package/features/undo-redo.js +3 -0
- package/features/visibility.d.ts +16 -0
- package/features/visibility.d.ts.map +1 -0
- package/features/visibility.js +3 -0
- package/index.d.ts +5 -1
- package/index.d.ts.map +1 -1
- package/index.js +1016 -306
- package/lib/angular-column-config.d.ts +1 -1
- package/lib/angular-grid-adapter.d.ts +1 -1
- package/lib/angular-grid-adapter.d.ts.map +1 -1
- package/lib/base-grid-editor.d.ts +1 -1
- package/lib/directives/grid-detail-view.directive.d.ts +1 -1
- package/lib/directives/grid.directive.d.ts +554 -3
- package/lib/directives/grid.directive.d.ts.map +1 -1
- package/lib/feature-registry.d.ts +72 -0
- package/lib/feature-registry.d.ts.map +1 -0
- package/lib/grid-type-registry.d.ts +1 -1
- package/lib/inject-grid.d.ts +109 -0
- package/lib/inject-grid.d.ts.map +1 -0
- package/package.json +11 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feature Registry for @toolbox-web/grid-angular
|
|
3
|
+
*
|
|
4
|
+
* This module provides a synchronous registry for plugin factories.
|
|
5
|
+
* Features are registered via side-effect imports, enabling tree-shaking
|
|
6
|
+
* while maintaining the clean input-based API.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // Import features you need (side-effect imports)
|
|
11
|
+
* import '@toolbox-web/grid-angular/features/selection';
|
|
12
|
+
* import '@toolbox-web/grid-angular/features/filtering';
|
|
13
|
+
*
|
|
14
|
+
* // Inputs work automatically - no async loading, no HTTP requests
|
|
15
|
+
* <tbw-grid [selection]="'range'" [filtering]="{ debounceMs: 200 }" />
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Feature names supported by the Grid directive.
|
|
20
|
+
*/
|
|
21
|
+
export type FeatureName = 'selection' | 'editing' | 'clipboard' | 'contextMenu' | 'sorting' | 'filtering' | 'reorder' | 'visibility' | 'pinnedColumns' | 'groupingColumns' | 'columnVirtualization' | 'rowReorder' | 'groupingRows' | 'pinnedRows' | 'tree' | 'masterDetail' | 'responsive' | 'undoRedo' | 'export' | 'print' | 'pivot' | 'serverSide';
|
|
22
|
+
/**
|
|
23
|
+
* Plugin factory function type.
|
|
24
|
+
* Takes configuration and returns a plugin instance.
|
|
25
|
+
*/
|
|
26
|
+
export type PluginFactory<TConfig = unknown> = (config: TConfig) => unknown;
|
|
27
|
+
/**
|
|
28
|
+
* Register a feature's plugin factory.
|
|
29
|
+
* Called by side-effect feature imports.
|
|
30
|
+
*
|
|
31
|
+
* @param name - The feature name (matches the input name on Grid directive)
|
|
32
|
+
* @param factory - Function that creates the plugin instance
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* // features/selection.ts
|
|
37
|
+
* import { SelectionPlugin } from '@toolbox-web/grid/plugins/selection';
|
|
38
|
+
* import { registerFeature } from '../lib/feature-registry';
|
|
39
|
+
*
|
|
40
|
+
* registerFeature('selection', (config) => new SelectionPlugin(config));
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function registerFeature<TConfig = unknown>(name: FeatureName, factory: PluginFactory<TConfig>): void;
|
|
44
|
+
/**
|
|
45
|
+
* Check if a feature is registered.
|
|
46
|
+
*/
|
|
47
|
+
export declare function isFeatureRegistered(name: FeatureName): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Get a registered feature's factory.
|
|
50
|
+
* Returns undefined if not registered.
|
|
51
|
+
*/
|
|
52
|
+
export declare function getFeatureFactory(name: FeatureName): PluginFactory | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Get all registered feature names.
|
|
55
|
+
* Useful for debugging.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getRegisteredFeatures(): FeatureName[];
|
|
58
|
+
/**
|
|
59
|
+
* Create a plugin instance for a feature.
|
|
60
|
+
* Shows a helpful warning if the feature is not registered.
|
|
61
|
+
*
|
|
62
|
+
* @param name - Feature name
|
|
63
|
+
* @param config - Plugin configuration
|
|
64
|
+
* @returns Plugin instance or undefined if not registered
|
|
65
|
+
*/
|
|
66
|
+
export declare function createPluginFromFeature<TConfig = unknown>(name: FeatureName, config: TConfig): unknown | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Clear the registry. For testing only.
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
export declare function clearFeatureRegistry(): void;
|
|
72
|
+
//# sourceMappingURL=feature-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-registry.d.ts","sourceRoot":"","sources":["../../../../libs/grid-angular/src/lib/feature-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB,WAAW,GACX,SAAS,GACT,WAAW,GACX,aAAa,GACb,SAAS,GACT,WAAW,GACX,SAAS,GACT,YAAY,GACZ,eAAe,GACf,iBAAiB,GACjB,sBAAsB,GACtB,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,MAAM,GACN,cAAc,GACd,YAAY,GACZ,UAAU,GACV,QAAQ,GACR,OAAO,GACP,OAAO,GACP,YAAY,CAAC;AAEjB;;;GAGG;AACH,MAAM,MAAM,aAAa,CAAC,OAAO,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC;AAuB5E;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAG,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,IAAI,CAK3G;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAE9D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,aAAa,GAAG,SAAS,CAE9E;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,WAAW,EAAE,CAErD;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,GAAG,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAqBlH;AASD;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAG3C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EnvironmentProviders, InjectionToken, Type } from '@angular/core';
|
|
2
|
-
import { TypeDefault } from '
|
|
2
|
+
import { TypeDefault } from '@toolbox-web/grid';
|
|
3
3
|
/**
|
|
4
4
|
* Angular-specific type default configuration.
|
|
5
5
|
* Uses Angular component types instead of function-based renderers/editors.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Signal } from '@angular/core';
|
|
2
|
+
import { ColumnConfig, DataGridElement, GridConfig } from '@toolbox-web/grid';
|
|
3
|
+
/**
|
|
4
|
+
* Selection convenience methods returned from injectGrid.
|
|
5
|
+
*/
|
|
6
|
+
export interface SelectionMethods<TRow = unknown> {
|
|
7
|
+
/**
|
|
8
|
+
* Select all rows in the grid.
|
|
9
|
+
* Requires SelectionPlugin with mode: 'row'.
|
|
10
|
+
*/
|
|
11
|
+
selectAll: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* Clear all selection.
|
|
14
|
+
* Works with any SelectionPlugin mode.
|
|
15
|
+
*/
|
|
16
|
+
clearSelection: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* Get selected row indices.
|
|
19
|
+
* Returns Set of selected row indices.
|
|
20
|
+
*/
|
|
21
|
+
getSelectedIndices: () => Set<number>;
|
|
22
|
+
/**
|
|
23
|
+
* Get selected rows data.
|
|
24
|
+
* Returns array of selected row objects.
|
|
25
|
+
*/
|
|
26
|
+
getSelectedRows: () => TRow[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Export convenience methods returned from injectGrid.
|
|
30
|
+
*/
|
|
31
|
+
export interface ExportMethods {
|
|
32
|
+
/**
|
|
33
|
+
* Export grid data to CSV file.
|
|
34
|
+
* Requires ExportPlugin to be loaded.
|
|
35
|
+
*
|
|
36
|
+
* @param filename - Optional filename (defaults to 'export.csv')
|
|
37
|
+
*/
|
|
38
|
+
exportToCsv: (filename?: string) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Export grid data to JSON file.
|
|
41
|
+
* Requires ExportPlugin to be loaded.
|
|
42
|
+
*
|
|
43
|
+
* @param filename - Optional filename (defaults to 'export.json')
|
|
44
|
+
*/
|
|
45
|
+
exportToJson: (filename?: string) => void;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Return type for injectGrid function.
|
|
49
|
+
*/
|
|
50
|
+
export interface InjectGridReturn<TRow = unknown> extends SelectionMethods<TRow>, ExportMethods {
|
|
51
|
+
/** Direct access to the typed grid element */
|
|
52
|
+
element: Signal<DataGridElement<TRow> | null>;
|
|
53
|
+
/** Whether the grid is ready */
|
|
54
|
+
isReady: Signal<boolean>;
|
|
55
|
+
/** Current grid configuration */
|
|
56
|
+
config: Signal<GridConfig<TRow> | null>;
|
|
57
|
+
/** Get the effective configuration */
|
|
58
|
+
getConfig: () => Promise<GridConfig<TRow> | null>;
|
|
59
|
+
/** Force a layout recalculation */
|
|
60
|
+
forceLayout: () => Promise<void>;
|
|
61
|
+
/** Toggle a group row */
|
|
62
|
+
toggleGroup: (key: string) => Promise<void>;
|
|
63
|
+
/** Register custom styles */
|
|
64
|
+
registerStyles: (id: string, css: string) => void;
|
|
65
|
+
/** Unregister custom styles */
|
|
66
|
+
unregisterStyles: (id: string) => void;
|
|
67
|
+
/** Get current visible columns */
|
|
68
|
+
visibleColumns: Signal<ColumnConfig<TRow>[]>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Angular inject function for programmatic access to a grid instance.
|
|
72
|
+
*
|
|
73
|
+
* This function should be called in the constructor or as a field initializer
|
|
74
|
+
* of an Angular component that contains a `<tbw-grid>` element.
|
|
75
|
+
*
|
|
76
|
+
* ## Usage
|
|
77
|
+
*
|
|
78
|
+
* ```typescript
|
|
79
|
+
* import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
80
|
+
* import { Grid, injectGrid } from '@toolbox-web/grid-angular';
|
|
81
|
+
*
|
|
82
|
+
* @Component({
|
|
83
|
+
* selector: 'app-my-grid',
|
|
84
|
+
* imports: [Grid],
|
|
85
|
+
* schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
86
|
+
* template: `
|
|
87
|
+
* <button (click)="handleResize()">Force Layout</button>
|
|
88
|
+
* <button (click)="handleExport()" [disabled]="!grid.isReady()">Export</button>
|
|
89
|
+
* <tbw-grid [rows]="rows" [gridConfig]="config"></tbw-grid>
|
|
90
|
+
* `
|
|
91
|
+
* })
|
|
92
|
+
* export class MyGridComponent {
|
|
93
|
+
* grid = injectGrid<Employee>();
|
|
94
|
+
*
|
|
95
|
+
* async handleResize() {
|
|
96
|
+
* await this.grid.forceLayout();
|
|
97
|
+
* }
|
|
98
|
+
*
|
|
99
|
+
* async handleExport() {
|
|
100
|
+
* const config = await this.grid.getConfig();
|
|
101
|
+
* console.log('Exporting with columns:', config?.columns);
|
|
102
|
+
* }
|
|
103
|
+
* }
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @returns Object with grid access methods and state signals
|
|
107
|
+
*/
|
|
108
|
+
export declare function injectGrid<TRow = unknown>(): InjectGridReturn<TRow>;
|
|
109
|
+
//# sourceMappingURL=inject-grid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inject-grid.d.ts","sourceRoot":"","sources":["../../../../libs/grid-angular/src/lib/inject-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiD,KAAK,MAAM,EAAU,MAAM,eAAe,CAAC;AACnG,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEnF;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,IAAI,GAAG,OAAO;IAC9C;;;OAGG;IACH,SAAS,EAAE,MAAM,IAAI,CAAC;IAEtB;;;OAGG;IACH,cAAc,EAAE,MAAM,IAAI,CAAC;IAE3B;;;OAGG;IACH,kBAAkB,EAAE,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC;IAEtC;;;OAGG;IACH,eAAe,EAAE,MAAM,IAAI,EAAE,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,WAAW,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAEzC;;;;;OAKG;IACH,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,IAAI,GAAG,OAAO,CAAE,SAAQ,gBAAgB,CAAC,IAAI,CAAC,EAAE,aAAa;IAC7F,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IAC9C,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACzB,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IACxC,sCAAsC;IACtC,SAAS,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IAClD,mCAAmC;IACnC,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,yBAAyB;IACzB,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,6BAA6B;IAC7B,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,+BAA+B;IAC/B,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,kCAAkC;IAClC,cAAc,EAAE,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;CAC9C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,UAAU,CAAC,IAAI,GAAG,OAAO,KAAK,gBAAgB,CAAC,IAAI,CAAC,CAgLnE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toolbox-web/grid-angular",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Angular adapter for @toolbox-web/grid data grid component",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -12,6 +12,16 @@
|
|
|
12
12
|
"types": "./index.d.ts",
|
|
13
13
|
"import": "./index.js",
|
|
14
14
|
"default": "./index.js"
|
|
15
|
+
},
|
|
16
|
+
"./features": {
|
|
17
|
+
"types": "./features/index.d.ts",
|
|
18
|
+
"import": "./features/index.js",
|
|
19
|
+
"default": "./features/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./features/*": {
|
|
22
|
+
"types": "./features/*.d.ts",
|
|
23
|
+
"import": "./features/*.js",
|
|
24
|
+
"default": "./features/*.js"
|
|
15
25
|
}
|
|
16
26
|
},
|
|
17
27
|
"keywords": [
|