@nanahoshi/mona-ui 0.24.6 → 0.24.8
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/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +14 -4
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +233 -231
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-CD_ODHpU.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DdyHnUIr.mjs} +24 -12
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-B6gq7Hu3.mjs +208 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DdUY3I7P.mjs +1100 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-Sa1aAtJ-.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-DG8Bu4Dy.mjs} +34 -21
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BvUM9nPt.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CVqpbMcb.mjs} +2565 -928
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +79 -11
- package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +20 -4
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +335 -45
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +565 -197
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +28 -2
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +598 -208
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +193 -74
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +58 -11
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +62 -11
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +62 -11
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +69 -11
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +58 -11
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +62 -11
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +58 -11
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +58 -11
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +62 -11
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +78 -11
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +58 -11
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +58 -11
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +58 -11
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +367 -463
- package/fesm2022/nanahoshi-mona-ui-query.mjs +317 -122
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +205 -140
- package/i18n/catalogs/en-US.messages.json +64 -17
- package/locales/ar-sa/ar-sa.messages.json +58 -11
- package/locales/de-de/de-de.messages.json +58 -11
- package/locales/es-es/es-es.messages.json +58 -11
- package/locales/fr-fr/fr-fr.messages.json +58 -11
- package/locales/id-id/id-id.messages.json +58 -11
- package/locales/it-it/it-it.messages.json +58 -11
- package/locales/ja-jp/ja-jp.messages.json +58 -11
- package/locales/ko-kr/ko-kr.messages.json +58 -11
- package/locales/pt-br/pt-br.messages.json +58 -11
- package/locales/ru-ru/ru-ru.messages.json +58 -11
- package/locales/tr-tr/tr-tr.messages.json +58 -11
- package/locales/zh-cn/zh-cn.messages.json +58 -11
- package/locales/zh-tw/zh-tw.messages.json +58 -11
- package/package.json +1 -1
- package/types/nanahoshi-mona-ui-check-box.d.ts +11 -1
- package/types/nanahoshi-mona-ui-filter.d.ts +54 -32
- package/types/nanahoshi-mona-ui-grid.d.ts +359 -110
- package/types/nanahoshi-mona-ui-i18n.d.ts +97 -6
- package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +14 -2
- package/types/nanahoshi-mona-ui-internal-list.d.ts +89 -10
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +155 -40
- package/types/nanahoshi-mona-ui-internal.d.ts +10 -2
- package/types/nanahoshi-mona-ui-list-box.d.ts +148 -47
- package/types/nanahoshi-mona-ui-list-view.d.ts +111 -21
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +53 -6
- package/types/nanahoshi-mona-ui-pager.d.ts +159 -76
- package/types/nanahoshi-mona-ui-query.d.ts +45 -14
- package/types/nanahoshi-mona-ui-tree-view.d.ts +84 -40
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-0jN7I1jo.mjs +0 -176
- package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BI_iE7pl.mjs +0 -946
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import * as _nanahoshi_mona_ui_i18n from '@nanahoshi/mona-ui/i18n';
|
|
2
|
+
import { MonaTreeViewMessages } from '@nanahoshi/mona-ui/i18n';
|
|
1
3
|
import * as _angular_core from '@angular/core';
|
|
2
4
|
import { TemplateRef } from '@angular/core';
|
|
3
5
|
import { ImmutableSet, Selector, List, Predicate } from '@mirei/ts-collections';
|
|
4
|
-
import { PreventableEvent,
|
|
6
|
+
import { PreventableEvent, FilterChangeEvent, FilterableOptions } from '@nanahoshi/mona-ui/common';
|
|
5
7
|
import { Observable, Subject, BehaviorSubject, ReplaySubject } from 'rxjs';
|
|
6
|
-
import { MonaTreeViewMessages } from '@nanahoshi/mona-ui/i18n';
|
|
7
8
|
|
|
8
9
|
interface CheckableOptions {
|
|
9
10
|
/**
|
|
@@ -65,6 +66,8 @@ declare class TreeNode<T> {
|
|
|
65
66
|
readonly checked: _angular_core.WritableSignal<boolean>;
|
|
66
67
|
readonly children: _angular_core.WritableSignal<ImmutableSet<TreeNode<T>>>;
|
|
67
68
|
readonly data: T;
|
|
69
|
+
/** Whether the last load of this node's children from an asynchronous children selector failed. */
|
|
70
|
+
readonly loadFailed: _angular_core.WritableSignal<boolean>;
|
|
68
71
|
readonly loading: _angular_core.WritableSignal<boolean>;
|
|
69
72
|
readonly uid: string;
|
|
70
73
|
/**
|
|
@@ -105,9 +108,9 @@ declare class NodeClickEvent<T> extends PreventableEvent {
|
|
|
105
108
|
get nodeItem(): NodeItem<T>;
|
|
106
109
|
}
|
|
107
110
|
|
|
108
|
-
declare abstract class NodeEvent<T
|
|
111
|
+
declare abstract class NodeEvent<T, E extends Event = MouseEvent | TouchEvent> extends PreventableEvent<E> {
|
|
109
112
|
#private;
|
|
110
|
-
protected constructor(type: string, node: TreeNode<T>, event:
|
|
113
|
+
protected constructor(type: string, node: TreeNode<T>, event: E);
|
|
111
114
|
get nodeItem(): NodeItem<T>;
|
|
112
115
|
}
|
|
113
116
|
|
|
@@ -145,7 +148,11 @@ interface ITreeView<T> {
|
|
|
145
148
|
undoMoveNode(snapshot: NodeMoveSnapshot): void;
|
|
146
149
|
}
|
|
147
150
|
|
|
148
|
-
|
|
151
|
+
/**
|
|
152
|
+
* A request to move a node: a drop, or a keyboard move (Ctrl+Shift+Arrow), whose original event is then the
|
|
153
|
+
* `KeyboardEvent`.
|
|
154
|
+
*/
|
|
155
|
+
declare class NodeDropEvent<T> extends NodeEvent<T, NodeDropOriginalEvent> {
|
|
149
156
|
#private;
|
|
150
157
|
constructor(params: NodeDropEventArgs<T>);
|
|
151
158
|
get position(): DropPosition;
|
|
@@ -153,16 +160,18 @@ declare class NodeDropEvent<T> extends NodeEvent<T> {
|
|
|
153
160
|
get targetNode(): NodeItem<T>;
|
|
154
161
|
get treeView(): ITreeView<T>;
|
|
155
162
|
}
|
|
156
|
-
declare class NodeDropEventSansTree<T> extends NodeEvent<T> {
|
|
163
|
+
declare class NodeDropEventSansTree<T> extends NodeEvent<T, NodeDropOriginalEvent> {
|
|
157
164
|
#private;
|
|
158
165
|
constructor(params: NodeDropEventArgsSansTree<T>);
|
|
159
|
-
get event():
|
|
166
|
+
get event(): NodeDropOriginalEvent;
|
|
160
167
|
get position(): DropPosition;
|
|
161
168
|
get sourceNode(): TreeNode<T>;
|
|
162
169
|
get targetNode(): TreeNode<T>;
|
|
163
170
|
}
|
|
171
|
+
/** The event behind a `nodeDrop`: the pointer event of a drop, or the key press of a keyboard move. */
|
|
172
|
+
type NodeDropOriginalEvent = MouseEvent | TouchEvent | KeyboardEvent;
|
|
164
173
|
interface NodeDropEventArgs<T> {
|
|
165
|
-
event:
|
|
174
|
+
event: NodeDropOriginalEvent;
|
|
166
175
|
position: DropPosition;
|
|
167
176
|
sourceNode: TreeNode<T>;
|
|
168
177
|
targetNode: TreeNode<T>;
|
|
@@ -213,26 +222,49 @@ interface TreeNodeExpandEvent<T> {
|
|
|
213
222
|
node: TreeNode<T>;
|
|
214
223
|
}
|
|
215
224
|
|
|
225
|
+
/** The ways Ctrl+Shift+Arrow moves a node: past a sibling, into the previous sibling, or out of its parent. */
|
|
226
|
+
type TreeKeyboardMoveDirection = "down" | "in" | "out" | "up";
|
|
227
|
+
/** Where a keyboard move takes a node. */
|
|
228
|
+
interface TreeKeyboardMove<T> {
|
|
229
|
+
readonly position: Exclude<DropPosition, "outside">;
|
|
230
|
+
readonly targetNode: TreeNode<T>;
|
|
231
|
+
}
|
|
232
|
+
|
|
216
233
|
interface TreeNodeSelectEvent<T> {
|
|
217
234
|
node: TreeNode<T>;
|
|
218
235
|
selected: boolean;
|
|
219
236
|
}
|
|
220
237
|
|
|
221
238
|
type ChildrenSelector<T> = string | Selector<T, Iterable<T> | Observable<Iterable<T>>>;
|
|
222
|
-
type NodeKeySelector<T, K =
|
|
239
|
+
type NodeKeySelector<T, K = unknown> = string | Selector<T, K> | null;
|
|
223
240
|
|
|
224
241
|
declare class TreeService<T> {
|
|
225
242
|
#private;
|
|
226
|
-
readonly animationTemporarilyDisabled: _angular_core.WritableSignal<boolean>;
|
|
227
243
|
readonly animationEnabled: _angular_core.WritableSignal<boolean>;
|
|
244
|
+
readonly animationTemporarilyDisabled: _angular_core.WritableSignal<boolean>;
|
|
228
245
|
readonly blur$: Subject<FocusEvent>;
|
|
229
246
|
readonly checkBy: _angular_core.WritableSignal<NodeKeySelector<T>>;
|
|
230
247
|
readonly checkableOptions: _angular_core.WritableSignal<CheckableOptions>;
|
|
231
|
-
|
|
248
|
+
/**
|
|
249
|
+
* The checked keys after the user checks or unchecks a node. Keys set from code, and keys the tree derives on its
|
|
250
|
+
* own (parents with `checkParents`, lazily loaded children of a checked node, ancestors after a move), aren't
|
|
251
|
+
* reported here.
|
|
252
|
+
*/
|
|
253
|
+
readonly checkedKeysChange$: Subject<ImmutableSet<unknown>>;
|
|
232
254
|
readonly children: _angular_core.WritableSignal<ChildrenSelector<T>>;
|
|
255
|
+
/**
|
|
256
|
+
* A node's children failed to load from an asynchronous children selector. The node is collapsed again (not
|
|
257
|
+
* reported through `expandedKeysChange$`), and expanding it retries the load.
|
|
258
|
+
*/
|
|
259
|
+
readonly childrenLoadError$: Subject<{
|
|
260
|
+
readonly error: unknown;
|
|
261
|
+
readonly node: TreeNode<T>;
|
|
262
|
+
}>;
|
|
263
|
+
/** A node started loading its children from an asynchronous children selector. */
|
|
264
|
+
readonly childrenLoadStart$: Subject<TreeNode<T>>;
|
|
233
265
|
readonly disableBy: _angular_core.WritableSignal<NodeKeySelector<T>>;
|
|
234
266
|
readonly disableOptions: _angular_core.WritableSignal<DisableOptions>;
|
|
235
|
-
readonly disabledKeys: _angular_core.WritableSignal<ImmutableSet<
|
|
267
|
+
readonly disabledKeys: _angular_core.WritableSignal<ImmutableSet<unknown>>;
|
|
236
268
|
readonly draggableOptions: _angular_core.WritableSignal<DraggableOptions>;
|
|
237
269
|
readonly dragging: _angular_core.WritableSignal<boolean>;
|
|
238
270
|
readonly dragging$: Observable<boolean>;
|
|
@@ -241,14 +273,21 @@ declare class TreeService<T> {
|
|
|
241
273
|
readonly dropPositionSignal: _angular_core.Signal<DropPositionChangeEvent<T> | null>;
|
|
242
274
|
readonly expandBy: _angular_core.WritableSignal<NodeKeySelector<T>>;
|
|
243
275
|
readonly expandableOptions: _angular_core.WritableSignal<ExpandableOptions>;
|
|
244
|
-
readonly expandedKeys: _angular_core.Signal<ImmutableSet<
|
|
245
|
-
|
|
246
|
-
|
|
276
|
+
readonly expandedKeys: _angular_core.Signal<ImmutableSet<unknown>>;
|
|
277
|
+
/**
|
|
278
|
+
* The expanded keys after the user expands or collapses a node outside filtering. The expansion a filter applies,
|
|
279
|
+
* and the user's changes to it while filtering, are view state and aren't reported.
|
|
280
|
+
*/
|
|
281
|
+
readonly expandedKeysChange$: Subject<ImmutableSet<unknown>>;
|
|
247
282
|
readonly filter$: ReplaySubject<string>;
|
|
248
283
|
readonly filterChange$: Subject<FilterChangeEvent>;
|
|
249
284
|
readonly filterPlaceholder: _angular_core.WritableSignal<string>;
|
|
285
|
+
/** The applied filter. Typing is debounced by the filter input; a filter set from code applies at once. */
|
|
250
286
|
readonly filterText: _angular_core.Signal<string>;
|
|
287
|
+
readonly filterableOptions: _angular_core.Signal<FilterableOptions>;
|
|
251
288
|
readonly focus$: Subject<FocusEvent>;
|
|
289
|
+
/** The number of nodes whose text matches the filter (their ancestors, shown for context, aren't counted). */
|
|
290
|
+
readonly matchCount: _angular_core.Signal<number>;
|
|
252
291
|
readonly navigatedNode: _angular_core.WritableSignal<TreeNode<T> | null>;
|
|
253
292
|
readonly nodeCheck$: Subject<NodeCheckEvent<T>>;
|
|
254
293
|
readonly nodeCheckChange$: Subject<TreeNodeCheckEvent<T>>;
|
|
@@ -261,16 +300,21 @@ declare class TreeService<T> {
|
|
|
261
300
|
readonly nodeSelect$: Subject<NodeSelectEvent<T>>;
|
|
262
301
|
readonly nodeSelectChange$: Subject<TreeNodeSelectEvent<T>>;
|
|
263
302
|
readonly nodeSet: _angular_core.WritableSignal<ImmutableSet<TreeNode<T>>>;
|
|
264
|
-
readonly nodeTemplate: _angular_core.WritableSignal<TemplateRef<
|
|
303
|
+
readonly nodeTemplate: _angular_core.WritableSignal<TemplateRef<unknown> | null>;
|
|
265
304
|
readonly selectBy: _angular_core.WritableSignal<NodeKeySelector<T>>;
|
|
266
305
|
readonly selectableOptions: _angular_core.WritableSignal<SelectableOptions>;
|
|
267
|
-
readonly selectedKeys: _angular_core.WritableSignal<ImmutableSet<
|
|
268
|
-
|
|
306
|
+
readonly selectedKeys: _angular_core.WritableSignal<ImmutableSet<unknown>>;
|
|
307
|
+
/** The selected keys after the user selects or deselects a node. Keys set from code aren't reported. */
|
|
308
|
+
readonly selectedKeysChange$: Subject<ImmutableSet<unknown>>;
|
|
269
309
|
readonly selectedNodes: _angular_core.Signal<ImmutableSet<TreeNode<T>>>;
|
|
270
310
|
readonly selectionChange$: Subject<NodeItem<T>>;
|
|
271
311
|
readonly textField: _angular_core.WritableSignal<string | Selector<T, string>>;
|
|
272
312
|
readonly viewNodeSet: _angular_core.Signal<ImmutableSet<TreeNode<T>>>;
|
|
273
313
|
constructor();
|
|
314
|
+
/** Whether two key sets hold the same keys, in any order. */
|
|
315
|
+
/** Reads a field of a data item by name (for the string forms of the key, id and children selectors). */
|
|
316
|
+
private static readField;
|
|
317
|
+
private static sameKeys;
|
|
274
318
|
static flatten<T>(nodes: Iterable<TreeNode<T>>): List<TreeNode<T>>;
|
|
275
319
|
clearFilter(): void;
|
|
276
320
|
detachNode(node: TreeNode<T>): void;
|
|
@@ -279,12 +323,28 @@ declare class TreeService<T> {
|
|
|
279
323
|
*/
|
|
280
324
|
expandSiblings(node: TreeNode<T>): void;
|
|
281
325
|
/**
|
|
282
|
-
*
|
|
283
|
-
* (
|
|
326
|
+
* The node of the current nodes that stands for `node`: the node itself, or after a data refresh rebuilt the
|
|
327
|
+
* nodes, the node of the same data item (or, for flat data, of the same id).
|
|
328
|
+
*/
|
|
329
|
+
findCounterpart(node: TreeNode<T>): TreeNode<T> | null;
|
|
330
|
+
/**
|
|
331
|
+
* Finds the next visible node whose text starts with `prefix` (case-insensitive), wrapping around. Used for
|
|
332
|
+
* typeahead: a first character searches after the navigated node, and each further character keeps the
|
|
333
|
+
* navigated node while it still matches.
|
|
284
334
|
*/
|
|
285
335
|
findNodeByText(prefix: string): TreeNode<T> | null;
|
|
336
|
+
getCheckKey(node: TreeNode<T>): unknown;
|
|
337
|
+
getDisableKey(node: TreeNode<T>): unknown;
|
|
338
|
+
/**
|
|
339
|
+
* Where a keyboard move takes a node: before its previous or after its next visible sibling (`"up"`, `"down"`),
|
|
340
|
+
* inside its previous visible sibling as the last child (`"in"`), or after its parent (`"out"`). `null` when the
|
|
341
|
+
* node can't move that way or is disabled.
|
|
342
|
+
*/
|
|
343
|
+
getKeyboardMove(node: TreeNode<T>, direction: TreeKeyboardMoveDirection): TreeKeyboardMove<T> | null;
|
|
286
344
|
getNodeByUid(uid: string): TreeNode<T> | null;
|
|
287
345
|
getNodeElementId(uid: string): string;
|
|
346
|
+
/** What identifies a node's data item across data refreshes: its id for flat data, else the item itself. */
|
|
347
|
+
getNodeIdentity(node: TreeNode<T>): unknown;
|
|
288
348
|
getNodeText(node: TreeNode<T>): string;
|
|
289
349
|
hasChildren(node: TreeNode<T> | null): boolean;
|
|
290
350
|
insertNodeAtIndex(node: TreeNode<T>, parentUid: string | null, index: number): void;
|
|
@@ -304,46 +364,53 @@ declare class TreeService<T> {
|
|
|
304
364
|
loadNodeChildren(node: TreeNode<T>, reload?: boolean): void;
|
|
305
365
|
/**
|
|
306
366
|
* Moves a node relative to a target node. Moving a node onto itself or into its own subtree is ignored,
|
|
307
|
-
* because it would detach the subtree and create a parent cycle
|
|
367
|
+
* because it would detach the subtree and create a parent cycle, and so is moving it inside its own parent or
|
|
368
|
+
* a disabled node, or `"outside"`.
|
|
369
|
+
* @returns whether the node moved.
|
|
308
370
|
*/
|
|
309
|
-
moveNode(sourceNode: TreeNode<T>, targetNode: TreeNode<T>, position: DropPosition):
|
|
371
|
+
moveNode(sourceNode: TreeNode<T>, targetNode: TreeNode<T>, position: DropPosition): boolean;
|
|
310
372
|
navigate(direction: "next" | "previous" | "first" | "last"): TreeNode<T> | null;
|
|
311
373
|
notifySelectionChange(node: TreeNode<T>): void;
|
|
374
|
+
/**
|
|
375
|
+
* Whether selecting `node` the way the user does (a click, or Enter) changes the selection. It doesn't for the
|
|
376
|
+
* selected node of a single selection that can't be toggled off.
|
|
377
|
+
*/
|
|
378
|
+
selectionWouldChange(node: TreeNode<T>): boolean;
|
|
312
379
|
setAnimationEnabled(enabled: boolean): void;
|
|
313
|
-
setChildrenSelector(selector: string | Selector<T, Iterable<T> | Observable<Iterable<T>>>): void;
|
|
314
380
|
setCheckBy(selector: NodeKeySelector<T>): void;
|
|
315
381
|
setCheckableOptions(options: Partial<CheckableOptions>): void;
|
|
316
|
-
setCheckedKeys(keys: Iterable<
|
|
382
|
+
setCheckedKeys(keys: Iterable<unknown>): void;
|
|
383
|
+
setChildrenSelector(selector: string | Selector<T, Iterable<T> | Observable<Iterable<T>>>): void;
|
|
317
384
|
setData(data: Iterable<T>): void;
|
|
318
385
|
setDataStructure(structure: DataStructure): void;
|
|
319
386
|
setDisableBy(selector: NodeKeySelector<T>): void;
|
|
320
387
|
setDisableOptions(options: Partial<DisableOptions>): void;
|
|
321
|
-
setDisabledKeys(keys: Iterable<
|
|
388
|
+
setDisabledKeys(keys: Iterable<unknown>): void;
|
|
322
389
|
setDraggableOptions(options: Partial<DraggableOptions>): void;
|
|
323
390
|
setExpandBy(selector: NodeKeySelector<T>): void;
|
|
324
391
|
setExpandableOptions(options: Partial<ExpandableOptions>): void;
|
|
325
|
-
setExpandedKeys(keys: Iterable<
|
|
392
|
+
setExpandedKeys(keys: Iterable<unknown>): void;
|
|
326
393
|
setFilterableOptions(options: Partial<FilterableOptions>): void;
|
|
327
394
|
setFlatIdField(field: string): void;
|
|
328
395
|
setFlatParentIdField(field: string): void;
|
|
329
396
|
setHasCheckboxPredicate(fn: ((data: T, uid: string) => boolean) | null): void;
|
|
330
|
-
setHasChildrenPredicate(predicate: Predicate<
|
|
397
|
+
setHasChildrenPredicate(predicate: Predicate<T> | null): void;
|
|
331
398
|
setNodeCheck(node: TreeNode<T>, checked: boolean): void;
|
|
332
399
|
setNodeExpand(node: TreeNode<T>, expanded: boolean): void;
|
|
333
|
-
|
|
400
|
+
/** @returns whether the selection changed. */
|
|
401
|
+
setNodeSelect(node: TreeNode<T>, selected: boolean): boolean;
|
|
334
402
|
setSelectBy(selector: NodeKeySelector<T>): void;
|
|
335
403
|
setSelectableOptions(options: Partial<SelectableOptions>): void;
|
|
336
404
|
setSelectedDataItems(dataItems: Iterable<T>): void;
|
|
337
|
-
setSelectedKeys(keys: Iterable<
|
|
405
|
+
setSelectedKeys(keys: Iterable<unknown>): void;
|
|
338
406
|
setTextField(selector: string | Selector<T, string>): void;
|
|
339
407
|
/**
|
|
340
408
|
* Expands or collapses a node the way user interaction does: disabled nodes are left alone, children of an
|
|
341
|
-
* asynchronous children selector are loaded on first expand, and `nodeExpand$` is notified.
|
|
409
|
+
* asynchronous children selector are loaded on first expand, and `nodeExpand$` is notified. Without expanding
|
|
410
|
+
* (every node is then open), nothing changes.
|
|
342
411
|
* @returns whether the expand state changed.
|
|
343
412
|
*/
|
|
344
413
|
toggleNodeExpand(node: TreeNode<T>, expanded: boolean): boolean;
|
|
345
|
-
getCheckKey(node: TreeNode<T>): any;
|
|
346
|
-
getDisableKey(node: TreeNode<T>): any;
|
|
347
414
|
private applyCheckedKeysToNodes;
|
|
348
415
|
private computeVisibleUids;
|
|
349
416
|
private createFlatNodes;
|
|
@@ -364,14 +431,22 @@ declare class TreeService<T> {
|
|
|
364
431
|
* `checkDisabledChildren` is set, only enabled ones, because the user cannot change disabled children.
|
|
365
432
|
*/
|
|
366
433
|
private getCheckStateChildren;
|
|
367
|
-
private getExpandKey;
|
|
368
434
|
private getChildNodes;
|
|
369
435
|
private getDataItemSelectKey;
|
|
436
|
+
private getExpandKey;
|
|
370
437
|
private getParentNodes;
|
|
371
438
|
private getSelectKey;
|
|
372
439
|
private isAnyParentCollapsed;
|
|
373
440
|
private isFiltered;
|
|
441
|
+
/**
|
|
442
|
+
* Keeps `aria-activedescendant` on a rendered node: when the active node is hidden by a collapse or a filter, the
|
|
443
|
+
* nearest visible ancestor takes over (else the first visible node); a node re-created by new data with the same
|
|
444
|
+
* uid is swapped in.
|
|
445
|
+
*/
|
|
446
|
+
private keepNavigatedNodeVisible;
|
|
374
447
|
private loadCheckedKeysForChildren;
|
|
448
|
+
/** Loads the children of the expanded, shown nodes whose children come from an observable and aren't loaded. */
|
|
449
|
+
private loadExpandedNodes;
|
|
375
450
|
private moveNodeAfter;
|
|
376
451
|
private moveNodeBefore;
|
|
377
452
|
private moveNodeInside;
|
|
@@ -386,16 +461,45 @@ declare class TreeService<T> {
|
|
|
386
461
|
|
|
387
462
|
declare class TreeComponent<T> {
|
|
388
463
|
#private;
|
|
389
|
-
protected readonly isRtl: _angular_core.Signal<boolean>;
|
|
390
464
|
protected readonly activeDescendantId: _angular_core.Signal<string | null>;
|
|
391
465
|
protected readonly baseClass: _angular_core.Signal<string>;
|
|
466
|
+
protected readonly isRtl: _angular_core.Signal<boolean>;
|
|
467
|
+
protected readonly keyShortcuts: _angular_core.Signal<"Control+Shift+ArrowUp Control+Shift+ArrowDown Control+Shift+ArrowLeft Control+Shift+ArrowRight" | null>;
|
|
468
|
+
protected readonly messages: _angular_core.Signal<_nanahoshi_mona_ui_i18n.MonaTreeViewMessages>;
|
|
469
|
+
/**
|
|
470
|
+
* With checkboxes, nodes report `aria-checked` and not `aria-selected`, so the tree isn't multiselectable in the
|
|
471
|
+
* `aria-selected` sense.
|
|
472
|
+
*/
|
|
473
|
+
protected readonly multiselectable: _angular_core.Signal<true | null>;
|
|
474
|
+
readonly ariaDescribedBy: _angular_core.InputSignal<string>;
|
|
392
475
|
readonly ariaLabel: _angular_core.InputSignal<string>;
|
|
476
|
+
readonly ariaLabelledBy: _angular_core.InputSignal<string>;
|
|
393
477
|
readonly data: _angular_core.InputSignal<Iterable<T> | undefined>;
|
|
394
478
|
readonly nodeTemplate: _angular_core.Signal<TemplateRef<any> | undefined>;
|
|
395
479
|
readonly treeService: TreeService<T>;
|
|
396
480
|
constructor();
|
|
397
|
-
|
|
398
|
-
|
|
481
|
+
/**
|
|
482
|
+
* Once the tree has rendered after a keyboard move, finds out whether the `nodeDrop` handler applied it (through
|
|
483
|
+
* `data` or `moveNode`). A move that was applied keeps the node active, opens the node it went into, and is
|
|
484
|
+
* announced.
|
|
485
|
+
*/
|
|
486
|
+
private afterKeyboardMove;
|
|
487
|
+
/** Ctrl+Shift+Arrow (Cmd+Shift+Arrow on macOS) moves the active node while dragging is on. */
|
|
488
|
+
private handleMoveKey;
|
|
489
|
+
private handlePointerMoveWhileDragging;
|
|
490
|
+
private isPointerOutsideTree;
|
|
491
|
+
/**
|
|
492
|
+
* Whether a key event is meant for the tree: from the tree itself or one of its nodes. Keys pressed in controls
|
|
493
|
+
* of a node template (or in a tree nested in one) are left to those controls.
|
|
494
|
+
*/
|
|
495
|
+
private isTreeKeyTarget;
|
|
496
|
+
private locationOf;
|
|
497
|
+
private moveDirection;
|
|
498
|
+
/**
|
|
499
|
+
* Asks for a keyboard move the way a drop does: `nodeDrop` is emitted, and its handler applies the move. The
|
|
500
|
+
* keyboard event is the drop event's original event.
|
|
501
|
+
*/
|
|
502
|
+
private moveWithKeyboard;
|
|
399
503
|
private notifyDropPositionChange;
|
|
400
504
|
private setFocusSubscription;
|
|
401
505
|
private setKeydownSubscription;
|
|
@@ -403,7 +507,7 @@ declare class TreeComponent<T> {
|
|
|
403
507
|
private setSubscriptions;
|
|
404
508
|
private setTypeaheadSubscription;
|
|
405
509
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TreeComponent<any>, never>;
|
|
406
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TreeComponent<any>, "mona-tree", never, { "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; }, {}, ["nodeTemplate"], never, true, never>;
|
|
510
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TreeComponent<any>, "mona-tree", never, { "ariaDescribedBy": { "alias": "ariaDescribedBy"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "ariaLabelledBy": { "alias": "ariaLabelledBy"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; }, {}, ["nodeTemplate"], never, true, never>;
|
|
407
511
|
}
|
|
408
512
|
|
|
409
513
|
declare class TreeNodeTemplateDirective {
|
|
@@ -413,6 +517,17 @@ declare class TreeNodeTemplateDirective {
|
|
|
413
517
|
|
|
414
518
|
declare const TREE_DEFAULT_MESSAGES: MonaTreeViewMessages;
|
|
415
519
|
|
|
520
|
+
/**
|
|
521
|
+
* Reports that the children of a node couldn't be loaded from an asynchronous children selector. The node is
|
|
522
|
+
* collapsed again, and expanding it retries the load.
|
|
523
|
+
*/
|
|
524
|
+
interface ChildrenLoadErrorEvent<T> {
|
|
525
|
+
/** What the children observable errored with. */
|
|
526
|
+
readonly error: unknown;
|
|
527
|
+
/** The node whose children failed to load. */
|
|
528
|
+
readonly node: NodeItem<T>;
|
|
529
|
+
}
|
|
530
|
+
|
|
416
531
|
/**
|
|
417
532
|
* Moves a node within a generic flat tree structure that uses parentId references.
|
|
418
533
|
* @param treeData - The flat array of tree nodes.
|
|
@@ -423,7 +538,7 @@ declare const TREE_DEFAULT_MESSAGES: MonaTreeViewMessages;
|
|
|
423
538
|
* The array is returned unchanged when the position is "outside" or the target is the dragged node or one of its
|
|
424
539
|
* descendants, which would otherwise create a parent cycle.
|
|
425
540
|
*/
|
|
426
|
-
declare function moveFlatTreeNode<T extends
|
|
541
|
+
declare function moveFlatTreeNode<T extends object>(treeData: Iterable<T>, event: NodeDropEvent<T>, idKey: keyof T, parentIdKey: keyof T): T[];
|
|
427
542
|
|
|
428
543
|
/**
|
|
429
544
|
* Moves a node within a generic hierarchical tree structure.
|
|
@@ -436,7 +551,7 @@ declare function moveFlatTreeNode<T extends Record<string, any>>(treeData: Itera
|
|
|
436
551
|
* The move is skipped, returning the tree unchanged, when the position is "outside", the target is missing,
|
|
437
552
|
* or the target is the dragged node or one of its descendants, so a node is never lost or made its own ancestor.
|
|
438
553
|
*/
|
|
439
|
-
declare function moveTreeNode<T extends
|
|
554
|
+
declare function moveTreeNode<T extends object>(treeData: Iterable<T>, event: NodeDropEvent<T>, idKey: keyof T, childrenKey: keyof T): T[];
|
|
440
555
|
|
|
441
556
|
export { InternalNodeDragEvent, NodeCheckEvent, NodeClickEvent, NodeDragEndEvent, NodeDragEvent, NodeDragStartEvent, NodeDropEvent, NodeDropEventSansTree, NodeEvent, NodeSelectEvent, TREE_DEFAULT_MESSAGES, TreeComponent, TreeNode, TreeNodeTemplateDirective, TreeService, moveFlatTreeNode, moveTreeNode };
|
|
442
|
-
export type { CheckableOptions, ChildrenSelector, DataStructure, DisableOptions, DraggableOptions, DropPosition, DropPositionChangeEvent, ExpandableOptions, ITreeView, NodeDropEventArgs, NodeDropEventArgsSansTree, NodeItem, NodeKeySelector, NodeMoveSnapshot, SelectableOptions, TreeNodeCheckEvent, TreeNodeExpandEvent, TreeNodeSelectEvent };
|
|
557
|
+
export type { CheckableOptions, ChildrenLoadErrorEvent, ChildrenSelector, DataStructure, DisableOptions, DraggableOptions, DropPosition, DropPositionChangeEvent, ExpandableOptions, ITreeView, NodeDropEventArgs, NodeDropEventArgsSansTree, NodeDropOriginalEvent, NodeItem, NodeKeySelector, NodeMoveSnapshot, SelectableOptions, TreeKeyboardMove, TreeKeyboardMoveDirection, TreeNodeCheckEvent, TreeNodeExpandEvent, TreeNodeSelectEvent };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { ElementRef,
|
|
2
|
+
import { ElementRef, Signal, DestroyRef } from '@angular/core';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import { OverlayRef } from '@angular/cdk/overlay';
|
|
5
5
|
|
|
@@ -90,6 +90,14 @@ declare function focusCanReturn(document: Document, ...containers: ReadonlyArray
|
|
|
90
90
|
|
|
91
91
|
declare function focusElement(host: HTMLElement, element: HTMLElement | ElementRef<HTMLElement> | string): void;
|
|
92
92
|
|
|
93
|
+
/**
|
|
94
|
+
* The text of the elements an `aria-labelledby` value points to, joined with spaces, for names built from a
|
|
95
|
+
* component's name ("Filter {name}"). It's read after every render, so it follows the labelling elements' text.
|
|
96
|
+
* Call it in an injection context.
|
|
97
|
+
* @param ids Returns the space-separated element ids.
|
|
98
|
+
*/
|
|
99
|
+
declare function injectLabelledByText(ids: () => string): Signal<string>;
|
|
100
|
+
|
|
93
101
|
declare const rxFromResize: (target: Element | Iterable<Element>, options?: ResizeObserverOptions) => Observable<ResizeObserverEntry[]>;
|
|
94
102
|
|
|
95
103
|
declare const rxTimeout: (destroyRef: DestroyRef, fn: Action, delay?: number) => void;
|
|
@@ -163,5 +171,5 @@ declare const isTypeaheadKey: (key: string, modifiers?: TypeaheadModifiers) => b
|
|
|
163
171
|
declare const TYPEAHEAD_RESET_DELAY = 200;
|
|
164
172
|
declare const setupTypeahead: (typeaheadKey$: Observable<string>) => Observable<string>;
|
|
165
173
|
|
|
166
|
-
export { AttributeBinderDirective, NavigationKeys, NavigationKeysList, TYPEAHEAD_RESET_DELAY, createElementControlId, focusCanReturn, focusElement, hex2rgba, hsla2hsva, hsva2rgba, isNavigationKey, isTypeaheadKey, isValidHex, isValidHsla, isValidRgb, restoreOverlayScroll, rgba2hex, rgba2hsla, rgba2hsva, rxFromResize, rxTimeout, setWindowStyles, setupTypeahead, string2Hsla, string2rgba, themeControlBackdropClasses, themeControlSurfaceClasses, themeOverlayBackdropClasses, themeOverlaySurfaceClasses, themeRaisedBackdropClasses, themeRaisedSurfaceClasses, toCssValue };
|
|
174
|
+
export { AttributeBinderDirective, NavigationKeys, NavigationKeysList, TYPEAHEAD_RESET_DELAY, createElementControlId, focusCanReturn, focusElement, hex2rgba, hsla2hsva, hsva2rgba, injectLabelledByText, isNavigationKey, isTypeaheadKey, isValidHex, isValidHsla, isValidRgb, restoreOverlayScroll, rgba2hex, rgba2hsla, rgba2hsva, rxFromResize, rxTimeout, setWindowStyles, setupTypeahead, string2Hsla, string2rgba, themeControlBackdropClasses, themeControlSurfaceClasses, themeOverlayBackdropClasses, themeOverlaySurfaceClasses, themeRaisedBackdropClasses, themeRaisedSurfaceClasses, toCssValue };
|
|
167
175
|
export type { Action, AttributeConfig, Channel, ColorScheme, HSL, HSLA, HSV, HSVA, HSVChannel, RGB, RGBA, RGBAChannel, RGBChannel, TypeaheadModifiers, VariantInputs, WindowStyleSettings };
|