@wirekyt/angular 0.0.34 → 0.0.35
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-json-tree-view.mjs +0 -5
- package/dist/fesm2022/wirekyt-angular-json-tree-view.mjs.map +1 -1
- package/dist/fesm2022/wirekyt-angular-listbox.mjs +627 -0
- package/dist/fesm2022/wirekyt-angular-listbox.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-menu.mjs +0 -6
- package/dist/fesm2022/wirekyt-angular-menu.mjs.map +1 -1
- package/dist/fesm2022/wirekyt-angular-number-input.mjs +467 -0
- package/dist/fesm2022/wirekyt-angular-number-input.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-password-input.mjs +437 -0
- package/dist/fesm2022/wirekyt-angular-password-input.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-pin-input.mjs +485 -0
- package/dist/fesm2022/wirekyt-angular-pin-input.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-progress.mjs +337 -0
- package/dist/fesm2022/wirekyt-angular-progress.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-qr-code.mjs +0 -11
- package/dist/fesm2022/wirekyt-angular-qr-code.mjs.map +1 -1
- package/dist/fesm2022/wirekyt-angular-radio-group.mjs +461 -0
- package/dist/fesm2022/wirekyt-angular-radio-group.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-rating-group.mjs +435 -0
- package/dist/fesm2022/wirekyt-angular-rating-group.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-scroll-area.mjs +276 -0
- package/dist/fesm2022/wirekyt-angular-scroll-area.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-segment-group.mjs +506 -0
- package/dist/fesm2022/wirekyt-angular-segment-group.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-signature-pad.mjs +382 -0
- package/dist/fesm2022/wirekyt-angular-signature-pad.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-slider.mjs +574 -0
- package/dist/fesm2022/wirekyt-angular-slider.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-splitter.mjs +303 -0
- package/dist/fesm2022/wirekyt-angular-splitter.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-steps.mjs +465 -0
- package/dist/fesm2022/wirekyt-angular-steps.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-swap.mjs +192 -0
- package/dist/fesm2022/wirekyt-angular-swap.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-switch.mjs +340 -0
- package/dist/fesm2022/wirekyt-angular-switch.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-tags-input.mjs +645 -0
- package/dist/fesm2022/wirekyt-angular-tags-input.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-timer.mjs +294 -0
- package/dist/fesm2022/wirekyt-angular-timer.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-toggle-group.mjs +194 -0
- package/dist/fesm2022/wirekyt-angular-toggle-group.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-toggle.mjs +170 -0
- package/dist/fesm2022/wirekyt-angular-toggle.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-tour.mjs +806 -0
- package/dist/fesm2022/wirekyt-angular-tour.mjs.map +1 -0
- package/dist/package.json +81 -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-json-tree-view.d.ts +0 -5
- package/dist/types/wirekyt-angular-json-tree-view.d.ts.map +1 -1
- package/dist/types/wirekyt-angular-listbox.d.ts +206 -0
- package/dist/types/wirekyt-angular-listbox.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-menu.d.ts +0 -23
- package/dist/types/wirekyt-angular-menu.d.ts.map +1 -1
- package/dist/types/wirekyt-angular-number-input.d.ts +143 -0
- package/dist/types/wirekyt-angular-number-input.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-password-input.d.ts +124 -0
- package/dist/types/wirekyt-angular-password-input.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-pin-input.d.ts +131 -0
- package/dist/types/wirekyt-angular-pin-input.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-progress.d.ts +129 -0
- package/dist/types/wirekyt-angular-progress.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-qr-code.d.ts +0 -11
- package/dist/types/wirekyt-angular-qr-code.d.ts.map +1 -1
- package/dist/types/wirekyt-angular-radio-group.d.ts +149 -0
- package/dist/types/wirekyt-angular-radio-group.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-rating-group.d.ts +136 -0
- package/dist/types/wirekyt-angular-rating-group.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-scroll-area.d.ts +106 -0
- package/dist/types/wirekyt-angular-scroll-area.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-segment-group.d.ts +152 -0
- package/dist/types/wirekyt-angular-segment-group.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-signature-pad.d.ts +120 -0
- package/dist/types/wirekyt-angular-signature-pad.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-slider.d.ts +176 -0
- package/dist/types/wirekyt-angular-slider.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-splitter.d.ts +116 -0
- package/dist/types/wirekyt-angular-splitter.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-steps.d.ts +160 -0
- package/dist/types/wirekyt-angular-steps.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-swap.d.ts +86 -0
- package/dist/types/wirekyt-angular-swap.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-switch.d.ts +110 -0
- package/dist/types/wirekyt-angular-switch.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-tags-input.d.ts +193 -0
- package/dist/types/wirekyt-angular-tags-input.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-timer.d.ts +109 -0
- package/dist/types/wirekyt-angular-timer.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-toggle-group.d.ts +81 -0
- package/dist/types/wirekyt-angular-toggle-group.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-toggle.d.ts +69 -0
- package/dist/types/wirekyt-angular-toggle.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-tour.d.ts +209 -0
- package/dist/types/wirekyt-angular-tour.d.ts.map +1 -0
- package/package.json +82 -3
|
@@ -0,0 +1,627 @@
|
|
|
1
|
+
import * as listbox from '@wirekyt/dom/machines/listbox';
|
|
2
|
+
import { anatomy } from '@wirekyt/dom/machines/listbox';
|
|
3
|
+
export { createListCollection, useListCollection } from '@wirekyt/angular/collection';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { InjectionToken, inject, input, model, booleanAttribute, output, signal, effect, DestroyRef, Renderer2, ElementRef, forwardRef, Directive, computed, TemplateRef, ViewContainerRef } from '@angular/core';
|
|
6
|
+
import { injectLocale, injectEnvironment, createId, useMachine, createCvaController, bindProps } from '@wirekyt/angular';
|
|
7
|
+
import { injectFieldContextOptional } from '@wirekyt/angular/field';
|
|
8
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
9
|
+
import { ListCollection } from '@wirekyt/dom/collection';
|
|
10
|
+
|
|
11
|
+
const listboxAnatomy = anatomy.extendWith("empty");
|
|
12
|
+
|
|
13
|
+
const LISTBOX_CONTEXT = new InjectionToken("WIREKYT.LISTBOX_CONTEXT");
|
|
14
|
+
function injectListboxContext() {
|
|
15
|
+
return inject(LISTBOX_CONTEXT);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const LISTBOX_ITEM_CONTEXT = new InjectionToken("WIREKYT.LISTBOX_ITEM_CONTEXT");
|
|
19
|
+
function injectListboxItemContext() {
|
|
20
|
+
const context = inject(LISTBOX_ITEM_CONTEXT, { optional: true });
|
|
21
|
+
if (!context) {
|
|
22
|
+
throw new Error("LISTBOX_ITEM_CONTEXT not found: a listbox item part directive must be used inside a [listbox-item] directive.");
|
|
23
|
+
}
|
|
24
|
+
return context;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function useListbox(options) {
|
|
28
|
+
const locale = injectLocale();
|
|
29
|
+
const environment = injectEnvironment();
|
|
30
|
+
const field = injectFieldContextOptional();
|
|
31
|
+
const fallbackId = createId();
|
|
32
|
+
return useMachine({
|
|
33
|
+
machine: listbox.machine,
|
|
34
|
+
context: () => {
|
|
35
|
+
const props = options.context();
|
|
36
|
+
const id = props.id ?? fallbackId;
|
|
37
|
+
const merged = {
|
|
38
|
+
dir: locale.dir,
|
|
39
|
+
locale: locale.locale,
|
|
40
|
+
getRootNode: environment.getRootNode,
|
|
41
|
+
...props,
|
|
42
|
+
id,
|
|
43
|
+
};
|
|
44
|
+
if (field) {
|
|
45
|
+
const fieldProps = props;
|
|
46
|
+
const fieldIds = field.ids;
|
|
47
|
+
const baseIds = (props.ids ?? {});
|
|
48
|
+
merged["ids"] = {
|
|
49
|
+
label: fieldIds.label,
|
|
50
|
+
content: fieldIds.control,
|
|
51
|
+
...baseIds,
|
|
52
|
+
};
|
|
53
|
+
const disabled = Boolean(props.disabled) || field.disabled();
|
|
54
|
+
const invalid = Boolean(fieldProps["invalid"]) || field.invalid();
|
|
55
|
+
const required = Boolean(fieldProps["required"]) || field.required();
|
|
56
|
+
merged["disabled"] = disabled || undefined;
|
|
57
|
+
merged["invalid"] = invalid || undefined;
|
|
58
|
+
merged["required"] = required || undefined;
|
|
59
|
+
}
|
|
60
|
+
return merged;
|
|
61
|
+
},
|
|
62
|
+
connect: (service, normalize) => listbox.connect(service, normalize),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
class ListboxRoot {
|
|
67
|
+
id = input(undefined, /* @ts-ignore */
|
|
68
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
69
|
+
elementIds = input(undefined, { ...(ngDevMode ? { debugName: "elementIds" } : /* istanbul ignore next */ {}), alias: "ids" });
|
|
70
|
+
collection = input.required(/* @ts-ignore */
|
|
71
|
+
...(ngDevMode ? [{ debugName: "collection" }] : /* istanbul ignore next */ []));
|
|
72
|
+
value = model(undefined, /* @ts-ignore */
|
|
73
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
74
|
+
defaultValue = input(undefined, /* @ts-ignore */
|
|
75
|
+
...(ngDevMode ? [{ debugName: "defaultValue" }] : /* istanbul ignore next */ []));
|
|
76
|
+
highlightedValue = model(undefined, /* @ts-ignore */
|
|
77
|
+
...(ngDevMode ? [{ debugName: "highlightedValue" }] : /* istanbul ignore next */ []));
|
|
78
|
+
defaultHighlightedValue = input(undefined, /* @ts-ignore */
|
|
79
|
+
...(ngDevMode ? [{ debugName: "defaultHighlightedValue" }] : /* istanbul ignore next */ []));
|
|
80
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
81
|
+
loopFocus = input(false, { ...(ngDevMode ? { debugName: "loopFocus" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
82
|
+
disallowSelectAll = input(false, { ...(ngDevMode ? { debugName: "disallowSelectAll" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
83
|
+
deselectable = input(false, { ...(ngDevMode ? { debugName: "deselectable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
84
|
+
selectOnHighlight = input(false, { ...(ngDevMode ? { debugName: "selectOnHighlight" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
85
|
+
typeahead = input(undefined, { ...(ngDevMode ? { debugName: "typeahead" } : /* istanbul ignore next */ {}), transform: (value) => value === undefined || value === null ? undefined : booleanAttribute(value) });
|
|
86
|
+
orientation = input(undefined, /* @ts-ignore */
|
|
87
|
+
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
88
|
+
selectionMode = input(undefined, /* @ts-ignore */
|
|
89
|
+
...(ngDevMode ? [{ debugName: "selectionMode" }] : /* istanbul ignore next */ []));
|
|
90
|
+
scrollToIndexFn = input(undefined, /* @ts-ignore */
|
|
91
|
+
...(ngDevMode ? [{ debugName: "scrollToIndexFn" }] : /* istanbul ignore next */ []));
|
|
92
|
+
valueChangeDetails = output();
|
|
93
|
+
highlightChange = output();
|
|
94
|
+
select = output();
|
|
95
|
+
_disabledFromForm = signal(false, /* @ts-ignore */
|
|
96
|
+
...(ngDevMode ? [{ debugName: "_disabledFromForm" }] : /* istanbul ignore next */ []));
|
|
97
|
+
_fallbackCollection = new ListCollection({ items: [] });
|
|
98
|
+
_pendingInternalWrites = 0;
|
|
99
|
+
_hasExternalBinding = false;
|
|
100
|
+
_hasReceivedFormWrite = false;
|
|
101
|
+
readCollection() {
|
|
102
|
+
try {
|
|
103
|
+
return this.collection();
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
return this._fallbackCollection;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
cva = createCvaController({
|
|
110
|
+
value: this.value,
|
|
111
|
+
setDisabled: (disabled) => this._disabledFromForm.set(disabled),
|
|
112
|
+
componentName: "ListboxRoot",
|
|
113
|
+
hasExternalModelBinding: () => this._hasExternalBinding,
|
|
114
|
+
});
|
|
115
|
+
machine = useListbox({
|
|
116
|
+
context: () => ({
|
|
117
|
+
id: this.id(),
|
|
118
|
+
ids: this.elementIds(),
|
|
119
|
+
collection: this.readCollection(),
|
|
120
|
+
value: this.value(),
|
|
121
|
+
defaultValue: this.defaultValue() ?? [],
|
|
122
|
+
highlightedValue: this.highlightedValue() ?? undefined,
|
|
123
|
+
defaultHighlightedValue: this.defaultHighlightedValue() ?? undefined,
|
|
124
|
+
disabled: this.disabled() || this._disabledFromForm() || undefined,
|
|
125
|
+
loopFocus: this.loopFocus() || undefined,
|
|
126
|
+
disallowSelectAll: this.disallowSelectAll() || undefined,
|
|
127
|
+
deselectable: this.deselectable() || undefined,
|
|
128
|
+
selectOnHighlight: this.selectOnHighlight() || undefined,
|
|
129
|
+
typeahead: this.typeahead(),
|
|
130
|
+
orientation: this.orientation(),
|
|
131
|
+
selectionMode: this.selectionMode(),
|
|
132
|
+
scrollToIndexFn: this.scrollToIndexFn(),
|
|
133
|
+
onValueChange: (details) => {
|
|
134
|
+
const current = this.value();
|
|
135
|
+
if (!arraysShallowEqual(current, details.value)) {
|
|
136
|
+
this._pendingInternalWrites++;
|
|
137
|
+
this.value.set([...details.value]);
|
|
138
|
+
}
|
|
139
|
+
this.cva.notifyValueChange(details.value);
|
|
140
|
+
this.cva.markTouched();
|
|
141
|
+
this.valueChangeDetails.emit(details);
|
|
142
|
+
},
|
|
143
|
+
onHighlightChange: (details) => {
|
|
144
|
+
const next = details.highlightedValue;
|
|
145
|
+
if (this.highlightedValue() !== next) {
|
|
146
|
+
this.highlightedValue.set(next);
|
|
147
|
+
}
|
|
148
|
+
this.highlightChange.emit(details);
|
|
149
|
+
},
|
|
150
|
+
onSelect: (details) => {
|
|
151
|
+
this.select.emit(details);
|
|
152
|
+
},
|
|
153
|
+
}),
|
|
154
|
+
});
|
|
155
|
+
state = this.machine.state;
|
|
156
|
+
api = this.machine.api;
|
|
157
|
+
service = this.machine.service;
|
|
158
|
+
send = this.machine.send;
|
|
159
|
+
constructor() {
|
|
160
|
+
let firstRunValue = true;
|
|
161
|
+
effect(() => {
|
|
162
|
+
void this.value();
|
|
163
|
+
if (firstRunValue) {
|
|
164
|
+
firstRunValue = false;
|
|
165
|
+
this._pendingInternalWrites = 0;
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (this._pendingInternalWrites > 0) {
|
|
169
|
+
this._pendingInternalWrites--;
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
this._hasExternalBinding = true;
|
|
173
|
+
});
|
|
174
|
+
bindProps({
|
|
175
|
+
elementRef: inject(ElementRef),
|
|
176
|
+
renderer: inject(Renderer2),
|
|
177
|
+
destroyRef: inject(DestroyRef),
|
|
178
|
+
props: () => this.api().getRootProps(),
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
writeValue(value) {
|
|
182
|
+
const next = value ?? [];
|
|
183
|
+
const current = this.value();
|
|
184
|
+
if (!this._hasReceivedFormWrite && current !== undefined) {
|
|
185
|
+
this._hasExternalBinding = true;
|
|
186
|
+
}
|
|
187
|
+
this._hasReceivedFormWrite = true;
|
|
188
|
+
if (!arraysShallowEqual(current, next)) {
|
|
189
|
+
this._pendingInternalWrites++;
|
|
190
|
+
}
|
|
191
|
+
this.cva.writeValue(next);
|
|
192
|
+
}
|
|
193
|
+
registerOnChange(fn) {
|
|
194
|
+
this.cva.registerOnChange(fn);
|
|
195
|
+
}
|
|
196
|
+
registerOnTouched(fn) {
|
|
197
|
+
this.cva.registerOnTouched(fn);
|
|
198
|
+
}
|
|
199
|
+
setDisabledState(disabled) {
|
|
200
|
+
this.cva.setDisabledState(disabled);
|
|
201
|
+
}
|
|
202
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxRoot, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
203
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: ListboxRoot, isStandalone: true, selector: "[listbox-root]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, elementIds: { classPropertyName: "elementIds", publicName: "ids", isSignal: true, isRequired: false, transformFunction: null }, collection: { classPropertyName: "collection", publicName: "collection", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, defaultValue: { classPropertyName: "defaultValue", publicName: "defaultValue", 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 }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, loopFocus: { classPropertyName: "loopFocus", publicName: "loopFocus", isSignal: true, isRequired: false, transformFunction: null }, disallowSelectAll: { classPropertyName: "disallowSelectAll", publicName: "disallowSelectAll", isSignal: true, isRequired: false, transformFunction: null }, deselectable: { classPropertyName: "deselectable", publicName: "deselectable", isSignal: true, isRequired: false, transformFunction: null }, selectOnHighlight: { classPropertyName: "selectOnHighlight", publicName: "selectOnHighlight", isSignal: true, isRequired: false, transformFunction: null }, typeahead: { classPropertyName: "typeahead", publicName: "typeahead", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, scrollToIndexFn: { classPropertyName: "scrollToIndexFn", publicName: "scrollToIndexFn", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", highlightedValue: "highlightedValueChange", valueChangeDetails: "valueChangeDetails", highlightChange: "highlightChange", select: "select" }, providers: [
|
|
204
|
+
{ provide: LISTBOX_CONTEXT, useExisting: forwardRef(() => ListboxRoot) },
|
|
205
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => ListboxRoot), multi: true },
|
|
206
|
+
], exportAs: ["listboxRoot"], ngImport: i0 });
|
|
207
|
+
}
|
|
208
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxRoot, decorators: [{
|
|
209
|
+
type: Directive,
|
|
210
|
+
args: [{
|
|
211
|
+
selector: "[listbox-root]",
|
|
212
|
+
standalone: true,
|
|
213
|
+
exportAs: "listboxRoot",
|
|
214
|
+
providers: [
|
|
215
|
+
{ provide: LISTBOX_CONTEXT, useExisting: forwardRef(() => ListboxRoot) },
|
|
216
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => ListboxRoot), multi: true },
|
|
217
|
+
],
|
|
218
|
+
}]
|
|
219
|
+
}], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], elementIds: [{ type: i0.Input, args: [{ isSignal: true, alias: "ids", required: false }] }], collection: [{ type: i0.Input, args: [{ isSignal: true, alias: "collection", required: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], defaultValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultValue", 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 }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], loopFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "loopFocus", required: false }] }], disallowSelectAll: [{ type: i0.Input, args: [{ isSignal: true, alias: "disallowSelectAll", required: false }] }], deselectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "deselectable", required: false }] }], selectOnHighlight: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectOnHighlight", required: false }] }], typeahead: [{ type: i0.Input, args: [{ isSignal: true, alias: "typeahead", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], selectionMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectionMode", required: false }] }], scrollToIndexFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollToIndexFn", required: false }] }], valueChangeDetails: [{ type: i0.Output, args: ["valueChangeDetails"] }], highlightChange: [{ type: i0.Output, args: ["highlightChange"] }], select: [{ type: i0.Output, args: ["select"] }] } });
|
|
220
|
+
function arraysShallowEqual(a, b) {
|
|
221
|
+
if (a === b)
|
|
222
|
+
return true;
|
|
223
|
+
if (!a || !b)
|
|
224
|
+
return false;
|
|
225
|
+
if (a.length !== b.length)
|
|
226
|
+
return false;
|
|
227
|
+
for (let i = 0; i < a.length; i++) {
|
|
228
|
+
if (a[i] !== b[i])
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
class ListboxRootProvider {
|
|
235
|
+
value = input.required(/* @ts-ignore */
|
|
236
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
237
|
+
get state() {
|
|
238
|
+
return this.value().state;
|
|
239
|
+
}
|
|
240
|
+
get api() {
|
|
241
|
+
return this.value().api;
|
|
242
|
+
}
|
|
243
|
+
get service() {
|
|
244
|
+
return this.value().service;
|
|
245
|
+
}
|
|
246
|
+
get send() {
|
|
247
|
+
return this.value().send;
|
|
248
|
+
}
|
|
249
|
+
resolveValue() {
|
|
250
|
+
return this.value();
|
|
251
|
+
}
|
|
252
|
+
constructor() {
|
|
253
|
+
bindProps({
|
|
254
|
+
elementRef: inject(ElementRef),
|
|
255
|
+
renderer: inject(Renderer2),
|
|
256
|
+
destroyRef: inject(DestroyRef),
|
|
257
|
+
props: () => this.value().api().getRootProps(),
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxRootProvider, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
261
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: ListboxRootProvider, isStandalone: true, selector: "[listbox-root-provider]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, providers: [{ provide: LISTBOX_CONTEXT, useExisting: forwardRef(() => ListboxRootProvider) }], exportAs: ["listboxRootProvider"], ngImport: i0 });
|
|
262
|
+
}
|
|
263
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxRootProvider, decorators: [{
|
|
264
|
+
type: Directive,
|
|
265
|
+
args: [{
|
|
266
|
+
selector: "[listbox-root-provider]",
|
|
267
|
+
standalone: true,
|
|
268
|
+
exportAs: "listboxRootProvider",
|
|
269
|
+
providers: [{ provide: LISTBOX_CONTEXT, useExisting: forwardRef(() => ListboxRootProvider) }],
|
|
270
|
+
}]
|
|
271
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }] } });
|
|
272
|
+
|
|
273
|
+
class ListboxLabel {
|
|
274
|
+
constructor() {
|
|
275
|
+
const context = injectListboxContext();
|
|
276
|
+
bindProps({
|
|
277
|
+
elementRef: inject(ElementRef),
|
|
278
|
+
renderer: inject(Renderer2),
|
|
279
|
+
destroyRef: inject(DestroyRef),
|
|
280
|
+
props: () => context.api().getLabelProps(),
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxLabel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
284
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: ListboxLabel, isStandalone: true, selector: "[listbox-label]", exportAs: ["listboxLabel"], ngImport: i0 });
|
|
285
|
+
}
|
|
286
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxLabel, decorators: [{
|
|
287
|
+
type: Directive,
|
|
288
|
+
args: [{
|
|
289
|
+
selector: "[listbox-label]",
|
|
290
|
+
standalone: true,
|
|
291
|
+
exportAs: "listboxLabel",
|
|
292
|
+
}]
|
|
293
|
+
}], ctorParameters: () => [] });
|
|
294
|
+
|
|
295
|
+
class ListboxInput {
|
|
296
|
+
autoHighlight = input(undefined, { ...(ngDevMode ? { debugName: "autoHighlight" } : /* istanbul ignore next */ {}), transform: (value) => value === undefined || value === null ? undefined : booleanAttribute(value) });
|
|
297
|
+
keyboardPriority = input(undefined, /* @ts-ignore */
|
|
298
|
+
...(ngDevMode ? [{ debugName: "keyboardPriority" }] : /* istanbul ignore next */ []));
|
|
299
|
+
constructor() {
|
|
300
|
+
const context = injectListboxContext();
|
|
301
|
+
bindProps({
|
|
302
|
+
elementRef: inject(ElementRef),
|
|
303
|
+
renderer: inject(Renderer2),
|
|
304
|
+
destroyRef: inject(DestroyRef),
|
|
305
|
+
props: () => context.api().getInputProps({
|
|
306
|
+
autoHighlight: this.autoHighlight(),
|
|
307
|
+
keyboardPriority: this.keyboardPriority(),
|
|
308
|
+
}),
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxInput, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
312
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: ListboxInput, isStandalone: true, selector: "[listbox-input]", inputs: { autoHighlight: { classPropertyName: "autoHighlight", publicName: "autoHighlight", isSignal: true, isRequired: false, transformFunction: null }, keyboardPriority: { classPropertyName: "keyboardPriority", publicName: "keyboardPriority", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["listboxInput"], ngImport: i0 });
|
|
313
|
+
}
|
|
314
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxInput, decorators: [{
|
|
315
|
+
type: Directive,
|
|
316
|
+
args: [{
|
|
317
|
+
selector: "[listbox-input]",
|
|
318
|
+
standalone: true,
|
|
319
|
+
exportAs: "listboxInput",
|
|
320
|
+
}]
|
|
321
|
+
}], ctorParameters: () => [], propDecorators: { autoHighlight: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoHighlight", required: false }] }], keyboardPriority: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyboardPriority", required: false }] }] } });
|
|
322
|
+
|
|
323
|
+
class ListboxContent {
|
|
324
|
+
constructor() {
|
|
325
|
+
const context = injectListboxContext();
|
|
326
|
+
bindProps({
|
|
327
|
+
elementRef: inject(ElementRef),
|
|
328
|
+
renderer: inject(Renderer2),
|
|
329
|
+
destroyRef: inject(DestroyRef),
|
|
330
|
+
props: () => context.api().getContentProps(),
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
334
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: ListboxContent, isStandalone: true, selector: "[listbox-content]", exportAs: ["listboxContent"], ngImport: i0 });
|
|
335
|
+
}
|
|
336
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxContent, decorators: [{
|
|
337
|
+
type: Directive,
|
|
338
|
+
args: [{
|
|
339
|
+
selector: "[listbox-content]",
|
|
340
|
+
standalone: true,
|
|
341
|
+
exportAs: "listboxContent",
|
|
342
|
+
}]
|
|
343
|
+
}], ctorParameters: () => [] });
|
|
344
|
+
|
|
345
|
+
const parts = listboxAnatomy.build();
|
|
346
|
+
class ListboxEmpty {
|
|
347
|
+
constructor() {
|
|
348
|
+
const context = injectListboxContext();
|
|
349
|
+
const elementRef = inject(ElementRef);
|
|
350
|
+
const renderer = inject(Renderer2);
|
|
351
|
+
const destroyRef = inject(DestroyRef);
|
|
352
|
+
bindProps({
|
|
353
|
+
elementRef,
|
|
354
|
+
renderer,
|
|
355
|
+
destroyRef,
|
|
356
|
+
props: () => ({
|
|
357
|
+
...parts.empty.attrs,
|
|
358
|
+
role: "presentation",
|
|
359
|
+
style: { display: context.api().collection.size === 0 ? undefined : "none" },
|
|
360
|
+
}),
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxEmpty, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
364
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: ListboxEmpty, isStandalone: true, selector: "[listbox-empty]", exportAs: ["listboxEmpty"], ngImport: i0 });
|
|
365
|
+
}
|
|
366
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxEmpty, decorators: [{
|
|
367
|
+
type: Directive,
|
|
368
|
+
args: [{
|
|
369
|
+
selector: "[listbox-empty]",
|
|
370
|
+
standalone: true,
|
|
371
|
+
exportAs: "listboxEmpty",
|
|
372
|
+
}]
|
|
373
|
+
}], ctorParameters: () => [] });
|
|
374
|
+
|
|
375
|
+
const LISTBOX_ITEM_GROUP_CONTEXT = new InjectionToken("WIREKYT.LISTBOX_ITEM_GROUP_CONTEXT");
|
|
376
|
+
function injectListboxItemGroupContext() {
|
|
377
|
+
const context = inject(LISTBOX_ITEM_GROUP_CONTEXT, { optional: true });
|
|
378
|
+
if (!context) {
|
|
379
|
+
throw new Error("LISTBOX_ITEM_GROUP_CONTEXT not found: an item-group-label directive must be used inside a [listbox-item-group] directive.");
|
|
380
|
+
}
|
|
381
|
+
return context;
|
|
382
|
+
}
|
|
383
|
+
class ListboxItemGroup {
|
|
384
|
+
groupId = input(undefined, { ...(ngDevMode ? { debugName: "groupId" } : /* istanbul ignore next */ {}), alias: "id" });
|
|
385
|
+
fallbackId = createId();
|
|
386
|
+
id = computed(() => this.groupId() ?? this.fallbackId, /* @ts-ignore */
|
|
387
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
388
|
+
constructor() {
|
|
389
|
+
const context = injectListboxContext();
|
|
390
|
+
bindProps({
|
|
391
|
+
elementRef: inject(ElementRef),
|
|
392
|
+
renderer: inject(Renderer2),
|
|
393
|
+
destroyRef: inject(DestroyRef),
|
|
394
|
+
props: () => context.api().getItemGroupProps({ id: this.id() }),
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxItemGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
398
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: ListboxItemGroup, isStandalone: true, selector: "[listbox-item-group]", inputs: { groupId: { classPropertyName: "groupId", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
399
|
+
{ provide: LISTBOX_ITEM_GROUP_CONTEXT, useExisting: forwardRef(() => ListboxItemGroup) },
|
|
400
|
+
], exportAs: ["listboxItemGroup"], ngImport: i0 });
|
|
401
|
+
}
|
|
402
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxItemGroup, decorators: [{
|
|
403
|
+
type: Directive,
|
|
404
|
+
args: [{
|
|
405
|
+
selector: "[listbox-item-group]",
|
|
406
|
+
standalone: true,
|
|
407
|
+
exportAs: "listboxItemGroup",
|
|
408
|
+
providers: [
|
|
409
|
+
{ provide: LISTBOX_ITEM_GROUP_CONTEXT, useExisting: forwardRef(() => ListboxItemGroup) },
|
|
410
|
+
],
|
|
411
|
+
}]
|
|
412
|
+
}], ctorParameters: () => [], propDecorators: { groupId: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }] } });
|
|
413
|
+
|
|
414
|
+
class ListboxItemGroupLabel {
|
|
415
|
+
constructor() {
|
|
416
|
+
const context = injectListboxContext();
|
|
417
|
+
const group = injectListboxItemGroupContext();
|
|
418
|
+
bindProps({
|
|
419
|
+
elementRef: inject(ElementRef),
|
|
420
|
+
renderer: inject(Renderer2),
|
|
421
|
+
destroyRef: inject(DestroyRef),
|
|
422
|
+
props: () => context.api().getItemGroupLabelProps({ htmlFor: group.id() }),
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxItemGroupLabel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
426
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: ListboxItemGroupLabel, isStandalone: true, selector: "[listbox-item-group-label]", exportAs: ["listboxItemGroupLabel"], ngImport: i0 });
|
|
427
|
+
}
|
|
428
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxItemGroupLabel, decorators: [{
|
|
429
|
+
type: Directive,
|
|
430
|
+
args: [{
|
|
431
|
+
selector: "[listbox-item-group-label]",
|
|
432
|
+
standalone: true,
|
|
433
|
+
exportAs: "listboxItemGroupLabel",
|
|
434
|
+
}]
|
|
435
|
+
}], ctorParameters: () => [] });
|
|
436
|
+
|
|
437
|
+
class ListboxItem {
|
|
438
|
+
item = input.required(/* @ts-ignore */
|
|
439
|
+
...(ngDevMode ? [{ debugName: "item" }] : /* istanbul ignore next */ []));
|
|
440
|
+
highlightOnHover = input(undefined, { ...(ngDevMode ? { debugName: "highlightOnHover" } : /* istanbul ignore next */ {}), transform: (value) => value === undefined || value === null ? undefined : booleanAttribute(value) });
|
|
441
|
+
context = injectListboxContext();
|
|
442
|
+
state = computed(() => this.context.api().getItemState({
|
|
443
|
+
item: this.item(),
|
|
444
|
+
highlightOnHover: this.highlightOnHover(),
|
|
445
|
+
}), /* @ts-ignore */
|
|
446
|
+
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
447
|
+
constructor() {
|
|
448
|
+
const context = this.context;
|
|
449
|
+
bindProps({
|
|
450
|
+
elementRef: inject(ElementRef),
|
|
451
|
+
renderer: inject(Renderer2),
|
|
452
|
+
destroyRef: inject(DestroyRef),
|
|
453
|
+
props: () => context
|
|
454
|
+
.api()
|
|
455
|
+
.getItemProps({ item: this.item(), highlightOnHover: this.highlightOnHover() }),
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
459
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: ListboxItem, isStandalone: true, selector: "[listbox-item]", inputs: { item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: true, transformFunction: null }, highlightOnHover: { classPropertyName: "highlightOnHover", publicName: "highlightOnHover", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: LISTBOX_ITEM_CONTEXT, useExisting: forwardRef(() => ListboxItem) }], exportAs: ["listboxItem"], ngImport: i0 });
|
|
460
|
+
}
|
|
461
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxItem, decorators: [{
|
|
462
|
+
type: Directive,
|
|
463
|
+
args: [{
|
|
464
|
+
selector: "[listbox-item]",
|
|
465
|
+
standalone: true,
|
|
466
|
+
exportAs: "listboxItem",
|
|
467
|
+
providers: [{ provide: LISTBOX_ITEM_CONTEXT, useExisting: forwardRef(() => ListboxItem) }],
|
|
468
|
+
}]
|
|
469
|
+
}], ctorParameters: () => [], propDecorators: { item: [{ type: i0.Input, args: [{ isSignal: true, alias: "item", required: true }] }], highlightOnHover: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlightOnHover", required: false }] }] } });
|
|
470
|
+
|
|
471
|
+
class ListboxContext {
|
|
472
|
+
static ngTemplateContextGuard(_directive, context) {
|
|
473
|
+
void context;
|
|
474
|
+
return true;
|
|
475
|
+
}
|
|
476
|
+
listbox = injectListboxContext();
|
|
477
|
+
templateRef = inject(TemplateRef);
|
|
478
|
+
viewContainer = inject(ViewContainerRef);
|
|
479
|
+
constructor() {
|
|
480
|
+
const view = this.viewContainer.createEmbeddedView(this.templateRef, {
|
|
481
|
+
$implicit: this.listbox.api,
|
|
482
|
+
api: this.listbox.api,
|
|
483
|
+
});
|
|
484
|
+
effect(() => {
|
|
485
|
+
this.listbox.api();
|
|
486
|
+
view.detectChanges();
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxContext, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
490
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: ListboxContext, isStandalone: true, selector: "[listbox-context]", exportAs: ["listboxContext"], ngImport: i0 });
|
|
491
|
+
}
|
|
492
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxContext, decorators: [{
|
|
493
|
+
type: Directive,
|
|
494
|
+
args: [{
|
|
495
|
+
selector: "[listbox-context]",
|
|
496
|
+
standalone: true,
|
|
497
|
+
exportAs: "listboxContext",
|
|
498
|
+
}]
|
|
499
|
+
}], ctorParameters: () => [] });
|
|
500
|
+
|
|
501
|
+
class ListboxItemContextDirective {
|
|
502
|
+
static ngTemplateContextGuard(_directive, context) {
|
|
503
|
+
void context;
|
|
504
|
+
return true;
|
|
505
|
+
}
|
|
506
|
+
item = injectListboxItemContext();
|
|
507
|
+
templateRef = inject(TemplateRef);
|
|
508
|
+
viewContainer = inject(ViewContainerRef);
|
|
509
|
+
constructor() {
|
|
510
|
+
const view = this.viewContainer.createEmbeddedView(this.templateRef, {
|
|
511
|
+
$implicit: this.item,
|
|
512
|
+
item: this.item,
|
|
513
|
+
});
|
|
514
|
+
effect(() => {
|
|
515
|
+
this.item.state();
|
|
516
|
+
view.detectChanges();
|
|
517
|
+
});
|
|
518
|
+
inject(DestroyRef).onDestroy(() => view.destroy());
|
|
519
|
+
}
|
|
520
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxItemContextDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
521
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: ListboxItemContextDirective, isStandalone: true, selector: "[listbox-item-context]", exportAs: ["listboxItemContext"], ngImport: i0 });
|
|
522
|
+
}
|
|
523
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxItemContextDirective, decorators: [{
|
|
524
|
+
type: Directive,
|
|
525
|
+
args: [{
|
|
526
|
+
selector: "[listbox-item-context]",
|
|
527
|
+
standalone: true,
|
|
528
|
+
exportAs: "listboxItemContext",
|
|
529
|
+
}]
|
|
530
|
+
}], ctorParameters: () => [] });
|
|
531
|
+
|
|
532
|
+
class ListboxItemText {
|
|
533
|
+
constructor() {
|
|
534
|
+
const context = injectListboxContext();
|
|
535
|
+
const item = injectListboxItemContext();
|
|
536
|
+
bindProps({
|
|
537
|
+
elementRef: inject(ElementRef),
|
|
538
|
+
renderer: inject(Renderer2),
|
|
539
|
+
destroyRef: inject(DestroyRef),
|
|
540
|
+
props: () => context
|
|
541
|
+
.api()
|
|
542
|
+
.getItemTextProps({ item: item.item(), highlightOnHover: item.highlightOnHover() }),
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxItemText, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
546
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: ListboxItemText, isStandalone: true, selector: "[listbox-item-text]", exportAs: ["listboxItemText"], ngImport: i0 });
|
|
547
|
+
}
|
|
548
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxItemText, decorators: [{
|
|
549
|
+
type: Directive,
|
|
550
|
+
args: [{
|
|
551
|
+
selector: "[listbox-item-text]",
|
|
552
|
+
standalone: true,
|
|
553
|
+
exportAs: "listboxItemText",
|
|
554
|
+
}]
|
|
555
|
+
}], ctorParameters: () => [] });
|
|
556
|
+
|
|
557
|
+
class ListboxItemIndicator {
|
|
558
|
+
constructor() {
|
|
559
|
+
const context = injectListboxContext();
|
|
560
|
+
const item = injectListboxItemContext();
|
|
561
|
+
bindProps({
|
|
562
|
+
elementRef: inject(ElementRef),
|
|
563
|
+
renderer: inject(Renderer2),
|
|
564
|
+
destroyRef: inject(DestroyRef),
|
|
565
|
+
props: () => context
|
|
566
|
+
.api()
|
|
567
|
+
.getItemIndicatorProps({ item: item.item(), highlightOnHover: item.highlightOnHover() }),
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxItemIndicator, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
571
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: ListboxItemIndicator, isStandalone: true, selector: "[listbox-item-indicator]", exportAs: ["listboxItemIndicator"], ngImport: i0 });
|
|
572
|
+
}
|
|
573
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxItemIndicator, decorators: [{
|
|
574
|
+
type: Directive,
|
|
575
|
+
args: [{
|
|
576
|
+
selector: "[listbox-item-indicator]",
|
|
577
|
+
standalone: true,
|
|
578
|
+
exportAs: "listboxItemIndicator",
|
|
579
|
+
}]
|
|
580
|
+
}], ctorParameters: () => [] });
|
|
581
|
+
|
|
582
|
+
class ListboxValueText {
|
|
583
|
+
placeholder = input(undefined, /* @ts-ignore */
|
|
584
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
585
|
+
elementRef = inject(ElementRef);
|
|
586
|
+
renderer = inject(Renderer2);
|
|
587
|
+
ownsTextContent = signal(false, /* @ts-ignore */
|
|
588
|
+
...(ngDevMode ? [{ debugName: "ownsTextContent" }] : /* istanbul ignore next */ []));
|
|
589
|
+
constructor() {
|
|
590
|
+
const context = injectListboxContext();
|
|
591
|
+
bindProps({
|
|
592
|
+
elementRef: this.elementRef,
|
|
593
|
+
renderer: this.renderer,
|
|
594
|
+
destroyRef: inject(DestroyRef),
|
|
595
|
+
props: () => context.api().getValueTextProps(),
|
|
596
|
+
});
|
|
597
|
+
effect(() => {
|
|
598
|
+
if (!this.ownsTextContent())
|
|
599
|
+
return;
|
|
600
|
+
const api = context.api();
|
|
601
|
+
this.renderer.setProperty(this.elementRef.nativeElement, "textContent", api.valueAsString || this.placeholder() || "");
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
ngAfterContentInit() {
|
|
605
|
+
this.ownsTextContent.set(hasOnlyWhitespaceContent(this.elementRef.nativeElement));
|
|
606
|
+
}
|
|
607
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxValueText, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
608
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: ListboxValueText, isStandalone: true, selector: "[listbox-value-text]", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["listboxValueText"], ngImport: i0 });
|
|
609
|
+
}
|
|
610
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ListboxValueText, decorators: [{
|
|
611
|
+
type: Directive,
|
|
612
|
+
args: [{
|
|
613
|
+
selector: "[listbox-value-text]",
|
|
614
|
+
standalone: true,
|
|
615
|
+
exportAs: "listboxValueText",
|
|
616
|
+
}]
|
|
617
|
+
}], ctorParameters: () => [], propDecorators: { placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }] } });
|
|
618
|
+
function hasOnlyWhitespaceContent(element) {
|
|
619
|
+
return element.firstElementChild === null && (element.textContent?.trim() ?? "") === "";
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Generated bundle index. Do not edit.
|
|
624
|
+
*/
|
|
625
|
+
|
|
626
|
+
export { LISTBOX_CONTEXT, LISTBOX_ITEM_CONTEXT, LISTBOX_ITEM_GROUP_CONTEXT, ListboxContent, ListboxContext, ListboxEmpty, ListboxInput, ListboxItem, ListboxItemContextDirective, ListboxItemGroup, ListboxItemGroupLabel, ListboxItemIndicator, ListboxItemText, ListboxLabel, ListboxRoot, ListboxRootProvider, ListboxValueText, injectListboxContext, injectListboxItemContext, injectListboxItemGroupContext, listboxAnatomy, useListbox };
|
|
627
|
+
//# sourceMappingURL=wirekyt-angular-listbox.mjs.map
|