@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
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
# Sorting & Filtering
|
|
2
|
+
|
|
3
|
+
> Sort rows by column headers and filter them from a header menu or a filter row.
|
|
4
|
+
|
|
5
|
+
Entry point: `@nanahoshi/mona-ui/grid`
|
|
6
|
+
|
|
7
|
+
**Selectors:** `mona-grid[monaGridSortable]`, `mona-grid[monaGridFilterable]`
|
|
8
|
+
|
|
9
|
+
`monaGridSortable` sorts rows when a column header is activated, by one column or several. `monaGridFilterable` adds filter controls to each column, in a header menu, a filter row under the headers, or both. Both keep their state in a two-way model you can also set from code.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Without server binding, the grid sorts and filters `data` itself, across every row, and then pages the result. With `monaGridServerBinding` it asks your server to do it, see [Server Binding & Virtualization](grid-server.md).
|
|
14
|
+
|
|
15
|
+
| Directive | State you bind | Events |
|
|
16
|
+
| :--- | :--- | :--- |
|
|
17
|
+
| `monaGridSortable` | `[(sort)]`: `SortDescriptor[]` | `columnSort` (cancelable), `sortChange` |
|
|
18
|
+
| `monaGridFilterable` | `[(filter)]`: `CompositeFilterDescriptor[]` | `filterChange` |
|
|
19
|
+
|
|
20
|
+
`SortDescriptor` and `CompositeFilterDescriptor` come from `@nanahoshi/mona-ui/query`, the same descriptors `Query` runs, so a server can apply them with the same code.
|
|
21
|
+
|
|
22
|
+
**Use something else when:**
|
|
23
|
+
|
|
24
|
+
- The subset is chosen by your own controls and shouldn't show in the columns. Bind a filtered `computed` to `data` instead, see [Grid Overview](grid.md#changing-the-data).
|
|
25
|
+
|
|
26
|
+
## Import & Quick Start
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { GridColumnComponent, GridComponent, GridFilterableDirective, GridSortableDirective } from "@nanahoshi/mona-ui/grid";
|
|
30
|
+
import type { CompositeFilterDescriptor, SortDescriptor } from "@nanahoshi/mona-ui/query";
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
protected readonly sort = signal<SortDescriptor[]>([{ dir: "desc", field: "orderDate" }]);
|
|
35
|
+
protected readonly filter = signal<CompositeFilterDescriptor[]>([]);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```html
|
|
39
|
+
<mona-grid
|
|
40
|
+
aria-label="Orders"
|
|
41
|
+
[data]="orders()"
|
|
42
|
+
monaGridSortable
|
|
43
|
+
[monaGridFilterable]="{ enabled: true, type: 'menu' }"
|
|
44
|
+
[(sort)]="sort"
|
|
45
|
+
[(filter)]="filter">
|
|
46
|
+
...
|
|
47
|
+
</mona-grid>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Examples
|
|
51
|
+
|
|
52
|
+
### Sorting and Filtering Together
|
|
53
|
+
|
|
54
|
+
`sorting-filtering-example.component.ts`
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { Component, signal } from "@angular/core";
|
|
58
|
+
import {
|
|
59
|
+
GridColumnComponent,
|
|
60
|
+
GridComponent,
|
|
61
|
+
GridFilterableDirective,
|
|
62
|
+
GridSortableDirective
|
|
63
|
+
} from "@nanahoshi/mona-ui/grid";
|
|
64
|
+
import type { CompositeFilterDescriptor, SortDescriptor } from "@nanahoshi/mona-ui/query";
|
|
65
|
+
|
|
66
|
+
@Component({
|
|
67
|
+
selector: "app-grid-sorting-filtering-sorting-filtering-example",
|
|
68
|
+
imports: [GridColumnComponent, GridComponent, GridFilterableDirective, GridSortableDirective],
|
|
69
|
+
templateUrl: "./sorting-filtering-example.component.html"
|
|
70
|
+
})
|
|
71
|
+
export class GridSortingFilteringExampleComponent {
|
|
72
|
+
protected readonly filter = signal<CompositeFilterDescriptor[]>([]);
|
|
73
|
+
protected readonly orders = [
|
|
74
|
+
{ id: 10248, customer: "Vins et alcools", shippedOn: new Date(2026, 6, 16), freight: 32.38, paid: true },
|
|
75
|
+
{ id: 10249, customer: "Toms Spezialitäten", shippedOn: new Date(2026, 6, 10), freight: 11.61, paid: true },
|
|
76
|
+
{ id: 10250, customer: "Hanari Carnes", shippedOn: new Date(2026, 6, 12), freight: 65.83, paid: false },
|
|
77
|
+
{ id: 10251, customer: "Victuailles en stock", shippedOn: new Date(2026, 6, 15), freight: 41.34, paid: true },
|
|
78
|
+
{ id: 10252, customer: "Suprêmes délices", shippedOn: new Date(2026, 6, 11), freight: 51.3, paid: false },
|
|
79
|
+
{ id: 10253, customer: "Hanari Carnes", shippedOn: new Date(2026, 6, 16), freight: 58.17, paid: true },
|
|
80
|
+
{ id: 10254, customer: "Chop-suey Chinese", shippedOn: new Date(2026, 6, 23), freight: 22.98, paid: false },
|
|
81
|
+
{ id: 10255, customer: "Richter Supermarkt", shippedOn: new Date(2026, 6, 15), freight: 148.33, paid: true }
|
|
82
|
+
];
|
|
83
|
+
protected readonly sort = signal<SortDescriptor[]>([{ field: "freight", dir: "desc" }]);
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`sorting-filtering-example.component.html`
|
|
88
|
+
|
|
89
|
+
```html
|
|
90
|
+
<mona-grid
|
|
91
|
+
aria-label="Orders"
|
|
92
|
+
[data]="orders"
|
|
93
|
+
[monaGridFilterable]="{ enabled: true, type: 'menu, row' }"
|
|
94
|
+
[monaGridSortable]="{ mode: 'multiple', allowUnsort: true }"
|
|
95
|
+
[pageSize]="5"
|
|
96
|
+
[(filter)]="filter"
|
|
97
|
+
[(sort)]="sort">
|
|
98
|
+
<mona-grid-column field="id" title="Order" type="number" [sortable]="false" [width]="100" />
|
|
99
|
+
<mona-grid-column field="customer" title="Customer" />
|
|
100
|
+
<mona-grid-column field="shippedOn" title="Shipped" type="date" />
|
|
101
|
+
<mona-grid-column field="freight" title="Freight" type="number" />
|
|
102
|
+
<mona-grid-column field="paid" title="Paid" type="boolean" />
|
|
103
|
+
</mona-grid>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Pass an object to `monaGridSortable` to configure the sort mode, unsorting, or index display, as the example does with `{ mode: 'multiple', allowUnsort: true }`. The filter type `'menu, row'` shows both the header menu and the filter row. `[sortable]="false"` turns header sorting off for the Order column.
|
|
107
|
+
|
|
108
|
+
### Sort Order
|
|
109
|
+
|
|
110
|
+
A `SortDescriptor` names a `field` and a `dir`, and can bring its own compare function:
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
interface SortDescriptor<TValue = unknown> {
|
|
114
|
+
dir: "asc" | "desc";
|
|
115
|
+
field: string;
|
|
116
|
+
/** Compares two values of `field`; `dir: "desc"` reverses the result. */
|
|
117
|
+
sort?(left: TValue, right: TValue): number;
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
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 restored grid state updates `sort` too.
|
|
122
|
+
|
|
123
|
+
In `mode: "multiple"`, sorted headers show their one-based priority next to the direction icon: the first sorted column is `1`, the next is `2`. Changing direction keeps the priority; unsorting a column renumbers the rest. `showIndices: false` hides the numbers. Single mode shows only the direction icon. Clicking a sorted header turns it around; with `allowUnsort`, a third click clears it.
|
|
124
|
+
|
|
125
|
+
### Custom Comparison
|
|
126
|
+
|
|
127
|
+
Without a comparator, values sort by type, with empty values first and strings by the locale. Give a column a `sortComparator` to compare its values your way, such as by a status's rank instead of its name:
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
const RANK: Record<string, number> = { Open: 0, Shipped: 1, Closed: 2 };
|
|
131
|
+
|
|
132
|
+
protected readonly byRank = (left: unknown, right: unknown): number => RANK[String(left)] - RANK[String(right)];
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
```html
|
|
136
|
+
<mona-grid-column field="status" title="Status" [sortComparator]="byRank"></mona-grid-column>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
A column's `sortComparator`, or a descriptor's own `sort` function, is kept when the user clicks the header. `dir: "desc"` reverses what it returns.
|
|
140
|
+
|
|
141
|
+
### Filtering from Code
|
|
142
|
+
|
|
143
|
+
Set the `filter` model to apply conditions and show them in the column's filter UI:
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
protected onShipChange(shipName: string | null): void {
|
|
147
|
+
this.filter.set(
|
|
148
|
+
shipName ? [{ logic: "and", filters: [{ field: "shipName", operator: "eq", value: shipName }] }] : []
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
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. With `[monaGridFilterable]="{ enabled: false }"` the filter UI is hidden, but a `filter` set from code still applies.
|
|
154
|
+
|
|
155
|
+
## Behavior
|
|
156
|
+
|
|
157
|
+
### Paging
|
|
158
|
+
|
|
159
|
+
A user's sort or filter goes back to the first page and reports it through `pageChange` and `skipChange`, with or without server binding. A `sort` or `filter` set from code keeps the current page.
|
|
160
|
+
|
|
161
|
+
### Turning columns off
|
|
162
|
+
|
|
163
|
+
`[sortable]="false"` on a column turns off sorting through its header, and `[filterable]="false"` leaves it out of the filter menu and the filter row. Both default to `true`, and both only change the header: descriptors from code or a restored state still apply to that field.
|
|
164
|
+
|
|
165
|
+
### The header menu
|
|
166
|
+
|
|
167
|
+
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 uses 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`).
|
|
168
|
+
|
|
169
|
+
### The filter row
|
|
170
|
+
|
|
171
|
+
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.
|
|
172
|
+
|
|
173
|
+
### Canceling a sort
|
|
174
|
+
|
|
175
|
+
`columnSort` is emitted before the sort changes; call `preventDefault()` on it to keep the current order. `sortChange` reports the new descriptors after the change.
|
|
176
|
+
|
|
177
|
+
## Accessibility
|
|
178
|
+
|
|
179
|
+
Sorted headers carry `aria-sort`, and the filter controls are named after their column, so give every column a `title`.
|
|
180
|
+
|
|
181
|
+
### Keyboard
|
|
182
|
+
|
|
183
|
+
| Key | Action |
|
|
184
|
+
| --- | --- |
|
|
185
|
+
| `Enter` | On a header, sorts the column (with `monaGridSortable`). |
|
|
186
|
+
| `Alt+ArrowDown` | On a filterable header, opens its filter menu. |
|
|
187
|
+
| `F2` | On a header or a filter-row cell, moves into its controls: the filter button or the filter input. |
|
|
188
|
+
| `Escape` | Closes the filter menu and returns focus to its funnel button; another `Escape` goes back to the header cell. |
|
|
189
|
+
|
|
190
|
+
The rest of the grid's keys are on [Grid Overview](grid.md#keyboard).
|
|
191
|
+
|
|
192
|
+
### ARIA
|
|
193
|
+
|
|
194
|
+
| Attribute | When present | Value |
|
|
195
|
+
| --- | --- | --- |
|
|
196
|
+
| `aria-sort` | On a header cell, only while `monaGridSortable` is enabled | `"ascending"`, `"descending"`, or `"none"`; only on the first sort |
|
|
197
|
+
| `aria-describedby` | On a header cell sorted after another | Its place in the sort order (`sortOrder` message) |
|
|
198
|
+
| `aria-keyshortcuts` | On a filterable header | `Alt+ArrowDown`, the key that opens its filter menu |
|
|
199
|
+
| `role` | On an open filter menu | `"dialog"`, with `aria-label` `"Filter by {column}"` |
|
|
200
|
+
| `aria-haspopup` | On a filter menu button / a filter row operator button | `"dialog"` / `"menu"`; the operator button also has `aria-expanded` |
|
|
201
|
+
| `aria-label` | On the filter row's inputs, operator buttons and clear buttons | `"Filter by {column}"`, `"Filter operator for {column}: {operator}"` (`filterOperator`), `"Clear filter for {column}"` (`clearFilter`) |
|
|
202
|
+
|
|
203
|
+
## API
|
|
204
|
+
|
|
205
|
+
Everything below is imported from `@nanahoshi/mona-ui/grid`.
|
|
206
|
+
|
|
207
|
+
### `GridSortableDirective`
|
|
208
|
+
|
|
209
|
+
**Selector:** `mona-grid[monaGridSortable]`
|
|
210
|
+
|
|
211
|
+
#### Inputs
|
|
212
|
+
|
|
213
|
+
| Name | Type | Default | Description |
|
|
214
|
+
| --- | --- | --- | --- |
|
|
215
|
+
| `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`. |
|
|
216
|
+
| `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. |
|
|
217
|
+
|
|
218
|
+
#### Outputs
|
|
219
|
+
|
|
220
|
+
| Name | Type | Description |
|
|
221
|
+
| --- | --- | --- |
|
|
222
|
+
| `columnSort` | `ColumnSortEvent` | Emitted when a column header is activated to change its sort direction. Call `preventDefault()` on the event to cancel the sort. |
|
|
223
|
+
| `sortChange` | `SortDescriptor[]` | Emitted when `sort` changes. |
|
|
224
|
+
|
|
225
|
+
### `GridFilterableDirective`
|
|
226
|
+
|
|
227
|
+
**Selector:** `mona-grid[monaGridFilterable]`
|
|
228
|
+
|
|
229
|
+
#### Inputs
|
|
230
|
+
|
|
231
|
+
| Name | Type | Default | Description |
|
|
232
|
+
| --- | --- | --- | --- |
|
|
233
|
+
| `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. |
|
|
234
|
+
| `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`. |
|
|
235
|
+
|
|
236
|
+
#### Outputs
|
|
237
|
+
|
|
238
|
+
| Name | Type | Description |
|
|
239
|
+
| --- | --- | --- |
|
|
240
|
+
| `filterChange` | `CompositeFilterDescriptor[]` | Emitted when `filter` changes. |
|
|
241
|
+
|
|
242
|
+
### `ColumnSortEvent`
|
|
243
|
+
|
|
244
|
+
**Extends:** `PreventableEvent`
|
|
245
|
+
|
|
246
|
+
#### Properties
|
|
247
|
+
|
|
248
|
+
| Name | Type |
|
|
249
|
+
| --- | --- |
|
|
250
|
+
| `column` (read-only) | `Column` |
|
|
251
|
+
|
|
252
|
+
### Types
|
|
253
|
+
|
|
254
|
+
#### `FilterableOptions`
|
|
255
|
+
|
|
256
|
+
| Name | Type |
|
|
257
|
+
| --- | --- |
|
|
258
|
+
| `enabled` | `boolean` |
|
|
259
|
+
| `type` | `"menu" \| "row" \| "menu, row"` |
|
|
260
|
+
|
|
261
|
+
#### `SortableOptions`
|
|
262
|
+
|
|
263
|
+
| Name | Type | Description |
|
|
264
|
+
| --- | --- | --- |
|
|
265
|
+
| `allowUnsort?` | `boolean` | Whether a third click on a sorted column clears its sort. |
|
|
266
|
+
| `enabled?` | `boolean` | Whether sorting is active. On unless set to `false`; options replace earlier ones. |
|
|
267
|
+
| `mode?` | `"single" \| "multiple"` | Whether one or several columns can be sorted at once. |
|
|
268
|
+
| `showIndices?` | `boolean` | Whether sort order indices are displayed on header cells. |
|
|
269
|
+
|
|
270
|
+
#### `ColumnSortComparator`
|
|
271
|
+
|
|
272
|
+
Compares two cell values for sorting: negative, zero or positive, as for `Array.prototype.sort`.
|
|
273
|
+
|
|
274
|
+
```typescript
|
|
275
|
+
type ColumnSortComparator = { compare(left: unknown, right: unknown): number }["compare"];
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
#### `ArrayFilterDescriptor`
|
|
279
|
+
|
|
280
|
+
From `@nanahoshi/mona-ui/query`.
|
|
281
|
+
|
|
282
|
+
```typescript
|
|
283
|
+
type ArrayFilterDescriptor = FieldDefinition & { operator: ArrayFilterOperators; value: readonly unknown[] };
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
#### `ArrayFilterOperators`
|
|
287
|
+
|
|
288
|
+
From `@nanahoshi/mona-ui/query`.
|
|
289
|
+
|
|
290
|
+
```typescript
|
|
291
|
+
type ArrayFilterOperators = "in" | "notin";
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
#### `BooleanFilterDescriptor`
|
|
295
|
+
|
|
296
|
+
From `@nanahoshi/mona-ui/query`.
|
|
297
|
+
|
|
298
|
+
```typescript
|
|
299
|
+
type BooleanFilterDescriptor = FieldDefinition & ({ operator: BooleanFilterOperators } | NullFilterDescriptor);
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
#### `BooleanFilterOperators`
|
|
303
|
+
|
|
304
|
+
From `@nanahoshi/mona-ui/query`.
|
|
305
|
+
|
|
306
|
+
```typescript
|
|
307
|
+
type BooleanFilterOperators = "istrue" | "isfalse" | NullFilterOperators;
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
#### `CommonFilterDescriptor`
|
|
311
|
+
|
|
312
|
+
From `@nanahoshi/mona-ui/query`.
|
|
313
|
+
|
|
314
|
+
```typescript
|
|
315
|
+
type CommonFilterDescriptor = FieldDefinition & { operator: CommonFilterOperators; value: unknown };
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
#### `CommonFilterOperators`
|
|
319
|
+
|
|
320
|
+
From `@nanahoshi/mona-ui/query`.
|
|
321
|
+
|
|
322
|
+
```typescript
|
|
323
|
+
type CommonFilterOperators = "eq" | "neq";
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
#### `CompositeFilterDescriptor`
|
|
327
|
+
|
|
328
|
+
From `@nanahoshi/mona-ui/query`.
|
|
329
|
+
|
|
330
|
+
An empty `filters` list matches every item, whatever the logic.
|
|
331
|
+
|
|
332
|
+
| Name | Type |
|
|
333
|
+
| --- | --- |
|
|
334
|
+
| `filters` | `Array<FilterDescriptor \| CompositeFilterDescriptor>` |
|
|
335
|
+
| `logic` | `FilterLogic` |
|
|
336
|
+
|
|
337
|
+
#### `DateFilterDescriptor`
|
|
338
|
+
|
|
339
|
+
From `@nanahoshi/mona-ui/query`.
|
|
340
|
+
|
|
341
|
+
```typescript
|
|
342
|
+
type DateFilterDescriptor = FieldDefinition & ( | { operator: DateFilterOperators; value: Date; } | NullFilterDescriptor );
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
#### `DateFilterOperators`
|
|
346
|
+
|
|
347
|
+
From `@nanahoshi/mona-ui/query`.
|
|
348
|
+
|
|
349
|
+
```typescript
|
|
350
|
+
type DateFilterOperators = NumericFilterOperators | NullFilterOperators;
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
#### `EmptyFilterDescriptor`
|
|
354
|
+
|
|
355
|
+
From `@nanahoshi/mona-ui/query`.
|
|
356
|
+
|
|
357
|
+
```typescript
|
|
358
|
+
type EmptyFilterDescriptor = FieldDefinition & { operator: EmptyFilterOperators };
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
#### `EmptyFilterOperators`
|
|
362
|
+
|
|
363
|
+
From `@nanahoshi/mona-ui/query`.
|
|
364
|
+
|
|
365
|
+
```typescript
|
|
366
|
+
type EmptyFilterOperators = "isempty" | "isnotempty";
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
#### `FieldDefinition`
|
|
370
|
+
|
|
371
|
+
From `@nanahoshi/mona-ui/query`.
|
|
372
|
+
|
|
373
|
+
```typescript
|
|
374
|
+
type FieldDefinition = { field: string };
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
#### `FilterDescriptor`
|
|
378
|
+
|
|
379
|
+
From `@nanahoshi/mona-ui/query`.
|
|
380
|
+
|
|
381
|
+
```typescript
|
|
382
|
+
type FilterDescriptor = | CommonFilterDescriptor | BooleanFilterDescriptor | NumericFilterDescriptor | StringFilterDescriptor | DateFilterDescriptor | NullFilterDescriptor | EmptyFilterDescriptor | NullOrEmptyFilterDescriptor | ArrayFilterDescriptor | RangeFilterDescriptor | FunctionFilterDescriptor;
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
#### `FilterLogic`
|
|
386
|
+
|
|
387
|
+
From `@nanahoshi/mona-ui/query`.
|
|
388
|
+
|
|
389
|
+
```typescript
|
|
390
|
+
type FilterLogic = "and" | "or";
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
#### `FunctionFilterDescriptor`
|
|
394
|
+
|
|
395
|
+
From `@nanahoshi/mona-ui/query`.
|
|
396
|
+
|
|
397
|
+
```typescript
|
|
398
|
+
type FunctionFilterDescriptor = FieldDefinition & { operator: FunctionFilterOperators; predicate(value: unknown): boolean; };
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
#### `FunctionFilterOperators`
|
|
402
|
+
|
|
403
|
+
From `@nanahoshi/mona-ui/query`.
|
|
404
|
+
|
|
405
|
+
```typescript
|
|
406
|
+
type FunctionFilterOperators = "function";
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
#### `NullFilterDescriptor`
|
|
410
|
+
|
|
411
|
+
From `@nanahoshi/mona-ui/query`.
|
|
412
|
+
|
|
413
|
+
```typescript
|
|
414
|
+
type NullFilterDescriptor = FieldDefinition & { operator: NullFilterOperators };
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
#### `NullFilterOperators`
|
|
418
|
+
|
|
419
|
+
From `@nanahoshi/mona-ui/query`.
|
|
420
|
+
|
|
421
|
+
```typescript
|
|
422
|
+
type NullFilterOperators = "isnull" | "isnotnull";
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
#### `NullOrEmptyFilterDescriptor`
|
|
426
|
+
|
|
427
|
+
From `@nanahoshi/mona-ui/query`.
|
|
428
|
+
|
|
429
|
+
```typescript
|
|
430
|
+
type NullOrEmptyFilterDescriptor = FieldDefinition & { operator: NullOrEmptyFilterOperators };
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
#### `NullOrEmptyFilterOperators`
|
|
434
|
+
|
|
435
|
+
From `@nanahoshi/mona-ui/query`.
|
|
436
|
+
|
|
437
|
+
```typescript
|
|
438
|
+
type NullOrEmptyFilterOperators = "isnullorempty" | "isnotnullorempty";
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
#### `NumericFilterDescriptor`
|
|
442
|
+
|
|
443
|
+
From `@nanahoshi/mona-ui/query`.
|
|
444
|
+
|
|
445
|
+
```typescript
|
|
446
|
+
type NumericFilterDescriptor = FieldDefinition & ( | { operator: NumericFilterOperators; value: number; } | NullFilterDescriptor );
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
#### `NumericFilterOperators`
|
|
450
|
+
|
|
451
|
+
From `@nanahoshi/mona-ui/query`.
|
|
452
|
+
|
|
453
|
+
```typescript
|
|
454
|
+
type NumericFilterOperators = CommonFilterOperators | "gt" | "gte" | "lt" | "lte" | NullFilterOperators;
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
#### `PreventableEvent`
|
|
458
|
+
|
|
459
|
+
From `@nanahoshi/mona-ui/common`.
|
|
460
|
+
|
|
461
|
+
**Type parameters:** `E extends Event = Event`
|
|
462
|
+
|
|
463
|
+
| Name | Type | Description |
|
|
464
|
+
| --- | --- | --- |
|
|
465
|
+
| `originalEvent` (read-only) | `E \| undefined` | The DOM event that caused this one, when there is one. |
|
|
466
|
+
| `type` (read-only) | `string \| undefined` | A name for the kind of event, when the component that emits it sets one. |
|
|
467
|
+
|
|
468
|
+
**Methods**
|
|
469
|
+
|
|
470
|
+
| Signature | Description |
|
|
471
|
+
| --- | --- |
|
|
472
|
+
| `isDefaultPrevented(): boolean` | Whether `preventDefault()` was called. |
|
|
473
|
+
| `preventDefault(): void` | Cancels what the event announces, such as opening or closing a popup, or closing a dialog. |
|
|
474
|
+
|
|
475
|
+
#### `RangeFilterBound`
|
|
476
|
+
|
|
477
|
+
From `@nanahoshi/mona-ui/query`.
|
|
478
|
+
|
|
479
|
+
A bound of a range filter. `null` leaves that end open.
|
|
480
|
+
|
|
481
|
+
```typescript
|
|
482
|
+
type RangeFilterBound = number | Date | string | null;
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
#### `RangeFilterDescriptor`
|
|
486
|
+
|
|
487
|
+
From `@nanahoshi/mona-ui/query`.
|
|
488
|
+
|
|
489
|
+
`between` and `notbetween` include both bounds.
|
|
490
|
+
|
|
491
|
+
```typescript
|
|
492
|
+
type RangeFilterDescriptor = FieldDefinition & { operator: RangeFilterOperators; value: readonly [from: RangeFilterBound, to: RangeFilterBound]; };
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
#### `RangeFilterOperators`
|
|
496
|
+
|
|
497
|
+
From `@nanahoshi/mona-ui/query`.
|
|
498
|
+
|
|
499
|
+
```typescript
|
|
500
|
+
type RangeFilterOperators = "between" | "notbetween";
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
#### `SortDescriptor`
|
|
504
|
+
|
|
505
|
+
From `@nanahoshi/mona-ui/query`.
|
|
506
|
+
|
|
507
|
+
**Type parameters:** `TValue = unknown`
|
|
508
|
+
|
|
509
|
+
| Name | Type |
|
|
510
|
+
| --- | --- |
|
|
511
|
+
| `dir` | `SortDirection` |
|
|
512
|
+
| `field` | `string` |
|
|
513
|
+
|
|
514
|
+
**Methods**
|
|
515
|
+
|
|
516
|
+
| Signature | Description |
|
|
517
|
+
| --- | --- |
|
|
518
|
+
| `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. |
|
|
519
|
+
|
|
520
|
+
#### `SortDirection`
|
|
521
|
+
|
|
522
|
+
From `@nanahoshi/mona-ui/query`.
|
|
523
|
+
|
|
524
|
+
```typescript
|
|
525
|
+
type SortDirection = "asc" | "desc";
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
#### `StringFilterDescriptor`
|
|
529
|
+
|
|
530
|
+
From `@nanahoshi/mona-ui/query`.
|
|
531
|
+
|
|
532
|
+
```typescript
|
|
533
|
+
type StringFilterDescriptor = FieldDefinition & ( | { operator: StringFilterOperators; value: string; } | NullFilterDescriptor | EmptyFilterDescriptor | NullOrEmptyFilterDescriptor );
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
#### `StringFilterOperators`
|
|
537
|
+
|
|
538
|
+
From `@nanahoshi/mona-ui/query`.
|
|
539
|
+
|
|
540
|
+
```typescript
|
|
541
|
+
type StringFilterOperators = | CommonFilterOperators | "startswith" | "endswith" | "contains" | "doesnotcontain" | NullFilterOperators | EmptyFilterOperators | NullOrEmptyFilterOperators;
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
**Documented elsewhere:** [`Column`](grid.md)
|