ngwr 13.0.0 → 14.0.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/README.md +13 -6
- package/color-picker/styles/_index.scss +43 -5
- package/fesm2022/ngwr-alert.mjs +5 -5
- package/fesm2022/ngwr-alert.mjs.map +1 -1
- package/fesm2022/ngwr-back-top.mjs +11 -1
- package/fesm2022/ngwr-back-top.mjs.map +1 -1
- package/fesm2022/ngwr-blur-text.mjs +13 -2
- package/fesm2022/ngwr-blur-text.mjs.map +1 -1
- package/fesm2022/ngwr-border-glow.mjs +12 -3
- package/fesm2022/ngwr-border-glow.mjs.map +1 -1
- package/fesm2022/ngwr-breadcrumbs.mjs +14 -3
- package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ngwr-button.mjs +4 -4
- package/fesm2022/ngwr-button.mjs.map +1 -1
- package/fesm2022/ngwr-calendar-testing.mjs +15 -0
- package/fesm2022/ngwr-calendar-testing.mjs.map +1 -1
- package/fesm2022/ngwr-calendar.mjs +51 -5
- package/fesm2022/ngwr-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-circular-text.mjs +20 -1
- package/fesm2022/ngwr-circular-text.mjs.map +1 -1
- package/fesm2022/ngwr-collapse.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker-testing.mjs +23 -7
- package/fesm2022/ngwr-color-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +89 -10
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-command-palette.mjs +27 -3
- package/fesm2022/ngwr-command-palette.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu.mjs +13 -3
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-date-adapters-fns.mjs +101 -33
- package/fesm2022/ngwr-date-adapters-fns.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker-testing.mjs +10 -2
- package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +103 -13
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-date.mjs +480 -79
- package/fesm2022/ngwr-date.mjs.map +1 -1
- package/fesm2022/ngwr-dialog.mjs +22 -16
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-directives.mjs +5 -2
- package/fesm2022/ngwr-directives.mjs.map +1 -1
- package/fesm2022/ngwr-drag-drop.mjs +30 -2
- package/fesm2022/ngwr-drag-drop.mjs.map +1 -1
- package/fesm2022/ngwr-drawer.mjs +24 -18
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +8 -3
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-event-calendar-testing.mjs.map +1 -1
- package/fesm2022/ngwr-event-calendar.mjs +1 -1
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload.mjs +52 -12
- package/fesm2022/ngwr-file-upload.mjs.map +1 -1
- package/fesm2022/ngwr-fuzzy-text.mjs +21 -4
- package/fesm2022/ngwr-fuzzy-text.mjs.map +1 -1
- package/fesm2022/ngwr-gradient-text.mjs +9 -2
- package/fesm2022/ngwr-gradient-text.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +63 -1
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +28 -1
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n.mjs +150 -22
- package/fesm2022/ngwr-i18n.mjs.map +1 -1
- package/fesm2022/ngwr-icon-adapters-feather.mjs +11 -0
- package/fesm2022/ngwr-icon-adapters-feather.mjs.map +1 -1
- package/fesm2022/ngwr-icon-adapters-lucide.mjs +22 -2
- package/fesm2022/ngwr-icon-adapters-lucide.mjs.map +1 -1
- package/fesm2022/ngwr-icon.mjs +474 -37
- package/fesm2022/ngwr-icon.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +3 -3
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-input-otp.mjs +21 -3
- package/fesm2022/ngwr-input-otp.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +14 -7
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-knob-testing.mjs.map +1 -1
- package/fesm2022/ngwr-knob.mjs +20 -2
- package/fesm2022/ngwr-knob.mjs.map +1 -1
- package/fesm2022/ngwr-loading-bar-router.mjs +73 -0
- package/fesm2022/ngwr-loading-bar-router.mjs.map +1 -0
- package/fesm2022/ngwr-loading-bar.mjs +21 -32
- package/fesm2022/ngwr-loading-bar.mjs.map +1 -1
- package/fesm2022/ngwr-markdown.mjs +63 -11
- package/fesm2022/ngwr-markdown.mjs.map +1 -1
- package/fesm2022/ngwr-mention.mjs +104 -14
- package/fesm2022/ngwr-mention.mjs.map +1 -1
- package/fesm2022/ngwr-overlay.mjs +36 -7
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-pagination-testing.mjs +11 -10
- package/fesm2022/ngwr-pagination-testing.mjs.map +1 -1
- package/fesm2022/ngwr-pagination.mjs +65 -30
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-popconfirm.mjs +3 -2
- package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +2 -1
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-qr.mjs +38 -1
- package/fesm2022/ngwr-qr.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +93 -34
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-shiny-text.mjs +10 -3
- package/fesm2022/ngwr-shiny-text.mjs.map +1 -1
- package/fesm2022/ngwr-splitter-testing.mjs.map +1 -1
- package/fesm2022/ngwr-squircle.mjs +2 -1
- package/fesm2022/ngwr-squircle.mjs.map +1 -1
- package/fesm2022/ngwr-statistic.mjs +35 -4
- package/fesm2022/ngwr-statistic.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +35 -12
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-tabs-router.mjs +158 -0
- package/fesm2022/ngwr-tabs-router.mjs.map +1 -0
- package/fesm2022/ngwr-tabs-testing.mjs +13 -11
- package/fesm2022/ngwr-tabs-testing.mjs.map +1 -1
- package/fesm2022/ngwr-tabs.mjs +104 -12
- package/fesm2022/ngwr-tabs.mjs.map +1 -1
- package/fesm2022/ngwr-textarea.mjs +20 -1
- package/fesm2022/ngwr-textarea.mjs.map +1 -1
- package/fesm2022/ngwr-tour.mjs +1 -1
- package/fesm2022/ngwr-tour.mjs.map +1 -1
- package/fesm2022/ngwr-transfer.mjs +2 -2
- package/fesm2022/ngwr-transfer.mjs.map +1 -1
- package/fesm2022/ngwr-tree.mjs +18 -2
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-utils.mjs +143 -1
- package/fesm2022/ngwr-utils.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/fesm2022/ngwr-window-testing.mjs +10 -2
- package/fesm2022/ngwr-window-testing.mjs.map +1 -1
- package/fesm2022/ngwr-window.mjs +4 -4
- package/fesm2022/ngwr-window.mjs.map +1 -1
- package/i18n/en.json +33 -6
- package/i18n/ru.json +33 -6
- package/llms-full.txt +20 -11
- package/llms.txt +47 -16
- package/mcp/catalog.js +3 -3
- package/mcp/providers.js +11 -0
- package/package.json +11 -3
- package/schematics/migrations/v13/index.js +101 -0
- package/schematics/migrations/v14/index.js +422 -0
- package/schematics/migrations.json +10 -0
- package/schematics/page/templates.js +1 -1
- package/schematics/use/symbol-map.json +1 -0
- package/skills/ngwr/SKILL.md +4 -1
- package/skills/ngwr/references/catalog.md +2 -0
- package/skills/ngwr/references/setup.md +4 -0
- package/stepper/styles/_index.scss +19 -1
- package/textarea/styles/_index.scss +14 -6
- package/toast/styles/_index.scss +12 -4
- package/types/ngwr-alert.d.ts +3 -3
- package/types/ngwr-blur-text.d.ts +8 -0
- package/types/ngwr-breadcrumbs.d.ts +1 -0
- package/types/ngwr-button.d.ts +2 -2
- package/types/ngwr-calendar-testing.d.ts +21 -4
- package/types/ngwr-calendar.d.ts +37 -0
- package/types/ngwr-circular-text.d.ts +9 -0
- package/types/ngwr-collapse.d.ts +19 -15
- package/types/ngwr-color-picker-testing.d.ts +10 -4
- package/types/ngwr-color-picker.d.ts +70 -2
- package/types/ngwr-command-palette.d.ts +14 -0
- package/types/ngwr-context-menu.d.ts +1 -1
- package/types/ngwr-date-adapters-fns.d.ts +71 -29
- package/types/ngwr-date-picker-testing.d.ts +206 -185
- package/types/ngwr-date-picker.d.ts +7 -0
- package/types/ngwr-date.d.ts +143 -13
- package/types/ngwr-drag-drop.d.ts +19 -0
- package/types/ngwr-dropdown.d.ts +1 -1
- package/types/ngwr-event-calendar-testing.d.ts +12 -9
- package/types/ngwr-file-upload.d.ts +31 -3
- package/types/ngwr-fuzzy-text.d.ts +5 -0
- package/types/ngwr-i18n.d.ts +89 -7
- package/types/ngwr-icon-adapters-feather.d.ts +11 -0
- package/types/ngwr-icon.d.ts +42 -1
- package/types/ngwr-input-number.d.ts +1 -1
- package/types/ngwr-input-otp.d.ts +3 -0
- package/types/ngwr-input.d.ts +11 -4
- package/types/ngwr-knob-testing.d.ts +8 -4
- package/types/ngwr-knob.d.ts +18 -0
- package/types/ngwr-loading-bar-router.d.ts +35 -0
- package/types/ngwr-loading-bar.d.ts +19 -9
- package/types/ngwr-mention.d.ts +13 -0
- package/types/ngwr-pagination-testing.d.ts +11 -10
- package/types/ngwr-pagination.d.ts +39 -10
- package/types/ngwr-popconfirm.d.ts +1 -1
- package/types/ngwr-popover.d.ts +1 -1
- package/types/ngwr-select.d.ts +65 -10
- package/types/ngwr-shiny-text.d.ts +1 -0
- package/types/ngwr-splitter-testing.d.ts +9 -4
- package/types/ngwr-squircle.d.ts +1 -1
- package/types/ngwr-statistic.d.ts +22 -2
- package/types/ngwr-table.d.ts +24 -5
- package/types/ngwr-tabs-router.d.ts +67 -0
- package/types/ngwr-tabs-testing.d.ts +12 -10
- package/types/ngwr-tabs.d.ts +103 -6
- package/types/ngwr-textarea.d.ts +9 -0
- package/types/ngwr-tree.d.ts +7 -0
- package/types/ngwr-utils.d.ts +79 -1
- package/types/ngwr-version.d.ts +1 -1
- package/types/ngwr-window-testing.d.ts +11 -3
- package/types/ngwr-window.d.ts +11 -4
- package/window/styles/_index.scss +1 -1
package/fesm2022/ngwr-select.mjs
CHANGED
|
@@ -3,14 +3,14 @@ import { ScrollStrategyOptions } from '@angular/cdk/overlay';
|
|
|
3
3
|
import { TemplatePortal } from '@angular/cdk/portal';
|
|
4
4
|
import { isPlatformBrowser } from '@angular/common';
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
|
-
import { InjectionToken, input, inject, ElementRef, computed, effect,
|
|
6
|
+
import { InjectionToken, input, inject, ElementRef, signal, computed, effect, afterEveryRender, ViewEncapsulation, Component, model, output, contentChildren, viewChild, TemplateRef, ViewContainerRef, DestroyRef, PLATFORM_ID, forwardRef } from '@angular/core';
|
|
7
7
|
import { toObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
8
8
|
import { skip, debounce, timer, switchMap, of, defer, isObservable, from, tap, catchError, finalize } from 'rxjs';
|
|
9
9
|
import { useConfigValue } from 'ngwr/config';
|
|
10
10
|
import { WR_FORM_FIELD } from 'ngwr/form';
|
|
11
11
|
import { useI18nText, useI18nFormatter } from 'ngwr/i18n';
|
|
12
12
|
import { WR_OVERLAY, WrOutsideClick, WR_RESPONSIVE_OVERLAYS, wrPresentAsSheet } from 'ngwr/overlay';
|
|
13
|
-
import { randomId } from 'ngwr/utils';
|
|
13
|
+
import { isComposing, randomId } from 'ngwr/utils';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @license
|
|
@@ -55,6 +55,31 @@ class WrOption {
|
|
|
55
55
|
id = `wr-option-${++uid}`;
|
|
56
56
|
host = inject(ElementRef);
|
|
57
57
|
parent = inject(WR_SELECT, { optional: true });
|
|
58
|
+
/**
|
|
59
|
+
* The option's own text, as a signal — the parent's trigger label and the
|
|
60
|
+
* client-side filter both read it from here.
|
|
61
|
+
*
|
|
62
|
+
* It has to be a signal, and a plain `textContent` read cannot be one. The
|
|
63
|
+
* label is PROJECTED content: the host template decides it, and the ordinary
|
|
64
|
+
* way it changes is that a `WrI18n` catalog lands a microtask after the first
|
|
65
|
+
* change-detection pass (`i18n/i18n.ts` writes every loader-backed catalog
|
|
66
|
+
* from `firstValueFrom(...).then(...)`). Read once and cached, a trigger sat
|
|
67
|
+
* on the English fallback while the open panel beside it showed the
|
|
68
|
+
* translation — visible in `wr-pagination`'s size changer, which prints
|
|
69
|
+
* `pagination.perPage` into each `<wr-option>`.
|
|
70
|
+
*
|
|
71
|
+
* Kept in step the way `wr-divider` keeps its own projected label: an
|
|
72
|
+
* `effect` and an `afterEveryRender`, and both are needed. The render hook is
|
|
73
|
+
* a hard no-op under SSR, so on its own the server would emit a trigger with
|
|
74
|
+
* no label at all; the effect is not gated that way and runs after the
|
|
75
|
+
* content has been projected. The effect on its own cannot follow text that
|
|
76
|
+
* moves later, because it reads nothing reactive to be re-run by.
|
|
77
|
+
*
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
labelText = signal('', /* @ts-ignore */
|
|
81
|
+
...(ngDevMode ? [{ debugName: "labelText" }] : /* istanbul ignore next */ []));
|
|
82
|
+
label = this.labelText.asReadonly();
|
|
58
83
|
/**
|
|
59
84
|
* @internal — true when this option is currently selected. Works for
|
|
60
85
|
* both single and multi-select parents via `WrSelectContext.isSelected`.
|
|
@@ -84,8 +109,7 @@ class WrOption {
|
|
|
84
109
|
const q = parent.searchQuery().trim().toLowerCase();
|
|
85
110
|
if (!q)
|
|
86
111
|
return false;
|
|
87
|
-
|
|
88
|
-
return !label.includes(q);
|
|
112
|
+
return !this.label().toLowerCase().includes(q);
|
|
89
113
|
}, /* @ts-ignore */
|
|
90
114
|
...(ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []));
|
|
91
115
|
classes = computed(() => {
|
|
@@ -105,19 +129,29 @@ class WrOption {
|
|
|
105
129
|
if (this.parent) {
|
|
106
130
|
const parent = this.parent;
|
|
107
131
|
// Re-register when disabled or value changes so the parent has fresh metadata.
|
|
132
|
+
// The label is seeded here as well, which is the read the server takes.
|
|
108
133
|
effect(onCleanup => {
|
|
134
|
+
this.syncLabel();
|
|
109
135
|
const unreg = parent.registerOption({
|
|
110
136
|
id: this.id,
|
|
111
137
|
value: this.value(),
|
|
112
138
|
disabled: this.disabled(),
|
|
113
|
-
|
|
139
|
+
label: this.label,
|
|
114
140
|
host: this.host.nativeElement,
|
|
115
141
|
});
|
|
116
142
|
onCleanup(() => unreg());
|
|
117
143
|
});
|
|
118
|
-
|
|
144
|
+
afterEveryRender(() => this.syncLabel());
|
|
119
145
|
}
|
|
120
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Read the projected text back off the DOM. Setting the same string again is
|
|
149
|
+
* a signal no-op, so the render hook costs a `textContent` read and nothing
|
|
150
|
+
* else on the passes where nothing moved.
|
|
151
|
+
*/
|
|
152
|
+
syncLabel() {
|
|
153
|
+
this.labelText.set(this.host.nativeElement.textContent?.trim() ?? '');
|
|
154
|
+
}
|
|
121
155
|
onClick() {
|
|
122
156
|
if (this.disabled() || !this.parent)
|
|
123
157
|
return;
|
|
@@ -620,7 +654,30 @@ class WrSelect {
|
|
|
620
654
|
...(ngDevMode ? [{ debugName: "activeOptionId" }] : /* istanbul ignore next */ []));
|
|
621
655
|
open = signal(false, /* @ts-ignore */
|
|
622
656
|
...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
623
|
-
|
|
657
|
+
/**
|
|
658
|
+
* Trigger label for single mode. Multi reads `selectedChips` instead.
|
|
659
|
+
*
|
|
660
|
+
* A `computed`, and that is the whole point. It used to be a `signal` written
|
|
661
|
+
* from an effect keyed on `value` / `registry` / `isMulti` / `displayWith` —
|
|
662
|
+
* not one of which moves when the OPTION'S OWN TEXT does, and that text is
|
|
663
|
+
* projected content whose ordinary way of changing is a translation catalog
|
|
664
|
+
* landing a microtask after the first pass. The trigger kept the English
|
|
665
|
+
* fallback while the open panel beside it showed the translation. The
|
|
666
|
+
* registration now carries the label as a signal, so a late catalog and a
|
|
667
|
+
* runtime locale switch both repaint the trigger with the panel.
|
|
668
|
+
*/
|
|
669
|
+
selectedLabel = computed(() => {
|
|
670
|
+
const v = this.value();
|
|
671
|
+
if (this.isMulti())
|
|
672
|
+
return null;
|
|
673
|
+
const match = this.registry().find(o => o.value === v);
|
|
674
|
+
if (match)
|
|
675
|
+
return match.label();
|
|
676
|
+
// Search mode: a value picked from a virtualized (or since-unmounted) row
|
|
677
|
+
// has no registered `<wr-option>`, so derive its label from `displayWith`
|
|
678
|
+
// — the same function that rendered the row.
|
|
679
|
+
return v != null && this.isSearchable() ? this.displayWith()(v) : null;
|
|
680
|
+
}, /* @ts-ignore */
|
|
624
681
|
...(ngDevMode ? [{ debugName: "selectedLabel" }] : /* istanbul ignore next */ []));
|
|
625
682
|
/**
|
|
626
683
|
* Selected chips (multi + tag modes). Multi reads labels from the
|
|
@@ -641,7 +698,7 @@ class WrSelect {
|
|
|
641
698
|
// directly: a searchable multi fed from `[options]` has no registered
|
|
642
699
|
// `<wr-option>` for a virtualized or unmounted row, and object items
|
|
643
700
|
// would otherwise render as "[object Object]".
|
|
644
|
-
return { value: v, label: found?.
|
|
701
|
+
return { value: v, label: found?.label() ?? this.displayWith()(v) };
|
|
645
702
|
});
|
|
646
703
|
}, /* @ts-ignore */
|
|
647
704
|
...(ngDevMode ? [{ debugName: "selectedChips" }] : /* istanbul ignore next */ []));
|
|
@@ -834,7 +891,7 @@ class WrSelect {
|
|
|
834
891
|
return list.length;
|
|
835
892
|
let count = 0;
|
|
836
893
|
for (const o of list) {
|
|
837
|
-
if (o.
|
|
894
|
+
if (o.label().toLowerCase().includes(q))
|
|
838
895
|
count++;
|
|
839
896
|
}
|
|
840
897
|
return count;
|
|
@@ -889,11 +946,29 @@ class WrSelect {
|
|
|
889
946
|
this.onTagInput(event);
|
|
890
947
|
}
|
|
891
948
|
onChipsKeydown(event) {
|
|
949
|
+
if (this.imeOwnsKey(event))
|
|
950
|
+
return;
|
|
892
951
|
if (this.hasChipSearch())
|
|
893
952
|
this.onSearchKey(event);
|
|
894
953
|
else
|
|
895
954
|
this.onTagKeydown(event);
|
|
896
955
|
}
|
|
956
|
+
/**
|
|
957
|
+
* True when the key belongs to an open IME conversion — and, when it does,
|
|
958
|
+
* stops the event on its way out.
|
|
959
|
+
*
|
|
960
|
+
* Not acting is not enough here. The panel closes on Escape from CDK's overlay
|
|
961
|
+
* keyboard dispatcher, one listener on `<body>` in the bubble phase, so a
|
|
962
|
+
* handler that merely returns still loses the panel: the Japanese user meant
|
|
963
|
+
* to cancel a reading and lost the query with it. Stopping the event at the
|
|
964
|
+
* field that owns the composition is the only place that reaches both.
|
|
965
|
+
*/
|
|
966
|
+
imeOwnsKey(event) {
|
|
967
|
+
if (!isComposing(event))
|
|
968
|
+
return false;
|
|
969
|
+
event.stopPropagation();
|
|
970
|
+
return true;
|
|
971
|
+
}
|
|
897
972
|
onChipsFocus() {
|
|
898
973
|
// Tag mode has no panel to open.
|
|
899
974
|
if (this.hasChipSearch())
|
|
@@ -959,6 +1034,10 @@ class WrSelect {
|
|
|
959
1034
|
this.touch.emit();
|
|
960
1035
|
}
|
|
961
1036
|
onSearchKey(event) {
|
|
1037
|
+
// Enter accepts an IME candidate, Escape cancels the reading, the arrows walk
|
|
1038
|
+
// the candidate list — none of it is the listbox's while a conversion is open.
|
|
1039
|
+
if (this.imeOwnsKey(event))
|
|
1040
|
+
return;
|
|
962
1041
|
// freeText: Enter on an unmatched query commits the typed string
|
|
963
1042
|
// as the value. Skips when an active option is highlighted (the
|
|
964
1043
|
// normal Enter-selects behaviour wins).
|
|
@@ -968,7 +1047,7 @@ class WrSelect {
|
|
|
968
1047
|
const list = this.orderedRegistry();
|
|
969
1048
|
const hasActive = this.virtualActive()
|
|
970
1049
|
? idx >= 0 && idx < this.filteredDynamicOptions().length
|
|
971
|
-
: idx >= 0 && idx < list.length && !list[idx].disabled && !this.isOptionHidden(list[idx].
|
|
1050
|
+
: idx >= 0 && idx < list.length && !list[idx].disabled && !this.isOptionHidden(list[idx].label());
|
|
972
1051
|
if (!hasActive && q) {
|
|
973
1052
|
event.preventDefault();
|
|
974
1053
|
this.value.set(q);
|
|
@@ -1140,26 +1219,6 @@ class WrSelect {
|
|
|
1140
1219
|
catchError(() => of([])), finalize(() => this.loaderLoading.set(false)));
|
|
1141
1220
|
}), takeUntilDestroyed(this.destroyRef))
|
|
1142
1221
|
.subscribe(items => this.loadedOptions.set(items));
|
|
1143
|
-
// Resolve the single-mode trigger label whenever the value or
|
|
1144
|
-
// options change. Multi mode reads `selectedChips` instead and
|
|
1145
|
-
// doesn't need this.
|
|
1146
|
-
effect(() => {
|
|
1147
|
-
const v = this.value();
|
|
1148
|
-
const list = this.registry();
|
|
1149
|
-
if (this.isMulti()) {
|
|
1150
|
-
this.selectedLabel.set(null);
|
|
1151
|
-
return;
|
|
1152
|
-
}
|
|
1153
|
-
const match = list.find(o => o.value === v);
|
|
1154
|
-
if (match) {
|
|
1155
|
-
this.selectedLabel.set(match.getLabel());
|
|
1156
|
-
return;
|
|
1157
|
-
}
|
|
1158
|
-
// Search mode: a value picked from a virtualized (or since-unmounted) row
|
|
1159
|
-
// has no registered `<wr-option>`, so derive its label from `displayWith`
|
|
1160
|
-
// — the same function that rendered the row.
|
|
1161
|
-
this.selectedLabel.set(v != null && this.isSearchable() ? this.displayWith()(v) : null);
|
|
1162
|
-
});
|
|
1163
1222
|
// Wire the virtual scroll listener + viewport/row measurement while the panel
|
|
1164
1223
|
// is open and virtualized. Re-runs when the panel opens/closes or the virtual
|
|
1165
1224
|
// list mounts/unmounts; the microtask defers the DOM read until the overlay
|
|
@@ -1463,7 +1522,7 @@ class WrSelect {
|
|
|
1463
1522
|
// Filtered-out options stay registered (they only self-hide via CSS), so
|
|
1464
1523
|
// the hidden check is load-bearing: without it Enter can commit a row
|
|
1465
1524
|
// that is not on screen.
|
|
1466
|
-
if (idx >= 0 && idx < list.length && !list[idx].disabled && !this.isOptionHidden(list[idx].
|
|
1525
|
+
if (idx >= 0 && idx < list.length && !list[idx].disabled && !this.isOptionHidden(list[idx].label())) {
|
|
1467
1526
|
const id = list[idx].id;
|
|
1468
1527
|
const el = this.overlayRef?.overlayElement.querySelector(`#${CSS.escape(id)}`);
|
|
1469
1528
|
el?.click();
|
|
@@ -1514,7 +1573,7 @@ class WrSelect {
|
|
|
1514
1573
|
while (attempts-- > 0) {
|
|
1515
1574
|
i = (i + delta + list.length) % list.length;
|
|
1516
1575
|
const o = list[i];
|
|
1517
|
-
if (!o.disabled && !this.isOptionHidden(o.
|
|
1576
|
+
if (!o.disabled && !this.isOptionHidden(o.label())) {
|
|
1518
1577
|
this.activeIndex.set(i);
|
|
1519
1578
|
return;
|
|
1520
1579
|
}
|
|
@@ -1536,7 +1595,7 @@ class WrSelect {
|
|
|
1536
1595
|
firstEnabled() {
|
|
1537
1596
|
if (this.virtualActive())
|
|
1538
1597
|
return this.filteredDynamicOptions().length > 0 ? 0 : -1;
|
|
1539
|
-
return this.orderedRegistry().findIndex(o => !o.disabled && !this.isOptionHidden(o.
|
|
1598
|
+
return this.orderedRegistry().findIndex(o => !o.disabled && !this.isOptionHidden(o.label()));
|
|
1540
1599
|
}
|
|
1541
1600
|
lastEnabled() {
|
|
1542
1601
|
if (this.virtualActive())
|
|
@@ -1544,7 +1603,7 @@ class WrSelect {
|
|
|
1544
1603
|
const list = this.orderedRegistry();
|
|
1545
1604
|
let found = -1;
|
|
1546
1605
|
list.forEach((o, i) => {
|
|
1547
|
-
if (!o.disabled && !this.isOptionHidden(o.
|
|
1606
|
+
if (!o.disabled && !this.isOptionHidden(o.label()))
|
|
1548
1607
|
found = i;
|
|
1549
1608
|
});
|
|
1550
1609
|
return found;
|