@wirekyt/angular 0.0.31 → 0.0.32
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/dist/fesm2022/wirekyt-angular-menu.mjs +1041 -0
- package/dist/fesm2022/wirekyt-angular-menu.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-select.mjs +0 -38
- package/dist/fesm2022/wirekyt-angular-select.mjs.map +1 -1
- package/dist/fesm2022/wirekyt-angular-tooltip.mjs +0 -1
- package/dist/fesm2022/wirekyt-angular-tooltip.mjs.map +1 -1
- package/dist/package.json +5 -1
- package/dist/types/wirekyt-angular-checkbox.d.ts +1 -1
- package/dist/types/wirekyt-angular-color-picker.d.ts +1 -1
- package/dist/types/wirekyt-angular-combobox.d.ts +1 -1
- package/dist/types/wirekyt-angular-date-picker.d.ts +1 -1
- package/dist/types/wirekyt-angular-menu.d.ts +340 -0
- package/dist/types/wirekyt-angular-menu.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-select.d.ts +0 -38
- package/dist/types/wirekyt-angular-select.d.ts.map +1 -1
- package/dist/types/wirekyt-angular-tooltip.d.ts +0 -1
- package/dist/types/wirekyt-angular-tooltip.d.ts.map +1 -1
- package/package.json +6 -2
|
@@ -0,0 +1,1041 @@
|
|
|
1
|
+
import * as menu from '@wirekyt/dom/machines/menu';
|
|
2
|
+
export { anatomy as menuAnatomy } from '@wirekyt/dom/machines/menu';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { InjectionToken, inject, input, model, booleanAttribute, output, EnvironmentInjector, Injector, computed, DestroyRef, afterNextRender, forwardRef, Directive, Renderer2, ElementRef, TemplateRef, ViewContainerRef, effect, untracked } from '@angular/core';
|
|
5
|
+
import { injectLocale, injectEnvironment, createId, useMachine, buildRootCarrier, bindProps } from '@wirekyt/angular';
|
|
6
|
+
import { PresenceBase, PRESENCE_CONTEXT, injectPresenceContext } from '@wirekyt/angular/presence';
|
|
7
|
+
|
|
8
|
+
const MENU_CONTEXT = new InjectionToken("WIREKYT.MENU_CONTEXT");
|
|
9
|
+
function injectMenuContext() {
|
|
10
|
+
return inject(MENU_CONTEXT);
|
|
11
|
+
}
|
|
12
|
+
const MENU_CONTEXT_CARRIER = new InjectionToken("WIREKYT.MENU_CONTEXT_CARRIER");
|
|
13
|
+
function injectMenuContextCarrier() {
|
|
14
|
+
return inject(MENU_CONTEXT_CARRIER);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function useMenu(options) {
|
|
18
|
+
const locale = injectLocale();
|
|
19
|
+
const environment = injectEnvironment();
|
|
20
|
+
const fallbackId = createId();
|
|
21
|
+
return useMachine({
|
|
22
|
+
machine: menu.machine,
|
|
23
|
+
context: () => {
|
|
24
|
+
const props = options.context();
|
|
25
|
+
return {
|
|
26
|
+
...props,
|
|
27
|
+
dir: locale.dir,
|
|
28
|
+
getRootNode: environment.getRootNode,
|
|
29
|
+
id: props.id ?? fallbackId,
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
connect: (service, normalize) => menu.connect(service, normalize),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const MENU_TRIGGER_ITEM_CONTEXT = new InjectionToken("WIREKYT.MENU_TRIGGER_ITEM_CONTEXT");
|
|
37
|
+
function injectMenuTriggerItemContext() {
|
|
38
|
+
return inject(MENU_TRIGGER_ITEM_CONTEXT);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
class MenuRoot extends PresenceBase {
|
|
42
|
+
id = input(undefined, /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
44
|
+
ids = input(undefined, /* @ts-ignore */
|
|
45
|
+
...(ngDevMode ? [{ debugName: "ids" }] : /* istanbul ignore next */ []));
|
|
46
|
+
open = model(undefined, /* @ts-ignore */
|
|
47
|
+
...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
48
|
+
defaultOpen = input(false, { ...(ngDevMode ? { debugName: "defaultOpen" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
49
|
+
highlightedValue = model(undefined, /* @ts-ignore */
|
|
50
|
+
...(ngDevMode ? [{ debugName: "highlightedValue" }] : /* istanbul ignore next */ []));
|
|
51
|
+
defaultHighlightedValue = input(undefined, /* @ts-ignore */
|
|
52
|
+
...(ngDevMode ? [{ debugName: "defaultHighlightedValue" }] : /* istanbul ignore next */ []));
|
|
53
|
+
loopFocus = input(false, { ...(ngDevMode ? { debugName: "loopFocus" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
54
|
+
closeOnSelect = input(undefined, { ...(ngDevMode ? { debugName: "closeOnSelect" } : /* istanbul ignore next */ {}), transform: optionalBooleanAttribute });
|
|
55
|
+
typeahead = input(undefined, { ...(ngDevMode ? { debugName: "typeahead" } : /* istanbul ignore next */ {}), transform: optionalBooleanAttribute });
|
|
56
|
+
composite = input(undefined, { ...(ngDevMode ? { debugName: "composite" } : /* istanbul ignore next */ {}), transform: optionalBooleanAttribute });
|
|
57
|
+
positioning = input(undefined, /* @ts-ignore */
|
|
58
|
+
...(ngDevMode ? [{ debugName: "positioning" }] : /* istanbul ignore next */ []));
|
|
59
|
+
ariaLabel = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
|
|
60
|
+
anchorPoint = input(undefined, /* @ts-ignore */
|
|
61
|
+
...(ngDevMode ? [{ debugName: "anchorPoint" }] : /* istanbul ignore next */ []));
|
|
62
|
+
navigate = input(undefined, /* @ts-ignore */
|
|
63
|
+
...(ngDevMode ? [{ debugName: "navigate" }] : /* istanbul ignore next */ []));
|
|
64
|
+
triggerValue = model(undefined, /* @ts-ignore */
|
|
65
|
+
...(ngDevMode ? [{ debugName: "triggerValue" }] : /* istanbul ignore next */ []));
|
|
66
|
+
defaultTriggerValue = input(undefined, /* @ts-ignore */
|
|
67
|
+
...(ngDevMode ? [{ debugName: "defaultTriggerValue" }] : /* istanbul ignore next */ []));
|
|
68
|
+
select = output();
|
|
69
|
+
escapeKeyDown = output();
|
|
70
|
+
focusOutside = output();
|
|
71
|
+
highlightChange = output();
|
|
72
|
+
interactOutside = output();
|
|
73
|
+
openChangeDetails = output();
|
|
74
|
+
pointerDownOutside = output();
|
|
75
|
+
requestDismiss = output();
|
|
76
|
+
triggerValueChangeDetails = output();
|
|
77
|
+
machine = useMenu({
|
|
78
|
+
context: () => ({
|
|
79
|
+
id: this.id(),
|
|
80
|
+
ids: this.ids(),
|
|
81
|
+
open: this.open(),
|
|
82
|
+
defaultOpen: this.defaultOpen(),
|
|
83
|
+
highlightedValue: this.highlightedValue(),
|
|
84
|
+
defaultHighlightedValue: this.defaultHighlightedValue(),
|
|
85
|
+
loopFocus: this.loopFocus(),
|
|
86
|
+
closeOnSelect: this.closeOnSelect(),
|
|
87
|
+
typeahead: this.typeahead(),
|
|
88
|
+
composite: this.composite(),
|
|
89
|
+
positioning: this.positioning(),
|
|
90
|
+
"aria-label": this.ariaLabel(),
|
|
91
|
+
anchorPoint: this.anchorPoint(),
|
|
92
|
+
navigate: this.navigate(),
|
|
93
|
+
triggerValue: this.triggerValue(),
|
|
94
|
+
defaultTriggerValue: this.defaultTriggerValue(),
|
|
95
|
+
onOpenChange: (details) => {
|
|
96
|
+
if (this.open() !== details.open)
|
|
97
|
+
this.open.set(details.open);
|
|
98
|
+
this.openChangeDetails.emit(details);
|
|
99
|
+
},
|
|
100
|
+
onHighlightChange: (details) => {
|
|
101
|
+
if (this.highlightedValue() !== details.highlightedValue) {
|
|
102
|
+
this.highlightedValue.set(details.highlightedValue);
|
|
103
|
+
}
|
|
104
|
+
this.highlightChange.emit(details);
|
|
105
|
+
},
|
|
106
|
+
onSelect: (details) => {
|
|
107
|
+
this.select.emit(details);
|
|
108
|
+
},
|
|
109
|
+
onTriggerValueChange: (details) => {
|
|
110
|
+
if (this.triggerValue() !== details.value)
|
|
111
|
+
this.triggerValue.set(details.value);
|
|
112
|
+
this.triggerValueChangeDetails.emit(details);
|
|
113
|
+
},
|
|
114
|
+
onEscapeKeyDown: (event) => this.escapeKeyDown.emit(event),
|
|
115
|
+
onFocusOutside: (event) => this.focusOutside.emit(event),
|
|
116
|
+
onInteractOutside: (event) => this.interactOutside.emit(event),
|
|
117
|
+
onPointerDownOutside: (event) => this.pointerDownOutside.emit(event),
|
|
118
|
+
onRequestDismiss: (event) => this.requestDismiss.emit(event),
|
|
119
|
+
}),
|
|
120
|
+
});
|
|
121
|
+
state = this.machine.state;
|
|
122
|
+
api = this.machine.api;
|
|
123
|
+
service = this.machine.service;
|
|
124
|
+
send = this.machine.send;
|
|
125
|
+
presence = this.createPresence(() => this.api().open);
|
|
126
|
+
contextCarrier = buildRootCarrier({
|
|
127
|
+
providers: [{ provide: PRESENCE_CONTEXT, useValue: this.presence }],
|
|
128
|
+
root: this,
|
|
129
|
+
rootToken: MENU_CONTEXT,
|
|
130
|
+
originInjector: inject(Injector),
|
|
131
|
+
environmentInjector: inject(EnvironmentInjector),
|
|
132
|
+
});
|
|
133
|
+
parentMenu = inject(MENU_CONTEXT, {
|
|
134
|
+
optional: true,
|
|
135
|
+
skipSelf: true,
|
|
136
|
+
});
|
|
137
|
+
triggerItemProps = computed(() => this.parentMenu?.api().getTriggerItemProps(this.api()), /* @ts-ignore */
|
|
138
|
+
...(ngDevMode ? [{ debugName: "triggerItemProps" }] : /* istanbul ignore next */ []));
|
|
139
|
+
constructor() {
|
|
140
|
+
super();
|
|
141
|
+
const parent = this.parentMenu;
|
|
142
|
+
if (parent) {
|
|
143
|
+
const destroyRef = inject(DestroyRef);
|
|
144
|
+
let connected = false;
|
|
145
|
+
let destroyed = false;
|
|
146
|
+
destroyRef.onDestroy(() => {
|
|
147
|
+
destroyed = true;
|
|
148
|
+
if (!connected)
|
|
149
|
+
return;
|
|
150
|
+
const childId = this.machine.service.prop("id");
|
|
151
|
+
if (!childId)
|
|
152
|
+
return;
|
|
153
|
+
const children = parent.service.refs.get("children");
|
|
154
|
+
const nextChildren = { ...children };
|
|
155
|
+
delete nextChildren[childId];
|
|
156
|
+
parent.service.refs.set("children", nextChildren);
|
|
157
|
+
this.machine.service.refs.set("parent", null);
|
|
158
|
+
this.machine.service.context.set("isSubmenu", false);
|
|
159
|
+
});
|
|
160
|
+
afterNextRender(() => {
|
|
161
|
+
if (destroyed)
|
|
162
|
+
return;
|
|
163
|
+
parent.api().setChild(this.machine.service);
|
|
164
|
+
this.machine.api().setParent(parent.service);
|
|
165
|
+
connected = true;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
getContextCarrier() {
|
|
170
|
+
return this.contextCarrier;
|
|
171
|
+
}
|
|
172
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuRoot, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
173
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: MenuRoot, isStandalone: true, selector: "[menu-root]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, ids: { classPropertyName: "ids", publicName: "ids", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, defaultOpen: { classPropertyName: "defaultOpen", publicName: "defaultOpen", isSignal: true, isRequired: false, transformFunction: null }, highlightedValue: { classPropertyName: "highlightedValue", publicName: "highlightedValue", isSignal: true, isRequired: false, transformFunction: null }, defaultHighlightedValue: { classPropertyName: "defaultHighlightedValue", publicName: "defaultHighlightedValue", isSignal: true, isRequired: false, transformFunction: null }, loopFocus: { classPropertyName: "loopFocus", publicName: "loopFocus", isSignal: true, isRequired: false, transformFunction: null }, closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", isSignal: true, isRequired: false, transformFunction: null }, typeahead: { classPropertyName: "typeahead", publicName: "typeahead", isSignal: true, isRequired: false, transformFunction: null }, composite: { classPropertyName: "composite", publicName: "composite", isSignal: true, isRequired: false, transformFunction: null }, positioning: { classPropertyName: "positioning", publicName: "positioning", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, anchorPoint: { classPropertyName: "anchorPoint", publicName: "anchorPoint", isSignal: true, isRequired: false, transformFunction: null }, navigate: { classPropertyName: "navigate", publicName: "navigate", isSignal: true, isRequired: false, transformFunction: null }, triggerValue: { classPropertyName: "triggerValue", publicName: "triggerValue", isSignal: true, isRequired: false, transformFunction: null }, defaultTriggerValue: { classPropertyName: "defaultTriggerValue", publicName: "defaultTriggerValue", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange", highlightedValue: "highlightedValueChange", triggerValue: "triggerValueChange", select: "select", escapeKeyDown: "escapeKeyDown", focusOutside: "focusOutside", highlightChange: "highlightChange", interactOutside: "interactOutside", openChangeDetails: "openChangeDetails", pointerDownOutside: "pointerDownOutside", requestDismiss: "requestDismiss", triggerValueChangeDetails: "triggerValueChangeDetails" }, providers: [
|
|
174
|
+
{
|
|
175
|
+
provide: PRESENCE_CONTEXT,
|
|
176
|
+
useFactory: (root) => root.presence,
|
|
177
|
+
deps: [forwardRef(() => MenuRoot)],
|
|
178
|
+
},
|
|
179
|
+
{ provide: MENU_CONTEXT, useExisting: forwardRef(() => MenuRoot) },
|
|
180
|
+
{
|
|
181
|
+
provide: MENU_TRIGGER_ITEM_CONTEXT,
|
|
182
|
+
useFactory: (root) => root.triggerItemProps,
|
|
183
|
+
deps: [forwardRef(() => MenuRoot)],
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
provide: MENU_CONTEXT_CARRIER,
|
|
187
|
+
useFactory: (root) => root.getContextCarrier(),
|
|
188
|
+
deps: [forwardRef(() => MenuRoot)],
|
|
189
|
+
},
|
|
190
|
+
], exportAs: ["menuRoot"], usesInheritance: true, ngImport: i0 });
|
|
191
|
+
}
|
|
192
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuRoot, decorators: [{
|
|
193
|
+
type: Directive,
|
|
194
|
+
args: [{
|
|
195
|
+
selector: "[menu-root]",
|
|
196
|
+
standalone: true,
|
|
197
|
+
exportAs: "menuRoot",
|
|
198
|
+
providers: [
|
|
199
|
+
{
|
|
200
|
+
provide: PRESENCE_CONTEXT,
|
|
201
|
+
useFactory: (root) => root.presence,
|
|
202
|
+
deps: [forwardRef(() => MenuRoot)],
|
|
203
|
+
},
|
|
204
|
+
{ provide: MENU_CONTEXT, useExisting: forwardRef(() => MenuRoot) },
|
|
205
|
+
{
|
|
206
|
+
provide: MENU_TRIGGER_ITEM_CONTEXT,
|
|
207
|
+
useFactory: (root) => root.triggerItemProps,
|
|
208
|
+
deps: [forwardRef(() => MenuRoot)],
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
provide: MENU_CONTEXT_CARRIER,
|
|
212
|
+
useFactory: (root) => root.getContextCarrier(),
|
|
213
|
+
deps: [forwardRef(() => MenuRoot)],
|
|
214
|
+
},
|
|
215
|
+
],
|
|
216
|
+
}]
|
|
217
|
+
}], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], ids: [{ type: i0.Input, args: [{ isSignal: true, alias: "ids", required: false }] }], open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }], defaultOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultOpen", required: false }] }], highlightedValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlightedValue", required: false }] }, { type: i0.Output, args: ["highlightedValueChange"] }], defaultHighlightedValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultHighlightedValue", required: false }] }], loopFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "loopFocus", required: false }] }], closeOnSelect: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnSelect", required: false }] }], typeahead: [{ type: i0.Input, args: [{ isSignal: true, alias: "typeahead", required: false }] }], composite: [{ type: i0.Input, args: [{ isSignal: true, alias: "composite", required: false }] }], positioning: [{ type: i0.Input, args: [{ isSignal: true, alias: "positioning", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], anchorPoint: [{ type: i0.Input, args: [{ isSignal: true, alias: "anchorPoint", required: false }] }], navigate: [{ type: i0.Input, args: [{ isSignal: true, alias: "navigate", required: false }] }], triggerValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "triggerValue", required: false }] }, { type: i0.Output, args: ["triggerValueChange"] }], defaultTriggerValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultTriggerValue", required: false }] }], select: [{ type: i0.Output, args: ["select"] }], escapeKeyDown: [{ type: i0.Output, args: ["escapeKeyDown"] }], focusOutside: [{ type: i0.Output, args: ["focusOutside"] }], highlightChange: [{ type: i0.Output, args: ["highlightChange"] }], interactOutside: [{ type: i0.Output, args: ["interactOutside"] }], openChangeDetails: [{ type: i0.Output, args: ["openChangeDetails"] }], pointerDownOutside: [{ type: i0.Output, args: ["pointerDownOutside"] }], requestDismiss: [{ type: i0.Output, args: ["requestDismiss"] }], triggerValueChangeDetails: [{ type: i0.Output, args: ["triggerValueChangeDetails"] }] } });
|
|
218
|
+
function optionalBooleanAttribute(value) {
|
|
219
|
+
return value === undefined || value === null ? undefined : booleanAttribute(value);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
class MenuRootProvider extends PresenceBase {
|
|
223
|
+
value = input.required(/* @ts-ignore */
|
|
224
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
225
|
+
state = computed(() => this.value().state(), /* @ts-ignore */
|
|
226
|
+
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
227
|
+
api = computed(() => this.value().api(), /* @ts-ignore */
|
|
228
|
+
...(ngDevMode ? [{ debugName: "api" }] : /* istanbul ignore next */ []));
|
|
229
|
+
send = (event) => this.value().send(event);
|
|
230
|
+
get service() {
|
|
231
|
+
return this.value().service;
|
|
232
|
+
}
|
|
233
|
+
presence = this.createPresence(() => {
|
|
234
|
+
try {
|
|
235
|
+
return this.api().open;
|
|
236
|
+
}
|
|
237
|
+
catch {
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
contextCarrier = buildRootCarrier({
|
|
242
|
+
providers: [{ provide: PRESENCE_CONTEXT, useValue: this.presence }],
|
|
243
|
+
root: this,
|
|
244
|
+
rootToken: MENU_CONTEXT,
|
|
245
|
+
originInjector: inject(Injector),
|
|
246
|
+
environmentInjector: inject(EnvironmentInjector),
|
|
247
|
+
});
|
|
248
|
+
parentMenu = inject(MENU_CONTEXT, {
|
|
249
|
+
optional: true,
|
|
250
|
+
skipSelf: true,
|
|
251
|
+
});
|
|
252
|
+
triggerItemProps = computed(() => this.parentMenu?.api().getTriggerItemProps(this.api()), /* @ts-ignore */
|
|
253
|
+
...(ngDevMode ? [{ debugName: "triggerItemProps" }] : /* istanbul ignore next */ []));
|
|
254
|
+
constructor() {
|
|
255
|
+
super();
|
|
256
|
+
const parent = this.parentMenu;
|
|
257
|
+
if (!parent)
|
|
258
|
+
return;
|
|
259
|
+
const destroyRef = inject(DestroyRef);
|
|
260
|
+
let connected = false;
|
|
261
|
+
let destroyed = false;
|
|
262
|
+
destroyRef.onDestroy(() => {
|
|
263
|
+
destroyed = true;
|
|
264
|
+
if (!connected)
|
|
265
|
+
return;
|
|
266
|
+
const childId = this.service.prop("id");
|
|
267
|
+
if (!childId)
|
|
268
|
+
return;
|
|
269
|
+
const children = parent.service.refs.get("children");
|
|
270
|
+
const nextChildren = { ...children };
|
|
271
|
+
delete nextChildren[childId];
|
|
272
|
+
parent.service.refs.set("children", nextChildren);
|
|
273
|
+
this.service.refs.set("parent", null);
|
|
274
|
+
this.service.context.set("isSubmenu", false);
|
|
275
|
+
});
|
|
276
|
+
afterNextRender(() => {
|
|
277
|
+
if (destroyed)
|
|
278
|
+
return;
|
|
279
|
+
parent.api().setChild(this.service);
|
|
280
|
+
this.api().setParent(parent.service);
|
|
281
|
+
connected = true;
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
getContextCarrier() {
|
|
285
|
+
return this.contextCarrier;
|
|
286
|
+
}
|
|
287
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuRootProvider, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
288
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: MenuRootProvider, isStandalone: true, selector: "[menu-root-provider]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, providers: [
|
|
289
|
+
{
|
|
290
|
+
provide: PRESENCE_CONTEXT,
|
|
291
|
+
useFactory: (provider) => provider.presence,
|
|
292
|
+
deps: [forwardRef(() => MenuRootProvider)],
|
|
293
|
+
},
|
|
294
|
+
{ provide: MENU_CONTEXT, useExisting: forwardRef(() => MenuRootProvider) },
|
|
295
|
+
{
|
|
296
|
+
provide: MENU_TRIGGER_ITEM_CONTEXT,
|
|
297
|
+
useFactory: (provider) => provider.triggerItemProps,
|
|
298
|
+
deps: [forwardRef(() => MenuRootProvider)],
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
provide: MENU_CONTEXT_CARRIER,
|
|
302
|
+
useFactory: (provider) => provider.getContextCarrier(),
|
|
303
|
+
deps: [forwardRef(() => MenuRootProvider)],
|
|
304
|
+
},
|
|
305
|
+
], exportAs: ["menuRootProvider"], usesInheritance: true, ngImport: i0 });
|
|
306
|
+
}
|
|
307
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuRootProvider, decorators: [{
|
|
308
|
+
type: Directive,
|
|
309
|
+
args: [{
|
|
310
|
+
selector: "[menu-root-provider]",
|
|
311
|
+
standalone: true,
|
|
312
|
+
exportAs: "menuRootProvider",
|
|
313
|
+
providers: [
|
|
314
|
+
{
|
|
315
|
+
provide: PRESENCE_CONTEXT,
|
|
316
|
+
useFactory: (provider) => provider.presence,
|
|
317
|
+
deps: [forwardRef(() => MenuRootProvider)],
|
|
318
|
+
},
|
|
319
|
+
{ provide: MENU_CONTEXT, useExisting: forwardRef(() => MenuRootProvider) },
|
|
320
|
+
{
|
|
321
|
+
provide: MENU_TRIGGER_ITEM_CONTEXT,
|
|
322
|
+
useFactory: (provider) => provider.triggerItemProps,
|
|
323
|
+
deps: [forwardRef(() => MenuRootProvider)],
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
provide: MENU_CONTEXT_CARRIER,
|
|
327
|
+
useFactory: (provider) => provider.getContextCarrier(),
|
|
328
|
+
deps: [forwardRef(() => MenuRootProvider)],
|
|
329
|
+
},
|
|
330
|
+
],
|
|
331
|
+
}]
|
|
332
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }] } });
|
|
333
|
+
|
|
334
|
+
class MenuTrigger {
|
|
335
|
+
value = input(undefined, /* @ts-ignore */
|
|
336
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
337
|
+
constructor() {
|
|
338
|
+
const context = injectMenuContext();
|
|
339
|
+
const presence = injectPresenceContext();
|
|
340
|
+
bindProps({
|
|
341
|
+
elementRef: inject(ElementRef),
|
|
342
|
+
renderer: inject(Renderer2),
|
|
343
|
+
destroyRef: inject(DestroyRef),
|
|
344
|
+
props: () => {
|
|
345
|
+
const props = context.api().getTriggerProps({ value: this.value() });
|
|
346
|
+
return {
|
|
347
|
+
...props,
|
|
348
|
+
"aria-controls": presence.unmounted() ? undefined : props["aria-controls"],
|
|
349
|
+
};
|
|
350
|
+
},
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
354
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: MenuTrigger, isStandalone: true, selector: "[menu-trigger]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["menuTrigger"], ngImport: i0 });
|
|
355
|
+
}
|
|
356
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuTrigger, decorators: [{
|
|
357
|
+
type: Directive,
|
|
358
|
+
args: [{
|
|
359
|
+
selector: "[menu-trigger]",
|
|
360
|
+
standalone: true,
|
|
361
|
+
exportAs: "menuTrigger",
|
|
362
|
+
}]
|
|
363
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }] } });
|
|
364
|
+
|
|
365
|
+
class MenuContextTrigger {
|
|
366
|
+
value = input(undefined, /* @ts-ignore */
|
|
367
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
368
|
+
constructor() {
|
|
369
|
+
const context = injectMenuContext();
|
|
370
|
+
bindProps({
|
|
371
|
+
elementRef: inject(ElementRef),
|
|
372
|
+
renderer: inject(Renderer2),
|
|
373
|
+
destroyRef: inject(DestroyRef),
|
|
374
|
+
props: () => context.api().getContextTriggerProps({ value: this.value() }),
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuContextTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
378
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: MenuContextTrigger, isStandalone: true, selector: "[menu-context-trigger]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["menuContextTrigger"], ngImport: i0 });
|
|
379
|
+
}
|
|
380
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuContextTrigger, decorators: [{
|
|
381
|
+
type: Directive,
|
|
382
|
+
args: [{
|
|
383
|
+
selector: "[menu-context-trigger]",
|
|
384
|
+
standalone: true,
|
|
385
|
+
exportAs: "menuContextTrigger",
|
|
386
|
+
}]
|
|
387
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }] } });
|
|
388
|
+
|
|
389
|
+
class MenuPositioner {
|
|
390
|
+
constructor() {
|
|
391
|
+
const context = injectMenuContext();
|
|
392
|
+
bindProps({
|
|
393
|
+
elementRef: inject(ElementRef),
|
|
394
|
+
renderer: inject(Renderer2),
|
|
395
|
+
destroyRef: inject(DestroyRef),
|
|
396
|
+
props: () => context.api().getPositionerProps(),
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuPositioner, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
400
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: MenuPositioner, isStandalone: true, selector: "[menu-positioner]", exportAs: ["menuPositioner"], ngImport: i0 });
|
|
401
|
+
}
|
|
402
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuPositioner, decorators: [{
|
|
403
|
+
type: Directive,
|
|
404
|
+
args: [{
|
|
405
|
+
selector: "[menu-positioner]",
|
|
406
|
+
standalone: true,
|
|
407
|
+
exportAs: "menuPositioner",
|
|
408
|
+
}]
|
|
409
|
+
}], ctorParameters: () => [] });
|
|
410
|
+
|
|
411
|
+
class MenuContent {
|
|
412
|
+
constructor() {
|
|
413
|
+
const context = injectMenuContext();
|
|
414
|
+
const presence = injectPresenceContext();
|
|
415
|
+
const template = inject((TemplateRef), { optional: true });
|
|
416
|
+
const container = inject(ViewContainerRef);
|
|
417
|
+
const host = inject(ElementRef);
|
|
418
|
+
const elementRef = template ? { nativeElement: null } : host;
|
|
419
|
+
let view;
|
|
420
|
+
effect(() => {
|
|
421
|
+
const unmounted = presence.unmounted();
|
|
422
|
+
if (template) {
|
|
423
|
+
if (unmounted) {
|
|
424
|
+
elementRef.nativeElement = null;
|
|
425
|
+
container.clear();
|
|
426
|
+
view = undefined;
|
|
427
|
+
}
|
|
428
|
+
else if (!view) {
|
|
429
|
+
view = container.createEmbeddedView(template);
|
|
430
|
+
elementRef.nativeElement =
|
|
431
|
+
view.rootNodes.find((node) => node.nodeType === 1) ?? null;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
untracked(() => presence.setNode(elementRef.nativeElement));
|
|
435
|
+
});
|
|
436
|
+
bindProps({
|
|
437
|
+
elementRef,
|
|
438
|
+
renderer: inject(Renderer2),
|
|
439
|
+
destroyRef: inject(DestroyRef),
|
|
440
|
+
props: () => {
|
|
441
|
+
presence.unmounted();
|
|
442
|
+
return { ...context.api().getContentProps(), ...presence.getPresenceProps() };
|
|
443
|
+
},
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
447
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: MenuContent, isStandalone: true, selector: "[menu-content]", exportAs: ["menuContent"], ngImport: i0 });
|
|
448
|
+
}
|
|
449
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuContent, decorators: [{
|
|
450
|
+
type: Directive,
|
|
451
|
+
args: [{
|
|
452
|
+
selector: "[menu-content]",
|
|
453
|
+
standalone: true,
|
|
454
|
+
exportAs: "menuContent",
|
|
455
|
+
}]
|
|
456
|
+
}], ctorParameters: () => [] });
|
|
457
|
+
|
|
458
|
+
const MENU_ITEM_CONTEXT = new InjectionToken("WIREKYT.MENU_ITEM_CONTEXT");
|
|
459
|
+
function injectMenuItemContext() {
|
|
460
|
+
return inject(MENU_ITEM_CONTEXT);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
const MENU_ITEM_PROPS_CONTEXT = new InjectionToken("WIREKYT.MENU_ITEM_PROPS_CONTEXT");
|
|
464
|
+
function injectMenuItemPropsContext() {
|
|
465
|
+
return inject(MENU_ITEM_PROPS_CONTEXT);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
class MenuItem {
|
|
469
|
+
value = input.required(/* @ts-ignore */
|
|
470
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
471
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
472
|
+
valueText = input(undefined, /* @ts-ignore */
|
|
473
|
+
...(ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []));
|
|
474
|
+
closeOnSelect = input(undefined, /* @ts-ignore */
|
|
475
|
+
...(ngDevMode ? [{ debugName: "closeOnSelect" }] : /* istanbul ignore next */ []));
|
|
476
|
+
select = output();
|
|
477
|
+
context = injectMenuContext();
|
|
478
|
+
api = computed(() => this.context.api(), /* @ts-ignore */
|
|
479
|
+
...(ngDevMode ? [{ debugName: "api" }] : /* istanbul ignore next */ []));
|
|
480
|
+
checked = computed(() => undefined, /* @ts-ignore */
|
|
481
|
+
...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
|
|
482
|
+
itemProps = computed(() => ({
|
|
483
|
+
value: this.value(),
|
|
484
|
+
disabled: this.disabled(),
|
|
485
|
+
valueText: this.valueText(),
|
|
486
|
+
closeOnSelect: this.closeOnSelect(),
|
|
487
|
+
}), /* @ts-ignore */
|
|
488
|
+
...(ngDevMode ? [{ debugName: "itemProps" }] : /* istanbul ignore next */ []));
|
|
489
|
+
state = computed(() => this.context.api().getItemState(this.itemProps()), /* @ts-ignore */
|
|
490
|
+
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
491
|
+
highlighted = computed(() => this.state().highlighted, /* @ts-ignore */
|
|
492
|
+
...(ngDevMode ? [{ debugName: "highlighted" }] : /* istanbul ignore next */ []));
|
|
493
|
+
itemId = computed(() => this.state().id, /* @ts-ignore */
|
|
494
|
+
...(ngDevMode ? [{ debugName: "itemId" }] : /* istanbul ignore next */ []));
|
|
495
|
+
constructor() {
|
|
496
|
+
const destroyRef = inject(DestroyRef);
|
|
497
|
+
const elementRef = inject(ElementRef);
|
|
498
|
+
const renderer = inject(Renderer2);
|
|
499
|
+
bindProps({
|
|
500
|
+
elementRef,
|
|
501
|
+
renderer,
|
|
502
|
+
destroyRef,
|
|
503
|
+
props: () => this.context.api().getItemProps(this.itemProps()),
|
|
504
|
+
});
|
|
505
|
+
let dispose;
|
|
506
|
+
let destroyed = false;
|
|
507
|
+
destroyRef.onDestroy(() => {
|
|
508
|
+
destroyed = true;
|
|
509
|
+
dispose?.();
|
|
510
|
+
});
|
|
511
|
+
afterNextRender(() => {
|
|
512
|
+
if (destroyed)
|
|
513
|
+
return;
|
|
514
|
+
dispose = this.context
|
|
515
|
+
.api()
|
|
516
|
+
.addItemListener({ id: this.state().id, onSelect: () => this.select.emit() });
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
520
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: MenuItem, isStandalone: true, selector: "[menu-item]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, valueText: { classPropertyName: "valueText", publicName: "valueText", isSignal: true, isRequired: false, transformFunction: null }, closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { select: "select" }, providers: [
|
|
521
|
+
{ provide: MENU_ITEM_CONTEXT, useExisting: forwardRef(() => MenuItem) },
|
|
522
|
+
{
|
|
523
|
+
provide: MENU_ITEM_PROPS_CONTEXT,
|
|
524
|
+
useFactory: (item) => item.itemProps,
|
|
525
|
+
deps: [forwardRef(() => MenuItem)],
|
|
526
|
+
},
|
|
527
|
+
], exportAs: ["menuItem"], ngImport: i0 });
|
|
528
|
+
}
|
|
529
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuItem, decorators: [{
|
|
530
|
+
type: Directive,
|
|
531
|
+
args: [{
|
|
532
|
+
selector: "[menu-item]",
|
|
533
|
+
standalone: true,
|
|
534
|
+
exportAs: "menuItem",
|
|
535
|
+
providers: [
|
|
536
|
+
{ provide: MENU_ITEM_CONTEXT, useExisting: forwardRef(() => MenuItem) },
|
|
537
|
+
{
|
|
538
|
+
provide: MENU_ITEM_PROPS_CONTEXT,
|
|
539
|
+
useFactory: (item) => item.itemProps,
|
|
540
|
+
deps: [forwardRef(() => MenuItem)],
|
|
541
|
+
},
|
|
542
|
+
],
|
|
543
|
+
}]
|
|
544
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], valueText: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueText", required: false }] }], closeOnSelect: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnSelect", required: false }] }], select: [{ type: i0.Output, args: ["select"] }] } });
|
|
545
|
+
|
|
546
|
+
class MenuContext {
|
|
547
|
+
static ngTemplateContextGuard(_directive, context) {
|
|
548
|
+
void context;
|
|
549
|
+
return true;
|
|
550
|
+
}
|
|
551
|
+
menu = injectMenuContext();
|
|
552
|
+
templateRef = inject(TemplateRef);
|
|
553
|
+
viewContainer = inject(ViewContainerRef);
|
|
554
|
+
constructor() {
|
|
555
|
+
const view = this.viewContainer.createEmbeddedView(this.templateRef, {
|
|
556
|
+
$implicit: this.menu.api,
|
|
557
|
+
api: this.menu.api,
|
|
558
|
+
});
|
|
559
|
+
effect(() => {
|
|
560
|
+
this.menu.api();
|
|
561
|
+
view.detectChanges();
|
|
562
|
+
});
|
|
563
|
+
inject(DestroyRef).onDestroy(() => view.destroy());
|
|
564
|
+
}
|
|
565
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuContext, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
566
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: MenuContext, isStandalone: true, selector: "[menu-context]", exportAs: ["menuContext"], ngImport: i0 });
|
|
567
|
+
}
|
|
568
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuContext, decorators: [{
|
|
569
|
+
type: Directive,
|
|
570
|
+
args: [{
|
|
571
|
+
selector: "[menu-context]",
|
|
572
|
+
standalone: true,
|
|
573
|
+
exportAs: "menuContext",
|
|
574
|
+
}]
|
|
575
|
+
}], ctorParameters: () => [] });
|
|
576
|
+
|
|
577
|
+
class MenuItemContextDirective {
|
|
578
|
+
static ngTemplateContextGuard(_directive, context) {
|
|
579
|
+
void context;
|
|
580
|
+
return true;
|
|
581
|
+
}
|
|
582
|
+
item = injectMenuItemContext();
|
|
583
|
+
templateRef = inject(TemplateRef);
|
|
584
|
+
viewContainer = inject(ViewContainerRef);
|
|
585
|
+
constructor() {
|
|
586
|
+
const view = this.viewContainer.createEmbeddedView(this.templateRef, {
|
|
587
|
+
$implicit: this.item,
|
|
588
|
+
item: this.item,
|
|
589
|
+
});
|
|
590
|
+
effect(() => {
|
|
591
|
+
this.item.state();
|
|
592
|
+
view.detectChanges();
|
|
593
|
+
});
|
|
594
|
+
inject(DestroyRef).onDestroy(() => view.destroy());
|
|
595
|
+
}
|
|
596
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuItemContextDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
597
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: MenuItemContextDirective, isStandalone: true, selector: "[menu-item-context]", exportAs: ["menuItemContext"], ngImport: i0 });
|
|
598
|
+
}
|
|
599
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuItemContextDirective, decorators: [{
|
|
600
|
+
type: Directive,
|
|
601
|
+
args: [{
|
|
602
|
+
selector: "[menu-item-context]",
|
|
603
|
+
standalone: true,
|
|
604
|
+
exportAs: "menuItemContext",
|
|
605
|
+
}]
|
|
606
|
+
}], ctorParameters: () => [] });
|
|
607
|
+
|
|
608
|
+
class MenuItemText {
|
|
609
|
+
value = input(undefined, /* @ts-ignore */
|
|
610
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
611
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
612
|
+
valueText = input(undefined, /* @ts-ignore */
|
|
613
|
+
...(ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []));
|
|
614
|
+
constructor() {
|
|
615
|
+
const context = injectMenuContext();
|
|
616
|
+
const item = inject(MENU_ITEM_CONTEXT, { optional: true });
|
|
617
|
+
const itemProps = inject(MENU_ITEM_PROPS_CONTEXT, { optional: true });
|
|
618
|
+
bindProps({
|
|
619
|
+
elementRef: inject(ElementRef),
|
|
620
|
+
renderer: inject(Renderer2),
|
|
621
|
+
destroyRef: inject(DestroyRef),
|
|
622
|
+
props: () => context.api().getItemTextProps(itemProps?.() ?? {
|
|
623
|
+
value: item?.value() ?? this.value() ?? "",
|
|
624
|
+
disabled: item?.disabled() ?? this.disabled(),
|
|
625
|
+
valueText: item?.valueText() ?? this.valueText(),
|
|
626
|
+
...(item?.checked() !== undefined ? { checked: item.checked() } : {}),
|
|
627
|
+
}),
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuItemText, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
631
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: MenuItemText, isStandalone: true, selector: "[menu-item-text]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, valueText: { classPropertyName: "valueText", publicName: "valueText", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["menuItemText"], ngImport: i0 });
|
|
632
|
+
}
|
|
633
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuItemText, decorators: [{
|
|
634
|
+
type: Directive,
|
|
635
|
+
args: [{
|
|
636
|
+
selector: "[menu-item-text]",
|
|
637
|
+
standalone: true,
|
|
638
|
+
exportAs: "menuItemText",
|
|
639
|
+
}]
|
|
640
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], valueText: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueText", required: false }] }] } });
|
|
641
|
+
|
|
642
|
+
class MenuSeparator {
|
|
643
|
+
constructor() {
|
|
644
|
+
const context = injectMenuContext();
|
|
645
|
+
bindProps({
|
|
646
|
+
elementRef: inject(ElementRef),
|
|
647
|
+
renderer: inject(Renderer2),
|
|
648
|
+
destroyRef: inject(DestroyRef),
|
|
649
|
+
props: () => context.api().getSeparatorProps(),
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuSeparator, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
653
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: MenuSeparator, isStandalone: true, selector: "[menu-separator]", exportAs: ["menuSeparator"], ngImport: i0 });
|
|
654
|
+
}
|
|
655
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuSeparator, decorators: [{
|
|
656
|
+
type: Directive,
|
|
657
|
+
args: [{
|
|
658
|
+
selector: "[menu-separator]",
|
|
659
|
+
standalone: true,
|
|
660
|
+
exportAs: "menuSeparator",
|
|
661
|
+
}]
|
|
662
|
+
}], ctorParameters: () => [] });
|
|
663
|
+
|
|
664
|
+
class MenuIndicator {
|
|
665
|
+
constructor() {
|
|
666
|
+
const context = injectMenuContext();
|
|
667
|
+
bindProps({
|
|
668
|
+
elementRef: inject(ElementRef),
|
|
669
|
+
renderer: inject(Renderer2),
|
|
670
|
+
destroyRef: inject(DestroyRef),
|
|
671
|
+
props: () => context.api().getIndicatorProps(),
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuIndicator, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
675
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: MenuIndicator, isStandalone: true, selector: "[menu-indicator]", exportAs: ["menuIndicator"], ngImport: i0 });
|
|
676
|
+
}
|
|
677
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuIndicator, decorators: [{
|
|
678
|
+
type: Directive,
|
|
679
|
+
args: [{
|
|
680
|
+
selector: "[menu-indicator]",
|
|
681
|
+
standalone: true,
|
|
682
|
+
exportAs: "menuIndicator",
|
|
683
|
+
}]
|
|
684
|
+
}], ctorParameters: () => [] });
|
|
685
|
+
|
|
686
|
+
class MenuArrow {
|
|
687
|
+
constructor() {
|
|
688
|
+
const context = injectMenuContext();
|
|
689
|
+
bindProps({
|
|
690
|
+
elementRef: inject(ElementRef),
|
|
691
|
+
renderer: inject(Renderer2),
|
|
692
|
+
destroyRef: inject(DestroyRef),
|
|
693
|
+
props: () => context.api().getArrowProps(),
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuArrow, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
697
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: MenuArrow, isStandalone: true, selector: "[menu-arrow]", exportAs: ["menuArrow"], ngImport: i0 });
|
|
698
|
+
}
|
|
699
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuArrow, decorators: [{
|
|
700
|
+
type: Directive,
|
|
701
|
+
args: [{
|
|
702
|
+
selector: "[menu-arrow]",
|
|
703
|
+
standalone: true,
|
|
704
|
+
exportAs: "menuArrow",
|
|
705
|
+
}]
|
|
706
|
+
}], ctorParameters: () => [] });
|
|
707
|
+
|
|
708
|
+
class MenuArrowTip {
|
|
709
|
+
constructor() {
|
|
710
|
+
const context = injectMenuContext();
|
|
711
|
+
bindProps({
|
|
712
|
+
elementRef: inject(ElementRef),
|
|
713
|
+
renderer: inject(Renderer2),
|
|
714
|
+
destroyRef: inject(DestroyRef),
|
|
715
|
+
props: () => context.api().getArrowTipProps(),
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuArrowTip, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
719
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: MenuArrowTip, isStandalone: true, selector: "[menu-arrow-tip]", exportAs: ["menuArrowTip"], ngImport: i0 });
|
|
720
|
+
}
|
|
721
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuArrowTip, decorators: [{
|
|
722
|
+
type: Directive,
|
|
723
|
+
args: [{
|
|
724
|
+
selector: "[menu-arrow-tip]",
|
|
725
|
+
standalone: true,
|
|
726
|
+
exportAs: "menuArrowTip",
|
|
727
|
+
}]
|
|
728
|
+
}], ctorParameters: () => [] });
|
|
729
|
+
|
|
730
|
+
class MenuCheckboxItem {
|
|
731
|
+
value = input.required(/* @ts-ignore */
|
|
732
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
733
|
+
checked = model(undefined, /* @ts-ignore */
|
|
734
|
+
...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
|
|
735
|
+
disabledInput = input(false, { ...(ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {}), alias: "disabled",
|
|
736
|
+
transform: booleanAttribute });
|
|
737
|
+
valueText = input(undefined, /* @ts-ignore */
|
|
738
|
+
...(ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []));
|
|
739
|
+
closeOnSelect = input(undefined, /* @ts-ignore */
|
|
740
|
+
...(ngDevMode ? [{ debugName: "closeOnSelect" }] : /* istanbul ignore next */ []));
|
|
741
|
+
disabled = computed(() => this.disabledInput(), /* @ts-ignore */
|
|
742
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
743
|
+
context = injectMenuContext();
|
|
744
|
+
api = computed(() => this.context.api(), /* @ts-ignore */
|
|
745
|
+
...(ngDevMode ? [{ debugName: "api" }] : /* istanbul ignore next */ []));
|
|
746
|
+
optionItemProps = computed(() => ({
|
|
747
|
+
type: "checkbox",
|
|
748
|
+
value: this.value(),
|
|
749
|
+
checked: this.checked() ?? false,
|
|
750
|
+
disabled: this.disabledInput(),
|
|
751
|
+
valueText: this.valueText(),
|
|
752
|
+
closeOnSelect: this.closeOnSelect(),
|
|
753
|
+
onCheckedChange: (next) => {
|
|
754
|
+
if (this.checked() !== next)
|
|
755
|
+
this.checked.set(next);
|
|
756
|
+
},
|
|
757
|
+
}), /* @ts-ignore */
|
|
758
|
+
...(ngDevMode ? [{ debugName: "optionItemProps" }] : /* istanbul ignore next */ []));
|
|
759
|
+
state = computed(() => this.context.api().getOptionItemState(this.optionItemProps()), /* @ts-ignore */
|
|
760
|
+
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
761
|
+
constructor() {
|
|
762
|
+
bindProps({
|
|
763
|
+
elementRef: inject(ElementRef),
|
|
764
|
+
renderer: inject(Renderer2),
|
|
765
|
+
destroyRef: inject(DestroyRef),
|
|
766
|
+
props: () => this.context.api().getOptionItemProps(this.optionItemProps()),
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuCheckboxItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
770
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: MenuCheckboxItem, isStandalone: true, selector: "[menu-checkbox-item]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, valueText: { classPropertyName: "valueText", publicName: "valueText", isSignal: true, isRequired: false, transformFunction: null }, closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange" }, providers: [
|
|
771
|
+
{ provide: MENU_ITEM_CONTEXT, useExisting: forwardRef(() => MenuCheckboxItem) },
|
|
772
|
+
{
|
|
773
|
+
provide: MENU_ITEM_PROPS_CONTEXT,
|
|
774
|
+
useFactory: (item) => item.optionItemProps,
|
|
775
|
+
deps: [forwardRef(() => MenuCheckboxItem)],
|
|
776
|
+
},
|
|
777
|
+
], exportAs: ["menuCheckboxItem"], ngImport: i0 });
|
|
778
|
+
}
|
|
779
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuCheckboxItem, decorators: [{
|
|
780
|
+
type: Directive,
|
|
781
|
+
args: [{
|
|
782
|
+
selector: "[menu-checkbox-item]",
|
|
783
|
+
standalone: true,
|
|
784
|
+
exportAs: "menuCheckboxItem",
|
|
785
|
+
providers: [
|
|
786
|
+
{ provide: MENU_ITEM_CONTEXT, useExisting: forwardRef(() => MenuCheckboxItem) },
|
|
787
|
+
{
|
|
788
|
+
provide: MENU_ITEM_PROPS_CONTEXT,
|
|
789
|
+
useFactory: (item) => item.optionItemProps,
|
|
790
|
+
deps: [forwardRef(() => MenuCheckboxItem)],
|
|
791
|
+
},
|
|
792
|
+
],
|
|
793
|
+
}]
|
|
794
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], disabledInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], valueText: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueText", required: false }] }], closeOnSelect: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnSelect", required: false }] }] } });
|
|
795
|
+
|
|
796
|
+
const MENU_RADIO_ITEM_GROUP_CONTEXT = new InjectionToken("WIREKYT.MENU_RADIO_ITEM_GROUP_CONTEXT");
|
|
797
|
+
function injectMenuRadioItemGroupContext() {
|
|
798
|
+
return inject(MENU_RADIO_ITEM_GROUP_CONTEXT);
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
class MenuRadioItem {
|
|
802
|
+
value = input.required(/* @ts-ignore */
|
|
803
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
804
|
+
disabledInput = input(false, { ...(ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {}), alias: "disabled",
|
|
805
|
+
transform: booleanAttribute });
|
|
806
|
+
valueText = input(undefined, /* @ts-ignore */
|
|
807
|
+
...(ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []));
|
|
808
|
+
closeOnSelect = input(undefined, /* @ts-ignore */
|
|
809
|
+
...(ngDevMode ? [{ debugName: "closeOnSelect" }] : /* istanbul ignore next */ []));
|
|
810
|
+
disabled = computed(() => this.disabledInput(), /* @ts-ignore */
|
|
811
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
812
|
+
context = injectMenuContext();
|
|
813
|
+
radioGroup = injectMenuRadioItemGroupContext();
|
|
814
|
+
api = computed(() => this.context.api(), /* @ts-ignore */
|
|
815
|
+
...(ngDevMode ? [{ debugName: "api" }] : /* istanbul ignore next */ []));
|
|
816
|
+
checked = computed(() => this.radioGroup.value() === this.value(), /* @ts-ignore */
|
|
817
|
+
...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
|
|
818
|
+
optionItemProps = computed(() => ({
|
|
819
|
+
type: "radio",
|
|
820
|
+
value: this.value(),
|
|
821
|
+
checked: this.checked(),
|
|
822
|
+
disabled: this.disabledInput(),
|
|
823
|
+
valueText: this.valueText(),
|
|
824
|
+
closeOnSelect: this.closeOnSelect(),
|
|
825
|
+
onCheckedChange: () => this.radioGroup.setValue(this.value()),
|
|
826
|
+
}), /* @ts-ignore */
|
|
827
|
+
...(ngDevMode ? [{ debugName: "optionItemProps" }] : /* istanbul ignore next */ []));
|
|
828
|
+
state = computed(() => this.context.api().getOptionItemState(this.optionItemProps()), /* @ts-ignore */
|
|
829
|
+
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
830
|
+
constructor() {
|
|
831
|
+
bindProps({
|
|
832
|
+
elementRef: inject(ElementRef),
|
|
833
|
+
renderer: inject(Renderer2),
|
|
834
|
+
destroyRef: inject(DestroyRef),
|
|
835
|
+
props: () => this.context.api().getOptionItemProps(this.optionItemProps()),
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuRadioItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
839
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: MenuRadioItem, isStandalone: true, selector: "[menu-radio-item]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, valueText: { classPropertyName: "valueText", publicName: "valueText", isSignal: true, isRequired: false, transformFunction: null }, closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
840
|
+
{ provide: MENU_ITEM_CONTEXT, useExisting: forwardRef(() => MenuRadioItem) },
|
|
841
|
+
{
|
|
842
|
+
provide: MENU_ITEM_PROPS_CONTEXT,
|
|
843
|
+
useFactory: (item) => item.optionItemProps,
|
|
844
|
+
deps: [forwardRef(() => MenuRadioItem)],
|
|
845
|
+
},
|
|
846
|
+
], exportAs: ["menuRadioItem"], ngImport: i0 });
|
|
847
|
+
}
|
|
848
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuRadioItem, decorators: [{
|
|
849
|
+
type: Directive,
|
|
850
|
+
args: [{
|
|
851
|
+
selector: "[menu-radio-item]",
|
|
852
|
+
standalone: true,
|
|
853
|
+
exportAs: "menuRadioItem",
|
|
854
|
+
providers: [
|
|
855
|
+
{ provide: MENU_ITEM_CONTEXT, useExisting: forwardRef(() => MenuRadioItem) },
|
|
856
|
+
{
|
|
857
|
+
provide: MENU_ITEM_PROPS_CONTEXT,
|
|
858
|
+
useFactory: (item) => item.optionItemProps,
|
|
859
|
+
deps: [forwardRef(() => MenuRadioItem)],
|
|
860
|
+
},
|
|
861
|
+
],
|
|
862
|
+
}]
|
|
863
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], disabledInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], valueText: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueText", required: false }] }], closeOnSelect: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnSelect", required: false }] }] } });
|
|
864
|
+
|
|
865
|
+
class MenuRadioItemGroup {
|
|
866
|
+
idInput = input(undefined, { ...(ngDevMode ? { debugName: "idInput" } : /* istanbul ignore next */ {}), alias: "id" });
|
|
867
|
+
value = model(undefined, /* @ts-ignore */
|
|
868
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
869
|
+
valueChangeDetails = output();
|
|
870
|
+
fallbackId = createId();
|
|
871
|
+
id = computed(() => this.idInput() ?? this.fallbackId, /* @ts-ignore */
|
|
872
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
873
|
+
setValue(next) {
|
|
874
|
+
if (this.value() === next)
|
|
875
|
+
return;
|
|
876
|
+
this.value.set(next);
|
|
877
|
+
this.valueChangeDetails.emit({ value: next });
|
|
878
|
+
}
|
|
879
|
+
constructor() {
|
|
880
|
+
const context = injectMenuContext();
|
|
881
|
+
bindProps({
|
|
882
|
+
elementRef: inject(ElementRef),
|
|
883
|
+
renderer: inject(Renderer2),
|
|
884
|
+
destroyRef: inject(DestroyRef),
|
|
885
|
+
props: () => context.api().getItemGroupProps({ id: this.id() }),
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuRadioItemGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
889
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: MenuRadioItemGroup, isStandalone: true, selector: "[menu-radio-item-group]", inputs: { idInput: { classPropertyName: "idInput", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", valueChangeDetails: "valueChangeDetails" }, providers: [
|
|
890
|
+
{ provide: MENU_RADIO_ITEM_GROUP_CONTEXT, useExisting: forwardRef(() => MenuRadioItemGroup) },
|
|
891
|
+
], exportAs: ["menuRadioItemGroup"], ngImport: i0 });
|
|
892
|
+
}
|
|
893
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuRadioItemGroup, decorators: [{
|
|
894
|
+
type: Directive,
|
|
895
|
+
args: [{
|
|
896
|
+
selector: "[menu-radio-item-group]",
|
|
897
|
+
standalone: true,
|
|
898
|
+
exportAs: "menuRadioItemGroup",
|
|
899
|
+
providers: [
|
|
900
|
+
{ provide: MENU_RADIO_ITEM_GROUP_CONTEXT, useExisting: forwardRef(() => MenuRadioItemGroup) },
|
|
901
|
+
],
|
|
902
|
+
}]
|
|
903
|
+
}], ctorParameters: () => [], propDecorators: { idInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], valueChangeDetails: [{ type: i0.Output, args: ["valueChangeDetails"] }] } });
|
|
904
|
+
|
|
905
|
+
const MENU_ITEM_GROUP_CONTEXT = new InjectionToken("WIREKYT.MENU_ITEM_GROUP_CONTEXT");
|
|
906
|
+
function injectMenuItemGroupContext() {
|
|
907
|
+
return inject(MENU_ITEM_GROUP_CONTEXT);
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
class MenuItemGroup {
|
|
911
|
+
idInput = input(undefined, { ...(ngDevMode ? { debugName: "idInput" } : /* istanbul ignore next */ {}), alias: "id" });
|
|
912
|
+
fallbackId = createId();
|
|
913
|
+
id = computed(() => this.idInput() ?? this.fallbackId, /* @ts-ignore */
|
|
914
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
915
|
+
constructor() {
|
|
916
|
+
const context = injectMenuContext();
|
|
917
|
+
bindProps({
|
|
918
|
+
elementRef: inject(ElementRef),
|
|
919
|
+
renderer: inject(Renderer2),
|
|
920
|
+
destroyRef: inject(DestroyRef),
|
|
921
|
+
props: () => context.api().getItemGroupProps({ id: this.id() }),
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuItemGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
925
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: MenuItemGroup, isStandalone: true, selector: "[menu-item-group]", inputs: { idInput: { classPropertyName: "idInput", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: MENU_ITEM_GROUP_CONTEXT, useExisting: forwardRef(() => MenuItemGroup) }], exportAs: ["menuItemGroup"], ngImport: i0 });
|
|
926
|
+
}
|
|
927
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuItemGroup, decorators: [{
|
|
928
|
+
type: Directive,
|
|
929
|
+
args: [{
|
|
930
|
+
selector: "[menu-item-group]",
|
|
931
|
+
standalone: true,
|
|
932
|
+
exportAs: "menuItemGroup",
|
|
933
|
+
providers: [{ provide: MENU_ITEM_GROUP_CONTEXT, useExisting: forwardRef(() => MenuItemGroup) }],
|
|
934
|
+
}]
|
|
935
|
+
}], ctorParameters: () => [], propDecorators: { idInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }] } });
|
|
936
|
+
|
|
937
|
+
class MenuItemGroupLabel {
|
|
938
|
+
constructor() {
|
|
939
|
+
const context = injectMenuContext();
|
|
940
|
+
const itemGroup = inject(MENU_ITEM_GROUP_CONTEXT, { optional: true });
|
|
941
|
+
const radioGroup = inject(MENU_RADIO_ITEM_GROUP_CONTEXT, { optional: true });
|
|
942
|
+
const groupId = itemGroup?.id ?? radioGroup?.id;
|
|
943
|
+
if (!groupId) {
|
|
944
|
+
throw new Error("[menu-item-group-label] requires a parent [menu-item-group] or [menu-radio-item-group] in the injection tree.");
|
|
945
|
+
}
|
|
946
|
+
bindProps({
|
|
947
|
+
elementRef: inject(ElementRef),
|
|
948
|
+
renderer: inject(Renderer2),
|
|
949
|
+
destroyRef: inject(DestroyRef),
|
|
950
|
+
props: () => context.api().getItemGroupLabelProps({ htmlFor: groupId() }),
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuItemGroupLabel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
954
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: MenuItemGroupLabel, isStandalone: true, selector: "[menu-item-group-label]", exportAs: ["menuItemGroupLabel"], ngImport: i0 });
|
|
955
|
+
}
|
|
956
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuItemGroupLabel, decorators: [{
|
|
957
|
+
type: Directive,
|
|
958
|
+
args: [{
|
|
959
|
+
selector: "[menu-item-group-label]",
|
|
960
|
+
standalone: true,
|
|
961
|
+
exportAs: "menuItemGroupLabel",
|
|
962
|
+
}]
|
|
963
|
+
}], ctorParameters: () => [] });
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* Nested-submenu trigger item. The directive must live inside a child menu's
|
|
967
|
+
* `[menu-root]` root that is itself a descendant of a parent `[menu-root]` root.
|
|
968
|
+
* The parent menu's `getTriggerItemProps(childApi)` is applied so clicking or
|
|
969
|
+
* hovering this element opens the child submenu while leaving the parent open.
|
|
970
|
+
*/
|
|
971
|
+
class MenuTriggerItem {
|
|
972
|
+
triggerItemProps = injectMenuTriggerItemContext();
|
|
973
|
+
itemProps = computed(() => ({
|
|
974
|
+
value: String(this.triggerItemProps()?.["data-value"] ?? ""),
|
|
975
|
+
}), /* @ts-ignore */
|
|
976
|
+
...(ngDevMode ? [{ debugName: "itemProps" }] : /* istanbul ignore next */ []));
|
|
977
|
+
constructor() {
|
|
978
|
+
if (!this.triggerItemProps()) {
|
|
979
|
+
throw new Error("[menu-trigger-item] must live inside a nested [menu-root] under a parent [menu-root] root.");
|
|
980
|
+
}
|
|
981
|
+
bindProps({
|
|
982
|
+
elementRef: inject(ElementRef),
|
|
983
|
+
renderer: inject(Renderer2),
|
|
984
|
+
destroyRef: inject(DestroyRef),
|
|
985
|
+
props: () => this.triggerItemProps() ?? {},
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuTriggerItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
989
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: MenuTriggerItem, isStandalone: true, selector: "[menu-trigger-item]", providers: [
|
|
990
|
+
{
|
|
991
|
+
provide: MENU_ITEM_PROPS_CONTEXT,
|
|
992
|
+
useFactory: (item) => item.itemProps,
|
|
993
|
+
deps: [forwardRef(() => MenuTriggerItem)],
|
|
994
|
+
},
|
|
995
|
+
], exportAs: ["menuTriggerItem"], ngImport: i0 });
|
|
996
|
+
}
|
|
997
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuTriggerItem, decorators: [{
|
|
998
|
+
type: Directive,
|
|
999
|
+
args: [{
|
|
1000
|
+
selector: "[menu-trigger-item]",
|
|
1001
|
+
standalone: true,
|
|
1002
|
+
exportAs: "menuTriggerItem",
|
|
1003
|
+
providers: [
|
|
1004
|
+
{
|
|
1005
|
+
provide: MENU_ITEM_PROPS_CONTEXT,
|
|
1006
|
+
useFactory: (item) => item.itemProps,
|
|
1007
|
+
deps: [forwardRef(() => MenuTriggerItem)],
|
|
1008
|
+
},
|
|
1009
|
+
],
|
|
1010
|
+
}]
|
|
1011
|
+
}], ctorParameters: () => [] });
|
|
1012
|
+
|
|
1013
|
+
class MenuItemIndicator {
|
|
1014
|
+
constructor() {
|
|
1015
|
+
const context = injectMenuContext();
|
|
1016
|
+
const itemProps = injectMenuItemPropsContext();
|
|
1017
|
+
bindProps({
|
|
1018
|
+
elementRef: inject(ElementRef),
|
|
1019
|
+
renderer: inject(Renderer2),
|
|
1020
|
+
destroyRef: inject(DestroyRef),
|
|
1021
|
+
props: () => context.api().getItemIndicatorProps(itemProps()),
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1024
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuItemIndicator, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1025
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: MenuItemIndicator, isStandalone: true, selector: "[menu-item-indicator]", exportAs: ["menuItemIndicator"], ngImport: i0 });
|
|
1026
|
+
}
|
|
1027
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MenuItemIndicator, decorators: [{
|
|
1028
|
+
type: Directive,
|
|
1029
|
+
args: [{
|
|
1030
|
+
selector: "[menu-item-indicator]",
|
|
1031
|
+
standalone: true,
|
|
1032
|
+
exportAs: "menuItemIndicator",
|
|
1033
|
+
}]
|
|
1034
|
+
}], ctorParameters: () => [] });
|
|
1035
|
+
|
|
1036
|
+
/**
|
|
1037
|
+
* Generated bundle index. Do not edit.
|
|
1038
|
+
*/
|
|
1039
|
+
|
|
1040
|
+
export { MENU_CONTEXT, MENU_CONTEXT_CARRIER, MENU_ITEM_CONTEXT, MenuArrow, MenuArrowTip, MenuCheckboxItem, MenuContent, MenuContext, MenuContextTrigger, MenuIndicator, MenuItem, MenuItemContextDirective, MenuItemGroup, MenuItemGroupLabel, MenuItemIndicator, MenuItemText, MenuPositioner, MenuRadioItem, MenuRadioItemGroup, MenuRoot, MenuRootProvider, MenuSeparator, MenuTrigger, MenuTriggerItem, injectMenuContext, injectMenuContextCarrier, injectMenuItemContext, useMenu };
|
|
1041
|
+
//# sourceMappingURL=wirekyt-angular-menu.mjs.map
|