@toolbox-web/grid-angular 0.1.1 → 0.1.2
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/README.md +76 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# @toolbox-web/grid-angular
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@toolbox-web/grid-angular)
|
|
4
4
|
[](../../LICENSE)
|
|
5
|
+
[](https://github.com/sponsors/OysteinAmundsen)
|
|
5
6
|
|
|
6
7
|
Angular adapter for `@toolbox-web/grid` data grid component. Provides directives for declarative template-driven cell renderers and editors.
|
|
7
8
|
|
|
@@ -296,6 +297,38 @@ import { Grid, GridToolPanel } from '@toolbox-web/grid-angular';
|
|
|
296
297
|
})
|
|
297
298
|
```
|
|
298
299
|
|
|
300
|
+
## Using Plugins
|
|
301
|
+
|
|
302
|
+
Import plugins individually for smaller bundles:
|
|
303
|
+
|
|
304
|
+
```typescript
|
|
305
|
+
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
306
|
+
import { Grid } from '@toolbox-web/grid-angular';
|
|
307
|
+
import { SelectionPlugin } from '@toolbox-web/grid/plugins/selection';
|
|
308
|
+
import { FilteringPlugin } from '@toolbox-web/grid/plugins/filtering';
|
|
309
|
+
|
|
310
|
+
@Component({
|
|
311
|
+
imports: [Grid],
|
|
312
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
313
|
+
template: `<tbw-grid [rows]="rows" [gridConfig]="config" />`,
|
|
314
|
+
})
|
|
315
|
+
export class MyGridComponent {
|
|
316
|
+
config = {
|
|
317
|
+
columns: [...],
|
|
318
|
+
plugins: [
|
|
319
|
+
new SelectionPlugin({ mode: 'row' }),
|
|
320
|
+
new FilteringPlugin({ debounceMs: 200 }),
|
|
321
|
+
],
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
Or import all plugins at once (larger bundle, but convenient):
|
|
327
|
+
|
|
328
|
+
```typescript
|
|
329
|
+
import { SelectionPlugin, FilteringPlugin } from '@toolbox-web/grid/all';
|
|
330
|
+
```
|
|
331
|
+
|
|
299
332
|
## API Reference
|
|
300
333
|
|
|
301
334
|
### Exported Directives
|
|
@@ -310,6 +343,32 @@ import { Grid, GridToolPanel } from '@toolbox-web/grid-angular';
|
|
|
310
343
|
| `GridDetailView` | `tbw-grid-detail` | Master-detail panel template |
|
|
311
344
|
| `GridToolPanel` | `tbw-grid-tool-panel` | Custom sidebar panel |
|
|
312
345
|
|
|
346
|
+
### Grid Directive Outputs
|
|
347
|
+
|
|
348
|
+
| Output | Type | Description |
|
|
349
|
+
| -------------- | --------------------------------- | -------------------- |
|
|
350
|
+
| `cellCommit` | `EventEmitter<CellCommitEvent>` | Cell value committed |
|
|
351
|
+
| `rowCommit` | `EventEmitter<RowCommitEvent>` | Row edit committed |
|
|
352
|
+
| `sortChange` | `EventEmitter<SortChangeEvent>` | Sort state changed |
|
|
353
|
+
| `columnResize` | `EventEmitter<ColumnResizeEvent>` | Column resized |
|
|
354
|
+
|
|
355
|
+
### GridDetailView Inputs
|
|
356
|
+
|
|
357
|
+
| Input | Type | Default | Description |
|
|
358
|
+
| ------------------ | ---------------------------- | --------- | ----------------------------------- |
|
|
359
|
+
| `showExpandColumn` | `boolean` | `true` | Show expand/collapse chevron column |
|
|
360
|
+
| `animation` | `'slide' \| 'fade' \| false` | `'slide'` | Animation style for expand/collapse |
|
|
361
|
+
|
|
362
|
+
### GridToolPanel Inputs
|
|
363
|
+
|
|
364
|
+
| Input | Type | Default | Description |
|
|
365
|
+
| --------- | -------- | -------- | --------------------------------- |
|
|
366
|
+
| `id` | `string` | Required | Unique panel identifier |
|
|
367
|
+
| `title` | `string` | Required | Panel title in accordion header |
|
|
368
|
+
| `icon` | `string` | - | Icon for the accordion header |
|
|
369
|
+
| `tooltip` | `string` | - | Tooltip text for header |
|
|
370
|
+
| `order` | `number` | `100` | Panel sort order (lower = higher) |
|
|
371
|
+
|
|
313
372
|
### Exported Types
|
|
314
373
|
|
|
315
374
|
```typescript
|
|
@@ -335,35 +394,6 @@ import { AngularGridAdapter } from '@toolbox-web/grid-angular';
|
|
|
335
394
|
|
|
336
395
|
In most cases, the `Grid` directive handles adapter registration automatically.
|
|
337
396
|
|
|
338
|
-
## Migration from TbwCellView/TbwCellEditor
|
|
339
|
-
|
|
340
|
-
If you were using the previous directive names, update your imports and templates:
|
|
341
|
-
|
|
342
|
-
```typescript
|
|
343
|
-
// Before
|
|
344
|
-
import { TbwCellView, TbwCellEditor } from '@toolbox-web/grid-angular';
|
|
345
|
-
|
|
346
|
-
// After
|
|
347
|
-
import { TbwRenderer, TbwEditor } from '@toolbox-web/grid-angular';
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
```html
|
|
351
|
-
<!-- Before -->
|
|
352
|
-
<app-badge *tbwCellView="let value" [value]="value" />
|
|
353
|
-
<app-editor *tbwCellEditor="let value" [value]="value" />
|
|
354
|
-
|
|
355
|
-
<!-- After -->
|
|
356
|
-
<app-badge *tbwRenderer="let value" [value]="value" />
|
|
357
|
-
<app-editor *tbwEditor="let value" [value]="value" />
|
|
358
|
-
```
|
|
359
|
-
|
|
360
|
-
> **Backwards Compatibility:** The old names (`TbwCellView`, `TbwCellEditor`) are still exported as aliases but are deprecated. They will be removed in a future major version.
|
|
361
|
-
|
|
362
|
-
## Requirements
|
|
363
|
-
|
|
364
|
-
- Angular 17+ (standalone components)
|
|
365
|
-
- `@toolbox-web/grid` >= 0.2.0
|
|
366
|
-
|
|
367
397
|
## Demo
|
|
368
398
|
|
|
369
399
|
See the full Angular demo at [`demos/employee-management/angular/`](../../demos/employee-management/angular/) which demonstrates:
|
|
@@ -376,6 +406,11 @@ See the full Angular demo at [`demos/employee-management/angular/`](../../demos/
|
|
|
376
406
|
- Shell integration (header, tool panels)
|
|
377
407
|
- Master-detail expandable rows
|
|
378
408
|
|
|
409
|
+
## Requirements
|
|
410
|
+
|
|
411
|
+
- Angular 17+ (standalone components)
|
|
412
|
+
- `@toolbox-web/grid` >= 0.2.0
|
|
413
|
+
|
|
379
414
|
## Development
|
|
380
415
|
|
|
381
416
|
```bash
|
|
@@ -389,6 +424,17 @@ bun nx test grid-angular
|
|
|
389
424
|
bun nx lint grid-angular
|
|
390
425
|
```
|
|
391
426
|
|
|
427
|
+
---
|
|
428
|
+
|
|
429
|
+
## Support This Project
|
|
430
|
+
|
|
431
|
+
This grid is built and maintained by a single developer in spare time. If it saves you time or money, consider sponsoring to keep development going:
|
|
432
|
+
|
|
433
|
+
[](https://github.com/sponsors/OysteinAmundsen)
|
|
434
|
+
[](https://www.patreon.com/c/OysteinAmundsen)
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
392
438
|
## License
|
|
393
439
|
|
|
394
440
|
MIT
|