@4sh/ui-kit 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 +201 -0
- package/NOTICE +7 -0
- package/README.md +229 -0
- package/fesm2022/4sh-ui-kit-forms.mjs +501 -0
- package/fesm2022/4sh-ui-kit-forms.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-motion.mjs +155 -0
- package/fesm2022/4sh-ui-kit-motion.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-overlay.mjs +61 -0
- package/fesm2022/4sh-ui-kit-overlay.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-theming.mjs +120 -0
- package/fesm2022/4sh-ui-kit-theming.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-types.mjs +12 -0
- package/fesm2022/4sh-ui-kit-types.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-accordion.mjs +244 -0
- package/fesm2022/4sh-ui-kit-ui-accordion.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-alert.mjs +160 -0
- package/fesm2022/4sh-ui-kit-ui-alert.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-autocomplete.mjs +926 -0
- package/fesm2022/4sh-ui-kit-ui-autocomplete.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-avatar-group.mjs +34 -0
- package/fesm2022/4sh-ui-kit-ui-avatar-group.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-avatar.mjs +122 -0
- package/fesm2022/4sh-ui-kit-ui-avatar.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-badge.mjs +95 -0
- package/fesm2022/4sh-ui-kit-ui-badge.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-breadcrumb.mjs +190 -0
- package/fesm2022/4sh-ui-kit-ui-breadcrumb.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-button-split.mjs +151 -0
- package/fesm2022/4sh-ui-kit-ui-button-split.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-button.mjs +222 -0
- package/fesm2022/4sh-ui-kit-ui-button.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-card.mjs +164 -0
- package/fesm2022/4sh-ui-kit-ui-card.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-checkbox.mjs +118 -0
- package/fesm2022/4sh-ui-kit-ui-checkbox.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-chip.mjs +205 -0
- package/fesm2022/4sh-ui-kit-ui-chip.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-context-menu.mjs +219 -0
- package/fesm2022/4sh-ui-kit-ui-context-menu.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-datepicker.mjs +1508 -0
- package/fesm2022/4sh-ui-kit-ui-datepicker.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-drawer.mjs +300 -0
- package/fesm2022/4sh-ui-kit-ui-drawer.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-empty-state.mjs +148 -0
- package/fesm2022/4sh-ui-kit-ui-empty-state.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-field.mjs +102 -0
- package/fesm2022/4sh-ui-kit-ui-field.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-file-upload.mjs +568 -0
- package/fesm2022/4sh-ui-kit-ui-file-upload.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-helper.mjs +85 -0
- package/fesm2022/4sh-ui-kit-ui-helper.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-icon.mjs +98 -0
- package/fesm2022/4sh-ui-kit-ui-icon.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-image.mjs +201 -0
- package/fesm2022/4sh-ui-kit-ui-image.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-input-group.mjs +119 -0
- package/fesm2022/4sh-ui-kit-ui-input-group.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-input-mask.mjs +125 -0
- package/fesm2022/4sh-ui-kit-ui-input-mask.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-input-number.mjs +234 -0
- package/fesm2022/4sh-ui-kit-ui-input-number.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-input-otp.mjs +288 -0
- package/fesm2022/4sh-ui-kit-ui-input-otp.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-input-tags.mjs +679 -0
- package/fesm2022/4sh-ui-kit-ui-input-tags.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-input.mjs +121 -0
- package/fesm2022/4sh-ui-kit-ui-input.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-label.mjs +61 -0
- package/fesm2022/4sh-ui-kit-ui-label.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-link.mjs +147 -0
- package/fesm2022/4sh-ui-kit-ui-link.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-menu.mjs +484 -0
- package/fesm2022/4sh-ui-kit-ui-menu.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-modal.mjs +555 -0
- package/fesm2022/4sh-ui-kit-ui-modal.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-nudger.mjs +168 -0
- package/fesm2022/4sh-ui-kit-ui-nudger.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-paginator.mjs +245 -0
- package/fesm2022/4sh-ui-kit-ui-paginator.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-popover.mjs +296 -0
- package/fesm2022/4sh-ui-kit-ui-popover.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-progress-bar.mjs +124 -0
- package/fesm2022/4sh-ui-kit-ui-progress-bar.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-radio.mjs +92 -0
- package/fesm2022/4sh-ui-kit-ui-radio.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-rating.mjs +185 -0
- package/fesm2022/4sh-ui-kit-ui-rating.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-read-only.mjs +146 -0
- package/fesm2022/4sh-ui-kit-ui-read-only.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-segment-control.mjs +386 -0
- package/fesm2022/4sh-ui-kit-ui-segment-control.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-select.mjs +868 -0
- package/fesm2022/4sh-ui-kit-ui-select.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-separator.mjs +77 -0
- package/fesm2022/4sh-ui-kit-ui-separator.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-sidebar.mjs +577 -0
- package/fesm2022/4sh-ui-kit-ui-sidebar.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-skeleton.mjs +81 -0
- package/fesm2022/4sh-ui-kit-ui-skeleton.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-slider.mjs +340 -0
- package/fesm2022/4sh-ui-kit-ui-slider.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-spinner.mjs +132 -0
- package/fesm2022/4sh-ui-kit-ui-spinner.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-stepper.mjs +389 -0
- package/fesm2022/4sh-ui-kit-ui-stepper.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-table.mjs +1406 -0
- package/fesm2022/4sh-ui-kit-ui-table.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-tabs.mjs +503 -0
- package/fesm2022/4sh-ui-kit-ui-tabs.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-tag.mjs +84 -0
- package/fesm2022/4sh-ui-kit-ui-tag.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-textarea.mjs +119 -0
- package/fesm2022/4sh-ui-kit-ui-textarea.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-toast.mjs +424 -0
- package/fesm2022/4sh-ui-kit-ui-toast.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-toggle.mjs +120 -0
- package/fesm2022/4sh-ui-kit-ui-toggle.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-tooltip.mjs +445 -0
- package/fesm2022/4sh-ui-kit-ui-tooltip.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit.mjs +16 -0
- package/fesm2022/4sh-ui-kit.mjs.map +1 -0
- package/package.json +287 -0
- package/styles/base/_base.scss +19 -0
- package/styles/base/_motion.scss +144 -0
- package/styles/base/_typography.scss +99 -0
- package/styles/generated/_tokens-breakpoint.scss +8 -0
- package/styles/generated/_tokens-metrics.scss +37 -0
- package/styles/generated/_tokens-primitives.scss +284 -0
- package/styles/generated/_tokens-responsive.scss +99 -0
- package/styles/generated/_tokens-semantics.scss +1274 -0
- package/styles/generated/_tokens-styles.scss +35 -0
- package/styles/generated/_tokens-transitions.scss +11 -0
- package/styles/generated/_tokens-typography.scss +14 -0
- package/styles/generated/_tokens.scss +10 -0
- package/styles/index.scss +25 -0
- package/styles/settings/_ui-config.scss +67 -0
- package/styles/utils/_functions.scss +67 -0
- package/styles/utils/_helpers.scss +129 -0
- package/styles/utils/_mixins.scss +186 -0
- package/styles/utils/_motion.scss +47 -0
- package/styles/utils/_overlay.scss +26 -0
- package/styles/utils.scss +15 -0
- package/styles.css +1 -0
- package/types/4sh-ui-kit-forms.d.ts +259 -0
- package/types/4sh-ui-kit-motion.d.ts +111 -0
- package/types/4sh-ui-kit-overlay.d.ts +31 -0
- package/types/4sh-ui-kit-theming.d.ts +54 -0
- package/types/4sh-ui-kit-types.d.ts +13 -0
- package/types/4sh-ui-kit-ui-accordion.d.ts +140 -0
- package/types/4sh-ui-kit-ui-alert.d.ts +89 -0
- package/types/4sh-ui-kit-ui-autocomplete.d.ts +411 -0
- package/types/4sh-ui-kit-ui-avatar-group.d.ts +17 -0
- package/types/4sh-ui-kit-ui-avatar.d.ts +55 -0
- package/types/4sh-ui-kit-ui-badge.d.ts +38 -0
- package/types/4sh-ui-kit-ui-breadcrumb.d.ts +131 -0
- package/types/4sh-ui-kit-ui-button-split.d.ts +102 -0
- package/types/4sh-ui-kit-ui-button.d.ts +91 -0
- package/types/4sh-ui-kit-ui-card.d.ts +102 -0
- package/types/4sh-ui-kit-ui-checkbox.d.ts +54 -0
- package/types/4sh-ui-kit-ui-chip.d.ts +114 -0
- package/types/4sh-ui-kit-ui-context-menu.d.ts +105 -0
- package/types/4sh-ui-kit-ui-datepicker.d.ts +539 -0
- package/types/4sh-ui-kit-ui-drawer.d.ts +147 -0
- package/types/4sh-ui-kit-ui-empty-state.d.ts +93 -0
- package/types/4sh-ui-kit-ui-field.d.ts +53 -0
- package/types/4sh-ui-kit-ui-file-upload.d.ts +268 -0
- package/types/4sh-ui-kit-ui-helper.d.ts +46 -0
- package/types/4sh-ui-kit-ui-icon.d.ts +69 -0
- package/types/4sh-ui-kit-ui-image.d.ts +88 -0
- package/types/4sh-ui-kit-ui-input-group.d.ts +54 -0
- package/types/4sh-ui-kit-ui-input-mask.d.ts +63 -0
- package/types/4sh-ui-kit-ui-input-number.d.ts +96 -0
- package/types/4sh-ui-kit-ui-input-otp.d.ts +130 -0
- package/types/4sh-ui-kit-ui-input-tags.d.ts +350 -0
- package/types/4sh-ui-kit-ui-input.d.ts +78 -0
- package/types/4sh-ui-kit-ui-label.d.ts +36 -0
- package/types/4sh-ui-kit-ui-link.d.ts +72 -0
- package/types/4sh-ui-kit-ui-menu.d.ts +235 -0
- package/types/4sh-ui-kit-ui-modal.d.ts +241 -0
- package/types/4sh-ui-kit-ui-nudger.d.ts +79 -0
- package/types/4sh-ui-kit-ui-paginator.d.ts +150 -0
- package/types/4sh-ui-kit-ui-popover.d.ts +125 -0
- package/types/4sh-ui-kit-ui-progress-bar.d.ts +82 -0
- package/types/4sh-ui-kit-ui-radio.d.ts +44 -0
- package/types/4sh-ui-kit-ui-rating.d.ts +90 -0
- package/types/4sh-ui-kit-ui-read-only.d.ts +70 -0
- package/types/4sh-ui-kit-ui-segment-control.d.ts +184 -0
- package/types/4sh-ui-kit-ui-select.d.ts +392 -0
- package/types/4sh-ui-kit-ui-separator.d.ts +43 -0
- package/types/4sh-ui-kit-ui-sidebar.d.ts +358 -0
- package/types/4sh-ui-kit-ui-skeleton.d.ts +52 -0
- package/types/4sh-ui-kit-ui-slider.d.ts +127 -0
- package/types/4sh-ui-kit-ui-spinner.d.ts +67 -0
- package/types/4sh-ui-kit-ui-stepper.d.ts +220 -0
- package/types/4sh-ui-kit-ui-table.d.ts +570 -0
- package/types/4sh-ui-kit-ui-tabs.d.ts +225 -0
- package/types/4sh-ui-kit-ui-tag.d.ts +46 -0
- package/types/4sh-ui-kit-ui-textarea.d.ts +61 -0
- package/types/4sh-ui-kit-ui-toast.d.ts +247 -0
- package/types/4sh-ui-kit-ui-toggle.d.ts +67 -0
- package/types/4sh-ui-kit-ui-tooltip.d.ts +167 -0
- package/types/4sh-ui-kit.d.ts +4 -0
|
@@ -0,0 +1,868 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, booleanAttribute, numberAttribute, output, contentChild, viewChild, signal, computed, effect, isDevMode, forwardRef, Component } from '@angular/core';
|
|
3
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
4
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
5
|
+
import * as i1 from '@angular/cdk/overlay';
|
|
6
|
+
import { OverlayModule } from '@angular/cdk/overlay';
|
|
7
|
+
import { CdkVirtualScrollViewport, ScrollingModule } from '@angular/cdk/scrolling';
|
|
8
|
+
import { BaseFormField, formatLabel, dropdownOverlayPositions, createOptionResolver } from '@4sh/ui-kit/forms';
|
|
9
|
+
import { UiField } from '@4sh/ui-kit/ui-field';
|
|
10
|
+
import { UiIcon } from '@4sh/ui-kit/ui-icon';
|
|
11
|
+
import { UiSpinner } from '@4sh/ui-kit/ui-spinner';
|
|
12
|
+
import { UiMotion } from '@4sh/ui-kit/motion';
|
|
13
|
+
import { closeOnNavigation } from '@4sh/ui-kit/overlay';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* ui-select — headless dropdown list built on the `ui-field` shell
|
|
17
|
+
* (label + box + helper) with a token-styled options panel in a CDK overlay.
|
|
18
|
+
*
|
|
19
|
+
* The trigger is a native element following the WAI-ARIA combobox pattern
|
|
20
|
+
* (`role="combobox"` + `aria-activedescendant`: focus never leaves the trigger
|
|
21
|
+
* or the filter input, options are only visually focused). Supports primitive
|
|
22
|
+
* or object options (`optionLabel` / `optionValue` / `optionDisabled`), grouped
|
|
23
|
+
* options, single or `multiple` selection (checkmark / checkbox display),
|
|
24
|
+
* built-in filtering, an `editable` free-text mode, `showClear`, `loading`, and
|
|
25
|
+
* CDK virtual scrolling (plus lazy loading of huge lists) — all wired through
|
|
26
|
+
* `ControlValueAccessor` on {@link BaseFormField} (shared label / helper /
|
|
27
|
+
* level / validation / states).
|
|
28
|
+
*
|
|
29
|
+
* Customisation: the `#item`, `#selectedItem`, `#group`, `#header`, `#footer`
|
|
30
|
+
* and `#empty` templates, `panelStyleClass`, and the local SCSS variables.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```html
|
|
34
|
+
* <ui-select label="Ville" [options]="cities" optionLabel="name" optionValue="code" [(ngModel)]="city" />
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
class UiSelect extends BaseFormField {
|
|
38
|
+
constructor() {
|
|
39
|
+
super();
|
|
40
|
+
/** Options to display. Primitives, objects, or groups (see `group`). */
|
|
41
|
+
this.options = input([], /* @ts-ignore */
|
|
42
|
+
...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
43
|
+
/** Field name (dot-path) to read a label from, when options are objects. */
|
|
44
|
+
this.optionLabel = input(/* @ts-ignore */
|
|
45
|
+
...(ngDevMode ? [undefined, { debugName: "optionLabel" }] : /* istanbul ignore next */ []));
|
|
46
|
+
/** Field name (dot-path) to read the value from, when options are objects. */
|
|
47
|
+
this.optionValue = input(/* @ts-ignore */
|
|
48
|
+
...(ngDevMode ? [undefined, { debugName: "optionValue" }] : /* istanbul ignore next */ []));
|
|
49
|
+
/** Field name (dot-path) to read the disabled flag from, when options are objects. */
|
|
50
|
+
this.optionDisabled = input(/* @ts-ignore */
|
|
51
|
+
...(ngDevMode ? [undefined, { debugName: "optionDisabled" }] : /* istanbul ignore next */ []));
|
|
52
|
+
/** Treat `options` as groups (`optionGroupLabel` + `optionGroupChildren`). */
|
|
53
|
+
this.group = input(false, { ...(ngDevMode ? { debugName: "group" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
54
|
+
/** Field name of a group's label. */
|
|
55
|
+
this.optionGroupLabel = input('label', /* @ts-ignore */
|
|
56
|
+
...(ngDevMode ? [{ debugName: "optionGroupLabel" }] : /* istanbul ignore next */ []));
|
|
57
|
+
/** Field name of a group's children array. */
|
|
58
|
+
this.optionGroupChildren = input('items', /* @ts-ignore */
|
|
59
|
+
...(ngDevMode ? [{ debugName: "optionGroupChildren" }] : /* istanbul ignore next */ []));
|
|
60
|
+
/** Property used to compare object values for equality (selection matching). */
|
|
61
|
+
this.dataKey = input(/* @ts-ignore */
|
|
62
|
+
...(ngDevMode ? [undefined, { debugName: "dataKey" }] : /* istanbul ignore next */ []));
|
|
63
|
+
/** Allow selecting several values (the model becomes an array, the panel stays open). */
|
|
64
|
+
this.multiple = input(false, { ...(ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
65
|
+
/** Display a check indicator on the selected option(s). */
|
|
66
|
+
this.checkmark = input(false, { ...(ngDevMode ? { debugName: "checkmark" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
67
|
+
/** Display a checkbox in front of each option (`multiple` mode). */
|
|
68
|
+
this.checkbox = input(false, { ...(ngDevMode ? { debugName: "checkbox" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
69
|
+
/** Max number of selected items rendered in the trigger (`multiple`); the rest collapses into `overflowLabel`. */
|
|
70
|
+
this.maxSelectedLabels = input(/* @ts-ignore */
|
|
71
|
+
...(ngDevMode ? [undefined, { debugName: "maxSelectedLabels" }] : /* istanbul ignore next */ []));
|
|
72
|
+
/** Collapsed-count indicator — `{0}` is replaced by the number of hidden items. */
|
|
73
|
+
this.overflowLabel = input('(+{0} autres)', /* @ts-ignore */
|
|
74
|
+
...(ngDevMode ? [{ debugName: "overflowLabel" }] : /* istanbul ignore next */ []));
|
|
75
|
+
/** Placeholder shown in the trigger when nothing is selected. */
|
|
76
|
+
this.placeholder = input(/* @ts-ignore */
|
|
77
|
+
...(ngDevMode ? [undefined, { debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
78
|
+
/** Show a clear (×) action in the trigger when a value is set. */
|
|
79
|
+
this.showClear = input(false, { ...(ngDevMode ? { debugName: "showClear" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
80
|
+
/** Accessible name of the clear action. */
|
|
81
|
+
this.clearAriaLabel = input('Effacer la sélection', /* @ts-ignore */
|
|
82
|
+
...(ngDevMode ? [{ debugName: "clearAriaLabel" }] : /* istanbul ignore next */ []));
|
|
83
|
+
/** FontAwesome icon of the dropdown chevron. */
|
|
84
|
+
this.icon = input('angle-down', /* @ts-ignore */
|
|
85
|
+
...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
86
|
+
/** Show the built-in filter input inside the panel. */
|
|
87
|
+
this.filter = input(false, { ...(ngDevMode ? { debugName: "filter" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
88
|
+
/** Placeholder of the filter input. */
|
|
89
|
+
this.filterPlaceholder = input(/* @ts-ignore */
|
|
90
|
+
...(ngDevMode ? [undefined, { debugName: "filterPlaceholder" }] : /* istanbul ignore next */ []));
|
|
91
|
+
/** Accessible name of the filter input. */
|
|
92
|
+
this.filterAriaLabel = input('Filtrer les options', /* @ts-ignore */
|
|
93
|
+
...(ngDevMode ? [{ debugName: "filterAriaLabel" }] : /* istanbul ignore next */ []));
|
|
94
|
+
/** Comma-separated field names (dot-paths) the filter matches against (defaults to the label). */
|
|
95
|
+
this.filterBy = input(/* @ts-ignore */
|
|
96
|
+
...(ngDevMode ? [undefined, { debugName: "filterBy" }] : /* istanbul ignore next */ []));
|
|
97
|
+
/** Move the focus into the filter input when the panel opens. */
|
|
98
|
+
this.autofocusFilter = input(true, { ...(ngDevMode ? { debugName: "autofocusFilter" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
99
|
+
/** Reset the filter text when the panel closes. */
|
|
100
|
+
this.resetFilterOnHide = input(false, { ...(ngDevMode ? { debugName: "resetFilterOnHide" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
101
|
+
/** Message shown when there is no option. */
|
|
102
|
+
this.emptyMessage = input('Aucune option disponible', /* @ts-ignore */
|
|
103
|
+
...(ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []));
|
|
104
|
+
/** Message shown when the filter matches nothing. */
|
|
105
|
+
this.emptyFilterMessage = input('Aucun résultat', /* @ts-ignore */
|
|
106
|
+
...(ngDevMode ? [{ debugName: "emptyFilterMessage" }] : /* istanbul ignore next */ []));
|
|
107
|
+
/** Free-text mode: the trigger becomes a real `<input>`, typing sets the value directly. */
|
|
108
|
+
this.editable = input(false, { ...(ngDevMode ? { debugName: "editable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
109
|
+
/** Loading state: a spinner replaces the chevron and the options are not interactive. */
|
|
110
|
+
this.loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
111
|
+
/** Visually focus the first option when the panel opens. */
|
|
112
|
+
this.autoOptionFocus = input(false, { ...(ngDevMode ? { debugName: "autoOptionFocus" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
113
|
+
/** Select an option as soon as it is visually focused with the keyboard (single mode). */
|
|
114
|
+
this.selectOnFocus = input(false, { ...(ngDevMode ? { debugName: "selectOnFocus" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
115
|
+
/** Visually focus the option under the mouse pointer. */
|
|
116
|
+
this.focusOnHover = input(true, { ...(ngDevMode ? { debugName: "focusOnHover" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
117
|
+
/** Render the options through a CDK virtual-scroll viewport. */
|
|
118
|
+
this.virtualScroll = input(false, { ...(ngDevMode ? { debugName: "virtualScroll" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
119
|
+
/** Fixed height (px) of one row — required by the virtual scroller. */
|
|
120
|
+
this.virtualScrollItemSize = input(40, { ...(ngDevMode ? { debugName: "virtualScrollItemSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
121
|
+
/** With `virtualScroll`: emit `lazyLoad` with the rendered range (lazy loading). */
|
|
122
|
+
this.lazy = input(false, { ...(ngDevMode ? { debugName: "lazy" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
123
|
+
/** Max height of the options list (CSS size, e.g. `'320px'`). Defaults from the SCSS. */
|
|
124
|
+
this.scrollHeight = input(/* @ts-ignore */
|
|
125
|
+
...(ngDevMode ? [undefined, { debugName: "scrollHeight" }] : /* istanbul ignore next */ []));
|
|
126
|
+
/**
|
|
127
|
+
* Auto-flip the panel above the trigger when there isn't enough room below
|
|
128
|
+
* (default). Set `false` to lock it below the trigger regardless of space.
|
|
129
|
+
*/
|
|
130
|
+
this.autoFlip = input(true, { ...(ngDevMode ? { debugName: "autoFlip" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
131
|
+
/** Extra class(es) applied to the panel (scoped custom styling). */
|
|
132
|
+
this.panelStyleClass = input(/* @ts-ignore */
|
|
133
|
+
...(ngDevMode ? [undefined, { debugName: "panelStyleClass" }] : /* istanbul ignore next */ []));
|
|
134
|
+
/**
|
|
135
|
+
* Panel width. By default it matches the field, which is too narrow when the
|
|
136
|
+
* field is compact (a phone dialling code in a `ui-input-group`, say) but the
|
|
137
|
+
* options are not. `'auto'` sizes the panel to its content while keeping the
|
|
138
|
+
* field width as a floor; any CSS size (`'260px'`) pins it.
|
|
139
|
+
*/
|
|
140
|
+
this.panelWidth = input(/* @ts-ignore */
|
|
141
|
+
...(ngDevMode ? [undefined, { debugName: "panelWidth" }] : /* istanbul ignore next */ []));
|
|
142
|
+
/** Emitted whenever the value changes (selection, typing, clear). */
|
|
143
|
+
this.valueChange = output();
|
|
144
|
+
/** Emitted when the panel opens. */
|
|
145
|
+
this.opened = output();
|
|
146
|
+
/** Emitted when the panel closes. */
|
|
147
|
+
this.closed = output();
|
|
148
|
+
/** Emitted when the value is cleared. */
|
|
149
|
+
this.cleared = output();
|
|
150
|
+
/** Emitted on each filter keystroke. */
|
|
151
|
+
this.filterChange = output();
|
|
152
|
+
/** Emitted when the virtual viewport's rendered range changes (`virtualScroll` + `lazy`). */
|
|
153
|
+
this.lazyLoad = output();
|
|
154
|
+
/** Emitted when the trigger receives focus. */
|
|
155
|
+
this.inputFocus = output();
|
|
156
|
+
/** Emitted when the trigger loses focus. */
|
|
157
|
+
this.inputBlur = output();
|
|
158
|
+
/** Custom option template: `<ng-template #item let-option let-selected="selected">`. */
|
|
159
|
+
this.itemTemplate = contentChild('item', /* @ts-ignore */
|
|
160
|
+
...(ngDevMode ? [{ debugName: "itemTemplate" }] : /* istanbul ignore next */ []));
|
|
161
|
+
/** Custom selected-value template (per selected option): `<ng-template #selectedItem let-option>`. */
|
|
162
|
+
this.selectedItemTemplate = contentChild('selectedItem', /* @ts-ignore */
|
|
163
|
+
...(ngDevMode ? [{ debugName: "selectedItemTemplate" }] : /* istanbul ignore next */ []));
|
|
164
|
+
/** Custom group-header template: `<ng-template #group let-group>`. */
|
|
165
|
+
this.groupTemplate = contentChild('group', /* @ts-ignore */
|
|
166
|
+
...(ngDevMode ? [{ debugName: "groupTemplate" }] : /* istanbul ignore next */ []));
|
|
167
|
+
/** Free content pinned above the list (before the filter). */
|
|
168
|
+
this.headerTemplate = contentChild('header', /* @ts-ignore */
|
|
169
|
+
...(ngDevMode ? [{ debugName: "headerTemplate" }] : /* istanbul ignore next */ []));
|
|
170
|
+
/** Free content pinned under the list. */
|
|
171
|
+
this.footerTemplate = contentChild('footer', /* @ts-ignore */
|
|
172
|
+
...(ngDevMode ? [{ debugName: "footerTemplate" }] : /* istanbul ignore next */ []));
|
|
173
|
+
/** Custom empty-state template. */
|
|
174
|
+
this.emptyTemplate = contentChild('empty', /* @ts-ignore */
|
|
175
|
+
...(ngDevMode ? [{ debugName: "emptyTemplate" }] : /* istanbul ignore next */ []));
|
|
176
|
+
/** @ignore Component root (overlay origin + outside-focus detection). */
|
|
177
|
+
this.containerEl = viewChild.required('container', /* @ts-ignore */
|
|
178
|
+
...(ngDevMode ? [{ debugName: "containerEl" }] : /* istanbul ignore next */ []));
|
|
179
|
+
/** @ignore Focusable trigger (combobox button or editable input). */
|
|
180
|
+
this.triggerEl = viewChild('trigger', /* @ts-ignore */
|
|
181
|
+
...(ngDevMode ? [{ debugName: "triggerEl" }] : /* istanbul ignore next */ []));
|
|
182
|
+
/** @ignore Panel root element (for scrolling the focused option into view). */
|
|
183
|
+
this.panelEl = viewChild('panel', /* @ts-ignore */
|
|
184
|
+
...(ngDevMode ? [{ debugName: "panelEl" }] : /* istanbul ignore next */ []));
|
|
185
|
+
/** @ignore Filter input (auto-focused on open). */
|
|
186
|
+
this.filterInputEl = viewChild('filterInput', /* @ts-ignore */
|
|
187
|
+
...(ngDevMode ? [{ debugName: "filterInputEl" }] : /* istanbul ignore next */ []));
|
|
188
|
+
/** @ignore Virtual-scroll viewport (lazy range + scrollToIndex). */
|
|
189
|
+
this.viewport = viewChild(CdkVirtualScrollViewport, /* @ts-ignore */
|
|
190
|
+
...(ngDevMode ? [{ debugName: "viewport" }] : /* istanbul ignore next */ []));
|
|
191
|
+
/** @ignore */
|
|
192
|
+
this.panelOpen = signal(false, /* @ts-ignore */
|
|
193
|
+
...(ngDevMode ? [{ debugName: "panelOpen" }] : /* istanbul ignore next */ []));
|
|
194
|
+
/** @ignore Element the overlay is anchored to (the field box). */
|
|
195
|
+
this.overlayOrigin = signal(null, /* @ts-ignore */
|
|
196
|
+
...(ngDevMode ? [{ debugName: "overlayOrigin" }] : /* istanbul ignore next */ []));
|
|
197
|
+
/** @ignore Field box width, measured on open. */
|
|
198
|
+
this.overlayWidth = signal(null, /* @ts-ignore */
|
|
199
|
+
...(ngDevMode ? [{ debugName: "overlayWidth" }] : /* istanbul ignore next */ []));
|
|
200
|
+
/** @ignore Current filter text. */
|
|
201
|
+
this.filterValue = signal('', /* @ts-ignore */
|
|
202
|
+
...(ngDevMode ? [{ debugName: "filterValue" }] : /* istanbul ignore next */ []));
|
|
203
|
+
/** @ignore Raw text typed in the editable trigger (`null` when not typing) — filters the list. */
|
|
204
|
+
this.editableQuery = signal(null, /* @ts-ignore */
|
|
205
|
+
...(ngDevMode ? [{ debugName: "editableQuery" }] : /* istanbul ignore next */ []));
|
|
206
|
+
/** @ignore Index of the visually focused option among the visible options (-1 = none). */
|
|
207
|
+
this.focusedIndex = signal(-1, /* @ts-ignore */
|
|
208
|
+
...(ngDevMode ? [{ debugName: "focusedIndex" }] : /* istanbul ignore next */ []));
|
|
209
|
+
/** @ignore Type-ahead buffer. */
|
|
210
|
+
this.searchBuffer = '';
|
|
211
|
+
// --- Derived state -----------------------------------------------------
|
|
212
|
+
/** @ignore Effective free-text mode (`multiple` wins over `editable`). */
|
|
213
|
+
this.isEditable = computed(() => this.editable() && !this.multiple(), /* @ts-ignore */
|
|
214
|
+
...(ngDevMode ? [{ debugName: "isEditable" }] : /* istanbul ignore next */ []));
|
|
215
|
+
/** @ignore */
|
|
216
|
+
this.listboxId = computed(() => `${this.resolvedId()}-list`, /* @ts-ignore */
|
|
217
|
+
...(ngDevMode ? [{ debugName: "listboxId" }] : /* istanbul ignore next */ []));
|
|
218
|
+
/** @ignore Icon size aligned with the field size. */
|
|
219
|
+
this.iconSize = computed(() => (this.size() === 'small' ? 'sm' : 'md'), /* @ts-ignore */
|
|
220
|
+
...(ngDevMode ? [{ debugName: "iconSize" }] : /* istanbul ignore next */ []));
|
|
221
|
+
/** @ignore Flat, unfiltered entries (no groups). */
|
|
222
|
+
this.flatEntries = computed(() => {
|
|
223
|
+
if (this.group())
|
|
224
|
+
return this.groupEntries().flatMap((g) => g.entries);
|
|
225
|
+
return (this.options() ?? []).map((option) => this.toEntry(option));
|
|
226
|
+
}, /* @ts-ignore */
|
|
227
|
+
...(ngDevMode ? [{ debugName: "flatEntries" }] : /* istanbul ignore next */ []));
|
|
228
|
+
/** @ignore Unfiltered groups (when `group` is enabled). */
|
|
229
|
+
this.groupEntries = computed(() => {
|
|
230
|
+
if (!this.group())
|
|
231
|
+
return [];
|
|
232
|
+
return (this.options() ?? []).map((groupOption) => {
|
|
233
|
+
const children = this.getField(groupOption, this.optionGroupChildren());
|
|
234
|
+
return {
|
|
235
|
+
label: this.asText(this.getField(groupOption, this.optionGroupLabel())) ?? '',
|
|
236
|
+
original: groupOption,
|
|
237
|
+
entries: (Array.isArray(children) ? children : []).map((option) => this.toEntry(option)),
|
|
238
|
+
};
|
|
239
|
+
});
|
|
240
|
+
}, /* @ts-ignore */
|
|
241
|
+
...(ngDevMode ? [{ debugName: "groupEntries" }] : /* istanbul ignore next */ []));
|
|
242
|
+
/** @ignore Normalized filter text ('' = no filtering). */
|
|
243
|
+
this.normalizedFilter = computed(() => this.normalize(this.filterValue().trim()), /* @ts-ignore */
|
|
244
|
+
...(ngDevMode ? [{ debugName: "normalizedFilter" }] : /* istanbul ignore next */ []));
|
|
245
|
+
/** @ignore Normalized editable-typing text ('' = no filtering). */
|
|
246
|
+
this.normalizedEditableQuery = computed(() => {
|
|
247
|
+
const query = this.editableQuery();
|
|
248
|
+
return this.isEditable() && query ? this.normalize(query.trim()) : '';
|
|
249
|
+
}, /* @ts-ignore */
|
|
250
|
+
...(ngDevMode ? [{ debugName: "normalizedEditableQuery" }] : /* istanbul ignore next */ []));
|
|
251
|
+
/** @ignore Rendered rows: filtered options + their group headers, with stable ids. */
|
|
252
|
+
this.visibleRows = computed(() => {
|
|
253
|
+
const rows = [];
|
|
254
|
+
let index = 0;
|
|
255
|
+
const pushOption = (entry) => {
|
|
256
|
+
rows.push({
|
|
257
|
+
kind: 'option',
|
|
258
|
+
key: `${this.listboxId()}-${index}`,
|
|
259
|
+
id: `${this.resolvedId()}-option-${index}`,
|
|
260
|
+
index,
|
|
261
|
+
entry,
|
|
262
|
+
selected: this.isValueSelected(entry.value),
|
|
263
|
+
});
|
|
264
|
+
index++;
|
|
265
|
+
};
|
|
266
|
+
if (this.group()) {
|
|
267
|
+
this.groupEntries().forEach((g, gi) => {
|
|
268
|
+
const entries = g.entries.filter((e) => this.matchesFilter(e));
|
|
269
|
+
if (!entries.length)
|
|
270
|
+
return;
|
|
271
|
+
rows.push({ kind: 'group', key: `${this.listboxId()}-group-${gi}`, label: g.label, original: g.original });
|
|
272
|
+
entries.forEach(pushOption);
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
this.flatEntries().filter((e) => this.matchesFilter(e)).forEach(pushOption);
|
|
277
|
+
}
|
|
278
|
+
return rows;
|
|
279
|
+
}, /* @ts-ignore */
|
|
280
|
+
...(ngDevMode ? [{ debugName: "visibleRows" }] : /* istanbul ignore next */ []));
|
|
281
|
+
/** @ignore Visible option rows only (visual-focus / type-ahead space). */
|
|
282
|
+
this.visibleOptions = computed(() => this.visibleRows().filter((r) => r.kind === 'option'), /* @ts-ignore */
|
|
283
|
+
...(ngDevMode ? [{ debugName: "visibleOptions" }] : /* istanbul ignore next */ []));
|
|
284
|
+
/** @ignore aria-setsize of the visible listbox. */
|
|
285
|
+
this.optionCount = computed(() => this.visibleOptions().length, /* @ts-ignore */
|
|
286
|
+
...(ngDevMode ? [{ debugName: "optionCount" }] : /* istanbul ignore next */ []));
|
|
287
|
+
/** @ignore trackBy of the virtual list. */
|
|
288
|
+
this.trackRow = (_, row) => row.key;
|
|
289
|
+
/** @ignore Empty state: no option at all, or nothing matches the filter / typed text. */
|
|
290
|
+
this.emptyLabel = computed(() => this.normalizedFilter() || this.normalizedEditableQuery() ? this.emptyFilterMessage() : this.emptyMessage(), /* @ts-ignore */
|
|
291
|
+
...(ngDevMode ? [{ debugName: "emptyLabel" }] : /* istanbul ignore next */ []));
|
|
292
|
+
/** @ignore Selected values as an array (whatever the mode). */
|
|
293
|
+
this.selectedValues = computed(() => {
|
|
294
|
+
const v = this.modelValue();
|
|
295
|
+
if (v === null || v === undefined)
|
|
296
|
+
return [];
|
|
297
|
+
return this.multiple() ? (Array.isArray(v) ? v : []) : [v];
|
|
298
|
+
}, /* @ts-ignore */
|
|
299
|
+
...(ngDevMode ? [{ debugName: "selectedValues" }] : /* istanbul ignore next */ []));
|
|
300
|
+
/** @ignore Selected options resolved against the (unfiltered) entries. Falls back to the raw value. */
|
|
301
|
+
this.selectedEntries = computed(() => this.selectedValues().map((value) => this.flatEntries().find((e) => this.equals(e.value, value)) ?? {
|
|
302
|
+
value,
|
|
303
|
+
label: this.asText(value) ?? '',
|
|
304
|
+
disabled: false,
|
|
305
|
+
original: value,
|
|
306
|
+
}), /* @ts-ignore */
|
|
307
|
+
...(ngDevMode ? [{ debugName: "selectedEntries" }] : /* istanbul ignore next */ []));
|
|
308
|
+
/** @ignore A value is currently set. */
|
|
309
|
+
this.hasValue = computed(() => {
|
|
310
|
+
if (this.multiple())
|
|
311
|
+
return this.selectedValues().length > 0;
|
|
312
|
+
const v = this.modelValue();
|
|
313
|
+
return v !== null && v !== undefined && v !== '';
|
|
314
|
+
}, /* @ts-ignore */
|
|
315
|
+
...(ngDevMode ? [{ debugName: "hasValue" }] : /* istanbul ignore next */ []));
|
|
316
|
+
/** @ignore Selected entries actually rendered in the trigger (`maxSelectedLabels` cap). */
|
|
317
|
+
this.displayedSelectedEntries = computed(() => {
|
|
318
|
+
const all = this.selectedEntries();
|
|
319
|
+
const max = this.maxSelectedLabels();
|
|
320
|
+
return this.multiple() && max != null && max > 0 && all.length > max ? all.slice(0, max) : all;
|
|
321
|
+
}, /* @ts-ignore */
|
|
322
|
+
...(ngDevMode ? [{ debugName: "displayedSelectedEntries" }] : /* istanbul ignore next */ []));
|
|
323
|
+
/** @ignore Number of selected items collapsed behind the overflow indicator. */
|
|
324
|
+
this.overflowCount = computed(() => this.selectedEntries().length - this.displayedSelectedEntries().length, /* @ts-ignore */
|
|
325
|
+
...(ngDevMode ? [{ debugName: "overflowCount" }] : /* istanbul ignore next */ []));
|
|
326
|
+
/** @ignore Rendered overflow indicator (e.g. `(+2 autres)`). */
|
|
327
|
+
this.overflowText = computed(() => formatLabel(this.overflowLabel(), this.overflowCount()), /* @ts-ignore */
|
|
328
|
+
...(ngDevMode ? [{ debugName: "overflowText" }] : /* istanbul ignore next */ []));
|
|
329
|
+
/** @ignore Contexts handed to the `#selectedItem` template (one per displayed selection). */
|
|
330
|
+
this.selectedItemContexts = computed(() => this.displayedSelectedEntries().map((entry, index) => ({
|
|
331
|
+
$implicit: entry.original,
|
|
332
|
+
option: entry.original,
|
|
333
|
+
index,
|
|
334
|
+
remove: () => this.removeValue(entry.value),
|
|
335
|
+
})), /* @ts-ignore */
|
|
336
|
+
...(ngDevMode ? [{ debugName: "selectedItemContexts" }] : /* istanbul ignore next */ []));
|
|
337
|
+
/** @ignore Text rendered in the trigger (and in the editable input). */
|
|
338
|
+
this.selectedLabel = computed(() => {
|
|
339
|
+
const shown = this.displayedSelectedEntries().map((e) => e.label).join(', ');
|
|
340
|
+
return this.overflowCount() > 0 ? `${shown} ${this.overflowText()}` : shown;
|
|
341
|
+
}, /* @ts-ignore */
|
|
342
|
+
...(ngDevMode ? [{ debugName: "selectedLabel" }] : /* istanbul ignore next */ []));
|
|
343
|
+
/** @ignore The clear action is shown. */
|
|
344
|
+
this.showClearButton = computed(() => this.showClear() && this.hasValue() && !this.isDisabled() && !this.readonly(), /* @ts-ignore */
|
|
345
|
+
...(ngDevMode ? [{ debugName: "showClearButton" }] : /* istanbul ignore next */ []));
|
|
346
|
+
/** @ignore id of the visually focused option (for aria-activedescendant). */
|
|
347
|
+
this.activeDescendant = computed(() => {
|
|
348
|
+
if (!this.panelOpen())
|
|
349
|
+
return null;
|
|
350
|
+
return this.visibleOptions()[this.focusedIndex()]?.id ?? null;
|
|
351
|
+
}, /* @ts-ignore */
|
|
352
|
+
...(ngDevMode ? [{ debugName: "activeDescendant" }] : /* istanbul ignore next */ []));
|
|
353
|
+
/** @ignore Below the trigger, flipping above when `autoFlip` and space is lacking. */
|
|
354
|
+
this.overlayPositions = computed(() => dropdownOverlayPositions(this.autoFlip()), /* @ts-ignore */
|
|
355
|
+
...(ngDevMode ? [{ debugName: "overlayPositions" }] : /* istanbul ignore next */ []));
|
|
356
|
+
/** @ignore Panel width: `panelWidth` when set, the field width otherwise. */
|
|
357
|
+
this.panelStyleWidth = computed(() => {
|
|
358
|
+
const width = this.panelWidth();
|
|
359
|
+
if (width)
|
|
360
|
+
return width === 'auto' ? null : width;
|
|
361
|
+
const measured = this.overlayWidth();
|
|
362
|
+
return measured === null ? null : `${measured}px`;
|
|
363
|
+
}, /* @ts-ignore */
|
|
364
|
+
...(ngDevMode ? [{ debugName: "panelStyleWidth" }] : /* istanbul ignore next */ []));
|
|
365
|
+
/** @ignore `panelWidth="auto"`: the field width becomes a floor, the content sets the rest. */
|
|
366
|
+
this.panelStyleMinWidth = computed(() => {
|
|
367
|
+
if (this.panelWidth() !== 'auto')
|
|
368
|
+
return null;
|
|
369
|
+
const measured = this.overlayWidth();
|
|
370
|
+
return measured === null ? null : `${measured}px`;
|
|
371
|
+
}, /* @ts-ignore */
|
|
372
|
+
...(ngDevMode ? [{ debugName: "panelStyleMinWidth" }] : /* istanbul ignore next */ []));
|
|
373
|
+
/** @ignore Concrete viewport height (px) for the virtual scroller. */
|
|
374
|
+
this.viewportHeight = computed(() => {
|
|
375
|
+
const rows = this.visibleRows().length || 1;
|
|
376
|
+
const max = this.scrollHeightPx();
|
|
377
|
+
return `${Math.min(rows * this.virtualScrollItemSize(), max)}px`;
|
|
378
|
+
}, /* @ts-ignore */
|
|
379
|
+
...(ngDevMode ? [{ debugName: "viewportHeight" }] : /* istanbul ignore next */ []));
|
|
380
|
+
/** @ignore `scrollHeight` parsed to px, with size-based defaults (matches the SCSS). */
|
|
381
|
+
this.scrollHeightPx = computed(() => {
|
|
382
|
+
const parsed = Number.parseFloat(this.scrollHeight() ?? '');
|
|
383
|
+
if (!Number.isNaN(parsed) && parsed > 0)
|
|
384
|
+
return parsed;
|
|
385
|
+
return this.size() === 'small' ? 256 : 312;
|
|
386
|
+
}, /* @ts-ignore */
|
|
387
|
+
...(ngDevMode ? [{ debugName: "scrollHeightPx" }] : /* istanbul ignore next */ []));
|
|
388
|
+
// --- Option resolution ----------------------------------------------------------
|
|
389
|
+
/** @ignore Shared option resolution (see `option-resolver.ts`). */
|
|
390
|
+
this.resolver = createOptionResolver({
|
|
391
|
+
optionValue: this.optionValue,
|
|
392
|
+
optionLabel: this.optionLabel,
|
|
393
|
+
optionDisabled: this.optionDisabled,
|
|
394
|
+
dataKey: this.dataKey,
|
|
395
|
+
});
|
|
396
|
+
// Never carry an open panel over to the next page (the field can live in
|
|
397
|
+
// an app shell that survives the navigation).
|
|
398
|
+
closeOnNavigation(() => this.close(false));
|
|
399
|
+
// Forward the rendered range of the virtual viewport (lazy loading).
|
|
400
|
+
effect((onCleanup) => {
|
|
401
|
+
const vp = this.viewport();
|
|
402
|
+
if (!vp || !this.lazy())
|
|
403
|
+
return;
|
|
404
|
+
const sub = vp.renderedRangeStream.subscribe((range) => this.lazyLoad.emit({ first: range.start, last: range.end }));
|
|
405
|
+
onCleanup(() => sub.unsubscribe());
|
|
406
|
+
});
|
|
407
|
+
// Re-measure the virtual viewport once it exists: it initialises while the
|
|
408
|
+
// overlay panel is still laying out and can capture a 0 viewport size,
|
|
409
|
+
// which freezes the rendered range on the first rows.
|
|
410
|
+
effect(() => {
|
|
411
|
+
const vp = this.viewport();
|
|
412
|
+
if (!vp)
|
|
413
|
+
return;
|
|
414
|
+
setTimeout(() => {
|
|
415
|
+
vp.checkViewportSize();
|
|
416
|
+
this.scrollFocusedIntoView();
|
|
417
|
+
});
|
|
418
|
+
});
|
|
419
|
+
// A11y / API safeguards (dev only).
|
|
420
|
+
if (isDevMode()) {
|
|
421
|
+
effect(() => {
|
|
422
|
+
if (!this.label() && !this.ariaLabel() && !this.ariaLabelledBy()) {
|
|
423
|
+
console.warn('[ui-select] Field has no accessible name: provide `label`, `ariaLabel` or `ariaLabelledBy`.');
|
|
424
|
+
}
|
|
425
|
+
if (this.editable() && this.multiple()) {
|
|
426
|
+
console.warn('[ui-select] `editable` is ignored in `multiple` mode (free-text entry is single-value only).');
|
|
427
|
+
}
|
|
428
|
+
if (this.checkbox() && !this.multiple()) {
|
|
429
|
+
console.warn('[ui-select] `checkbox` is meant for `multiple` mode (one checkbox per option).');
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
// --- CVA -----------------------------------------------------------------
|
|
435
|
+
writeValue(value) {
|
|
436
|
+
this.modelValue.set(value);
|
|
437
|
+
}
|
|
438
|
+
/** Moves focus to the trigger. */
|
|
439
|
+
focus(options) {
|
|
440
|
+
this.triggerEl()?.nativeElement.focus(options);
|
|
441
|
+
}
|
|
442
|
+
// --- Panel open/close ----------------------------------------------------
|
|
443
|
+
open() {
|
|
444
|
+
if (this.isDisabled() || this.readonly() || this.panelOpen())
|
|
445
|
+
return;
|
|
446
|
+
const origin = this.containerEl().nativeElement.querySelector('.ui-field-box') ?? this.containerEl().nativeElement;
|
|
447
|
+
this.overlayOrigin.set(origin);
|
|
448
|
+
this.overlayWidth.set(origin.getBoundingClientRect().width);
|
|
449
|
+
this.focusedIndex.set(this.initialFocusIndex());
|
|
450
|
+
this.panelOpen.set(true);
|
|
451
|
+
this.opened.emit();
|
|
452
|
+
this.queueAfterOpen();
|
|
453
|
+
}
|
|
454
|
+
close(focusTrigger = true) {
|
|
455
|
+
if (!this.panelOpen())
|
|
456
|
+
return;
|
|
457
|
+
this.panelOpen.set(false);
|
|
458
|
+
this.clearSearchBuffer();
|
|
459
|
+
this.editableQuery.set(null);
|
|
460
|
+
if (this.resetFilterOnHide())
|
|
461
|
+
this.filterValue.set('');
|
|
462
|
+
this.emitTouch();
|
|
463
|
+
this.closed.emit();
|
|
464
|
+
if (focusTrigger)
|
|
465
|
+
this.focus();
|
|
466
|
+
}
|
|
467
|
+
/** @ignore */
|
|
468
|
+
toggle() {
|
|
469
|
+
this.panelOpen() ? this.close() : this.open();
|
|
470
|
+
}
|
|
471
|
+
/** @ignore First visually focused option when the panel opens. */
|
|
472
|
+
initialFocusIndex() {
|
|
473
|
+
const options = this.visibleOptions();
|
|
474
|
+
const selected = options.findIndex((o) => o.selected && !o.entry.disabled);
|
|
475
|
+
if (selected !== -1)
|
|
476
|
+
return selected;
|
|
477
|
+
if (this.autoOptionFocus())
|
|
478
|
+
return options.findIndex((o) => !o.entry.disabled);
|
|
479
|
+
return -1;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* @ignore Post-open work once the overlay is attached: focus the filter,
|
|
483
|
+
* scroll the focused option into view (the virtual viewport is re-measured
|
|
484
|
+
* by its own effect). `setTimeout` (not rAF) so it also runs in
|
|
485
|
+
* throttled/background tabs.
|
|
486
|
+
*/
|
|
487
|
+
queueAfterOpen() {
|
|
488
|
+
setTimeout(() => {
|
|
489
|
+
// Never steal the focus from the editable input while the user types.
|
|
490
|
+
if (this.filter() && this.autofocusFilter() && !this.isEditable())
|
|
491
|
+
this.filterInputEl()?.nativeElement.focus();
|
|
492
|
+
this.scrollFocusedIntoView();
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
// --- Trigger interactions --------------------------------------------------
|
|
496
|
+
/** @ignore Container click: open (button mode) or toggle from the chevron (editable mode). */
|
|
497
|
+
onContainerClick(event) {
|
|
498
|
+
if (this.isDisabled() || this.readonly())
|
|
499
|
+
return;
|
|
500
|
+
const target = event.target;
|
|
501
|
+
// Inner actions (clear, chip remove buttons in `#selectedItem`…) handle themselves.
|
|
502
|
+
if (target.closest('button') && !target.closest('.ui-select-trigger'))
|
|
503
|
+
return;
|
|
504
|
+
if (this.isEditable()) {
|
|
505
|
+
if (target.closest('.ui-select-chevron'))
|
|
506
|
+
this.toggle();
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
this.open();
|
|
510
|
+
}
|
|
511
|
+
/** @ignore Clear action (does not bubble to the container, which would re-open). */
|
|
512
|
+
onClearClick(event) {
|
|
513
|
+
event.stopPropagation();
|
|
514
|
+
this.clear();
|
|
515
|
+
}
|
|
516
|
+
/** Clears the value. */
|
|
517
|
+
clear() {
|
|
518
|
+
this.commit(null);
|
|
519
|
+
// Editable mode: drop any typed text still filtering the list — the
|
|
520
|
+
// trigger just went blank, the panel (if open) must show every option again,
|
|
521
|
+
// not the stale query's matches (same reset `selectRow`/`close` already do).
|
|
522
|
+
this.editableQuery.set(null);
|
|
523
|
+
this.cleared.emit();
|
|
524
|
+
this.focus();
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* @ignore Editable mode: typing sets the value directly (view → form) and
|
|
528
|
+
* surfaces the matching options (the panel opens and filters as you type).
|
|
529
|
+
*/
|
|
530
|
+
onEditableInput(event) {
|
|
531
|
+
const value = event.target.value;
|
|
532
|
+
this.editableQuery.set(value);
|
|
533
|
+
// An emptied input commits `null` (same normalization as `clear()`).
|
|
534
|
+
this.commit(value === '' ? null : value);
|
|
535
|
+
if (!this.panelOpen())
|
|
536
|
+
this.open();
|
|
537
|
+
// Re-anchor the visual focus on the first matching option.
|
|
538
|
+
this.focusedIndex.set(this.visibleOptions().findIndex((o) => !o.entry.disabled));
|
|
539
|
+
}
|
|
540
|
+
/** Deselects one value (`multiple`) or clears the value (single). */
|
|
541
|
+
removeValue(value) {
|
|
542
|
+
if (this.isDisabled() || this.readonly())
|
|
543
|
+
return;
|
|
544
|
+
if (!this.multiple()) {
|
|
545
|
+
this.commit(null);
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
const current = this.selectedValues().filter((v) => !this.equals(v, value));
|
|
549
|
+
this.commit(current);
|
|
550
|
+
}
|
|
551
|
+
/** @ignore */
|
|
552
|
+
onTriggerFocus(event) {
|
|
553
|
+
this.inputFocus.emit(event);
|
|
554
|
+
}
|
|
555
|
+
/** @ignore Mark touched when focus leaves the component (trigger → outside, not into the panel). */
|
|
556
|
+
onTriggerBlur(event) {
|
|
557
|
+
const next = event.relatedTarget;
|
|
558
|
+
if (!next || !this.panelEl()?.nativeElement.contains(next))
|
|
559
|
+
this.emitTouch();
|
|
560
|
+
this.inputBlur.emit(event);
|
|
561
|
+
}
|
|
562
|
+
/** @ignore Keyboard on the trigger (combobox pattern). */
|
|
563
|
+
onTriggerKeydown(event) {
|
|
564
|
+
if (this.isDisabled() || this.readonly())
|
|
565
|
+
return;
|
|
566
|
+
// Multiple: Backspace deselects the last selected item (chip-removal keyboard path).
|
|
567
|
+
if (event.key === 'Backspace' && !this.isEditable() && this.multiple() && this.hasValue()) {
|
|
568
|
+
event.preventDefault();
|
|
569
|
+
const values = this.selectedValues();
|
|
570
|
+
this.removeValue(values[values.length - 1]);
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
if (this.handleNavigationKey(event))
|
|
574
|
+
return;
|
|
575
|
+
// Type-ahead (button trigger only — the editable input types for real).
|
|
576
|
+
if (!this.isEditable() && event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
|
|
577
|
+
event.preventDefault();
|
|
578
|
+
if (!this.panelOpen())
|
|
579
|
+
this.open();
|
|
580
|
+
this.searchOption(event.key);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
/** @ignore Keyboard inside the filter input (navigation delegated, typing kept native). */
|
|
584
|
+
onFilterKeydown(event) {
|
|
585
|
+
if (event.key === 'Home' || event.key === 'End')
|
|
586
|
+
return; // keep caret moves native
|
|
587
|
+
this.handleNavigationKey(event);
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* @ignore Shared open/navigate/select/close keys. Returns true when handled.
|
|
591
|
+
* Focus stays on the trigger / filter input; options are focused visually
|
|
592
|
+
* through `aria-activedescendant`.
|
|
593
|
+
*/
|
|
594
|
+
handleNavigationKey(event) {
|
|
595
|
+
switch (event.key) {
|
|
596
|
+
case 'ArrowDown':
|
|
597
|
+
event.preventDefault();
|
|
598
|
+
if (!this.panelOpen()) {
|
|
599
|
+
this.open();
|
|
600
|
+
if (this.focusedIndex() === -1)
|
|
601
|
+
this.moveFocus(1);
|
|
602
|
+
}
|
|
603
|
+
else {
|
|
604
|
+
this.moveFocus(1);
|
|
605
|
+
}
|
|
606
|
+
return true;
|
|
607
|
+
case 'ArrowUp':
|
|
608
|
+
event.preventDefault();
|
|
609
|
+
if (event.altKey) {
|
|
610
|
+
this.close();
|
|
611
|
+
}
|
|
612
|
+
else if (!this.panelOpen()) {
|
|
613
|
+
this.open();
|
|
614
|
+
if (this.focusedIndex() === -1)
|
|
615
|
+
this.moveFocus(-1);
|
|
616
|
+
}
|
|
617
|
+
else {
|
|
618
|
+
this.moveFocus(-1);
|
|
619
|
+
}
|
|
620
|
+
return true;
|
|
621
|
+
case 'Home':
|
|
622
|
+
case 'End':
|
|
623
|
+
if (!this.panelOpen())
|
|
624
|
+
return false;
|
|
625
|
+
event.preventDefault();
|
|
626
|
+
this.focusEdge(event.key === 'Home' ? 1 : -1);
|
|
627
|
+
return true;
|
|
628
|
+
case 'Enter':
|
|
629
|
+
if (!this.panelOpen())
|
|
630
|
+
return false; // closed: native click (button) / form submit (input)
|
|
631
|
+
event.preventDefault();
|
|
632
|
+
this.selectFocused();
|
|
633
|
+
return true;
|
|
634
|
+
case ' ':
|
|
635
|
+
if (this.isEditable() || (this.filter() && event.target === this.filterInputEl()?.nativeElement)) {
|
|
636
|
+
return false; // space types in the inputs
|
|
637
|
+
}
|
|
638
|
+
if (!this.panelOpen())
|
|
639
|
+
return false; // closed button: native click opens
|
|
640
|
+
event.preventDefault();
|
|
641
|
+
this.selectFocused();
|
|
642
|
+
return true;
|
|
643
|
+
case 'Escape':
|
|
644
|
+
if (!this.panelOpen())
|
|
645
|
+
return false;
|
|
646
|
+
event.preventDefault();
|
|
647
|
+
event.stopPropagation();
|
|
648
|
+
this.close();
|
|
649
|
+
return true;
|
|
650
|
+
case 'Tab':
|
|
651
|
+
if (this.panelOpen())
|
|
652
|
+
this.close(false);
|
|
653
|
+
return false; // let the focus move on
|
|
654
|
+
default:
|
|
655
|
+
return false;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
// --- Options interactions --------------------------------------------------
|
|
659
|
+
/** @ignore */
|
|
660
|
+
onOptionClick(row, event) {
|
|
661
|
+
event.preventDefault();
|
|
662
|
+
if (this.loading())
|
|
663
|
+
return;
|
|
664
|
+
this.selectRow(row);
|
|
665
|
+
}
|
|
666
|
+
/** @ignore Keep the focus on the trigger / filter input when clicking an option. */
|
|
667
|
+
onOptionMousedown(event) {
|
|
668
|
+
event.preventDefault();
|
|
669
|
+
}
|
|
670
|
+
/** @ignore */
|
|
671
|
+
onOptionMouseEnter(row) {
|
|
672
|
+
if (this.focusOnHover() && !row.entry.disabled)
|
|
673
|
+
this.focusedIndex.set(row.index);
|
|
674
|
+
}
|
|
675
|
+
/** @ignore Select (single) or toggle (multiple) an option. */
|
|
676
|
+
selectRow(row, keepOpen = false) {
|
|
677
|
+
if (row.entry.disabled || this.readonly())
|
|
678
|
+
return;
|
|
679
|
+
this.focusedIndex.set(row.index);
|
|
680
|
+
this.editableQuery.set(null); // picking an option ends the typing session (display shows the label)
|
|
681
|
+
if (this.multiple()) {
|
|
682
|
+
const current = [...this.selectedValues()];
|
|
683
|
+
const at = current.findIndex((v) => this.equals(v, row.entry.value));
|
|
684
|
+
if (at !== -1)
|
|
685
|
+
current.splice(at, 1);
|
|
686
|
+
else
|
|
687
|
+
current.push(row.entry.value);
|
|
688
|
+
this.commit(current);
|
|
689
|
+
return; // multiple: the panel stays open
|
|
690
|
+
}
|
|
691
|
+
this.commit(row.entry.value);
|
|
692
|
+
if (!keepOpen)
|
|
693
|
+
this.close();
|
|
694
|
+
}
|
|
695
|
+
/** @ignore */
|
|
696
|
+
selectFocused() {
|
|
697
|
+
const row = this.visibleOptions()[this.focusedIndex()];
|
|
698
|
+
if (row)
|
|
699
|
+
this.selectRow(row);
|
|
700
|
+
else if (!this.multiple())
|
|
701
|
+
this.close();
|
|
702
|
+
}
|
|
703
|
+
/** @ignore Propagate a user-driven value change (view → form). */
|
|
704
|
+
commit(value) {
|
|
705
|
+
this.modelValue.set(value);
|
|
706
|
+
this.emitChange(value);
|
|
707
|
+
this.valueChange.emit(value);
|
|
708
|
+
}
|
|
709
|
+
// --- Visual focus ------------------------------------------------------------
|
|
710
|
+
/** @ignore Move the visual focus, skipping disabled options (no wrap). */
|
|
711
|
+
moveFocus(delta) {
|
|
712
|
+
const options = this.visibleOptions();
|
|
713
|
+
if (!options.length)
|
|
714
|
+
return;
|
|
715
|
+
let i = this.focusedIndex();
|
|
716
|
+
if (i === -1)
|
|
717
|
+
i = delta === 1 ? -1 : options.length;
|
|
718
|
+
for (i += delta; i >= 0 && i < options.length; i += delta) {
|
|
719
|
+
if (!options[i].entry.disabled) {
|
|
720
|
+
this.setFocusedIndex(i);
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
/** @ignore Focus the first (`1`) or last (`-1`) enabled option. */
|
|
726
|
+
focusEdge(direction) {
|
|
727
|
+
const options = this.visibleOptions();
|
|
728
|
+
const from = direction === 1 ? 0 : options.length - 1;
|
|
729
|
+
for (let i = from; i >= 0 && i < options.length; i += direction) {
|
|
730
|
+
if (!options[i].entry.disabled) {
|
|
731
|
+
this.setFocusedIndex(i);
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
/** @ignore Apply a visual-focus move (+ select-on-focus, + scroll into view). */
|
|
737
|
+
setFocusedIndex(index) {
|
|
738
|
+
this.focusedIndex.set(index);
|
|
739
|
+
if (this.selectOnFocus() && !this.multiple()) {
|
|
740
|
+
const row = this.visibleOptions()[index];
|
|
741
|
+
if (row)
|
|
742
|
+
this.selectRow(row, true);
|
|
743
|
+
}
|
|
744
|
+
this.scrollFocusedIntoView();
|
|
745
|
+
}
|
|
746
|
+
/** @ignore Keep the visually focused option visible ('auto' — smooth is unreliable in throttled tabs). */
|
|
747
|
+
scrollFocusedIntoView() {
|
|
748
|
+
const row = this.visibleOptions()[this.focusedIndex()];
|
|
749
|
+
if (!row)
|
|
750
|
+
return;
|
|
751
|
+
const vp = this.viewport();
|
|
752
|
+
if (vp) {
|
|
753
|
+
const rowIndex = this.visibleRows().findIndex((r) => r.kind === 'option' && r.index === row.index);
|
|
754
|
+
if (rowIndex !== -1)
|
|
755
|
+
vp.scrollToIndex(Math.max(0, rowIndex - 1), 'auto');
|
|
756
|
+
return;
|
|
757
|
+
}
|
|
758
|
+
this.panelEl()
|
|
759
|
+
?.nativeElement.querySelector(`[id="${row.id}"]`)
|
|
760
|
+
?.scrollIntoView({ block: 'nearest' });
|
|
761
|
+
}
|
|
762
|
+
// --- Type-ahead ---------------------------------------------------------------
|
|
763
|
+
/** @ignore Accumulate printable characters and focus the first matching option. */
|
|
764
|
+
searchOption(char) {
|
|
765
|
+
this.searchBuffer += char.toLowerCase();
|
|
766
|
+
if (this.searchTimeout)
|
|
767
|
+
clearTimeout(this.searchTimeout);
|
|
768
|
+
this.searchTimeout = setTimeout(() => this.clearSearchBuffer(), 500);
|
|
769
|
+
const options = this.visibleOptions();
|
|
770
|
+
if (!options.length)
|
|
771
|
+
return;
|
|
772
|
+
const needle = this.normalize(this.searchBuffer);
|
|
773
|
+
// Restart the scan below the focused option only for a fresh (1-char) search.
|
|
774
|
+
const from = this.searchBuffer.length === 1 ? this.focusedIndex() + 1 : Math.max(0, this.focusedIndex());
|
|
775
|
+
for (let k = 0; k < options.length; k++) {
|
|
776
|
+
const i = (from + k) % options.length;
|
|
777
|
+
const option = options[i];
|
|
778
|
+
if (!option.entry.disabled && this.normalize(option.entry.label).startsWith(needle)) {
|
|
779
|
+
this.setFocusedIndex(i);
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
/** @ignore */
|
|
785
|
+
clearSearchBuffer() {
|
|
786
|
+
this.searchBuffer = '';
|
|
787
|
+
if (this.searchTimeout) {
|
|
788
|
+
clearTimeout(this.searchTimeout);
|
|
789
|
+
this.searchTimeout = undefined;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
// --- Filter -------------------------------------------------------------------
|
|
793
|
+
/** @ignore */
|
|
794
|
+
onFilterInput(event) {
|
|
795
|
+
const value = event.target.value;
|
|
796
|
+
this.filterValue.set(value);
|
|
797
|
+
this.filterChange.emit({ originalEvent: event, filter: value });
|
|
798
|
+
// Re-anchor the visual focus on the first matching option.
|
|
799
|
+
const first = this.visibleOptions().findIndex((o) => !o.entry.disabled);
|
|
800
|
+
this.focusedIndex.set(first);
|
|
801
|
+
}
|
|
802
|
+
/** @ignore An entry passes the current filter(s): panel filter and/or editable typing. */
|
|
803
|
+
matchesFilter(entry) {
|
|
804
|
+
const needles = [this.normalizedFilter(), this.normalizedEditableQuery()].filter(Boolean);
|
|
805
|
+
if (!needles.length)
|
|
806
|
+
return true;
|
|
807
|
+
const fields = this.filterBy()
|
|
808
|
+
?.split(',')
|
|
809
|
+
.map((f) => f.trim())
|
|
810
|
+
.filter(Boolean);
|
|
811
|
+
const haystacks = fields?.length
|
|
812
|
+
? fields.map((f) => this.asText(this.getField(entry.original, f)) ?? '')
|
|
813
|
+
: [entry.label];
|
|
814
|
+
return needles.every((needle) => haystacks.some((text) => this.normalize(text).includes(needle)));
|
|
815
|
+
}
|
|
816
|
+
/** @ignore Case- and diacritics-insensitive comparison text. */
|
|
817
|
+
normalize(text) {
|
|
818
|
+
return text
|
|
819
|
+
.toLowerCase()
|
|
820
|
+
.normalize('NFD')
|
|
821
|
+
.replace(/[̀-ͯ]/g, '');
|
|
822
|
+
}
|
|
823
|
+
/** @ignore */
|
|
824
|
+
toEntry(option) {
|
|
825
|
+
return this.resolver.toEntry(option);
|
|
826
|
+
}
|
|
827
|
+
/** @ignore Read a (dot-path) field from an object. */
|
|
828
|
+
getField(target, path) {
|
|
829
|
+
return this.resolver.getField(target, path);
|
|
830
|
+
}
|
|
831
|
+
/** @ignore */
|
|
832
|
+
resolveValue(option) {
|
|
833
|
+
return this.resolver.resolveValue(option);
|
|
834
|
+
}
|
|
835
|
+
/** @ignore */
|
|
836
|
+
resolveLabel(option) {
|
|
837
|
+
return this.resolver.resolveLabel(option);
|
|
838
|
+
}
|
|
839
|
+
/** @ignore */
|
|
840
|
+
asText(value) {
|
|
841
|
+
return this.resolver.asText(value);
|
|
842
|
+
}
|
|
843
|
+
/** @ignore Whether a resolved value is part of the current model. */
|
|
844
|
+
isValueSelected(value) {
|
|
845
|
+
return this.selectedValues().some((v) => this.equals(v, value));
|
|
846
|
+
}
|
|
847
|
+
/** @ignore Value equality — by `dataKey` for objects, strict otherwise. */
|
|
848
|
+
equals(a, b) {
|
|
849
|
+
return this.resolver.equals(a, b);
|
|
850
|
+
}
|
|
851
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: UiSelect, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
852
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: UiSelect, isStandalone: true, selector: "ui-select", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: false, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: false, transformFunction: null }, optionDisabled: { classPropertyName: "optionDisabled", publicName: "optionDisabled", isSignal: true, isRequired: false, transformFunction: null }, group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: false, transformFunction: null }, optionGroupLabel: { classPropertyName: "optionGroupLabel", publicName: "optionGroupLabel", isSignal: true, isRequired: false, transformFunction: null }, optionGroupChildren: { classPropertyName: "optionGroupChildren", publicName: "optionGroupChildren", isSignal: true, isRequired: false, transformFunction: null }, dataKey: { classPropertyName: "dataKey", publicName: "dataKey", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, checkmark: { classPropertyName: "checkmark", publicName: "checkmark", isSignal: true, isRequired: false, transformFunction: null }, checkbox: { classPropertyName: "checkbox", publicName: "checkbox", isSignal: true, isRequired: false, transformFunction: null }, maxSelectedLabels: { classPropertyName: "maxSelectedLabels", publicName: "maxSelectedLabels", isSignal: true, isRequired: false, transformFunction: null }, overflowLabel: { classPropertyName: "overflowLabel", publicName: "overflowLabel", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, showClear: { classPropertyName: "showClear", publicName: "showClear", isSignal: true, isRequired: false, transformFunction: null }, clearAriaLabel: { classPropertyName: "clearAriaLabel", publicName: "clearAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, filterPlaceholder: { classPropertyName: "filterPlaceholder", publicName: "filterPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, filterAriaLabel: { classPropertyName: "filterAriaLabel", publicName: "filterAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, filterBy: { classPropertyName: "filterBy", publicName: "filterBy", isSignal: true, isRequired: false, transformFunction: null }, autofocusFilter: { classPropertyName: "autofocusFilter", publicName: "autofocusFilter", isSignal: true, isRequired: false, transformFunction: null }, resetFilterOnHide: { classPropertyName: "resetFilterOnHide", publicName: "resetFilterOnHide", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, emptyFilterMessage: { classPropertyName: "emptyFilterMessage", publicName: "emptyFilterMessage", isSignal: true, isRequired: false, transformFunction: null }, editable: { classPropertyName: "editable", publicName: "editable", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, autoOptionFocus: { classPropertyName: "autoOptionFocus", publicName: "autoOptionFocus", isSignal: true, isRequired: false, transformFunction: null }, selectOnFocus: { classPropertyName: "selectOnFocus", publicName: "selectOnFocus", isSignal: true, isRequired: false, transformFunction: null }, focusOnHover: { classPropertyName: "focusOnHover", publicName: "focusOnHover", isSignal: true, isRequired: false, transformFunction: null }, virtualScroll: { classPropertyName: "virtualScroll", publicName: "virtualScroll", isSignal: true, isRequired: false, transformFunction: null }, virtualScrollItemSize: { classPropertyName: "virtualScrollItemSize", publicName: "virtualScrollItemSize", isSignal: true, isRequired: false, transformFunction: null }, lazy: { classPropertyName: "lazy", publicName: "lazy", isSignal: true, isRequired: false, transformFunction: null }, scrollHeight: { classPropertyName: "scrollHeight", publicName: "scrollHeight", isSignal: true, isRequired: false, transformFunction: null }, autoFlip: { classPropertyName: "autoFlip", publicName: "autoFlip", isSignal: true, isRequired: false, transformFunction: null }, panelStyleClass: { classPropertyName: "panelStyleClass", publicName: "panelStyleClass", isSignal: true, isRequired: false, transformFunction: null }, panelWidth: { classPropertyName: "panelWidth", publicName: "panelWidth", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", opened: "opened", closed: "closed", cleared: "cleared", filterChange: "filterChange", lazyLoad: "lazyLoad", inputFocus: "inputFocus", inputBlur: "inputBlur" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiSelect), multi: true }], queries: [{ propertyName: "itemTemplate", first: true, predicate: ["item"], descendants: true, isSignal: true }, { propertyName: "selectedItemTemplate", first: true, predicate: ["selectedItem"], descendants: true, isSignal: true }, { propertyName: "groupTemplate", first: true, predicate: ["group"], descendants: true, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: ["header"], descendants: true, isSignal: true }, { propertyName: "footerTemplate", first: true, predicate: ["footer"], descendants: true, isSignal: true }, { propertyName: "emptyTemplate", first: true, predicate: ["empty"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "containerEl", first: true, predicate: ["container"], descendants: true, isSignal: true }, { propertyName: "triggerEl", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "panelEl", first: true, predicate: ["panel"], descendants: true, isSignal: true }, { propertyName: "filterInputEl", first: true, predicate: ["filterInput"], descendants: true, isSignal: true }, { propertyName: "viewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<!-- One rendered row: group header or option (shared by the plain and virtual lists). -->\n<ng-template #rowTpl let-row>\n @if (row.kind === 'group') {\n <li class=\"ui-select-group\" role=\"presentation\" [class._small]=\"size() === 'small'\">\n @if (groupTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"{ $implicit: row.original, group: row.original }\" />\n } @else {\n {{ row.label }}\n }\n </li>\n } @else {\n <!-- ARIA combobox/listbox pattern: keyboard and focus are handled by\n the trigger role=\"combobox\" (roving via aria-activedescendant). -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <li\n class=\"ui-select-option\"\n role=\"option\"\n [attr.id]=\"row.id\"\n [class._small]=\"size() === 'small'\"\n [class._selected]=\"row.selected\"\n [class._focused]=\"row.index === focusedIndex()\"\n [class._disabled]=\"row.entry.disabled\"\n [attr.aria-selected]=\"row.selected\"\n [attr.aria-disabled]=\"row.entry.disabled || null\"\n [attr.aria-setsize]=\"optionCount()\"\n [attr.aria-posinset]=\"row.index + 1\"\n (mousedown)=\"onOptionMousedown($event)\"\n (click)=\"onOptionClick(row, $event)\"\n (mouseenter)=\"onOptionMouseEnter(row)\"\n >\n @if (checkbox() && multiple()) {\n <!-- Purely visual checkbox: the option itself carries the aria-selected state. -->\n <span class=\"ui-select-checkbox\" [class._checked]=\"row.selected\" aria-hidden=\"true\">\n <ui-icon class=\"ui-select-checkbox-icon\" name=\"check\" size=\"sm\" />\n </span>\n }\n @if (itemTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{ $implicit: row.entry.original, option: row.entry.original, selected: row.selected, index: row.index }\"\n />\n } @else {\n <span class=\"ui-select-option-label\">{{ row.entry.label }}</span>\n }\n @if (checkmark() && row.selected) {\n <ui-icon class=\"ui-select-checkmark\" name=\"check\" [size]=\"iconSize()\" />\n }\n </li>\n }\n</ng-template>\n\n<!-- Options panel (CDK overlay). -->\n<ng-template #panelTpl>\n <div\n #panel\n class=\"ui-select-panel\"\n [class]=\"panelStyleClass()\"\n [class._small]=\"size() === 'small'\"\n [style.width]=\"panelStyleWidth()\"\n [style.min-width]=\"panelStyleMinWidth()\"\n [uiMotion]=\"'slide-down'\"\n #panelMotion=\"uiMotion\"\n motionOnInsert\n >\n @if (headerTemplate(); as tpl) {\n <div class=\"ui-select-header\">\n <ng-container [ngTemplateOutlet]=\"tpl\" />\n </div>\n }\n\n @if (filter()) {\n <div class=\"ui-select-filter\" [class._small]=\"size() === 'small'\">\n <ui-icon class=\"ui-select-filter-icon\" name=\"magnifying-glass\" size=\"sm\" />\n <input\n #filterInput\n type=\"text\"\n class=\"ui-select-filter-input\"\n autocomplete=\"off\"\n role=\"searchbox\"\n [value]=\"filterValue()\"\n [placeholder]=\"filterPlaceholder() ?? ''\"\n [attr.aria-label]=\"filterAriaLabel()\"\n [attr.aria-controls]=\"listboxId()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n (input)=\"onFilterInput($event)\"\n (keydown)=\"onFilterKeydown($event)\"\n />\n </div>\n }\n\n @if (virtualScroll()) {\n <cdk-virtual-scroll-viewport\n class=\"ui-select-viewport\"\n [itemSize]=\"virtualScrollItemSize()\"\n [style.height]=\"viewportHeight()\"\n >\n <ul\n class=\"ui-select-list\"\n role=\"listbox\"\n [attr.id]=\"listboxId()\"\n [attr.aria-label]=\"label() || ariaLabel() || null\"\n [attr.aria-multiselectable]=\"multiple() ? 'true' : null\"\n >\n <ng-container *cdkVirtualFor=\"let row of visibleRows(); trackBy: trackRow\">\n <ng-container [ngTemplateOutlet]=\"rowTpl\" [ngTemplateOutletContext]=\"{ $implicit: row }\" />\n </ng-container>\n @if (!visibleRows().length) {\n <ng-container [ngTemplateOutlet]=\"emptyTpl\" />\n }\n </ul>\n </cdk-virtual-scroll-viewport>\n } @else {\n <div class=\"ui-select-scroller\" [class._small]=\"size() === 'small'\" [style.max-height]=\"scrollHeight() || null\">\n <ul\n class=\"ui-select-list\"\n role=\"listbox\"\n [attr.id]=\"listboxId()\"\n [attr.aria-label]=\"label() || ariaLabel() || null\"\n [attr.aria-multiselectable]=\"multiple() ? 'true' : null\"\n >\n @for (row of visibleRows(); track row.key) {\n <ng-container [ngTemplateOutlet]=\"rowTpl\" [ngTemplateOutletContext]=\"{ $implicit: row }\" />\n } @empty {\n <ng-container [ngTemplateOutlet]=\"emptyTpl\" />\n }\n </ul>\n </div>\n }\n\n @if (footerTemplate(); as tpl) {\n <div class=\"ui-select-footer\">\n <ng-container [ngTemplateOutlet]=\"tpl\" />\n </div>\n }\n </div>\n</ng-template>\n\n<!-- Empty state row. -->\n<ng-template #emptyTpl>\n <li class=\"ui-select-empty\" role=\"presentation\">\n @if (emptyTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" />\n } @else {\n {{ emptyLabel() }}\n }\n </li>\n</ng-template>\n\n<!-- Trigger: composed field. Clicking the box opens the panel (backdrop closes it). -->\n<!-- Convenience click on the wrapper: focus and keyboard are carried by\n the inner trigger role=\"combobox\". -->\n<!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n<div #container class=\"ui-select\" [class._editable]=\"isEditable()\" (click)=\"onContainerClick($event)\">\n <ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [autoHeight]=\"multiple()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n >\n @if (isEditable()) {\n <input\n #trigger\n type=\"text\"\n class=\"ui-select-native\"\n [class._small]=\"size() === 'small'\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n [id]=\"resolvedId()\"\n [value]=\"selectedLabel()\"\n [placeholder]=\"placeholder() ?? ''\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-expanded]=\"panelOpen()\"\n [attr.aria-controls]=\"panelOpen() ? listboxId() : null\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"displayMessage() ? messageId() : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onEditableInput($event)\"\n (keydown)=\"onTriggerKeydown($event)\"\n (focus)=\"onTriggerFocus($event)\"\n (blur)=\"onTriggerBlur($event)\"\n />\n } @else {\n <!-- Multiple + #selectedItem: the values (e.g. removable chips) live OUTSIDE the\n combobox button so their own buttons stay valid, interactive HTML. -->\n @if (multiple() && selectedItemTemplate() && hasValue()) {\n <div class=\"ui-select-values\">\n @for (ctx of selectedItemContexts(); track $index) {\n <ng-container [ngTemplateOutlet]=\"selectedItemTemplate()!\" [ngTemplateOutletContext]=\"ctx\" />\n }\n @if (overflowCount() > 0) {\n <span class=\"ui-select-overflow\" [class._small]=\"size() === 'small'\">{{ overflowText() }}</span>\n }\n </div>\n }\n <button\n #trigger\n type=\"button\"\n class=\"ui-select-trigger\"\n [class._small]=\"size() === 'small'\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n [id]=\"resolvedId()\"\n [disabled]=\"isDisabled()\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-expanded]=\"panelOpen()\"\n [attr.aria-controls]=\"panelOpen() ? listboxId() : null\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"displayMessage() ? messageId() : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (keydown)=\"onTriggerKeydown($event)\"\n (focus)=\"onTriggerFocus($event)\"\n (blur)=\"onTriggerBlur($event)\"\n >\n @if (multiple() && selectedItemTemplate() && hasValue()) {\n <!-- Accessible value of the combobox (the visual value is the chips next to it). -->\n <span class=\"ui-select-sr\">{{ selectedLabel() }}</span>\n } @else if (!multiple() && selectedItemTemplate() && hasValue()) {\n <ng-container [ngTemplateOutlet]=\"selectedItemTemplate()!\" [ngTemplateOutletContext]=\"selectedItemContexts()[0]\" />\n } @else if (hasValue()) {\n <span class=\"ui-select-value\" [class._wrap]=\"multiple()\">{{ selectedLabel() }}</span>\n } @else {\n <span class=\"ui-select-placeholder\">{{ placeholder() ?? '' }}</span>\n }\n </button>\n }\n\n @if (showClearButton()) {\n <button\n uiFieldSuffix\n type=\"button\"\n class=\"ui-select-clear\"\n [attr.aria-label]=\"clearAriaLabel()\"\n (click)=\"onClearClick($event)\"\n >\n <ui-icon name=\"xmark\" [size]=\"iconSize()\" />\n </button>\n }\n\n @if (loading()) {\n <ui-spinner uiFieldSuffix class=\"ui-select-loading\" size=\"small\" orientation=\"horizontal\" ariaLabel=\"Chargement des options\" />\n } @else {\n <ui-icon\n uiFieldSuffix\n class=\"ui-select-chevron\"\n [class._open]=\"panelOpen()\"\n [class._disabled]=\"isDisabled()\"\n [name]=\"icon()\"\n [size]=\"iconSize()\"\n />\n }\n </ui-field>\n</div>\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin()!\"\n [cdkConnectedOverlayOpen]=\"panelOpen()\"\n [cdkConnectedOverlayPositions]=\"overlayPositions()\"\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n (backdropClick)=\"close(false)\"\n (overlayOutsideClick)=\"close(false)\"\n (detach)=\"close(false)\"\n>\n <ng-container [ngTemplateOutlet]=\"panelTpl\" />\n</ng-template>\n", styles: [".ui-select{display:block;cursor:pointer;--ui-field-box-cursor: pointer}.ui-select._editable{--ui-field-box-cursor: text}.ui-select-trigger{display:flex;align-items:center;flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;text-align:left;font-family:var(--fontfamily-base);font-size:var(--size-typography-text-default);color:var(--form-high-content-default);cursor:pointer}.ui-select-trigger:first-child{padding-inline-start:var(--units-md)}.ui-select-trigger:last-child{padding-inline-end:var(--units-md)}.ui-select-trigger._small{font-size:var(--size-typography-text-md)}.ui-select-trigger:disabled{cursor:not-allowed;color:var(--form-high-content-disabled)}.ui-select-value,.ui-select-placeholder{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-select-placeholder{color:var(--form-low-content-default)}.ui-select-value._wrap{overflow:visible;text-overflow:clip;white-space:normal;overflow-wrap:anywhere}.ui-select-values{display:flex;align-items:center;flex-wrap:wrap;gap:var(--units-xs);min-width:0}.ui-select-overflow{flex-shrink:0;font-family:var(--fontfamily-base);font-size:var(--size-typography-text-md);color:var(--form-low-content-default);white-space:nowrap}.ui-select-overflow._small{font-size:var(--size-typography-text-sm)}.ui-select-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.ui-select-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--fontfamily-base);font-size:var(--size-typography-text-default);color:var(--form-high-content-default)}.ui-select-native:first-child{padding-inline-start:var(--units-md)}.ui-select-native:last-child{padding-inline-end:var(--units-md)}.ui-select-native::placeholder{color:var(--form-low-content-default);opacity:1}.ui-select-native:disabled{cursor:not-allowed;color:var(--form-high-content-disabled)}.ui-select-native._small{font-size:var(--size-typography-text-md)}.ui-select-clear{display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:var(--size-components-2xs);height:var(--size-components-2xs);flex-shrink:0;margin:0;padding:0;border:none;border-radius:var(--radius-full);background:none;color:var(--form-low-content-default);cursor:pointer;transition:color var(--transition-default) var(--transition-easeinout),box-shadow var(--transition-default) var(--transition-easeinout)}.ui-select-clear:first-child{margin-inline-start:var(--units-md)}.ui-select-clear:last-child{margin-inline-end:var(--units-md)}.ui-select-clear:hover:not(:disabled){color:var(--form-high-content-hover)}.ui-select-clear:focus-visible{outline:none;color:var(--form-high-content-focused);box-shadow:0 0 0 var(--units-2xs) rgb(from var(--form-high-stroke-focused) r g b/50%)}.ui-select-clear:disabled{cursor:not-allowed;color:var(--form-high-content-disabled)}.ui-select-chevron{flex-shrink:0;color:var(--form-low-content-default)}.ui-select-chevron:first-child{margin-inline-start:var(--units-md)}.ui-select-chevron:last-child{margin-inline-end:var(--units-md)}.ui-select-chevron._disabled{color:var(--form-high-content-disabled)}.ui-select-chevron{transition:rotate var(--ui-motion-duration, var(--transition-default)) var(--ui-motion-easing, var(--transition-easeinout)) var(--ui-motion-delay, 0ms);cursor:pointer}.ui-select-chevron._open{rotate:180deg}.ui-select-loading{flex-shrink:0}.ui-select-loading:first-child{margin-inline-start:var(--units-md)}.ui-select-loading:last-child{margin-inline-end:var(--units-md)}.ui-select-panel{border:var(--stroke-default) solid var(--ui-overlay-stroke, var(--form-high-stroke-default));border-radius:var(--ui-overlay-radius, var(--radius-default));background-color:var(--ui-overlay-surface, var(--form-high-surface-default));box-shadow:var(--ui-overlay-shadow, var(--shadow-default-md));font-family:var(--fontfamily-base);display:flex;flex-direction:column;gap:var(--units-xs);box-sizing:border-box;max-width:calc(100vw - var(--units-lg));padding:var(--units-xs)}.ui-select-panel .ui-select-header,.ui-select-panel .ui-select-footer{padding:var(--units-xs) var(--units-sm);font-family:var(--fontfamily-base);font-size:var(--size-typography-text-md);color:var(--form-high-content-default)}.ui-select-panel .ui-select-filter{display:flex;align-items:center;gap:var(--units-sm);box-sizing:border-box;height:var(--size-components-sm);flex-shrink:0;padding:0;border:var(--stroke-sm) solid var(--form-high-stroke-default);border-radius:var(--radius-sm);background-color:var(--form-high-surface-default);transition:border-color var(--transition-default) var(--transition-easeinout)}.ui-select-panel .ui-select-filter:hover:not(:focus-within){border-color:var(--form-high-stroke-hover)}.ui-select-panel .ui-select-filter:focus-within{border-color:var(--form-high-stroke-focused)}.ui-select-panel .ui-select-filter._small{height:var(--size-components-xs)}.ui-select-panel .ui-select-filter-icon{flex-shrink:0;color:var(--form-low-content-default)}.ui-select-panel .ui-select-filter-icon:first-child{margin-inline-start:var(--units-sm)}.ui-select-panel .ui-select-filter-icon:last-child{margin-inline-end:var(--units-sm)}.ui-select-panel .ui-select-filter-input{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--fontfamily-base);font-size:var(--size-typography-text-default);color:var(--form-high-content-default)}.ui-select-panel .ui-select-filter-input:first-child{padding-inline-start:var(--units-sm)}.ui-select-panel .ui-select-filter-input:last-child{padding-inline-end:var(--units-sm)}.ui-select-panel .ui-select-filter-input::placeholder{color:var(--form-low-content-default);opacity:1}.ui-select-panel .ui-select-filter-input:disabled{cursor:not-allowed;color:var(--form-high-content-disabled)}.ui-select-panel .ui-select-filter-input{font-size:var(--size-typography-text-md)}.ui-select-panel .ui-select-scroller{overflow:auto;max-height:19.5rem}.ui-select-panel .ui-select-scroller._small{max-height:16rem}.ui-select-panel .ui-select-viewport{width:100%}.ui-select-panel .ui-select-list{display:flex;flex-direction:column;gap:var(--units-xs);margin:0;padding:0;list-style:none}.ui-select-panel .ui-select-viewport .ui-select-list{gap:0}.ui-select-panel .ui-select-viewport .ui-select-group{height:2.5rem}.ui-select-panel .ui-select-viewport .ui-select-group._small{height:2rem}.ui-select-panel .ui-select-option{display:flex;align-items:center;gap:var(--units-sm);box-sizing:border-box;height:2.5rem;flex-shrink:0;padding:0 var(--units-default);border-radius:var(--radius-sm);font-family:var(--fontfamily-base);font-size:var(--size-typography-text-default);color:var(--form-high-content-default);cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color var(--transition-default) var(--transition-easeinout),color var(--transition-default) var(--transition-easeinout)}.ui-select-panel .ui-select-option._small{height:2rem;padding:0 var(--units-md);font-size:var(--size-typography-text-md)}.ui-select-panel .ui-select-option._focused,.ui-select-panel .ui-select-option:hover:not(._disabled){background-color:var(--global-background-default-hover)}.ui-select-panel .ui-select-option._selected{background-color:var(--form-high-surface-hover);color:var(--form-high-content-checked)}.ui-select-panel .ui-select-option._disabled{color:var(--form-high-content-disabled);cursor:not-allowed}.ui-select-panel .ui-select-option-label{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-select-panel .ui-select-checkmark{flex-shrink:0;margin-left:auto;color:var(--form-high-content-checked)}.ui-select-panel .ui-select-checkbox{display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:1.125rem;height:1.125rem;flex-shrink:0;border:var(--stroke-default) solid var(--form-high-stroke-default);border-radius:var(--radius-xs);background-color:var(--form-high-surface-default);transition:background-color var(--transition-default) var(--transition-easeinout),border-color var(--transition-default) var(--transition-easeinout)}.ui-select-panel .ui-select-checkbox .ui-select-checkbox-icon{color:var(--form-high-content-checked);opacity:0;transform:scale(.6);transition:opacity var(--transition-default) var(--transition-easeinout),transform var(--transition-default) var(--transition-easeinout)}.ui-select-panel .ui-select-checkbox._checked{border-color:var(--form-high-stroke-checked)}.ui-select-panel .ui-select-checkbox._checked .ui-select-checkbox-icon{opacity:1;transform:scale(1)}.ui-select-panel .ui-select-option._disabled .ui-select-checkbox{border-color:var(--form-high-stroke-disabled);background-color:var(--form-high-surface-disabled)}.ui-select-panel .ui-select-group{display:flex;align-items:center;box-sizing:border-box;height:2rem;flex-shrink:0;padding:0 var(--units-default);font-family:var(--fontfamily-base);font-size:var(--size-typography-text-md);font-weight:var(--weight-bold);color:var(--form-low-content-default)}.ui-select-panel .ui-select-group._small{height:1.5rem;padding:0 var(--units-md);font-size:var(--size-typography-text-sm)}.ui-select-panel .ui-select-empty{display:flex;align-items:center;box-sizing:border-box;min-height:2.5rem;padding:0 var(--units-default);font-family:var(--fontfamily-base);font-size:var(--size-typography-text-default);color:var(--form-low-content-default)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i1.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation", "cdkConnectedOverlayUsePopover", "cdkConnectedOverlayMatchWidth", "cdkConnectedOverlay"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i1.ɵɵCdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i1.ɵɵCdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i1.ɵɵCdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "ngmodule", type: ScrollingModule }, { kind: "component", type: UiField, selector: "ui-field", inputs: ["label", "for", "required", "size", "level", "disabled", "readonly", "multiline", "autoHeight", "message", "messageId", "hasFooter"] }, { kind: "component", type: UiIcon, selector: "ui-icon", inputs: ["name", "size", "type", "family", "decorative", "ariaLabel"] }, { kind: "component", type: UiSpinner, selector: "ui-spinner", inputs: ["size", "orientation", "label", "ariaLabel", "spinnerTemplate", "image", "imageAlt", "icon", "strokeWidth", "fill", "animationDuration", "delay"] }, { kind: "directive", type: UiMotion, selector: "[uiMotion]", inputs: ["uiMotion", "motionDuration", "motionDelay", "motionEasing", "motionEnterEasing", "motionLeaveEasing", "motionDistance", "motionScale", "motionDisabled", "motionOnInsert"], exportAs: ["uiMotion"] }] }); }
|
|
853
|
+
}
|
|
854
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: UiSelect, decorators: [{
|
|
855
|
+
type: Component,
|
|
856
|
+
args: [{ selector: 'ui-select', imports: [NgTemplateOutlet, OverlayModule, ScrollingModule, UiField, UiIcon, UiSpinner, UiMotion], providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiSelect), multi: true }], template: "<!-- One rendered row: group header or option (shared by the plain and virtual lists). -->\n<ng-template #rowTpl let-row>\n @if (row.kind === 'group') {\n <li class=\"ui-select-group\" role=\"presentation\" [class._small]=\"size() === 'small'\">\n @if (groupTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"{ $implicit: row.original, group: row.original }\" />\n } @else {\n {{ row.label }}\n }\n </li>\n } @else {\n <!-- ARIA combobox/listbox pattern: keyboard and focus are handled by\n the trigger role=\"combobox\" (roving via aria-activedescendant). -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <li\n class=\"ui-select-option\"\n role=\"option\"\n [attr.id]=\"row.id\"\n [class._small]=\"size() === 'small'\"\n [class._selected]=\"row.selected\"\n [class._focused]=\"row.index === focusedIndex()\"\n [class._disabled]=\"row.entry.disabled\"\n [attr.aria-selected]=\"row.selected\"\n [attr.aria-disabled]=\"row.entry.disabled || null\"\n [attr.aria-setsize]=\"optionCount()\"\n [attr.aria-posinset]=\"row.index + 1\"\n (mousedown)=\"onOptionMousedown($event)\"\n (click)=\"onOptionClick(row, $event)\"\n (mouseenter)=\"onOptionMouseEnter(row)\"\n >\n @if (checkbox() && multiple()) {\n <!-- Purely visual checkbox: the option itself carries the aria-selected state. -->\n <span class=\"ui-select-checkbox\" [class._checked]=\"row.selected\" aria-hidden=\"true\">\n <ui-icon class=\"ui-select-checkbox-icon\" name=\"check\" size=\"sm\" />\n </span>\n }\n @if (itemTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{ $implicit: row.entry.original, option: row.entry.original, selected: row.selected, index: row.index }\"\n />\n } @else {\n <span class=\"ui-select-option-label\">{{ row.entry.label }}</span>\n }\n @if (checkmark() && row.selected) {\n <ui-icon class=\"ui-select-checkmark\" name=\"check\" [size]=\"iconSize()\" />\n }\n </li>\n }\n</ng-template>\n\n<!-- Options panel (CDK overlay). -->\n<ng-template #panelTpl>\n <div\n #panel\n class=\"ui-select-panel\"\n [class]=\"panelStyleClass()\"\n [class._small]=\"size() === 'small'\"\n [style.width]=\"panelStyleWidth()\"\n [style.min-width]=\"panelStyleMinWidth()\"\n [uiMotion]=\"'slide-down'\"\n #panelMotion=\"uiMotion\"\n motionOnInsert\n >\n @if (headerTemplate(); as tpl) {\n <div class=\"ui-select-header\">\n <ng-container [ngTemplateOutlet]=\"tpl\" />\n </div>\n }\n\n @if (filter()) {\n <div class=\"ui-select-filter\" [class._small]=\"size() === 'small'\">\n <ui-icon class=\"ui-select-filter-icon\" name=\"magnifying-glass\" size=\"sm\" />\n <input\n #filterInput\n type=\"text\"\n class=\"ui-select-filter-input\"\n autocomplete=\"off\"\n role=\"searchbox\"\n [value]=\"filterValue()\"\n [placeholder]=\"filterPlaceholder() ?? ''\"\n [attr.aria-label]=\"filterAriaLabel()\"\n [attr.aria-controls]=\"listboxId()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n (input)=\"onFilterInput($event)\"\n (keydown)=\"onFilterKeydown($event)\"\n />\n </div>\n }\n\n @if (virtualScroll()) {\n <cdk-virtual-scroll-viewport\n class=\"ui-select-viewport\"\n [itemSize]=\"virtualScrollItemSize()\"\n [style.height]=\"viewportHeight()\"\n >\n <ul\n class=\"ui-select-list\"\n role=\"listbox\"\n [attr.id]=\"listboxId()\"\n [attr.aria-label]=\"label() || ariaLabel() || null\"\n [attr.aria-multiselectable]=\"multiple() ? 'true' : null\"\n >\n <ng-container *cdkVirtualFor=\"let row of visibleRows(); trackBy: trackRow\">\n <ng-container [ngTemplateOutlet]=\"rowTpl\" [ngTemplateOutletContext]=\"{ $implicit: row }\" />\n </ng-container>\n @if (!visibleRows().length) {\n <ng-container [ngTemplateOutlet]=\"emptyTpl\" />\n }\n </ul>\n </cdk-virtual-scroll-viewport>\n } @else {\n <div class=\"ui-select-scroller\" [class._small]=\"size() === 'small'\" [style.max-height]=\"scrollHeight() || null\">\n <ul\n class=\"ui-select-list\"\n role=\"listbox\"\n [attr.id]=\"listboxId()\"\n [attr.aria-label]=\"label() || ariaLabel() || null\"\n [attr.aria-multiselectable]=\"multiple() ? 'true' : null\"\n >\n @for (row of visibleRows(); track row.key) {\n <ng-container [ngTemplateOutlet]=\"rowTpl\" [ngTemplateOutletContext]=\"{ $implicit: row }\" />\n } @empty {\n <ng-container [ngTemplateOutlet]=\"emptyTpl\" />\n }\n </ul>\n </div>\n }\n\n @if (footerTemplate(); as tpl) {\n <div class=\"ui-select-footer\">\n <ng-container [ngTemplateOutlet]=\"tpl\" />\n </div>\n }\n </div>\n</ng-template>\n\n<!-- Empty state row. -->\n<ng-template #emptyTpl>\n <li class=\"ui-select-empty\" role=\"presentation\">\n @if (emptyTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" />\n } @else {\n {{ emptyLabel() }}\n }\n </li>\n</ng-template>\n\n<!-- Trigger: composed field. Clicking the box opens the panel (backdrop closes it). -->\n<!-- Convenience click on the wrapper: focus and keyboard are carried by\n the inner trigger role=\"combobox\". -->\n<!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n<div #container class=\"ui-select\" [class._editable]=\"isEditable()\" (click)=\"onContainerClick($event)\">\n <ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [autoHeight]=\"multiple()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n >\n @if (isEditable()) {\n <input\n #trigger\n type=\"text\"\n class=\"ui-select-native\"\n [class._small]=\"size() === 'small'\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n [id]=\"resolvedId()\"\n [value]=\"selectedLabel()\"\n [placeholder]=\"placeholder() ?? ''\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-expanded]=\"panelOpen()\"\n [attr.aria-controls]=\"panelOpen() ? listboxId() : null\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"displayMessage() ? messageId() : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onEditableInput($event)\"\n (keydown)=\"onTriggerKeydown($event)\"\n (focus)=\"onTriggerFocus($event)\"\n (blur)=\"onTriggerBlur($event)\"\n />\n } @else {\n <!-- Multiple + #selectedItem: the values (e.g. removable chips) live OUTSIDE the\n combobox button so their own buttons stay valid, interactive HTML. -->\n @if (multiple() && selectedItemTemplate() && hasValue()) {\n <div class=\"ui-select-values\">\n @for (ctx of selectedItemContexts(); track $index) {\n <ng-container [ngTemplateOutlet]=\"selectedItemTemplate()!\" [ngTemplateOutletContext]=\"ctx\" />\n }\n @if (overflowCount() > 0) {\n <span class=\"ui-select-overflow\" [class._small]=\"size() === 'small'\">{{ overflowText() }}</span>\n }\n </div>\n }\n <button\n #trigger\n type=\"button\"\n class=\"ui-select-trigger\"\n [class._small]=\"size() === 'small'\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n [id]=\"resolvedId()\"\n [disabled]=\"isDisabled()\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-expanded]=\"panelOpen()\"\n [attr.aria-controls]=\"panelOpen() ? listboxId() : null\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"displayMessage() ? messageId() : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (keydown)=\"onTriggerKeydown($event)\"\n (focus)=\"onTriggerFocus($event)\"\n (blur)=\"onTriggerBlur($event)\"\n >\n @if (multiple() && selectedItemTemplate() && hasValue()) {\n <!-- Accessible value of the combobox (the visual value is the chips next to it). -->\n <span class=\"ui-select-sr\">{{ selectedLabel() }}</span>\n } @else if (!multiple() && selectedItemTemplate() && hasValue()) {\n <ng-container [ngTemplateOutlet]=\"selectedItemTemplate()!\" [ngTemplateOutletContext]=\"selectedItemContexts()[0]\" />\n } @else if (hasValue()) {\n <span class=\"ui-select-value\" [class._wrap]=\"multiple()\">{{ selectedLabel() }}</span>\n } @else {\n <span class=\"ui-select-placeholder\">{{ placeholder() ?? '' }}</span>\n }\n </button>\n }\n\n @if (showClearButton()) {\n <button\n uiFieldSuffix\n type=\"button\"\n class=\"ui-select-clear\"\n [attr.aria-label]=\"clearAriaLabel()\"\n (click)=\"onClearClick($event)\"\n >\n <ui-icon name=\"xmark\" [size]=\"iconSize()\" />\n </button>\n }\n\n @if (loading()) {\n <ui-spinner uiFieldSuffix class=\"ui-select-loading\" size=\"small\" orientation=\"horizontal\" ariaLabel=\"Chargement des options\" />\n } @else {\n <ui-icon\n uiFieldSuffix\n class=\"ui-select-chevron\"\n [class._open]=\"panelOpen()\"\n [class._disabled]=\"isDisabled()\"\n [name]=\"icon()\"\n [size]=\"iconSize()\"\n />\n }\n </ui-field>\n</div>\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin()!\"\n [cdkConnectedOverlayOpen]=\"panelOpen()\"\n [cdkConnectedOverlayPositions]=\"overlayPositions()\"\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n (backdropClick)=\"close(false)\"\n (overlayOutsideClick)=\"close(false)\"\n (detach)=\"close(false)\"\n>\n <ng-container [ngTemplateOutlet]=\"panelTpl\" />\n</ng-template>\n", styles: [".ui-select{display:block;cursor:pointer;--ui-field-box-cursor: pointer}.ui-select._editable{--ui-field-box-cursor: text}.ui-select-trigger{display:flex;align-items:center;flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;text-align:left;font-family:var(--fontfamily-base);font-size:var(--size-typography-text-default);color:var(--form-high-content-default);cursor:pointer}.ui-select-trigger:first-child{padding-inline-start:var(--units-md)}.ui-select-trigger:last-child{padding-inline-end:var(--units-md)}.ui-select-trigger._small{font-size:var(--size-typography-text-md)}.ui-select-trigger:disabled{cursor:not-allowed;color:var(--form-high-content-disabled)}.ui-select-value,.ui-select-placeholder{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-select-placeholder{color:var(--form-low-content-default)}.ui-select-value._wrap{overflow:visible;text-overflow:clip;white-space:normal;overflow-wrap:anywhere}.ui-select-values{display:flex;align-items:center;flex-wrap:wrap;gap:var(--units-xs);min-width:0}.ui-select-overflow{flex-shrink:0;font-family:var(--fontfamily-base);font-size:var(--size-typography-text-md);color:var(--form-low-content-default);white-space:nowrap}.ui-select-overflow._small{font-size:var(--size-typography-text-sm)}.ui-select-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.ui-select-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--fontfamily-base);font-size:var(--size-typography-text-default);color:var(--form-high-content-default)}.ui-select-native:first-child{padding-inline-start:var(--units-md)}.ui-select-native:last-child{padding-inline-end:var(--units-md)}.ui-select-native::placeholder{color:var(--form-low-content-default);opacity:1}.ui-select-native:disabled{cursor:not-allowed;color:var(--form-high-content-disabled)}.ui-select-native._small{font-size:var(--size-typography-text-md)}.ui-select-clear{display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:var(--size-components-2xs);height:var(--size-components-2xs);flex-shrink:0;margin:0;padding:0;border:none;border-radius:var(--radius-full);background:none;color:var(--form-low-content-default);cursor:pointer;transition:color var(--transition-default) var(--transition-easeinout),box-shadow var(--transition-default) var(--transition-easeinout)}.ui-select-clear:first-child{margin-inline-start:var(--units-md)}.ui-select-clear:last-child{margin-inline-end:var(--units-md)}.ui-select-clear:hover:not(:disabled){color:var(--form-high-content-hover)}.ui-select-clear:focus-visible{outline:none;color:var(--form-high-content-focused);box-shadow:0 0 0 var(--units-2xs) rgb(from var(--form-high-stroke-focused) r g b/50%)}.ui-select-clear:disabled{cursor:not-allowed;color:var(--form-high-content-disabled)}.ui-select-chevron{flex-shrink:0;color:var(--form-low-content-default)}.ui-select-chevron:first-child{margin-inline-start:var(--units-md)}.ui-select-chevron:last-child{margin-inline-end:var(--units-md)}.ui-select-chevron._disabled{color:var(--form-high-content-disabled)}.ui-select-chevron{transition:rotate var(--ui-motion-duration, var(--transition-default)) var(--ui-motion-easing, var(--transition-easeinout)) var(--ui-motion-delay, 0ms);cursor:pointer}.ui-select-chevron._open{rotate:180deg}.ui-select-loading{flex-shrink:0}.ui-select-loading:first-child{margin-inline-start:var(--units-md)}.ui-select-loading:last-child{margin-inline-end:var(--units-md)}.ui-select-panel{border:var(--stroke-default) solid var(--ui-overlay-stroke, var(--form-high-stroke-default));border-radius:var(--ui-overlay-radius, var(--radius-default));background-color:var(--ui-overlay-surface, var(--form-high-surface-default));box-shadow:var(--ui-overlay-shadow, var(--shadow-default-md));font-family:var(--fontfamily-base);display:flex;flex-direction:column;gap:var(--units-xs);box-sizing:border-box;max-width:calc(100vw - var(--units-lg));padding:var(--units-xs)}.ui-select-panel .ui-select-header,.ui-select-panel .ui-select-footer{padding:var(--units-xs) var(--units-sm);font-family:var(--fontfamily-base);font-size:var(--size-typography-text-md);color:var(--form-high-content-default)}.ui-select-panel .ui-select-filter{display:flex;align-items:center;gap:var(--units-sm);box-sizing:border-box;height:var(--size-components-sm);flex-shrink:0;padding:0;border:var(--stroke-sm) solid var(--form-high-stroke-default);border-radius:var(--radius-sm);background-color:var(--form-high-surface-default);transition:border-color var(--transition-default) var(--transition-easeinout)}.ui-select-panel .ui-select-filter:hover:not(:focus-within){border-color:var(--form-high-stroke-hover)}.ui-select-panel .ui-select-filter:focus-within{border-color:var(--form-high-stroke-focused)}.ui-select-panel .ui-select-filter._small{height:var(--size-components-xs)}.ui-select-panel .ui-select-filter-icon{flex-shrink:0;color:var(--form-low-content-default)}.ui-select-panel .ui-select-filter-icon:first-child{margin-inline-start:var(--units-sm)}.ui-select-panel .ui-select-filter-icon:last-child{margin-inline-end:var(--units-sm)}.ui-select-panel .ui-select-filter-input{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--fontfamily-base);font-size:var(--size-typography-text-default);color:var(--form-high-content-default)}.ui-select-panel .ui-select-filter-input:first-child{padding-inline-start:var(--units-sm)}.ui-select-panel .ui-select-filter-input:last-child{padding-inline-end:var(--units-sm)}.ui-select-panel .ui-select-filter-input::placeholder{color:var(--form-low-content-default);opacity:1}.ui-select-panel .ui-select-filter-input:disabled{cursor:not-allowed;color:var(--form-high-content-disabled)}.ui-select-panel .ui-select-filter-input{font-size:var(--size-typography-text-md)}.ui-select-panel .ui-select-scroller{overflow:auto;max-height:19.5rem}.ui-select-panel .ui-select-scroller._small{max-height:16rem}.ui-select-panel .ui-select-viewport{width:100%}.ui-select-panel .ui-select-list{display:flex;flex-direction:column;gap:var(--units-xs);margin:0;padding:0;list-style:none}.ui-select-panel .ui-select-viewport .ui-select-list{gap:0}.ui-select-panel .ui-select-viewport .ui-select-group{height:2.5rem}.ui-select-panel .ui-select-viewport .ui-select-group._small{height:2rem}.ui-select-panel .ui-select-option{display:flex;align-items:center;gap:var(--units-sm);box-sizing:border-box;height:2.5rem;flex-shrink:0;padding:0 var(--units-default);border-radius:var(--radius-sm);font-family:var(--fontfamily-base);font-size:var(--size-typography-text-default);color:var(--form-high-content-default);cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color var(--transition-default) var(--transition-easeinout),color var(--transition-default) var(--transition-easeinout)}.ui-select-panel .ui-select-option._small{height:2rem;padding:0 var(--units-md);font-size:var(--size-typography-text-md)}.ui-select-panel .ui-select-option._focused,.ui-select-panel .ui-select-option:hover:not(._disabled){background-color:var(--global-background-default-hover)}.ui-select-panel .ui-select-option._selected{background-color:var(--form-high-surface-hover);color:var(--form-high-content-checked)}.ui-select-panel .ui-select-option._disabled{color:var(--form-high-content-disabled);cursor:not-allowed}.ui-select-panel .ui-select-option-label{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-select-panel .ui-select-checkmark{flex-shrink:0;margin-left:auto;color:var(--form-high-content-checked)}.ui-select-panel .ui-select-checkbox{display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:1.125rem;height:1.125rem;flex-shrink:0;border:var(--stroke-default) solid var(--form-high-stroke-default);border-radius:var(--radius-xs);background-color:var(--form-high-surface-default);transition:background-color var(--transition-default) var(--transition-easeinout),border-color var(--transition-default) var(--transition-easeinout)}.ui-select-panel .ui-select-checkbox .ui-select-checkbox-icon{color:var(--form-high-content-checked);opacity:0;transform:scale(.6);transition:opacity var(--transition-default) var(--transition-easeinout),transform var(--transition-default) var(--transition-easeinout)}.ui-select-panel .ui-select-checkbox._checked{border-color:var(--form-high-stroke-checked)}.ui-select-panel .ui-select-checkbox._checked .ui-select-checkbox-icon{opacity:1;transform:scale(1)}.ui-select-panel .ui-select-option._disabled .ui-select-checkbox{border-color:var(--form-high-stroke-disabled);background-color:var(--form-high-surface-disabled)}.ui-select-panel .ui-select-group{display:flex;align-items:center;box-sizing:border-box;height:2rem;flex-shrink:0;padding:0 var(--units-default);font-family:var(--fontfamily-base);font-size:var(--size-typography-text-md);font-weight:var(--weight-bold);color:var(--form-low-content-default)}.ui-select-panel .ui-select-group._small{height:1.5rem;padding:0 var(--units-md);font-size:var(--size-typography-text-sm)}.ui-select-panel .ui-select-empty{display:flex;align-items:center;box-sizing:border-box;min-height:2.5rem;padding:0 var(--units-default);font-family:var(--fontfamily-base);font-size:var(--size-typography-text-default);color:var(--form-low-content-default)}\n"] }]
|
|
857
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], optionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionLabel", required: false }] }], optionValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionValue", required: false }] }], optionDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionDisabled", required: false }] }], group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: false }] }], optionGroupLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionGroupLabel", required: false }] }], optionGroupChildren: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionGroupChildren", required: false }] }], dataKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataKey", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], checkmark: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkmark", required: false }] }], checkbox: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkbox", required: false }] }], maxSelectedLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSelectedLabels", required: false }] }], overflowLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "overflowLabel", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], showClear: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClear", required: false }] }], clearAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearAriaLabel", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: false }] }], filterPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterPlaceholder", required: false }] }], filterAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterAriaLabel", required: false }] }], filterBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterBy", required: false }] }], autofocusFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "autofocusFilter", required: false }] }], resetFilterOnHide: [{ type: i0.Input, args: [{ isSignal: true, alias: "resetFilterOnHide", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }], emptyFilterMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyFilterMessage", required: false }] }], editable: [{ type: i0.Input, args: [{ isSignal: true, alias: "editable", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], autoOptionFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoOptionFocus", required: false }] }], selectOnFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectOnFocus", required: false }] }], focusOnHover: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusOnHover", required: false }] }], virtualScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScroll", required: false }] }], virtualScrollItemSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScrollItemSize", required: false }] }], lazy: [{ type: i0.Input, args: [{ isSignal: true, alias: "lazy", required: false }] }], scrollHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollHeight", required: false }] }], autoFlip: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoFlip", required: false }] }], panelStyleClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelStyleClass", required: false }] }], panelWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelWidth", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }], cleared: [{ type: i0.Output, args: ["cleared"] }], filterChange: [{ type: i0.Output, args: ["filterChange"] }], lazyLoad: [{ type: i0.Output, args: ["lazyLoad"] }], inputFocus: [{ type: i0.Output, args: ["inputFocus"] }], inputBlur: [{ type: i0.Output, args: ["inputBlur"] }], itemTemplate: [{ type: i0.ContentChild, args: ['item', { isSignal: true }] }], selectedItemTemplate: [{ type: i0.ContentChild, args: ['selectedItem', { isSignal: true }] }], groupTemplate: [{ type: i0.ContentChild, args: ['group', { isSignal: true }] }], headerTemplate: [{ type: i0.ContentChild, args: ['header', { isSignal: true }] }], footerTemplate: [{ type: i0.ContentChild, args: ['footer', { isSignal: true }] }], emptyTemplate: [{ type: i0.ContentChild, args: ['empty', { isSignal: true }] }], containerEl: [{ type: i0.ViewChild, args: ['container', { isSignal: true }] }], triggerEl: [{ type: i0.ViewChild, args: ['trigger', { isSignal: true }] }], panelEl: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }], filterInputEl: [{ type: i0.ViewChild, args: ['filterInput', { isSignal: true }] }], viewport: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CdkVirtualScrollViewport), { isSignal: true }] }] } });
|
|
858
|
+
|
|
859
|
+
/*
|
|
860
|
+
* Public API Surface of ui-kit/ui-select
|
|
861
|
+
*/
|
|
862
|
+
|
|
863
|
+
/**
|
|
864
|
+
* Generated bundle index. Do not edit.
|
|
865
|
+
*/
|
|
866
|
+
|
|
867
|
+
export { UiSelect };
|
|
868
|
+
//# sourceMappingURL=4sh-ui-kit-ui-select.mjs.map
|