@thkl/agrid 0.1.11 → 0.1.12
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 +74 -4
- package/fesm2022/thkl-agrid.mjs +2490 -502
- package/fesm2022/thkl-agrid.mjs.map +1 -1
- package/package.json +1 -1
- package/types/thkl-agrid.d.ts +748 -58
- package/types/thkl-agrid.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -72,14 +72,69 @@ be dragged.
|
|
|
72
72
|
`confirmRowDelete` protects grid delete actions with a localized in-row Yes/No confirmation.
|
|
73
73
|
Direct calls to `AgridDataSource.removeRow()` remain immediate.
|
|
74
74
|
|
|
75
|
-
`enableRowMarking`
|
|
76
|
-
|
|
75
|
+
`enableRowMarking` makes each control-cell row header clickable and adds a checkbox. Clicking the
|
|
76
|
+
header outside its nested controls toggles the same mark state and emits `(rowMark)` with the row,
|
|
77
|
+
its original datasource index, and the resulting `marked` state. Marked rows are included in
|
|
78
|
+
keyboard, cell-context, and row-context copy operations. Read `grid.markedRowIndices()` or call
|
|
77
79
|
`grid.clearMarkedRows()` when the host needs to inspect or reset the copy basket.
|
|
78
80
|
|
|
79
81
|
Marking is independent from row selection. Cell and range copy use the same copied columns for
|
|
80
82
|
every marked row, while Copy row uses every visible column. Duplicate rows are omitted, and marked
|
|
81
83
|
rows remain included when filters hide them.
|
|
82
84
|
|
|
85
|
+
Selecting numeric cells displays a live status bar with count, sum, average, minimum, and maximum.
|
|
86
|
+
Read the same values from `grid.selectionSummary()`. The signal is `null` when the active selection
|
|
87
|
+
contains no finite numeric values.
|
|
88
|
+
|
|
89
|
+
Set `enableColumnMarking: true` to toggle complete-column highlighting by clicking a header outside
|
|
90
|
+
its menu and resize controls. The grid exposes `markedColumnFields()` and emits `(columnMark)`.
|
|
91
|
+
|
|
92
|
+
Append custom commands to one column's menu and handle them through one typed output:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
{ field: 'status', header: 'Status', headerMenuItems: [
|
|
96
|
+
{ key: 'archive', label: 'Archive', icon: '⌂' },
|
|
97
|
+
] }
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
```html
|
|
101
|
+
<agrid [provider]="provider" (columnHeaderAction)="onColumnHeaderAction($event)" />
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The event contains `{ column, key }`.
|
|
105
|
+
|
|
106
|
+
Use `(firstDataRendered)` when host logic must wait until the grid has completed its first render
|
|
107
|
+
containing datasource rows:
|
|
108
|
+
|
|
109
|
+
```html
|
|
110
|
+
<agrid [provider]="provider" (firstDataRendered)="onGridReady($event)" />
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The event fires once per grid component. An initially empty datasource delays it until rows arrive.
|
|
114
|
+
Server-side loading placeholders do not count as rendered data. The payload contains `rows`,
|
|
115
|
+
`rowCount`, `provider`, and `datasource`.
|
|
116
|
+
|
|
117
|
+
For commands that change `textAlign` at runtime, keep the writable signal in the host instead of
|
|
118
|
+
mutating `event.column`:
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
readonly salaryAlignment = signal<'left' | 'center' | 'right'>('right');
|
|
122
|
+
|
|
123
|
+
// Column definition
|
|
124
|
+
{ field: 'salary', header: 'Salary', textAlign: this.salaryAlignment }
|
|
125
|
+
|
|
126
|
+
onColumnHeaderAction(event: ColumnHeaderActionEvent<Employee>): void {
|
|
127
|
+
if (event.column.field !== 'salary') return;
|
|
128
|
+
if (event.key === 'align-left') this.salaryAlignment.set('left');
|
|
129
|
+
if (event.key === 'align-center') this.salaryAlignment.set('center');
|
|
130
|
+
if (event.key === 'align-right') this.salaryAlignment.set('right');
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Assigning `event.column.textAlign = 'center'` mutates plain configuration and does not trigger an
|
|
135
|
+
Angular update. Calling `.set()` on `event.column.textAlign` is also not type-safe because the
|
|
136
|
+
property may contain a static string or a read-only signal.
|
|
137
|
+
|
|
83
138
|
## Menu bar
|
|
84
139
|
|
|
85
140
|
Set `menuBarItems` to render command buttons above the headers. An item with `items` becomes a
|
|
@@ -171,6 +226,10 @@ does not include. Numbers offer `=`, `≠`, `>`, `≥`, `<`, `≤`, and `between
|
|
|
171
226
|
before / after / between. Conditions combine with the header text filter, value picker, and other
|
|
172
227
|
columns using AND semantics, and are included in `AgridControl.toJSON()` state.
|
|
173
228
|
|
|
229
|
+
The header arrow opens the complete column menu. The condition button beside the inline filter
|
|
230
|
+
opens only the condition operator and operand controls; sorting, layout, grouping, custom commands,
|
|
231
|
+
clear-all actions, and distinct-value selection remain in the complete menu.
|
|
232
|
+
|
|
174
233
|
```ts
|
|
175
234
|
const columns: ColDef<Order>[] = [
|
|
176
235
|
{ field: 'reference', header: 'Reference', filterable: true },
|
|
@@ -316,6 +375,14 @@ tree.
|
|
|
316
375
|
Tree mode can be combined with `masterDetail: true` and a `detailRenderer`. Detail expanders are
|
|
317
376
|
shown only for leaf rows; parent rows retain their tree expand/collapse control.
|
|
318
377
|
|
|
378
|
+
Set `detailColumnField` to a column field when the panel should expose one larger multiline value.
|
|
379
|
+
The formatted value is shown normally; click it or focus it and press Enter to open a textarea.
|
|
380
|
+
Blur or Ctrl/Cmd+Enter commits, while Escape cancels. Editability, validation, history, and edit
|
|
381
|
+
events follow the linked column's normal cell behavior.
|
|
382
|
+
Set `detailActions` to add text-template buttons above the textarea. Each action has an `id`,
|
|
383
|
+
`label`, and optional `text` string or row-aware resolver; clicking inserts at the current
|
|
384
|
+
selection, or appends if the button opens the textarea.
|
|
385
|
+
|
|
319
386
|
## Standalone tree control
|
|
320
387
|
|
|
321
388
|
Use `<agrid-tree>` for the same parent-ID or path hierarchy without grid columns. It adds tree
|
|
@@ -453,7 +520,8 @@ Use `rowChanged` to send one request after the user edits one or more fields in
|
|
|
453
520
|
```ts
|
|
454
521
|
saveRow(event: RowUpdateEvent<Person>): void {
|
|
455
522
|
this.http.patch(`/api/people/${event.row.id}`, event.row).subscribe(() => {
|
|
456
|
-
this.
|
|
523
|
+
this.provider.control.indicate(event.originalIndex, '#2da44e', 1000);
|
|
524
|
+
this.provider.control.clearChangedCells(event.originalIndex);
|
|
457
525
|
});
|
|
458
526
|
}
|
|
459
527
|
```
|
|
@@ -461,6 +529,8 @@ saveRow(event: RowUpdateEvent<Person>): void {
|
|
|
461
529
|
The event fires with the latest complete row when inline navigation leaves that row, or when the
|
|
462
530
|
sidebar editor Save button is used. `cellEdit` and `recordEdit` remain available for every committed
|
|
463
531
|
field change. With `showChangedCellIndicator: true`, changed cells keep a corner marker until the
|
|
464
|
-
PATCH succeeds. Override `--agrid-color-cell-changed` to customize its color.
|
|
532
|
+
PATCH succeeds. Override `--agrid-color-cell-changed` to customize its color. Call
|
|
533
|
+
`control.indicate(index, color, durationMs)` to flash a complete row for transient server-side
|
|
534
|
+
feedback.
|
|
465
535
|
|
|
466
536
|
Full documentation and demos: https://thkl.github.io/agrid/
|