@thkl/agrid 0.1.4 → 0.1.5
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 +30 -1
- package/fesm2022/thkl-agrid.mjs +338 -15
- package/fesm2022/thkl-agrid.mjs.map +1 -1
- package/package.json +1 -1
- package/types/thkl-agrid.d.ts +107 -2
- package/types/thkl-agrid.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# @thkl/agrid
|
|
2
2
|
|
|
3
3
|
A signal-based, standalone data grid for Angular 21 with virtual scrolling, editing,
|
|
4
|
-
filtering, sorting, grouping, pinned columns, selection, clipboard operations,
|
|
4
|
+
filtering, sorting, grouping, tree data, pinned columns, selection, clipboard operations,
|
|
5
|
+
and pagination.
|
|
5
6
|
|
|
6
7
|
## Install
|
|
7
8
|
|
|
@@ -70,6 +71,34 @@ Marking is independent from row selection. Cell and range copy use the same copi
|
|
|
70
71
|
every marked row, while Copy row uses every visible column. Duplicate rows are omitted, and marked
|
|
71
72
|
rows remain included when filters hide them.
|
|
72
73
|
|
|
74
|
+
## Tree data
|
|
75
|
+
|
|
76
|
+
Pass `treeConfig` to render rows as a hierarchical tree. The hierarchy lives on the flat row
|
|
77
|
+
array via stable `id` / `parentId` accessors, so there are no nested `children` arrays and
|
|
78
|
+
selection and editing keep working on the same indices.
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
import { AgridTreeConfig } from '@thkl/agrid';
|
|
82
|
+
|
|
83
|
+
const treeConfig: AgridTreeConfig<OrgRow> = {
|
|
84
|
+
getId: row => row.id,
|
|
85
|
+
getParentId: row => row.parentId, // null / unknown id ⇒ root row
|
|
86
|
+
treeField: 'name', // column that shows the twisty
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
readonly provider = new AgridProvider<OrgRow>({
|
|
90
|
+
columns,
|
|
91
|
+
datasource: new AgridDataSource(rows),
|
|
92
|
+
treeConfig,
|
|
93
|
+
});
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The `treeField` column shows an indented expand/collapse twisty. Filtering and sorting behave as
|
|
97
|
+
in a flat grid; with `keepAncestorsOnFilter` (default `true`) a match deep in the tree keeps its
|
|
98
|
+
parents visible and force-opens the path to it. Tree mode takes precedence over grouping and
|
|
99
|
+
disables pagination. Call `grid.expandAllNodes()` / `grid.collapseAllNodes()` to toggle the whole
|
|
100
|
+
tree.
|
|
101
|
+
|
|
73
102
|
## Saving edited rows
|
|
74
103
|
|
|
75
104
|
Use `rowChanged` to send one request after the user edits one or more fields in a row:
|