@nanahoshi/mona-ui 0.1.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.
Files changed (134) hide show
  1. package/README.md +25 -0
  2. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +590 -0
  3. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +168 -0
  4. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +220 -0
  5. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +225 -0
  6. package/fesm2022/nanahoshi-mona-ui-button.mjs +497 -0
  7. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +1569 -0
  8. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +339 -0
  9. package/fesm2022/nanahoshi-mona-ui-chip.mjs +453 -0
  10. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +200 -0
  11. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +853 -0
  12. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +923 -0
  13. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +495 -0
  14. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +686 -0
  15. package/fesm2022/nanahoshi-mona-ui-common.mjs +642 -0
  16. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +485 -0
  17. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +132 -0
  18. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +460 -0
  19. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +659 -0
  20. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +828 -0
  21. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +523 -0
  22. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +615 -0
  23. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +701 -0
  24. package/fesm2022/nanahoshi-mona-ui-editor.mjs +1400 -0
  25. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +245 -0
  26. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +170 -0
  27. package/fesm2022/nanahoshi-mona-ui-filter.mjs +680 -0
  28. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-cell.component-B9SQH5N-.mjs +105 -0
  29. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DlLwcCFT.mjs +42 -0
  30. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-Dgea-O0X.mjs +130 -0
  31. package/fesm2022/nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs +773 -0
  32. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DRHycGIh.mjs +240 -0
  33. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs +5374 -0
  34. package/fesm2022/nanahoshi-mona-ui-grid.mjs +2 -0
  35. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +87 -0
  36. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +154 -0
  37. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1356 -0
  38. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2263 -0
  39. package/fesm2022/nanahoshi-mona-ui-internal.mjs +379 -0
  40. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +630 -0
  41. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +527 -0
  42. package/fesm2022/nanahoshi-mona-ui-list.mjs +4 -0
  43. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +966 -0
  44. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +641 -0
  45. package/fesm2022/nanahoshi-mona-ui-notification.mjs +536 -0
  46. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +597 -0
  47. package/fesm2022/nanahoshi-mona-ui-pager.mjs +790 -0
  48. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +83 -0
  49. package/fesm2022/nanahoshi-mona-ui-popover.mjs +325 -0
  50. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +1559 -0
  51. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1321 -0
  52. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +294 -0
  53. package/fesm2022/nanahoshi-mona-ui-query.mjs +175 -0
  54. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +339 -0
  55. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +565 -0
  56. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1049 -0
  57. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +636 -0
  58. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +843 -0
  59. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +537 -0
  60. package/fesm2022/nanahoshi-mona-ui-switch.mjs +308 -0
  61. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +664 -0
  62. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +111 -0
  63. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +369 -0
  64. package/fesm2022/nanahoshi-mona-ui-theme.mjs +314 -0
  65. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +450 -0
  66. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +723 -0
  67. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +716 -0
  68. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +733 -0
  69. package/fesm2022/nanahoshi-mona-ui-window.mjs +1329 -0
  70. package/fesm2022/nanahoshi-mona-ui.mjs +9 -0
  71. package/package.json +289 -0
  72. package/types/nanahoshi-mona-ui-auto-complete.d.ts +223 -0
  73. package/types/nanahoshi-mona-ui-avatar.d.ts +642 -0
  74. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +70 -0
  75. package/types/nanahoshi-mona-ui-button-group.d.ts +77 -0
  76. package/types/nanahoshi-mona-ui-button.d.ts +111 -0
  77. package/types/nanahoshi-mona-ui-calendar.d.ts +262 -0
  78. package/types/nanahoshi-mona-ui-check-box.d.ts +133 -0
  79. package/types/nanahoshi-mona-ui-chip.d.ts +130 -0
  80. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +113 -0
  81. package/types/nanahoshi-mona-ui-color-gradient.d.ts +201 -0
  82. package/types/nanahoshi-mona-ui-color-palette.d.ts +102 -0
  83. package/types/nanahoshi-mona-ui-color-picker.d.ts +156 -0
  84. package/types/nanahoshi-mona-ui-combo-box.d.ts +232 -0
  85. package/types/nanahoshi-mona-ui-common.d.ts +386 -0
  86. package/types/nanahoshi-mona-ui-contextmenu.d.ts +129 -0
  87. package/types/nanahoshi-mona-ui-date-input.d.ts +60 -0
  88. package/types/nanahoshi-mona-ui-date-picker.d.ts +177 -0
  89. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +199 -0
  90. package/types/nanahoshi-mona-ui-dialog.d.ts +261 -0
  91. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +159 -0
  92. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +219 -0
  93. package/types/nanahoshi-mona-ui-dropdowns.d.ts +176 -0
  94. package/types/nanahoshi-mona-ui-editor.d.ts +113 -0
  95. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +87 -0
  96. package/types/nanahoshi-mona-ui-fieldset.d.ts +68 -0
  97. package/types/nanahoshi-mona-ui-filter.d.ts +115 -0
  98. package/types/nanahoshi-mona-ui-grid.d.ts +1114 -0
  99. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +25 -0
  100. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +28 -0
  101. package/types/nanahoshi-mona-ui-internal-list.d.ts +269 -0
  102. package/types/nanahoshi-mona-ui-internal-tree.d.ts +391 -0
  103. package/types/nanahoshi-mona-ui-internal.d.ts +136 -0
  104. package/types/nanahoshi-mona-ui-list-box.d.ts +225 -0
  105. package/types/nanahoshi-mona-ui-list-view.d.ts +188 -0
  106. package/types/nanahoshi-mona-ui-list.d.ts +1 -0
  107. package/types/nanahoshi-mona-ui-menubar.d.ts +198 -0
  108. package/types/nanahoshi-mona-ui-multi-select.d.ts +247 -0
  109. package/types/nanahoshi-mona-ui-notification.d.ts +106 -0
  110. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +161 -0
  111. package/types/nanahoshi-mona-ui-pager.d.ts +238 -0
  112. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -0
  113. package/types/nanahoshi-mona-ui-popover.d.ts +130 -0
  114. package/types/nanahoshi-mona-ui-popup-menu.d.ts +412 -0
  115. package/types/nanahoshi-mona-ui-popup.d.ts +485 -0
  116. package/types/nanahoshi-mona-ui-progress-bar.d.ts +139 -0
  117. package/types/nanahoshi-mona-ui-query.d.ts +89 -0
  118. package/types/nanahoshi-mona-ui-radio-button.d.ts +128 -0
  119. package/types/nanahoshi-mona-ui-scroll-view.d.ts +166 -0
  120. package/types/nanahoshi-mona-ui-slider.d.ts +305 -0
  121. package/types/nanahoshi-mona-ui-split-button.d.ts +182 -0
  122. package/types/nanahoshi-mona-ui-splitter.d.ts +70 -0
  123. package/types/nanahoshi-mona-ui-stepper.d.ts +173 -0
  124. package/types/nanahoshi-mona-ui-switch.d.ts +125 -0
  125. package/types/nanahoshi-mona-ui-tabs.d.ts +158 -0
  126. package/types/nanahoshi-mona-ui-text-area.d.ts +42 -0
  127. package/types/nanahoshi-mona-ui-text-box.d.ts +164 -0
  128. package/types/nanahoshi-mona-ui-theme.d.ts +23 -0
  129. package/types/nanahoshi-mona-ui-time-picker.d.ts +184 -0
  130. package/types/nanahoshi-mona-ui-time-selector.d.ts +143 -0
  131. package/types/nanahoshi-mona-ui-tooltip.d.ts +130 -0
  132. package/types/nanahoshi-mona-ui-tree-view.d.ts +274 -0
  133. package/types/nanahoshi-mona-ui-window.d.ts +295 -0
  134. package/types/nanahoshi-mona-ui.d.ts +2 -0
@@ -0,0 +1,733 @@
1
+ import { NgTemplateOutlet } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { Directive, inject, DestroyRef, contentChild, TemplateRef, computed, input, output, effect, untracked, afterNextRender, Component } from '@angular/core';
4
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
+ import { FilterInputComponent } from '@nanahoshi/mona-ui/internal/filter-input';
6
+ import { TreeService, TreeComponent, TreeNodeTemplateDirective, NodeDropEvent } from '@nanahoshi/mona-ui/internal/tree';
7
+ export { NodeCheckEvent, NodeClickEvent, NodeDragEndEvent, NodeDragEvent, NodeDragStartEvent, NodeDropEvent, moveFlatTreeNode, moveTreeNode } from '@nanahoshi/mona-ui/internal/tree';
8
+ import { sequenceEqual } from '@mirei/ts-collections';
9
+ import { pairwise } from 'rxjs';
10
+
11
+ class TreeViewNodeTemplateDirective {
12
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TreeViewNodeTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
13
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: TreeViewNodeTemplateDirective, isStandalone: true, selector: "ng-template[monaTreeViewNodeTemplate]", ngImport: i0 }); }
14
+ }
15
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TreeViewNodeTemplateDirective, decorators: [{
16
+ type: Directive,
17
+ args: [{
18
+ selector: "ng-template[monaTreeViewNodeTemplate]"
19
+ }]
20
+ }] });
21
+
22
+ class TreeViewComponent {
23
+ #destroyRef;
24
+ constructor() {
25
+ this.#destroyRef = inject(DestroyRef);
26
+ this.nodeTemplate = contentChild(TreeViewNodeTemplateDirective, { ...(ngDevMode ? { debugName: "nodeTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
27
+ this.treeService = inject((TreeService));
28
+ this.filterAriaLabel = computed(() => {
29
+ const ariaLabel = this.ariaLabel();
30
+ return ariaLabel ? `Filter ${ariaLabel}` : "Filter tree";
31
+ }, /* @ts-ignore */
32
+ ...(ngDevMode ? [{ debugName: "filterAriaLabel" }] : /* istanbul ignore next */ []));
33
+ /**
34
+ * @description Enables CSS transitions when nodes expand or collapse.
35
+ * @default true
36
+ */
37
+ this.animate = input(true, /* @ts-ignore */
38
+ ...(ngDevMode ? [{ debugName: "animate" }] : /* istanbul ignore next */ []));
39
+ /**
40
+ * @description Accessible name for the tree. Describe what the tree represents. When empty, assistive technology announces the role without a label.
41
+ * @default ""
42
+ */
43
+ this.ariaLabel = input("", /* @ts-ignore */
44
+ ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
45
+ /**
46
+ * @description Property name or accessor used to derive a node's children from a data item. Accepts a property name, a function returning the children, or a function returning an observable of the children.
47
+ * @default ""
48
+ */
49
+ this.children = input("", /* @ts-ignore */
50
+ ...(ngDevMode ? [{ debugName: "children" }] : /* istanbul ignore next */ []));
51
+ /**
52
+ * @description Collection of items to render.
53
+ * @default []
54
+ */
55
+ this.data = input([], /* @ts-ignore */
56
+ ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
57
+ /**
58
+ * @description Predicate that determines whether a node has children. Required when the children selector returns an observable.
59
+ * @default null
60
+ */
61
+ this.hasChildren = input(null, /* @ts-ignore */
62
+ ...(ngDevMode ? [{ debugName: "hasChildren" }] : /* istanbul ignore next */ []));
63
+ /**
64
+ * @description Property name that holds a node's unique identifier. Required when `mode` is set to `"flat"`.
65
+ * @default ""
66
+ */
67
+ this.idField = input("", /* @ts-ignore */
68
+ ...(ngDevMode ? [{ debugName: "idField" }] : /* istanbul ignore next */ []));
69
+ /**
70
+ * @description Shape of the source data: `"hierarchical"` for nested items via `children`, or `"flat"` for a flat list linked by `idField` and `parentIdField`.
71
+ * @default "hierarchical"
72
+ */
73
+ this.mode = input("hierarchical", /* @ts-ignore */
74
+ ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
75
+ /**
76
+ * @description Emitted when the tree-view loses focus.
77
+ */
78
+ this.blur = output();
79
+ /**
80
+ * @description Emitted when the tree-view gains focus.
81
+ */
82
+ this.focus = output();
83
+ /**
84
+ * @description Emitted when a node is clicked.
85
+ */
86
+ this.nodeClick = output();
87
+ /**
88
+ * @description Property name that holds a node's parent identifier. Required when `mode` is set to `"flat"`.
89
+ * @default ""
90
+ */
91
+ this.parentIdField = input("", /* @ts-ignore */
92
+ ...(ngDevMode ? [{ debugName: "parentIdField" }] : /* istanbul ignore next */ []));
93
+ /**
94
+ * @description Property name or accessor used to derive the display text from a data item.
95
+ * @default ""
96
+ */
97
+ this.textField = input("", /* @ts-ignore */
98
+ ...(ngDevMode ? [{ debugName: "textField" }] : /* istanbul ignore next */ []));
99
+ effect(() => {
100
+ const mode = this.mode();
101
+ if (mode === "flat") {
102
+ this.#setFlatDataStructureFields();
103
+ }
104
+ else if (mode === "hierarchical") {
105
+ this.#setHierarchicalDataStructureFields();
106
+ }
107
+ this.#setGenericDataStructureFields(mode);
108
+ });
109
+ effect(() => {
110
+ const animate = this.animate();
111
+ untracked(() => {
112
+ this.treeService.setAnimationEnabled(animate);
113
+ });
114
+ });
115
+ afterNextRender({
116
+ read: () => this.#setSubscriptions()
117
+ });
118
+ }
119
+ moveNode(source, target, position) {
120
+ if (position === "outside") {
121
+ return null;
122
+ }
123
+ const sourceNode = this.treeService.getNodeByUid(source.uid);
124
+ if (!sourceNode) {
125
+ return null;
126
+ }
127
+ const targetNode = this.treeService.getNodeByUid(target.uid);
128
+ if (!targetNode) {
129
+ return null;
130
+ }
131
+ const originalParentUid = sourceNode.parent?.uid ?? null;
132
+ const originalIndex = sourceNode.parent !== null
133
+ ? sourceNode.parent.children().toList().indexOf(sourceNode)
134
+ : this.treeService.nodeSet().toList().indexOf(sourceNode);
135
+ this.treeService.moveNode(sourceNode, targetNode, position);
136
+ return { originalParentUid, originalIndex, sourceNodeUid: sourceNode.uid };
137
+ }
138
+ undoMoveNode(snapshot) {
139
+ const sourceNode = this.treeService.getNodeByUid(snapshot.sourceNodeUid);
140
+ if (!sourceNode) {
141
+ return;
142
+ }
143
+ if (snapshot.originalParentUid === null) {
144
+ this.treeService.detachNode(sourceNode);
145
+ this.treeService.insertNodeAtIndex(sourceNode, null, snapshot.originalIndex);
146
+ }
147
+ else {
148
+ this.treeService.detachNode(sourceNode);
149
+ this.treeService.insertNodeAtIndex(sourceNode, snapshot.originalParentUid, snapshot.originalIndex);
150
+ }
151
+ }
152
+ onFilterChange(event) {
153
+ this.treeService.filterChange$.next(event);
154
+ if (!event.isDefaultPrevented()) {
155
+ this.treeService.filter$.next(event.filter);
156
+ }
157
+ }
158
+ #setFlatDataStructureFields() {
159
+ const idField = this.idField();
160
+ const parentIdField = this.parentIdField();
161
+ untracked(() => {
162
+ this.treeService.setFlatIdField(idField);
163
+ this.treeService.setFlatParentIdField(parentIdField);
164
+ });
165
+ }
166
+ #setGenericDataStructureFields(mode) {
167
+ const textField = this.textField();
168
+ const data = this.data();
169
+ untracked(() => {
170
+ this.treeService.setTextField(textField);
171
+ this.treeService.setDataStructure(mode);
172
+ this.treeService.setData(data);
173
+ });
174
+ }
175
+ #setHierarchicalDataStructureFields() {
176
+ const childrenSelector = this.children();
177
+ const hasChildren = this.hasChildren();
178
+ untracked(() => {
179
+ this.treeService.setChildrenSelector(childrenSelector);
180
+ this.treeService.setHasChildrenPredicate(hasChildren);
181
+ });
182
+ }
183
+ #setSubscriptions() {
184
+ this.treeService.nodeClick$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(event => {
185
+ this.nodeClick.emit(event);
186
+ });
187
+ this.treeService.focus$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(e => this.focus.emit(e));
188
+ this.treeService.blur$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(e => this.blur.emit(e));
189
+ }
190
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TreeViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
191
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: TreeViewComponent, isStandalone: true, selector: "mona-tree-view", inputs: { animate: { classPropertyName: "animate", publicName: "animate", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, children: { classPropertyName: "children", publicName: "children", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, hasChildren: { classPropertyName: "hasChildren", publicName: "hasChildren", isSignal: true, isRequired: false, transformFunction: null }, idField: { classPropertyName: "idField", publicName: "idField", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, parentIdField: { classPropertyName: "parentIdField", publicName: "parentIdField", isSignal: true, isRequired: false, transformFunction: null }, textField: { classPropertyName: "textField", publicName: "textField", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { blur: "blur", focus: "focus", nodeClick: "nodeClick" }, providers: [TreeService], queries: [{ propertyName: "nodeTemplate", first: true, predicate: TreeViewNodeTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: "@if (treeService.filterableOptions().enabled) {\r\n <div role=\"search\" [attr.aria-label]=\"filterAriaLabel()\">\r\n <mona-filter-input\r\n [filter]=\"treeService.filterText()\"\r\n [debounce]=\"treeService.filterableOptions().debounce\"\r\n [placeholder]=\"treeService.filterPlaceholder()\"\r\n (filterChange)=\"onFilterChange($event)\"></mona-filter-input>\r\n </div>\r\n}\r\n<div class=\"flex-1 overflow-auto\">\r\n <mona-tree [ariaLabel]=\"ariaLabel()\">\r\n @if (nodeTemplate()) {\r\n <ng-template monaTreeNodeTemplate let-dataItem let-element=\"element\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"nodeTemplate() ?? null\"\r\n [ngTemplateOutletContext]=\"{ $implicit: dataItem, element }\"></ng-container>\r\n </ng-template>\r\n }\r\n </mona-tree>\r\n</div>\r\n", dependencies: [{ kind: "component", type: FilterInputComponent, selector: "mona-filter-input", inputs: ["debounce", "filter", "placeholder", "size"], outputs: ["filterChange", "inputBlur", "inputFocus"] }, { kind: "component", type: TreeComponent, selector: "mona-tree", inputs: ["ariaLabel", "data"] }, { kind: "directive", type: TreeNodeTemplateDirective, selector: "ng-template[monaTreeNodeTemplate]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
192
+ }
193
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TreeViewComponent, decorators: [{
194
+ type: Component,
195
+ args: [{ selector: "mona-tree-view", imports: [FilterInputComponent, TreeComponent, TreeNodeTemplateDirective, NgTemplateOutlet], providers: [TreeService], template: "@if (treeService.filterableOptions().enabled) {\r\n <div role=\"search\" [attr.aria-label]=\"filterAriaLabel()\">\r\n <mona-filter-input\r\n [filter]=\"treeService.filterText()\"\r\n [debounce]=\"treeService.filterableOptions().debounce\"\r\n [placeholder]=\"treeService.filterPlaceholder()\"\r\n (filterChange)=\"onFilterChange($event)\"></mona-filter-input>\r\n </div>\r\n}\r\n<div class=\"flex-1 overflow-auto\">\r\n <mona-tree [ariaLabel]=\"ariaLabel()\">\r\n @if (nodeTemplate()) {\r\n <ng-template monaTreeNodeTemplate let-dataItem let-element=\"element\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"nodeTemplate() ?? null\"\r\n [ngTemplateOutletContext]=\"{ $implicit: dataItem, element }\"></ng-container>\r\n </ng-template>\r\n }\r\n </mona-tree>\r\n</div>\r\n" }]
196
+ }], ctorParameters: () => [], propDecorators: { nodeTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => TreeViewNodeTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], animate: [{ type: i0.Input, args: [{ isSignal: true, alias: "animate", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], children: [{ type: i0.Input, args: [{ isSignal: true, alias: "children", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], hasChildren: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasChildren", required: false }] }], idField: [{ type: i0.Input, args: [{ isSignal: true, alias: "idField", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], blur: [{ type: i0.Output, args: ["blur"] }], focus: [{ type: i0.Output, args: ["focus"] }], nodeClick: [{ type: i0.Output, args: ["nodeClick"] }], parentIdField: [{ type: i0.Input, args: [{ isSignal: true, alias: "parentIdField", required: false }] }], textField: [{ type: i0.Input, args: [{ isSignal: true, alias: "textField", required: false }] }] } });
197
+
198
+ class TreeViewCheckableDirective {
199
+ #defaultOptions;
200
+ #destroyRef;
201
+ #treeService;
202
+ constructor() {
203
+ this.#defaultOptions = {
204
+ checkChildren: true,
205
+ checkParents: true,
206
+ enabled: true,
207
+ mode: "multiple"
208
+ };
209
+ this.#destroyRef = inject(DestroyRef);
210
+ this.#treeService = inject(TreeService);
211
+ /**
212
+ * @description Property name or accessor used to derive a node's check key from its data. Falls back to the node's data when unset.
213
+ * @default ""
214
+ */
215
+ this.checkBy = input("", /* @ts-ignore */
216
+ ...(ngDevMode ? [{ debugName: "checkBy" }] : /* istanbul ignore next */ []));
217
+ /**
218
+ * @description Keys of the currently checked nodes.
219
+ * @default []
220
+ */
221
+ this.checkedKeys = input([], /* @ts-ignore */
222
+ ...(ngDevMode ? [{ debugName: "checkedKeys" }] : /* istanbul ignore next */ []));
223
+ /**
224
+ * @description Emitted when the checked keys change.
225
+ */
226
+ this.checkedKeysChange = output();
227
+ /**
228
+ * @description Predicate that determines whether a node displays a checkbox. When unset, every node displays a checkbox.
229
+ * @default null
230
+ */
231
+ this.hasCheckbox = input(null, /* @ts-ignore */
232
+ ...(ngDevMode ? [{ debugName: "hasCheckbox" }] : /* istanbul ignore next */ []));
233
+ /**
234
+ * @description Emitted when a node is checked or unchecked.
235
+ */
236
+ this.nodeCheck = output();
237
+ /**
238
+ * @description Configures check mode and whether checking a node also checks its children or parents. Merged over `{ checkChildren: true, checkParents: true, enabled: true, mode: "multiple" }` when applied bare.
239
+ * @default ""
240
+ */
241
+ this.options = input("", { ...(ngDevMode ? { debugName: "options" } : /* istanbul ignore next */ {}), alias: "monaTreeViewCheckable" });
242
+ effect(() => {
243
+ const checkBy = this.checkBy();
244
+ untracked(() => {
245
+ this.#treeService.setCheckBy(checkBy ?? "");
246
+ });
247
+ });
248
+ effect(() => {
249
+ const checkedKeys = this.checkedKeys();
250
+ untracked(() => {
251
+ this.#treeService.setCheckedKeys(checkedKeys ?? []);
252
+ });
253
+ });
254
+ effect(() => {
255
+ const options = this.options();
256
+ untracked(() => {
257
+ if (options === "") {
258
+ this.#treeService.setCheckableOptions(this.#defaultOptions);
259
+ }
260
+ else {
261
+ this.#treeService.setCheckableOptions({
262
+ ...this.#defaultOptions,
263
+ ...options
264
+ });
265
+ }
266
+ });
267
+ });
268
+ effect(() => {
269
+ const hasCheckbox = this.hasCheckbox();
270
+ untracked(() => {
271
+ this.#treeService.setHasCheckboxPredicate(hasCheckbox);
272
+ });
273
+ });
274
+ }
275
+ ngOnInit() {
276
+ this.setNodeCheckSubscription();
277
+ }
278
+ setNodeCheckSubscription() {
279
+ this.#treeService.checkedKeys$
280
+ .pipe(pairwise(), takeUntilDestroyed(this.#destroyRef))
281
+ .subscribe(([oldKeys, keys]) => {
282
+ const orderedOldKeys = oldKeys.orderBy(k => k);
283
+ const orderedKeys = keys.orderBy(k => k);
284
+ if (sequenceEqual(orderedOldKeys, orderedKeys)) {
285
+ return;
286
+ }
287
+ this.checkedKeysChange.emit(keys.toArray());
288
+ });
289
+ this.#treeService.nodeCheck$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(event => {
290
+ this.nodeCheck.emit(event);
291
+ });
292
+ }
293
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TreeViewCheckableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
294
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: TreeViewCheckableDirective, isStandalone: true, selector: "mona-tree-view[monaTreeViewCheckable]", inputs: { checkBy: { classPropertyName: "checkBy", publicName: "checkBy", isSignal: true, isRequired: false, transformFunction: null }, checkedKeys: { classPropertyName: "checkedKeys", publicName: "checkedKeys", isSignal: true, isRequired: false, transformFunction: null }, hasCheckbox: { classPropertyName: "hasCheckbox", publicName: "hasCheckbox", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "monaTreeViewCheckable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedKeysChange: "checkedKeysChange", nodeCheck: "nodeCheck" }, exportAs: ["monaTreeViewCheckable"], ngImport: i0 }); }
295
+ }
296
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TreeViewCheckableDirective, decorators: [{
297
+ type: Directive,
298
+ args: [{
299
+ selector: "mona-tree-view[monaTreeViewCheckable]",
300
+ exportAs: "monaTreeViewCheckable"
301
+ }]
302
+ }], ctorParameters: () => [], propDecorators: { checkBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkBy", required: false }] }], checkedKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkedKeys", required: false }] }], checkedKeysChange: [{ type: i0.Output, args: ["checkedKeysChange"] }], hasCheckbox: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasCheckbox", required: false }] }], nodeCheck: [{ type: i0.Output, args: ["nodeCheck"] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "monaTreeViewCheckable", required: false }] }] } });
303
+
304
+ class TreeViewDisableDirective {
305
+ #defaultOptions;
306
+ #treeService;
307
+ constructor() {
308
+ this.#defaultOptions = {
309
+ disableChildren: true,
310
+ enabled: true
311
+ };
312
+ this.#treeService = inject(TreeService);
313
+ /**
314
+ * @description Property name or accessor used to derive a node's disable key from its data. Falls back to the node's data when unset.
315
+ * @default ""
316
+ */
317
+ this.disableBy = input("", /* @ts-ignore */
318
+ ...(ngDevMode ? [{ debugName: "disableBy" }] : /* istanbul ignore next */ []));
319
+ /**
320
+ * @description Keys of the currently disabled nodes.
321
+ * @default []
322
+ */
323
+ this.disabledKeys = input([], /* @ts-ignore */
324
+ ...(ngDevMode ? [{ debugName: "disabledKeys" }] : /* istanbul ignore next */ []));
325
+ /**
326
+ * @description Configures whether disabling a node also disables its children. Merged over `{ disableChildren: true, enabled: true }` when applied bare.
327
+ * @default ""
328
+ */
329
+ this.options = input("", { ...(ngDevMode ? { debugName: "options" } : /* istanbul ignore next */ {}), alias: "monaTreeViewDisable" });
330
+ effect(() => {
331
+ const disableBy = this.disableBy();
332
+ untracked(() => {
333
+ this.#treeService.setDisableBy(disableBy ?? "");
334
+ });
335
+ });
336
+ effect(() => {
337
+ const disabledKeys = this.disabledKeys();
338
+ untracked(() => {
339
+ this.#treeService.setDisabledKeys(disabledKeys ?? []);
340
+ });
341
+ });
342
+ effect(() => {
343
+ const options = this.options();
344
+ untracked(() => {
345
+ if (options === "") {
346
+ this.#treeService.setDisableOptions(this.#defaultOptions);
347
+ }
348
+ else {
349
+ this.#treeService.setDisableOptions({
350
+ ...this.#defaultOptions,
351
+ ...options
352
+ });
353
+ }
354
+ });
355
+ });
356
+ }
357
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TreeViewDisableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
358
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: TreeViewDisableDirective, isStandalone: true, selector: "mona-tree-view[monaTreeViewDisable]", inputs: { disableBy: { classPropertyName: "disableBy", publicName: "disableBy", isSignal: true, isRequired: false, transformFunction: null }, disabledKeys: { classPropertyName: "disabledKeys", publicName: "disabledKeys", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "monaTreeViewDisable", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["monaTreeViewDisable"], ngImport: i0 }); }
359
+ }
360
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TreeViewDisableDirective, decorators: [{
361
+ type: Directive,
362
+ args: [{
363
+ selector: "mona-tree-view[monaTreeViewDisable]",
364
+ exportAs: "monaTreeViewDisable"
365
+ }]
366
+ }], ctorParameters: () => [], propDecorators: { disableBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableBy", required: false }] }], disabledKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledKeys", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "monaTreeViewDisable", required: false }] }] } });
367
+
368
+ class TreeViewDragAndDropDirective {
369
+ #defaultOptions;
370
+ #destroyRef;
371
+ #treeService;
372
+ #treeView;
373
+ constructor() {
374
+ this.#defaultOptions = {
375
+ enabled: true
376
+ };
377
+ this.#destroyRef = inject(DestroyRef);
378
+ this.#treeService = inject(TreeService);
379
+ this.#treeView = inject((TreeViewComponent));
380
+ /**
381
+ * @description Emitted while a node is being dragged.
382
+ */
383
+ this.nodeDrag = output();
384
+ /**
385
+ * @description Emitted when a node drag ends.
386
+ */
387
+ this.nodeDragEnd = output();
388
+ /**
389
+ * @description Emitted when a node drag starts.
390
+ */
391
+ this.nodeDragStart = output();
392
+ /**
393
+ * @description Emitted when a node is dropped.
394
+ */
395
+ this.nodeDrop = output();
396
+ /**
397
+ * @description Configures whether dragging nodes to reorder or reparent them is enabled. Merged over `{ enabled: true }` when applied bare.
398
+ * @default ""
399
+ */
400
+ this.options = input("", { ...(ngDevMode ? { debugName: "options" } : /* istanbul ignore next */ {}), alias: "monaTreeViewDragAndDrop" });
401
+ effect(() => {
402
+ const options = this.options();
403
+ untracked(() => {
404
+ if (options === "") {
405
+ this.#treeService.setDraggableOptions(this.#defaultOptions);
406
+ }
407
+ else {
408
+ this.#treeService.setDraggableOptions({
409
+ ...this.#defaultOptions,
410
+ ...options
411
+ });
412
+ }
413
+ });
414
+ });
415
+ afterNextRender({
416
+ read: () => this.setSubscriptions()
417
+ });
418
+ }
419
+ setSubscriptions() {
420
+ this.#treeService.nodeDrag$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(e => {
421
+ this.nodeDrag.emit(e.dragEvent);
422
+ });
423
+ this.#treeService.nodeDragEnd$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(e => {
424
+ this.nodeDragEnd.emit(e);
425
+ });
426
+ this.#treeService.nodeDragStart$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(e => {
427
+ this.nodeDragStart.emit(e);
428
+ });
429
+ this.#treeService.nodeDrop$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(e => {
430
+ const event = new NodeDropEvent({
431
+ event: e.event,
432
+ position: e.position,
433
+ sourceNode: e.sourceNode,
434
+ targetNode: e.targetNode,
435
+ treeView: this.#treeView
436
+ });
437
+ this.nodeDrop.emit(event);
438
+ });
439
+ }
440
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TreeViewDragAndDropDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
441
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: TreeViewDragAndDropDirective, isStandalone: true, selector: "mona-tree-view[monaTreeViewDragAndDrop]", inputs: { options: { classPropertyName: "options", publicName: "monaTreeViewDragAndDrop", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { nodeDrag: "nodeDrag", nodeDragEnd: "nodeDragEnd", nodeDragStart: "nodeDragStart", nodeDrop: "nodeDrop" }, exportAs: ["monaTreeViewDragAndDrop"], ngImport: i0 }); }
442
+ }
443
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TreeViewDragAndDropDirective, decorators: [{
444
+ type: Directive,
445
+ args: [{
446
+ selector: "mona-tree-view[monaTreeViewDragAndDrop]",
447
+ exportAs: "monaTreeViewDragAndDrop"
448
+ }]
449
+ }], ctorParameters: () => [], propDecorators: { nodeDrag: [{ type: i0.Output, args: ["nodeDrag"] }], nodeDragEnd: [{ type: i0.Output, args: ["nodeDragEnd"] }], nodeDragStart: [{ type: i0.Output, args: ["nodeDragStart"] }], nodeDrop: [{ type: i0.Output, args: ["nodeDrop"] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "monaTreeViewDragAndDrop", required: false }] }] } });
450
+
451
+ class TreeViewExpandableDirective {
452
+ #defaultOptions;
453
+ #destroyRef;
454
+ #treeService;
455
+ constructor() {
456
+ this.#defaultOptions = {
457
+ enabled: true
458
+ };
459
+ this.#destroyRef = inject(DestroyRef);
460
+ this.#treeService = inject(TreeService);
461
+ /**
462
+ * @description Emitted when a node is collapsed.
463
+ */
464
+ this.collapse = output();
465
+ /**
466
+ * @description Emitted when a node is expanded.
467
+ */
468
+ this.expand = output();
469
+ /**
470
+ * @description Property name or accessor used to derive a node's expand key from its data. Falls back to the node's data when unset.
471
+ * @default ""
472
+ */
473
+ this.expandBy = input("", /* @ts-ignore */
474
+ ...(ngDevMode ? [{ debugName: "expandBy" }] : /* istanbul ignore next */ []));
475
+ /**
476
+ * @description Keys of the currently expanded nodes.
477
+ * @default []
478
+ */
479
+ this.expandedKeys = input([], /* @ts-ignore */
480
+ ...(ngDevMode ? [{ debugName: "expandedKeys" }] : /* istanbul ignore next */ []));
481
+ /**
482
+ * @description Emitted when the expanded keys change.
483
+ */
484
+ this.expandedKeysChange = output();
485
+ /**
486
+ * @description Configures whether expanding and collapsing nodes is enabled. Merged over `{ enabled: true }` when applied bare.
487
+ * @default ""
488
+ */
489
+ this.options = input("", { ...(ngDevMode ? { debugName: "options" } : /* istanbul ignore next */ {}), alias: "monaTreeViewExpandable" });
490
+ effect(() => {
491
+ const expandBy = this.expandBy();
492
+ untracked(() => {
493
+ this.#treeService.setExpandBy(expandBy ?? "");
494
+ });
495
+ });
496
+ effect(() => {
497
+ const expandedKeys = this.expandedKeys();
498
+ untracked(() => {
499
+ this.#treeService.setExpandedKeys(expandedKeys ?? []);
500
+ });
501
+ });
502
+ effect(() => {
503
+ const options = this.options();
504
+ untracked(() => {
505
+ if (options === "") {
506
+ this.#treeService.setExpandableOptions(this.#defaultOptions);
507
+ }
508
+ else {
509
+ this.#treeService.setExpandableOptions({
510
+ ...this.#defaultOptions,
511
+ ...options
512
+ });
513
+ }
514
+ });
515
+ });
516
+ afterNextRender({
517
+ read: () => this.setSubscriptions()
518
+ });
519
+ }
520
+ setSubscriptions() {
521
+ this.#treeService.expandedKeys$
522
+ .pipe(pairwise(), takeUntilDestroyed(this.#destroyRef))
523
+ .subscribe(([oldKeys, keys]) => {
524
+ const orderedOldKeys = oldKeys.orderBy(k => k);
525
+ const orderedKeys = keys.orderBy(k => k);
526
+ if (sequenceEqual(orderedOldKeys, orderedKeys)) {
527
+ return;
528
+ }
529
+ this.expandedKeysChange.emit(keys.toArray());
530
+ });
531
+ this.#treeService.nodeExpand$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(event => {
532
+ if (event.expanded) {
533
+ this.expand.emit(event.node.nodeItem);
534
+ }
535
+ else {
536
+ this.collapse.emit(event.node.nodeItem);
537
+ }
538
+ });
539
+ }
540
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TreeViewExpandableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
541
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: TreeViewExpandableDirective, isStandalone: true, selector: "mona-tree-view[monaTreeViewExpandable]", inputs: { expandBy: { classPropertyName: "expandBy", publicName: "expandBy", isSignal: true, isRequired: false, transformFunction: null }, expandedKeys: { classPropertyName: "expandedKeys", publicName: "expandedKeys", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "monaTreeViewExpandable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { collapse: "collapse", expand: "expand", expandedKeysChange: "expandedKeysChange" }, exportAs: ["monaTreeViewExpandable"], ngImport: i0 }); }
542
+ }
543
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TreeViewExpandableDirective, decorators: [{
544
+ type: Directive,
545
+ args: [{
546
+ selector: "mona-tree-view[monaTreeViewExpandable]",
547
+ exportAs: "monaTreeViewExpandable"
548
+ }]
549
+ }], ctorParameters: () => [], propDecorators: { collapse: [{ type: i0.Output, args: ["collapse"] }], expand: [{ type: i0.Output, args: ["expand"] }], expandBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "expandBy", required: false }] }], expandedKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "expandedKeys", required: false }] }], expandedKeysChange: [{ type: i0.Output, args: ["expandedKeysChange"] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "monaTreeViewExpandable", required: false }] }] } });
550
+
551
+ class TreeViewFilterableDirective {
552
+ #defaultOptions;
553
+ #destroyRef;
554
+ #treeService;
555
+ constructor() {
556
+ this.#defaultOptions = {
557
+ enabled: true,
558
+ operator: "contains",
559
+ caseSensitive: false,
560
+ debounce: 0
561
+ };
562
+ this.#destroyRef = inject(DestroyRef);
563
+ this.#treeService = inject(TreeService);
564
+ /**
565
+ * @description Current filter text used to narrow the visible nodes.
566
+ * @default ""
567
+ */
568
+ this.filter = input("", /* @ts-ignore */
569
+ ...(ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []));
570
+ /**
571
+ * @description Emitted when the filter value changes.
572
+ */
573
+ this.filterChange = output();
574
+ /**
575
+ * @description Placeholder text shown in the filter input.
576
+ * @default ""
577
+ */
578
+ this.filterPlaceholder = input("", /* @ts-ignore */
579
+ ...(ngDevMode ? [{ debugName: "filterPlaceholder" }] : /* istanbul ignore next */ []));
580
+ /**
581
+ * @description Configures the filter operator, case sensitivity, and debounce delay. Merged over `{ enabled: true, operator: "contains", caseSensitive: false, debounce: 0 }` when applied bare.
582
+ * @default ""
583
+ */
584
+ this.options = input("", { ...(ngDevMode ? { debugName: "options" } : /* istanbul ignore next */ {}), alias: "monaTreeViewFilterable" });
585
+ effect(() => {
586
+ const filter = this.filter();
587
+ untracked(() => this.#treeService.filter$.next(filter));
588
+ });
589
+ effect(() => {
590
+ const filterPlaceholder = this.filterPlaceholder();
591
+ untracked(() => this.#treeService.filterPlaceholder.set(filterPlaceholder));
592
+ });
593
+ effect(() => {
594
+ const options = this.options();
595
+ untracked(() => {
596
+ if (options === "") {
597
+ this.#treeService.setFilterableOptions(this.#defaultOptions);
598
+ }
599
+ else {
600
+ this.#treeService.setFilterableOptions({
601
+ ...this.#defaultOptions,
602
+ ...options
603
+ });
604
+ }
605
+ });
606
+ });
607
+ afterNextRender({
608
+ read: () => this.setSubscription()
609
+ });
610
+ }
611
+ setSubscription() {
612
+ this.#treeService.filterChange$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(event => {
613
+ this.filterChange.emit(event);
614
+ });
615
+ }
616
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TreeViewFilterableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
617
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: TreeViewFilterableDirective, isStandalone: true, selector: "mona-tree-view[monaTreeViewFilterable]", inputs: { filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, filterPlaceholder: { classPropertyName: "filterPlaceholder", publicName: "filterPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "monaTreeViewFilterable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { filterChange: "filterChange" }, exportAs: ["monaTreeViewFilterable"], ngImport: i0 }); }
618
+ }
619
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TreeViewFilterableDirective, decorators: [{
620
+ type: Directive,
621
+ args: [{
622
+ selector: "mona-tree-view[monaTreeViewFilterable]",
623
+ exportAs: "monaTreeViewFilterable"
624
+ }]
625
+ }], ctorParameters: () => [], propDecorators: { filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: false }] }], filterChange: [{ type: i0.Output, args: ["filterChange"] }], filterPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterPlaceholder", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "monaTreeViewFilterable", required: false }] }] } });
626
+
627
+ class TreeViewSelectableDirective {
628
+ #defaultOptions;
629
+ #destroyRef;
630
+ #treeService;
631
+ constructor() {
632
+ this.#defaultOptions = {
633
+ childrenOnly: false,
634
+ enabled: true,
635
+ mode: "single",
636
+ toggleable: false
637
+ };
638
+ this.#destroyRef = inject(DestroyRef);
639
+ this.#treeService = inject(TreeService);
640
+ /**
641
+ * @description Emitted when a node is selected or deselected.
642
+ */
643
+ this.nodeSelect = output();
644
+ /**
645
+ * @description Property name or accessor used to derive a node's selection key from its data. Falls back to the node's data when unset.
646
+ * @default ""
647
+ */
648
+ this.selectBy = input("", /* @ts-ignore */
649
+ ...(ngDevMode ? [{ debugName: "selectBy" }] : /* istanbul ignore next */ []));
650
+ /**
651
+ * @description Keys of the currently selected nodes.
652
+ * @default []
653
+ */
654
+ this.selectedKeys = input([], /* @ts-ignore */
655
+ ...(ngDevMode ? [{ debugName: "selectedKeys" }] : /* istanbul ignore next */ []));
656
+ /**
657
+ * @description Emitted when the selected keys change.
658
+ */
659
+ this.selectedKeysChange = output();
660
+ /**
661
+ * @description Emitted when the selection changes.
662
+ */
663
+ this.selectionChange = output();
664
+ /**
665
+ * @description Configures selection mode, toggleability, and whether only child nodes are selectable. Merged over `{ childrenOnly: false, enabled: true, mode: "single", toggleable: false }` when applied bare.
666
+ * @default ""
667
+ */
668
+ this.options = input("", { ...(ngDevMode ? { debugName: "options" } : /* istanbul ignore next */ {}), alias: "monaTreeViewSelectable" });
669
+ effect(() => {
670
+ const selectBy = this.selectBy();
671
+ untracked(() => this.#treeService.setSelectBy(selectBy ?? ""));
672
+ });
673
+ effect(() => {
674
+ const selectedKeys = this.selectedKeys();
675
+ untracked(() => this.#treeService.setSelectedKeys(selectedKeys ?? []));
676
+ });
677
+ effect(() => {
678
+ const options = this.options();
679
+ untracked(() => {
680
+ if (options === "") {
681
+ this.#treeService.setSelectableOptions(this.#defaultOptions);
682
+ }
683
+ else {
684
+ this.#treeService.setSelectableOptions({
685
+ ...this.#defaultOptions,
686
+ ...options
687
+ });
688
+ }
689
+ });
690
+ });
691
+ }
692
+ ngOnInit() {
693
+ this.setNodeSelectSubscription();
694
+ }
695
+ setNodeSelectSubscription() {
696
+ this.#treeService.nodeSelect$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(event => {
697
+ this.nodeSelect.emit(event);
698
+ });
699
+ this.#treeService.selectedKeys$
700
+ .pipe(pairwise(), takeUntilDestroyed(this.#destroyRef))
701
+ .subscribe(([oldKeys, keys]) => {
702
+ const orderedOldKeys = oldKeys.orderBy(k => k);
703
+ const orderedKeys = keys.orderBy(k => k);
704
+ if (sequenceEqual(orderedOldKeys, orderedKeys)) {
705
+ return;
706
+ }
707
+ this.selectedKeysChange.emit(keys.toArray());
708
+ });
709
+ this.#treeService.selectionChange$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(nodeItem => {
710
+ this.selectionChange.emit(nodeItem);
711
+ });
712
+ }
713
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TreeViewSelectableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
714
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: TreeViewSelectableDirective, isStandalone: true, selector: "mona-tree-view[monaTreeViewSelectable]", inputs: { selectBy: { classPropertyName: "selectBy", publicName: "selectBy", isSignal: true, isRequired: false, transformFunction: null }, selectedKeys: { classPropertyName: "selectedKeys", publicName: "selectedKeys", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "monaTreeViewSelectable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { nodeSelect: "nodeSelect", selectedKeysChange: "selectedKeysChange", selectionChange: "selectionChange" }, exportAs: ["monaTreeViewSelectable"], ngImport: i0 }); }
715
+ }
716
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TreeViewSelectableDirective, decorators: [{
717
+ type: Directive,
718
+ args: [{
719
+ selector: "mona-tree-view[monaTreeViewSelectable]",
720
+ exportAs: "monaTreeViewSelectable"
721
+ }]
722
+ }], ctorParameters: () => [], propDecorators: { nodeSelect: [{ type: i0.Output, args: ["nodeSelect"] }], selectBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectBy", required: false }] }], selectedKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedKeys", required: false }] }], selectedKeysChange: [{ type: i0.Output, args: ["selectedKeysChange"] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "monaTreeViewSelectable", required: false }] }] } });
723
+
724
+ /*
725
+ * Public API Surface of @nanahoshi/mona-ui/tree-view
726
+ */
727
+
728
+ /**
729
+ * Generated bundle index. Do not edit.
730
+ */
731
+
732
+ export { TreeViewCheckableDirective, TreeViewComponent, TreeViewDisableDirective, TreeViewDragAndDropDirective, TreeViewExpandableDirective, TreeViewFilterableDirective, TreeViewNodeTemplateDirective, TreeViewSelectableDirective };
733
+ //# sourceMappingURL=nanahoshi-mona-ui-tree-view.mjs.map