@agility-workbench/angular-grid 1.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/LICENSE +21 -0
- package/README.md +103 -0
- package/fesm2022/agility-workbench-angular-grid.mjs +1028 -0
- package/index.d.ts +267 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Himanshu M
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# @agility-workbench/angular-grid
|
|
2
|
+
|
|
3
|
+
Angular bindings for [`@agility-workbench/grid`](https://www.npmjs.com/package/@agility-workbench/grid) —
|
|
4
|
+
a high-performance data grid. Provides the standalone `<awb-grid>` component and re-exports the
|
|
5
|
+
full core API, so you can import everything you need from one place. Supports Angular 20.3
|
|
6
|
+
through 22 (zone-based and zoneless applications) on Node 20.19+.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @agility-workbench/angular-grid
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`@agility-workbench/grid` is installed automatically as a dependency; `@angular/core` (20.3–22,
|
|
15
|
+
each major verified against the packed artifact) is a peer dependency your app provides.
|
|
16
|
+
|
|
17
|
+
## Quick start
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { Component } from "@angular/core";
|
|
21
|
+
import {
|
|
22
|
+
AwbGrid,
|
|
23
|
+
ColumnType,
|
|
24
|
+
type IGridAPI,
|
|
25
|
+
type NgColDef,
|
|
26
|
+
} from "@agility-workbench/angular-grid";
|
|
27
|
+
|
|
28
|
+
@Component({
|
|
29
|
+
selector: "app-example",
|
|
30
|
+
standalone: true,
|
|
31
|
+
imports: [AwbGrid],
|
|
32
|
+
template: `
|
|
33
|
+
<div style="height: 400px">
|
|
34
|
+
<awb-grid
|
|
35
|
+
[rowData]="rowData"
|
|
36
|
+
[columnDefs]="columnDefs"
|
|
37
|
+
rowIdKey="id"
|
|
38
|
+
[rowNumbers]="true"
|
|
39
|
+
(gridReady)="onGridReady($event)"
|
|
40
|
+
/>
|
|
41
|
+
</div>
|
|
42
|
+
`,
|
|
43
|
+
})
|
|
44
|
+
export class ExampleComponent {
|
|
45
|
+
columnDefs: NgColDef[] = [
|
|
46
|
+
{ key: "name", label: "Name", type: ColumnType.STRING },
|
|
47
|
+
{ key: "price", label: "Price", type: ColumnType.NUMBER },
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
rowData = [
|
|
51
|
+
{ id: "1", name: "Widget", price: 9.99 },
|
|
52
|
+
{ id: "2", name: "Gadget", price: 14.5 },
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
onGridReady(api: IGridAPI): void {
|
|
56
|
+
// Imperative API: sorting, selection, editing, exports, view state, …
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The grid fills its host element — give `<awb-grid>` (or a wrapper) a height. The component is
|
|
62
|
+
also available via template reference: `<awb-grid #grid="awbGrid" />` → `grid.api`.
|
|
63
|
+
|
|
64
|
+
## Styling
|
|
65
|
+
|
|
66
|
+
Nothing to do — the grid delivers its own stylesheet when it attaches, once per document, and
|
|
67
|
+
once per shadow root for grids inside one.
|
|
68
|
+
|
|
69
|
+
Under a strict Content Security Policy without `style-src 'unsafe-inline'`, pass a nonce via the
|
|
70
|
+
`styleNonce` input (page-global, so use the same value for every grid). To load the stylesheet
|
|
71
|
+
yourself instead — via `angular.json` styles or a global import of
|
|
72
|
+
`@agility-workbench/grid/styles.css` — set `suppressStyleInjection` on each grid, so the two
|
|
73
|
+
copies do not fight in the cascade.
|
|
74
|
+
|
|
75
|
+
## Angular components in the grid
|
|
76
|
+
|
|
77
|
+
Column definitions accept Angular component classes wherever the core accepts a class component —
|
|
78
|
+
`cellRenderer`, `cellEditor`, `tooltipComponent`, `headerTooltip`, and `actionFrameComponent`.
|
|
79
|
+
A component receives its params either through an input named `params` or by implementing
|
|
80
|
+
`awbInit(params)` (plus optional `awbRefresh(params)`):
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import { Component, input } from "@angular/core";
|
|
84
|
+
import type { CellRendererParams } from "@agility-workbench/angular-grid";
|
|
85
|
+
|
|
86
|
+
@Component({
|
|
87
|
+
standalone: true,
|
|
88
|
+
template: `<strong>{{ params()?.value }}</strong>`,
|
|
89
|
+
})
|
|
90
|
+
export class BoldCell {
|
|
91
|
+
readonly params = input<CellRendererParams>();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const columnDefs: NgColDef[] = [{ key: "name", label: "Name", cellRenderer: BoldCell }];
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Cell editors implement `ICellEditorNgComp` (`getValue()` plus optional `focus`, `isParsed`,
|
|
98
|
+
`isCancelBeforeStart`). Menu items returned from `getColumnMenuItems` / `bodyContextMenu` may use
|
|
99
|
+
`TemplateRef`s for their `left`/`right` slots (`NgMenuItem`).
|
|
100
|
+
|
|
101
|
+
## License
|
|
102
|
+
|
|
103
|
+
MIT
|