@nanahoshi/mona-ui 0.26.1 → 0.26.3

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.
@@ -0,0 +1,238 @@
1
+ # Grouping & Aggregates
2
+
3
+ > Group rows by column values and show sums, averages and other aggregates in footers.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/grid`
6
+
7
+ **Selectors:** `mona-grid[monaGridGroupable]`, `ng-template[monaGridFooterTemplate]`, `ng-template[monaGridGroupFooterTemplate]`
8
+
9
+ `monaGridGroupable` lets people drag column headers into a group panel above the grid, and nests the rows under one expandable header per value. A column's `aggregate` adds a sum, average, count, minimum or maximum to the grid footer and to each group's footer.
10
+
11
+ ## Overview
12
+
13
+ Grouping and aggregates work on their own or together. An aggregate without grouping shows one footer row under the grid; with grouping, each expanded group shows its own footer too.
14
+
15
+ | Piece | Where | What it does |
16
+ | :--- | :--- | :--- |
17
+ | `monaGridGroupable` | `mona-grid` | The group panel, group headers, and the `[(group)]` model of `GroupDescriptor[]`. Emits `groupChange`. |
18
+ | `aggregate` | `mona-grid-column` | `"sum"`, `"avg"`, `"count"`, `"min"`, `"max"` or `"custom"`. |
19
+ | `monaGridFooterTemplate` | `mona-grid-column` | Replaces the column's value in the grid footer. |
20
+ | `monaGridGroupFooterTemplate` | `mona-grid-column` | Replaces the column's value in a group's footer. |
21
+
22
+ **Use something else when:**
23
+
24
+ - The data is a hierarchy of its own rather than rows sharing a value. Use [Tree View](tree-view.md).
25
+ - You only need a total outside the grid. Compute it from your data with a `computed`.
26
+
27
+ ## Import & Quick Start
28
+
29
+ ```typescript
30
+ import { GridColumnComponent, GridComponent, GridGroupableDirective, type GroupDescriptor } from "@nanahoshi/mona-ui/grid";
31
+ ```
32
+
33
+ ```typescript
34
+ protected readonly group = signal<GroupDescriptor[]>([{ field: "country", dir: "asc" }]);
35
+ ```
36
+
37
+ ```html
38
+ <mona-grid aria-label="Orders" [data]="orders()" [monaGridGroupable]="{ enabled: true, showFooter: true }" [(group)]="group">
39
+ <mona-grid-column field="country" title="Country"></mona-grid-column>
40
+ <mona-grid-column field="freight" title="Freight" type="number" aggregate="sum"></mona-grid-column>
41
+ </mona-grid>
42
+ ```
43
+
44
+ ## Anatomy
45
+
46
+ | Directive | Selector | Placed inside | Template context | Replaces |
47
+ | --- | --- | --- | --- | --- |
48
+ | `GridFooterTemplateDirective` | `ng-template[monaGridFooterTemplate]` | `mona-grid-column` | `{ $implicit, aggregate, aggregates, column, columnIndex, rows }`: `$implicit` is the column's aggregate value, `aggregate` the column's bucket (`{ field, sum?, avg?, count?, min?, max? }`) or `null`, `aggregates` the buckets by field, `rows` the data items of the whole view. The context type isn't exported. | The column's aggregate value in the grid footer |
49
+ | `GridGroupFooterTemplateDirective` | `ng-template[monaGridGroupFooterTemplate]` | `mona-grid-column` | The footer context, plus `count`, `depth`, `groupKey` and `groupValue` for the group; `rows` and the aggregates cover that group's rows. The context type isn't exported. | The column's aggregate value in a group's footer |
50
+
51
+ ## Examples
52
+
53
+ ### Grouped Totals
54
+
55
+ `aggregates-example.component.ts`
56
+
57
+ ```typescript
58
+ import { DecimalPipe } from "@angular/common";
59
+ import { Component, signal } from "@angular/core";
60
+ import {
61
+ GridColumnComponent,
62
+ GridComponent,
63
+ GridFooterTemplateDirective,
64
+ GridGroupableDirective,
65
+ GridGroupFooterTemplateDirective,
66
+ type GroupDescriptor
67
+ } from "@nanahoshi/mona-ui/grid";
68
+
69
+ @Component({
70
+ selector: "app-grid-grouping-aggregates-example",
71
+ imports: [
72
+ DecimalPipe,
73
+ GridColumnComponent,
74
+ GridComponent,
75
+ GridFooterTemplateDirective,
76
+ GridGroupableDirective,
77
+ GridGroupFooterTemplateDirective
78
+ ],
79
+ templateUrl: "./aggregates-example.component.html"
80
+ })
81
+ export class GridAggregatesExampleComponent {
82
+ protected readonly group = signal<GroupDescriptor[]>([{ field: "region", dir: "asc" }]);
83
+ protected readonly sales = [
84
+ { id: 1, region: "North", rep: "Amara Okafor", units: 42, revenue: 12600 },
85
+ { id: 2, region: "North", rep: "Lukas Weber", units: 31, revenue: 9300 },
86
+ { id: 3, region: "South", rep: "Mei Tanaka", units: 58, revenue: 17400 },
87
+ { id: 4, region: "South", rep: "Diego Ramos", units: 19, revenue: 5700 },
88
+ { id: 5, region: "South", rep: "Sofia Rossi", units: 27, revenue: 8100 },
89
+ { id: 6, region: "West", rep: "Noah Clarke", units: 36, revenue: 10800 }
90
+ ];
91
+ }
92
+ ```
93
+
94
+ `aggregates-example.component.html`
95
+
96
+ ```html
97
+ <mona-grid
98
+ aria-label="Sales by region"
99
+ rowKey="id"
100
+ [data]="sales"
101
+ [monaGridGroupable]="{ enabled: true, showFooter: true }"
102
+ [pageSize]="10"
103
+ [(group)]="group">
104
+ <mona-grid-column field="region" title="Region" />
105
+ <mona-grid-column aggregate="count" field="rep" title="Rep">
106
+ <ng-template monaGridFooterTemplate let-count>{{ count }} reps</ng-template>
107
+ <ng-template monaGridGroupFooterTemplate let-count>{{ count }} reps</ng-template>
108
+ </mona-grid-column>
109
+ <mona-grid-column aggregate="avg" field="units" title="Units" type="number">
110
+ <ng-template monaGridFooterTemplate let-average>Average {{ average | number: "1.0-1" }}</ng-template>
111
+ <ng-template monaGridGroupFooterTemplate let-average>Average {{ average | number: "1.0-1" }}</ng-template>
112
+ </mona-grid-column>
113
+ <mona-grid-column aggregate="sum" field="revenue" title="Revenue" type="number" />
114
+ </mona-grid>
115
+ ```
116
+
117
+ Each column with an `aggregate` shows its value in the footer: the count of reps, the average units and the sum of revenue, for the whole view and for each region. `showFooter: true` keeps a group's footer visible while the group is collapsed.
118
+
119
+ ### Grouping from Code
120
+
121
+ Set the `group` model to group without a drag. Each descriptor names a `field` and, optionally, a `dir` for the order of the group headers:
122
+
123
+ ```typescript
124
+ this.group.set([{ field: "country", dir: "asc" }, { field: "shipped", dir: "desc" }]);
125
+ ```
126
+
127
+ A repeated field keeps its last descriptor. `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.
128
+
129
+ ### Custom Aggregates
130
+
131
+ `aggregate="custom"` reserves a footer cell that the grid doesn't fill: give the column a `monaGridFooterTemplate`, and for grouped rows a `monaGridGroupFooterTemplate`, and compute the value from `rows` in the context.
132
+
133
+ ```html
134
+ <mona-grid-column field="freight" title="Freight" type="number" aggregate="custom">
135
+ <ng-template monaGridFooterTemplate let-rows="rows">{{ heaviest(rows) }}</ng-template>
136
+ </mona-grid-column>
137
+ ```
138
+
139
+ ## Behavior
140
+
141
+ ### What forms a group
142
+
143
+ `null`, `undefined` and empty text form one group; `1` and `"1"` are different groups; dates group by their time.
144
+
145
+ ### What an aggregate covers
146
+
147
+ Aggregates cover the whole view: every filtered row, not only the current page, in the footer and in each group footer. With server binding they cover the loaded page. `count` counts values that aren't empty; `sum` and `avg` use numbers and numeric text (`"12.5"`), and the sum of no numbers is `0`.
148
+
149
+ ### Footers and virtual scrolling
150
+
151
+ While virtual scrolling is on, the grid shows no aggregate footer under the grid. Group footers still show, at the virtual row height.
152
+
153
+ ### Grouping with other features
154
+
155
+ Grouped rows can be sorted, filtered, selected, edited and paged. Row reordering turns itself off while rows are grouped. With server binding, grouping and aggregates work on the loaded page only, and `group` isn't part of the request.
156
+
157
+ ## Accessibility
158
+
159
+ While rows are grouped, the grid's role is `treegrid`, and each row has an `aria-level`. Moving a column into the group panel from the keyboard is announced through a polite live region (the `columnGrouped` message).
160
+
161
+ ### Keyboard
162
+
163
+ | Key | Action |
164
+ | --- | --- |
165
+ | `Ctrl+Shift+G` / `Cmd+Shift+G` | On a header, groups the rows by its column and announces it. |
166
+ | `Enter` / `Alt+ArrowDown` | On a group row, expands or collapses it. |
167
+ | `ArrowRight` / `ArrowLeft` | On a group row, expands/collapses it first (mirrored in right-to-left layouts); on an expanded/collapsed group, moves as usual. |
168
+ | `Delete` / `Backspace` | On a chip in the group panel, removes that grouping. |
169
+
170
+ The rest of the grid's keys are on [Grid Overview](grid.md#keyboard).
171
+
172
+ ### ARIA
173
+
174
+ | Attribute | When present | Value |
175
+ | --- | --- | --- |
176
+ | `role` | On the tabular content region | `"treegrid"` while rows are grouped |
177
+ | `aria-expanded` | On a group header row | Whether the group is expanded |
178
+ | `aria-level` | On rows of a grouped grid | The group's nesting depth; data rows sit one level below their group |
179
+ | `aria-rowcount` | On the tabular content region | `-1` when paged groups make the count unknown |
180
+
181
+ ## API
182
+
183
+ Everything below is imported from `@nanahoshi/mona-ui/grid`.
184
+
185
+ ### `GridGroupableDirective`
186
+
187
+ **Selector:** `mona-grid[monaGridGroupable]`
188
+
189
+ #### Inputs
190
+
191
+ | Name | Type | Default | Description |
192
+ | --- | --- | --- | --- |
193
+ | `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. |
194
+ | `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`. |
195
+
196
+ #### Outputs
197
+
198
+ | Name | Type | Description |
199
+ | --- | --- | --- |
200
+ | `groupChange` | `GroupDescriptor[]` | Emitted when `group` changes. |
201
+
202
+ ### `GridFooterTemplateDirective`
203
+
204
+ **Selector:** `ng-template[monaGridFooterTemplate]`
205
+
206
+ ### `GridGroupFooterTemplateDirective`
207
+
208
+ **Selector:** `ng-template[monaGridGroupFooterTemplate]`
209
+
210
+ ### Types
211
+
212
+ #### `GroupableOptions`
213
+
214
+ | Name | Type | Description |
215
+ | --- | --- | --- |
216
+ | `enabled` | `boolean` | Whether grouping is active. |
217
+ | `showFooter` | `boolean` | Whether a group's aggregate footer also shows while the group is collapsed; expanded groups always show it. |
218
+
219
+ #### `GroupDescriptor`
220
+
221
+ | Name | Type |
222
+ | --- | --- |
223
+ | `dir?` | `SortDirection` |
224
+ | `field` | `string` |
225
+
226
+ #### `AggregateFunction`
227
+
228
+ ```typescript
229
+ type AggregateFunction = "sum" | "avg" | "count" | "min" | "max" | "custom";
230
+ ```
231
+
232
+ #### `SortDirection`
233
+
234
+ From `@nanahoshi/mona-ui/query`.
235
+
236
+ ```typescript
237
+ type SortDirection = "asc" | "desc";
238
+ ```
@@ -0,0 +1,297 @@
1
+ # Rows
2
+
3
+ > Expandable detail rows, row reordering by drag or keyboard, row classes and row sizing.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/grid`
6
+
7
+ **Selectors:** `ng-template[monaGridDetailTemplate]`, `mona-grid[monaGridRowReorderable]`
8
+
9
+ A `monaGridDetailTemplate` gives each row an expandable detail row underneath, for content that doesn't fit the columns. `monaGridRowReorderable` adds a drag handle to each row so people can put rows in their own order. Rows also take classes from `rowClass`, and grow to fit their cell templates.
10
+
11
+ ## Overview
12
+
13
+ | What | How | State and events |
14
+ | :--- | :--- | :--- |
15
+ | Detail rows | `monaGridDetailTemplate` inside `mona-grid` | `[(expandedKeys)]` on the grid |
16
+ | Row reordering | `monaGridRowReorderable` | `rowReorder` with the reordered data |
17
+ | Row classes | `rowClass` on the grid | — |
18
+ | Row height | Cell templates and editors | — |
19
+
20
+ Detail rows and row reordering both identify rows by the grid's `rowKey`, so set it.
21
+
22
+ **Use something else when:**
23
+
24
+ - The detail is a hierarchy of rows like its parent's. Group the rows instead, see [Grouping & Aggregates](grid-grouping.md).
25
+ - The order is a value people choose, such as a priority. Make it a column and sort by it, see [Sorting & Filtering](grid-sorting-filtering.md).
26
+
27
+ ## Import & Quick Start
28
+
29
+ ```typescript
30
+ import {
31
+ GridColumnComponent,
32
+ GridComponent,
33
+ GridDetailTemplateDirective,
34
+ GridRowReorderableDirective,
35
+ type RowReorderEvent
36
+ } from "@nanahoshi/mona-ui/grid";
37
+ ```
38
+
39
+ ```html
40
+ <mona-grid aria-label="Products" rowKey="id" [data]="products()" monaGridRowReorderable (rowReorder)="onRowReorder($event)">
41
+ <mona-grid-column field="name" title="Name"></mona-grid-column>
42
+ <ng-template monaGridDetailTemplate let-product>
43
+ <p class="p-3">{{ product.description }}</p>
44
+ </ng-template>
45
+ </mona-grid>
46
+ ```
47
+
48
+ ```typescript
49
+ protected onRowReorder(event: RowReorderEvent<Product>): void {
50
+ this.products.set([...event.reorderedData]);
51
+ }
52
+ ```
53
+
54
+ ## Examples
55
+
56
+ ### Detail Rows and Row Reordering
57
+
58
+ `master-detail-example.component.ts`
59
+
60
+ ```typescript
61
+ import { Component, signal } from "@angular/core";
62
+ import {
63
+ GridColumnComponent,
64
+ GridComponent,
65
+ GridDetailTemplateDirective,
66
+ GridRowReorderableDirective,
67
+ type RowReorderEvent
68
+ } from "@nanahoshi/mona-ui/grid";
69
+
70
+ type Task = Record<PropertyKey, unknown> & {
71
+ id: number;
72
+ notes: string;
73
+ owner: string;
74
+ title: string;
75
+ };
76
+
77
+ @Component({
78
+ selector: "app-grid-rows-master-detail-example",
79
+ imports: [GridColumnComponent, GridComponent, GridDetailTemplateDirective, GridRowReorderableDirective],
80
+ templateUrl: "./master-detail-example.component.html"
81
+ })
82
+ export class GridMasterDetailExampleComponent {
83
+ protected readonly expandedKeys = signal<unknown[]>([2]);
84
+ protected readonly tasks = signal<Task[]>([
85
+ { id: 1, title: "Draft the release notes", owner: "Amara Okafor", notes: "Cover the new grid pages." },
86
+ { id: 2, title: "Review the migration guide", owner: "Lukas Weber", notes: "Check every renamed input." },
87
+ { id: 3, title: "Record the demo video", owner: "Mei Tanaka", notes: "Two minutes, captions on." },
88
+ { id: 4, title: "Publish the package", owner: "Diego Ramos", notes: "After the release notes are in." }
89
+ ]);
90
+
91
+ protected onRowReorder(event: RowReorderEvent): void {
92
+ // The grid never changes the data: set the new order to keep it.
93
+ this.tasks.set([...event.reorderedData] as Task[]);
94
+ }
95
+ }
96
+ ```
97
+
98
+ `master-detail-example.component.html`
99
+
100
+ ```html
101
+ <mona-grid
102
+ aria-label="Release tasks"
103
+ rowKey="id"
104
+ [data]="tasks()"
105
+ [pageSize]="10"
106
+ monaGridRowReorderable
107
+ (rowReorder)="onRowReorder($event)"
108
+ [(expandedKeys)]="expandedKeys">
109
+ <mona-grid-column field="title" title="Task" />
110
+ <mona-grid-column field="owner" title="Owner" />
111
+ <ng-template monaGridDetailTemplate let-task>
112
+ <p class="p-3 text-sm">{{ task.notes }}</p>
113
+ </ng-template>
114
+ </mona-grid>
115
+ ```
116
+
117
+ Task 2 starts expanded, because its key is in `expandedKeys`. Drag a row's handle, or press `Alt+ArrowDown` on it, to move it; the example keeps the new order by setting its data to `reorderedData`.
118
+
119
+ ### Restricting Which Rows Move
120
+
121
+ An options object can keep some rows in place and name the handles after their row:
122
+
123
+ ```html
124
+ <mona-grid
125
+ [data]="products()"
126
+ rowKey="id"
127
+ [monaGridRowReorderable]="{ enabled: true, canReorder: canReorderProduct, rowAriaLabel: productLabel }"
128
+ (rowReorder)="onRowReorder($event)">
129
+ </mona-grid>
130
+ ```
131
+
132
+ ```typescript
133
+ protected readonly canReorderProduct = (row: Record<PropertyKey, unknown>): boolean => row["status"] !== "archived";
134
+ protected readonly productLabel = (row: Record<PropertyKey, unknown>): string => `Move ${String(row["name"])}`;
135
+ ```
136
+
137
+ A row that can't move shows a disabled handle.
138
+
139
+ ### Row Classes
140
+
141
+ `rowClass` returns classes for each data row from its item, such as a muted row for a cancelled order:
142
+
143
+ ```html
144
+ <mona-grid [data]="orders()" [rowClass]="orderRowClass"></mona-grid>
145
+ ```
146
+
147
+ ```typescript
148
+ protected readonly orderRowClass = (order: Order): string | null => (order.cancelled ? "opacity-60" : null);
149
+ ```
150
+
151
+ It can return a string, an array of strings, or `null` for none. Use it for emphasis, not to carry information: the row's text must say the same thing.
152
+
153
+ ### Rows That Fit Their Content
154
+
155
+ 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.
156
+
157
+ ```html
158
+ <mona-grid [data]="users()">
159
+ <mona-grid-column field="name" title="User">
160
+ <ng-template monaGridCellTemplate let-user>
161
+ <div class="flex items-center gap-3">
162
+ <mona-avatar
163
+ [label]="user.initials"
164
+ [width]="48"
165
+ [height]="48"
166
+ labelColor="white"
167
+ backgroundColor="#44607e"
168
+ borderRadius="50%" />
169
+ <div>
170
+ <div>{{ user.name }}</div>
171
+ <div>{{ user.email }}</div>
172
+ </div>
173
+ </div>
174
+ </ng-template>
175
+ </mona-grid-column>
176
+ </mona-grid>
177
+ ```
178
+
179
+ Import `GridCellTemplateDirective` from `@nanahoshi/mona-ui/grid` and `AvatarComponent` from `@nanahoshi/mona-ui/avatar` alongside the Grid and column components. Virtual rows are different: they all have one height, see [Server Binding & Virtualization](grid-server.md).
180
+
181
+ ## Behavior
182
+
183
+ ### Detail rows
184
+
185
+ The detail toggle sits in its own column at the start of the grid. `expandedKeys` holds the `rowKey` values of the expanded rows, or the data items when the grid has no `rowKey`; `expandedKeysChange` reports the rows people open and close. Detail rows aren't supported with `monaGridVirtualScroll`, whose rows share one height: the grid ignores the template there and warns in development mode. While detail rows exist, `aria-rowcount` is `-1`, since the grid can't know how many rows the details add.
186
+
187
+ ### Row reordering
188
+
189
+ The handle sits in a column of its own, the first in the grid, and rows move only by that handle. The consumer owns the order: `rowReorder` carries the complete reordered data, and the grid never changes `data`. Row order is application data and isn't stored in `GridState`.
190
+
191
+ Row reordering works with paging (moving rows within the current page), detail rows, selection, locked columns, footers, and the add row. It's disabled while sorting, filtering, grouping, server binding, virtual scrolling, or an edit is active, because those change which row sits where; the handle then says why (the `rowReorderDisabled…` messages).
192
+
193
+ ## Accessibility
194
+
195
+ A row's handle is a button named after the row (`reorderRow`, or `rowAriaLabel`), with the keyboard hint and, when it's disabled, the reason. A keyboard move is announced through a polite live region (`rowReorderMoved`). The detail toggle is a button named by the `expandDetail`/`collapseDetail` messages.
196
+
197
+ ### Keyboard
198
+
199
+ | Key | Action |
200
+ | --- | --- |
201
+ | `Enter` / `Alt+ArrowDown` | On a row's detail toggle cell, expands or collapses its detail row. |
202
+ | `Alt+ArrowUp` / `Alt+ArrowDown` | On a reorder handle, moves the row up/down one place. Focus stays on the handle, so the row can keep moving. |
203
+
204
+ The rest of the grid's keys are on [Grid Overview](grid.md#keyboard).
205
+
206
+ ### ARIA
207
+
208
+ | Attribute | When present | Value |
209
+ | --- | --- | --- |
210
+ | `aria-expanded` | On the detail toggle button | Whether the detail row is open |
211
+ | `aria-label` | On the detail toggle button | `expandDetail` / `collapseDetail` for its row |
212
+ | `aria-label` | On a row reorder handle | The row's name, the keyboard hint and, when disabled, the reason |
213
+ | `aria-rowcount` | On the tabular content region | `-1` while detail rows make the count unknown |
214
+
215
+ ## API
216
+
217
+ Everything below is imported from `@nanahoshi/mona-ui/grid`.
218
+
219
+ ### `GridRowReorderableDirective`
220
+
221
+ **Selector:** `mona-grid[monaGridRowReorderable]`
222
+
223
+ #### Inputs
224
+
225
+ | Name | Type | Default | Description |
226
+ | --- | --- | --- | --- |
227
+ | `monaGridRowReorderable` | `RowReorderableOptions \| ""` | `""` | Enables row reordering via the reorder-handle column. Pass a `RowReorderableOptions` object to configure it explicitly. |
228
+
229
+ #### Outputs
230
+
231
+ | Name | Type | Description |
232
+ | --- | --- | --- |
233
+ | `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. |
234
+
235
+ ### `GridDetailTemplateDirective`
236
+
237
+ **Selector:** `ng-template[monaGridDetailTemplate]`
238
+
239
+ ### `RowReorderEvent`
240
+
241
+ **Type parameters:** `TData extends Record<PropertyKey, unknown> = Record<PropertyKey, unknown>`
242
+ **Extends:** `PreventableEvent`
243
+
244
+ #### Properties
245
+
246
+ | Name | Type |
247
+ | --- | --- |
248
+ | `currentIndex` (read-only) | `number` |
249
+ | `currentPageIndex` (read-only) | `number` |
250
+ | `previousIndex` (read-only) | `number` |
251
+ | `previousPageIndex` (read-only) | `number` |
252
+ | `reorderedData` (read-only) | `readonly TData[]` |
253
+ | `rowData` (read-only) | `TData` |
254
+
255
+ ### Types
256
+
257
+ #### `RowReorderableOptions`
258
+
259
+ | Name | Type | Description |
260
+ | --- | --- | --- |
261
+ | `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. |
262
+ | `enabled?` | `boolean` | Enables row reordering. |
263
+ | `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" |
264
+
265
+ #### `GridRowClass`
266
+
267
+ Returns the classes to add to the data row that shows the given item.
268
+
269
+ ```typescript
270
+ type GridRowClass<TData> = (data: TData) => GridRowClassValue;
271
+ ```
272
+
273
+ #### `GridRowClassValue`
274
+
275
+ The classes a `GridRowClass` function adds to a data row. Nullish values add nothing.
276
+
277
+ ```typescript
278
+ type GridRowClassValue = string | readonly string[] | null | undefined;
279
+ ```
280
+
281
+ #### `PreventableEvent`
282
+
283
+ From `@nanahoshi/mona-ui/common`.
284
+
285
+ **Type parameters:** `E extends Event = Event`
286
+
287
+ | Name | Type | Description |
288
+ | --- | --- | --- |
289
+ | `originalEvent` (read-only) | `E \| undefined` | The DOM event that caused this one, when there is one. |
290
+ | `type` (read-only) | `string \| undefined` | A name for the kind of event, when the component that emits it sets one. |
291
+
292
+ **Methods**
293
+
294
+ | Signature | Description |
295
+ | --- | --- |
296
+ | `isDefaultPrevented(): boolean` | Whether `preventDefault()` was called. |
297
+ | `preventDefault(): void` | Cancels what the event announces, such as opening or closing a popup, or closing a dialog. |