@star-ng/ui 0.0.0-placeholder.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +147 -3
- package/fesm2022/star-ng-ui-accordion.mjs +376 -0
- package/fesm2022/star-ng-ui-accordion.mjs.map +1 -0
- package/fesm2022/star-ng-ui-autocomplete.mjs +782 -0
- package/fesm2022/star-ng-ui-autocomplete.mjs.map +1 -0
- package/fesm2022/star-ng-ui-avatar.mjs +154 -0
- package/fesm2022/star-ng-ui-avatar.mjs.map +1 -0
- package/fesm2022/star-ng-ui-badge.mjs +153 -0
- package/fesm2022/star-ng-ui-badge.mjs.map +1 -0
- package/fesm2022/star-ng-ui-breadcrumb.mjs +199 -0
- package/fesm2022/star-ng-ui-breadcrumb.mjs.map +1 -0
- package/fesm2022/star-ng-ui-button.mjs +282 -0
- package/fesm2022/star-ng-ui-button.mjs.map +1 -0
- package/fesm2022/star-ng-ui-card.mjs +112 -0
- package/fesm2022/star-ng-ui-card.mjs.map +1 -0
- package/fesm2022/star-ng-ui-chart.mjs +1904 -0
- package/fesm2022/star-ng-ui-chart.mjs.map +1 -0
- package/fesm2022/star-ng-ui-checkbox.mjs +345 -0
- package/fesm2022/star-ng-ui-checkbox.mjs.map +1 -0
- package/fesm2022/star-ng-ui-core.mjs +392 -0
- package/fesm2022/star-ng-ui-core.mjs.map +1 -0
- package/fesm2022/star-ng-ui-data-display.mjs +1556 -0
- package/fesm2022/star-ng-ui-data-display.mjs.map +1 -0
- package/fesm2022/star-ng-ui-date-picker.mjs +2786 -0
- package/fesm2022/star-ng-ui-date-picker.mjs.map +1 -0
- package/fesm2022/star-ng-ui-dialog.mjs +948 -0
- package/fesm2022/star-ng-ui-dialog.mjs.map +1 -0
- package/fesm2022/star-ng-ui-drawer.mjs +158 -0
- package/fesm2022/star-ng-ui-drawer.mjs.map +1 -0
- package/fesm2022/star-ng-ui-editor.mjs +416 -0
- package/fesm2022/star-ng-ui-editor.mjs.map +1 -0
- package/fesm2022/star-ng-ui-field.mjs +378 -0
- package/fesm2022/star-ng-ui-field.mjs.map +1 -0
- package/fesm2022/star-ng-ui-file-upload.mjs +762 -0
- package/fesm2022/star-ng-ui-file-upload.mjs.map +1 -0
- package/fesm2022/star-ng-ui-i18n-de.mjs +179 -0
- package/fesm2022/star-ng-ui-i18n-de.mjs.map +1 -0
- package/fesm2022/star-ng-ui-i18n-es.mjs +179 -0
- package/fesm2022/star-ng-ui-i18n-es.mjs.map +1 -0
- package/fesm2022/star-ng-ui-input-group.mjs +188 -0
- package/fesm2022/star-ng-ui-input-group.mjs.map +1 -0
- package/fesm2022/star-ng-ui-input-mask.mjs +434 -0
- package/fesm2022/star-ng-ui-input-mask.mjs.map +1 -0
- package/fesm2022/star-ng-ui-input-number.mjs +691 -0
- package/fesm2022/star-ng-ui-input-number.mjs.map +1 -0
- package/fesm2022/star-ng-ui-input-otp.mjs +343 -0
- package/fesm2022/star-ng-ui-input-otp.mjs.map +1 -0
- package/fesm2022/star-ng-ui-input-tags.mjs +616 -0
- package/fesm2022/star-ng-ui-input-tags.mjs.map +1 -0
- package/fesm2022/star-ng-ui-knob.mjs +514 -0
- package/fesm2022/star-ng-ui-knob.mjs.map +1 -0
- package/fesm2022/star-ng-ui-layout.mjs +608 -0
- package/fesm2022/star-ng-ui-layout.mjs.map +1 -0
- package/fesm2022/star-ng-ui-listbox.mjs +978 -0
- package/fesm2022/star-ng-ui-listbox.mjs.map +1 -0
- package/fesm2022/star-ng-ui-media.mjs +833 -0
- package/fesm2022/star-ng-ui-media.mjs.map +1 -0
- package/fesm2022/star-ng-ui-menu.mjs +1840 -0
- package/fesm2022/star-ng-ui-menu.mjs.map +1 -0
- package/fesm2022/star-ng-ui-message.mjs +191 -0
- package/fesm2022/star-ng-ui-message.mjs.map +1 -0
- package/fesm2022/star-ng-ui-paginator.mjs +387 -0
- package/fesm2022/star-ng-ui-paginator.mjs.map +1 -0
- package/fesm2022/star-ng-ui-panel.mjs +324 -0
- package/fesm2022/star-ng-ui-panel.mjs.map +1 -0
- package/fesm2022/star-ng-ui-password.mjs +517 -0
- package/fesm2022/star-ng-ui-password.mjs.map +1 -0
- package/fesm2022/star-ng-ui-popover.mjs +241 -0
- package/fesm2022/star-ng-ui-popover.mjs.map +1 -0
- package/fesm2022/star-ng-ui-progress-bar.mjs +183 -0
- package/fesm2022/star-ng-ui-progress-bar.mjs.map +1 -0
- package/fesm2022/star-ng-ui-radio.mjs +411 -0
- package/fesm2022/star-ng-ui-radio.mjs.map +1 -0
- package/fesm2022/star-ng-ui-rating.mjs +211 -0
- package/fesm2022/star-ng-ui-rating.mjs.map +1 -0
- package/fesm2022/star-ng-ui-select-button.mjs +613 -0
- package/fesm2022/star-ng-ui-select-button.mjs.map +1 -0
- package/fesm2022/star-ng-ui-select.mjs +2523 -0
- package/fesm2022/star-ng-ui-select.mjs.map +1 -0
- package/fesm2022/star-ng-ui-skeleton.mjs +160 -0
- package/fesm2022/star-ng-ui-skeleton.mjs.map +1 -0
- package/fesm2022/star-ng-ui-slider.mjs +552 -0
- package/fesm2022/star-ng-ui-slider.mjs.map +1 -0
- package/fesm2022/star-ng-ui-spinner.mjs +148 -0
- package/fesm2022/star-ng-ui-spinner.mjs.map +1 -0
- package/fesm2022/star-ng-ui-stepper.mjs +360 -0
- package/fesm2022/star-ng-ui-stepper.mjs.map +1 -0
- package/fesm2022/star-ng-ui-table.mjs +3477 -0
- package/fesm2022/star-ng-ui-table.mjs.map +1 -0
- package/fesm2022/star-ng-ui-tabs.mjs +464 -0
- package/fesm2022/star-ng-ui-tabs.mjs.map +1 -0
- package/fesm2022/star-ng-ui-tag.mjs +129 -0
- package/fesm2022/star-ng-ui-tag.mjs.map +1 -0
- package/fesm2022/star-ng-ui-theme-switch.mjs +105 -0
- package/fesm2022/star-ng-ui-theme-switch.mjs.map +1 -0
- package/fesm2022/star-ng-ui-theme.mjs +98 -0
- package/fesm2022/star-ng-ui-theme.mjs.map +1 -0
- package/fesm2022/star-ng-ui-toast.mjs +298 -0
- package/fesm2022/star-ng-ui-toast.mjs.map +1 -0
- package/fesm2022/star-ng-ui-toggle-switch.mjs +316 -0
- package/fesm2022/star-ng-ui-toggle-switch.mjs.map +1 -0
- package/fesm2022/star-ng-ui-tooltip.mjs +297 -0
- package/fesm2022/star-ng-ui-tooltip.mjs.map +1 -0
- package/fesm2022/star-ng-ui-transloco.mjs +40 -0
- package/fesm2022/star-ng-ui-transloco.mjs.map +1 -0
- package/fesm2022/star-ng-ui-tree.mjs +1446 -0
- package/fesm2022/star-ng-ui-tree.mjs.map +1 -0
- package/fesm2022/star-ng-ui-utility.mjs +2134 -0
- package/fesm2022/star-ng-ui-utility.mjs.map +1 -0
- package/fesm2022/star-ng-ui.mjs +51 -0
- package/package.json +281 -5
- package/styles/_base.scss +70 -0
- package/styles/_shared.scss +2 -0
- package/styles/_tokens.scss +190 -0
- package/styles/controls/_accordion.scss +75 -0
- package/styles/controls/_autocomplete.scss +44 -0
- package/styles/controls/_avatar.scss +39 -0
- package/styles/controls/_breadcrumb.scss +45 -0
- package/styles/controls/_button.scss +137 -0
- package/styles/controls/_card.scss +38 -0
- package/styles/controls/_chart.scss +214 -0
- package/styles/controls/_chip.scss +51 -0
- package/styles/controls/_choice.scss +153 -0
- package/styles/controls/_data-display.scss +118 -0
- package/styles/controls/_date-picker.scss +300 -0
- package/styles/controls/_dialog.scss +123 -0
- package/styles/controls/_drawer.scss +118 -0
- package/styles/controls/_editor.scss +74 -0
- package/styles/controls/_field.scss +92 -0
- package/styles/controls/_file-upload.scss +136 -0
- package/styles/controls/_input-group.scss +104 -0
- package/styles/controls/_input-mask.scss +46 -0
- package/styles/controls/_input-number.scss +125 -0
- package/styles/controls/_knob.scss +76 -0
- package/styles/controls/_layout.scss +182 -0
- package/styles/controls/_listbox.scss +38 -0
- package/styles/controls/_media.scss +222 -0
- package/styles/controls/_menu.scss +254 -0
- package/styles/controls/_message.scss +48 -0
- package/styles/controls/_org-chart.scss +128 -0
- package/styles/controls/_paginator.scss +59 -0
- package/styles/controls/_panel.scss +83 -0
- package/styles/controls/_popover.scss +40 -0
- package/styles/controls/_progress-bar.scss +74 -0
- package/styles/controls/_select-button.scss +61 -0
- package/styles/controls/_select.scss +216 -0
- package/styles/controls/_skeleton.scss +43 -0
- package/styles/controls/_slider.scss +163 -0
- package/styles/controls/_spinner.scss +34 -0
- package/styles/controls/_stepper.scss +109 -0
- package/styles/controls/_table.scss +523 -0
- package/styles/controls/_tabs.scss +93 -0
- package/styles/controls/_tag.scss +84 -0
- package/styles/controls/_toast.scss +141 -0
- package/styles/controls/_tooltip.scss +14 -0
- package/styles/controls/_tree.scss +113 -0
- package/styles/controls/_utility.scss +654 -0
- package/styles/star-ng.css +5803 -0
- package/styles/star-ng.min.css +1 -0
- package/styles/star-ng.scss +50 -0
- package/theme/star-theme-first-paint.js +1 -0
- package/types/star-ng-ui-accordion.d.ts +82 -0
- package/types/star-ng-ui-autocomplete.d.ts +171 -0
- package/types/star-ng-ui-avatar.d.ts +43 -0
- package/types/star-ng-ui-badge.d.ts +46 -0
- package/types/star-ng-ui-breadcrumb.d.ts +39 -0
- package/types/star-ng-ui-button.d.ts +79 -0
- package/types/star-ng-ui-card.d.ts +29 -0
- package/types/star-ng-ui-chart.d.ts +337 -0
- package/types/star-ng-ui-checkbox.d.ts +92 -0
- package/types/star-ng-ui-core.d.ts +310 -0
- package/types/star-ng-ui-data-display.d.ts +339 -0
- package/types/star-ng-ui-date-picker.d.ts +701 -0
- package/types/star-ng-ui-dialog.d.ts +254 -0
- package/types/star-ng-ui-drawer.d.ts +29 -0
- package/types/star-ng-ui-editor.d.ts +96 -0
- package/types/star-ng-ui-field.d.ts +146 -0
- package/types/star-ng-ui-file-upload.d.ts +192 -0
- package/types/star-ng-ui-i18n-de.d.ts +7 -0
- package/types/star-ng-ui-i18n-es.d.ts +7 -0
- package/types/star-ng-ui-input-group.d.ts +58 -0
- package/types/star-ng-ui-input-mask.d.ts +126 -0
- package/types/star-ng-ui-input-number.d.ts +193 -0
- package/types/star-ng-ui-input-otp.d.ts +86 -0
- package/types/star-ng-ui-input-tags.d.ts +159 -0
- package/types/star-ng-ui-knob.d.ts +121 -0
- package/types/star-ng-ui-layout.d.ts +154 -0
- package/types/star-ng-ui-listbox.d.ts +197 -0
- package/types/star-ng-ui-media.d.ts +161 -0
- package/types/star-ng-ui-menu.d.ts +332 -0
- package/types/star-ng-ui-message.d.ts +52 -0
- package/types/star-ng-ui-paginator.d.ts +85 -0
- package/types/star-ng-ui-panel.d.ts +65 -0
- package/types/star-ng-ui-password.d.ts +129 -0
- package/types/star-ng-ui-popover.d.ts +57 -0
- package/types/star-ng-ui-progress-bar.d.ts +49 -0
- package/types/star-ng-ui-radio.d.ts +116 -0
- package/types/star-ng-ui-rating.d.ts +52 -0
- package/types/star-ng-ui-select-button.d.ts +169 -0
- package/types/star-ng-ui-select.d.ts +540 -0
- package/types/star-ng-ui-skeleton.d.ts +47 -0
- package/types/star-ng-ui-slider.d.ts +145 -0
- package/types/star-ng-ui-spinner.d.ts +29 -0
- package/types/star-ng-ui-stepper.d.ts +89 -0
- package/types/star-ng-ui-table.d.ts +829 -0
- package/types/star-ng-ui-tabs.d.ts +109 -0
- package/types/star-ng-ui-tag.d.ts +35 -0
- package/types/star-ng-ui-theme-switch.d.ts +36 -0
- package/types/star-ng-ui-theme.d.ts +95 -0
- package/types/star-ng-ui-toast.d.ts +84 -0
- package/types/star-ng-ui-toggle-switch.d.ts +81 -0
- package/types/star-ng-ui-tooltip.d.ts +66 -0
- package/types/star-ng-ui-transloco.d.ts +14 -0
- package/types/star-ng-ui-tree.d.ts +310 -0
- package/types/star-ng-ui-utility.d.ts +533 -0
- package/types/star-ng-ui.d.ts +51 -0
|
@@ -0,0 +1,782 @@
|
|
|
1
|
+
import { CdkConnectedOverlay, CdkOverlayOrigin } from "@angular/cdk/overlay";
|
|
2
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import { ChangeDetectionStrategy, Component, DestroyRef, Directive, booleanAttribute, computed, effect, inject, input, linkedSignal, model, output, signal, untracked, viewChild } from "@angular/core";
|
|
5
|
+
import { matchesFilter } from "@star-ng/ui/core";
|
|
6
|
+
import { StarOptionListBase } from "@star-ng/ui/select";
|
|
7
|
+
var StarAutoCompleteBase = class StarAutoCompleteBase extends StarOptionListBase {
|
|
8
|
+
suggestions = input(null, ...ngDevMode ? [{ debugName: "suggestions" }] : /* istanbul ignore next */ []);
|
|
9
|
+
minQueryLength = input(1, ...ngDevMode ? [{ debugName: "minQueryLength" }] : /* istanbul ignore next */ []);
|
|
10
|
+
delay = input(300, ...ngDevMode ? [{ debugName: "delay" }] : /* istanbul ignore next */ []);
|
|
11
|
+
dropdown = input(false, {
|
|
12
|
+
...ngDevMode ? { debugName: "dropdown" } : /* istanbul ignore next */ {},
|
|
13
|
+
transform: booleanAttribute
|
|
14
|
+
});
|
|
15
|
+
autoHighlight = input(false, {
|
|
16
|
+
...ngDevMode ? { debugName: "autoHighlight" } : /* istanbul ignore next */ {},
|
|
17
|
+
transform: booleanAttribute
|
|
18
|
+
});
|
|
19
|
+
showEmptyMessage = input(true, {
|
|
20
|
+
...ngDevMode ? { debugName: "showEmptyMessage" } : /* istanbul ignore next */ {},
|
|
21
|
+
transform: booleanAttribute
|
|
22
|
+
});
|
|
23
|
+
completeMethod = output();
|
|
24
|
+
closeOnChoose = true;
|
|
25
|
+
control = viewChild.required("control", ...ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []);
|
|
26
|
+
known = signal([], ...ngDevMode ? [{ debugName: "known" }] : /* istanbul ignore next */ []);
|
|
27
|
+
showAll = signal(false, ...ngDevMode ? [{ debugName: "showAll" }] : /* istanbul ignore next */ []);
|
|
28
|
+
searchTimer;
|
|
29
|
+
query = linkedSignal(() => this.queryFromValue(), ...ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []);
|
|
30
|
+
visibleOptions = computed(() => {
|
|
31
|
+
const remote = this.suggestions();
|
|
32
|
+
const query = this.query();
|
|
33
|
+
const candidates = remote ?? (this.showAll() || !query ? this.options() : this.options().filter((option) => matchesFilter(this.labelOf(option), query)));
|
|
34
|
+
return this.groupedOrder(this.isMultiple ? candidates.filter((option) => !this.isSelected(option)) : candidates);
|
|
35
|
+
}, ...ngDevMode ? [{ debugName: "visibleOptions" }] : /* istanbul ignore next */ []);
|
|
36
|
+
queryLongEnough = computed(() => this.showAll() || this.query().length >= this.minQueryLength(), ...ngDevMode ? [{ debugName: "queryLongEnough" }] : /* istanbul ignore next */ []);
|
|
37
|
+
panelVisible = computed(() => this.open() && this.queryLongEnough() && (this.visibleOptions().length > 0 || this.loading() || this.showEmptyMessage()), ...ngDevMode ? [{ debugName: "panelVisible" }] : /* istanbul ignore next */ []);
|
|
38
|
+
liveText = computed(() => {
|
|
39
|
+
if (!this.panelVisible()) return "";
|
|
40
|
+
if (this.loading()) return this.text.searching;
|
|
41
|
+
const count = this.visibleOptions().length;
|
|
42
|
+
return count ? this.text.resultsAvailable(count) : this.emptyText();
|
|
43
|
+
}, ...ngDevMode ? [{ debugName: "liveText" }] : /* istanbul ignore next */ []);
|
|
44
|
+
constructor() {
|
|
45
|
+
super();
|
|
46
|
+
inject(DestroyRef).onDestroy(() => clearTimeout(this.searchTimer));
|
|
47
|
+
effect(() => {
|
|
48
|
+
this.visibleOptions();
|
|
49
|
+
untracked(() => this.activeIndex.set(this.autoHighlight() ? this.firstEnabledFrom(0, 1) : -1));
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
initialActiveIndex() {
|
|
53
|
+
return this.autoHighlight() ? this.firstEnabledFrom(0, 1) : -1;
|
|
54
|
+
}
|
|
55
|
+
optionForValue(value) {
|
|
56
|
+
const pools = [
|
|
57
|
+
this.known(),
|
|
58
|
+
this.suggestions() ?? [],
|
|
59
|
+
this.options()
|
|
60
|
+
];
|
|
61
|
+
for (const pool of pools) {
|
|
62
|
+
const match = pool.find((option) => this.equals(this.valueOf(option), value));
|
|
63
|
+
if (match !== void 0) return match;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
labelForValue(value) {
|
|
67
|
+
const option = this.optionForValue(value);
|
|
68
|
+
if (option !== void 0) return this.labelOf(option);
|
|
69
|
+
return this.optionValue() === null ? this.labelOf(value) : String(value);
|
|
70
|
+
}
|
|
71
|
+
remember(option) {
|
|
72
|
+
this.known.update((known) => known.includes(option) ? known : [...known, option]);
|
|
73
|
+
}
|
|
74
|
+
onQuery(text) {
|
|
75
|
+
this.query.set(text);
|
|
76
|
+
this.showAll.set(false);
|
|
77
|
+
clearTimeout(this.searchTimer);
|
|
78
|
+
if (text.length < this.minQueryLength()) {
|
|
79
|
+
this.closePanel(false);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
this.openPanel();
|
|
83
|
+
this.searchTimer = setTimeout(() => this.completeMethod.emit({ query: text }), this.delay());
|
|
84
|
+
}
|
|
85
|
+
showAllOptions() {
|
|
86
|
+
if (!this.interactive()) return;
|
|
87
|
+
if (this.panelVisible()) {
|
|
88
|
+
this.closePanel();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
this.showAll.set(true);
|
|
92
|
+
this.completeMethod.emit({ query: "" });
|
|
93
|
+
this.openPanel();
|
|
94
|
+
this.focus();
|
|
95
|
+
}
|
|
96
|
+
onOutsideClick(event) {
|
|
97
|
+
if (this.control().nativeElement.contains(event.target)) return;
|
|
98
|
+
this.closePanel(false);
|
|
99
|
+
this.onBlurCommit();
|
|
100
|
+
this.touch.emit();
|
|
101
|
+
}
|
|
102
|
+
onInputBlur() {
|
|
103
|
+
if (this.panelVisible()) return;
|
|
104
|
+
this.onBlurCommit();
|
|
105
|
+
this.touch.emit();
|
|
106
|
+
}
|
|
107
|
+
onKeydown(event) {
|
|
108
|
+
if (event.key === "Home" || event.key === "End") return;
|
|
109
|
+
if (event.key === "Enter" && !this.panelVisible()) return;
|
|
110
|
+
if (event.key === "ArrowDown" && !this.open() && !this.queryLongEnough()) return;
|
|
111
|
+
super.onKeydown(event);
|
|
112
|
+
}
|
|
113
|
+
setText(text) {
|
|
114
|
+
this.query.set(text);
|
|
115
|
+
this.trigger().nativeElement.value = text;
|
|
116
|
+
}
|
|
117
|
+
highlight(label) {
|
|
118
|
+
const query = this.query().trim();
|
|
119
|
+
const index = query ? label.toLocaleLowerCase().indexOf(query.toLocaleLowerCase()) : -1;
|
|
120
|
+
if (index < 0) return [
|
|
121
|
+
label,
|
|
122
|
+
"",
|
|
123
|
+
""
|
|
124
|
+
];
|
|
125
|
+
return [
|
|
126
|
+
label.slice(0, index),
|
|
127
|
+
label.slice(index, index + query.length),
|
|
128
|
+
label.slice(index + query.length)
|
|
129
|
+
];
|
|
130
|
+
}
|
|
131
|
+
chips() {
|
|
132
|
+
return [];
|
|
133
|
+
}
|
|
134
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
135
|
+
minVersion: "12.0.0",
|
|
136
|
+
version: "22.2.6",
|
|
137
|
+
ngImport: i0,
|
|
138
|
+
type: StarAutoCompleteBase,
|
|
139
|
+
deps: [],
|
|
140
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
141
|
+
});
|
|
142
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
143
|
+
minVersion: "17.2.0",
|
|
144
|
+
version: "22.2.6",
|
|
145
|
+
type: StarAutoCompleteBase,
|
|
146
|
+
isStandalone: true,
|
|
147
|
+
inputs: {
|
|
148
|
+
suggestions: {
|
|
149
|
+
classPropertyName: "suggestions",
|
|
150
|
+
publicName: "suggestions",
|
|
151
|
+
isSignal: true,
|
|
152
|
+
isRequired: false,
|
|
153
|
+
transformFunction: null
|
|
154
|
+
},
|
|
155
|
+
minQueryLength: {
|
|
156
|
+
classPropertyName: "minQueryLength",
|
|
157
|
+
publicName: "minQueryLength",
|
|
158
|
+
isSignal: true,
|
|
159
|
+
isRequired: false,
|
|
160
|
+
transformFunction: null
|
|
161
|
+
},
|
|
162
|
+
delay: {
|
|
163
|
+
classPropertyName: "delay",
|
|
164
|
+
publicName: "delay",
|
|
165
|
+
isSignal: true,
|
|
166
|
+
isRequired: false,
|
|
167
|
+
transformFunction: null
|
|
168
|
+
},
|
|
169
|
+
dropdown: {
|
|
170
|
+
classPropertyName: "dropdown",
|
|
171
|
+
publicName: "dropdown",
|
|
172
|
+
isSignal: true,
|
|
173
|
+
isRequired: false,
|
|
174
|
+
transformFunction: null
|
|
175
|
+
},
|
|
176
|
+
autoHighlight: {
|
|
177
|
+
classPropertyName: "autoHighlight",
|
|
178
|
+
publicName: "autoHighlight",
|
|
179
|
+
isSignal: true,
|
|
180
|
+
isRequired: false,
|
|
181
|
+
transformFunction: null
|
|
182
|
+
},
|
|
183
|
+
showEmptyMessage: {
|
|
184
|
+
classPropertyName: "showEmptyMessage",
|
|
185
|
+
publicName: "showEmptyMessage",
|
|
186
|
+
isSignal: true,
|
|
187
|
+
isRequired: false,
|
|
188
|
+
transformFunction: null
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
outputs: { completeMethod: "completeMethod" },
|
|
192
|
+
viewQueries: [{
|
|
193
|
+
propertyName: "control",
|
|
194
|
+
first: true,
|
|
195
|
+
predicate: ["control"],
|
|
196
|
+
descendants: true,
|
|
197
|
+
isSignal: true
|
|
198
|
+
}],
|
|
199
|
+
usesInheritance: true,
|
|
200
|
+
ngImport: i0
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
204
|
+
minVersion: "12.0.0",
|
|
205
|
+
version: "22.2.6",
|
|
206
|
+
ngImport: i0,
|
|
207
|
+
type: StarAutoCompleteBase,
|
|
208
|
+
decorators: [{ type: Directive }],
|
|
209
|
+
ctorParameters: () => [],
|
|
210
|
+
propDecorators: {
|
|
211
|
+
suggestions: [{
|
|
212
|
+
type: i0.Input,
|
|
213
|
+
args: [{
|
|
214
|
+
isSignal: true,
|
|
215
|
+
alias: "suggestions",
|
|
216
|
+
required: false
|
|
217
|
+
}]
|
|
218
|
+
}],
|
|
219
|
+
minQueryLength: [{
|
|
220
|
+
type: i0.Input,
|
|
221
|
+
args: [{
|
|
222
|
+
isSignal: true,
|
|
223
|
+
alias: "minQueryLength",
|
|
224
|
+
required: false
|
|
225
|
+
}]
|
|
226
|
+
}],
|
|
227
|
+
delay: [{
|
|
228
|
+
type: i0.Input,
|
|
229
|
+
args: [{
|
|
230
|
+
isSignal: true,
|
|
231
|
+
alias: "delay",
|
|
232
|
+
required: false
|
|
233
|
+
}]
|
|
234
|
+
}],
|
|
235
|
+
dropdown: [{
|
|
236
|
+
type: i0.Input,
|
|
237
|
+
args: [{
|
|
238
|
+
isSignal: true,
|
|
239
|
+
alias: "dropdown",
|
|
240
|
+
required: false
|
|
241
|
+
}]
|
|
242
|
+
}],
|
|
243
|
+
autoHighlight: [{
|
|
244
|
+
type: i0.Input,
|
|
245
|
+
args: [{
|
|
246
|
+
isSignal: true,
|
|
247
|
+
alias: "autoHighlight",
|
|
248
|
+
required: false
|
|
249
|
+
}]
|
|
250
|
+
}],
|
|
251
|
+
showEmptyMessage: [{
|
|
252
|
+
type: i0.Input,
|
|
253
|
+
args: [{
|
|
254
|
+
isSignal: true,
|
|
255
|
+
alias: "showEmptyMessage",
|
|
256
|
+
required: false
|
|
257
|
+
}]
|
|
258
|
+
}],
|
|
259
|
+
completeMethod: [{
|
|
260
|
+
type: i0.Output,
|
|
261
|
+
args: ["completeMethod"]
|
|
262
|
+
}],
|
|
263
|
+
control: [{
|
|
264
|
+
type: i0.ViewChild,
|
|
265
|
+
args: ["control", { isSignal: true }]
|
|
266
|
+
}]
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
const TEMPLATE = `
|
|
270
|
+
<div #control class="star-select__control star-ac__control" cdkOverlayOrigin #origin="cdkOverlayOrigin">
|
|
271
|
+
@if (isMultiple) {
|
|
272
|
+
@for (chip of chips(); track $index) {
|
|
273
|
+
<span class="star-chip star-chip--sm">
|
|
274
|
+
{{ chip.label }}
|
|
275
|
+
@if (interactive()) {
|
|
276
|
+
<button
|
|
277
|
+
type="button"
|
|
278
|
+
class="star-chip__remove"
|
|
279
|
+
tabindex="-1"
|
|
280
|
+
[attr.aria-label]="text.removeItem(chip.label)"
|
|
281
|
+
(click)="removeValue(chip.value)"
|
|
282
|
+
>
|
|
283
|
+
<i class="ph-bold ph-x" aria-hidden="true"></i>
|
|
284
|
+
</button>
|
|
285
|
+
}
|
|
286
|
+
</span>
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
<input
|
|
290
|
+
#trigger
|
|
291
|
+
type="text"
|
|
292
|
+
class="star-ac__input"
|
|
293
|
+
role="combobox"
|
|
294
|
+
aria-autocomplete="list"
|
|
295
|
+
autocomplete="off"
|
|
296
|
+
[id]="inputId()"
|
|
297
|
+
[attr.name]="name() || null"
|
|
298
|
+
[value]="query()"
|
|
299
|
+
[attr.placeholder]="placeholder()"
|
|
300
|
+
[disabled]="disabled()"
|
|
301
|
+
[readOnly]="readonly()"
|
|
302
|
+
[attr.aria-label]="ariaLabel()"
|
|
303
|
+
[attr.aria-labelledby]="ariaLabelledBy()"
|
|
304
|
+
[attr.aria-required]="required() || null"
|
|
305
|
+
[attr.aria-invalid]="showInvalid() || null"
|
|
306
|
+
[attr.aria-expanded]="panelVisible()"
|
|
307
|
+
[attr.aria-controls]="panelVisible() ? listId : null"
|
|
308
|
+
[attr.aria-activedescendant]="panelVisible() ? activeId() : null"
|
|
309
|
+
(input)="onQuery(trigger.value)"
|
|
310
|
+
(keydown)="onKeydown($event)"
|
|
311
|
+
(blur)="onInputBlur()"
|
|
312
|
+
/>
|
|
313
|
+
@if (loading()) {
|
|
314
|
+
<i class="ph-bold ph-spinner-gap star-spin star-select__caret" aria-hidden="true"></i>
|
|
315
|
+
}
|
|
316
|
+
@if (showClear() && hasValue() && interactive()) {
|
|
317
|
+
<button type="button" class="star-select__icon-btn" [attr.aria-label]="text.clear" (click)="clear()">
|
|
318
|
+
<i class="ph-bold ph-x" aria-hidden="true"></i>
|
|
319
|
+
</button>
|
|
320
|
+
}
|
|
321
|
+
@if (dropdown()) {
|
|
322
|
+
<button
|
|
323
|
+
type="button"
|
|
324
|
+
class="star-select__icon-btn"
|
|
325
|
+
tabindex="-1"
|
|
326
|
+
[attr.aria-label]="text.showOptions"
|
|
327
|
+
[disabled]="!interactive()"
|
|
328
|
+
(click)="showAllOptions()"
|
|
329
|
+
>
|
|
330
|
+
<i class="ph-bold ph-caret-down" aria-hidden="true"></i>
|
|
331
|
+
</button>
|
|
332
|
+
}
|
|
333
|
+
</div>
|
|
334
|
+
<span class="star-sr-only" aria-live="polite">{{ liveText() }}</span>
|
|
335
|
+
|
|
336
|
+
<ng-template
|
|
337
|
+
cdkConnectedOverlay
|
|
338
|
+
cdkConnectedOverlayUsePopover="inline"
|
|
339
|
+
cdkConnectedOverlayMatchWidth
|
|
340
|
+
[cdkConnectedOverlayOrigin]="origin"
|
|
341
|
+
[cdkConnectedOverlayOpen]="panelVisible()"
|
|
342
|
+
[cdkConnectedOverlayPositions]="positions"
|
|
343
|
+
(detach)="closePanel(false)"
|
|
344
|
+
(overlayOutsideClick)="onOutsideClick($event)"
|
|
345
|
+
>
|
|
346
|
+
<div class="star-panel" (mousedown)="onPanelMousedown($event)">
|
|
347
|
+
<ul
|
|
348
|
+
class="star-listbox"
|
|
349
|
+
role="listbox"
|
|
350
|
+
[id]="listId"
|
|
351
|
+
[class.star-listbox--virtual]="virtualScroll()"
|
|
352
|
+
[style.--star-item-size.px]="virtualScroll() ? virtualItemSize() : null"
|
|
353
|
+
[style.max-height]="scrollHeight()"
|
|
354
|
+
[attr.aria-label]="ariaLabel()"
|
|
355
|
+
[attr.aria-labelledby]="ariaLabelledBy()"
|
|
356
|
+
(scroll)="onListScroll($event)"
|
|
357
|
+
>
|
|
358
|
+
@if (virtualWindow().before) {
|
|
359
|
+
<li class="star-listbox__spacer" role="presentation" [style.height.px]="virtualWindow().before"></li>
|
|
360
|
+
}
|
|
361
|
+
@for (row of renderedRows(); track row.key) {
|
|
362
|
+
@if (row.kind === 'group') {
|
|
363
|
+
<li class="star-listbox__group" role="presentation" [id]="row.id">{{ row.label }}</li>
|
|
364
|
+
} @else {
|
|
365
|
+
@let option = row.option;
|
|
366
|
+
@let i = row.index;
|
|
367
|
+
<!-- Keyboard is handled on the combobox via aria-activedescendant (WAI-ARIA combobox pattern). -->
|
|
368
|
+
<!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->
|
|
369
|
+
<li
|
|
370
|
+
class="star-listbox__option"
|
|
371
|
+
role="option"
|
|
372
|
+
[id]="optionId(i)"
|
|
373
|
+
[class.star-listbox__option--active]="activeIndex() === i"
|
|
374
|
+
[attr.aria-selected]="activeIndex() === i"
|
|
375
|
+
[attr.aria-disabled]="isDisabled(option) || null"
|
|
376
|
+
[attr.aria-describedby]="row.groupId"
|
|
377
|
+
[attr.aria-setsize]="virtualScroll() ? visibleOptions().length : null"
|
|
378
|
+
[attr.aria-posinset]="virtualScroll() ? i + 1 : null"
|
|
379
|
+
(click)="onOptionClick(option, i)"
|
|
380
|
+
(mousemove)="isDisabled(option) || activeIndex.set(i)"
|
|
381
|
+
>
|
|
382
|
+
<span class="star-listbox__label">
|
|
383
|
+
@if (optionTemplate(); as custom) {
|
|
384
|
+
<ng-container *ngTemplateOutlet="custom.template; context: optionContext(option, i)" />
|
|
385
|
+
} @else {
|
|
386
|
+
@let parts = highlight(labelOf(option));
|
|
387
|
+
{{ parts[0] }}<mark class="star-ac__match">{{ parts[1] }}</mark>{{ parts[2] }}
|
|
388
|
+
}
|
|
389
|
+
</span>
|
|
390
|
+
</li>
|
|
391
|
+
}
|
|
392
|
+
} @empty {
|
|
393
|
+
<li class="star-listbox__empty" role="presentation">
|
|
394
|
+
{{ loading() ? text.searching : emptyText() }}
|
|
395
|
+
</li>
|
|
396
|
+
}
|
|
397
|
+
@if (virtualWindow().after) {
|
|
398
|
+
<li class="star-listbox__spacer" role="presentation" [style.height.px]="virtualWindow().after"></li>
|
|
399
|
+
}
|
|
400
|
+
</ul>
|
|
401
|
+
</div>
|
|
402
|
+
</ng-template>
|
|
403
|
+
`;
|
|
404
|
+
const HOST = {
|
|
405
|
+
class: "star-select star-ac",
|
|
406
|
+
"[class.star-select--open]": "panelVisible()",
|
|
407
|
+
"[class.star-select--disabled]": "disabled()",
|
|
408
|
+
"[class.star-select--invalid]": "showInvalid()",
|
|
409
|
+
"[class.star-select--sm]": "size() === 'sm'"
|
|
410
|
+
};
|
|
411
|
+
var StarAutoComplete = class StarAutoComplete extends StarAutoCompleteBase {
|
|
412
|
+
value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
413
|
+
selected = output();
|
|
414
|
+
isMultiple = false;
|
|
415
|
+
hasValue = computed(() => this.value() !== null || !!this.query(), ...ngDevMode ? [{ debugName: "hasValue" }] : /* istanbul ignore next */ []);
|
|
416
|
+
queryFromValue() {
|
|
417
|
+
const value = this.value();
|
|
418
|
+
return value === null ? "" : this.labelForValue(value);
|
|
419
|
+
}
|
|
420
|
+
isSelected(option) {
|
|
421
|
+
const value = this.value();
|
|
422
|
+
return value !== null && this.equals(this.valueOf(option), value);
|
|
423
|
+
}
|
|
424
|
+
choose(option) {
|
|
425
|
+
this.remember(option);
|
|
426
|
+
this.value.set(this.valueOf(option));
|
|
427
|
+
this.setText(this.labelOf(option));
|
|
428
|
+
this.selected.emit(option);
|
|
429
|
+
}
|
|
430
|
+
onBlurCommit() {
|
|
431
|
+
const text = this.query().trim();
|
|
432
|
+
if (!text) {
|
|
433
|
+
if (this.value() !== null) this.value.set(null);
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
if (text === this.queryFromValue()) return;
|
|
437
|
+
const exact = this.visibleOptions().find((option) => !this.isDisabled(option) && this.labelOf(option).toLocaleLowerCase() === text.toLocaleLowerCase());
|
|
438
|
+
if (exact !== void 0) this.choose(exact);
|
|
439
|
+
else this.setText(this.queryFromValue());
|
|
440
|
+
}
|
|
441
|
+
removeValue(_value) {
|
|
442
|
+
this.clear();
|
|
443
|
+
}
|
|
444
|
+
clear() {
|
|
445
|
+
this.value.set(null);
|
|
446
|
+
this.setText("");
|
|
447
|
+
this.focus();
|
|
448
|
+
}
|
|
449
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
450
|
+
minVersion: "12.0.0",
|
|
451
|
+
version: "22.2.6",
|
|
452
|
+
ngImport: i0,
|
|
453
|
+
type: StarAutoComplete,
|
|
454
|
+
deps: null,
|
|
455
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
456
|
+
});
|
|
457
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
458
|
+
minVersion: "17.0.0",
|
|
459
|
+
version: "22.2.6",
|
|
460
|
+
type: StarAutoComplete,
|
|
461
|
+
isStandalone: true,
|
|
462
|
+
selector: "star-autocomplete",
|
|
463
|
+
inputs: { value: {
|
|
464
|
+
classPropertyName: "value",
|
|
465
|
+
publicName: "value",
|
|
466
|
+
isSignal: true,
|
|
467
|
+
isRequired: false,
|
|
468
|
+
transformFunction: null
|
|
469
|
+
} },
|
|
470
|
+
outputs: {
|
|
471
|
+
value: "valueChange",
|
|
472
|
+
selected: "selected"
|
|
473
|
+
},
|
|
474
|
+
host: {
|
|
475
|
+
properties: {
|
|
476
|
+
"class.star-select--open": "panelVisible()",
|
|
477
|
+
"class.star-select--disabled": "disabled()",
|
|
478
|
+
"class.star-select--invalid": "showInvalid()",
|
|
479
|
+
"class.star-select--sm": "size() === 'sm'"
|
|
480
|
+
},
|
|
481
|
+
classAttribute: "star-select star-ac"
|
|
482
|
+
},
|
|
483
|
+
usesInheritance: true,
|
|
484
|
+
ngImport: i0,
|
|
485
|
+
template: "\n <div #control class=\"star-select__control star-ac__control\" cdkOverlayOrigin #origin=\"cdkOverlayOrigin\">\n @if (isMultiple) {\n @for (chip of chips(); track $index) {\n <span class=\"star-chip star-chip--sm\">\n {{ chip.label }}\n @if (interactive()) {\n <button\n type=\"button\"\n class=\"star-chip__remove\"\n tabindex=\"-1\"\n [attr.aria-label]=\"text.removeItem(chip.label)\"\n (click)=\"removeValue(chip.value)\"\n >\n <i class=\"ph-bold ph-x\" aria-hidden=\"true\"></i>\n </button>\n }\n </span>\n }\n }\n <input\n #trigger\n type=\"text\"\n class=\"star-ac__input\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n autocomplete=\"off\"\n [id]=\"inputId()\"\n [attr.name]=\"name() || null\"\n [value]=\"query()\"\n [attr.placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readOnly]=\"readonly()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledBy()\"\n [attr.aria-required]=\"required() || null\"\n [attr.aria-invalid]=\"showInvalid() || null\"\n [attr.aria-expanded]=\"panelVisible()\"\n [attr.aria-controls]=\"panelVisible() ? listId : null\"\n [attr.aria-activedescendant]=\"panelVisible() ? activeId() : null\"\n (input)=\"onQuery(trigger.value)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onInputBlur()\"\n />\n @if (loading()) {\n <i class=\"ph-bold ph-spinner-gap star-spin star-select__caret\" aria-hidden=\"true\"></i>\n }\n @if (showClear() && hasValue() && interactive()) {\n <button type=\"button\" class=\"star-select__icon-btn\" [attr.aria-label]=\"text.clear\" (click)=\"clear()\">\n <i class=\"ph-bold ph-x\" aria-hidden=\"true\"></i>\n </button>\n }\n @if (dropdown()) {\n <button\n type=\"button\"\n class=\"star-select__icon-btn\"\n tabindex=\"-1\"\n [attr.aria-label]=\"text.showOptions\"\n [disabled]=\"!interactive()\"\n (click)=\"showAllOptions()\"\n >\n <i class=\"ph-bold ph-caret-down\" aria-hidden=\"true\"></i>\n </button>\n }\n </div>\n <span class=\"star-sr-only\" aria-live=\"polite\">{{ liveText() }}</span>\n\n <ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayUsePopover=\"inline\"\n cdkConnectedOverlayMatchWidth\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayOpen]=\"panelVisible()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n (detach)=\"closePanel(false)\"\n (overlayOutsideClick)=\"onOutsideClick($event)\"\n >\n <div class=\"star-panel\" (mousedown)=\"onPanelMousedown($event)\">\n <ul\n class=\"star-listbox\"\n role=\"listbox\"\n [id]=\"listId\"\n [class.star-listbox--virtual]=\"virtualScroll()\"\n [style.--star-item-size.px]=\"virtualScroll() ? virtualItemSize() : null\"\n [style.max-height]=\"scrollHeight()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledBy()\"\n (scroll)=\"onListScroll($event)\"\n >\n @if (virtualWindow().before) {\n <li class=\"star-listbox__spacer\" role=\"presentation\" [style.height.px]=\"virtualWindow().before\"></li>\n }\n @for (row of renderedRows(); track row.key) {\n @if (row.kind === 'group') {\n <li class=\"star-listbox__group\" role=\"presentation\" [id]=\"row.id\">{{ row.label }}</li>\n } @else {\n @let option = row.option;\n @let i = row.index;\n <!-- Keyboard is handled on the combobox via aria-activedescendant (WAI-ARIA combobox pattern). -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <li\n class=\"star-listbox__option\"\n role=\"option\"\n [id]=\"optionId(i)\"\n [class.star-listbox__option--active]=\"activeIndex() === i\"\n [attr.aria-selected]=\"activeIndex() === i\"\n [attr.aria-disabled]=\"isDisabled(option) || null\"\n [attr.aria-describedby]=\"row.groupId\"\n [attr.aria-setsize]=\"virtualScroll() ? visibleOptions().length : null\"\n [attr.aria-posinset]=\"virtualScroll() ? i + 1 : null\"\n (click)=\"onOptionClick(option, i)\"\n (mousemove)=\"isDisabled(option) || activeIndex.set(i)\"\n >\n <span class=\"star-listbox__label\">\n @if (optionTemplate(); as custom) {\n <ng-container *ngTemplateOutlet=\"custom.template; context: optionContext(option, i)\" />\n } @else {\n @let parts = highlight(labelOf(option));\n {{ parts[0] }}<mark class=\"star-ac__match\">{{ parts[1] }}</mark>{{ parts[2] }}\n }\n </span>\n </li>\n }\n } @empty {\n <li class=\"star-listbox__empty\" role=\"presentation\">\n {{ loading() ? text.searching : emptyText() }}\n </li>\n }\n @if (virtualWindow().after) {\n <li class=\"star-listbox__spacer\" role=\"presentation\" [style.height.px]=\"virtualWindow().after\"></li>\n }\n </ul>\n </div>\n </ng-template>\n",
|
|
486
|
+
isInline: true,
|
|
487
|
+
dependencies: [
|
|
488
|
+
{
|
|
489
|
+
kind: "directive",
|
|
490
|
+
type: CdkConnectedOverlay,
|
|
491
|
+
selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]",
|
|
492
|
+
inputs: [
|
|
493
|
+
"cdkConnectedOverlayOrigin",
|
|
494
|
+
"cdkConnectedOverlayPositions",
|
|
495
|
+
"cdkConnectedOverlayPositionStrategy",
|
|
496
|
+
"cdkConnectedOverlayOffsetX",
|
|
497
|
+
"cdkConnectedOverlayOffsetY",
|
|
498
|
+
"cdkConnectedOverlayWidth",
|
|
499
|
+
"cdkConnectedOverlayHeight",
|
|
500
|
+
"cdkConnectedOverlayMinWidth",
|
|
501
|
+
"cdkConnectedOverlayMinHeight",
|
|
502
|
+
"cdkConnectedOverlayBackdropClass",
|
|
503
|
+
"cdkConnectedOverlayPanelClass",
|
|
504
|
+
"cdkConnectedOverlayViewportMargin",
|
|
505
|
+
"cdkConnectedOverlayScrollStrategy",
|
|
506
|
+
"cdkConnectedOverlayOpen",
|
|
507
|
+
"cdkConnectedOverlayDisableClose",
|
|
508
|
+
"cdkConnectedOverlayTransformOriginOn",
|
|
509
|
+
"cdkConnectedOverlayHasBackdrop",
|
|
510
|
+
"cdkConnectedOverlayLockPosition",
|
|
511
|
+
"cdkConnectedOverlayFlexibleDimensions",
|
|
512
|
+
"cdkConnectedOverlayGrowAfterOpen",
|
|
513
|
+
"cdkConnectedOverlayPush",
|
|
514
|
+
"cdkConnectedOverlayDisposeOnNavigation",
|
|
515
|
+
"cdkConnectedOverlayUsePopover",
|
|
516
|
+
"cdkConnectedOverlayMatchWidth",
|
|
517
|
+
"cdkConnectedOverlay"
|
|
518
|
+
],
|
|
519
|
+
outputs: [
|
|
520
|
+
"backdropClick",
|
|
521
|
+
"positionChange",
|
|
522
|
+
"attach",
|
|
523
|
+
"detach",
|
|
524
|
+
"overlayKeydown",
|
|
525
|
+
"overlayOutsideClick"
|
|
526
|
+
],
|
|
527
|
+
exportAs: ["cdkConnectedOverlay"]
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
kind: "directive",
|
|
531
|
+
type: CdkOverlayOrigin,
|
|
532
|
+
selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]",
|
|
533
|
+
exportAs: ["cdkOverlayOrigin"]
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
kind: "directive",
|
|
537
|
+
type: NgTemplateOutlet,
|
|
538
|
+
selector: "[ngTemplateOutlet]",
|
|
539
|
+
inputs: [
|
|
540
|
+
"ngTemplateOutletContext",
|
|
541
|
+
"ngTemplateOutlet",
|
|
542
|
+
"ngTemplateOutletInjector"
|
|
543
|
+
]
|
|
544
|
+
}
|
|
545
|
+
],
|
|
546
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
547
|
+
});
|
|
548
|
+
};
|
|
549
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
550
|
+
minVersion: "12.0.0",
|
|
551
|
+
version: "22.2.6",
|
|
552
|
+
ngImport: i0,
|
|
553
|
+
type: StarAutoComplete,
|
|
554
|
+
decorators: [{
|
|
555
|
+
type: Component,
|
|
556
|
+
args: [{
|
|
557
|
+
selector: "star-autocomplete",
|
|
558
|
+
imports: [
|
|
559
|
+
CdkConnectedOverlay,
|
|
560
|
+
CdkOverlayOrigin,
|
|
561
|
+
NgTemplateOutlet
|
|
562
|
+
],
|
|
563
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
564
|
+
host: HOST,
|
|
565
|
+
template: TEMPLATE
|
|
566
|
+
}]
|
|
567
|
+
}],
|
|
568
|
+
propDecorators: {
|
|
569
|
+
value: [{
|
|
570
|
+
type: i0.Input,
|
|
571
|
+
args: [{
|
|
572
|
+
isSignal: true,
|
|
573
|
+
alias: "value",
|
|
574
|
+
required: false
|
|
575
|
+
}]
|
|
576
|
+
}, {
|
|
577
|
+
type: i0.Output,
|
|
578
|
+
args: ["valueChange"]
|
|
579
|
+
}],
|
|
580
|
+
selected: [{
|
|
581
|
+
type: i0.Output,
|
|
582
|
+
args: ["selected"]
|
|
583
|
+
}]
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
var StarMultiAutoComplete = class StarMultiAutoComplete extends StarAutoCompleteBase {
|
|
587
|
+
value = model([], ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
588
|
+
selectionLimit = input(0, ...ngDevMode ? [{ debugName: "selectionLimit" }] : /* istanbul ignore next */ []);
|
|
589
|
+
isMultiple = true;
|
|
590
|
+
hasValue = computed(() => this.value().length > 0, ...ngDevMode ? [{ debugName: "hasValue" }] : /* istanbul ignore next */ []);
|
|
591
|
+
queryFromValue() {
|
|
592
|
+
return "";
|
|
593
|
+
}
|
|
594
|
+
chips() {
|
|
595
|
+
return this.value().map((value) => ({
|
|
596
|
+
value,
|
|
597
|
+
label: this.labelForValue(value)
|
|
598
|
+
}));
|
|
599
|
+
}
|
|
600
|
+
isSelected(option) {
|
|
601
|
+
const optionValue = this.valueOf(option);
|
|
602
|
+
return this.value().some((value) => this.equals(value, optionValue));
|
|
603
|
+
}
|
|
604
|
+
choose(option) {
|
|
605
|
+
const limit = this.selectionLimit();
|
|
606
|
+
if (this.isSelected(option) || limit > 0 && this.value().length >= limit) return;
|
|
607
|
+
this.remember(option);
|
|
608
|
+
this.value.update((values) => [...values, this.valueOf(option)]);
|
|
609
|
+
this.setText("");
|
|
610
|
+
}
|
|
611
|
+
onBlurCommit() {
|
|
612
|
+
this.setText("");
|
|
613
|
+
}
|
|
614
|
+
onKeydown(event) {
|
|
615
|
+
if (event.key === "Backspace" && !this.query() && this.value().length && this.interactive()) {
|
|
616
|
+
this.value.update((values) => values.slice(0, -1));
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
super.onKeydown(event);
|
|
620
|
+
}
|
|
621
|
+
removeValue(value) {
|
|
622
|
+
this.value.update((values) => values.filter((v) => !this.equals(v, value)));
|
|
623
|
+
this.focus();
|
|
624
|
+
}
|
|
625
|
+
clear() {
|
|
626
|
+
this.value.set([]);
|
|
627
|
+
this.setText("");
|
|
628
|
+
this.focus();
|
|
629
|
+
}
|
|
630
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
631
|
+
minVersion: "12.0.0",
|
|
632
|
+
version: "22.2.6",
|
|
633
|
+
ngImport: i0,
|
|
634
|
+
type: StarMultiAutoComplete,
|
|
635
|
+
deps: null,
|
|
636
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
637
|
+
});
|
|
638
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
639
|
+
minVersion: "17.0.0",
|
|
640
|
+
version: "22.2.6",
|
|
641
|
+
type: StarMultiAutoComplete,
|
|
642
|
+
isStandalone: true,
|
|
643
|
+
selector: "star-multi-autocomplete",
|
|
644
|
+
inputs: {
|
|
645
|
+
value: {
|
|
646
|
+
classPropertyName: "value",
|
|
647
|
+
publicName: "value",
|
|
648
|
+
isSignal: true,
|
|
649
|
+
isRequired: false,
|
|
650
|
+
transformFunction: null
|
|
651
|
+
},
|
|
652
|
+
selectionLimit: {
|
|
653
|
+
classPropertyName: "selectionLimit",
|
|
654
|
+
publicName: "selectionLimit",
|
|
655
|
+
isSignal: true,
|
|
656
|
+
isRequired: false,
|
|
657
|
+
transformFunction: null
|
|
658
|
+
}
|
|
659
|
+
},
|
|
660
|
+
outputs: { value: "valueChange" },
|
|
661
|
+
host: {
|
|
662
|
+
properties: {
|
|
663
|
+
"class.star-select--open": "panelVisible()",
|
|
664
|
+
"class.star-select--disabled": "disabled()",
|
|
665
|
+
"class.star-select--invalid": "showInvalid()",
|
|
666
|
+
"class.star-select--sm": "size() === 'sm'"
|
|
667
|
+
},
|
|
668
|
+
classAttribute: "star-select star-ac star-ac--multi"
|
|
669
|
+
},
|
|
670
|
+
usesInheritance: true,
|
|
671
|
+
ngImport: i0,
|
|
672
|
+
template: "\n <div #control class=\"star-select__control star-ac__control\" cdkOverlayOrigin #origin=\"cdkOverlayOrigin\">\n @if (isMultiple) {\n @for (chip of chips(); track $index) {\n <span class=\"star-chip star-chip--sm\">\n {{ chip.label }}\n @if (interactive()) {\n <button\n type=\"button\"\n class=\"star-chip__remove\"\n tabindex=\"-1\"\n [attr.aria-label]=\"text.removeItem(chip.label)\"\n (click)=\"removeValue(chip.value)\"\n >\n <i class=\"ph-bold ph-x\" aria-hidden=\"true\"></i>\n </button>\n }\n </span>\n }\n }\n <input\n #trigger\n type=\"text\"\n class=\"star-ac__input\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n autocomplete=\"off\"\n [id]=\"inputId()\"\n [attr.name]=\"name() || null\"\n [value]=\"query()\"\n [attr.placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readOnly]=\"readonly()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledBy()\"\n [attr.aria-required]=\"required() || null\"\n [attr.aria-invalid]=\"showInvalid() || null\"\n [attr.aria-expanded]=\"panelVisible()\"\n [attr.aria-controls]=\"panelVisible() ? listId : null\"\n [attr.aria-activedescendant]=\"panelVisible() ? activeId() : null\"\n (input)=\"onQuery(trigger.value)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onInputBlur()\"\n />\n @if (loading()) {\n <i class=\"ph-bold ph-spinner-gap star-spin star-select__caret\" aria-hidden=\"true\"></i>\n }\n @if (showClear() && hasValue() && interactive()) {\n <button type=\"button\" class=\"star-select__icon-btn\" [attr.aria-label]=\"text.clear\" (click)=\"clear()\">\n <i class=\"ph-bold ph-x\" aria-hidden=\"true\"></i>\n </button>\n }\n @if (dropdown()) {\n <button\n type=\"button\"\n class=\"star-select__icon-btn\"\n tabindex=\"-1\"\n [attr.aria-label]=\"text.showOptions\"\n [disabled]=\"!interactive()\"\n (click)=\"showAllOptions()\"\n >\n <i class=\"ph-bold ph-caret-down\" aria-hidden=\"true\"></i>\n </button>\n }\n </div>\n <span class=\"star-sr-only\" aria-live=\"polite\">{{ liveText() }}</span>\n\n <ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayUsePopover=\"inline\"\n cdkConnectedOverlayMatchWidth\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayOpen]=\"panelVisible()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n (detach)=\"closePanel(false)\"\n (overlayOutsideClick)=\"onOutsideClick($event)\"\n >\n <div class=\"star-panel\" (mousedown)=\"onPanelMousedown($event)\">\n <ul\n class=\"star-listbox\"\n role=\"listbox\"\n [id]=\"listId\"\n [class.star-listbox--virtual]=\"virtualScroll()\"\n [style.--star-item-size.px]=\"virtualScroll() ? virtualItemSize() : null\"\n [style.max-height]=\"scrollHeight()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledBy()\"\n (scroll)=\"onListScroll($event)\"\n >\n @if (virtualWindow().before) {\n <li class=\"star-listbox__spacer\" role=\"presentation\" [style.height.px]=\"virtualWindow().before\"></li>\n }\n @for (row of renderedRows(); track row.key) {\n @if (row.kind === 'group') {\n <li class=\"star-listbox__group\" role=\"presentation\" [id]=\"row.id\">{{ row.label }}</li>\n } @else {\n @let option = row.option;\n @let i = row.index;\n <!-- Keyboard is handled on the combobox via aria-activedescendant (WAI-ARIA combobox pattern). -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <li\n class=\"star-listbox__option\"\n role=\"option\"\n [id]=\"optionId(i)\"\n [class.star-listbox__option--active]=\"activeIndex() === i\"\n [attr.aria-selected]=\"activeIndex() === i\"\n [attr.aria-disabled]=\"isDisabled(option) || null\"\n [attr.aria-describedby]=\"row.groupId\"\n [attr.aria-setsize]=\"virtualScroll() ? visibleOptions().length : null\"\n [attr.aria-posinset]=\"virtualScroll() ? i + 1 : null\"\n (click)=\"onOptionClick(option, i)\"\n (mousemove)=\"isDisabled(option) || activeIndex.set(i)\"\n >\n <span class=\"star-listbox__label\">\n @if (optionTemplate(); as custom) {\n <ng-container *ngTemplateOutlet=\"custom.template; context: optionContext(option, i)\" />\n } @else {\n @let parts = highlight(labelOf(option));\n {{ parts[0] }}<mark class=\"star-ac__match\">{{ parts[1] }}</mark>{{ parts[2] }}\n }\n </span>\n </li>\n }\n } @empty {\n <li class=\"star-listbox__empty\" role=\"presentation\">\n {{ loading() ? text.searching : emptyText() }}\n </li>\n }\n @if (virtualWindow().after) {\n <li class=\"star-listbox__spacer\" role=\"presentation\" [style.height.px]=\"virtualWindow().after\"></li>\n }\n </ul>\n </div>\n </ng-template>\n",
|
|
673
|
+
isInline: true,
|
|
674
|
+
dependencies: [
|
|
675
|
+
{
|
|
676
|
+
kind: "directive",
|
|
677
|
+
type: CdkConnectedOverlay,
|
|
678
|
+
selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]",
|
|
679
|
+
inputs: [
|
|
680
|
+
"cdkConnectedOverlayOrigin",
|
|
681
|
+
"cdkConnectedOverlayPositions",
|
|
682
|
+
"cdkConnectedOverlayPositionStrategy",
|
|
683
|
+
"cdkConnectedOverlayOffsetX",
|
|
684
|
+
"cdkConnectedOverlayOffsetY",
|
|
685
|
+
"cdkConnectedOverlayWidth",
|
|
686
|
+
"cdkConnectedOverlayHeight",
|
|
687
|
+
"cdkConnectedOverlayMinWidth",
|
|
688
|
+
"cdkConnectedOverlayMinHeight",
|
|
689
|
+
"cdkConnectedOverlayBackdropClass",
|
|
690
|
+
"cdkConnectedOverlayPanelClass",
|
|
691
|
+
"cdkConnectedOverlayViewportMargin",
|
|
692
|
+
"cdkConnectedOverlayScrollStrategy",
|
|
693
|
+
"cdkConnectedOverlayOpen",
|
|
694
|
+
"cdkConnectedOverlayDisableClose",
|
|
695
|
+
"cdkConnectedOverlayTransformOriginOn",
|
|
696
|
+
"cdkConnectedOverlayHasBackdrop",
|
|
697
|
+
"cdkConnectedOverlayLockPosition",
|
|
698
|
+
"cdkConnectedOverlayFlexibleDimensions",
|
|
699
|
+
"cdkConnectedOverlayGrowAfterOpen",
|
|
700
|
+
"cdkConnectedOverlayPush",
|
|
701
|
+
"cdkConnectedOverlayDisposeOnNavigation",
|
|
702
|
+
"cdkConnectedOverlayUsePopover",
|
|
703
|
+
"cdkConnectedOverlayMatchWidth",
|
|
704
|
+
"cdkConnectedOverlay"
|
|
705
|
+
],
|
|
706
|
+
outputs: [
|
|
707
|
+
"backdropClick",
|
|
708
|
+
"positionChange",
|
|
709
|
+
"attach",
|
|
710
|
+
"detach",
|
|
711
|
+
"overlayKeydown",
|
|
712
|
+
"overlayOutsideClick"
|
|
713
|
+
],
|
|
714
|
+
exportAs: ["cdkConnectedOverlay"]
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
kind: "directive",
|
|
718
|
+
type: CdkOverlayOrigin,
|
|
719
|
+
selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]",
|
|
720
|
+
exportAs: ["cdkOverlayOrigin"]
|
|
721
|
+
},
|
|
722
|
+
{
|
|
723
|
+
kind: "directive",
|
|
724
|
+
type: NgTemplateOutlet,
|
|
725
|
+
selector: "[ngTemplateOutlet]",
|
|
726
|
+
inputs: [
|
|
727
|
+
"ngTemplateOutletContext",
|
|
728
|
+
"ngTemplateOutlet",
|
|
729
|
+
"ngTemplateOutletInjector"
|
|
730
|
+
]
|
|
731
|
+
}
|
|
732
|
+
],
|
|
733
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
734
|
+
});
|
|
735
|
+
};
|
|
736
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
737
|
+
minVersion: "12.0.0",
|
|
738
|
+
version: "22.2.6",
|
|
739
|
+
ngImport: i0,
|
|
740
|
+
type: StarMultiAutoComplete,
|
|
741
|
+
decorators: [{
|
|
742
|
+
type: Component,
|
|
743
|
+
args: [{
|
|
744
|
+
selector: "star-multi-autocomplete",
|
|
745
|
+
imports: [
|
|
746
|
+
CdkConnectedOverlay,
|
|
747
|
+
CdkOverlayOrigin,
|
|
748
|
+
NgTemplateOutlet
|
|
749
|
+
],
|
|
750
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
751
|
+
host: {
|
|
752
|
+
...HOST,
|
|
753
|
+
class: "star-select star-ac star-ac--multi"
|
|
754
|
+
},
|
|
755
|
+
template: TEMPLATE
|
|
756
|
+
}]
|
|
757
|
+
}],
|
|
758
|
+
propDecorators: {
|
|
759
|
+
value: [{
|
|
760
|
+
type: i0.Input,
|
|
761
|
+
args: [{
|
|
762
|
+
isSignal: true,
|
|
763
|
+
alias: "value",
|
|
764
|
+
required: false
|
|
765
|
+
}]
|
|
766
|
+
}, {
|
|
767
|
+
type: i0.Output,
|
|
768
|
+
args: ["valueChange"]
|
|
769
|
+
}],
|
|
770
|
+
selectionLimit: [{
|
|
771
|
+
type: i0.Input,
|
|
772
|
+
args: [{
|
|
773
|
+
isSignal: true,
|
|
774
|
+
alias: "selectionLimit",
|
|
775
|
+
required: false
|
|
776
|
+
}]
|
|
777
|
+
}]
|
|
778
|
+
}
|
|
779
|
+
});
|
|
780
|
+
export { StarAutoComplete, StarAutoCompleteBase, StarMultiAutoComplete };
|
|
781
|
+
|
|
782
|
+
//# sourceMappingURL=star-ng-ui-autocomplete.mjs.map
|