@nanahoshi/mona-ui 0.26.2 → 0.27.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/docs/auto-complete.md +1 -1
- package/docs/circular-progress-bar.md +38 -0
- package/docs/combo-box.md +1 -1
- package/docs/dropdown-list.md +1 -1
- package/docs/grid-columns.md +296 -0
- package/docs/grid-editing.md +575 -0
- package/docs/grid-grouping.md +238 -0
- package/docs/grid-rows.md +297 -0
- package/docs/grid-selection.md +196 -0
- package/docs/grid-server.md +569 -0
- package/docs/grid-sorting-filtering.md +544 -0
- package/docs/grid-state-export.md +422 -0
- package/docs/grid.md +170 -1717
- package/docs/multi-select.md +1 -1
- package/docs/tree-view.md +1 -1
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +38 -10
- package/llms.txt +12 -1
- package/package.json +1 -1
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +17 -3
package/docs/grid.md
CHANGED
|
@@ -1,38 +1,44 @@
|
|
|
1
|
-
# Grid
|
|
1
|
+
# Grid Overview
|
|
2
2
|
|
|
3
|
-
> Tabular data with paging,
|
|
3
|
+
> Tabular data in typed columns with paging, templates and a toolbar, extended by feature directives.
|
|
4
4
|
|
|
5
5
|
Entry point: `@nanahoshi/mona-ui/grid`
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
**Selectors:** `mona-grid`, `mona-grid-column`
|
|
8
8
|
|
|
9
|
-
`GridComponent`
|
|
9
|
+
`GridComponent` shows rows of data in typed columns, with a pager below them. Sorting, filtering, grouping, selection, editing, column and row features, server binding, virtualization, state and export are directives you add to the same `<mona-grid>` element, each described on its own page.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
This page covers the grid itself: its columns, cell formatting, templates, paging, the toolbar and keyboard navigation.
|
|
12
12
|
|
|
13
13
|
## Overview
|
|
14
14
|
|
|
15
|
-
The grid renders `data` as rows against
|
|
15
|
+
The grid renders `data` as rows against the `mona-grid-column` definitions projected into `<mona-grid>`. Paging is always on. Every other feature is opt-in through a directive on the same `mona-grid` element, such as `monaGridSortable` or `monaGridEditable`, and that directive also emits the feature's events. Columns are a flat list: there are no column groups or nested columns.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
| Feature | Directive on `<mona-grid>` | Page |
|
|
18
|
+
| :--- | :--- | :--- |
|
|
19
|
+
| Sorting, filtering | `monaGridSortable`, `monaGridFilterable` | [Sorting & Filtering](grid-sorting-filtering.md) |
|
|
20
|
+
| Grouping, aggregates | `monaGridGroupable`, column `aggregate` | [Grouping & Aggregates](grid-grouping.md) |
|
|
21
|
+
| Row selection | `monaGridSelectable` | [Selection](grid-selection.md) |
|
|
22
|
+
| Inline editing | `monaGridEditable`, `mona-grid-command-column` | [Editing](grid-editing.md) |
|
|
23
|
+
| Resizing, reordering, locking, hiding columns | `monaGridResizable`, `monaGridReorderable`, column `locked` | [Columns](grid-columns.md) |
|
|
24
|
+
| Detail rows, row reordering, row classes | `monaGridDetailTemplate`, `monaGridRowReorderable` | [Rows](grid-rows.md) |
|
|
25
|
+
| Server pages, virtual scrolling | `monaGridServerBinding`, `monaGridVirtualScroll` | [Server Binding & Virtualization](grid-server.md) |
|
|
26
|
+
| Saved state, CSV export | `monaGridStatePersistence`, `monaGridExport` | [State & Export](grid-state-export.md) |
|
|
18
27
|
|
|
19
28
|
**Use Grid when:**
|
|
20
29
|
|
|
21
|
-
- Data is naturally tabular
|
|
30
|
+
- Data is naturally tabular, with a fixed set of typed columns, and people need to page, sort, filter or edit it.
|
|
22
31
|
- Rows need per-cell or per-row editing backed by Angular Signal Forms.
|
|
23
32
|
|
|
24
|
-
**Use
|
|
33
|
+
**Use something else when:**
|
|
25
34
|
|
|
26
|
-
- Data is hierarchical and
|
|
27
|
-
|
|
28
|
-
**Use `ListView` instead when:**
|
|
29
|
-
|
|
30
|
-
- Rows are single-value items without a fixed set of typed columns.
|
|
35
|
+
- Data is hierarchical and people mostly expand and collapse nodes. Use [Tree View](tree-view.md).
|
|
36
|
+
- Rows are single-value items without columns. Use [List View](list-view.md).
|
|
31
37
|
|
|
32
38
|
## Import & Quick Start
|
|
33
39
|
|
|
34
40
|
```typescript
|
|
35
|
-
import {
|
|
41
|
+
import { GridColumnComponent, GridComponent } from "@nanahoshi/mona-ui/grid";
|
|
36
42
|
```
|
|
37
43
|
|
|
38
44
|
```typescript
|
|
@@ -43,30 +49,28 @@ protected readonly orders = signal([
|
|
|
43
49
|
```
|
|
44
50
|
|
|
45
51
|
```html
|
|
46
|
-
<mona-grid [data]="orders()" [pageSize]="10">
|
|
52
|
+
<mona-grid aria-label="Orders" rowKey="orderId" [data]="orders()" [pageSize]="10">
|
|
47
53
|
<mona-grid-column field="orderId" title="Order ID" type="number"></mona-grid-column>
|
|
48
54
|
<mona-grid-column field="shipName" title="Ship Name" type="string"></mona-grid-column>
|
|
49
55
|
<mona-grid-column field="freight" title="Freight" type="number"></mona-grid-column>
|
|
50
56
|
</mona-grid>
|
|
51
57
|
```
|
|
52
58
|
|
|
53
|
-
Without
|
|
59
|
+
Without a feature directive the grid above only pages. Give it an `aria-label`, and a height through `class` when it should scroll inside a fixed area.
|
|
54
60
|
|
|
55
61
|
## Anatomy
|
|
56
62
|
|
|
57
|
-
|
|
63
|
+
A column's `type` (`"string"`, `"number"`, `"date"` or `"boolean"`) decides how its cells are formatted, which filter operators it offers and which editor it uses. `field` names the property each row is read from, and `title` is the header text.
|
|
58
64
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
| `
|
|
64
|
-
| `
|
|
65
|
-
| `
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
68
|
-
| `GridNoDataTemplateDirective` | `ng-template[monaGridNoDataTemplate]` | `mona-grid` | None | The grid's default empty-state message |
|
|
69
|
-
| `GridToolbarTemplateDirective` | `ng-template[monaGridToolbarTemplate]` | `mona-grid` | `GridToolbarTemplateContext`: `addRowData`, `addRowVisible`, `cancelAdd()`, `cancelEdit()`, `dataState`, `editSession`, `saveAdd()`, `selectedKeys`, `startAdd()`; the same object is also `$implicit`. | No default — renders above the column headers |
|
|
65
|
+
The templates below are placed inside `<mona-grid-column>` or `<mona-grid>`. The other pages describe the ones that belong to a feature: [edit templates](grid-editing.md), [footer and group footer templates](grid-grouping.md) and [detail templates](grid-rows.md).
|
|
66
|
+
|
|
67
|
+
| Directive | Selector | Placed inside | Template context | Replaces |
|
|
68
|
+
| --- | --- | --- | --- | --- |
|
|
69
|
+
| `GridCellTemplateDirective` | `ng-template[monaGridCellTemplate]` | `mona-grid-column` or `mona-grid-command-column` | `{ $implicit: dataItem, column: string }` | The column's formatted cell text |
|
|
70
|
+
| `GridHeaderTemplateDirective` | `ng-template[monaGridHeaderTemplate]` | `mona-grid-column` | `{ $implicit: column, column: Column }` | The whole header text |
|
|
71
|
+
| `GridColumnTitleTemplateDirective` | `[monaGridColumnTitleTemplate]` | `mona-grid-column` | None | The header's title text, keeping its sort and filter buttons. Ignored when a header template is present. |
|
|
72
|
+
| `GridNoDataTemplateDirective` | `ng-template[monaGridNoDataTemplate]` | `mona-grid` | None | The grid's empty-state message |
|
|
73
|
+
| `GridToolbarTemplateDirective` | `ng-template[monaGridToolbarTemplate]` | `mona-grid` | `GridToolbarTemplateContext`: `addRowData`, `addRowVisible`, `cancelAdd()`, `cancelEdit()`, `dataState`, `editSession`, `saveAdd()`, `selectedKeys`, `startAdd()`; the same object is also `$implicit` | Nothing: it adds a toolbar above the column headers |
|
|
70
74
|
|
|
71
75
|
```html
|
|
72
76
|
<mona-grid [data]="orders()">
|
|
@@ -87,712 +91,170 @@ The cell template's `$implicit` is the row's item from `data`, the same object,
|
|
|
87
91
|
|
|
88
92
|
### Cell Formatting
|
|
89
93
|
|
|
90
|
-
Without a `format`, a `date` column shows the locale's numeric date (`03/15/2024` in en-US, `15.03.2024` in de-DE), and every other value shows as it is.
|
|
91
|
-
|
|
92
|
-
`format` takes one of two things:
|
|
94
|
+
Without a `format`, a `date` column shows the locale's numeric date (`03/15/2024` in en-US, `15.03.2024` in de-DE), and every other value shows as it is. `format` takes one of two things:
|
|
93
95
|
|
|
94
96
|
- A date format string, using Angular's `formatDate` patterns (`"yyyy-MM-dd"`, `"MMM d, y"`). It applies only to `type="date"` columns, where the filter menu and the filter row use it too, and it formats with the application's `LOCALE_ID`. Other columns ignore a string.
|
|
95
97
|
- A function `(value, row, column) => string`, for any column. What it returns replaces the cell text. `value` is the cell's value, `row` the row's data item, and `column` the `Column`.
|
|
96
98
|
|
|
97
|
-
|
|
98
|
-
<mona-grid-column field="orderDate" title="Ordered" type="date" format="MMM d, y"></mona-grid-column>
|
|
99
|
-
<mona-grid-column field="freight" title="Freight" type="number" [format]="formatCurrency"></mona-grid-column>
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
```typescript
|
|
103
|
-
readonly #currency = new Intl.NumberFormat("en-US", { currency: "USD", style: "currency" });
|
|
104
|
-
|
|
105
|
-
protected readonly formatCurrency = (value: number): string => this.#currency.format(value);
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
A formatter can be typed for the column's value, as above. There is no format string for numbers or currency: use a formatter function, or a `monaGridCellTemplate` with Angular's `currency` or `number` pipe. A cell template replaces the cell text, formatted or not. `format` only changes what the cell shows. Sorting, filtering, aggregates and CSV export use the raw value.
|
|
109
|
-
|
|
110
|
-
### Client Sorting, Filtering, and Paging
|
|
111
|
-
|
|
112
|
-
Without `monaGridServerBinding`, the grid sorts, filters, groups and pages `data` itself. Bind the whole data set to `data`; the grid never changes the array.
|
|
113
|
-
|
|
114
|
-
When `data` is replaced, the grid keeps its sort, filter and group descriptors and applies them to the new rows. It also keeps the current page, unless the new rows no longer reach it: then it moves to the last page and reports it through `pageChange` and `skipChange`. A user's sort or filter goes back to the first page, with or without server binding, and reports it through `pageChange` and `skipChange`. A `sort` or `filter` set from code keeps the current page.
|
|
115
|
-
|
|
116
|
-
To filter from controls outside the grid, either bind a filtered `computed` to `data`:
|
|
117
|
-
|
|
118
|
-
```typescript
|
|
119
|
-
protected readonly search = signal("");
|
|
120
|
-
protected readonly shownOrders = computed(() => {
|
|
121
|
-
const text = this.search().toLowerCase();
|
|
122
|
-
return this.orders().filter(order => order.shipName.toLowerCase().includes(text));
|
|
123
|
-
});
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
```html
|
|
127
|
-
<mona-text-box aria-label="Search orders" [(value)]="search"></mona-text-box>
|
|
128
|
-
<mona-grid [data]="shownOrders()">...</mona-grid>
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
or set the `filter` model of `monaGridFilterable`, which also shows the condition in that column's filter UI:
|
|
132
|
-
|
|
133
|
-
```typescript
|
|
134
|
-
protected readonly filter = signal<CompositeFilterDescriptor[]>([]);
|
|
135
|
-
|
|
136
|
-
protected onShipChange(shipName: string | null): void {
|
|
137
|
-
this.filter.set(
|
|
138
|
-
shipName ? [{ logic: "and", filters: [{ field: "shipName", operator: "eq", value: shipName }] }] : []
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
```html
|
|
144
|
-
<mona-grid [data]="orders()" monaGridFilterable [(filter)]="filter">...</mona-grid>
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
The `filter` model needs `monaGridFilterable` on the grid. With `[monaGridFilterable]="{ enabled: false }"` the filter UI is hidden, but a `filter` set from code still applies. `CompositeFilterDescriptor` comes from `@nanahoshi/mona-ui/query`.
|
|
148
|
-
|
|
149
|
-
### Server Paging, Sorting, and Filtering
|
|
150
|
-
|
|
151
|
-
Import `GridServerBindingDirective` and `GridDataState` from `@nanahoshi/mona-ui/grid`. Apply `monaGridServerBinding` when `data` contains only the page returned by your server. Bind the server's matching record count to `total`, the page's zero-based offset to `skip`, and its size to the Grid's existing `pageSize` input.
|
|
152
|
-
|
|
153
|
-
`server-example.component.ts`
|
|
99
|
+
`cell-formatting-example.component.ts`
|
|
154
100
|
|
|
155
101
|
```typescript
|
|
156
|
-
import { Component
|
|
157
|
-
import {
|
|
158
|
-
|
|
159
|
-
GridComponent,
|
|
160
|
-
type GridDataState,
|
|
161
|
-
GridFilterableDirective,
|
|
162
|
-
GridServerBindingDirective,
|
|
163
|
-
GridSortableDirective
|
|
164
|
-
} from "@nanahoshi/mona-ui/grid";
|
|
165
|
-
import { type CompositeFilterDescriptor, Query, type SortDescriptor } from "@nanahoshi/mona-ui/query";
|
|
166
|
-
|
|
167
|
-
interface Customer {
|
|
168
|
-
id: number;
|
|
169
|
-
name: string;
|
|
170
|
-
orders: number;
|
|
171
|
-
}
|
|
102
|
+
import { Component } from "@angular/core";
|
|
103
|
+
import { ChipComponent } from "@nanahoshi/mona-ui/chip";
|
|
104
|
+
import { GridCellTemplateDirective, GridColumnComponent, GridComponent } from "@nanahoshi/mona-ui/grid";
|
|
172
105
|
|
|
173
|
-
interface
|
|
174
|
-
|
|
175
|
-
|
|
106
|
+
interface Order {
|
|
107
|
+
customer: string;
|
|
108
|
+
freight: number;
|
|
109
|
+
orderDate: Date;
|
|
110
|
+
orderId: number;
|
|
111
|
+
shipped: boolean;
|
|
176
112
|
}
|
|
177
113
|
|
|
178
|
-
const
|
|
179
|
-
id: index + 1,
|
|
180
|
-
name: `Customer ${String(index + 1).padStart(2, "0")}`,
|
|
181
|
-
orders: (index * 37) % 50
|
|
182
|
-
}));
|
|
183
|
-
|
|
184
|
-
/** Stands in for a server: it filters and sorts every record, then returns one page after a short wait. */
|
|
185
|
-
async function fetchCustomers(state: GridDataState): Promise<CustomerPage> {
|
|
186
|
-
await new Promise<void>(resolve => setTimeout(resolve, 400));
|
|
187
|
-
let query = Query.from(CUSTOMERS);
|
|
188
|
-
for (const filter of state.filter) {
|
|
189
|
-
query = query.filter(filter);
|
|
190
|
-
}
|
|
191
|
-
const rows = query.sort(state.sort).run();
|
|
192
|
-
return { data: rows.slice(state.skip, state.skip + state.take), total: rows.length };
|
|
193
|
-
}
|
|
114
|
+
const currency = new Intl.NumberFormat("en-US", { currency: "USD", style: "currency" });
|
|
194
115
|
|
|
195
116
|
@Component({
|
|
196
|
-
selector: "app-grid-
|
|
197
|
-
imports: [
|
|
198
|
-
|
|
199
|
-
GridComponent,
|
|
200
|
-
GridFilterableDirective,
|
|
201
|
-
GridServerBindingDirective,
|
|
202
|
-
GridSortableDirective
|
|
203
|
-
],
|
|
204
|
-
templateUrl: "./server-example.component.html"
|
|
117
|
+
selector: "app-grid-cell-formatting-example",
|
|
118
|
+
imports: [ChipComponent, GridCellTemplateDirective, GridColumnComponent, GridComponent],
|
|
119
|
+
templateUrl: "./cell-formatting-example.component.html"
|
|
205
120
|
})
|
|
206
|
-
export class
|
|
207
|
-
readonly
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
`server-example.component.html`
|
|
121
|
+
export class GridCellFormattingExampleComponent {
|
|
122
|
+
protected readonly orders: Order[] = [
|
|
123
|
+
{
|
|
124
|
+
orderId: 10248,
|
|
125
|
+
customer: "Vins et alcools Chevalier",
|
|
126
|
+
freight: 32.38,
|
|
127
|
+
orderDate: new Date(2026, 6, 4),
|
|
128
|
+
shipped: true
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
orderId: 10249,
|
|
132
|
+
customer: "Toms Spezialitäten",
|
|
133
|
+
freight: 11.61,
|
|
134
|
+
orderDate: new Date(2026, 6, 5),
|
|
135
|
+
shipped: true
|
|
136
|
+
},
|
|
137
|
+
{ orderId: 10250, customer: "Hanari Carnes", freight: 65.83, orderDate: new Date(2026, 6, 8), shipped: false },
|
|
138
|
+
{
|
|
139
|
+
orderId: 10251,
|
|
140
|
+
customer: "Victuailles en stock",
|
|
141
|
+
freight: 41.34,
|
|
142
|
+
orderDate: new Date(2026, 6, 8),
|
|
143
|
+
shipped: true
|
|
144
|
+
},
|
|
145
|
+
{ orderId: 10252, customer: "Suprêmes délices", freight: 51.3, orderDate: new Date(2026, 6, 9), shipped: false }
|
|
146
|
+
];
|
|
239
147
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
class="h-96"
|
|
244
|
-
monaGridServerBinding
|
|
245
|
-
monaGridSortable
|
|
246
|
-
[data]="result().data"
|
|
247
|
-
[loading]="loading()"
|
|
248
|
-
[monaGridFilterable]="{ enabled: true, type: 'row' }"
|
|
249
|
-
[pageSize]="state().take"
|
|
250
|
-
[skip]="state().skip"
|
|
251
|
-
[total]="result().total"
|
|
252
|
-
[(filter)]="filter"
|
|
253
|
-
[(sort)]="sort"
|
|
254
|
-
(dataStateChange)="load($event)">
|
|
255
|
-
<mona-grid-column field="id" title="ID" type="number" [width]="90" />
|
|
256
|
-
<mona-grid-column field="name" title="Customer" />
|
|
257
|
-
<mona-grid-column field="orders" title="Orders" type="number" />
|
|
258
|
-
</mona-grid>
|
|
148
|
+
/** Typed for the column's value. Sorting, filtering and export still use the number. */
|
|
149
|
+
protected readonly formatFreight = (value: number): string => currency.format(value);
|
|
150
|
+
}
|
|
259
151
|
```
|
|
260
152
|
|
|
261
|
-
`
|
|
262
|
-
|
|
263
|
-
The application owns HTTP requests, errors, and stale-response handling. The example ignores a response that arrives after a newer request started. `SortDescriptor` and `CompositeFilterDescriptor` come from `@nanahoshi/mona-ui/query`; the Grid has no endpoint or transport dependency.
|
|
264
|
-
|
|
265
|
-
The server must apply the descriptors to the whole matching dataset before paging. The Grid preserves returned row order and displays every supplied row, even when `skip` is nonzero. For example, ten supplied rows at `skip: 40`, `pageSize: 10`, and `total: 137` show page five and retain all ten rows.
|
|
266
|
-
|
|
267
|
-
While `loading` is true, the body shows a localized loading indicator, preserves existing rows, and suppresses the ordinary empty state. The grid element exposes `aria-busy`; the header and pager remain available for another request. Set `loading` back to false on both success and error.
|
|
268
|
-
|
|
269
|
-
Server mode has these boundaries:
|
|
270
|
-
|
|
271
|
-
- Grouping and aggregates operate on the loaded page. Each group direction controls the loaded page's group header order while preserving server row order within each leaf group. `group` is not part of `GridDataState`, and no remote aggregate protocol is provided.
|
|
272
|
-
- CSV export contains loaded data only. Fetch a full export through your application when needed.
|
|
273
|
-
- Select-all selects loaded rows only. Use `selectBy` and controlled `selectedKeys` to manage stable keys across pages; this does not select unloaded records.
|
|
274
|
-
- Editing events continue to describe loaded rows; the application saves changes to its server.
|
|
275
|
-
- Row reordering is disabled with an accessible, localized server-binding reason.
|
|
276
|
-
- `monaGridServerBinding` and enabled `monaGridVirtualScroll` cannot be combined; enabling both throws an error. This directive provides page-based loading rather than remote virtual scrolling.
|
|
277
|
-
- State persistence restores sort, filter, and page size (unless `persistPageSize` is `false`), then emits one consolidated refresh at `skip: 0`. The offset is not persisted. When providing a saved initial state, use that refresh to load the restored query instead of starting a competing initial request.
|
|
278
|
-
|
|
279
|
-
### Row Sizing
|
|
280
|
-
|
|
281
|
-
Ordinary rows fit their cell templates and editors. Short text stays compact with a 36px minimum under the default spacing scale, and default cell text still truncates horizontally. Avatars, stacked labels, and custom editors can make a row taller without setting a row height. Selection controls, detail toggles, command buttons, and locked cells align within the resulting row.
|
|
153
|
+
`cell-formatting-example.component.html`
|
|
282
154
|
|
|
283
155
|
```html
|
|
284
|
-
<mona-grid [data]="
|
|
285
|
-
<mona-grid-column field="
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
borderRadius="50%" />
|
|
295
|
-
<div>
|
|
296
|
-
<div>{{ user.name }}</div>
|
|
297
|
-
<div>{{ user.email }}</div>
|
|
298
|
-
</div>
|
|
299
|
-
</div>
|
|
156
|
+
<mona-grid aria-label="Orders" rowKey="orderId" [data]="orders" [pageSize]="5">
|
|
157
|
+
<mona-grid-column field="orderId" title="Order" type="number" [width]="90" />
|
|
158
|
+
<mona-grid-column field="customer" title="Customer" />
|
|
159
|
+
<mona-grid-column field="orderDate" format="MMM d, y" title="Ordered" type="date" />
|
|
160
|
+
<mona-grid-column field="freight" title="Freight" type="number" [format]="formatFreight" />
|
|
161
|
+
<mona-grid-column field="shipped" title="Status" type="boolean">
|
|
162
|
+
<ng-template monaGridCellTemplate let-order>
|
|
163
|
+
<mona-chip size="small" [look]="order.shipped ? 'success' : 'warning'">
|
|
164
|
+
{{ order.shipped ? "Shipped" : "Waiting" }}
|
|
165
|
+
</mona-chip>
|
|
300
166
|
</ng-template>
|
|
301
167
|
</mona-grid-column>
|
|
302
168
|
</mona-grid>
|
|
303
169
|
```
|
|
304
170
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
Virtualization uses a fixed height in pixels for every rendered item and the scrolling calculations. The default is **36px**; set a larger height for templates, such as `[monaGridVirtualScroll]="{ height: 64 }"`. Oversized virtual templates are clipped to that height. Expanded detail rows add a separate row and are not supported by this fixed-item geometry; use ordinary rows for expanded details. Variable-height virtualization is not provided.
|
|
171
|
+
A formatter can be typed for the column's value, as `formatFreight` is. There is no format string for numbers or currency: use a formatter function, or a `monaGridCellTemplate` with Angular's `currency` or `number` pipe. A cell template replaces the cell text, formatted or not. `format` only changes what the cell shows. Sorting, filtering, aggregates and CSV export use the raw value.
|
|
308
172
|
|
|
309
173
|
### Paging
|
|
310
174
|
|
|
311
|
-
`pageSize` and `pageSizeValues` control the built-in pager; `[(pageSize)]` and `[(skip)]` are two-way, and `pageChange` reports the user's page and page-size changes (not values set from code). A new page size keeps the first row of the current page in view.
|
|
175
|
+
`pageSize` and `pageSizeValues` control the built-in pager; `[(pageSize)]` and `[(skip)]` are two-way, and `pageChange` reports the user's page and page-size changes (not values set from code). A new page size keeps the first row of the current page in view. The pager shows a page-size picker only when `pageSizeValues` lists some sizes; it's empty by default. `responsivePager` collapses the pager into a dropdown when the grid narrows.
|
|
312
176
|
|
|
313
177
|
```html
|
|
314
178
|
<mona-grid [data]="orders()" [pageSize]="10" [pageSizeValues]="[10, 20, 30]" [responsivePager]="true"></mona-grid>
|
|
315
179
|
```
|
|
316
180
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
`monaGridSortable` enables column-header sorting; `sort` is a two-way bindable model of the current sort descriptors, and a restored grid state updates it. A `SortDescriptor` comes from `@nanahoshi/mona-ui/query`:
|
|
320
|
-
|
|
321
|
-
```typescript
|
|
322
|
-
import type { SortDescriptor } from "@nanahoshi/mona-ui/query";
|
|
323
|
-
|
|
324
|
-
interface SortDescriptor<TValue = unknown> {
|
|
325
|
-
dir: "asc" | "desc";
|
|
326
|
-
field: string;
|
|
327
|
-
/** Compares two values of `field`; `dir: "desc"` reverses the result. */
|
|
328
|
-
sort?(left: TValue, right: TValue): number;
|
|
329
|
-
}
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
```typescript
|
|
333
|
-
protected readonly sort = signal<SortDescriptor[]>([{ dir: "desc", field: "orderDate" }]);
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
```html
|
|
337
|
-
<mona-grid [data]="orders()" monaGridSortable [(sort)]="sort">...</mona-grid>
|
|
338
|
-
```
|
|
339
|
-
|
|
340
|
-
Descriptors are kept even when no column shows their field (a column added later shows the sort), and a repeated field keeps its last descriptor. A column's `sortComparator`, or the descriptor's own `sort` function, is kept when the user clicks the header.
|
|
341
|
-
|
|
342
|
-
`sorting-filtering-example.component.ts`
|
|
343
|
-
|
|
344
|
-
```typescript
|
|
345
|
-
import { Component, signal } from "@angular/core";
|
|
346
|
-
import {
|
|
347
|
-
GridColumnComponent,
|
|
348
|
-
GridComponent,
|
|
349
|
-
GridFilterableDirective,
|
|
350
|
-
GridSortableDirective
|
|
351
|
-
} from "@nanahoshi/mona-ui/grid";
|
|
352
|
-
import type { CompositeFilterDescriptor, SortDescriptor } from "@nanahoshi/mona-ui/query";
|
|
353
|
-
|
|
354
|
-
@Component({
|
|
355
|
-
selector: "app-grid-sorting-filtering-example",
|
|
356
|
-
imports: [GridColumnComponent, GridComponent, GridFilterableDirective, GridSortableDirective],
|
|
357
|
-
templateUrl: "./sorting-filtering-example.component.html"
|
|
358
|
-
})
|
|
359
|
-
export class GridSortingFilteringExampleComponent {
|
|
360
|
-
protected readonly filter = signal<CompositeFilterDescriptor[]>([]);
|
|
361
|
-
protected readonly orders = [
|
|
362
|
-
{ id: 10248, customer: "Vins et alcools", shippedOn: new Date(2026, 6, 16), freight: 32.38, paid: true },
|
|
363
|
-
{ id: 10249, customer: "Toms Spezialitäten", shippedOn: new Date(2026, 6, 10), freight: 11.61, paid: true },
|
|
364
|
-
{ id: 10250, customer: "Hanari Carnes", shippedOn: new Date(2026, 6, 12), freight: 65.83, paid: false },
|
|
365
|
-
{ id: 10251, customer: "Victuailles en stock", shippedOn: new Date(2026, 6, 15), freight: 41.34, paid: true },
|
|
366
|
-
{ id: 10252, customer: "Suprêmes délices", shippedOn: new Date(2026, 6, 11), freight: 51.3, paid: false },
|
|
367
|
-
{ id: 10253, customer: "Hanari Carnes", shippedOn: new Date(2026, 6, 16), freight: 58.17, paid: true },
|
|
368
|
-
{ id: 10254, customer: "Chop-suey Chinese", shippedOn: new Date(2026, 6, 23), freight: 22.98, paid: false },
|
|
369
|
-
{ id: 10255, customer: "Richter Supermarkt", shippedOn: new Date(2026, 6, 15), freight: 148.33, paid: true }
|
|
370
|
-
];
|
|
371
|
-
protected readonly sort = signal<SortDescriptor[]>([{ field: "freight", dir: "desc" }]);
|
|
372
|
-
}
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
`sorting-filtering-example.component.html`
|
|
376
|
-
|
|
377
|
-
```html
|
|
378
|
-
<mona-grid
|
|
379
|
-
aria-label="Orders"
|
|
380
|
-
[data]="orders"
|
|
381
|
-
[monaGridFilterable]="{ enabled: true, type: 'menu, row' }"
|
|
382
|
-
[monaGridSortable]="{ mode: 'multiple', allowUnsort: true }"
|
|
383
|
-
[pageSize]="5"
|
|
384
|
-
[(filter)]="filter"
|
|
385
|
-
[(sort)]="sort">
|
|
386
|
-
<mona-grid-column field="id" title="Order" type="number" [sortable]="false" [width]="100" />
|
|
387
|
-
<mona-grid-column field="customer" title="Customer" />
|
|
388
|
-
<mona-grid-column field="shippedOn" title="Shipped" type="date" />
|
|
389
|
-
<mona-grid-column field="freight" title="Freight" type="number" />
|
|
390
|
-
<mona-grid-column field="paid" title="Paid" type="boolean" />
|
|
391
|
-
</mona-grid>
|
|
392
|
-
```
|
|
393
|
-
|
|
394
|
-
Pass an object to `monaGridSortable` to configure sort mode, unsorting, or index display, as the example does with `{ mode: 'multiple', allowUnsort: true }`.
|
|
395
|
-
|
|
396
|
-
In multiple mode, sorted headers show their one-based priority next to the direction icon by default: the first sorted column is `1`, the next is `2`. Changing direction retains priority; unsorting a column renumbers the remaining columns. Set `showIndices: false` to hide the numbers. Single mode shows only the direction icon.
|
|
397
|
-
|
|
398
|
-
Set `[sortable]="false"` on a column to disable sorting through its header. Columns default to `sortable: true`, and grid-level sorting must also be enabled. This setting controls header interaction; existing or externally supplied `sort` descriptors remain applied. The example turns it off for the Order column.
|
|
399
|
-
|
|
400
|
-
### Filtering
|
|
401
|
-
|
|
402
|
-
`monaGridFilterable` renders filter UI either in the column header menu, a dedicated filter row, or both, per `type`. `filter` is a two-way bindable model of the applied `CompositeFilterDescriptor[]`, applied before the first render. Conditions on one field become that column's filter, and an `and` across fields is split per column; filters on the same field are combined with `and`. Filters that span columns (an `or` of two fields) are still applied, reported and sent to the server, without marking a column. Conditions with an unknown operator are ignored.
|
|
403
|
-
|
|
404
|
-
The [sorting example](#sorting) shows both the header menu and the filter row.
|
|
405
|
-
|
|
406
|
-
The header menu is a dialog named after its column (`filterByColumn`). It opens at the column type's first operator, keeps focus inside until it closes, and returns focus to its funnel button. `Enter` in a value applies the filter, and text that is only spaces is no value; text is trimmed before it is applied. A date column's menu and filter row use the column's string `format`, or the locale's date format without one. While a column is filtered, its funnel shows a dot as well as a colour, and its name says so (`filterByColumnFiltered`).
|
|
407
|
-
|
|
408
|
-
In the filter row, typing filters after a 300 ms pause; choosing an operator, picking a date or a Boolean value, and `Clear` filter at once and drop typing that has not filtered yet. An operator chosen without a value stays chosen until there is one. A cell follows only its own column's filter, and its own filter coming back does not overwrite newer typing. Its inputs are named `"Filter by {column}"`, its operator button `"Filter operator for {column}: {operator}"` (`filterOperator`), and its clear button `"Clear filter for {column}"` (`clearFilter`).
|
|
409
|
-
|
|
410
|
-
### Grouping
|
|
411
|
-
|
|
412
|
-
`monaGridGroupable` lets the consumer drag a column header into the group panel rendered above the grid. `group` is a two-way bindable model of the group descriptors: `groupChange` emits once for each user change (grouping, ungrouping, reordering or re-sorting groups) and after a state is restored, never for a value set from code. `null`, `undefined` and empty text form one group; `1` and `"1"` are different groups; dates group by their time.
|
|
413
|
-
|
|
414
|
-
```html
|
|
415
|
-
<mona-grid
|
|
416
|
-
[data]="orders()"
|
|
417
|
-
[monaGridGroupable]="{ enabled: true, showFooter: true }"
|
|
418
|
-
[group]="group()"
|
|
419
|
-
(groupChange)="group.set($event)">
|
|
420
|
-
</mona-grid>
|
|
421
|
-
```
|
|
422
|
-
|
|
423
|
-
### Row Selection
|
|
424
|
-
|
|
425
|
-
`monaGridSelectable` enables single or multiple row selection. `selectedKeys` binds the currently selected keys; `selectBy` (a field name or a function) chooses what identifies a row. Without `selectBy`, rows are selected by the grid's `rowKey` value, so the selection survives a refetch; without either, by the data item. `selectedKeysChange` reports user changes only.
|
|
426
|
-
|
|
427
|
-
`selection-example.component.ts`
|
|
428
|
-
|
|
429
|
-
```typescript
|
|
430
|
-
import { Component, signal } from "@angular/core";
|
|
431
|
-
import { GridColumnComponent, GridComponent, GridSelectableDirective } from "@nanahoshi/mona-ui/grid";
|
|
432
|
-
|
|
433
|
-
@Component({
|
|
434
|
-
selector: "app-grid-selection-example",
|
|
435
|
-
imports: [GridColumnComponent, GridComponent, GridSelectableDirective],
|
|
436
|
-
templateUrl: "./selection-example.component.html"
|
|
437
|
-
})
|
|
438
|
-
export class GridSelectionExampleComponent {
|
|
439
|
-
protected readonly members = [
|
|
440
|
-
{ id: 1, name: "Amara Okafor", role: "Designer", location: "Lagos" },
|
|
441
|
-
{ id: 2, name: "Lukas Weber", role: "Engineer", location: "Berlin" },
|
|
442
|
-
{ id: 3, name: "Mei Tanaka", role: "Engineer", location: "Osaka" },
|
|
443
|
-
{ id: 4, name: "Diego Ramos", role: "Product manager", location: "Lima" },
|
|
444
|
-
{ id: 5, name: "Sofia Rossi", role: "Researcher", location: "Turin" },
|
|
445
|
-
{ id: 6, name: "Noah Clarke", role: "Engineer", location: "Toronto" }
|
|
446
|
-
];
|
|
447
|
-
protected readonly selectedIds = signal<number[]>([2]);
|
|
448
|
-
|
|
449
|
-
/** Names each row's checkbox after the person, instead of "Select row 3". */
|
|
450
|
-
protected readonly rowLabel = (row: Record<PropertyKey, unknown>): string => `Select ${String(row["name"])}`;
|
|
451
|
-
}
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
`selection-example.component.html`
|
|
455
|
-
|
|
456
|
-
```html
|
|
457
|
-
<div class="flex flex-col gap-2">
|
|
458
|
-
<mona-grid
|
|
459
|
-
aria-label="Team members"
|
|
460
|
-
rowKey="id"
|
|
461
|
-
[data]="members"
|
|
462
|
-
[monaGridSelectable]="{ mode: 'multiple', showCheckboxes: true, rowAriaLabel: rowLabel }"
|
|
463
|
-
[pageSize]="5"
|
|
464
|
-
[(selectedKeys)]="selectedIds">
|
|
465
|
-
<mona-grid-column field="name" title="Name" />
|
|
466
|
-
<mona-grid-column field="role" title="Role" />
|
|
467
|
-
<mona-grid-column field="location" title="Location" />
|
|
468
|
-
</mona-grid>
|
|
469
|
-
<span aria-live="polite" class="text-sm">{{ selectedIds().length }} selected</span>
|
|
470
|
-
</div>
|
|
471
|
-
```
|
|
472
|
-
|
|
473
|
-
Set `showCheckboxes: true` to render a built-in checkbox selection column. The column is fixed at the left of the grid, is locked while horizontally scrolling, and never participates in sorting, filtering, grouping, resizing, reordering, or the column chooser. `rowAriaLabel` names each checkbox after its row.
|
|
474
|
-
|
|
475
|
-
Options:
|
|
476
|
-
|
|
477
|
-
- `mode`: `"single"` (default) or `"multiple"`.
|
|
478
|
-
- `showCheckboxes`: display the built-in checkbox selection column (default `false`).
|
|
479
|
-
- `showSelectAll`: display the select-all checkbox in the selection column header (default `true`, multiple mode only).
|
|
480
|
-
- `selectAllScope`: which rows the header checkbox affects — `"page"` (default) selects only rows on the current page; `"view"` selects every row in the current filtered and sorted view. Virtual scrolling has no logical pages, so `"page"` resolves to the full current view there. The header checkbox is checked when every row in scope is selected and indeterminate when only some are.
|
|
481
|
-
- `selectOnRowClick`: whether clicking a row changes its selection (default `false`, so clicking a row's content — a link, a button, an editable cell — never silently discards the current selection). Set to `true` to also select rows via a plain click, in addition to checkboxes or application code.
|
|
482
|
-
|
|
483
|
-
Selection state always lives in `selectedKeys`. Row clicks and checkbox clicks mutate the same state. When `selectOnRowClick` is enabled: in single mode, clicking a row replaces the previous selection; in multiple mode, a plain click replaces the selection with just that row, Ctrl/Cmd-click toggles a single row without disturbing the rest, and Shift-click range-selects from the last clicked row. Checkbox clicks always toggle the clicked row in place, regardless of `selectOnRowClick`. Bulk (de)selection preserves keys that are outside the current scope. Provide a stable `selectBy` when selection must survive data reloads, pagination, or remote data fetching.
|
|
484
|
-
|
|
485
|
-
### Virtualization
|
|
486
|
-
|
|
487
|
-
`monaGridVirtualScroll` renders only the rows currently in view, for large data sets. `scrollEndThreshold` (rows from the bottom) controls when `scrollEnd` fires, useful for loading more data incrementally.
|
|
488
|
-
|
|
489
|
-
```html
|
|
490
|
-
<mona-grid
|
|
491
|
-
[data]="orders()"
|
|
492
|
-
[monaGridVirtualScroll]="{ height: 36 }"
|
|
493
|
-
[scrollEndThreshold]="5"
|
|
494
|
-
(scrollEnd)="loadMoreOrders()">
|
|
495
|
-
</mona-grid>
|
|
496
|
-
```
|
|
497
|
-
|
|
498
|
-
While virtual scrolling is on, the grid shows no pager and no aggregate footer, and rejects detail rows and server binding.
|
|
181
|
+
When the rows shrink below the current page (new data, a removed row, a filter), the grid moves to the last page and reports it through `pageChange` and `skipChange`.
|
|
499
182
|
|
|
500
|
-
|
|
183
|
+
### Changing the Data
|
|
501
184
|
|
|
502
|
-
|
|
185
|
+
Bind the whole data set to `data`; the grid never changes the array. When `data` is replaced, the grid keeps its sort, filter and group descriptors and applies them to the new rows. It also keeps the current page, unless the new rows no longer reach it.
|
|
503
186
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
`editing-example.component.ts`
|
|
507
|
-
|
|
508
|
-
```typescript
|
|
509
|
-
import { Component, signal } from "@angular/core";
|
|
510
|
-
import { type SchemaPathTree, validate } from "@angular/forms/signals";
|
|
511
|
-
import { ButtonDirective } from "@nanahoshi/mona-ui/button";
|
|
512
|
-
import {
|
|
513
|
-
GridAddCommandDirective,
|
|
514
|
-
GridColumnComponent,
|
|
515
|
-
GridCommandColumnComponent,
|
|
516
|
-
GridComponent,
|
|
517
|
-
GridEditableDirective,
|
|
518
|
-
type GridEditSchemaFactory,
|
|
519
|
-
type GridRemoveEvent,
|
|
520
|
-
type GridSaveEvent,
|
|
521
|
-
GridToolbarTemplateDirective
|
|
522
|
-
} from "@nanahoshi/mona-ui/grid";
|
|
523
|
-
|
|
524
|
-
interface Product {
|
|
525
|
-
id: number;
|
|
526
|
-
inStock: boolean;
|
|
527
|
-
name: string;
|
|
528
|
-
price: number;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
/** Validates the row being edited. A failed save keeps the editor open and announces the error. */
|
|
532
|
-
const productSchema: GridEditSchemaFactory<Product> =
|
|
533
|
-
() =>
|
|
534
|
-
(row: SchemaPathTree<Product>): void => {
|
|
535
|
-
validate(row.name, ({ value }) =>
|
|
536
|
-
value().trim() !== "" ? undefined : { kind: "required", message: "Enter a name." }
|
|
537
|
-
);
|
|
538
|
-
validate(row.price, ({ value }) =>
|
|
539
|
-
value() >= 0 ? undefined : { kind: "min", message: "The price can't be negative." }
|
|
540
|
-
);
|
|
541
|
-
};
|
|
542
|
-
|
|
543
|
-
@Component({
|
|
544
|
-
selector: "app-grid-editing-example",
|
|
545
|
-
imports: [
|
|
546
|
-
ButtonDirective,
|
|
547
|
-
GridAddCommandDirective,
|
|
548
|
-
GridColumnComponent,
|
|
549
|
-
GridCommandColumnComponent,
|
|
550
|
-
GridComponent,
|
|
551
|
-
GridEditableDirective,
|
|
552
|
-
GridToolbarTemplateDirective
|
|
553
|
-
],
|
|
554
|
-
templateUrl: "./editing-example.component.html"
|
|
555
|
-
})
|
|
556
|
-
export class GridEditingExampleComponent {
|
|
557
|
-
#nextId = 4;
|
|
558
|
-
protected readonly productSchema = productSchema;
|
|
559
|
-
protected readonly products = signal<Product[]>([
|
|
560
|
-
{ id: 1, name: "Desk lamp", price: 39, inStock: true },
|
|
561
|
-
{ id: 2, name: "Notebook", price: 6.5, inStock: true },
|
|
562
|
-
{ id: 3, name: "Standing desk", price: 420, inStock: false }
|
|
563
|
-
]);
|
|
564
|
-
protected readonly createProduct = (): Product => ({
|
|
565
|
-
id: this.#nextId++,
|
|
566
|
-
name: "",
|
|
567
|
-
price: 0,
|
|
568
|
-
inStock: true
|
|
569
|
-
});
|
|
570
|
-
|
|
571
|
-
protected onRemove(event: GridRemoveEvent): void {
|
|
572
|
-
this.products.update(products => products.filter(product => product.id !== event.key));
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
/** The grid never changes `data` itself: write the saved row back. */
|
|
576
|
-
protected onSave(event: GridSaveEvent<Product>): void {
|
|
577
|
-
const saved = event.rowData;
|
|
578
|
-
const id = event.originalRowData?.id;
|
|
579
|
-
if (event.operation === "create") {
|
|
580
|
-
this.products.update(products => [...products, saved]);
|
|
581
|
-
} else {
|
|
582
|
-
this.products.update(products => products.map(product => (product.id === id ? saved : product)));
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
```
|
|
587
|
-
|
|
588
|
-
`editing-example.component.html`
|
|
589
|
-
|
|
590
|
-
```html
|
|
591
|
-
<mona-grid
|
|
592
|
-
aria-label="Products"
|
|
593
|
-
rowKey="id"
|
|
594
|
-
[data]="products()"
|
|
595
|
-
[monaGridEditable]="{ mode: 'row', schema: productSchema }"
|
|
596
|
-
[newRowFactory]="createProduct"
|
|
597
|
-
[pageSize]="5"
|
|
598
|
-
(remove)="onRemove($event)"
|
|
599
|
-
(save)="onSave($event)">
|
|
600
|
-
<ng-template let-addRowVisible="addRowVisible" monaGridToolbarTemplate>
|
|
601
|
-
<button monaButton monaGridAddCommand type="button" [disabled]="addRowVisible">Add product</button>
|
|
602
|
-
</ng-template>
|
|
603
|
-
<mona-grid-column field="name" title="Name" />
|
|
604
|
-
<mona-grid-column field="price" title="Price" type="number" />
|
|
605
|
-
<mona-grid-column field="inStock" title="In stock" type="boolean" />
|
|
606
|
-
<mona-grid-command-column [width]="120" />
|
|
607
|
-
</mona-grid>
|
|
608
|
-
```
|
|
609
|
-
|
|
610
|
-
A `mona-grid-command-column` without content shows the built-in Edit and Remove buttons, and `monaGridAddCommand` on a toolbar button opens the add row.
|
|
611
|
-
|
|
612
|
-
Each column's `type` (`"string"`, `"number"`, `"date"`, or `"boolean"`) selects the built-in editor rendered for that cell — a text box, numeric text box, date picker, or checkbox, respectively — unless the column provides its own `monaGridEditTemplate`. Every column is editable except the one whose `field` is the `rowKey`; set `[editable]` on a `mona-grid-column` to change that, for example `[editable]="true"` to type the key of a new row.
|
|
613
|
-
|
|
614
|
-
Each editor is named after its column title. Number text is read in the grid's locale (`1.234,5` in de-DE); a date picked in the calendar keeps the time of day the value had. A row without a value for an editable column starts that editor at `null`, and the field is left out of the saved row again if it stays empty.
|
|
615
|
-
|
|
616
|
-
**Keys.** In cell mode, `Enter` or `F2` starts editing, `Enter` or leaving the editor saves, `Escape` cancels and `Tab` moves to the next editable cell. In row mode, `Enter` or `F2` on any cell edits the row from that cell's editor; `Tab` and `Shift+Tab` move between the row's editors and its Save and Cancel buttons, `Enter` saves the row (after validation) and `Escape` cancels it. The add row works the same way. `Enter` and `Escape` are left to an input method while it composes text. After Save, Cancel or Remove, focus moves to the row's cell, or to the nearest cell when the row is gone.
|
|
617
|
-
|
|
618
|
-
**Events.** `save` is the one to persist from: its `rowData` holds the edited values and `originalRowData` the row as it was. `cellEdit` comes first in cell mode, with the field's old and new value; its `rowData` is the row as it was. Neither fires when nothing changed. To save on a server, prevent `save` to keep the editor open, then call `endEdit()` on the `GridEditableDirective` (from `viewChild(GridEditableDirective)`) when the request succeeds. `cancel` carries a `reason`: `"command"`, `"escape"`, `"switch"` (another edit or the add row started) or `"removed"` (the row left the data or the view, which can't be prevented). When `data` is replaced during an edit, the edit moves to the new item with the same `rowKey` and keeps what was typed. `remove` carries the row's `key` and its `index` in `data`.
|
|
619
|
-
|
|
620
|
-
**Validation.** An invalid field is linked to its editor with `aria-describedby`, and a commit that fails validation is announced through a polite live region. The command buttons are named after their row (`Edit row 3`); `commandAriaLabel` in the options names them after something else, such as an order number.
|
|
621
|
-
|
|
622
|
-
Custom edit templates receive a `GridEditTemplateContext` bound to the row's Signal Forms field:
|
|
623
|
-
|
|
624
|
-
```html
|
|
625
|
-
<mona-grid-column field="shipName" title="Ship Name">
|
|
626
|
-
<ng-template monaGridEditTemplate let-context>
|
|
627
|
-
<mona-text-box [formField]="$any(context.field)" (keydown.escape)="context.cancel()"></mona-text-box>
|
|
628
|
-
</ng-template>
|
|
629
|
-
</mona-grid-column>
|
|
630
|
-
```
|
|
631
|
-
|
|
632
|
-
### Column Resizing
|
|
633
|
-
|
|
634
|
-
`monaGridResizable` renders a drag handle between header cells; `columnResize` emits the old and new width once a resize completes. A drag stops at the column's `minWidth` and `maxWidth`, and `Escape` during a drag puts the width back.
|
|
635
|
-
|
|
636
|
-
The handle is also a focusable `separator`: `F2` on a header moves to it, `ArrowLeft`/`ArrowRight` resize the column by 10px (mirrored in right-to-left layouts), `Home`/`End` set it to its narrowest/widest width, and `Enter` fits it to its content.
|
|
637
|
-
|
|
638
|
-
```html
|
|
639
|
-
<mona-grid [data]="orders()" monaGridResizable (columnResize)="onColumnResize($event)"></mona-grid>
|
|
640
|
-
```
|
|
641
|
-
|
|
642
|
-
### Column Reordering
|
|
643
|
-
|
|
644
|
-
`monaGridReorderable` lets the consumer drag column headers into a new order. Dropping on the start half of a header puts the column before it, the end half after it; `Escape` cancels the drag. From the keyboard, `Ctrl+Shift+ArrowLeft`/`Ctrl+Shift+ArrowRight` moves the focused header one place and announces its new position. `columnReorder` is cancelable — call `preventDefault()` to keep a column from moving.
|
|
645
|
-
|
|
646
|
-
```html
|
|
647
|
-
<mona-grid [data]="orders()" monaGridReorderable (columnReorder)="onColumnReorder($event)"></mona-grid>
|
|
648
|
-
```
|
|
649
|
-
|
|
650
|
-
```typescript
|
|
651
|
-
protected onColumnReorder(event: ColumnReorderEvent): void {
|
|
652
|
-
if (event.column.field === "orderId") {
|
|
653
|
-
event.preventDefault();
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
```
|
|
657
|
-
|
|
658
|
-
### Column Locking
|
|
659
|
-
|
|
660
|
-
Set `locked` and `lockedPosition` on a `mona-grid-column` (or `mona-grid-command-column`) to keep it fixed while the grid scrolls horizontally.
|
|
661
|
-
|
|
662
|
-
```html
|
|
663
|
-
<mona-grid-column field="orderId" title="Order ID" [locked]="true" lockedPosition="left"></mona-grid-column>
|
|
664
|
-
```
|
|
665
|
-
|
|
666
|
-
### Row Reordering
|
|
667
|
-
|
|
668
|
-
`monaGridRowReorderable` adds a built-in reorder-handle column as the first grid column. Rows can be moved only by dragging that handle, or with `Alt + ArrowUp` / `Alt + ArrowDown` while the handle is focused. The consumer owns the row order: `rowReorder` carries the complete reordered application data, and the grid never mutates the `[data]` input.
|
|
669
|
-
|
|
670
|
-
```html
|
|
671
|
-
<mona-grid [data]="products()" [rowKey]="'id'" monaGridRowReorderable (rowReorder)="onRowReorder($event)">
|
|
672
|
-
<mona-grid-column field="name" title="Name"></mona-grid-column>
|
|
673
|
-
<mona-grid-column field="price" title="Price"></mona-grid-column>
|
|
674
|
-
</mona-grid>
|
|
675
|
-
```
|
|
676
|
-
|
|
677
|
-
```typescript
|
|
678
|
-
protected readonly products = signal<Product[]>([...PRODUCTS]);
|
|
679
|
-
|
|
680
|
-
protected onRowReorder(event: RowReorderEvent<Product>): void {
|
|
681
|
-
this.products.set([...event.reorderedData]);
|
|
682
|
-
}
|
|
683
|
-
```
|
|
684
|
-
|
|
685
|
-
An options object can restrict which rows move and customize the handle's accessible label:
|
|
686
|
-
|
|
687
|
-
```html
|
|
688
|
-
<mona-grid
|
|
689
|
-
[data]="products()"
|
|
690
|
-
[rowKey]="'id'"
|
|
691
|
-
[monaGridRowReorderable]="{ enabled: true, canReorder: canReorderProduct }"
|
|
692
|
-
(rowReorder)="onRowReorder($event)">
|
|
693
|
-
</mona-grid>
|
|
694
|
-
```
|
|
695
|
-
|
|
696
|
-
Row reordering works with pagination (moving rows within the current page), master-detail rows, selection, locked columns, footers, and the add-row editor. It is intentionally disabled while sorting, filtering, grouping, server binding, virtual scrolling, or an edit session is active, because those features change the source-to-view mapping. Row order is application data and is not stored in `GridState`.
|
|
697
|
-
|
|
698
|
-
### Master-Detail Rows
|
|
699
|
-
|
|
700
|
-
`monaGridDetailTemplate` renders projected content for each row that the consumer can expand. The detail toggle is a button named by the `expandDetail`/`collapseDetail` messages, with `aria-expanded`. Detail rows aren't supported with `monaGridVirtualScroll`, whose rows share one height: the grid ignores the template there and warns in development mode.
|
|
701
|
-
|
|
702
|
-
```html
|
|
703
|
-
<mona-grid [data]="orders()">
|
|
704
|
-
<ng-template monaGridDetailTemplate let-dataItem>
|
|
705
|
-
<pre>{{ dataItem | json }}</pre>
|
|
706
|
-
</ng-template>
|
|
707
|
-
</mona-grid>
|
|
708
|
-
```
|
|
709
|
-
|
|
710
|
-
### State Persistence
|
|
711
|
-
|
|
712
|
-
`monaGridStatePersistence` captures and restores column order/width/visibility, sort, filter, group state and the page size (unless `persistPageSize` is `false`) through the two-way bindable `state` model.
|
|
187
|
+
To show a subset that your own controls choose, bind a filtered `computed`:
|
|
713
188
|
|
|
714
189
|
```typescript
|
|
715
|
-
protected readonly
|
|
190
|
+
protected readonly search = signal("");
|
|
191
|
+
protected readonly shownOrders = computed(() => {
|
|
192
|
+
const text = this.search().toLowerCase();
|
|
193
|
+
return this.orders().filter(order => order.shipName.toLowerCase().includes(text));
|
|
194
|
+
});
|
|
716
195
|
```
|
|
717
196
|
|
|
718
197
|
```html
|
|
719
|
-
<mona-
|
|
198
|
+
<mona-text-box aria-label="Search orders" [(value)]="search"></mona-text-box>
|
|
199
|
+
<mona-grid [data]="shownOrders()">...</mona-grid>
|
|
720
200
|
```
|
|
721
201
|
|
|
722
|
-
|
|
202
|
+
To show the condition in a column's filter UI as well, set the `filter` model of `monaGridFilterable` instead, see [Sorting & Filtering](grid-sorting-filtering.md). To have a server page, sort and filter, see [Server Binding & Virtualization](grid-server.md).
|
|
723
203
|
|
|
724
|
-
###
|
|
204
|
+
### Row Identity
|
|
725
205
|
|
|
726
|
-
`
|
|
206
|
+
`rowKey` names the property, or gives the function, that identifies a row. Selection, detail rows and editing use it to find a row again after `data` is replaced, so set it whenever rows have an id. A column whose `field` is the `rowKey` isn't editable unless it says so.
|
|
727
207
|
|
|
728
|
-
|
|
729
|
-
<button (click)="gridExport.exportCsv('orders.csv')">Export as CSV</button>
|
|
730
|
-
<mona-grid [data]="orders()" monaGridExport #gridExport="monaGridExport"></mona-grid>
|
|
731
|
-
```
|
|
208
|
+
### Toolbar and the Columns Button
|
|
732
209
|
|
|
733
|
-
|
|
210
|
+
`monaGridToolbarTemplate` adds a toolbar above the column headers, for your own buttons and for commands such as Add. The toolbar also shows a built-in Columns button (the `columns` message). It opens a popup that lists every column, with a box to filter the list by title. Apply shows the checked columns and hides the others; Cancel drops the changes. A column's `hidden` input sets where it starts. Without a toolbar template there is no Columns button. See [Columns](grid-columns.md).
|
|
734
211
|
|
|
735
|
-
|
|
212
|
+
## Appearance & Styling
|
|
736
213
|
|
|
737
|
-
|
|
214
|
+
| Input | What it changes |
|
|
215
|
+
| :--- | :--- |
|
|
216
|
+
| `class` | Classes on the grid element, merged with `tailwind-merge`. Set a height here for a grid that scrolls inside a fixed area. |
|
|
217
|
+
| `rounded` | The corner radius: `"none"`, `"small"`, `"medium"` (default) or `"large"`. |
|
|
218
|
+
| `rowClass` | A function that returns classes for each data row, such as a muted row for a cancelled order. See [Rows](grid-rows.md). |
|
|
219
|
+
| `resizeMethod` | How columns without a `width` get one: `"fitView"` (default) shares the free width, `"auto"` fits the content, and a number gives each of them that many pixels. See [Columns](grid-columns.md). |
|
|
738
220
|
|
|
739
|
-
|
|
740
|
-
<mona-grid-column field="freight" title="Freight" type="number" aggregate="avg"></mona-grid-column>
|
|
741
|
-
```
|
|
221
|
+
Grid styling is implemented with Tailwind utility classes internally; there are no public CSS custom properties to override.
|
|
742
222
|
|
|
743
223
|
## Behavior
|
|
744
224
|
|
|
745
|
-
###
|
|
225
|
+
### Events come from the feature directives
|
|
746
226
|
|
|
747
|
-
|
|
227
|
+
`mona-grid` reports only paging (`pageChange`, `skipChange`, `pageSizeChange`) and detail rows (`expandedKeysChange`). Every other event comes from the directive that turns its feature on: `columnSort`, `columnResize`, `columnReorder`, `groupChange`, `selectedKeysChange`, `rowReorder`, `cellEdit`, `rowEdit`, `save`, `remove`, `cancel`, `add`, `edit`, `dataStateChange` and `scrollEnd`.
|
|
748
228
|
|
|
749
229
|
### Cancelable events
|
|
750
230
|
|
|
751
|
-
`columnSort`, `columnReorder`, `cellEdit`, `rowEdit`, `save`, `remove`, `cancel`, `add`, and `edit` are
|
|
752
|
-
|
|
753
|
-
### `resizeMethod` controls initial column widths
|
|
754
|
-
|
|
755
|
-
`"fitView"` (default) distributes available width across columns with no explicit `width`. `"auto"` sizes each column to fit its rendered content. A literal number applies that width to every column without an explicit `width`.
|
|
756
|
-
|
|
757
|
-
### No CSS custom properties
|
|
758
|
-
|
|
759
|
-
Grid styling is implemented with Tailwind utility classes internally; there are no public CSS custom properties to override. The only public styling hooks are the `class` input (merged with `tailwind-merge`) and the `rounded` input.
|
|
760
|
-
|
|
761
|
-
### The Columns button
|
|
762
|
-
|
|
763
|
-
When the grid has a `monaGridToolbarTemplate`, the toolbar also shows a built-in Columns button (the `columns` message). It opens a popup that lists every column, with a box to filter the list by title. Apply shows the checked columns and hides the others; Cancel drops the changes. A column's `hidden` input sets where it starts, and `monaGridStatePersistence` saves what the user chose. The popup's component is internal, so there is nothing to import, and without a toolbar template there is no button.
|
|
231
|
+
`columnSort`, `columnReorder`, `cellEdit`, `rowEdit`, `save`, `remove`, `cancel`, `add`, and `edit` are event objects with `preventDefault()` and `isDefaultPrevented()`. Calling `preventDefault()` stops the change: `columnReorder.preventDefault()` keeps the dragged column where it was. `columnResize` is a plain object with no `preventDefault()`.
|
|
764
232
|
|
|
765
|
-
|
|
233
|
+
### Directives combine
|
|
766
234
|
|
|
767
|
-
|
|
235
|
+
The feature directives work together on one grid, with three exceptions: `monaGridServerBinding` and an enabled `monaGridVirtualScroll` can't be combined, virtual rows don't show detail rows, and row reordering turns itself off while rows are sorted, filtered, grouped, edited, server-bound or virtual. Each page lists its own limits.
|
|
768
236
|
|
|
769
237
|
## Accessibility
|
|
770
238
|
|
|
239
|
+
The grid element has no name of its own: set `aria-label` or `aria-labelledby`. The feature pages describe the roles, names and keys their features add.
|
|
240
|
+
|
|
771
241
|
### Keyboard
|
|
772
242
|
|
|
773
243
|
The grid is one Tab stop. `Tab` moves into the grid at the cell that last had focus. The first time, that is the first body cell, or the first header cell when there are no rows. The next `Tab` leaves the grid. Inside, the keys below move between cells; the header, the filter row, the add row and the body rows are one column of rows.
|
|
774
244
|
|
|
775
|
-
| Key
|
|
776
|
-
|
|
|
777
|
-
| `ArrowDown` / `ArrowUp`
|
|
778
|
-
| `ArrowLeft` / `ArrowRight`
|
|
779
|
-
| `Home` / `End`
|
|
780
|
-
| `Ctrl+Home` / `Ctrl+End` (`Cmd` too) | Move to the first/last cell in the grid. With virtual scrolling, the grid scrolls to the last row first.
|
|
781
|
-
| `PageUp` / `PageDown`
|
|
782
|
-
| `Enter`
|
|
783
|
-
| `F2`
|
|
784
|
-
| `
|
|
785
|
-
| `
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
| `Ctrl+C` / `Cmd+C` | Copies the focused cell's text (body rows, not while editing, and not when text is selected). |
|
|
789
|
-
| `Ctrl+Shift+ArrowLeft` / `ArrowRight` | With `monaGridReorderable`, moves the focused header's column one place (mirrored in right-to-left layouts) and announces it. `Cmd` too. |
|
|
790
|
-
| `Ctrl+Shift+G` / `Cmd+Shift+G` | With `monaGridGroupable`, groups the rows by the focused header's column and announces it. |
|
|
791
|
-
| `Delete` / `Backspace` | On a chip in the group panel, removes that grouping. |
|
|
792
|
-
| `ArrowRight` / `ArrowLeft` | On a group row, expands/collapses it first (mirrored in right-to-left layouts); on an expanded/collapsed group, moves as usual. |
|
|
793
|
-
| `Tab` / `Shift+Tab` | Leaves the grid. While editing a cell, commits it and edits the next/previous editable cell. |
|
|
794
|
-
|
|
795
|
-
Headers list their shortcuts in `aria-keyshortcuts`. The column resize handle has its own keys, described under [Column Resizing](#column-resizing).
|
|
245
|
+
| Key | Action |
|
|
246
|
+
| --- | --- |
|
|
247
|
+
| `ArrowDown` / `ArrowUp` | Move to the same column in the next/previous row, across the header, the filter row, the add row and the body. |
|
|
248
|
+
| `ArrowLeft` / `ArrowRight` | Move to the previous/next cell in the row (mirrored in right-to-left layouts). |
|
|
249
|
+
| `Home` / `End` | Move to the first/last cell in the row. |
|
|
250
|
+
| `Ctrl+Home` / `Ctrl+End` (`Cmd` too) | Move to the first/last cell in the grid. With virtual scrolling, the grid scrolls to the last row first. |
|
|
251
|
+
| `PageUp` / `PageDown` | Move up/down by the number of rows that fit in the body. |
|
|
252
|
+
| `Enter` | On a header, sorts the column. On a group row or the detail toggle, expands or collapses it. On an editable cell, starts editing. On any other cell, moves into its controls. |
|
|
253
|
+
| `F2` | Starts editing an editable cell; on any other cell, including a header or a filter-row cell, moves into its controls (links, buttons, the filter button, the filter input). |
|
|
254
|
+
| `Ctrl+C` / `Cmd+C` | Copies the focused cell's text (body rows, not while editing, and not when text is selected). |
|
|
255
|
+
| `Tab` / `Shift+Tab` | Leaves the grid. While editing a cell, commits it and edits the next/previous editable cell. |
|
|
256
|
+
|
|
257
|
+
Sorting, filtering, grouping, selection, column moves and row moves add keys of their own, listed on their pages. Headers list their shortcuts in `aria-keyshortcuts`.
|
|
796
258
|
|
|
797
259
|
Inside a cell's controls, `Tab`, `Shift+Tab` and the arrows move between them (text fields keep their arrow keys), `Tab` past the last control moves on to the next cell, and `Escape` returns to the cell.
|
|
798
260
|
|
|
@@ -804,38 +266,20 @@ Grid cells use a roving `tabindex`: the cell that last had focus has `tabindex="
|
|
|
804
266
|
|
|
805
267
|
### ARIA
|
|
806
268
|
|
|
807
|
-
| Attribute
|
|
808
|
-
|
|
|
809
|
-
| `role`
|
|
810
|
-
| `aria-label`
|
|
811
|
-
| `aria-rowcount`
|
|
812
|
-
| `aria-colcount`
|
|
813
|
-
| `aria-
|
|
814
|
-
| `
|
|
815
|
-
| `role`
|
|
816
|
-
| `role`
|
|
817
|
-
| `role`
|
|
818
|
-
| `
|
|
819
|
-
| `
|
|
820
|
-
| `aria-
|
|
821
|
-
| `aria-describedby` | On a header cell sorted after another | Its place in the sort order (`sortOrder` message) |
|
|
822
|
-
| `aria-keyshortcuts` | On a header cell with keyboard shortcuts | The keys that open its filter menu, move it or group by it |
|
|
823
|
-
| `role` | On an open filter menu | `"dialog"`, with `aria-label` `"Filter by {column}"` |
|
|
824
|
-
| `aria-haspopup` | On a filter menu button / a filter row operator button | `"dialog"` / `"menu"`; the operator button also has `aria-expanded` |
|
|
825
|
-
| `aria-selected` | On a row, only while `monaGridSelectable` is enabled | Reflects whether the row is selected |
|
|
826
|
-
| `aria-busy` | On the tabular content region in server mode | `"true"` while `loading` is true |
|
|
827
|
-
| `aria-rowindex` | On every row | 1-based position, counting header, filter and add rows and earlier pages |
|
|
828
|
-
| `aria-colindex` | On every cell | 1-based column position, accounting for group indent columns |
|
|
829
|
-
| `aria-expanded` | On a group header row | Reflects whether the group is expanded |
|
|
830
|
-
| `aria-level` | On rows of a grouped grid | The group's nesting depth; data rows sit one level below their group |
|
|
831
|
-
| `aria-readonly` | On a data cell | `"true"` when editing is disabled for that cell or column |
|
|
832
|
-
| `aria-orientation` | On the column resize handle | `"vertical"` |
|
|
833
|
-
| `aria-label` | On the column resize handle | `"Resize {column}"` (`resizeColumn` message) |
|
|
834
|
-
| `aria-valuenow` | On the column resize handle | The column width in pixels, with `aria-valuemin`/`aria-valuemax` |
|
|
835
|
-
| `aria-expanded` | On the detail toggle button | Reflects whether the detail row is open |
|
|
836
|
-
| `aria-label` | On the built-in command buttons | Names the row: `"Edit row 3"`, `"Remove row 3"`, `"Save row 3"`, `"Cancel editing row 3"`, or the `commandAriaLabel` option's text |
|
|
837
|
-
|
|
838
|
-
Moving a column or grouping by one from the keyboard is announced through a polite live region (`columnMoved` and `columnGrouped` messages). The grid element has no name of its own: set `aria-label` or `aria-labelledby`.
|
|
269
|
+
| Attribute | When present | Value |
|
|
270
|
+
| --- | --- | --- |
|
|
271
|
+
| `role` | On the tabular content region | `"grid"`, or `"treegrid"` while rows are grouped |
|
|
272
|
+
| `aria-label` | On the tabular content region | The `aria-label` input; `aria-labelledby` likewise |
|
|
273
|
+
| `aria-rowcount` | On the tabular content region | Every row, or `-1` when paged groups or detail rows make it unknown |
|
|
274
|
+
| `aria-colcount` | On the tabular content region | Every column, including group indent and selection columns |
|
|
275
|
+
| `aria-readonly` | On the tabular content region | `"true"` while editing is off |
|
|
276
|
+
| `role` | On the header/body/footer row groups | `"rowgroup"` |
|
|
277
|
+
| `role` | On header cells | `"columnheader"` |
|
|
278
|
+
| `role` | On data/group/footer rows | `"row"` |
|
|
279
|
+
| `role` | On data cells | `"gridcell"` |
|
|
280
|
+
| `aria-rowindex` | On every row | 1-based position, counting header, filter and add rows and earlier pages |
|
|
281
|
+
| `aria-colindex` | On every cell | 1-based column position, accounting for group indent columns |
|
|
282
|
+
| `aria-keyshortcuts` | On a header cell with keyboard shortcuts | The keys that open its filter menu, move it or group by it |
|
|
839
283
|
|
|
840
284
|
## API
|
|
841
285
|
|
|
@@ -898,454 +342,42 @@ Everything below is imported from `@nanahoshi/mona-ui/grid`.
|
|
|
898
342
|
| `pageSizeChange` | `number` | Emitted when `pageSize` changes. |
|
|
899
343
|
| `skipChange` | `number` | Emitted when `skip` changes. |
|
|
900
344
|
|
|
901
|
-
### `
|
|
345
|
+
### `GridCellTemplateDirective`
|
|
902
346
|
|
|
903
|
-
**Selector:** `
|
|
347
|
+
**Selector:** `ng-template[monaGridCellTemplate]`
|
|
904
348
|
|
|
905
|
-
|
|
349
|
+
### `GridColumnTitleTemplateDirective`
|
|
906
350
|
|
|
907
|
-
|
|
908
|
-
| --- | --- | --- | --- |
|
|
909
|
-
| `hidden` | `boolean` | `false` | Whether this command column is hidden from the rendered grid. |
|
|
910
|
-
| `locked` | `boolean` | `false` | Whether this command column remains fixed while the grid scrolls horizontally. |
|
|
911
|
-
| `lockedPosition` | `GridColumnLockedPosition` | `"left"` | The side of the grid where this locked command column is fixed. |
|
|
912
|
-
| `maxWidth` | `number \| null` | `null` | The maximum width of this command column in pixels. |
|
|
913
|
-
| `minWidth` | `number \| null` | `null` | The minimum width of this command column in pixels. |
|
|
914
|
-
| `removeConfirmation` | `boolean` | `false` | Whether removing a row asks for confirmation before emitting `remove`: from the built-in Remove button, or from a `monaGridRemoveCommand` button in this column's template. |
|
|
915
|
-
| `stateKey` | `string \| null` | `"commands"` | A stable key used to persist state for this command column. |
|
|
916
|
-
| `title` | `string \| null` | `null` | The title displayed in the command column header. Without one, the localized `commandColumnTitle` message ("Commands"). |
|
|
917
|
-
| `width` | `number \| null` | `160` | The fixed width of this command column in pixels. |
|
|
351
|
+
**Selector:** `[monaGridColumnTitleTemplate]`
|
|
918
352
|
|
|
919
|
-
### `
|
|
353
|
+
### `GridContextMenuDirective`
|
|
920
354
|
|
|
921
|
-
**Selector:** `
|
|
922
|
-
**Type parameters:** `T extends object = Record<PropertyKey, unknown>`
|
|
355
|
+
**Selector:** `[monaGridContextMenu]`
|
|
923
356
|
|
|
924
|
-
|
|
357
|
+
### `GridHeaderTemplateDirective`
|
|
925
358
|
|
|
926
|
-
|
|
927
|
-
| --- | --- | --- | --- |
|
|
928
|
-
| `monaGridEditable` | `EditableOptions<T> \| ""` | `""` | Enables inline editing. An empty string enables cell-mode editing with default settings; pass an object to choose `"cell"` or `"row"` mode and an optional validation `schema`. |
|
|
929
|
-
| `newRowFactory` | `() => T` | — | Creates the initial data object used by the add-row editor. |
|
|
359
|
+
**Selector:** `ng-template[monaGridHeaderTemplate]`
|
|
930
360
|
|
|
931
|
-
|
|
361
|
+
### `GridNoDataTemplateDirective`
|
|
932
362
|
|
|
933
|
-
|
|
934
|
-
| --- | --- | --- |
|
|
935
|
-
| `add` | `GridAddEvent` | Emitted before the grid displays the new-row editor. |
|
|
936
|
-
| `cancel` | `GridCancelEvent` | Emitted before an edit operation is canceled; `reason` says why. Prevent it to keep editing, except for `"removed"`, when the edited row left the data or the view. |
|
|
937
|
-
| `cellEdit` | `CellEditEvent` | Emitted before a changed cell is saved in cell mode; not when the value didn't change. `rowData` is the row as it was; persist from `save`, whose `rowData` holds the edited values. |
|
|
938
|
-
| `edit` | `GridEditEvent` | Emitted before a row enters edit mode. |
|
|
939
|
-
| `remove` | `GridRemoveEvent` | Emitted when a row remove command is triggered, with the row's `key` and `index`. |
|
|
940
|
-
| `rowEdit` | `RowEditEvent` | Emitted after a changed row is saved (row mode only). |
|
|
941
|
-
| `save` | `GridSaveEvent<T>` | Emitted before an edited or new row is saved; not when an edit changed nothing. `rowData` holds the edited values and `originalRowData` the row as it was. Prevent it to keep the editor open, for example while saving on the server, then call `endEdit()`. |
|
|
363
|
+
**Selector:** `ng-template[monaGridNoDataTemplate]`
|
|
942
364
|
|
|
943
|
-
|
|
365
|
+
### `GridToolbarTemplateDirective`
|
|
944
366
|
|
|
945
|
-
|
|
946
|
-
| --- | --- |
|
|
947
|
-
| `endEdit(): void` | Closes the current edit without reporting it, such as after a `save` that was prevented to save on the server has finished. |
|
|
367
|
+
**Selector:** `ng-template[monaGridToolbarTemplate]`
|
|
948
368
|
|
|
949
|
-
### `
|
|
369
|
+
### `Row`
|
|
950
370
|
|
|
951
|
-
|
|
371
|
+
A row of the grid, wrapping its data item.
|
|
952
372
|
|
|
953
|
-
####
|
|
373
|
+
#### Properties
|
|
954
374
|
|
|
955
|
-
| Name | Type |
|
|
956
|
-
| --- | --- |
|
|
957
|
-
| `
|
|
958
|
-
| `
|
|
959
|
-
| `selectedKeys` | `Iterable<unknown>` | `[]` | Currently selected row keys. |
|
|
375
|
+
| Name | Type |
|
|
376
|
+
| --- | --- |
|
|
377
|
+
| `data` (read-only) | `Record<PropertyKey, unknown>` |
|
|
378
|
+
| `uid` (read-only) | `string` |
|
|
960
379
|
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
| Name | Type | Description |
|
|
964
|
-
| --- | --- | --- |
|
|
965
|
-
| `selectedKeysChange` | `unknown[]` | Emitted when the user changes the selection. Not emitted for a `selectedKeys` value set from code. |
|
|
966
|
-
|
|
967
|
-
### `GridServerBindingDirective`
|
|
968
|
-
|
|
969
|
-
**Selector:** `mona-grid[monaGridServerBinding]`
|
|
970
|
-
|
|
971
|
-
#### Inputs
|
|
972
|
-
|
|
973
|
-
| Name | Type | Default | Description |
|
|
974
|
-
| --- | --- | --- | --- |
|
|
975
|
-
| `loading` | `boolean` | `false` | Shows a loading overlay while the application requests server data. |
|
|
976
|
-
| `skip` | `number` | `0` | Zero-based offset of the supplied server page. External changes do not request data. |
|
|
977
|
-
| `total` (required) | `number` | — | Total matching server records before paging. Must be a non-negative integer. |
|
|
978
|
-
|
|
979
|
-
#### Outputs
|
|
980
|
-
|
|
981
|
-
| Name | Type | Description |
|
|
982
|
-
| --- | --- | --- |
|
|
983
|
-
| `dataStateChange` | `GridDataState` | Emitted once per user paging, sorting, or filtering action with the requested server state. |
|
|
984
|
-
|
|
985
|
-
### `GridStatePersistenceDirective`
|
|
986
|
-
|
|
987
|
-
**Selector:** `mona-grid[monaGridStatePersistence]`
|
|
988
|
-
**Exported as:** `monaGridStatePersistence`
|
|
989
|
-
|
|
990
|
-
#### Inputs
|
|
991
|
-
|
|
992
|
-
| Name | Type | Default | Description |
|
|
993
|
-
| --- | --- | --- | --- |
|
|
994
|
-
| `monaGridStatePersistence` | `GridStatePersistenceOptions \| ""` | `""` | State persistence options such as schema version and page size persistence. |
|
|
995
|
-
| `state` (two-way) | `GridState \| null` | `null` | The persisted grid state to apply and update when the grid state changes. |
|
|
996
|
-
|
|
997
|
-
#### Outputs
|
|
998
|
-
|
|
999
|
-
| Name | Type | Description |
|
|
1000
|
-
| --- | --- | --- |
|
|
1001
|
-
| `stateChange` | `GridState \| null` | Emitted when `state` changes. |
|
|
1002
|
-
|
|
1003
|
-
#### Methods
|
|
1004
|
-
|
|
1005
|
-
| Signature | Description |
|
|
1006
|
-
| --- | --- |
|
|
1007
|
-
| `captureState(): GridState` | Captures the grid's current state (columns, sort, filter, group) without waiting for the next change cycle. |
|
|
1008
|
-
| `loadState(state: GridState \| null, options: GridStatePersistenceOptions = this.#resolveOptions()): GridStateLoadResult` | Applies a previously captured state to the grid. A state that isn't well formed (a missing array, a duplicate column id, an unknown filter operator, a page size or width that isn't a positive number) returns `rejected-invalid` and changes nothing. |
|
|
1009
|
-
|
|
1010
|
-
### `GridSortableDirective`
|
|
1011
|
-
|
|
1012
|
-
**Selector:** `mona-grid[monaGridSortable]`
|
|
1013
|
-
|
|
1014
|
-
#### Inputs
|
|
1015
|
-
|
|
1016
|
-
| Name | Type | Default | Description |
|
|
1017
|
-
| --- | --- | --- | --- |
|
|
1018
|
-
| `monaGridSortable` | `SortableOptions \| ""` | `""` | Enables column sorting on the grid. Pass a `SortableOptions` object to configure sort mode, unsort behavior, or sort-index display. Sorting is on unless the object sets `enabled: false`. |
|
|
1019
|
-
| `sort` (two-way) | `SortDescriptor[]` | `[]` | Current sort descriptors applied to the grid. Descriptors are kept even when no column shows the field, and a repeated field keeps its last descriptor. Supports two-way binding; a restored grid state updates it too. |
|
|
1020
|
-
|
|
1021
|
-
#### Outputs
|
|
1022
|
-
|
|
1023
|
-
| Name | Type | Description |
|
|
1024
|
-
| --- | --- | --- |
|
|
1025
|
-
| `columnSort` | `ColumnSortEvent` | Emitted when a column header is activated to change its sort direction. Call `preventDefault()` on the event to cancel the sort. |
|
|
1026
|
-
| `sortChange` | `SortDescriptor[]` | Emitted when `sort` changes. |
|
|
1027
|
-
|
|
1028
|
-
### `GridVirtualScrollDirective`
|
|
1029
|
-
|
|
1030
|
-
**Selector:** `mona-grid[monaGridVirtualScroll]`
|
|
1031
|
-
|
|
1032
|
-
#### Inputs
|
|
1033
|
-
|
|
1034
|
-
| Name | Type | Default | Description |
|
|
1035
|
-
| --- | --- | --- | --- |
|
|
1036
|
-
| `monaGridVirtualScroll` | `Partial<VirtualScrollOptions> \| "" \| undefined` | `undefined` | Enables row virtualization on the grid. Pass a `VirtualScrollOptions` object to configure the fixed row height. |
|
|
1037
|
-
| `scrollEndThreshold` | `number` | `5` | Distance, in rows, from the bottom of the virtualized list at which `scrollEnd` is emitted. |
|
|
1038
|
-
|
|
1039
|
-
#### Outputs
|
|
1040
|
-
|
|
1041
|
-
| Name | Type | Description |
|
|
1042
|
-
| --- | --- | --- |
|
|
1043
|
-
| `scrollEnd` | `void` | Emitted when the scroll position reaches the configured threshold from the bottom of the virtualized list. |
|
|
1044
|
-
|
|
1045
|
-
### `GridFilterableDirective`
|
|
1046
|
-
|
|
1047
|
-
**Selector:** `mona-grid[monaGridFilterable]`
|
|
1048
|
-
|
|
1049
|
-
#### Inputs
|
|
1050
|
-
|
|
1051
|
-
| Name | Type | Default | Description |
|
|
1052
|
-
| --- | --- | --- | --- |
|
|
1053
|
-
| `filter` (two-way) | `CompositeFilterDescriptor[]` | `[]` | Current filter descriptors applied to the grid. Conditions on one field show in that column's filter menu (repeated fields are combined with `and`); filters across fields, such as an `or` of two columns, are still applied and reported. Conditions with an unknown operator are ignored. Supports two-way binding. |
|
|
1054
|
-
| `monaGridFilterable` | `Partial<FilterableOptions> \| ""` | `""` | Enables column filtering on the grid. Pass a `FilterableOptions` object to configure whether filters render in the header menu, a filter row, or both. Filtering is on unless the object sets `enabled: false`. |
|
|
1055
|
-
|
|
1056
|
-
#### Outputs
|
|
1057
|
-
|
|
1058
|
-
| Name | Type | Description |
|
|
1059
|
-
| --- | --- | --- |
|
|
1060
|
-
| `filterChange` | `CompositeFilterDescriptor[]` | Emitted when `filter` changes. |
|
|
1061
|
-
|
|
1062
|
-
### `GridGroupableDirective`
|
|
1063
|
-
|
|
1064
|
-
**Selector:** `mona-grid[monaGridGroupable]`
|
|
1065
|
-
|
|
1066
|
-
#### Inputs
|
|
1067
|
-
|
|
1068
|
-
| Name | Type | Default | Description |
|
|
1069
|
-
| --- | --- | --- | --- |
|
|
1070
|
-
| `group` (two-way) | `GroupDescriptor[]` | `[]` | Current group descriptors applied to the grid. A repeated field keeps its last descriptor; a field without a column is grouped once its column appears. Supports two-way binding: `groupChange` emits after the user groups, ungroups, reorders or re-sorts groups, and after a grid state is restored, never for a value set here. |
|
|
1071
|
-
| `monaGridGroupable` | `Partial<GroupableOptions> \| "" \| undefined` | `undefined` | Enables column grouping on the grid. Pass a `GroupableOptions` object to configure group footer display. Grouping is on unless the object sets `enabled: false`. |
|
|
1072
|
-
|
|
1073
|
-
#### Outputs
|
|
1074
|
-
|
|
1075
|
-
| Name | Type | Description |
|
|
1076
|
-
| --- | --- | --- |
|
|
1077
|
-
| `groupChange` | `GroupDescriptor[]` | Emitted when `group` changes. |
|
|
1078
|
-
|
|
1079
|
-
### `GridReorderableDirective`
|
|
1080
|
-
|
|
1081
|
-
**Selector:** `mona-grid[monaGridReorderable]`
|
|
1082
|
-
|
|
1083
|
-
#### Inputs
|
|
1084
|
-
|
|
1085
|
-
| Name | Type | Default | Description |
|
|
1086
|
-
| --- | --- | --- | --- |
|
|
1087
|
-
| `monaGridReorderable` | `ReorderableOptions \| ""` | `""` | Enables column reordering via drag and drop. Pass a `ReorderableOptions` object to configure it explicitly. |
|
|
1088
|
-
|
|
1089
|
-
#### Outputs
|
|
1090
|
-
|
|
1091
|
-
| Name | Type | Description |
|
|
1092
|
-
| --- | --- | --- |
|
|
1093
|
-
| `columnReorder` | `ColumnReorderEvent` | Emitted when a column is dropped into a new position. Call `preventDefault()` on the event to cancel the reorder. |
|
|
1094
|
-
|
|
1095
|
-
### `GridResizableDirective`
|
|
1096
|
-
|
|
1097
|
-
**Selector:** `mona-grid[monaGridResizable]`
|
|
1098
|
-
|
|
1099
|
-
#### Inputs
|
|
1100
|
-
|
|
1101
|
-
| Name | Type | Default | Description |
|
|
1102
|
-
| --- | --- | --- | --- |
|
|
1103
|
-
| `monaGridResizable` | `ResizableOptions \| ""` | `""` | Enables column resizing on the grid. Pass a `ResizableOptions` object to configure it explicitly. |
|
|
1104
|
-
|
|
1105
|
-
#### Outputs
|
|
1106
|
-
|
|
1107
|
-
| Name | Type | Description |
|
|
1108
|
-
| --- | --- | --- |
|
|
1109
|
-
| `columnResize` | `ColumnResizeEvent` | Emitted when a column resize completes, with the column and its old and new widths. |
|
|
1110
|
-
|
|
1111
|
-
### `GridRowReorderableDirective`
|
|
1112
|
-
|
|
1113
|
-
**Selector:** `mona-grid[monaGridRowReorderable]`
|
|
1114
|
-
|
|
1115
|
-
#### Inputs
|
|
1116
|
-
|
|
1117
|
-
| Name | Type | Default | Description |
|
|
1118
|
-
| --- | --- | --- | --- |
|
|
1119
|
-
| `monaGridRowReorderable` | `RowReorderableOptions \| ""` | `""` | Enables row reordering via the reorder-handle column. Pass a `RowReorderableOptions` object to configure it explicitly. |
|
|
1120
|
-
|
|
1121
|
-
#### Outputs
|
|
1122
|
-
|
|
1123
|
-
| Name | Type | Description |
|
|
1124
|
-
| --- | --- | --- |
|
|
1125
|
-
| `rowReorder` | `RowReorderEvent<Record<PropertyKey, unknown>>` | Emitted when a row is moved to a new position. The event carries the moved row, source- and page-relative indices, and the complete reordered application data. |
|
|
1126
|
-
|
|
1127
|
-
### `GridEditCommandDirective`
|
|
1128
|
-
|
|
1129
|
-
**Selector:** `button[monaGridEditCommand]`
|
|
1130
|
-
|
|
1131
|
-
#### Inputs
|
|
1132
|
-
|
|
1133
|
-
| Name | Type | Default | Description |
|
|
1134
|
-
| --- | --- | --- | --- |
|
|
1135
|
-
| `monaGridEditCommand` | `Row \| null` | `null` | The row the button puts into row edit mode when clicked, usually the command template's `row`. Does nothing while `null` or when the grid isn't in row edit mode. |
|
|
1136
|
-
|
|
1137
|
-
### `GridExportDirective`
|
|
1138
|
-
|
|
1139
|
-
**Selector:** `mona-grid[monaGridExport]`
|
|
1140
|
-
**Exported as:** `monaGridExport`
|
|
1141
|
-
|
|
1142
|
-
#### Methods
|
|
1143
|
-
|
|
1144
|
-
| Signature | Description |
|
|
1145
|
-
| --- | --- |
|
|
1146
|
-
| `exportCsv(filename?: string): void` | Exports the visible columns of the current view as CSV (only the loaded page with server binding). |
|
|
1147
|
-
|
|
1148
|
-
### `GridRemoveCommandDirective`
|
|
1149
|
-
|
|
1150
|
-
**Selector:** `button[monaGridRemoveCommand]`
|
|
1151
|
-
|
|
1152
|
-
#### Inputs
|
|
1153
|
-
|
|
1154
|
-
| Name | Type | Default | Description |
|
|
1155
|
-
| --- | --- | --- | --- |
|
|
1156
|
-
| `monaGridRemoveCommand` | `Row \| null` | `null` | The row the button removes when clicked, usually the command template's `row`. The click emits the grid's `remove` event for that row. Inside a command column with `removeConfirmation`, it asks first, as the built-in remove command does. Does nothing while `null`. |
|
|
1157
|
-
|
|
1158
|
-
### `GridAddCommandDirective`
|
|
1159
|
-
|
|
1160
|
-
**Selector:** `button[monaGridAddCommand]`
|
|
1161
|
-
|
|
1162
|
-
### `GridCancelCommandDirective`
|
|
1163
|
-
|
|
1164
|
-
**Selector:** `button[monaGridCancelCommand]`
|
|
1165
|
-
|
|
1166
|
-
### `GridCellTemplateDirective`
|
|
1167
|
-
|
|
1168
|
-
**Selector:** `ng-template[monaGridCellTemplate]`
|
|
1169
|
-
|
|
1170
|
-
### `GridColumnTitleTemplateDirective`
|
|
1171
|
-
|
|
1172
|
-
**Selector:** `[monaGridColumnTitleTemplate]`
|
|
1173
|
-
|
|
1174
|
-
### `GridContextMenuDirective`
|
|
1175
|
-
|
|
1176
|
-
**Selector:** `[monaGridContextMenu]`
|
|
1177
|
-
|
|
1178
|
-
### `GridDetailTemplateDirective`
|
|
1179
|
-
|
|
1180
|
-
**Selector:** `ng-template[monaGridDetailTemplate]`
|
|
1181
|
-
|
|
1182
|
-
### `GridEditTemplateDirective`
|
|
1183
|
-
|
|
1184
|
-
**Selector:** `ng-template[monaGridEditTemplate]`
|
|
1185
|
-
|
|
1186
|
-
### `GridFooterTemplateDirective`
|
|
1187
|
-
|
|
1188
|
-
**Selector:** `ng-template[monaGridFooterTemplate]`
|
|
1189
|
-
|
|
1190
|
-
### `GridGroupFooterTemplateDirective`
|
|
1191
|
-
|
|
1192
|
-
**Selector:** `ng-template[monaGridGroupFooterTemplate]`
|
|
1193
|
-
|
|
1194
|
-
### `GridHeaderTemplateDirective`
|
|
1195
|
-
|
|
1196
|
-
**Selector:** `ng-template[monaGridHeaderTemplate]`
|
|
1197
|
-
|
|
1198
|
-
### `GridNoDataTemplateDirective`
|
|
1199
|
-
|
|
1200
|
-
**Selector:** `ng-template[monaGridNoDataTemplate]`
|
|
1201
|
-
|
|
1202
|
-
### `GridSaveCommandDirective`
|
|
1203
|
-
|
|
1204
|
-
**Selector:** `button[monaGridSaveCommand]`
|
|
1205
|
-
|
|
1206
|
-
### `GridToolbarTemplateDirective`
|
|
1207
|
-
|
|
1208
|
-
**Selector:** `ng-template[monaGridToolbarTemplate]`
|
|
1209
|
-
|
|
1210
|
-
### `CellEditEvent`
|
|
1211
|
-
|
|
1212
|
-
**Extends:** `PreventableEvent`
|
|
1213
|
-
|
|
1214
|
-
#### Properties
|
|
1215
|
-
|
|
1216
|
-
| Name | Type |
|
|
1217
|
-
| --- | --- |
|
|
1218
|
-
| `field` (read-only) | `string` |
|
|
1219
|
-
| `newValue` (read-only) | `unknown` |
|
|
1220
|
-
| `oldValue` (read-only) | `unknown` |
|
|
1221
|
-
| `rowData` (read-only) | `Record<PropertyKey, unknown>` |
|
|
1222
|
-
| `session` (read-only) | `GridEditSession` |
|
|
1223
|
-
|
|
1224
|
-
### `ColumnReorderEvent`
|
|
1225
|
-
|
|
1226
|
-
**Extends:** `PreventableEvent`
|
|
1227
|
-
|
|
1228
|
-
#### Properties
|
|
1229
|
-
|
|
1230
|
-
| Name | Type |
|
|
1231
|
-
| --- | --- |
|
|
1232
|
-
| `column` (read-only) | `Column` |
|
|
1233
|
-
| `newIndex` (read-only) | `number` |
|
|
1234
|
-
| `oldIndex` (read-only) | `number` |
|
|
1235
|
-
|
|
1236
|
-
### `ColumnSortEvent`
|
|
1237
|
-
|
|
1238
|
-
**Extends:** `PreventableEvent`
|
|
1239
|
-
|
|
1240
|
-
#### Properties
|
|
1241
|
-
|
|
1242
|
-
| Name | Type |
|
|
1243
|
-
| --- | --- |
|
|
1244
|
-
| `column` (read-only) | `Column` |
|
|
1245
|
-
|
|
1246
|
-
### `GridAddEvent`
|
|
1247
|
-
|
|
1248
|
-
**Extends:** `PreventableEvent`
|
|
1249
|
-
|
|
1250
|
-
#### Properties
|
|
1251
|
-
|
|
1252
|
-
| Name | Type |
|
|
1253
|
-
| --- | --- |
|
|
1254
|
-
| `rowData` (read-only) | `Record<PropertyKey, unknown>` |
|
|
1255
|
-
| `session` (read-only) | `GridEditSession` |
|
|
1256
|
-
|
|
1257
|
-
### `GridCancelEvent`
|
|
1258
|
-
|
|
1259
|
-
**Extends:** `PreventableEvent`
|
|
1260
|
-
|
|
1261
|
-
#### Properties
|
|
1262
|
-
|
|
1263
|
-
| Name | Type |
|
|
1264
|
-
| --- | --- |
|
|
1265
|
-
| `operation` (read-only) | `GridSaveOperation` |
|
|
1266
|
-
| `reason` (read-only) | `GridCancelReason` |
|
|
1267
|
-
| `rowData` (read-only) | `Record<PropertyKey, unknown>` |
|
|
1268
|
-
| `session` (read-only) | `GridEditSession` |
|
|
1269
|
-
|
|
1270
|
-
### `GridEditEvent`
|
|
1271
|
-
|
|
1272
|
-
**Extends:** `PreventableEvent`
|
|
1273
|
-
|
|
1274
|
-
#### Properties
|
|
1275
|
-
|
|
1276
|
-
| Name | Type |
|
|
1277
|
-
| --- | --- |
|
|
1278
|
-
| `rowData` (read-only) | `Record<PropertyKey, unknown>` |
|
|
1279
|
-
| `session` (read-only) | `GridEditSession` |
|
|
1280
|
-
|
|
1281
|
-
### `GridRemoveEvent`
|
|
1282
|
-
|
|
1283
|
-
**Extends:** `PreventableEvent`
|
|
1284
|
-
|
|
1285
|
-
#### Properties
|
|
1286
|
-
|
|
1287
|
-
| Name | Type | Description |
|
|
1288
|
-
| --- | --- | --- |
|
|
1289
|
-
| `index` (read-only) | `number` | The row's position in the grid's `data`, or -1 when it is no longer there. |
|
|
1290
|
-
| `key` (read-only) | `unknown` | The row's `rowKey` value, or the data item when the grid has no `rowKey`. |
|
|
1291
|
-
| `rowData` (read-only) | `Record<PropertyKey, unknown>` | The data item of the row being removed. |
|
|
1292
|
-
|
|
1293
|
-
### `GridSaveEvent`
|
|
1294
|
-
|
|
1295
|
-
`T` is the row type, which a typed `schema` or `newRowFactory` on `monaGridEditable` sets.
|
|
1296
|
-
|
|
1297
|
-
**Type parameters:** `T extends object = Record<PropertyKey, unknown>`
|
|
1298
|
-
**Extends:** `PreventableEvent`
|
|
1299
|
-
|
|
1300
|
-
#### Properties
|
|
1301
|
-
|
|
1302
|
-
| Name | Type |
|
|
1303
|
-
| --- | --- |
|
|
1304
|
-
| `operation` (read-only) | `GridSaveOperation` |
|
|
1305
|
-
| `originalRowData` (read-only) | `T \| null` |
|
|
1306
|
-
| `rowData` (read-only) | `T` |
|
|
1307
|
-
| `session` (read-only) | `GridEditSession` |
|
|
1308
|
-
|
|
1309
|
-
### `Row`
|
|
1310
|
-
|
|
1311
|
-
A row of the grid, wrapping its data item.
|
|
1312
|
-
|
|
1313
|
-
#### Properties
|
|
1314
|
-
|
|
1315
|
-
| Name | Type |
|
|
1316
|
-
| --- | --- |
|
|
1317
|
-
| `data` (read-only) | `Record<PropertyKey, unknown>` |
|
|
1318
|
-
| `uid` (read-only) | `string` |
|
|
1319
|
-
|
|
1320
|
-
### `RowEditEvent`
|
|
1321
|
-
|
|
1322
|
-
**Extends:** `PreventableEvent`
|
|
1323
|
-
|
|
1324
|
-
#### Properties
|
|
1325
|
-
|
|
1326
|
-
| Name | Type |
|
|
1327
|
-
| --- | --- |
|
|
1328
|
-
| `originalRowData` (read-only) | `Record<PropertyKey, unknown> \| null` |
|
|
1329
|
-
| `rowData` (read-only) | `Record<PropertyKey, unknown>` |
|
|
1330
|
-
| `session` (read-only) | `GridEditSession` |
|
|
1331
|
-
|
|
1332
|
-
### `RowReorderEvent`
|
|
1333
|
-
|
|
1334
|
-
**Type parameters:** `TData extends Record<PropertyKey, unknown> = Record<PropertyKey, unknown>`
|
|
1335
|
-
**Extends:** `PreventableEvent`
|
|
1336
|
-
|
|
1337
|
-
#### Properties
|
|
1338
|
-
|
|
1339
|
-
| Name | Type |
|
|
1340
|
-
| --- | --- |
|
|
1341
|
-
| `currentIndex` (read-only) | `number` |
|
|
1342
|
-
| `currentPageIndex` (read-only) | `number` |
|
|
1343
|
-
| `previousIndex` (read-only) | `number` |
|
|
1344
|
-
| `previousPageIndex` (read-only) | `number` |
|
|
1345
|
-
| `reorderedData` (read-only) | `readonly TData[]` |
|
|
1346
|
-
| `rowData` (read-only) | `TData` |
|
|
1347
|
-
|
|
1348
|
-
### Types
|
|
380
|
+
### Types
|
|
1349
381
|
|
|
1350
382
|
#### `GRID_DEFAULT_MESSAGES`
|
|
1351
383
|
|
|
@@ -1422,155 +454,7 @@ grid scrolls horizontally.
|
|
|
1422
454
|
| `titleTemplate` (read-only) | `TemplateRef<unknown> \| null` | The column's `monaGridColumnTitleTemplate`, shown in the header in place of `title` when there is no header template, or `null`. |
|
|
1423
455
|
| `width` (read-only) | `number \| null` | The column's configured width in pixels, or `null` to size it automatically. |
|
|
1424
456
|
|
|
1425
|
-
#### `
|
|
1426
|
-
|
|
1427
|
-
| Name | Type |
|
|
1428
|
-
| --- | --- |
|
|
1429
|
-
| `column` | `Column` |
|
|
1430
|
-
| `newWidth` | `number` |
|
|
1431
|
-
| `oldWidth` | `number` |
|
|
1432
|
-
|
|
1433
|
-
#### `EditableOptions`
|
|
1434
|
-
|
|
1435
|
-
`T` is the row type, which a typed `schema` sets.
|
|
1436
|
-
|
|
1437
|
-
**Type parameters:** `T extends object = Record<PropertyKey, unknown>`
|
|
1438
|
-
|
|
1439
|
-
| Name | Type | Description |
|
|
1440
|
-
| --- | --- | --- |
|
|
1441
|
-
| `commandAriaLabel?` | `( command: GridRowCommand, rowData: Record<PropertyKey, unknown>, absoluteIndex: number ) => string` | Returns the accessible name of a row's command button, such as "Edit order 10248". Without it the buttons are named by position ("Edit row 3"). `absoluteIndex` is the row's 0-based position in the filtered and sorted rows; the add row isn't passed here. |
|
|
1442
|
-
| `enabled?` | `boolean` | Whether editing is active. On unless set to `false`; options replace earlier ones. |
|
|
1443
|
-
| `mode` | `"cell" \| "row"` | Whether editing commits per cell or per row. |
|
|
1444
|
-
| `schema?` | `GridEditSchemaFactory<T>` | Builds a Signal Forms validation schema for the row being edited. |
|
|
1445
|
-
|
|
1446
|
-
#### `FilterableOptions`
|
|
1447
|
-
|
|
1448
|
-
| Name | Type |
|
|
1449
|
-
| --- | --- |
|
|
1450
|
-
| `enabled` | `boolean` |
|
|
1451
|
-
| `type` | `"menu" \| "row" \| "menu, row"` |
|
|
1452
|
-
|
|
1453
|
-
#### `GridColumnState`
|
|
1454
|
-
|
|
1455
|
-
| Name | Type |
|
|
1456
|
-
| --- | --- |
|
|
1457
|
-
| `hidden` | `boolean` |
|
|
1458
|
-
| `id` | `string` |
|
|
1459
|
-
| `order` | `number` |
|
|
1460
|
-
| `width` | `number \| null` |
|
|
1461
|
-
|
|
1462
|
-
#### `GridDataState`
|
|
1463
|
-
|
|
1464
|
-
The paging, sorting, and filtering requested by a server-bound Grid.
|
|
1465
|
-
|
|
1466
|
-
| Name | Type | Description |
|
|
1467
|
-
| --- | --- | --- |
|
|
1468
|
-
| `filter` (read-only) | `readonly CompositeFilterDescriptor[]` | Applied composite filter descriptors. |
|
|
1469
|
-
| `skip` (read-only) | `number` | Requested zero-based offset. |
|
|
1470
|
-
| `sort` (read-only) | `readonly SortDescriptor[]` | Sort descriptors in priority order. |
|
|
1471
|
-
| `take` (read-only) | `number` | Requested page size. |
|
|
1472
|
-
|
|
1473
|
-
#### `GridEditFormContext`
|
|
1474
|
-
|
|
1475
|
-
What a schema factory is told about the edit. `T` is the row type, untyped unless you give one.
|
|
1476
|
-
|
|
1477
|
-
**Type parameters:** `T extends object = Record<PropertyKey, unknown>`
|
|
1478
|
-
|
|
1479
|
-
| Name | Type |
|
|
1480
|
-
| --- | --- |
|
|
1481
|
-
| `column` (read-only) | `Column \| null` |
|
|
1482
|
-
| `field` (read-only) | `string \| null` |
|
|
1483
|
-
| `isNew` (read-only) | `boolean` |
|
|
1484
|
-
| `mode` (read-only) | `"cell" \| "row"` |
|
|
1485
|
-
| `operation` (read-only) | `GridEditOperation` |
|
|
1486
|
-
| `originalRowData` (read-only) | `T \| null` |
|
|
1487
|
-
| `rowData` (read-only) | `T` |
|
|
1488
|
-
|
|
1489
|
-
#### `GridEditSession`
|
|
1490
|
-
|
|
1491
|
-
| Name | Type | Description |
|
|
1492
|
-
| --- | --- | --- |
|
|
1493
|
-
| `column` (read-only) | `Column \| null` | The column currently being edited, in cell mode. |
|
|
1494
|
-
| `field` (read-only) | `string \| null` | The field name currently being edited, in cell mode. |
|
|
1495
|
-
| `form` (read-only) | `FieldTree<Record<PropertyKey, unknown>>` | The Signal Forms field tree backing the row being edited. |
|
|
1496
|
-
| `isNew` (read-only) | `boolean` | Whether this session represents a new row being added. |
|
|
1497
|
-
| `mode` (read-only) | `"cell" \| "row"` | The active editing mode. |
|
|
1498
|
-
| `model` (read-only) | `WritableSignal<Record<PropertyKey, unknown>>` | The signal holding the row's current edited values. |
|
|
1499
|
-
| `operation` (read-only) | `GridEditOperation` | `"create"` or `"update"`. |
|
|
1500
|
-
| `originalRowData` (read-only) | `Record<PropertyKey, unknown> \| null` | The row's data before editing began. |
|
|
1501
|
-
| `row` (read-only) | `Row \| null` | The internal row wrapper being edited. |
|
|
1502
|
-
| `rowUid` (read-only) | `string \| null` | The stable identifier of the row being edited. |
|
|
1503
|
-
|
|
1504
|
-
#### `GridEditTemplateContext`
|
|
1505
|
-
|
|
1506
|
-
| Name | Type | Description |
|
|
1507
|
-
| --- | --- | --- |
|
|
1508
|
-
| `cancel` (read-only) | `() => void` | Cancels the current edit. |
|
|
1509
|
-
| `column` (read-only) | `string` | The field name of the column being edited. |
|
|
1510
|
-
| `commit` (read-only) | `() => void` | Commits the current edit. |
|
|
1511
|
-
| `dataField` (read-only) | `string` | Same as `column`; the field name being edited. |
|
|
1512
|
-
| `dataItem` (read-only) | `Record<PropertyKey, unknown>` | The row's current edited values. |
|
|
1513
|
-
| `errors` (read-only) | `readonly ValidationError.WithFieldTree[]` | Validation errors for this field. |
|
|
1514
|
-
| `field` (read-only) | `FieldTree<unknown>` | The Signal Forms field for this column. |
|
|
1515
|
-
| `form` (read-only) | `GridEditSession["form"]` | The row's full Signal Forms field tree. |
|
|
1516
|
-
| `invalid` (read-only) | `boolean` | Whether this field currently fails validation. |
|
|
1517
|
-
| `isNew` (read-only) | `boolean` | Whether this is a new row being added. |
|
|
1518
|
-
| `session` (read-only) | `GridEditSession` | The full edit session for this row. |
|
|
1519
|
-
| `setValue` (read-only) | `(value: unknown) => void` | Sets this field's value. |
|
|
1520
|
-
| `touched` (read-only) | `boolean` | Whether this field has been touched. |
|
|
1521
|
-
| `value` (read-only) | `unknown` | This field's current value. |
|
|
1522
|
-
|
|
1523
|
-
#### `GridState`
|
|
1524
|
-
|
|
1525
|
-
| Name | Type | Description |
|
|
1526
|
-
| --- | --- | --- |
|
|
1527
|
-
| `columns` | `readonly GridColumnState[]` | Persisted per-column hidden/order/width state. |
|
|
1528
|
-
| `filter` | `readonly GridStateCompositeFilterDescriptor[]` | Persisted filter descriptors. |
|
|
1529
|
-
| `group` | `readonly GroupDescriptor[]` | Persisted group descriptors. |
|
|
1530
|
-
| `pageSize?` | `number` | Persisted page size, unless `persistPageSize` is `false`. |
|
|
1531
|
-
| `schemaVersion?` | `number \| string` | Consumer-defined version tag used to reject stale persisted state. |
|
|
1532
|
-
| `sort` | `readonly GridStateSortDescriptor[]` | Persisted sort descriptors. |
|
|
1533
|
-
| `version` | `GridStateVersion` | The state schema version produced by this version of the library. |
|
|
1534
|
-
|
|
1535
|
-
#### `GridStateCompositeFilterDescriptor`
|
|
1536
|
-
|
|
1537
|
-
| Name | Type |
|
|
1538
|
-
| --- | --- |
|
|
1539
|
-
| `filters` | `readonly (GridStateFilterDescriptor \| GridStateCompositeFilterDescriptor)[]` |
|
|
1540
|
-
| `logic` | `FilterLogic` |
|
|
1541
|
-
|
|
1542
|
-
#### `GridStateFilterDescriptor`
|
|
1543
|
-
|
|
1544
|
-
| Name | Type |
|
|
1545
|
-
| --- | --- |
|
|
1546
|
-
| `field` | `string` |
|
|
1547
|
-
| `operator` | `Exclude<FilterOperators, "function">` |
|
|
1548
|
-
| `value?` | `GridStateFilterValue` |
|
|
1549
|
-
|
|
1550
|
-
#### `GridStateLoadResult`
|
|
1551
|
-
|
|
1552
|
-
| Name | Type |
|
|
1553
|
-
| --- | --- |
|
|
1554
|
-
| `ignoredColumns` | `readonly string[]` |
|
|
1555
|
-
| `missingColumns` | `readonly string[]` |
|
|
1556
|
-
| `status` | `GridStateLoadStatus` |
|
|
1557
|
-
|
|
1558
|
-
#### `GridStatePersistenceOptions`
|
|
1559
|
-
|
|
1560
|
-
| Name | Type |
|
|
1561
|
-
| --- | --- |
|
|
1562
|
-
| `enabled?` | `boolean` |
|
|
1563
|
-
| `persistPageSize?` | `boolean` |
|
|
1564
|
-
| `schemaVersion?` | `number \| string` |
|
|
1565
|
-
|
|
1566
|
-
#### `GridStateSortDescriptor`
|
|
1567
|
-
|
|
1568
|
-
| Name | Type |
|
|
1569
|
-
| --- | --- |
|
|
1570
|
-
| `dir` | `SortDirection` |
|
|
1571
|
-
| `field` | `string` |
|
|
1572
|
-
|
|
1573
|
-
#### `GridToolbarTemplateContext`
|
|
457
|
+
#### `GridToolbarTemplateContext`
|
|
1574
458
|
|
|
1575
459
|
Context of `monaGridToolbarTemplate`: the toolbar state, also as `$implicit`.
|
|
1576
460
|
|
|
@@ -1580,67 +464,6 @@ Context of `monaGridToolbarTemplate`: the toolbar state, also as `$implicit`.
|
|
|
1580
464
|
| --- | --- |
|
|
1581
465
|
| `$implicit` (read-only) | `GridToolbarContext` |
|
|
1582
466
|
|
|
1583
|
-
#### `GroupableOptions`
|
|
1584
|
-
|
|
1585
|
-
| Name | Type | Description |
|
|
1586
|
-
| --- | --- | --- |
|
|
1587
|
-
| `enabled` | `boolean` | Whether grouping is active. |
|
|
1588
|
-
| `showFooter` | `boolean` | Whether a group's aggregate footer also shows while the group is collapsed; expanded groups always show it. |
|
|
1589
|
-
|
|
1590
|
-
#### `GroupDescriptor`
|
|
1591
|
-
|
|
1592
|
-
| Name | Type |
|
|
1593
|
-
| --- | --- |
|
|
1594
|
-
| `dir?` | `SortDirection` |
|
|
1595
|
-
| `field` | `string` |
|
|
1596
|
-
|
|
1597
|
-
#### `ReorderableOptions`
|
|
1598
|
-
|
|
1599
|
-
| Name | Type | Description |
|
|
1600
|
-
| --- | --- | --- |
|
|
1601
|
-
| `enabled` | `boolean` | Whether column reordering is active. On unless set to `false`; options replace earlier ones. |
|
|
1602
|
-
|
|
1603
|
-
#### `ResizableOptions`
|
|
1604
|
-
|
|
1605
|
-
| Name | Type | Description |
|
|
1606
|
-
| --- | --- | --- |
|
|
1607
|
-
| `enabled` | `boolean` | Whether column resizing is active. On unless set to `false`; options replace earlier ones. |
|
|
1608
|
-
|
|
1609
|
-
#### `RowReorderableOptions`
|
|
1610
|
-
|
|
1611
|
-
| Name | Type | Description |
|
|
1612
|
-
| --- | --- | --- |
|
|
1613
|
-
| `canReorder?` | `(rowData: Record<PropertyKey, unknown>) => boolean` | Determines whether an individual row may be reordered. Rows for which this returns false must show a disabled handle. |
|
|
1614
|
-
| `enabled?` | `boolean` | Enables row reordering. |
|
|
1615
|
-
| `rowAriaLabel?` | `(rowData: Record<PropertyKey, unknown>, absoluteIndex: number) => string` | Returns the accessible label fragment for a row's reorder handle. Locale-aware composition supplies sentence punctuation, keyboard instructions, and disabled reasons around this fragment. The default must be positional, such as: "Reorder row 3" |
|
|
1616
|
-
|
|
1617
|
-
#### `SelectableOptions`
|
|
1618
|
-
|
|
1619
|
-
| Name | Type | Description |
|
|
1620
|
-
| --- | --- | --- |
|
|
1621
|
-
| `enabled?` | `boolean` | Enables row selection. |
|
|
1622
|
-
| `mode?` | `"single" \| "multiple"` | Controls whether one or multiple rows can be selected. |
|
|
1623
|
-
| `rowAriaLabel?` | `(rowData: Record<PropertyKey, unknown>) => string` | Derives the accessible label for a row's selection checkbox from its data. When omitted, the checkbox falls back to a positional label (e.g. "Select row 3"). |
|
|
1624
|
-
| `selectAllScope?` | `"page" \| "view"` | Determines which rows are affected by the header checkbox. - "page": rows on the current paginated page - "view": all rows in the current filtered and sorted view For virtual scrolling, "page" resolves to the complete current view because virtual scrolling does not have logical pages. |
|
|
1625
|
-
| `selectOnRowClick?` | `boolean` | Whether clicking the row itself changes selection. Off by default so that clicking a row to interact with its content (a link, a button, an editable cell) never silently discards the current selection. Set this to true to also select rows via a plain click, in addition to checkboxes or application code. |
|
|
1626
|
-
| `showCheckboxes?` | `boolean` | Displays the built-in checkbox selection column. |
|
|
1627
|
-
| `showSelectAll?` | `boolean` | Displays a select-all checkbox in the selection-column header. Only applies to multiple-selection mode. |
|
|
1628
|
-
|
|
1629
|
-
#### `SortableOptions`
|
|
1630
|
-
|
|
1631
|
-
| Name | Type | Description |
|
|
1632
|
-
| --- | --- | --- |
|
|
1633
|
-
| `allowUnsort?` | `boolean` | Whether a third click on a sorted column clears its sort. |
|
|
1634
|
-
| `enabled?` | `boolean` | Whether sorting is active. On unless set to `false`; options replace earlier ones. |
|
|
1635
|
-
| `mode?` | `"single" \| "multiple"` | Whether one or several columns can be sorted at once. |
|
|
1636
|
-
| `showIndices?` | `boolean` | Whether sort order indices are displayed on header cells. |
|
|
1637
|
-
|
|
1638
|
-
#### `AggregateFunction`
|
|
1639
|
-
|
|
1640
|
-
```typescript
|
|
1641
|
-
type AggregateFunction = "sum" | "avg" | "count" | "min" | "max" | "custom";
|
|
1642
|
-
```
|
|
1643
|
-
|
|
1644
467
|
#### `ColumnFormat`
|
|
1645
468
|
|
|
1646
469
|
A date format string, for `date` columns, or a formatter function, for any column.
|
|
@@ -1664,169 +487,6 @@ type ColumnFormatFunction = { format(value: unknown, row: Record<PropertyKey, un
|
|
|
1664
487
|
type ColumnKind = "command" | "data";
|
|
1665
488
|
```
|
|
1666
489
|
|
|
1667
|
-
#### `ColumnSortComparator`
|
|
1668
|
-
|
|
1669
|
-
Compares two cell values for sorting: negative, zero or positive, as for `Array.prototype.sort`.
|
|
1670
|
-
|
|
1671
|
-
```typescript
|
|
1672
|
-
type ColumnSortComparator = { compare(left: unknown, right: unknown): number }["compare"];
|
|
1673
|
-
```
|
|
1674
|
-
|
|
1675
|
-
#### `GridCancelReason`
|
|
1676
|
-
|
|
1677
|
-
Why an edit is being canceled: `"command"` for the Cancel button or `cancel()` in a template, `"escape"` for
|
|
1678
|
-
the Escape key, `"switch"` when another edit or the add row starts, `"removed"` when the edited row left the
|
|
1679
|
-
data or the view. A `"removed"` cancel can't be prevented: the row is gone.
|
|
1680
|
-
|
|
1681
|
-
```typescript
|
|
1682
|
-
type GridCancelReason = "command" | "escape" | "removed" | "switch";
|
|
1683
|
-
```
|
|
1684
|
-
|
|
1685
|
-
#### `GridColumnLockedPosition`
|
|
1686
|
-
|
|
1687
|
-
```typescript
|
|
1688
|
-
type GridColumnLockedPosition = "left" | "right";
|
|
1689
|
-
```
|
|
1690
|
-
|
|
1691
|
-
#### `GridEditOperation`
|
|
1692
|
-
|
|
1693
|
-
```typescript
|
|
1694
|
-
type GridEditOperation = "create" | "update";
|
|
1695
|
-
```
|
|
1696
|
-
|
|
1697
|
-
#### `GridEditSchemaFactory`
|
|
1698
|
-
|
|
1699
|
-
Builds the Signal Forms schema for the row being edited. `T` is the row type, untyped unless you give one.
|
|
1700
|
-
|
|
1701
|
-
```typescript
|
|
1702
|
-
type GridEditSchemaFactory<T extends object = Record<PropertyKey, unknown>> = ( context: GridEditFormContext<T> ) => SchemaOrSchemaFn<T> | null | undefined;
|
|
1703
|
-
```
|
|
1704
|
-
|
|
1705
|
-
#### `GridKeySelector`
|
|
1706
|
-
|
|
1707
|
-
The field holding a row's key, or a function returning it.
|
|
1708
|
-
|
|
1709
|
-
```typescript
|
|
1710
|
-
type GridKeySelector<TData, TKey = unknown> = string | Selector<TData, TKey> | null;
|
|
1711
|
-
```
|
|
1712
|
-
|
|
1713
|
-
#### `GridRowClass`
|
|
1714
|
-
|
|
1715
|
-
Returns the classes to add to the data row that shows the given item.
|
|
1716
|
-
|
|
1717
|
-
```typescript
|
|
1718
|
-
type GridRowClass<TData> = (data: TData) => GridRowClassValue;
|
|
1719
|
-
```
|
|
1720
|
-
|
|
1721
|
-
#### `GridRowClassValue`
|
|
1722
|
-
|
|
1723
|
-
The classes a `GridRowClass` function adds to a data row. Nullish values add nothing.
|
|
1724
|
-
|
|
1725
|
-
```typescript
|
|
1726
|
-
type GridRowClassValue = string | readonly string[] | null | undefined;
|
|
1727
|
-
```
|
|
1728
|
-
|
|
1729
|
-
#### `GridRowCommand`
|
|
1730
|
-
|
|
1731
|
-
A row command button: Edit, Remove, Save or Cancel.
|
|
1732
|
-
|
|
1733
|
-
```typescript
|
|
1734
|
-
type GridRowCommand = "cancel" | "edit" | "remove" | "save";
|
|
1735
|
-
```
|
|
1736
|
-
|
|
1737
|
-
#### `GridSaveOperation`
|
|
1738
|
-
|
|
1739
|
-
```typescript
|
|
1740
|
-
type GridSaveOperation = GridEditOperation;
|
|
1741
|
-
```
|
|
1742
|
-
|
|
1743
|
-
#### `GridStateFilterValue`
|
|
1744
|
-
|
|
1745
|
-
```typescript
|
|
1746
|
-
type GridStateFilterValue = boolean | number | string | null | readonly (boolean | number | string | null)[];
|
|
1747
|
-
```
|
|
1748
|
-
|
|
1749
|
-
#### `GridStateLoadStatus`
|
|
1750
|
-
|
|
1751
|
-
The outcome of loading a state. `rejected-invalid`: the state isn't a well-formed `GridState` (a missing
|
|
1752
|
-
array, a duplicate column id, an unknown filter operator, a page size or width that isn't a positive
|
|
1753
|
-
number), and nothing was changed.
|
|
1754
|
-
|
|
1755
|
-
```typescript
|
|
1756
|
-
type GridStateLoadStatus = "applied" | "empty" | "rejected-invalid" | "rejected-schema" | "rejected-version";
|
|
1757
|
-
```
|
|
1758
|
-
|
|
1759
|
-
#### `GridStateVersion`
|
|
1760
|
-
|
|
1761
|
-
```typescript
|
|
1762
|
-
type GridStateVersion = 1;
|
|
1763
|
-
```
|
|
1764
|
-
|
|
1765
|
-
#### `ResizeMethod`
|
|
1766
|
-
|
|
1767
|
-
```typescript
|
|
1768
|
-
type ResizeMethod = "auto" | "fitView" | number;
|
|
1769
|
-
```
|
|
1770
|
-
|
|
1771
|
-
#### `ArrayFilterDescriptor`
|
|
1772
|
-
|
|
1773
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1774
|
-
|
|
1775
|
-
```typescript
|
|
1776
|
-
type ArrayFilterDescriptor = FieldDefinition & { operator: ArrayFilterOperators; value: readonly unknown[] };
|
|
1777
|
-
```
|
|
1778
|
-
|
|
1779
|
-
#### `ArrayFilterOperators`
|
|
1780
|
-
|
|
1781
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1782
|
-
|
|
1783
|
-
```typescript
|
|
1784
|
-
type ArrayFilterOperators = "in" | "notin";
|
|
1785
|
-
```
|
|
1786
|
-
|
|
1787
|
-
#### `BooleanFilterDescriptor`
|
|
1788
|
-
|
|
1789
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1790
|
-
|
|
1791
|
-
```typescript
|
|
1792
|
-
type BooleanFilterDescriptor = FieldDefinition & ({ operator: BooleanFilterOperators } | NullFilterDescriptor);
|
|
1793
|
-
```
|
|
1794
|
-
|
|
1795
|
-
#### `BooleanFilterOperators`
|
|
1796
|
-
|
|
1797
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1798
|
-
|
|
1799
|
-
```typescript
|
|
1800
|
-
type BooleanFilterOperators = "istrue" | "isfalse" | NullFilterOperators;
|
|
1801
|
-
```
|
|
1802
|
-
|
|
1803
|
-
#### `CommonFilterDescriptor`
|
|
1804
|
-
|
|
1805
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1806
|
-
|
|
1807
|
-
```typescript
|
|
1808
|
-
type CommonFilterDescriptor = FieldDefinition & { operator: CommonFilterOperators; value: unknown };
|
|
1809
|
-
```
|
|
1810
|
-
|
|
1811
|
-
#### `CommonFilterOperators`
|
|
1812
|
-
|
|
1813
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1814
|
-
|
|
1815
|
-
```typescript
|
|
1816
|
-
type CommonFilterOperators = "eq" | "neq";
|
|
1817
|
-
```
|
|
1818
|
-
|
|
1819
|
-
#### `CompositeFilterDescriptor`
|
|
1820
|
-
|
|
1821
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1822
|
-
|
|
1823
|
-
An empty `filters` list matches every item, whatever the logic.
|
|
1824
|
-
|
|
1825
|
-
| Name | Type |
|
|
1826
|
-
| --- | --- |
|
|
1827
|
-
| `filters` | `Array<FilterDescriptor \| CompositeFilterDescriptor>` |
|
|
1828
|
-
| `logic` | `FilterLogic` |
|
|
1829
|
-
|
|
1830
490
|
#### `DataType`
|
|
1831
491
|
|
|
1832
492
|
From `@nanahoshi/mona-ui/common`.
|
|
@@ -1835,197 +495,6 @@ From `@nanahoshi/mona-ui/common`.
|
|
|
1835
495
|
type DataType = "string" | "number" | "date" | "boolean";
|
|
1836
496
|
```
|
|
1837
497
|
|
|
1838
|
-
#### `DateFilterDescriptor`
|
|
1839
|
-
|
|
1840
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1841
|
-
|
|
1842
|
-
```typescript
|
|
1843
|
-
type DateFilterDescriptor = FieldDefinition & ( | { operator: DateFilterOperators; value: Date; } | NullFilterDescriptor );
|
|
1844
|
-
```
|
|
1845
|
-
|
|
1846
|
-
#### `DateFilterOperators`
|
|
1847
|
-
|
|
1848
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1849
|
-
|
|
1850
|
-
```typescript
|
|
1851
|
-
type DateFilterOperators = NumericFilterOperators | NullFilterOperators;
|
|
1852
|
-
```
|
|
1853
|
-
|
|
1854
|
-
#### `EmptyFilterDescriptor`
|
|
1855
|
-
|
|
1856
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1857
|
-
|
|
1858
|
-
```typescript
|
|
1859
|
-
type EmptyFilterDescriptor = FieldDefinition & { operator: EmptyFilterOperators };
|
|
1860
|
-
```
|
|
1861
|
-
|
|
1862
|
-
#### `EmptyFilterOperators`
|
|
1863
|
-
|
|
1864
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1865
|
-
|
|
1866
|
-
```typescript
|
|
1867
|
-
type EmptyFilterOperators = "isempty" | "isnotempty";
|
|
1868
|
-
```
|
|
1869
|
-
|
|
1870
|
-
#### `FieldDefinition`
|
|
1871
|
-
|
|
1872
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1873
|
-
|
|
1874
|
-
```typescript
|
|
1875
|
-
type FieldDefinition = { field: string };
|
|
1876
|
-
```
|
|
1877
|
-
|
|
1878
|
-
#### `FilterDescriptor`
|
|
1879
|
-
|
|
1880
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1881
|
-
|
|
1882
|
-
```typescript
|
|
1883
|
-
type FilterDescriptor = | CommonFilterDescriptor | BooleanFilterDescriptor | NumericFilterDescriptor | StringFilterDescriptor | DateFilterDescriptor | NullFilterDescriptor | EmptyFilterDescriptor | NullOrEmptyFilterDescriptor | ArrayFilterDescriptor | RangeFilterDescriptor | FunctionFilterDescriptor;
|
|
1884
|
-
```
|
|
1885
|
-
|
|
1886
|
-
#### `FilterLogic`
|
|
1887
|
-
|
|
1888
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1889
|
-
|
|
1890
|
-
```typescript
|
|
1891
|
-
type FilterLogic = "and" | "or";
|
|
1892
|
-
```
|
|
1893
|
-
|
|
1894
|
-
#### `FilterOperators`
|
|
1895
|
-
|
|
1896
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1897
|
-
|
|
1898
|
-
```typescript
|
|
1899
|
-
type FilterOperators = | CommonFilterOperators | BooleanFilterOperators | NumericFilterOperators | StringFilterOperators | DateFilterOperators | NullFilterOperators | EmptyFilterOperators | NullOrEmptyFilterOperators | ArrayFilterOperators | RangeFilterOperators | FunctionFilterOperators;
|
|
1900
|
-
```
|
|
1901
|
-
|
|
1902
|
-
#### `FunctionFilterDescriptor`
|
|
1903
|
-
|
|
1904
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1905
|
-
|
|
1906
|
-
```typescript
|
|
1907
|
-
type FunctionFilterDescriptor = FieldDefinition & { operator: FunctionFilterOperators; predicate(value: unknown): boolean; };
|
|
1908
|
-
```
|
|
1909
|
-
|
|
1910
|
-
#### `FunctionFilterOperators`
|
|
1911
|
-
|
|
1912
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1913
|
-
|
|
1914
|
-
```typescript
|
|
1915
|
-
type FunctionFilterOperators = "function";
|
|
1916
|
-
```
|
|
1917
|
-
|
|
1918
|
-
#### `NullFilterDescriptor`
|
|
1919
|
-
|
|
1920
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1921
|
-
|
|
1922
|
-
```typescript
|
|
1923
|
-
type NullFilterDescriptor = FieldDefinition & { operator: NullFilterOperators };
|
|
1924
|
-
```
|
|
1925
|
-
|
|
1926
|
-
#### `NullFilterOperators`
|
|
1927
|
-
|
|
1928
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1929
|
-
|
|
1930
|
-
```typescript
|
|
1931
|
-
type NullFilterOperators = "isnull" | "isnotnull";
|
|
1932
|
-
```
|
|
1933
|
-
|
|
1934
|
-
#### `NullOrEmptyFilterDescriptor`
|
|
1935
|
-
|
|
1936
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1937
|
-
|
|
1938
|
-
```typescript
|
|
1939
|
-
type NullOrEmptyFilterDescriptor = FieldDefinition & { operator: NullOrEmptyFilterOperators };
|
|
1940
|
-
```
|
|
1941
|
-
|
|
1942
|
-
#### `NullOrEmptyFilterOperators`
|
|
1943
|
-
|
|
1944
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1945
|
-
|
|
1946
|
-
```typescript
|
|
1947
|
-
type NullOrEmptyFilterOperators = "isnullorempty" | "isnotnullorempty";
|
|
1948
|
-
```
|
|
1949
|
-
|
|
1950
|
-
#### `NumericFilterDescriptor`
|
|
1951
|
-
|
|
1952
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1953
|
-
|
|
1954
|
-
```typescript
|
|
1955
|
-
type NumericFilterDescriptor = FieldDefinition & ( | { operator: NumericFilterOperators; value: number; } | NullFilterDescriptor );
|
|
1956
|
-
```
|
|
1957
|
-
|
|
1958
|
-
#### `NumericFilterOperators`
|
|
1959
|
-
|
|
1960
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1961
|
-
|
|
1962
|
-
```typescript
|
|
1963
|
-
type NumericFilterOperators = CommonFilterOperators | "gt" | "gte" | "lt" | "lte" | NullFilterOperators;
|
|
1964
|
-
```
|
|
1965
|
-
|
|
1966
|
-
#### `PreventableEvent`
|
|
1967
|
-
|
|
1968
|
-
From `@nanahoshi/mona-ui/common`.
|
|
1969
|
-
|
|
1970
|
-
**Type parameters:** `E extends Event = Event`
|
|
1971
|
-
|
|
1972
|
-
| Name | Type | Description |
|
|
1973
|
-
| --- | --- | --- |
|
|
1974
|
-
| `originalEvent` (read-only) | `E \| undefined` | The DOM event that caused this one, when there is one. |
|
|
1975
|
-
| `type` (read-only) | `string \| undefined` | A name for the kind of event, when the component that emits it sets one. |
|
|
1976
|
-
|
|
1977
|
-
**Methods**
|
|
1978
|
-
|
|
1979
|
-
| Signature | Description |
|
|
1980
|
-
| --- | --- |
|
|
1981
|
-
| `isDefaultPrevented(): boolean` | Whether `preventDefault()` was called. |
|
|
1982
|
-
| `preventDefault(): void` | Cancels what the event announces, such as opening or closing a popup, or closing a dialog. |
|
|
1983
|
-
|
|
1984
|
-
#### `RangeFilterBound`
|
|
1985
|
-
|
|
1986
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1987
|
-
|
|
1988
|
-
A bound of a range filter. `null` leaves that end open.
|
|
1989
|
-
|
|
1990
|
-
```typescript
|
|
1991
|
-
type RangeFilterBound = number | Date | string | null;
|
|
1992
|
-
```
|
|
1993
|
-
|
|
1994
|
-
#### `RangeFilterDescriptor`
|
|
1995
|
-
|
|
1996
|
-
From `@nanahoshi/mona-ui/query`.
|
|
1997
|
-
|
|
1998
|
-
`between` and `notbetween` include both bounds.
|
|
1999
|
-
|
|
2000
|
-
```typescript
|
|
2001
|
-
type RangeFilterDescriptor = FieldDefinition & { operator: RangeFilterOperators; value: readonly [from: RangeFilterBound, to: RangeFilterBound]; };
|
|
2002
|
-
```
|
|
2003
|
-
|
|
2004
|
-
#### `RangeFilterOperators`
|
|
2005
|
-
|
|
2006
|
-
From `@nanahoshi/mona-ui/query`.
|
|
2007
|
-
|
|
2008
|
-
```typescript
|
|
2009
|
-
type RangeFilterOperators = "between" | "notbetween";
|
|
2010
|
-
```
|
|
2011
|
-
|
|
2012
|
-
#### `SortDescriptor`
|
|
2013
|
-
|
|
2014
|
-
From `@nanahoshi/mona-ui/query`.
|
|
2015
|
-
|
|
2016
|
-
**Type parameters:** `TValue = unknown`
|
|
2017
|
-
|
|
2018
|
-
| Name | Type |
|
|
2019
|
-
| --- | --- |
|
|
2020
|
-
| `dir` | `SortDirection` |
|
|
2021
|
-
| `field` | `string` |
|
|
2022
|
-
|
|
2023
|
-
**Methods**
|
|
2024
|
-
|
|
2025
|
-
| Signature | Description |
|
|
2026
|
-
| --- | --- |
|
|
2027
|
-
| `sort(left: TValue, right: TValue): number` | Compares two values of `field` (not two rows). Return a negative number when `left` comes first in ascending order; `dir: "desc"` reverses the result. Empty values are passed in as they are. |
|
|
2028
|
-
|
|
2029
498
|
#### `SortDirection`
|
|
2030
499
|
|
|
2031
500
|
From `@nanahoshi/mona-ui/query`.
|
|
@@ -2034,20 +503,4 @@ From `@nanahoshi/mona-ui/query`.
|
|
|
2034
503
|
type SortDirection = "asc" | "desc";
|
|
2035
504
|
```
|
|
2036
505
|
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
From `@nanahoshi/mona-ui/query`.
|
|
2040
|
-
|
|
2041
|
-
```typescript
|
|
2042
|
-
type StringFilterDescriptor = FieldDefinition & ( | { operator: StringFilterOperators; value: string; } | NullFilterDescriptor | EmptyFilterDescriptor | NullOrEmptyFilterDescriptor );
|
|
2043
|
-
```
|
|
2044
|
-
|
|
2045
|
-
#### `StringFilterOperators`
|
|
2046
|
-
|
|
2047
|
-
From `@nanahoshi/mona-ui/query`.
|
|
2048
|
-
|
|
2049
|
-
```typescript
|
|
2050
|
-
type StringFilterOperators = | CommonFilterOperators | "startswith" | "endswith" | "contains" | "doesnotcontain" | NullFilterOperators | EmptyFilterOperators | NullOrEmptyFilterOperators;
|
|
2051
|
-
```
|
|
2052
|
-
|
|
2053
|
-
**Documented elsewhere:** [`PageChangeEvent`](pager.md), [`VirtualScrollOptions`](list-view.md)
|
|
506
|
+
**Documented elsewhere:** [`AggregateFunction`](grid-grouping.md), [`ColumnSortComparator`](grid-sorting-filtering.md), [`GridColumnLockedPosition`](grid-columns.md), [`GridDataState`](grid-server.md), [`GridEditSession`](grid-editing.md), [`GridKeySelector`](grid-selection.md), [`GridRowClass`](grid-rows.md), [`PageChangeEvent`](pager.md), [`ResizeMethod`](grid-columns.md)
|