@cityway/basic-ui 1.1.0-beta026 → 1.1.0-beta028
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -74
- package/cityway-basic-ui-1.1.0-beta028.tgz +0 -0
- package/docs/00-overview.md +209 -209
- package/docs/components/autocomplete.md +56 -1
- package/docs/components/badge.md +148 -147
- package/docs/components/button.md +1 -1
- package/docs/components/card.md +264 -253
- package/docs/components/form-field/README.md +5 -3
- package/docs/components/form-field/checkbox.md +34 -4
- package/docs/components/form-field/date.md +39 -0
- package/docs/components/tab.md +239 -192
- package/fesm2022/cityway-basic-ui.mjs +366 -121
- package/fesm2022/cityway-basic-ui.mjs.map +1 -1
- package/index.d.ts +182 -14
- package/package.json +2 -2
- package/styles/basic-ui.styles.bo.min.css +1 -1
- package/styles/basic-ui.styles.bo.min.css.map +1 -1
- package/styles/basic-ui.styles.fo.min.css +1 -1
- package/styles/basic-ui.styles.fo.min.css.map +1 -1
- package/cityway-basic-ui-1.1.0-beta026.tgz +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i1 from '@angular/common';
|
|
2
2
|
import { CommonModule, DOCUMENT, isPlatformBrowser, NgClass, NgTemplateOutlet } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { inject, ElementRef, model, output, effect, Directive, input, HostBinding, ChangeDetectionStrategy, Component, ChangeDetectorRef, viewChild, signal, computed, untracked, contentChildren, DestroyRef, Injectable, NgZone, Renderer2, ViewContainerRef,
|
|
4
|
+
import { inject, ElementRef, model, output, effect, Directive, input, HostBinding, ChangeDetectionStrategy, Component, ChangeDetectorRef, viewChild, signal, computed, untracked, contentChildren, DestroyRef, Injectable, NgZone, Renderer2, ViewContainerRef, Pipe, TemplateRef, PLATFORM_ID, EventEmitter, ContentChild, Output, Input, ApplicationRef, Injector, createComponent, contentChild, viewChildren, forwardRef } from '@angular/core';
|
|
5
5
|
import * as i2 from '@ngx-translate/core';
|
|
6
6
|
import { TranslatePipe, TranslateModule, TranslateService } from '@ngx-translate/core';
|
|
7
7
|
import { LiveAnnouncer } from '@angular/cdk/a11y';
|
|
@@ -1364,6 +1364,8 @@ var BadgeTypeEnum;
|
|
|
1364
1364
|
BadgeTypeEnum["lightWarning"] = "light-warning";
|
|
1365
1365
|
BadgeTypeEnum["lightDanger"] = "light-danger";
|
|
1366
1366
|
BadgeTypeEnum["lightLight"] = "light-light";
|
|
1367
|
+
/** Fond blanc (surface/default) : badge pose sur une surface claire (bande de sous-onglets, card light). */
|
|
1368
|
+
BadgeTypeEnum["lightWhite"] = "light-white";
|
|
1367
1369
|
// Heavy variants
|
|
1368
1370
|
BadgeTypeEnum["heavyPrimary"] = "heavy-primary";
|
|
1369
1371
|
BadgeTypeEnum["heavyInfo"] = "heavy-info";
|
|
@@ -1982,8 +1984,12 @@ class ButtonComponent {
|
|
|
1982
1984
|
*
|
|
1983
1985
|
* Pas de mode fixe sous un ancetre transforme (modale animee par `translate` / `scale`...) : le
|
|
1984
1986
|
* `fixed` s'y calerait sur cet ancetre et non sur la fenetre, le menu serait mal place.
|
|
1987
|
+
*
|
|
1988
|
+
* Pas de mode fixe non plus pour un menu `static` : il est dans le flux et pousse son conteneur.
|
|
1985
1989
|
*/
|
|
1986
1990
|
escapeClipping() {
|
|
1991
|
+
if (this.placementCss === 'dropdown-menu-static')
|
|
1992
|
+
return;
|
|
1987
1993
|
const menu = this.dropdownMenu()?.nativeElement;
|
|
1988
1994
|
const toggle = this.dropdownToggle()?.nativeElement;
|
|
1989
1995
|
if (!menu || !toggle || typeof window === 'undefined' || !this.isClippedWithoutTransform(toggle))
|
|
@@ -2269,6 +2275,40 @@ var FormFieldTypeEnum;
|
|
|
2269
2275
|
FormFieldTypeEnum["richText"] = "richText";
|
|
2270
2276
|
})(FormFieldTypeEnum || (FormFieldTypeEnum = {}));
|
|
2271
2277
|
|
|
2278
|
+
const HTML_ESCAPES = {
|
|
2279
|
+
'&': '&',
|
|
2280
|
+
'<': '<',
|
|
2281
|
+
'>': '>',
|
|
2282
|
+
'"': '"',
|
|
2283
|
+
"'": ''',
|
|
2284
|
+
};
|
|
2285
|
+
/**
|
|
2286
|
+
* Échappe le HTML de `text` puis entoure les occurrences de `term` (insensible à la casse) par
|
|
2287
|
+
* `<mark>`. Le résultat est destiné à un binding `[innerHTML]` (Angular sanitize la sortie).
|
|
2288
|
+
*/
|
|
2289
|
+
function highlightTerm(text, term) {
|
|
2290
|
+
const escaped = String(text ?? '').replace(/[&<>"']/g, (c) => HTML_ESCAPES[c]);
|
|
2291
|
+
if (!term)
|
|
2292
|
+
return escaped;
|
|
2293
|
+
const re = new RegExp(`(${term.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')})`, 'gi');
|
|
2294
|
+
return escaped.replace(re, '<mark>$1</mark>');
|
|
2295
|
+
}
|
|
2296
|
+
/**
|
|
2297
|
+
* Mise en gras du terme recherché, comme dans les options de `cw-autocomplete` :
|
|
2298
|
+
* `<span [innerHTML]="item.label | cwHighlight: term"></span>`. Depuis la beta028.
|
|
2299
|
+
*/
|
|
2300
|
+
class CwHighlightPipe {
|
|
2301
|
+
transform(text, term) {
|
|
2302
|
+
return highlightTerm(text, term);
|
|
2303
|
+
}
|
|
2304
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: CwHighlightPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
2305
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.20", ngImport: i0, type: CwHighlightPipe, isStandalone: true, name: "cwHighlight" }); }
|
|
2306
|
+
}
|
|
2307
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: CwHighlightPipe, decorators: [{
|
|
2308
|
+
type: Pipe,
|
|
2309
|
+
args: [{ name: 'cwHighlight', standalone: true }]
|
|
2310
|
+
}] });
|
|
2311
|
+
|
|
2272
2312
|
/**
|
|
2273
2313
|
* Logique clavier W3C combobox + listbox, isolée en fonctions pures pour testabilité.
|
|
2274
2314
|
*
|
|
@@ -2416,6 +2456,12 @@ class AutocompleteComponent {
|
|
|
2416
2456
|
this.valueField = input('id', ...(ngDevMode ? [{ debugName: "valueField" }] : []));
|
|
2417
2457
|
/** Colonnes additionnelles (au-delà de la colonne 1 qui contient toujours displayField). */
|
|
2418
2458
|
this.columns = input([], ...(ngDevMode ? [{ debugName: "columns" }] : []));
|
|
2459
|
+
/**
|
|
2460
|
+
* Gabarit du contenu de chaque option, à la place de `displayField` + `columns`. Ne rend que le
|
|
2461
|
+
* contenu : `role="option"`, ARIA, clavier, case à cocher (multi) et état désactivé restent gérés
|
|
2462
|
+
* ici. Le texte de l'input après sélection reste `displayField`.
|
|
2463
|
+
*/
|
|
2464
|
+
this.optionTemplate = input(null, ...(ngDevMode ? [{ debugName: "optionTemplate" }] : []));
|
|
2419
2465
|
// ---------- Behavior ----------
|
|
2420
2466
|
/** Active la multi-sélection (impl. à l'étape 4). */
|
|
2421
2467
|
this.multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple" }] : []));
|
|
@@ -2693,12 +2739,26 @@ class AutocompleteComponent {
|
|
|
2693
2739
|
* Le résultat est binding-é via [innerHTML] (Angular sanitize la sortie).
|
|
2694
2740
|
*/
|
|
2695
2741
|
highlight(text) {
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2742
|
+
return highlightTerm(text, this.term());
|
|
2743
|
+
}
|
|
2744
|
+
/**
|
|
2745
|
+
* Contexte du gabarit d'option. `selected` : coché en multi ; en mono, item dont la
|
|
2746
|
+
* `valueField` est la valeur du control.
|
|
2747
|
+
*/
|
|
2748
|
+
optionContext(item, row) {
|
|
2749
|
+
const value = this.control().value;
|
|
2750
|
+
const selected = this.multiple()
|
|
2751
|
+
? this.isItemSelected(item)
|
|
2752
|
+
: value != null && item[this.valueField()] === value;
|
|
2753
|
+
return {
|
|
2754
|
+
$implicit: item,
|
|
2755
|
+
item,
|
|
2756
|
+
term: this.term(),
|
|
2757
|
+
selected,
|
|
2758
|
+
disabled: this.isItemDisabled(item),
|
|
2759
|
+
active: this.activeRow() === row,
|
|
2760
|
+
index: row,
|
|
2761
|
+
};
|
|
2702
2762
|
}
|
|
2703
2763
|
// ---------- DOM event handlers ----------
|
|
2704
2764
|
onFocus() {
|
|
@@ -2947,22 +3007,8 @@ class AutocompleteComponent {
|
|
|
2947
3007
|
option?.scrollIntoView({ block: 'nearest', inline: 'nearest' });
|
|
2948
3008
|
});
|
|
2949
3009
|
}
|
|
2950
|
-
// ---------- Utilities ----------
|
|
2951
|
-
escapeHtml(s) {
|
|
2952
|
-
const map = {
|
|
2953
|
-
'&': '&',
|
|
2954
|
-
'<': '<',
|
|
2955
|
-
'>': '>',
|
|
2956
|
-
'"': '"',
|
|
2957
|
-
"'": ''',
|
|
2958
|
-
};
|
|
2959
|
-
return s.replace(/[&<>"']/g, (c) => map[c]);
|
|
2960
|
-
}
|
|
2961
|
-
escapeRegex(s) {
|
|
2962
|
-
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
2963
|
-
}
|
|
2964
3010
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: AutocompleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2965
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: AutocompleteComponent, isStandalone: true, selector: "cw-autocomplete", inputs: { control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: true, transformFunction: null }, fetcher: { classPropertyName: "fetcher", publicName: "fetcher", isSignal: true, isRequired: true, transformFunction: null }, displayField: { classPropertyName: "displayField", publicName: "displayField", isSignal: true, isRequired: false, transformFunction: null }, valueField: { classPropertyName: "valueField", publicName: "valueField", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, minChars: { classPropertyName: "minChars", publicName: "minChars", isSignal: true, isRequired: false, transformFunction: null }, debounceMs: { classPropertyName: "debounceMs", publicName: "debounceMs", isSignal: true, isRequired: false, transformFunction: null }, selectedItem: { classPropertyName: "selectedItem", publicName: "selectedItem", isSignal: true, isRequired: false, transformFunction: null }, resolver: { classPropertyName: "resolver", publicName: "resolver", isSignal: true, isRequired: false, transformFunction: null }, selectedItems: { classPropertyName: "selectedItems", publicName: "selectedItems", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, isRequired: { classPropertyName: "isRequired", publicName: "isRequired", isSignal: true, isRequired: false, transformFunction: null }, isReadonly: { classPropertyName: "isReadonly", publicName: "isReadonly", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, ariaInvalid: { classPropertyName: "ariaInvalid", publicName: "ariaInvalid", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "ariaDescribedBy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemSelected: "itemSelected", itemsChange: "itemsChange" }, viewQueries: [{ propertyName: "listboxEl", first: true, predicate: ["listboxEl"], descendants: true, isSignal: true }, { propertyName: "masterCheckbox", first: true, predicate: ["masterCheckbox"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\n class=\"autocomplete-wrapper\"\n (clickOutside)=\"onClickOutside()\">\n\n <div class=\"field-group\">\n <input\n type=\"text\"\n class=\"field-control autocomplete-input\"\n [class.has-value]=\"hasAnyContent()\"\n [id]=\"resolvedId()\"\n [formControl]=\"searchInput\"\n [attr.placeholder]=\"placeholder() ? (placeholder() | translate) : null\"\n [attr.readonly]=\"isReadonly() ? 'readonly' : null\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-controls]=\"listboxId()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-required]=\"isRequired() ? 'true' : null\"\n [attr.aria-invalid]=\"ariaInvalid() ? 'true' : null\"\n [attr.aria-describedby]=\"ariaDescribedBy()\"\n autocomplete=\"off\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n (keydown)=\"onKeyDown($event)\">\n\n @if (loading()) {\n <div class=\"autocomplete-loader-container d-flex-h\">\n <span class=\"autocomplete-loader spinner-border spinner-border-sm\" aria-hidden=\"true\"></span>\n </div>\n }\n </div>\n\n @if (showListbox()) {\n <ul\n #listboxEl\n class=\"list-unstyled autocomplete-listbox dropdown-menu show\"\n role=\"listbox\"\n [id]=\"listboxId()\"\n [attr.aria-labelledby]=\"resolvedId()\"\n [attr.aria-multiselectable]=\"multiple() ? 'true' : null\"\n (mousedown)=\"$event.preventDefault()\">\n\n @if (multiple()) {\n <!-- Option de listbox : le clavier est gere sur l'input role=\"combobox\"\n (aria-activedescendant + onKeyDown) ; conformement au pattern WAI-ARIA,\n les options ne sont pas focusables et le (click) est un confort souris. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <li\n role=\"option\"\n [id]=\"masterOptionId()\"\n class=\"autocomplete-option autocomplete-option-master\"\n [class.is-active]=\"activeRow() === MASTER_ROW\"\n [attr.aria-selected]=\"masterState() === 'checked' ? 'true' : 'false'\"\n (mouseenter)=\"onMasterMouseEnter()\"\n (click)=\"onMasterClick()\">\n <input\n #masterCheckbox\n type=\"checkbox\"\n class=\"field-check-input\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [checked]=\"masterState() === 'checked'\">\n <span class=\"autocomplete-master-label fs-sm\">\n {{ (masterState() === 'checked'\n ? '_COMMON._ACTION.DESELECT_ALL'\n : '_COMMON._ACTION.SELECT_ALL') | translate }}\n </span>\n </li>\n }\n\n @for (item of items(); track $index; let rowIdx = $index) {\n <!-- Option de listbox : clavier gere sur l'input role=\"combobox\"\n (aria-activedescendant + onKeyDown) ; options non focusables (WAI-ARIA),\n (click) = confort souris. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <li\n role=\"option\"\n [id]=\"optionId(rowIdx)\"\n class=\"autocomplete-option\"\n [class.is-active]=\"activeRow() === rowIdx\"\n [class.is-disabled]=\"isItemDisabled(item)\"\n [attr.aria-selected]=\"multiple() ? (isItemSelected(item) ? 'true' : 'false') : (activeRow() === rowIdx ? 'true' : null)\"\n [attr.aria-disabled]=\"isItemDisabled(item) ? 'true' : null\"\n (mouseenter)=\"onRowMouseEnter(rowIdx)\"\n (click)=\"onRowClick(rowIdx)\">\n\n @if (multiple()) {\n <input\n type=\"checkbox\"\n class=\"field-check-input\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [disabled]=\"isItemDisabled(item)\"\n [checked]=\"isItemSelected(item)\">\n }\n\n <!-- Texte principal et colonnes additionnelles empiles, a cote de la case (mode multiple). -->\n
|
|
3011
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: AutocompleteComponent, isStandalone: true, selector: "cw-autocomplete", inputs: { control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: true, transformFunction: null }, fetcher: { classPropertyName: "fetcher", publicName: "fetcher", isSignal: true, isRequired: true, transformFunction: null }, displayField: { classPropertyName: "displayField", publicName: "displayField", isSignal: true, isRequired: false, transformFunction: null }, valueField: { classPropertyName: "valueField", publicName: "valueField", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, optionTemplate: { classPropertyName: "optionTemplate", publicName: "optionTemplate", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, minChars: { classPropertyName: "minChars", publicName: "minChars", isSignal: true, isRequired: false, transformFunction: null }, debounceMs: { classPropertyName: "debounceMs", publicName: "debounceMs", isSignal: true, isRequired: false, transformFunction: null }, selectedItem: { classPropertyName: "selectedItem", publicName: "selectedItem", isSignal: true, isRequired: false, transformFunction: null }, resolver: { classPropertyName: "resolver", publicName: "resolver", isSignal: true, isRequired: false, transformFunction: null }, selectedItems: { classPropertyName: "selectedItems", publicName: "selectedItems", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, isRequired: { classPropertyName: "isRequired", publicName: "isRequired", isSignal: true, isRequired: false, transformFunction: null }, isReadonly: { classPropertyName: "isReadonly", publicName: "isReadonly", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, ariaInvalid: { classPropertyName: "ariaInvalid", publicName: "ariaInvalid", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "ariaDescribedBy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemSelected: "itemSelected", itemsChange: "itemsChange" }, viewQueries: [{ propertyName: "listboxEl", first: true, predicate: ["listboxEl"], descendants: true, isSignal: true }, { propertyName: "masterCheckbox", first: true, predicate: ["masterCheckbox"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\n class=\"autocomplete-wrapper\"\n (clickOutside)=\"onClickOutside()\">\n\n <div class=\"field-group\">\n <input\n type=\"text\"\n class=\"field-control autocomplete-input\"\n [class.has-value]=\"hasAnyContent()\"\n [id]=\"resolvedId()\"\n [formControl]=\"searchInput\"\n [attr.placeholder]=\"placeholder() ? (placeholder() | translate) : null\"\n [attr.readonly]=\"isReadonly() ? 'readonly' : null\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-controls]=\"listboxId()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-required]=\"isRequired() ? 'true' : null\"\n [attr.aria-invalid]=\"ariaInvalid() ? 'true' : null\"\n [attr.aria-describedby]=\"ariaDescribedBy()\"\n autocomplete=\"off\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n (keydown)=\"onKeyDown($event)\">\n\n @if (loading()) {\n <div class=\"autocomplete-loader-container d-flex-h\">\n <span class=\"autocomplete-loader spinner-border spinner-border-sm\" aria-hidden=\"true\"></span>\n </div>\n }\n </div>\n\n @if (showListbox()) {\n <ul\n #listboxEl\n class=\"list-unstyled autocomplete-listbox dropdown-menu show\"\n role=\"listbox\"\n [id]=\"listboxId()\"\n [attr.aria-labelledby]=\"resolvedId()\"\n [attr.aria-multiselectable]=\"multiple() ? 'true' : null\"\n (mousedown)=\"$event.preventDefault()\">\n\n @if (multiple()) {\n <!-- Option de listbox : le clavier est gere sur l'input role=\"combobox\"\n (aria-activedescendant + onKeyDown) ; conformement au pattern WAI-ARIA,\n les options ne sont pas focusables et le (click) est un confort souris. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <li\n role=\"option\"\n [id]=\"masterOptionId()\"\n class=\"autocomplete-option autocomplete-option-master\"\n [class.is-active]=\"activeRow() === MASTER_ROW\"\n [attr.aria-selected]=\"masterState() === 'checked' ? 'true' : 'false'\"\n (mouseenter)=\"onMasterMouseEnter()\"\n (click)=\"onMasterClick()\">\n <input\n #masterCheckbox\n type=\"checkbox\"\n class=\"field-check-input\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [checked]=\"masterState() === 'checked'\">\n <span class=\"autocomplete-master-label fs-sm\">\n {{ (masterState() === 'checked'\n ? '_COMMON._ACTION.DESELECT_ALL'\n : '_COMMON._ACTION.SELECT_ALL') | translate }}\n </span>\n </li>\n }\n\n @for (item of items(); track $index; let rowIdx = $index) {\n <!-- Option de listbox : clavier gere sur l'input role=\"combobox\"\n (aria-activedescendant + onKeyDown) ; options non focusables (WAI-ARIA),\n (click) = confort souris. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <li\n role=\"option\"\n [id]=\"optionId(rowIdx)\"\n class=\"autocomplete-option\"\n [class.is-active]=\"activeRow() === rowIdx\"\n [class.is-disabled]=\"isItemDisabled(item)\"\n [attr.aria-selected]=\"multiple() ? (isItemSelected(item) ? 'true' : 'false') : (activeRow() === rowIdx ? 'true' : null)\"\n [attr.aria-disabled]=\"isItemDisabled(item) ? 'true' : null\"\n (mouseenter)=\"onRowMouseEnter(rowIdx)\"\n (click)=\"onRowClick(rowIdx)\">\n\n @if (multiple()) {\n <input\n type=\"checkbox\"\n class=\"field-check-input\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [disabled]=\"isItemDisabled(item)\"\n [checked]=\"isItemSelected(item)\">\n }\n\n @if (optionTemplate(); as tpl) {\n <!-- Gabarit du consommateur : contenu seul, a cote de la case (mode multiple). -->\n <span class=\"autocomplete-option-custom flex-grow-1 fs-sm\">\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"optionContext(item, rowIdx)\"></ng-container>\n </span>\n } @else {\n <!-- Texte principal et colonnes additionnelles empiles, a cote de la case (mode multiple). -->\n <span class=\"d-flex-v gap-5xs\">\n <span class=\"autocomplete-option-main fs-sm\" [innerHTML]=\"highlight(getColumnText(item, 0))\"></span>\n\n @for (col of columns(); track col.field; let colIdx = $index) {\n <span class=\"autocomplete-option-additionnal text-muted fs-xs\"\n [innerHTML]=\"highlight(getColumnText(item, colIdx + 1))\"></span>\n }\n </span>\n }\n </li>\n }\n </ul>\n }\n\n @if (showNoResult()) {\n <div class=\"autocomplete-listbox dropdown-menu show fs-sm px-md\" aria-hidden=\"true\">\n {{ '_COMMON.NO_RESULT' | translate }}\n </div>\n }\n</div>\n\n <!-- Les chips de la multi-s\u00E9lection sont rendus par le parent cw-form-field (hors field-group),\n \u00E0 partir de `chips()` + `onChipRemove()`. Voir form-field.component.html. -->\n\n <!-- Live region pour annonces lecteur d'\u00E9cran -->\n <div\n [id]=\"liveId()\"\n class=\"visually-hidden\"\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\">\n @if (liveMessageKey(); as key) {\n {{ key | translate: { total: items().length } }}\n }\n </div>\n", styles: [":host{display:block;width:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "directive", type: ClickOutsideDirective, selector: "[clickOutside]", outputs: ["clickOutside"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
|
|
2966
3012
|
}
|
|
2967
3013
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: AutocompleteComponent, decorators: [{
|
|
2968
3014
|
type: Component,
|
|
@@ -2971,8 +3017,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImpo
|
|
|
2971
3017
|
ReactiveFormsModule,
|
|
2972
3018
|
TranslateModule,
|
|
2973
3019
|
ClickOutsideDirective
|
|
2974
|
-
], template: "<div\n class=\"autocomplete-wrapper\"\n (clickOutside)=\"onClickOutside()\">\n\n <div class=\"field-group\">\n <input\n type=\"text\"\n class=\"field-control autocomplete-input\"\n [class.has-value]=\"hasAnyContent()\"\n [id]=\"resolvedId()\"\n [formControl]=\"searchInput\"\n [attr.placeholder]=\"placeholder() ? (placeholder() | translate) : null\"\n [attr.readonly]=\"isReadonly() ? 'readonly' : null\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-controls]=\"listboxId()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-required]=\"isRequired() ? 'true' : null\"\n [attr.aria-invalid]=\"ariaInvalid() ? 'true' : null\"\n [attr.aria-describedby]=\"ariaDescribedBy()\"\n autocomplete=\"off\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n (keydown)=\"onKeyDown($event)\">\n\n @if (loading()) {\n <div class=\"autocomplete-loader-container d-flex-h\">\n <span class=\"autocomplete-loader spinner-border spinner-border-sm\" aria-hidden=\"true\"></span>\n </div>\n }\n </div>\n\n @if (showListbox()) {\n <ul\n #listboxEl\n class=\"list-unstyled autocomplete-listbox dropdown-menu show\"\n role=\"listbox\"\n [id]=\"listboxId()\"\n [attr.aria-labelledby]=\"resolvedId()\"\n [attr.aria-multiselectable]=\"multiple() ? 'true' : null\"\n (mousedown)=\"$event.preventDefault()\">\n\n @if (multiple()) {\n <!-- Option de listbox : le clavier est gere sur l'input role=\"combobox\"\n (aria-activedescendant + onKeyDown) ; conformement au pattern WAI-ARIA,\n les options ne sont pas focusables et le (click) est un confort souris. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <li\n role=\"option\"\n [id]=\"masterOptionId()\"\n class=\"autocomplete-option autocomplete-option-master\"\n [class.is-active]=\"activeRow() === MASTER_ROW\"\n [attr.aria-selected]=\"masterState() === 'checked' ? 'true' : 'false'\"\n (mouseenter)=\"onMasterMouseEnter()\"\n (click)=\"onMasterClick()\">\n <input\n #masterCheckbox\n type=\"checkbox\"\n class=\"field-check-input\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [checked]=\"masterState() === 'checked'\">\n <span class=\"autocomplete-master-label fs-sm\">\n {{ (masterState() === 'checked'\n ? '_COMMON._ACTION.DESELECT_ALL'\n : '_COMMON._ACTION.SELECT_ALL') | translate }}\n </span>\n </li>\n }\n\n @for (item of items(); track $index; let rowIdx = $index) {\n <!-- Option de listbox : clavier gere sur l'input role=\"combobox\"\n (aria-activedescendant + onKeyDown) ; options non focusables (WAI-ARIA),\n (click) = confort souris. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <li\n role=\"option\"\n [id]=\"optionId(rowIdx)\"\n class=\"autocomplete-option\"\n [class.is-active]=\"activeRow() === rowIdx\"\n [class.is-disabled]=\"isItemDisabled(item)\"\n [attr.aria-selected]=\"multiple() ? (isItemSelected(item) ? 'true' : 'false') : (activeRow() === rowIdx ? 'true' : null)\"\n [attr.aria-disabled]=\"isItemDisabled(item) ? 'true' : null\"\n (mouseenter)=\"onRowMouseEnter(rowIdx)\"\n (click)=\"onRowClick(rowIdx)\">\n\n @if (multiple()) {\n <input\n type=\"checkbox\"\n class=\"field-check-input\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [disabled]=\"isItemDisabled(item)\"\n [checked]=\"isItemSelected(item)\">\n }\n\n <!-- Texte principal et colonnes additionnelles empiles, a cote de la case (mode multiple). -->\n
|
|
2975
|
-
}], ctorParameters: () => [], propDecorators: { control: [{ type: i0.Input, args: [{ isSignal: true, alias: "control", required: true }] }], fetcher: [{ type: i0.Input, args: [{ isSignal: true, alias: "fetcher", required: true }] }], displayField: [{ type: i0.Input, args: [{ isSignal: true, alias: "displayField", required: false }] }], valueField: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueField", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], minChars: [{ type: i0.Input, args: [{ isSignal: true, alias: "minChars", required: false }] }], debounceMs: [{ type: i0.Input, args: [{ isSignal: true, alias: "debounceMs", required: false }] }], selectedItem: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedItem", required: false }] }], resolver: [{ type: i0.Input, args: [{ isSignal: true, alias: "resolver", required: false }] }], selectedItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedItems", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], isRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "isRequired", required: false }] }], isReadonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "isReadonly", required: false }] }], isDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "isDisabled", required: false }] }], ariaInvalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaInvalid", required: false }] }], ariaDescribedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaDescribedBy", required: false }] }], itemSelected: [{ type: i0.Output, args: ["itemSelected"] }], itemsChange: [{ type: i0.Output, args: ["itemsChange"] }], listboxEl: [{ type: i0.ViewChild, args: ['listboxEl', { isSignal: true }] }], masterCheckbox: [{ type: i0.ViewChild, args: ['masterCheckbox', { isSignal: true }] }] } });
|
|
3020
|
+
], template: "<div\n class=\"autocomplete-wrapper\"\n (clickOutside)=\"onClickOutside()\">\n\n <div class=\"field-group\">\n <input\n type=\"text\"\n class=\"field-control autocomplete-input\"\n [class.has-value]=\"hasAnyContent()\"\n [id]=\"resolvedId()\"\n [formControl]=\"searchInput\"\n [attr.placeholder]=\"placeholder() ? (placeholder() | translate) : null\"\n [attr.readonly]=\"isReadonly() ? 'readonly' : null\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-controls]=\"listboxId()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-required]=\"isRequired() ? 'true' : null\"\n [attr.aria-invalid]=\"ariaInvalid() ? 'true' : null\"\n [attr.aria-describedby]=\"ariaDescribedBy()\"\n autocomplete=\"off\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n (keydown)=\"onKeyDown($event)\">\n\n @if (loading()) {\n <div class=\"autocomplete-loader-container d-flex-h\">\n <span class=\"autocomplete-loader spinner-border spinner-border-sm\" aria-hidden=\"true\"></span>\n </div>\n }\n </div>\n\n @if (showListbox()) {\n <ul\n #listboxEl\n class=\"list-unstyled autocomplete-listbox dropdown-menu show\"\n role=\"listbox\"\n [id]=\"listboxId()\"\n [attr.aria-labelledby]=\"resolvedId()\"\n [attr.aria-multiselectable]=\"multiple() ? 'true' : null\"\n (mousedown)=\"$event.preventDefault()\">\n\n @if (multiple()) {\n <!-- Option de listbox : le clavier est gere sur l'input role=\"combobox\"\n (aria-activedescendant + onKeyDown) ; conformement au pattern WAI-ARIA,\n les options ne sont pas focusables et le (click) est un confort souris. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <li\n role=\"option\"\n [id]=\"masterOptionId()\"\n class=\"autocomplete-option autocomplete-option-master\"\n [class.is-active]=\"activeRow() === MASTER_ROW\"\n [attr.aria-selected]=\"masterState() === 'checked' ? 'true' : 'false'\"\n (mouseenter)=\"onMasterMouseEnter()\"\n (click)=\"onMasterClick()\">\n <input\n #masterCheckbox\n type=\"checkbox\"\n class=\"field-check-input\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [checked]=\"masterState() === 'checked'\">\n <span class=\"autocomplete-master-label fs-sm\">\n {{ (masterState() === 'checked'\n ? '_COMMON._ACTION.DESELECT_ALL'\n : '_COMMON._ACTION.SELECT_ALL') | translate }}\n </span>\n </li>\n }\n\n @for (item of items(); track $index; let rowIdx = $index) {\n <!-- Option de listbox : clavier gere sur l'input role=\"combobox\"\n (aria-activedescendant + onKeyDown) ; options non focusables (WAI-ARIA),\n (click) = confort souris. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <li\n role=\"option\"\n [id]=\"optionId(rowIdx)\"\n class=\"autocomplete-option\"\n [class.is-active]=\"activeRow() === rowIdx\"\n [class.is-disabled]=\"isItemDisabled(item)\"\n [attr.aria-selected]=\"multiple() ? (isItemSelected(item) ? 'true' : 'false') : (activeRow() === rowIdx ? 'true' : null)\"\n [attr.aria-disabled]=\"isItemDisabled(item) ? 'true' : null\"\n (mouseenter)=\"onRowMouseEnter(rowIdx)\"\n (click)=\"onRowClick(rowIdx)\">\n\n @if (multiple()) {\n <input\n type=\"checkbox\"\n class=\"field-check-input\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [disabled]=\"isItemDisabled(item)\"\n [checked]=\"isItemSelected(item)\">\n }\n\n @if (optionTemplate(); as tpl) {\n <!-- Gabarit du consommateur : contenu seul, a cote de la case (mode multiple). -->\n <span class=\"autocomplete-option-custom flex-grow-1 fs-sm\">\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"optionContext(item, rowIdx)\"></ng-container>\n </span>\n } @else {\n <!-- Texte principal et colonnes additionnelles empiles, a cote de la case (mode multiple). -->\n <span class=\"d-flex-v gap-5xs\">\n <span class=\"autocomplete-option-main fs-sm\" [innerHTML]=\"highlight(getColumnText(item, 0))\"></span>\n\n @for (col of columns(); track col.field; let colIdx = $index) {\n <span class=\"autocomplete-option-additionnal text-muted fs-xs\"\n [innerHTML]=\"highlight(getColumnText(item, colIdx + 1))\"></span>\n }\n </span>\n }\n </li>\n }\n </ul>\n }\n\n @if (showNoResult()) {\n <div class=\"autocomplete-listbox dropdown-menu show fs-sm px-md\" aria-hidden=\"true\">\n {{ '_COMMON.NO_RESULT' | translate }}\n </div>\n }\n</div>\n\n <!-- Les chips de la multi-s\u00E9lection sont rendus par le parent cw-form-field (hors field-group),\n \u00E0 partir de `chips()` + `onChipRemove()`. Voir form-field.component.html. -->\n\n <!-- Live region pour annonces lecteur d'\u00E9cran -->\n <div\n [id]=\"liveId()\"\n class=\"visually-hidden\"\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\">\n @if (liveMessageKey(); as key) {\n {{ key | translate: { total: items().length } }}\n }\n </div>\n", styles: [":host{display:block;width:100%}\n"] }]
|
|
3021
|
+
}], ctorParameters: () => [], propDecorators: { control: [{ type: i0.Input, args: [{ isSignal: true, alias: "control", required: true }] }], fetcher: [{ type: i0.Input, args: [{ isSignal: true, alias: "fetcher", required: true }] }], displayField: [{ type: i0.Input, args: [{ isSignal: true, alias: "displayField", required: false }] }], valueField: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueField", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], optionTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionTemplate", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], minChars: [{ type: i0.Input, args: [{ isSignal: true, alias: "minChars", required: false }] }], debounceMs: [{ type: i0.Input, args: [{ isSignal: true, alias: "debounceMs", required: false }] }], selectedItem: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedItem", required: false }] }], resolver: [{ type: i0.Input, args: [{ isSignal: true, alias: "resolver", required: false }] }], selectedItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedItems", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], isRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "isRequired", required: false }] }], isReadonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "isReadonly", required: false }] }], isDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "isDisabled", required: false }] }], ariaInvalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaInvalid", required: false }] }], ariaDescribedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaDescribedBy", required: false }] }], itemSelected: [{ type: i0.Output, args: ["itemSelected"] }], itemsChange: [{ type: i0.Output, args: ["itemsChange"] }], listboxEl: [{ type: i0.ViewChild, args: ['listboxEl', { isSignal: true }] }], masterCheckbox: [{ type: i0.ViewChild, args: ['masterCheckbox', { isSignal: true }] }] } });
|
|
3022
|
+
|
|
3023
|
+
/**
|
|
3024
|
+
* Gabarit du contenu d'une option d'autocomplétion, projeté dans `cw-form-field` :
|
|
3025
|
+
* `<ng-template cwAutocompleteOption let-item let-term="term">…</ng-template>`.
|
|
3026
|
+
* Type le contexte (`CwAutocompleteOptionContext`) dans le gabarit. Depuis la beta028.
|
|
3027
|
+
*/
|
|
3028
|
+
class CwAutocompleteOptionDirective {
|
|
3029
|
+
constructor() {
|
|
3030
|
+
this.templateRef = inject(TemplateRef);
|
|
3031
|
+
}
|
|
3032
|
+
static ngTemplateContextGuard(_dir, ctx) {
|
|
3033
|
+
return true;
|
|
3034
|
+
}
|
|
3035
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: CwAutocompleteOptionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3036
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.20", type: CwAutocompleteOptionDirective, isStandalone: true, selector: "ng-template[cwAutocompleteOption]", ngImport: i0 }); }
|
|
3037
|
+
}
|
|
3038
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: CwAutocompleteOptionDirective, decorators: [{
|
|
3039
|
+
type: Directive,
|
|
3040
|
+
args: [{
|
|
3041
|
+
selector: 'ng-template[cwAutocompleteOption]',
|
|
3042
|
+
standalone: true,
|
|
3043
|
+
}]
|
|
3044
|
+
}] });
|
|
2976
3045
|
|
|
2977
3046
|
/**
|
|
2978
3047
|
* Icône du bouton « édition HTML » (preset `expert`), enregistrée dans le registre
|
|
@@ -3656,6 +3725,25 @@ class FormFieldComponent {
|
|
|
3656
3725
|
|| this.type === this.typeField.checkboxCardCompact
|
|
3657
3726
|
|| this.isSwitchCard;
|
|
3658
3727
|
}
|
|
3728
|
+
/** Checkbox / switch en carte sans `options` : carte unique liée à un `FormControl<boolean>`. */
|
|
3729
|
+
get isBooleanChoiceCard() {
|
|
3730
|
+
return this.isMultiChoiceCard && (!this.options || this.options.length === 0);
|
|
3731
|
+
}
|
|
3732
|
+
/** Case à cocher booléenne seule : checkbox sans options, switch, carte booléenne. */
|
|
3733
|
+
get isBooleanField() {
|
|
3734
|
+
return this.isSingleCheckbox()
|
|
3735
|
+
|| this.type === this.typeField.switch
|
|
3736
|
+
|| this.type === this.typeField.switchSmall
|
|
3737
|
+
|| this.isBooleanChoiceCard;
|
|
3738
|
+
}
|
|
3739
|
+
/** `aria-describedby` de la carte booléenne : précision, puis erreur / aide / ids de l'écran. */
|
|
3740
|
+
get booleanCardDescribedBy() {
|
|
3741
|
+
const ids = [
|
|
3742
|
+
!this.isChoiceCardCompact && this.description ? `${this.name}-desc` : null,
|
|
3743
|
+
this.getDescribedBy(this.control),
|
|
3744
|
+
].filter(Boolean);
|
|
3745
|
+
return ids.length ? ids.join(' ') : null;
|
|
3746
|
+
}
|
|
3659
3747
|
/** Branchement `[control]` ou `[formGroup]` + `[name]` : les deux sont détectés. */
|
|
3660
3748
|
get isRange() {
|
|
3661
3749
|
const ctrl = this.controlOrGroup;
|
|
@@ -3804,6 +3892,40 @@ class FormFieldComponent {
|
|
|
3804
3892
|
return [FormFieldTypeEnum.dateToDate, FormFieldTypeEnum.timeToTime, FormFieldTypeEnum.dateTimeToDateTime]
|
|
3805
3893
|
.includes(this.type) && this.isRange;
|
|
3806
3894
|
}
|
|
3895
|
+
/** Raccourcis effectifs de la période (`dateToDate` seulement : décalages en jours). */
|
|
3896
|
+
get activePeriodShortcuts() {
|
|
3897
|
+
return this.isPeriod && this.type === FormFieldTypeEnum.dateToDate ? this.periodShortcuts ?? [] : [];
|
|
3898
|
+
}
|
|
3899
|
+
/**
|
|
3900
|
+
* Période avec addon ou raccourcis : le `.field-group` de la période porte alors les états
|
|
3901
|
+
* invalide / désactivé, comme le wrapper addon des autres types. Sans, rendu historique.
|
|
3902
|
+
*/
|
|
3903
|
+
get hasPeriodAddons() {
|
|
3904
|
+
return this.isPeriod && (!!this.addonLeft || !!this.addonRight || this.activePeriodShortcuts.length > 0);
|
|
3905
|
+
}
|
|
3906
|
+
/** Raccourci actif : les deux bornes valent exactement ses dates (recalculé à chaque saisie). */
|
|
3907
|
+
isPeriodShortcutActive(shortcut) {
|
|
3908
|
+
const start = this.getControl('start')?.value;
|
|
3909
|
+
const end = this.getControl('end')?.value;
|
|
3910
|
+
return start === this.formatDate(this.todayPlus(shortcut.start))
|
|
3911
|
+
&& end === this.formatDate(this.todayPlus(shortcut.end));
|
|
3912
|
+
}
|
|
3913
|
+
/** Écrit la période du raccourci en une seule émission de `valueChanges` du groupe. */
|
|
3914
|
+
onPeriodShortcut(shortcut) {
|
|
3915
|
+
const group = this.controlOrGroup;
|
|
3916
|
+
if (!group || this.isDisabledOrReadonly)
|
|
3917
|
+
return;
|
|
3918
|
+
group.setValue({
|
|
3919
|
+
start: this.formatDate(this.todayPlus(shortcut.start)),
|
|
3920
|
+
end: this.formatDate(this.todayPlus(shortcut.end)),
|
|
3921
|
+
});
|
|
3922
|
+
group.markAsDirty();
|
|
3923
|
+
}
|
|
3924
|
+
todayPlus(days) {
|
|
3925
|
+
const date = new Date();
|
|
3926
|
+
date.setDate(date.getDate() + days);
|
|
3927
|
+
return date;
|
|
3928
|
+
}
|
|
3807
3929
|
get hasFieldTooltip() {
|
|
3808
3930
|
return !!this.tooltip && this.displayLabel;
|
|
3809
3931
|
}
|
|
@@ -3935,22 +4057,25 @@ class FormFieldComponent {
|
|
|
3935
4057
|
}
|
|
3936
4058
|
else {
|
|
3937
4059
|
const ctrl = this.controlOrGroup;
|
|
4060
|
+
// Booléen seul : `false` n'est pas une valeur vide, la case doit être cochée. Même clé
|
|
4061
|
+
// d'erreur `required` (message inchangé). Les groupes gardent `required` (tableau non vide).
|
|
4062
|
+
const validator = this.isBooleanField ? Validators.requiredTrue : Validators.required;
|
|
3938
4063
|
if (ctrl)
|
|
3939
|
-
this.requiredAppliedMain = this.toggleRequired(ctrl, this.requiredAppliedMain, this.isRequired);
|
|
4064
|
+
this.requiredAppliedMain = this.toggleRequired(ctrl, this.requiredAppliedMain, this.isRequired, validator);
|
|
3940
4065
|
}
|
|
3941
4066
|
}
|
|
3942
|
-
/** Ajoute/retire `Validators.required` selon `required`, et retourne le nouveau flag "appliqué par nous". */
|
|
3943
|
-
toggleRequired(ctrl, alreadyApplied, required) {
|
|
4067
|
+
/** Ajoute/retire `validator` (`Validators.required` par défaut) selon `required`, et retourne le nouveau flag "appliqué par nous". */
|
|
4068
|
+
toggleRequired(ctrl, alreadyApplied, required, validator = Validators.required) {
|
|
3944
4069
|
if (required) {
|
|
3945
|
-
if (!ctrl.hasValidator(
|
|
3946
|
-
ctrl.addValidators(
|
|
4070
|
+
if (!ctrl.hasValidator(validator)) {
|
|
4071
|
+
ctrl.addValidators(validator);
|
|
3947
4072
|
ctrl.updateValueAndValidity({ emitEvent: false });
|
|
3948
4073
|
return true;
|
|
3949
4074
|
}
|
|
3950
4075
|
return alreadyApplied;
|
|
3951
4076
|
}
|
|
3952
4077
|
if (alreadyApplied) {
|
|
3953
|
-
ctrl.removeValidators(
|
|
4078
|
+
ctrl.removeValidators(validator);
|
|
3954
4079
|
ctrl.updateValueAndValidity({ emitEvent: false });
|
|
3955
4080
|
return false;
|
|
3956
4081
|
}
|
|
@@ -4453,7 +4578,7 @@ class FormFieldComponent {
|
|
|
4453
4578
|
this.formControl.markAsTouched();
|
|
4454
4579
|
}
|
|
4455
4580
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: FormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4456
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: FormFieldComponent, isStandalone: true, selector: "cw-form-field", inputs: { control: { classPropertyName: "control", publicName: "control", isSignal: false, isRequired: false, transformFunction: null }, formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: false, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: false, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: false, isRequired: false, transformFunction: null }, displayLabel: { classPropertyName: "displayLabel", publicName: "displayLabel", isSignal: false, isRequired: false, transformFunction: null }, fieldTitle: { classPropertyName: "fieldTitle", publicName: "fieldTitle", isSignal: false, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: false, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: false, isRequired: false, transformFunction: null }, autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: false, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: false, isRequired: false, transformFunction: null }, rangeOptions: { classPropertyName: "rangeOptions", publicName: "rangeOptions", isSignal: false, isRequired: false, transformFunction: null }, validationOptions: { classPropertyName: "validationOptions", publicName: "validationOptions", isSignal: false, isRequired: false, transformFunction: null }, autocompleteOptions: { classPropertyName: "autocompleteOptions", publicName: "autocompleteOptions", isSignal: false, isRequired: false, transformFunction: null }, richTextOptions: { classPropertyName: "richTextOptions", publicName: "richTextOptions", isSignal: false, isRequired: false, transformFunction: null }, errorMessages: { classPropertyName: "errorMessages", publicName: "errorMessages", isSignal: false, isRequired: false, transformFunction: null }, isRequired: { classPropertyName: "isRequired", publicName: "isRequired", isSignal: false, isRequired: false, transformFunction: null }, requiredStart: { classPropertyName: "requiredStart", publicName: "requiredStart", isSignal: false, isRequired: false, transformFunction: null }, requiredEnd: { classPropertyName: "requiredEnd", publicName: "requiredEnd", isSignal: false, isRequired: false, transformFunction: null }, help: { classPropertyName: "help", publicName: "help", isSignal: false, isRequired: false, transformFunction: null }, helpParams: { classPropertyName: "helpParams", publicName: "helpParams", isSignal: false, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", isSignal: false, isRequired: false, transformFunction: null }, ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "ariaDescribedBy", isSignal: false, isRequired: false, transformFunction: null }, addonLeft: { classPropertyName: "addonLeft", publicName: "addonLeft", isSignal: false, isRequired: false, transformFunction: null }, addonRight: { classPropertyName: "addonRight", publicName: "addonRight", isSignal: false, isRequired: false, transformFunction: null }, isInAddon: { classPropertyName: "isInAddon", publicName: "isInAddon", isSignal: false, isRequired: false, transformFunction: null }, isReadonly: { classPropertyName: "isReadonly", publicName: "isReadonly", isSignal: false, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: false, isRequired: false, transformFunction: null }, sliderValue: { classPropertyName: "sliderValue", publicName: "sliderValue", isSignal: false, isRequired: false, transformFunction: null }, sliderOptions: { classPropertyName: "sliderOptions", publicName: "sliderOptions", isSignal: false, isRequired: false, transformFunction: null }, cssClass: { classPropertyName: "cssClass", publicName: "cssClass", isSignal: false, isRequired: false, transformFunction: null }, skeletonMode: { classPropertyName: "skeletonMode", publicName: "skeletonMode", isSignal: false, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: false, isRequired: false, transformFunction: null }, appendTo: { classPropertyName: "appendTo", publicName: "appendTo", isSignal: false, isRequired: false, transformFunction: null }, initialCountry: { classPropertyName: "initialCountry", publicName: "initialCountry", isSignal: false, isRequired: false, transformFunction: null }, recommendedDimensions: { classPropertyName: "recommendedDimensions", publicName: "recommendedDimensions", isSignal: false, isRequired: false, transformFunction: null }, showPreview: { classPropertyName: "showPreview", publicName: "showPreview", isSignal: false, isRequired: false, transformFunction: null }, existingFile: { classPropertyName: "existingFile", publicName: "existingFile", isSignal: false, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { refreshEvent: "refreshEvent", fileRemoved: "fileRemoved", textChanged: "textChanged", valueChange: "valueChange", phoneRegionChange: "phoneRegionChange" }, host: { properties: { "class": "this.hostClasses" } }, queries: [{ propertyName: "optionTemplate", first: true, predicate: ["ngOptionTpl"], descendants: true, read: TemplateRef }, { propertyName: "labelTemplate", first: true, predicate: ["ngLabelTpl"], descendants: true, read: TemplateRef }], viewQueries: [{ propertyName: "checkboxInputRef", first: true, predicate: ["checkboxInput"], descendants: true, isSignal: true }, { propertyName: "fileInputRef", first: true, predicate: ["fileInput"], descendants: true, isSignal: true }, { propertyName: "phoneInputRef", first: true, predicate: ["phoneInput"], descendants: true, isSignal: true }, { propertyName: "autocompleteRef", first: true, predicate: AutocompleteComponent, descendants: true, isSignal: true }, { propertyName: "ngSelectRef", first: true, predicate: NgSelectComponent, descendants: true, isSignal: true }], usesOnChanges: true, ngImport: i0, template: "@if (!isInAddon) {\n @if (\n type !== typeField.checkbox &&\n type !== typeField.radio &&\n type !== typeField.checkboxButton &&\n type !== typeField.radioButton &&\n type !== typeField.checkboxInline &&\n type !== typeField.radioInline &&\n type !== typeField.switch &&\n type !== typeField.range &&\n type !== typeField.switchSmall &&\n !isChoiceCard &&\n !isPeriod\n ) {\n <!-- Bouton d'aide HORS du <label> (bouton dans un label = HTML invalide, son libelle\n polluerait le nom accessible du champ et un clic activerait le label) : on aligne\n label + bouton dans un conteneur flex, seulement quand il y a une aide. -->\n @if (hasFieldTooltip) {\n <div class=\"d-flex-h gap-2xs\">\n <ng-container *ngTemplateOutlet=\"fieldLabel\"></ng-container>\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n </div>\n } @else {\n <ng-container *ngTemplateOutlet=\"fieldLabel\"></ng-container>\n }\n }\n\n @if (addonLeft || addonRight) {\n <div class=\"field-group\" [class.field-group-invalid]=\"isInvalid\" [class.field-group-disabled]=\"isDisabledOrReadonly\">\n @if(addonLeft) {\n <div class=\"field-group-addon-left\">\n <ng-container [ngTemplateOutlet]=\"addonLeft\"></ng-container>\n </div>\n }\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\n @if(addonRight) {\n <div class=\"field-group-addon-right\">\n <ng-container [ngTemplateOutlet]=\"addonRight\"></ng-container>\n </div>\n }\n </div>\n }\n @else {\n @if ( isInInputGroup() ) {\n <div class=\"field-group\" [class.field-group-invalid]=\"isInvalid\" [class.field-group-disabled]=\"isDisabledOrReadonly\">\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\n </div>\n }\n @else {\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\n }\n }\n\n <!-- Error message -->\n @if (controlOrGroup?.invalid && controlOrGroup?.touched) {\n <div class=\"field-invalid\" [id]=\"'error-' + name\">\n @if (\n !errorMessages?.['required'] &&\n ((controlOrGroup?.errors?.['required']) || (getControl('start')?.errors?.['required'] || getControl('end')?.errors?.['required']))\n ) {\n <span [innerHtml]=\"'_COMMON._FORM.ERROR_IS_MANDATORY' | translate: {label: label | translate}\"></span>\n }\n @if (!errorMessages?.['rangeInvalid'] && controlOrGroup?.errors?.['rangeInvalid']) {\n <span>{{'_COMMON._DATES.ERROR_START_END_PERIOD' | translate}}</span>\n }\n @if (!errorMessages?.['fileExtension'] && controlOrGroup?.errors?.['fileExtension']) {\n <span>{{ '_COMMON._FORM.ERROR_FILE_EXTENSION' | translate: { accept: acceptLabel } }}</span>\n }\n @if (!errorMessages?.['fileSize'] && controlOrGroup?.errors?.['fileSize']) {\n <span>{{ '_COMMON._FORM.ERROR_FILE_SIZE' | translate: { maxSize: maxSizeLabel } }}</span>\n }\n @if (!errorMessages?.['email'] && controlOrGroup?.errors?.['email']) {\n <span>{{ '_COMMON._FORM.ERROR_INVALID_EMAIL' | translate }}</span>\n }\n @if (!errorMessages?.['phone'] && controlOrGroup?.errors?.['phone']) {\n <span>{{ '_COMMON._FORM.ERROR_INVALID_PHONE' | translate }}</span>\n }\n @if (errorMessages) {\n @for (entry of errorMessages | keyvalue: keepOrder; track entry.key) {\n @if (controlOrGroup?.errors?.[entry.key]; as errVal) {\n <span>{{ entry.value | translate: (errVal === true ? null : errVal) }}</span>\n }\n }\n }\n </div>\n }\n\n @if (help || autoHelpEntries.length) {\n <div [id]=\"name + '-help'\" class=\"field-text\">\n @if (help) {\n <span>{{ help | translate: helpParams }}</span>\n }\n @for (entry of autoHelpEntries; track entry.key) {\n <!-- Espace explicite : les blancs entre balises sont supprim\u00E9s \u00E0 la compilation. -->\n {{ ' ' }}<span>{{ entry.key | translate: entry.params }}</span>\n }\n </div>\n }\n\n <!-- Aper\u00E7u du fichier (type=file, opt-in) : sous le champ et ses aides, comme dans la\n maquette DS. La croix native du champ n'est pas retir\u00E9e \u2014 les deux vident le m\u00EAme\n control, l'aper\u00E7u ajoute juste \u00AB Visualiser \u00BB et une cible plus grande. -->\n @if (isPreviewVisible) {\n <cw-file-preview [file]=\"previewFile\" [existingFile]=\"existingFile ?? null\"\n [disabled]=\"!!isDisabledOrReadonly\" (remove)=\"onPreviewRemove()\" />\n }\n\n <!-- Chips de la multi-s\u00E9lection (autocomplete) : rendus ici, hors du field-group et apr\u00E8s\n erreur/help, pour \u00EAtre visuellement d\u00E9tach\u00E9s du champ. La donn\u00E9e et le retrait restent\n port\u00E9s par cw-autocomplete (`chips()` / `onChipRemove()`), seul l'affichage est d\u00E9l\u00E9gu\u00E9. -->\n @if (type === typeField.autocompleteMultiple && autocompleteRef()?.chips()?.length) {\n <ul class=\"autocomplete-chips\" role=\"list\">\n @for (chip of autocompleteRef()!.chips(); track chip.item) {\n <li>\n <button type=\"button\" class=\"autocomplete-chip\"\n [disabled]=\"isEffectivelyDisabled || isReadonly\"\n (click)=\"autocompleteRef()!.onChipRemove(chip.item)\">\n <span>{{ chip.label }}</span>\n @if (!isEffectivelyDisabled && !isReadonly) {\n <span aria-hidden=\"true\" class=\"autocomplete-chip-x\">×</span>\n <span class=\"visually-hidden\">{{ '_COMMON._ACTION.DELETE' | translate }}</span>\n }\n </button>\n </li>\n }\n </ul>\n }\n}\n@else {\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\n}\n\n<ng-template #field>\n <!-- Autocomplete (mono / multi) -->\n @if ((type === typeField.autocomplete || type === typeField.autocompleteMultiple) && autocompleteOptions) {\n <cw-autocomplete\n [id]=\"name\"\n [control]=\"formControl\"\n [fetcher]=\"autocompleteOptions.fetcher\"\n [displayField]=\"autocompleteOptions.displayField ?? 'label'\"\n [valueField]=\"autocompleteOptions.valueField ?? 'id'\"\n [columns]=\"autocompleteOptions.columns ?? []\"\n [resolver]=\"autocompleteOptions.resolver ?? null\"\n [selectedItem]=\"autocompleteOptions.selectedItem ?? null\"\n [selectedItems]=\"autocompleteOptions.selectedItems ?? []\"\n [minChars]=\"autocompleteOptions.minChars ?? 2\"\n [debounceMs]=\"autocompleteOptions.debounceMs ?? 250\"\n [multiple]=\"type === typeField.autocompleteMultiple\"\n [isRequired]=\"isRequired\"\n [isReadonly]=\"!!isReadonly\"\n [isDisabled]=\"isEffectivelyDisabled\"\n [ariaInvalid]=\"control.invalid && control.touched\"\n [ariaDescribedBy]=\"getDescribedBy(control)\"\n [placeholder]=\"placeholder\">\n </cw-autocomplete>\n }\n\n <!-- Rich text editor (Quill) : sous-composant interne, sans field-group ni bouton clear\n (il porte sa propre bordure + toolbar). Le label statique du form-field reste au-dessus. -->\n @if (type === typeField.richText) {\n <cw-rich-text-editor\n [id]=\"name\"\n [control]=\"formControl\"\n [options]=\"richTextOptions\"\n [placeholder]=\"placeholder ? (placeholder | translate) : ''\"\n [isRequired]=\"isRequired\"\n [isReadonly]=\"!!isReadonly\"\n [isDisabled]=\"isEffectivelyDisabled\"\n [ariaInvalid]=\"control.invalid && control.touched\"\n [ariaDescribedBy]=\"getDescribedBy(control)\">\n </cw-rich-text-editor>\n }\n\n <!-- Text -->\n @if ([typeField.text, typeField.date, typeField.time, typeField.dateTime, typeField.number,\n typeField.email,\n typeField.color, typeField.zipCode].includes(type)) {\n <input [type]=\"type === typeField.zipCode ? 'text' : type\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\n [attr.title]=\"fieldTitle ? (fieldTitle | translate) : null\"\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '', type === typeField.zipCode ? 'field-control-zipcode' : '']\"\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [attr.aria-required]=\"isRequired\"\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\"\n [attr.min]=\"minAttr\" [attr.max]=\"maxAttr\" [attr.step]=\"stepAttr\" [attr.pattern]=\"patternAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\n }\n\n <!-- Phone (intl-tel-input) -->\n @if (type === typeField.phone) {\n <input #phoneInput type=\"tel\" class=\"field-control\" [id]=\"name\"\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [disabled]=\"isEffectivelyDisabled\" [attr.aria-required]=\"isRequired\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (focus)=\"onFocus()\" (blur)=\"onPhoneBlur($event)\" />\n }\n\n <!-- File -->\n @if (type === typeField.file) {\n <!-- L'input natif reste LE controle (focus, clavier, restitution aux lecteurs d'ecran,\n validation), mais il est masque visuellement : le libelle de son bouton et son\n \u00AB aucun fichier choisi \u00BB sont ecrits par le NAVIGATEUR, dans SA langue. Ils sont\n intraduisibles et ne suivent pas la langue de l'application \u2014 un utilisateur qui\n bascule en anglais garderait \u00AB Choisir un fichier \u00BB. On les reecrit donc a cote,\n traduits, dans une couche purement visuelle. -->\n <input #fileInput type=\"file\" class=\"field-control visually-hidden\" [id]=\"name\"\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\n [attr.required]=\"isRequired ? 'required' : null\"\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [disabled]=\"isEffectivelyDisabled\" [attr.aria-required]=\"isRequired\"\n [attr.accept]=\"acceptAttr\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (change)=\"onFileChange($event)\" (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\n\n <!-- `aria-hidden` : doublon visuel de l'input, que les lecteurs d'ecran restituent deja\n (nom du champ, bouton de parcours, fichier selectionne). L'annoncer une seconde fois\n ne ferait que bavarder. Le clic est relaye a l'input, le clavier passe par lui. -->\n <span class=\"field-file\" aria-hidden=\"true\" (click)=\"openFilePicker()\">\n <span class=\"field-file-button\">{{ '_COMMON._FORM.CHOOSE_FILE' | translate }}</span>\n <span class=\"field-file-name\" [class.field-file-name-empty]=\"!selectedFileName\">\n {{ selectedFileName ?? ('_COMMON._FORM.NO_FILE_SELECTED' | translate) }}\n </span>\n </span>\n }\n\n @if (type === typeField.password) {\n <input [type]=\"isPasswordShown ? 'text' : 'password'\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\n [attr.required]=\"isRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.aria-required]=\"isRequired\"\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\" [attr.pattern]=\"patternAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\n <cw-button [type]=\"buttonType.ghost\"\n cssClass=\"btn-password-field\"\n [withIcon]=\"isPasswordShown ? spriteIcon.toolbarHidePassword : spriteIcon.toolbarShowPassword\"\n [withOnlyIcon]=\"true\"\n [label]=\"isPasswordShown ? '_COMMON._FORM._SHOW_HIDE_PWD.HIDE' : '_COMMON._FORM._SHOW_HIDE_PWD.SHOW'\"\n (btnAction)=\"togglePasswordVisibility()\">\n </cw-button>\n }\n\n <!-- Textarea -->\n @if (type === typeField.textarea) {\n <textarea class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"\n [attr.aria-required]=\"isRequired\" [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\" [attr.pattern]=\"patternAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\"></textarea>\n }\n\n <!-- Select -->\n @if (type === typeField.select) {\n <ng-select [formControl]=\"formControl\" [items]=\"options\" bindLabel=\"label\" [labelForId]=\"name\" [appendTo]=\"appendTo ?? ''\" bindValue=\"value\"\n [ngClass]=\"cssClass\" [searchable]=\"false\" [placeholder]=\"placeholder ? (placeholder | translate) : ''\" [readonly]=\"isReadonly\" [clearable]=\"false\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.required]=\"isRequired ? 'required' : null\"\n [attr.aria-required]=\"isRequired\" [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\" [attr.id]=\"name\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" (open)=\"onDropdownOpen()\" (close)=\"onDropdownClose()\">\n\n <!-- Template pour les options -->\n <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\">\n @if (optionTemplate) {\n <ng-container *ngTemplateOutlet=\"optionTemplate; context: { item: item | translate, index: index, searchTerm: search }\"></ng-container>\n }\n @else {\n <div>{{ item.label | translate }}</div>\n }\n </ng-template>\n\n <!-- Template pour le label -->\n <ng-template ng-label-tmp let-item=\"item\">\n @if (labelTemplate) {\n <ng-container *ngTemplateOutlet=\"labelTemplate; context: { item: item | translate }\"></ng-container>\n }\n @else {\n {{ (item.label | translate) || (placeholder | translate) }}\n }\n </ng-template>\n </ng-select>\n }\n\n <!-- NgSelect -->\n @if (type === typeField.ngSelect || type === typeField.ngSelectMultiple) {\n <ng-select [formControl]=\"formControl\" [items]=\"options\" bindLabel=\"label\" [labelForId]=\"name\" [appendTo]=\"appendTo ?? ''\" bindValue=\"value\"\n [multiple]=\"type === typeField.ngSelectMultiple\" [ngClass]=\"cssClass\" [clearable]=\"false\"\n [placeholder]=\"placeholder ? (placeholder | translate) : ''\" [readonly]=\"isReadonly\"\n [notFoundText]=\"'_COMMON.NO_RESULT' | translate\" [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"\n [attr.required]=\"isRequired ? 'required' : null\" [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\" [attr.id]=\"name\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" (search)=\"textChanged.emit($event?.term)\"\n (open)=\"onDropdownOpen()\" (close)=\"onDropdownClose()\">\n\n <!-- Template pour les options -->\n <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\">\n @if (optionTemplate) {\n <ng-container *ngTemplateOutlet=\"optionTemplate; context: { item: item, index: index, searchTerm: search }\"></ng-container>\n }\n @else {\n <div>{{ item.label | translate }}</div>\n }\n </ng-template>\n\n <!-- Template pour le label -->\n <ng-template ng-label-tmp let-item=\"item\" let-clear=\"clear\">\n <span class=\"ng-value-icon left\" (click)=\"clear(item)\" aria-hidden=\"true\">\u00D7</span>\n @if (labelTemplate) {\n <ng-container *ngTemplateOutlet=\"labelTemplate; context: { item: item | translate }\"></ng-container>\n }\n @else {\n {{ (item.label | translate) || (placeholder | translate) }}\n }\n </ng-template>\n </ng-select>\n }\n\n <!-- Radio -->\n @if (type === typeField.radioInline || type === typeField.radio) {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.radioInline ? 'd-flex-h gap-md flex-wrap' : 'd-flex-v gap-sm'\">\n @for (opt of options; track opt.value) {\n <li class=\"field-check\">\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [attr.name]=\"name\" [value]=\"opt.value\" [formControl]=\"formControl\"\n class=\"field-check-input\" [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" (change)=\"onRadioChange(opt.value)\" />\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">{{ opt.label | translate }}</label>\n </li>\n }\n </ul>\n </fieldset>\n }\n\n <!-- Radio button -->\n @if (type === typeField.radioButton) {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <div class=\"field-group field-group-btn\">\n @for (opt of options; track opt.value) {\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [attr.name]=\"name\" [value]=\"opt.value\" [formControl]=\"formControl\"\n class=\"visually-hidden\" [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" (change)=\"onRadioChange(opt.value)\"/>\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">{{ opt.label | translate }}</label>\n }\n </div>\n </fieldset>\n }\n\n <!-- Cartes : checkbox / radio / switch (contr\u00F4le \u00E0 gauche, titre, description facultative) -->\n @if (isChoiceCard) {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <ul class=\"field-card-list list-unstyled mb-none\" [class.field-card-list-compact]=\"isChoiceCardCompact\">\n @for (opt of options; track opt.value) {\n <li class=\"d-flex-v\">\n <!-- Le label englobe toute la carte : un clic n'importe o\u00F9 coche l'option. -->\n <label class=\"field-card d-flex-h items-start gap-xs flex-1\" [for]=\"name + '_' + opt.value\" [class.field-switch]=\"isSwitchCard\" [class.field-switch-small]=\"isSwitchCard\">\n @if (isRadioCard) {\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [attr.name]=\"name\" [value]=\"opt.value\" [formControl]=\"formControl\"\n class=\"field-check-input\"\n [attr.aria-describedby]=\"(!isChoiceCardCompact && opt.description) ? name + '_' + opt.value + '-desc' : null\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" (change)=\"onRadioChange(opt.value)\" />\n } @else {\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\n [checked]=\"control.value?.includes(opt.value)\" class=\"field-check-input\"\n [attr.role]=\"isSwitchCard ? 'switch' : null\"\n [attr.aria-describedby]=\"(!isChoiceCardCompact && opt.description) ? name + '_' + opt.value + '-desc' : null\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\n }\n <span class=\"d-flex-v gap-5xs\">\n <span class=\"field-card-title\">{{ opt.label | translate }}</span>\n @if (!isChoiceCardCompact && opt.description) {\n <span class=\"field-text\" [id]=\"name + '_' + opt.value + '-desc'\">{{ opt.description | translate }}</span>\n }\n </span>\n </label>\n </li>\n }\n </ul>\n </fieldset>\n }\n\n <!-- Checkbox Switch -->\n @if ( type === typeField.switch || type === typeField.switchSmall)\n {\n <div class=\"field-check field-switch\" [ngClass]=\"{'field-switch-small': type === typeField.switchSmall}\">\n <input type=\"checkbox\" [id]=\"name\" [formControl]=\"formControl\" class=\"field-check-input\" [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"/>\n <label [for]=\"name\" class=\"field-check-label\">{{ label | translate }}</label>\n </div>\n }\n\n <!-- Checkbox -->\n @if (type === typeField.checkboxInline || type === typeField.checkbox) {\n @if (isSingleCheckbox()) {\n <div class=\"field-check\" [class.field-check-inline]=\"type === typeField.checkboxInline\">\n <input #checkboxInput type=\"checkbox\" [id]=\"name\" [formControl]=\"formControl\"\n class=\"field-check-input\"\n [class.is-invalid]=\"control?.invalid && control?.touched\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control?.invalid && control?.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" />\n <label [for]=\"name\" class=\"field-check-label\">\n {{ label | translate }}\n @if (isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n </div>\n }\n @else if( options.length > 1) {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n [ngClass]=\"{ 'flex-column': type === typeField.checkbox }\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.checkboxInline ? 'd-flex-h gap-md' : 'd-flex-v gap-sm'\">\n @for (opt of options; track opt.value) {\n <li class=\"field-check\" [ngClass]=\"{ 'field-check-inline': type === typeField.checkboxInline }\">\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\n [checked]=\"control.value?.includes(opt.value)\" class=\"field-check-input\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">\n {{ opt.label | translate }}\n </label>\n </li>\n }\n </ul>\n </fieldset>\n }\n @else {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.checkboxInline ? 'd-flex-h gap-md' : 'd-flex-v gap-sm'\">\n @for (opt of options; track opt.value) {\n <li class=\"field-check\" [ngClass]=\"{ 'field-check-inline': type === typeField.checkboxInline }\">\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\n [checked]=\"control.value?.includes(opt.value)\" class=\"field-check-input\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">\n {{ opt.label | translate }}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n </li>\n }\n </ul>\n </fieldset>\n }\n }\n\n <!-- Checkbox button -->\n @if (type === typeField.checkboxButton && options.length > 0) {\n\n @if(options.length > 1) {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <div class=\"field-group field-group-btn\">\n @for (opt of options; track opt.value) {\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\n [checked]=\"control.value?.includes(opt.value)\" class=\"visually-hidden\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">{{ opt.label | translate }}</label>\n }\n </div>\n </fieldset>\n }\n @else {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <div class=\"btn-group btn-group-secondary\">\n @for (opt of options; track opt.value) {\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\n [checked]=\"control.value?.includes(opt.value)\" class=\"visually-hidden\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\"/>\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">\n {{ opt.label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n }\n </div>\n </fieldset>\n }\n }\n\n <!-- Period - DateToDate / TimeToTime / DateTimeToDateTime -->\n @if (isPeriod) {\n <!-- Fieldset : le legend nomme la p\u00E9riode, \u00AB Du \u00BB / \u00AB au \u00BB sont les labels de chaque input. -->\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n <!-- Deux bornes obligatoires : ast\u00E9risque sur la p\u00E9riode ; une seule : sur sa borne. -->\n @if(isStartRequired && isEndRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <div class=\"field-group\">\n <label class=\"field-group-addon-left\" [for]=\"name + '_start'\">\n {{ '_COMMON._DATES.FROM_TO_1' | translate }}\n @if(isStartRequired && !isEndRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n <input [type]=\"getInputType()\" class=\"field-control\" [id]=\"name + '_start'\" [formControl]=\"getControl('start')!\"\n [attr.title]=\"fieldTitle ? (fieldTitle | translate) + ' \u2013 ' + ('_COMMON._DATES.FROM_TO_1' | translate) : null\"\n [attr.placeholder]=\"type === typeField.timeToTime ? ('_COMMON._DATES.FROM' | translate) : ('_COMMON._DATES.FROM_TO_1' | translate)\"\n [ngClass]=\"[(cssClass || ''), getControl('start')?.value ? 'has-value' : '']\"\n [attr.required]=\"isStartRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.aria-required]=\"isStartRequired\"\n [attr.min]=\"minStartAttr\" [attr.max]=\"maxStartAttr\" [attr.step]=\"stepAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"getControl('start')?.invalid && getControl('start')?.touched\"\n [attr.aria-describedby]=\"getDescribedBy(getControl('start'))\"\n (focus)=\"onFocusRange('start')\" (blur)=\"onBlurRange('start')\" />\n\n @if(getControl('start')?.value && !isDisabledOrReadonly) {\n <button type=\"button\" class=\"btn btn-secondary btn-clear-field\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_START' | translate: { label: label | translate }\"\n (click)=\"onClearFieldPeriod('start')\">\n <span aria-hidden=\"true\">×</span>\n </button>\n }\n <label class=\"field-group-addon-center\" [for]=\"name + '_end'\">\n {{ '_COMMON._DATES.FROM_TO_2' | translate }}\n @if(isEndRequired && !isStartRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n <input [type]=\"getInputType()\" class=\"field-control\" [id]=\"name + '_end'\" [formControl]=\"getControl('end')!\"\n [attr.title]=\"fieldTitle ? (fieldTitle | translate) + ' \u2013 ' + ('_COMMON._DATES.FROM_TO_2' | translate) : null\"\n [attr.placeholder]=\"type === typeField.timeToTime ? ('_COMMON._DATES.TO' | translate) : ('_COMMON._DATES.FROM_TO_2' | translate)\"\n [ngClass]=\"[(cssClass || ''), getControl('end')?.value ? 'has-value' : '']\"\n [attr.required]=\"isEndRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.aria-required]=\"isEndRequired\"\n [attr.min]=\"minEndAttr\" [attr.max]=\"maxEndAttr\" [attr.step]=\"stepAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"getControl('end')?.invalid && getControl('end')?.touched\"\n [attr.aria-describedby]=\"getDescribedBy(getControl('end'))\"\n (focus)=\"onFocusRange('end')\" (blur)=\"onBlurRange('end')\" />\n\n @if(getControl('end')?.value && !isDisabledOrReadonly) {\n <button type=\"button\" class=\"btn btn-ghost btn-clear-field\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_END' | translate: { label: label | translate }\"\n (click)=\"onClearFieldPeriod('end')\">\n <span aria-hidden=\"true\">×</span>\n </button>\n }\n </div>\n </fieldset>\n }\n\n @if ([typeField.datePlusOne, typeField.datePlusTwo, typeField.datePlusSeven, typeField.dateComplexe].includes(type)) {\n\n <div class=\"field-group\">\n @if (type === typeField.dateComplexe) {\n <div class=\"field-group-addon-left\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onDateAddDay('prev')\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.nextLeft\" [label]=\"'Jour pr\u00E9c\u00E9dent'\"></cw-icon>\n </button>\n </div>\n }\n\n <input type=\"date\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\n [attr.title]=\"fieldTitle ? (fieldTitle | translate) : null\"\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [attr.aria-required]=\"isRequired\"\n [attr.min]=\"minAttr\" [attr.max]=\"maxAttr\" [attr.step]=\"stepAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\n\n @if(formControl?.value && !isDisabledOrReadonly) {\n <button class=\"btn btn-ghost btn-clear-field\" type=\"button\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_FIELD' | translate: { label: label | translate }\"\n (click)=\"onClearField(formControl)\"><span aria-hidden=\"true\">×</span></button>\n }\n\n\n @if (type === typeField.dateComplexe) {\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onDateAddDay('next')\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.nextRight\" [label]=\"'Jour suivant'\"></cw-icon>\n </button>\n </div>\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onRefresh()\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.toolbarRefresh\" [label]=\"'Rafra\u00EEchir'\"></cw-icon>\n </button>\n </div>\n }\n\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onTodayAddDay(0)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n J\n <span class=\"visually-hidden\">Aujourd'hui</span>\n </button>\n </div>\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onTodayAddDay(1)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n J+1\n <span class=\"visually-hidden\">Demain</span>\n </button>\n </div>\n\n @if (type !== typeField.datePlusOne && type !== typeField.dateComplexe) {\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost \" type=\"button\" (click)=\"onTodayAddDay(2)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n J+2\n <span class=\"visually-hidden\">Dans 2 jours</span>\n </button>\n </div>\n\n @if (type !== typeField.datePlusTwo) {\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onTodayAddDay(7)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n J+7\n <span class=\"visually-hidden\">Dans 7 jours</span>\n </button>\n </div>\n }\n }\n </div>\n }\n\n @if (type === typeField.slider) {\n <ngx-slider [(value)]=\"sliderValue\" [options]=\"sliderOptions\" [formControl]=\"formControl\"></ngx-slider>\n }\n\n @if (type === typeField.range) {\n <div class=\"slider\">\n\n <cw-button [isDisabled]=\"formControl.value <= rangeOptions.floor\" [label]=\"'Diminuer ' + formControl.value + ' ' + label\"\n [withIcon]=\"spriteIcon.toolbarMinus\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\"\n [iconSize]=\"buttonIconSize.small\" (btnAction)=\"onRangeStep('decrease')\">\n </cw-button>\n\n <div class=\"slider-input\">\n <label [for]=\"name\" class=\"slider-tooltip\" [style.left]=\"getRangePercent() + '%'\" aria-live=\"polite\"\n aria-atomic=\"true\">\n {{ label | translate }} {{ formControl.value }}\n @if (rangeOptions.unit) {\n <abbr [title]=\"rangeOptions.unit\">{{ rangeOptions.unit }}</abbr>\n }\n </label>\n\n <div class=\"slider-custom-bar\">\n <div class=\"slider-custom-bar-selection\" [style.width]=\"getRangePercent() + '%'\">\n </div>\n </div>\n\n <input type=\"range\" [id]=\"name\" [formControl]=\"formControl\" [min]=\"rangeOptions.floor\" [max]=\"rangeOptions.ceil\"\n [step]=\"rangeOptions.step || 1\" class=\"field-control-range\" [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\">\n </div>\n\n <cw-button [isDisabled]=\"formControl.value >= rangeOptions.ceil\" [label]=\"'Augmenter ' + formControl.value + ' ' + label\"\n [withIcon]=\"spriteIcon.toolbarPlus\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\"\n [iconSize]=\"buttonIconSize.small\" (btnAction)=\"onRangeStep('increase')\">\n </cw-button>\n </div>\n }\n\n @if (isInInputGroup() && clearable && !isDisabledOrReadonly && type !== typeField.autocompleteMultiple) {\n @if (type === typeField.autocomplete) {\n @if (autocompleteRef()?.hasAnyContent()) {\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_FIELD' | translate: { label: label | translate }\"\n (click)=\"onClearAutocomplete()\"><span aria-hidden=\"true\">×</span></button>\n }\n } @else if (type === typeField.ngSelectMultiple) {\n <!-- value est un tableau : un [] vide \u00E9tant truthy, on teste .length pour n'afficher le clear global que s'il y a au moins une s\u00E9lection. -->\n @if (formControl?.value?.length) {\n <button class=\"btn btn-ghost btn-clear-field\" type=\"button\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_FIELD' | translate: { label: label | translate }\"\n (click)=\"onClearField(formControl)\"><span aria-hidden=\"true\">×</span></button>\n }\n } @else {\n @if(formControl?.value) {\n <button class=\"btn btn-ghost btn-clear-field\" type=\"button\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_FIELD' | translate: { label: label | translate }\"\n (click)=\"onClearField(formControl)\"><span aria-hidden=\"true\">×</span></button>\n }\n }\n }\n\n</ng-template>\n\n<ng-template #fieldLabel>\n <label [for]=\"name\" class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\n {{ label | translate }}\n\n @if (isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n</ng-template>\n\n<!-- Bouton d'aide (tooltip) partage label/legend. Hors du <label> (sinon son libelle\n s'ajoute au nom du champ et le clic active le label) ; dans un <legend>, le fieldset\n est nomme par aria-labelledby sur le seul texte (legendId) pour la meme raison. -->\n<ng-template #fieldTooltip>\n <button type=\"button\" class=\"btn btn-ghost btn-field-tooltip\"\n [cwTooltip]=\"tooltip ?? ''\"\n [attr.data-test-ctw]=\"'tooltip-' + name\">\n <cw-icon [icon]=\"spriteIcon.alertHelp\" [type]=\"iconType.circular\" [iconUiType]=\"iconUiType.info\"\n [iconSize]=\"iconSize.xs\" [label]=\"'_COMMON._FORM.TOOLTIP_HELP' | translate\"></cw-icon>\n </button>\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.RangeValueAccessor, selector: "input[type=range][formControlName],input[type=range][formControl],input[type=range][ngModel]" }, { kind: "directive", type: i2$1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2$1.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: NgSelectModule }, { kind: "component", type: i3.NgSelectComponent, selector: "ng-select", inputs: ["ariaLabelDropdown", "bindLabel", "bindValue", "ariaLabel", "markFirst", "placeholder", "fixedPlaceholder", "notFoundText", "typeToSearchText", "preventToggleOnRightClick", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "tabFocusOnClearButton", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "ngClass", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "deselectOnClick", "keyDownFn"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }, { kind: "directive", type: i3.NgOptionTemplateDirective, selector: "[ng-option-tmp]" }, { kind: "directive", type: i3.NgLabelTemplateDirective, selector: "[ng-label-tmp]" }, { kind: "ngmodule", type: NgxSliderModule }, { kind: "component", type: i4.SliderComponent, selector: "ngx-slider", inputs: ["value", "highValue", "options", "manualRefresh", "triggerFocus", "cancelUserChange"], outputs: ["valueChange", "highValueChange", "userChangeStart", "userChange", "userChangeEnd"] }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "text", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom", "spritePath"] }, { kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "labelParams", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "loadingAnnounce", "cssClass", "dataTest", "skeletonMode", "isPressed", "ariaDescribedBy", "ariaLabel", "ariaExpanded", "ariaControls", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { kind: "directive", type: CwTooltipDirective, selector: "[cwTooltip]", inputs: ["cwTooltip", "cwTooltipTitle", "cwTooltipType", "cwTooltipTrigger", "cwTooltipPosition", "cwTooltipDisabled"] }, { kind: "component", type: AutocompleteComponent, selector: "cw-autocomplete", inputs: ["control", "fetcher", "displayField", "valueField", "columns", "multiple", "minChars", "debounceMs", "selectedItem", "resolver", "selectedItems", "placeholder", "id", "isRequired", "isReadonly", "isDisabled", "ariaInvalid", "ariaDescribedBy"], outputs: ["itemSelected", "itemsChange"] }, { kind: "component", type: RichTextEditorComponent, selector: "cw-rich-text-editor", inputs: ["control", "options", "id", "placeholder", "isRequired", "isReadonly", "isDisabled", "ariaInvalid", "ariaDescribedBy"], outputs: ["valueChange"] }, { kind: "component", type: FilePreviewComponent, selector: "cw-file-preview", inputs: ["file", "existingFile", "showActions", "disabled", "dataTest"], outputs: ["remove"] }, { kind: "pipe", type: i1.KeyValuePipe, name: "keyvalue" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
|
|
4581
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: FormFieldComponent, isStandalone: true, selector: "cw-form-field", inputs: { control: { classPropertyName: "control", publicName: "control", isSignal: false, isRequired: false, transformFunction: null }, formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: false, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: false, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: false, isRequired: false, transformFunction: null }, displayLabel: { classPropertyName: "displayLabel", publicName: "displayLabel", isSignal: false, isRequired: false, transformFunction: null }, fieldTitle: { classPropertyName: "fieldTitle", publicName: "fieldTitle", isSignal: false, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: false, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: false, isRequired: false, transformFunction: null }, autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: false, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: false, isRequired: false, transformFunction: null }, rangeOptions: { classPropertyName: "rangeOptions", publicName: "rangeOptions", isSignal: false, isRequired: false, transformFunction: null }, validationOptions: { classPropertyName: "validationOptions", publicName: "validationOptions", isSignal: false, isRequired: false, transformFunction: null }, autocompleteOptions: { classPropertyName: "autocompleteOptions", publicName: "autocompleteOptions", isSignal: false, isRequired: false, transformFunction: null }, richTextOptions: { classPropertyName: "richTextOptions", publicName: "richTextOptions", isSignal: false, isRequired: false, transformFunction: null }, errorMessages: { classPropertyName: "errorMessages", publicName: "errorMessages", isSignal: false, isRequired: false, transformFunction: null }, isRequired: { classPropertyName: "isRequired", publicName: "isRequired", isSignal: false, isRequired: false, transformFunction: null }, requiredStart: { classPropertyName: "requiredStart", publicName: "requiredStart", isSignal: false, isRequired: false, transformFunction: null }, requiredEnd: { classPropertyName: "requiredEnd", publicName: "requiredEnd", isSignal: false, isRequired: false, transformFunction: null }, periodShortcuts: { classPropertyName: "periodShortcuts", publicName: "periodShortcuts", isSignal: false, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: false, isRequired: false, transformFunction: null }, help: { classPropertyName: "help", publicName: "help", isSignal: false, isRequired: false, transformFunction: null }, helpParams: { classPropertyName: "helpParams", publicName: "helpParams", isSignal: false, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", isSignal: false, isRequired: false, transformFunction: null }, ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "ariaDescribedBy", isSignal: false, isRequired: false, transformFunction: null }, addonLeft: { classPropertyName: "addonLeft", publicName: "addonLeft", isSignal: false, isRequired: false, transformFunction: null }, addonRight: { classPropertyName: "addonRight", publicName: "addonRight", isSignal: false, isRequired: false, transformFunction: null }, isInAddon: { classPropertyName: "isInAddon", publicName: "isInAddon", isSignal: false, isRequired: false, transformFunction: null }, isReadonly: { classPropertyName: "isReadonly", publicName: "isReadonly", isSignal: false, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: false, isRequired: false, transformFunction: null }, sliderValue: { classPropertyName: "sliderValue", publicName: "sliderValue", isSignal: false, isRequired: false, transformFunction: null }, sliderOptions: { classPropertyName: "sliderOptions", publicName: "sliderOptions", isSignal: false, isRequired: false, transformFunction: null }, cssClass: { classPropertyName: "cssClass", publicName: "cssClass", isSignal: false, isRequired: false, transformFunction: null }, skeletonMode: { classPropertyName: "skeletonMode", publicName: "skeletonMode", isSignal: false, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: false, isRequired: false, transformFunction: null }, appendTo: { classPropertyName: "appendTo", publicName: "appendTo", isSignal: false, isRequired: false, transformFunction: null }, initialCountry: { classPropertyName: "initialCountry", publicName: "initialCountry", isSignal: false, isRequired: false, transformFunction: null }, recommendedDimensions: { classPropertyName: "recommendedDimensions", publicName: "recommendedDimensions", isSignal: false, isRequired: false, transformFunction: null }, showPreview: { classPropertyName: "showPreview", publicName: "showPreview", isSignal: false, isRequired: false, transformFunction: null }, existingFile: { classPropertyName: "existingFile", publicName: "existingFile", isSignal: false, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { refreshEvent: "refreshEvent", fileRemoved: "fileRemoved", textChanged: "textChanged", valueChange: "valueChange", phoneRegionChange: "phoneRegionChange" }, host: { properties: { "class": "this.hostClasses" } }, queries: [{ propertyName: "optionTemplate", first: true, predicate: ["ngOptionTpl"], descendants: true, read: TemplateRef }, { propertyName: "labelTemplate", first: true, predicate: ["ngLabelTpl"], descendants: true, read: TemplateRef }, { propertyName: "autocompleteOptionTpl", first: true, predicate: CwAutocompleteOptionDirective, descendants: true }], viewQueries: [{ propertyName: "checkboxInputRef", first: true, predicate: ["checkboxInput"], descendants: true, isSignal: true }, { propertyName: "fileInputRef", first: true, predicate: ["fileInput"], descendants: true, isSignal: true }, { propertyName: "phoneInputRef", first: true, predicate: ["phoneInput"], descendants: true, isSignal: true }, { propertyName: "autocompleteRef", first: true, predicate: AutocompleteComponent, descendants: true, isSignal: true }, { propertyName: "ngSelectRef", first: true, predicate: NgSelectComponent, descendants: true, isSignal: true }], usesOnChanges: true, ngImport: i0, template: "@if (!isInAddon) {\n @if (\n type !== typeField.checkbox &&\n type !== typeField.radio &&\n type !== typeField.checkboxButton &&\n type !== typeField.radioButton &&\n type !== typeField.checkboxInline &&\n type !== typeField.radioInline &&\n type !== typeField.switch &&\n type !== typeField.range &&\n type !== typeField.switchSmall &&\n !isChoiceCard &&\n !isPeriod\n ) {\n <!-- Bouton d'aide HORS du <label> (bouton dans un label = HTML invalide, son libelle\n polluerait le nom accessible du champ et un clic activerait le label) : on aligne\n label + bouton dans un conteneur flex, seulement quand il y a une aide. -->\n @if (hasFieldTooltip) {\n <div class=\"d-flex-h gap-2xs\">\n <ng-container *ngTemplateOutlet=\"fieldLabel\"></ng-container>\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n </div>\n } @else {\n <ng-container *ngTemplateOutlet=\"fieldLabel\"></ng-container>\n }\n }\n\n <!-- Une p\u00E9riode rend ses addons dans son propre field-group (entre les bornes et le fieldset). -->\n @if ((addonLeft || addonRight) && !isPeriod) {\n <div class=\"field-group\" [class.field-group-invalid]=\"isInvalid\" [class.field-group-disabled]=\"isDisabledOrReadonly\">\n @if(addonLeft) {\n <div class=\"field-group-addon-left\">\n <ng-container [ngTemplateOutlet]=\"addonLeft\"></ng-container>\n </div>\n }\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\n @if(addonRight) {\n <div class=\"field-group-addon-right\">\n <ng-container [ngTemplateOutlet]=\"addonRight\"></ng-container>\n </div>\n }\n </div>\n }\n @else {\n @if ( isInInputGroup() ) {\n <div class=\"field-group\" [class.field-group-invalid]=\"isInvalid\" [class.field-group-disabled]=\"isDisabledOrReadonly\">\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\n </div>\n }\n @else {\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\n }\n }\n\n <!-- Error message -->\n @if (controlOrGroup?.invalid && controlOrGroup?.touched) {\n <div class=\"field-invalid\" [id]=\"'error-' + name\">\n @if (\n !errorMessages?.['required'] &&\n ((controlOrGroup?.errors?.['required']) || (getControl('start')?.errors?.['required'] || getControl('end')?.errors?.['required']))\n ) {\n <span [innerHtml]=\"'_COMMON._FORM.ERROR_IS_MANDATORY' | translate: {label: label | translate}\"></span>\n }\n @if (!errorMessages?.['rangeInvalid'] && controlOrGroup?.errors?.['rangeInvalid']) {\n <span>{{'_COMMON._DATES.ERROR_START_END_PERIOD' | translate}}</span>\n }\n @if (!errorMessages?.['fileExtension'] && controlOrGroup?.errors?.['fileExtension']) {\n <span>{{ '_COMMON._FORM.ERROR_FILE_EXTENSION' | translate: { accept: acceptLabel } }}</span>\n }\n @if (!errorMessages?.['fileSize'] && controlOrGroup?.errors?.['fileSize']) {\n <span>{{ '_COMMON._FORM.ERROR_FILE_SIZE' | translate: { maxSize: maxSizeLabel } }}</span>\n }\n @if (!errorMessages?.['email'] && controlOrGroup?.errors?.['email']) {\n <span>{{ '_COMMON._FORM.ERROR_INVALID_EMAIL' | translate }}</span>\n }\n @if (!errorMessages?.['phone'] && controlOrGroup?.errors?.['phone']) {\n <span>{{ '_COMMON._FORM.ERROR_INVALID_PHONE' | translate }}</span>\n }\n @if (errorMessages) {\n @for (entry of errorMessages | keyvalue: keepOrder; track entry.key) {\n @if (controlOrGroup?.errors?.[entry.key]; as errVal) {\n <span>{{ entry.value | translate: (errVal === true ? null : errVal) }}</span>\n }\n }\n }\n </div>\n }\n\n @if (help || autoHelpEntries.length) {\n <div [id]=\"name + '-help'\" class=\"field-text\">\n @if (help) {\n <span>{{ help | translate: helpParams }}</span>\n }\n @for (entry of autoHelpEntries; track entry.key) {\n <!-- Espace explicite : les blancs entre balises sont supprim\u00E9s \u00E0 la compilation. -->\n {{ ' ' }}<span>{{ entry.key | translate: entry.params }}</span>\n }\n </div>\n }\n\n <!-- Aper\u00E7u du fichier (type=file, opt-in) : sous le champ et ses aides, comme dans la\n maquette DS. La croix native du champ n'est pas retir\u00E9e \u2014 les deux vident le m\u00EAme\n control, l'aper\u00E7u ajoute juste \u00AB Visualiser \u00BB et une cible plus grande. -->\n @if (isPreviewVisible) {\n <cw-file-preview [file]=\"previewFile\" [existingFile]=\"existingFile ?? null\"\n [disabled]=\"!!isDisabledOrReadonly\" (remove)=\"onPreviewRemove()\" />\n }\n\n <!-- Chips de la multi-s\u00E9lection (autocomplete) : rendus ici, hors du field-group et apr\u00E8s\n erreur/help, pour \u00EAtre visuellement d\u00E9tach\u00E9s du champ. La donn\u00E9e et le retrait restent\n port\u00E9s par cw-autocomplete (`chips()` / `onChipRemove()`), seul l'affichage est d\u00E9l\u00E9gu\u00E9. -->\n @if (type === typeField.autocompleteMultiple && autocompleteRef()?.chips()?.length) {\n <ul class=\"autocomplete-chips\" role=\"list\">\n @for (chip of autocompleteRef()!.chips(); track chip.item) {\n <li>\n <button type=\"button\" class=\"autocomplete-chip\"\n [disabled]=\"isEffectivelyDisabled || isReadonly\"\n (click)=\"autocompleteRef()!.onChipRemove(chip.item)\">\n <span>{{ chip.label }}</span>\n @if (!isEffectivelyDisabled && !isReadonly) {\n <span aria-hidden=\"true\" class=\"autocomplete-chip-x\">×</span>\n <span class=\"visually-hidden\">{{ '_COMMON._ACTION.DELETE' | translate }}</span>\n }\n </button>\n </li>\n }\n </ul>\n }\n}\n@else {\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\n}\n\n<ng-template #field>\n <!-- Autocomplete (mono / multi) -->\n @if ((type === typeField.autocomplete || type === typeField.autocompleteMultiple) && autocompleteOptions) {\n <cw-autocomplete\n [id]=\"name\"\n [control]=\"formControl\"\n [fetcher]=\"autocompleteOptions.fetcher\"\n [displayField]=\"autocompleteOptions.displayField ?? 'label'\"\n [valueField]=\"autocompleteOptions.valueField ?? 'id'\"\n [columns]=\"autocompleteOptions.columns ?? []\"\n [optionTemplate]=\"autocompleteOptions.optionTemplate ?? autocompleteOptionTpl?.templateRef ?? null\"\n [resolver]=\"autocompleteOptions.resolver ?? null\"\n [selectedItem]=\"autocompleteOptions.selectedItem ?? null\"\n [selectedItems]=\"autocompleteOptions.selectedItems ?? []\"\n [minChars]=\"autocompleteOptions.minChars ?? 2\"\n [debounceMs]=\"autocompleteOptions.debounceMs ?? 250\"\n [multiple]=\"type === typeField.autocompleteMultiple\"\n [isRequired]=\"isRequired\"\n [isReadonly]=\"!!isReadonly\"\n [isDisabled]=\"isEffectivelyDisabled\"\n [ariaInvalid]=\"control.invalid && control.touched\"\n [ariaDescribedBy]=\"getDescribedBy(control)\"\n [placeholder]=\"placeholder\">\n </cw-autocomplete>\n }\n\n <!-- Rich text editor (Quill) : sous-composant interne, sans field-group ni bouton clear\n (il porte sa propre bordure + toolbar). Le label statique du form-field reste au-dessus. -->\n @if (type === typeField.richText) {\n <cw-rich-text-editor\n [id]=\"name\"\n [control]=\"formControl\"\n [options]=\"richTextOptions\"\n [placeholder]=\"placeholder ? (placeholder | translate) : ''\"\n [isRequired]=\"isRequired\"\n [isReadonly]=\"!!isReadonly\"\n [isDisabled]=\"isEffectivelyDisabled\"\n [ariaInvalid]=\"control.invalid && control.touched\"\n [ariaDescribedBy]=\"getDescribedBy(control)\">\n </cw-rich-text-editor>\n }\n\n <!-- Text -->\n @if ([typeField.text, typeField.date, typeField.time, typeField.dateTime, typeField.number,\n typeField.email,\n typeField.color, typeField.zipCode].includes(type)) {\n <input [type]=\"type === typeField.zipCode ? 'text' : type\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\n [attr.title]=\"fieldTitle ? (fieldTitle | translate) : null\"\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '', type === typeField.zipCode ? 'field-control-zipcode' : '']\"\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [attr.aria-required]=\"isRequired\"\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\"\n [attr.min]=\"minAttr\" [attr.max]=\"maxAttr\" [attr.step]=\"stepAttr\" [attr.pattern]=\"patternAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\n }\n\n <!-- Phone (intl-tel-input) -->\n @if (type === typeField.phone) {\n <input #phoneInput type=\"tel\" class=\"field-control\" [id]=\"name\"\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [disabled]=\"isEffectivelyDisabled\" [attr.aria-required]=\"isRequired\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (focus)=\"onFocus()\" (blur)=\"onPhoneBlur($event)\" />\n }\n\n <!-- File -->\n @if (type === typeField.file) {\n <!-- L'input natif reste LE controle (focus, clavier, restitution aux lecteurs d'ecran,\n validation), mais il est masque visuellement : le libelle de son bouton et son\n \u00AB aucun fichier choisi \u00BB sont ecrits par le NAVIGATEUR, dans SA langue. Ils sont\n intraduisibles et ne suivent pas la langue de l'application \u2014 un utilisateur qui\n bascule en anglais garderait \u00AB Choisir un fichier \u00BB. On les reecrit donc a cote,\n traduits, dans une couche purement visuelle. -->\n <input #fileInput type=\"file\" class=\"field-control visually-hidden\" [id]=\"name\"\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\n [attr.required]=\"isRequired ? 'required' : null\"\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [disabled]=\"isEffectivelyDisabled\" [attr.aria-required]=\"isRequired\"\n [attr.accept]=\"acceptAttr\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (change)=\"onFileChange($event)\" (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\n\n <!-- `aria-hidden` : doublon visuel de l'input, que les lecteurs d'ecran restituent deja\n (nom du champ, bouton de parcours, fichier selectionne). L'annoncer une seconde fois\n ne ferait que bavarder. Le clic est relaye a l'input, le clavier passe par lui. -->\n <span class=\"field-file\" aria-hidden=\"true\" (click)=\"openFilePicker()\">\n <span class=\"field-file-button\">{{ '_COMMON._FORM.CHOOSE_FILE' | translate }}</span>\n <span class=\"field-file-name\" [class.field-file-name-empty]=\"!selectedFileName\">\n {{ selectedFileName ?? ('_COMMON._FORM.NO_FILE_SELECTED' | translate) }}\n </span>\n </span>\n }\n\n @if (type === typeField.password) {\n <input [type]=\"isPasswordShown ? 'text' : 'password'\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\n [attr.required]=\"isRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.aria-required]=\"isRequired\"\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\" [attr.pattern]=\"patternAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\n <cw-button [type]=\"buttonType.ghost\"\n cssClass=\"btn-password-field\"\n [withIcon]=\"isPasswordShown ? spriteIcon.toolbarHidePassword : spriteIcon.toolbarShowPassword\"\n [withOnlyIcon]=\"true\"\n [label]=\"isPasswordShown ? '_COMMON._FORM._SHOW_HIDE_PWD.HIDE' : '_COMMON._FORM._SHOW_HIDE_PWD.SHOW'\"\n (btnAction)=\"togglePasswordVisibility()\">\n </cw-button>\n }\n\n <!-- Textarea -->\n @if (type === typeField.textarea) {\n <textarea class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"\n [attr.aria-required]=\"isRequired\" [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\" [attr.pattern]=\"patternAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\"></textarea>\n }\n\n <!-- Select -->\n @if (type === typeField.select) {\n <ng-select [formControl]=\"formControl\" [items]=\"options\" bindLabel=\"label\" [labelForId]=\"name\" [appendTo]=\"appendTo ?? ''\" bindValue=\"value\"\n [ngClass]=\"cssClass\" [searchable]=\"false\" [placeholder]=\"placeholder ? (placeholder | translate) : ''\" [readonly]=\"isReadonly\" [clearable]=\"false\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.required]=\"isRequired ? 'required' : null\"\n [attr.aria-required]=\"isRequired\" [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\" [attr.id]=\"name\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" (open)=\"onDropdownOpen()\" (close)=\"onDropdownClose()\">\n\n <!-- Template pour les options -->\n <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\">\n @if (optionTemplate) {\n <ng-container *ngTemplateOutlet=\"optionTemplate; context: { item: item | translate, index: index, searchTerm: search }\"></ng-container>\n }\n @else {\n <div>{{ item.label | translate }}</div>\n }\n </ng-template>\n\n <!-- Template pour le label -->\n <ng-template ng-label-tmp let-item=\"item\">\n @if (labelTemplate) {\n <ng-container *ngTemplateOutlet=\"labelTemplate; context: { item: item | translate }\"></ng-container>\n }\n @else {\n {{ (item.label | translate) || (placeholder | translate) }}\n }\n </ng-template>\n </ng-select>\n }\n\n <!-- NgSelect -->\n @if (type === typeField.ngSelect || type === typeField.ngSelectMultiple) {\n <ng-select [formControl]=\"formControl\" [items]=\"options\" bindLabel=\"label\" [labelForId]=\"name\" [appendTo]=\"appendTo ?? ''\" bindValue=\"value\"\n [multiple]=\"type === typeField.ngSelectMultiple\" [ngClass]=\"cssClass\" [clearable]=\"false\"\n [placeholder]=\"placeholder ? (placeholder | translate) : ''\" [readonly]=\"isReadonly\"\n [notFoundText]=\"'_COMMON.NO_RESULT' | translate\" [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"\n [attr.required]=\"isRequired ? 'required' : null\" [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\" [attr.id]=\"name\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" (search)=\"textChanged.emit($event?.term)\"\n (open)=\"onDropdownOpen()\" (close)=\"onDropdownClose()\">\n\n <!-- Template pour les options -->\n <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\">\n @if (optionTemplate) {\n <ng-container *ngTemplateOutlet=\"optionTemplate; context: { item: item, index: index, searchTerm: search }\"></ng-container>\n }\n @else {\n <div>{{ item.label | translate }}</div>\n }\n </ng-template>\n\n <!-- Template pour le label -->\n <ng-template ng-label-tmp let-item=\"item\" let-clear=\"clear\">\n <span class=\"ng-value-icon left\" (click)=\"clear(item)\" aria-hidden=\"true\">\u00D7</span>\n @if (labelTemplate) {\n <ng-container *ngTemplateOutlet=\"labelTemplate; context: { item: item | translate }\"></ng-container>\n }\n @else {\n {{ (item.label | translate) || (placeholder | translate) }}\n }\n </ng-template>\n </ng-select>\n }\n\n <!-- Radio -->\n @if (type === typeField.radioInline || type === typeField.radio) {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.radioInline ? 'd-flex-h gap-md flex-wrap' : 'd-flex-v gap-sm'\">\n @for (opt of options; track opt.value) {\n <li class=\"field-check\">\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [attr.name]=\"name\" [value]=\"opt.value\" [formControl]=\"formControl\"\n class=\"field-check-input\" [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" (change)=\"onRadioChange(opt.value)\" />\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">{{ opt.label | translate }}</label>\n </li>\n }\n </ul>\n </fieldset>\n }\n\n <!-- Radio button -->\n @if (type === typeField.radioButton) {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <div class=\"field-group field-group-btn\">\n @for (opt of options; track opt.value) {\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [attr.name]=\"name\" [value]=\"opt.value\" [formControl]=\"formControl\"\n class=\"visually-hidden\" [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" (change)=\"onRadioChange(opt.value)\"/>\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">{{ opt.label | translate }}</label>\n }\n </div>\n </fieldset>\n }\n\n <!-- Cartes : checkbox / radio / switch (contr\u00F4le \u00E0 gauche, titre, description facultative) -->\n @if (isChoiceCard) {\n @if (isBooleanChoiceCard) {\n <!-- Carte bool\u00E9enne (sans options) : une case li\u00E9e au FormControl<boolean>, nomm\u00E9e par le titre. -->\n <div class=\"field-card-list\" [class.field-card-list-compact]=\"isChoiceCardCompact\">\n <label class=\"field-card d-flex-h items-start gap-xs\" [for]=\"name\" [class.field-switch]=\"isSwitchCard\" [class.field-switch-small]=\"isSwitchCard\">\n <input type=\"checkbox\" [id]=\"name\" [formControl]=\"formControl\" class=\"field-check-input\"\n [attr.role]=\"isSwitchCard ? 'switch' : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"booleanCardDescribedBy\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" />\n <span class=\"d-flex-v gap-5xs\">\n <span class=\"field-card-title\">\n {{ label | translate }}\n @if (isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (!isChoiceCardCompact && description) {\n <span class=\"field-text\" [id]=\"name + '-desc'\">{{ description | translate }}</span>\n }\n </span>\n </label>\n </div>\n } @else {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <ul class=\"field-card-list list-unstyled mb-none\" [class.field-card-list-compact]=\"isChoiceCardCompact\">\n @for (opt of options; track opt.value) {\n <li class=\"d-flex-v\">\n <!-- Le label englobe toute la carte : un clic n'importe o\u00F9 coche l'option. -->\n <label class=\"field-card d-flex-h items-start gap-xs flex-1\" [for]=\"name + '_' + opt.value\" [class.field-switch]=\"isSwitchCard\" [class.field-switch-small]=\"isSwitchCard\">\n @if (isRadioCard) {\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [attr.name]=\"name\" [value]=\"opt.value\" [formControl]=\"formControl\"\n class=\"field-check-input\"\n [attr.aria-describedby]=\"(!isChoiceCardCompact && opt.description) ? name + '_' + opt.value + '-desc' : null\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" (change)=\"onRadioChange(opt.value)\" />\n } @else {\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\n [checked]=\"control.value?.includes(opt.value)\" class=\"field-check-input\"\n [attr.role]=\"isSwitchCard ? 'switch' : null\"\n [attr.aria-describedby]=\"(!isChoiceCardCompact && opt.description) ? name + '_' + opt.value + '-desc' : null\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\n }\n <span class=\"d-flex-v gap-5xs\">\n <span class=\"field-card-title\">{{ opt.label | translate }}</span>\n @if (!isChoiceCardCompact && opt.description) {\n <span class=\"field-text\" [id]=\"name + '_' + opt.value + '-desc'\">{{ opt.description | translate }}</span>\n }\n </span>\n </label>\n </li>\n }\n </ul>\n </fieldset>\n }\n }\n\n <!-- Checkbox Switch -->\n @if ( type === typeField.switch || type === typeField.switchSmall)\n {\n <div class=\"field-check field-switch\" [ngClass]=\"{'field-switch-small': type === typeField.switchSmall}\">\n <input type=\"checkbox\" [id]=\"name\" [formControl]=\"formControl\" class=\"field-check-input\" [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"/>\n <label [for]=\"name\" class=\"field-check-label\">{{ label | translate }}</label>\n </div>\n }\n\n <!-- Checkbox -->\n @if (type === typeField.checkboxInline || type === typeField.checkbox) {\n @if (isSingleCheckbox()) {\n <div class=\"field-check\" [class.field-check-inline]=\"type === typeField.checkboxInline\">\n <input #checkboxInput type=\"checkbox\" [id]=\"name\" [formControl]=\"formControl\"\n class=\"field-check-input\"\n [class.is-invalid]=\"control?.invalid && control?.touched\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control?.invalid && control?.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" />\n <label [for]=\"name\" class=\"field-check-label\">\n {{ label | translate }}\n @if (isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n </div>\n }\n @else if( options.length > 1) {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n [ngClass]=\"{ 'flex-column': type === typeField.checkbox }\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.checkboxInline ? 'd-flex-h gap-md' : 'd-flex-v gap-sm'\">\n @for (opt of options; track opt.value) {\n <li class=\"field-check\" [ngClass]=\"{ 'field-check-inline': type === typeField.checkboxInline }\">\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\n [checked]=\"control.value?.includes(opt.value)\" class=\"field-check-input\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">\n {{ opt.label | translate }}\n </label>\n </li>\n }\n </ul>\n </fieldset>\n }\n @else {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.checkboxInline ? 'd-flex-h gap-md' : 'd-flex-v gap-sm'\">\n @for (opt of options; track opt.value) {\n <li class=\"field-check\" [ngClass]=\"{ 'field-check-inline': type === typeField.checkboxInline }\">\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\n [checked]=\"control.value?.includes(opt.value)\" class=\"field-check-input\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">\n {{ opt.label | translate }}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n </li>\n }\n </ul>\n </fieldset>\n }\n }\n\n <!-- Checkbox button -->\n @if (type === typeField.checkboxButton && options.length > 0) {\n\n @if(options.length > 1) {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <div class=\"field-group field-group-btn\">\n @for (opt of options; track opt.value) {\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\n [checked]=\"control.value?.includes(opt.value)\" class=\"visually-hidden\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">{{ opt.label | translate }}</label>\n }\n </div>\n </fieldset>\n }\n @else {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <div class=\"btn-group btn-group-secondary\">\n @for (opt of options; track opt.value) {\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\n [checked]=\"control.value?.includes(opt.value)\" class=\"visually-hidden\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\"/>\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">\n {{ opt.label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n }\n </div>\n </fieldset>\n }\n }\n\n <!-- Period - DateToDate / TimeToTime / DateTimeToDateTime -->\n @if (isPeriod) {\n <!-- Fieldset : le legend nomme la p\u00E9riode, \u00AB Du \u00BB / \u00AB au \u00BB sont les labels de chaque input. -->\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n <!-- Deux bornes obligatoires : ast\u00E9risque sur la p\u00E9riode ; une seule : sur sa borne. -->\n @if(isStartRequired && isEndRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <!-- \u00C9tats invalide / d\u00E9sactiv\u00E9 pos\u00E9s seulement avec addon ou raccourcis (rendu historique sinon). -->\n <div class=\"field-group\"\n [class.field-group-invalid]=\"hasPeriodAddons && isInvalid\"\n [class.field-group-disabled]=\"hasPeriodAddons && isDisabledOrReadonly\">\n @if (addonLeft) {\n <div class=\"field-group-addon-left\">\n <ng-container [ngTemplateOutlet]=\"addonLeft\"></ng-container>\n </div>\n }\n <label class=\"field-group-addon-left\" [for]=\"name + '_start'\">\n {{ '_COMMON._DATES.FROM_TO_1' | translate }}\n @if(isStartRequired && !isEndRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n <input [type]=\"getInputType()\" class=\"field-control\" [id]=\"name + '_start'\" [formControl]=\"getControl('start')!\"\n [attr.title]=\"fieldTitle ? (fieldTitle | translate) + ' \u2013 ' + ('_COMMON._DATES.FROM_TO_1' | translate) : null\"\n [attr.placeholder]=\"type === typeField.timeToTime ? ('_COMMON._DATES.FROM' | translate) : ('_COMMON._DATES.FROM_TO_1' | translate)\"\n [ngClass]=\"[(cssClass || ''), getControl('start')?.value ? 'has-value' : '']\"\n [attr.required]=\"isStartRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.aria-required]=\"isStartRequired\"\n [attr.min]=\"minStartAttr\" [attr.max]=\"maxStartAttr\" [attr.step]=\"stepAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"getControl('start')?.invalid && getControl('start')?.touched\"\n [attr.aria-describedby]=\"getDescribedBy(getControl('start'))\"\n (focus)=\"onFocusRange('start')\" (blur)=\"onBlurRange('start')\" />\n\n @if(getControl('start')?.value && !isDisabledOrReadonly) {\n <button type=\"button\" class=\"btn btn-secondary btn-clear-field\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_START' | translate: { label: label | translate }\"\n (click)=\"onClearFieldPeriod('start')\">\n <span aria-hidden=\"true\">×</span>\n </button>\n }\n <label class=\"field-group-addon-center\" [for]=\"name + '_end'\">\n {{ '_COMMON._DATES.FROM_TO_2' | translate }}\n @if(isEndRequired && !isStartRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n <input [type]=\"getInputType()\" class=\"field-control\" [id]=\"name + '_end'\" [formControl]=\"getControl('end')!\"\n [attr.title]=\"fieldTitle ? (fieldTitle | translate) + ' \u2013 ' + ('_COMMON._DATES.FROM_TO_2' | translate) : null\"\n [attr.placeholder]=\"type === typeField.timeToTime ? ('_COMMON._DATES.TO' | translate) : ('_COMMON._DATES.FROM_TO_2' | translate)\"\n [ngClass]=\"[(cssClass || ''), getControl('end')?.value ? 'has-value' : '']\"\n [attr.required]=\"isEndRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.aria-required]=\"isEndRequired\"\n [attr.min]=\"minEndAttr\" [attr.max]=\"maxEndAttr\" [attr.step]=\"stepAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"getControl('end')?.invalid && getControl('end')?.touched\"\n [attr.aria-describedby]=\"getDescribedBy(getControl('end'))\"\n (focus)=\"onFocusRange('end')\" (blur)=\"onBlurRange('end')\" />\n\n @if(getControl('end')?.value && !isDisabledOrReadonly) {\n <button type=\"button\" class=\"btn btn-ghost btn-clear-field\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_END' | translate: { label: label | translate }\"\n (click)=\"onClearFieldPeriod('end')\">\n <span aria-hidden=\"true\">×</span>\n </button>\n }\n\n <!-- Raccourcis (dateToDate) puis addon droit : dans le fieldset, apr\u00E8s la borne de fin. -->\n @for (shortcut of activePeriodShortcuts; track $index) {\n <div class=\"field-group-addon-right\">\n <button type=\"button\" class=\"btn btn-ghost\"\n [class.active]=\"isPeriodShortcutActive(shortcut)\"\n [attr.aria-pressed]=\"isPeriodShortcutActive(shortcut)\"\n [attr.aria-label]=\"shortcut.ariaLabel ? (shortcut.ariaLabel | translate) : null\"\n [attr.disabled]=\"isDisabledOrReadonly ? 'disabled' : null\"\n (click)=\"onPeriodShortcut(shortcut)\">\n {{ shortcut.label | translate }}\n </button>\n </div>\n }\n @if (addonRight) {\n <div class=\"field-group-addon-right\">\n <ng-container [ngTemplateOutlet]=\"addonRight\"></ng-container>\n </div>\n }\n </div>\n </fieldset>\n }\n\n @if ([typeField.datePlusOne, typeField.datePlusTwo, typeField.datePlusSeven, typeField.dateComplexe].includes(type)) {\n\n <div class=\"field-group\">\n @if (type === typeField.dateComplexe) {\n <div class=\"field-group-addon-left\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onDateAddDay('prev')\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.nextLeft\" [label]=\"'Jour pr\u00E9c\u00E9dent'\"></cw-icon>\n </button>\n </div>\n }\n\n <input type=\"date\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\n [attr.title]=\"fieldTitle ? (fieldTitle | translate) : null\"\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [attr.aria-required]=\"isRequired\"\n [attr.min]=\"minAttr\" [attr.max]=\"maxAttr\" [attr.step]=\"stepAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\n\n @if(formControl?.value && !isDisabledOrReadonly) {\n <button class=\"btn btn-ghost btn-clear-field\" type=\"button\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_FIELD' | translate: { label: label | translate }\"\n (click)=\"onClearField(formControl)\"><span aria-hidden=\"true\">×</span></button>\n }\n\n\n @if (type === typeField.dateComplexe) {\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onDateAddDay('next')\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.nextRight\" [label]=\"'Jour suivant'\"></cw-icon>\n </button>\n </div>\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onRefresh()\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.toolbarRefresh\" [label]=\"'Rafra\u00EEchir'\"></cw-icon>\n </button>\n </div>\n }\n\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onTodayAddDay(0)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n J\n <span class=\"visually-hidden\">Aujourd'hui</span>\n </button>\n </div>\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onTodayAddDay(1)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n J+1\n <span class=\"visually-hidden\">Demain</span>\n </button>\n </div>\n\n @if (type !== typeField.datePlusOne && type !== typeField.dateComplexe) {\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost \" type=\"button\" (click)=\"onTodayAddDay(2)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n J+2\n <span class=\"visually-hidden\">Dans 2 jours</span>\n </button>\n </div>\n\n @if (type !== typeField.datePlusTwo) {\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onTodayAddDay(7)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n J+7\n <span class=\"visually-hidden\">Dans 7 jours</span>\n </button>\n </div>\n }\n }\n </div>\n }\n\n @if (type === typeField.slider) {\n <ngx-slider [(value)]=\"sliderValue\" [options]=\"sliderOptions\" [formControl]=\"formControl\"></ngx-slider>\n }\n\n @if (type === typeField.range) {\n <div class=\"slider\">\n\n <cw-button [isDisabled]=\"formControl.value <= rangeOptions.floor\" [label]=\"'Diminuer ' + formControl.value + ' ' + label\"\n [withIcon]=\"spriteIcon.toolbarMinus\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\"\n [iconSize]=\"buttonIconSize.small\" (btnAction)=\"onRangeStep('decrease')\">\n </cw-button>\n\n <div class=\"slider-input\">\n <label [for]=\"name\" class=\"slider-tooltip\" [style.left]=\"getRangePercent() + '%'\" aria-live=\"polite\"\n aria-atomic=\"true\">\n {{ label | translate }} {{ formControl.value }}\n @if (rangeOptions.unit) {\n <abbr [title]=\"rangeOptions.unit\">{{ rangeOptions.unit }}</abbr>\n }\n </label>\n\n <div class=\"slider-custom-bar\">\n <div class=\"slider-custom-bar-selection\" [style.width]=\"getRangePercent() + '%'\">\n </div>\n </div>\n\n <input type=\"range\" [id]=\"name\" [formControl]=\"formControl\" [min]=\"rangeOptions.floor\" [max]=\"rangeOptions.ceil\"\n [step]=\"rangeOptions.step || 1\" class=\"field-control-range\" [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\">\n </div>\n\n <cw-button [isDisabled]=\"formControl.value >= rangeOptions.ceil\" [label]=\"'Augmenter ' + formControl.value + ' ' + label\"\n [withIcon]=\"spriteIcon.toolbarPlus\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\"\n [iconSize]=\"buttonIconSize.small\" (btnAction)=\"onRangeStep('increase')\">\n </cw-button>\n </div>\n }\n\n @if (isInInputGroup() && clearable && !isDisabledOrReadonly && type !== typeField.autocompleteMultiple) {\n @if (type === typeField.autocomplete) {\n @if (autocompleteRef()?.hasAnyContent()) {\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_FIELD' | translate: { label: label | translate }\"\n (click)=\"onClearAutocomplete()\"><span aria-hidden=\"true\">×</span></button>\n }\n } @else if (type === typeField.ngSelectMultiple) {\n <!-- value est un tableau : un [] vide \u00E9tant truthy, on teste .length pour n'afficher le clear global que s'il y a au moins une s\u00E9lection. -->\n @if (formControl?.value?.length) {\n <button class=\"btn btn-ghost btn-clear-field\" type=\"button\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_FIELD' | translate: { label: label | translate }\"\n (click)=\"onClearField(formControl)\"><span aria-hidden=\"true\">×</span></button>\n }\n } @else {\n @if(formControl?.value) {\n <button class=\"btn btn-ghost btn-clear-field\" type=\"button\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_FIELD' | translate: { label: label | translate }\"\n (click)=\"onClearField(formControl)\"><span aria-hidden=\"true\">×</span></button>\n }\n }\n }\n\n</ng-template>\n\n<ng-template #fieldLabel>\n <label [for]=\"name\" class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\n {{ label | translate }}\n\n @if (isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n</ng-template>\n\n<!-- Bouton d'aide (tooltip) partage label/legend. Hors du <label> (sinon son libelle\n s'ajoute au nom du champ et le clic active le label) ; dans un <legend>, le fieldset\n est nomme par aria-labelledby sur le seul texte (legendId) pour la meme raison. -->\n<ng-template #fieldTooltip>\n <button type=\"button\" class=\"btn btn-ghost btn-field-tooltip\"\n [cwTooltip]=\"tooltip ?? ''\"\n [attr.data-test-ctw]=\"'tooltip-' + name\">\n <cw-icon [icon]=\"spriteIcon.alertHelp\" [type]=\"iconType.circular\" [iconUiType]=\"iconUiType.info\"\n [iconSize]=\"iconSize.xs\" [label]=\"'_COMMON._FORM.TOOLTIP_HELP' | translate\"></cw-icon>\n </button>\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.RangeValueAccessor, selector: "input[type=range][formControlName],input[type=range][formControl],input[type=range][ngModel]" }, { kind: "directive", type: i2$1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2$1.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: NgSelectModule }, { kind: "component", type: i3.NgSelectComponent, selector: "ng-select", inputs: ["ariaLabelDropdown", "bindLabel", "bindValue", "ariaLabel", "markFirst", "placeholder", "fixedPlaceholder", "notFoundText", "typeToSearchText", "preventToggleOnRightClick", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "tabFocusOnClearButton", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "ngClass", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "deselectOnClick", "keyDownFn"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }, { kind: "directive", type: i3.NgOptionTemplateDirective, selector: "[ng-option-tmp]" }, { kind: "directive", type: i3.NgLabelTemplateDirective, selector: "[ng-label-tmp]" }, { kind: "ngmodule", type: NgxSliderModule }, { kind: "component", type: i4.SliderComponent, selector: "ngx-slider", inputs: ["value", "highValue", "options", "manualRefresh", "triggerFocus", "cancelUserChange"], outputs: ["valueChange", "highValueChange", "userChangeStart", "userChange", "userChangeEnd"] }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "text", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom", "spritePath"] }, { kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "labelParams", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "loadingAnnounce", "cssClass", "dataTest", "skeletonMode", "isPressed", "ariaDescribedBy", "ariaLabel", "ariaExpanded", "ariaControls", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { kind: "directive", type: CwTooltipDirective, selector: "[cwTooltip]", inputs: ["cwTooltip", "cwTooltipTitle", "cwTooltipType", "cwTooltipTrigger", "cwTooltipPosition", "cwTooltipDisabled"] }, { kind: "component", type: AutocompleteComponent, selector: "cw-autocomplete", inputs: ["control", "fetcher", "displayField", "valueField", "columns", "optionTemplate", "multiple", "minChars", "debounceMs", "selectedItem", "resolver", "selectedItems", "placeholder", "id", "isRequired", "isReadonly", "isDisabled", "ariaInvalid", "ariaDescribedBy"], outputs: ["itemSelected", "itemsChange"] }, { kind: "component", type: RichTextEditorComponent, selector: "cw-rich-text-editor", inputs: ["control", "options", "id", "placeholder", "isRequired", "isReadonly", "isDisabled", "ariaInvalid", "ariaDescribedBy"], outputs: ["valueChange"] }, { kind: "component", type: FilePreviewComponent, selector: "cw-file-preview", inputs: ["file", "existingFile", "showActions", "disabled", "dataTest"], outputs: ["remove"] }, { kind: "pipe", type: i1.KeyValuePipe, name: "keyvalue" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
|
|
4457
4582
|
}
|
|
4458
4583
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: FormFieldComponent, decorators: [{
|
|
4459
4584
|
type: Component,
|
|
@@ -4470,7 +4595,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImpo
|
|
|
4470
4595
|
AutocompleteComponent,
|
|
4471
4596
|
RichTextEditorComponent,
|
|
4472
4597
|
FilePreviewComponent
|
|
4473
|
-
], template: "@if (!isInAddon) {\n @if (\n type !== typeField.checkbox &&\n type !== typeField.radio &&\n type !== typeField.checkboxButton &&\n type !== typeField.radioButton &&\n type !== typeField.checkboxInline &&\n type !== typeField.radioInline &&\n type !== typeField.switch &&\n type !== typeField.range &&\n type !== typeField.switchSmall &&\n !isChoiceCard &&\n !isPeriod\n ) {\n <!-- Bouton d'aide HORS du <label> (bouton dans un label = HTML invalide, son libelle\n polluerait le nom accessible du champ et un clic activerait le label) : on aligne\n label + bouton dans un conteneur flex, seulement quand il y a une aide. -->\n @if (hasFieldTooltip) {\n <div class=\"d-flex-h gap-2xs\">\n <ng-container *ngTemplateOutlet=\"fieldLabel\"></ng-container>\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n </div>\n } @else {\n <ng-container *ngTemplateOutlet=\"fieldLabel\"></ng-container>\n }\n }\n\n @if (addonLeft || addonRight) {\n <div class=\"field-group\" [class.field-group-invalid]=\"isInvalid\" [class.field-group-disabled]=\"isDisabledOrReadonly\">\n @if(addonLeft) {\n <div class=\"field-group-addon-left\">\n <ng-container [ngTemplateOutlet]=\"addonLeft\"></ng-container>\n </div>\n }\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\n @if(addonRight) {\n <div class=\"field-group-addon-right\">\n <ng-container [ngTemplateOutlet]=\"addonRight\"></ng-container>\n </div>\n }\n </div>\n }\n @else {\n @if ( isInInputGroup() ) {\n <div class=\"field-group\" [class.field-group-invalid]=\"isInvalid\" [class.field-group-disabled]=\"isDisabledOrReadonly\">\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\n </div>\n }\n @else {\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\n }\n }\n\n <!-- Error message -->\n @if (controlOrGroup?.invalid && controlOrGroup?.touched) {\n <div class=\"field-invalid\" [id]=\"'error-' + name\">\n @if (\n !errorMessages?.['required'] &&\n ((controlOrGroup?.errors?.['required']) || (getControl('start')?.errors?.['required'] || getControl('end')?.errors?.['required']))\n ) {\n <span [innerHtml]=\"'_COMMON._FORM.ERROR_IS_MANDATORY' | translate: {label: label | translate}\"></span>\n }\n @if (!errorMessages?.['rangeInvalid'] && controlOrGroup?.errors?.['rangeInvalid']) {\n <span>{{'_COMMON._DATES.ERROR_START_END_PERIOD' | translate}}</span>\n }\n @if (!errorMessages?.['fileExtension'] && controlOrGroup?.errors?.['fileExtension']) {\n <span>{{ '_COMMON._FORM.ERROR_FILE_EXTENSION' | translate: { accept: acceptLabel } }}</span>\n }\n @if (!errorMessages?.['fileSize'] && controlOrGroup?.errors?.['fileSize']) {\n <span>{{ '_COMMON._FORM.ERROR_FILE_SIZE' | translate: { maxSize: maxSizeLabel } }}</span>\n }\n @if (!errorMessages?.['email'] && controlOrGroup?.errors?.['email']) {\n <span>{{ '_COMMON._FORM.ERROR_INVALID_EMAIL' | translate }}</span>\n }\n @if (!errorMessages?.['phone'] && controlOrGroup?.errors?.['phone']) {\n <span>{{ '_COMMON._FORM.ERROR_INVALID_PHONE' | translate }}</span>\n }\n @if (errorMessages) {\n @for (entry of errorMessages | keyvalue: keepOrder; track entry.key) {\n @if (controlOrGroup?.errors?.[entry.key]; as errVal) {\n <span>{{ entry.value | translate: (errVal === true ? null : errVal) }}</span>\n }\n }\n }\n </div>\n }\n\n @if (help || autoHelpEntries.length) {\n <div [id]=\"name + '-help'\" class=\"field-text\">\n @if (help) {\n <span>{{ help | translate: helpParams }}</span>\n }\n @for (entry of autoHelpEntries; track entry.key) {\n <!-- Espace explicite : les blancs entre balises sont supprim\u00E9s \u00E0 la compilation. -->\n {{ ' ' }}<span>{{ entry.key | translate: entry.params }}</span>\n }\n </div>\n }\n\n <!-- Aper\u00E7u du fichier (type=file, opt-in) : sous le champ et ses aides, comme dans la\n maquette DS. La croix native du champ n'est pas retir\u00E9e \u2014 les deux vident le m\u00EAme\n control, l'aper\u00E7u ajoute juste \u00AB Visualiser \u00BB et une cible plus grande. -->\n @if (isPreviewVisible) {\n <cw-file-preview [file]=\"previewFile\" [existingFile]=\"existingFile ?? null\"\n [disabled]=\"!!isDisabledOrReadonly\" (remove)=\"onPreviewRemove()\" />\n }\n\n <!-- Chips de la multi-s\u00E9lection (autocomplete) : rendus ici, hors du field-group et apr\u00E8s\n erreur/help, pour \u00EAtre visuellement d\u00E9tach\u00E9s du champ. La donn\u00E9e et le retrait restent\n port\u00E9s par cw-autocomplete (`chips()` / `onChipRemove()`), seul l'affichage est d\u00E9l\u00E9gu\u00E9. -->\n @if (type === typeField.autocompleteMultiple && autocompleteRef()?.chips()?.length) {\n <ul class=\"autocomplete-chips\" role=\"list\">\n @for (chip of autocompleteRef()!.chips(); track chip.item) {\n <li>\n <button type=\"button\" class=\"autocomplete-chip\"\n [disabled]=\"isEffectivelyDisabled || isReadonly\"\n (click)=\"autocompleteRef()!.onChipRemove(chip.item)\">\n <span>{{ chip.label }}</span>\n @if (!isEffectivelyDisabled && !isReadonly) {\n <span aria-hidden=\"true\" class=\"autocomplete-chip-x\">×</span>\n <span class=\"visually-hidden\">{{ '_COMMON._ACTION.DELETE' | translate }}</span>\n }\n </button>\n </li>\n }\n </ul>\n }\n}\n@else {\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\n}\n\n<ng-template #field>\n <!-- Autocomplete (mono / multi) -->\n @if ((type === typeField.autocomplete || type === typeField.autocompleteMultiple) && autocompleteOptions) {\n <cw-autocomplete\n [id]=\"name\"\n [control]=\"formControl\"\n [fetcher]=\"autocompleteOptions.fetcher\"\n [displayField]=\"autocompleteOptions.displayField ?? 'label'\"\n [valueField]=\"autocompleteOptions.valueField ?? 'id'\"\n [columns]=\"autocompleteOptions.columns ?? []\"\n [resolver]=\"autocompleteOptions.resolver ?? null\"\n [selectedItem]=\"autocompleteOptions.selectedItem ?? null\"\n [selectedItems]=\"autocompleteOptions.selectedItems ?? []\"\n [minChars]=\"autocompleteOptions.minChars ?? 2\"\n [debounceMs]=\"autocompleteOptions.debounceMs ?? 250\"\n [multiple]=\"type === typeField.autocompleteMultiple\"\n [isRequired]=\"isRequired\"\n [isReadonly]=\"!!isReadonly\"\n [isDisabled]=\"isEffectivelyDisabled\"\n [ariaInvalid]=\"control.invalid && control.touched\"\n [ariaDescribedBy]=\"getDescribedBy(control)\"\n [placeholder]=\"placeholder\">\n </cw-autocomplete>\n }\n\n <!-- Rich text editor (Quill) : sous-composant interne, sans field-group ni bouton clear\n (il porte sa propre bordure + toolbar). Le label statique du form-field reste au-dessus. -->\n @if (type === typeField.richText) {\n <cw-rich-text-editor\n [id]=\"name\"\n [control]=\"formControl\"\n [options]=\"richTextOptions\"\n [placeholder]=\"placeholder ? (placeholder | translate) : ''\"\n [isRequired]=\"isRequired\"\n [isReadonly]=\"!!isReadonly\"\n [isDisabled]=\"isEffectivelyDisabled\"\n [ariaInvalid]=\"control.invalid && control.touched\"\n [ariaDescribedBy]=\"getDescribedBy(control)\">\n </cw-rich-text-editor>\n }\n\n <!-- Text -->\n @if ([typeField.text, typeField.date, typeField.time, typeField.dateTime, typeField.number,\n typeField.email,\n typeField.color, typeField.zipCode].includes(type)) {\n <input [type]=\"type === typeField.zipCode ? 'text' : type\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\n [attr.title]=\"fieldTitle ? (fieldTitle | translate) : null\"\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '', type === typeField.zipCode ? 'field-control-zipcode' : '']\"\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [attr.aria-required]=\"isRequired\"\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\"\n [attr.min]=\"minAttr\" [attr.max]=\"maxAttr\" [attr.step]=\"stepAttr\" [attr.pattern]=\"patternAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\n }\n\n <!-- Phone (intl-tel-input) -->\n @if (type === typeField.phone) {\n <input #phoneInput type=\"tel\" class=\"field-control\" [id]=\"name\"\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [disabled]=\"isEffectivelyDisabled\" [attr.aria-required]=\"isRequired\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (focus)=\"onFocus()\" (blur)=\"onPhoneBlur($event)\" />\n }\n\n <!-- File -->\n @if (type === typeField.file) {\n <!-- L'input natif reste LE controle (focus, clavier, restitution aux lecteurs d'ecran,\n validation), mais il est masque visuellement : le libelle de son bouton et son\n \u00AB aucun fichier choisi \u00BB sont ecrits par le NAVIGATEUR, dans SA langue. Ils sont\n intraduisibles et ne suivent pas la langue de l'application \u2014 un utilisateur qui\n bascule en anglais garderait \u00AB Choisir un fichier \u00BB. On les reecrit donc a cote,\n traduits, dans une couche purement visuelle. -->\n <input #fileInput type=\"file\" class=\"field-control visually-hidden\" [id]=\"name\"\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\n [attr.required]=\"isRequired ? 'required' : null\"\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [disabled]=\"isEffectivelyDisabled\" [attr.aria-required]=\"isRequired\"\n [attr.accept]=\"acceptAttr\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (change)=\"onFileChange($event)\" (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\n\n <!-- `aria-hidden` : doublon visuel de l'input, que les lecteurs d'ecran restituent deja\n (nom du champ, bouton de parcours, fichier selectionne). L'annoncer une seconde fois\n ne ferait que bavarder. Le clic est relaye a l'input, le clavier passe par lui. -->\n <span class=\"field-file\" aria-hidden=\"true\" (click)=\"openFilePicker()\">\n <span class=\"field-file-button\">{{ '_COMMON._FORM.CHOOSE_FILE' | translate }}</span>\n <span class=\"field-file-name\" [class.field-file-name-empty]=\"!selectedFileName\">\n {{ selectedFileName ?? ('_COMMON._FORM.NO_FILE_SELECTED' | translate) }}\n </span>\n </span>\n }\n\n @if (type === typeField.password) {\n <input [type]=\"isPasswordShown ? 'text' : 'password'\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\n [attr.required]=\"isRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.aria-required]=\"isRequired\"\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\" [attr.pattern]=\"patternAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\n <cw-button [type]=\"buttonType.ghost\"\n cssClass=\"btn-password-field\"\n [withIcon]=\"isPasswordShown ? spriteIcon.toolbarHidePassword : spriteIcon.toolbarShowPassword\"\n [withOnlyIcon]=\"true\"\n [label]=\"isPasswordShown ? '_COMMON._FORM._SHOW_HIDE_PWD.HIDE' : '_COMMON._FORM._SHOW_HIDE_PWD.SHOW'\"\n (btnAction)=\"togglePasswordVisibility()\">\n </cw-button>\n }\n\n <!-- Textarea -->\n @if (type === typeField.textarea) {\n <textarea class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"\n [attr.aria-required]=\"isRequired\" [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\" [attr.pattern]=\"patternAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\"></textarea>\n }\n\n <!-- Select -->\n @if (type === typeField.select) {\n <ng-select [formControl]=\"formControl\" [items]=\"options\" bindLabel=\"label\" [labelForId]=\"name\" [appendTo]=\"appendTo ?? ''\" bindValue=\"value\"\n [ngClass]=\"cssClass\" [searchable]=\"false\" [placeholder]=\"placeholder ? (placeholder | translate) : ''\" [readonly]=\"isReadonly\" [clearable]=\"false\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.required]=\"isRequired ? 'required' : null\"\n [attr.aria-required]=\"isRequired\" [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\" [attr.id]=\"name\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" (open)=\"onDropdownOpen()\" (close)=\"onDropdownClose()\">\n\n <!-- Template pour les options -->\n <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\">\n @if (optionTemplate) {\n <ng-container *ngTemplateOutlet=\"optionTemplate; context: { item: item | translate, index: index, searchTerm: search }\"></ng-container>\n }\n @else {\n <div>{{ item.label | translate }}</div>\n }\n </ng-template>\n\n <!-- Template pour le label -->\n <ng-template ng-label-tmp let-item=\"item\">\n @if (labelTemplate) {\n <ng-container *ngTemplateOutlet=\"labelTemplate; context: { item: item | translate }\"></ng-container>\n }\n @else {\n {{ (item.label | translate) || (placeholder | translate) }}\n }\n </ng-template>\n </ng-select>\n }\n\n <!-- NgSelect -->\n @if (type === typeField.ngSelect || type === typeField.ngSelectMultiple) {\n <ng-select [formControl]=\"formControl\" [items]=\"options\" bindLabel=\"label\" [labelForId]=\"name\" [appendTo]=\"appendTo ?? ''\" bindValue=\"value\"\n [multiple]=\"type === typeField.ngSelectMultiple\" [ngClass]=\"cssClass\" [clearable]=\"false\"\n [placeholder]=\"placeholder ? (placeholder | translate) : ''\" [readonly]=\"isReadonly\"\n [notFoundText]=\"'_COMMON.NO_RESULT' | translate\" [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"\n [attr.required]=\"isRequired ? 'required' : null\" [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\" [attr.id]=\"name\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" (search)=\"textChanged.emit($event?.term)\"\n (open)=\"onDropdownOpen()\" (close)=\"onDropdownClose()\">\n\n <!-- Template pour les options -->\n <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\">\n @if (optionTemplate) {\n <ng-container *ngTemplateOutlet=\"optionTemplate; context: { item: item, index: index, searchTerm: search }\"></ng-container>\n }\n @else {\n <div>{{ item.label | translate }}</div>\n }\n </ng-template>\n\n <!-- Template pour le label -->\n <ng-template ng-label-tmp let-item=\"item\" let-clear=\"clear\">\n <span class=\"ng-value-icon left\" (click)=\"clear(item)\" aria-hidden=\"true\">\u00D7</span>\n @if (labelTemplate) {\n <ng-container *ngTemplateOutlet=\"labelTemplate; context: { item: item | translate }\"></ng-container>\n }\n @else {\n {{ (item.label | translate) || (placeholder | translate) }}\n }\n </ng-template>\n </ng-select>\n }\n\n <!-- Radio -->\n @if (type === typeField.radioInline || type === typeField.radio) {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.radioInline ? 'd-flex-h gap-md flex-wrap' : 'd-flex-v gap-sm'\">\n @for (opt of options; track opt.value) {\n <li class=\"field-check\">\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [attr.name]=\"name\" [value]=\"opt.value\" [formControl]=\"formControl\"\n class=\"field-check-input\" [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" (change)=\"onRadioChange(opt.value)\" />\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">{{ opt.label | translate }}</label>\n </li>\n }\n </ul>\n </fieldset>\n }\n\n <!-- Radio button -->\n @if (type === typeField.radioButton) {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <div class=\"field-group field-group-btn\">\n @for (opt of options; track opt.value) {\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [attr.name]=\"name\" [value]=\"opt.value\" [formControl]=\"formControl\"\n class=\"visually-hidden\" [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" (change)=\"onRadioChange(opt.value)\"/>\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">{{ opt.label | translate }}</label>\n }\n </div>\n </fieldset>\n }\n\n <!-- Cartes : checkbox / radio / switch (contr\u00F4le \u00E0 gauche, titre, description facultative) -->\n @if (isChoiceCard) {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <ul class=\"field-card-list list-unstyled mb-none\" [class.field-card-list-compact]=\"isChoiceCardCompact\">\n @for (opt of options; track opt.value) {\n <li class=\"d-flex-v\">\n <!-- Le label englobe toute la carte : un clic n'importe o\u00F9 coche l'option. -->\n <label class=\"field-card d-flex-h items-start gap-xs flex-1\" [for]=\"name + '_' + opt.value\" [class.field-switch]=\"isSwitchCard\" [class.field-switch-small]=\"isSwitchCard\">\n @if (isRadioCard) {\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [attr.name]=\"name\" [value]=\"opt.value\" [formControl]=\"formControl\"\n class=\"field-check-input\"\n [attr.aria-describedby]=\"(!isChoiceCardCompact && opt.description) ? name + '_' + opt.value + '-desc' : null\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" (change)=\"onRadioChange(opt.value)\" />\n } @else {\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\n [checked]=\"control.value?.includes(opt.value)\" class=\"field-check-input\"\n [attr.role]=\"isSwitchCard ? 'switch' : null\"\n [attr.aria-describedby]=\"(!isChoiceCardCompact && opt.description) ? name + '_' + opt.value + '-desc' : null\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\n }\n <span class=\"d-flex-v gap-5xs\">\n <span class=\"field-card-title\">{{ opt.label | translate }}</span>\n @if (!isChoiceCardCompact && opt.description) {\n <span class=\"field-text\" [id]=\"name + '_' + opt.value + '-desc'\">{{ opt.description | translate }}</span>\n }\n </span>\n </label>\n </li>\n }\n </ul>\n </fieldset>\n }\n\n <!-- Checkbox Switch -->\n @if ( type === typeField.switch || type === typeField.switchSmall)\n {\n <div class=\"field-check field-switch\" [ngClass]=\"{'field-switch-small': type === typeField.switchSmall}\">\n <input type=\"checkbox\" [id]=\"name\" [formControl]=\"formControl\" class=\"field-check-input\" [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"/>\n <label [for]=\"name\" class=\"field-check-label\">{{ label | translate }}</label>\n </div>\n }\n\n <!-- Checkbox -->\n @if (type === typeField.checkboxInline || type === typeField.checkbox) {\n @if (isSingleCheckbox()) {\n <div class=\"field-check\" [class.field-check-inline]=\"type === typeField.checkboxInline\">\n <input #checkboxInput type=\"checkbox\" [id]=\"name\" [formControl]=\"formControl\"\n class=\"field-check-input\"\n [class.is-invalid]=\"control?.invalid && control?.touched\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control?.invalid && control?.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" />\n <label [for]=\"name\" class=\"field-check-label\">\n {{ label | translate }}\n @if (isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n </div>\n }\n @else if( options.length > 1) {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n [ngClass]=\"{ 'flex-column': type === typeField.checkbox }\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.checkboxInline ? 'd-flex-h gap-md' : 'd-flex-v gap-sm'\">\n @for (opt of options; track opt.value) {\n <li class=\"field-check\" [ngClass]=\"{ 'field-check-inline': type === typeField.checkboxInline }\">\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\n [checked]=\"control.value?.includes(opt.value)\" class=\"field-check-input\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">\n {{ opt.label | translate }}\n </label>\n </li>\n }\n </ul>\n </fieldset>\n }\n @else {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.checkboxInline ? 'd-flex-h gap-md' : 'd-flex-v gap-sm'\">\n @for (opt of options; track opt.value) {\n <li class=\"field-check\" [ngClass]=\"{ 'field-check-inline': type === typeField.checkboxInline }\">\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\n [checked]=\"control.value?.includes(opt.value)\" class=\"field-check-input\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">\n {{ opt.label | translate }}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n </li>\n }\n </ul>\n </fieldset>\n }\n }\n\n <!-- Checkbox button -->\n @if (type === typeField.checkboxButton && options.length > 0) {\n\n @if(options.length > 1) {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <div class=\"field-group field-group-btn\">\n @for (opt of options; track opt.value) {\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\n [checked]=\"control.value?.includes(opt.value)\" class=\"visually-hidden\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">{{ opt.label | translate }}</label>\n }\n </div>\n </fieldset>\n }\n @else {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <div class=\"btn-group btn-group-secondary\">\n @for (opt of options; track opt.value) {\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\n [checked]=\"control.value?.includes(opt.value)\" class=\"visually-hidden\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\"/>\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">\n {{ opt.label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n }\n </div>\n </fieldset>\n }\n }\n\n <!-- Period - DateToDate / TimeToTime / DateTimeToDateTime -->\n @if (isPeriod) {\n <!-- Fieldset : le legend nomme la p\u00E9riode, \u00AB Du \u00BB / \u00AB au \u00BB sont les labels de chaque input. -->\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n <!-- Deux bornes obligatoires : ast\u00E9risque sur la p\u00E9riode ; une seule : sur sa borne. -->\n @if(isStartRequired && isEndRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <div class=\"field-group\">\n <label class=\"field-group-addon-left\" [for]=\"name + '_start'\">\n {{ '_COMMON._DATES.FROM_TO_1' | translate }}\n @if(isStartRequired && !isEndRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n <input [type]=\"getInputType()\" class=\"field-control\" [id]=\"name + '_start'\" [formControl]=\"getControl('start')!\"\n [attr.title]=\"fieldTitle ? (fieldTitle | translate) + ' \u2013 ' + ('_COMMON._DATES.FROM_TO_1' | translate) : null\"\n [attr.placeholder]=\"type === typeField.timeToTime ? ('_COMMON._DATES.FROM' | translate) : ('_COMMON._DATES.FROM_TO_1' | translate)\"\n [ngClass]=\"[(cssClass || ''), getControl('start')?.value ? 'has-value' : '']\"\n [attr.required]=\"isStartRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.aria-required]=\"isStartRequired\"\n [attr.min]=\"minStartAttr\" [attr.max]=\"maxStartAttr\" [attr.step]=\"stepAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"getControl('start')?.invalid && getControl('start')?.touched\"\n [attr.aria-describedby]=\"getDescribedBy(getControl('start'))\"\n (focus)=\"onFocusRange('start')\" (blur)=\"onBlurRange('start')\" />\n\n @if(getControl('start')?.value && !isDisabledOrReadonly) {\n <button type=\"button\" class=\"btn btn-secondary btn-clear-field\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_START' | translate: { label: label | translate }\"\n (click)=\"onClearFieldPeriod('start')\">\n <span aria-hidden=\"true\">×</span>\n </button>\n }\n <label class=\"field-group-addon-center\" [for]=\"name + '_end'\">\n {{ '_COMMON._DATES.FROM_TO_2' | translate }}\n @if(isEndRequired && !isStartRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n <input [type]=\"getInputType()\" class=\"field-control\" [id]=\"name + '_end'\" [formControl]=\"getControl('end')!\"\n [attr.title]=\"fieldTitle ? (fieldTitle | translate) + ' \u2013 ' + ('_COMMON._DATES.FROM_TO_2' | translate) : null\"\n [attr.placeholder]=\"type === typeField.timeToTime ? ('_COMMON._DATES.TO' | translate) : ('_COMMON._DATES.FROM_TO_2' | translate)\"\n [ngClass]=\"[(cssClass || ''), getControl('end')?.value ? 'has-value' : '']\"\n [attr.required]=\"isEndRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.aria-required]=\"isEndRequired\"\n [attr.min]=\"minEndAttr\" [attr.max]=\"maxEndAttr\" [attr.step]=\"stepAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"getControl('end')?.invalid && getControl('end')?.touched\"\n [attr.aria-describedby]=\"getDescribedBy(getControl('end'))\"\n (focus)=\"onFocusRange('end')\" (blur)=\"onBlurRange('end')\" />\n\n @if(getControl('end')?.value && !isDisabledOrReadonly) {\n <button type=\"button\" class=\"btn btn-ghost btn-clear-field\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_END' | translate: { label: label | translate }\"\n (click)=\"onClearFieldPeriod('end')\">\n <span aria-hidden=\"true\">×</span>\n </button>\n }\n </div>\n </fieldset>\n }\n\n @if ([typeField.datePlusOne, typeField.datePlusTwo, typeField.datePlusSeven, typeField.dateComplexe].includes(type)) {\n\n <div class=\"field-group\">\n @if (type === typeField.dateComplexe) {\n <div class=\"field-group-addon-left\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onDateAddDay('prev')\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.nextLeft\" [label]=\"'Jour pr\u00E9c\u00E9dent'\"></cw-icon>\n </button>\n </div>\n }\n\n <input type=\"date\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\n [attr.title]=\"fieldTitle ? (fieldTitle | translate) : null\"\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [attr.aria-required]=\"isRequired\"\n [attr.min]=\"minAttr\" [attr.max]=\"maxAttr\" [attr.step]=\"stepAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\n\n @if(formControl?.value && !isDisabledOrReadonly) {\n <button class=\"btn btn-ghost btn-clear-field\" type=\"button\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_FIELD' | translate: { label: label | translate }\"\n (click)=\"onClearField(formControl)\"><span aria-hidden=\"true\">×</span></button>\n }\n\n\n @if (type === typeField.dateComplexe) {\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onDateAddDay('next')\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.nextRight\" [label]=\"'Jour suivant'\"></cw-icon>\n </button>\n </div>\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onRefresh()\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.toolbarRefresh\" [label]=\"'Rafra\u00EEchir'\"></cw-icon>\n </button>\n </div>\n }\n\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onTodayAddDay(0)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n J\n <span class=\"visually-hidden\">Aujourd'hui</span>\n </button>\n </div>\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onTodayAddDay(1)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n J+1\n <span class=\"visually-hidden\">Demain</span>\n </button>\n </div>\n\n @if (type !== typeField.datePlusOne && type !== typeField.dateComplexe) {\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost \" type=\"button\" (click)=\"onTodayAddDay(2)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n J+2\n <span class=\"visually-hidden\">Dans 2 jours</span>\n </button>\n </div>\n\n @if (type !== typeField.datePlusTwo) {\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onTodayAddDay(7)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n J+7\n <span class=\"visually-hidden\">Dans 7 jours</span>\n </button>\n </div>\n }\n }\n </div>\n }\n\n @if (type === typeField.slider) {\n <ngx-slider [(value)]=\"sliderValue\" [options]=\"sliderOptions\" [formControl]=\"formControl\"></ngx-slider>\n }\n\n @if (type === typeField.range) {\n <div class=\"slider\">\n\n <cw-button [isDisabled]=\"formControl.value <= rangeOptions.floor\" [label]=\"'Diminuer ' + formControl.value + ' ' + label\"\n [withIcon]=\"spriteIcon.toolbarMinus\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\"\n [iconSize]=\"buttonIconSize.small\" (btnAction)=\"onRangeStep('decrease')\">\n </cw-button>\n\n <div class=\"slider-input\">\n <label [for]=\"name\" class=\"slider-tooltip\" [style.left]=\"getRangePercent() + '%'\" aria-live=\"polite\"\n aria-atomic=\"true\">\n {{ label | translate }} {{ formControl.value }}\n @if (rangeOptions.unit) {\n <abbr [title]=\"rangeOptions.unit\">{{ rangeOptions.unit }}</abbr>\n }\n </label>\n\n <div class=\"slider-custom-bar\">\n <div class=\"slider-custom-bar-selection\" [style.width]=\"getRangePercent() + '%'\">\n </div>\n </div>\n\n <input type=\"range\" [id]=\"name\" [formControl]=\"formControl\" [min]=\"rangeOptions.floor\" [max]=\"rangeOptions.ceil\"\n [step]=\"rangeOptions.step || 1\" class=\"field-control-range\" [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\">\n </div>\n\n <cw-button [isDisabled]=\"formControl.value >= rangeOptions.ceil\" [label]=\"'Augmenter ' + formControl.value + ' ' + label\"\n [withIcon]=\"spriteIcon.toolbarPlus\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\"\n [iconSize]=\"buttonIconSize.small\" (btnAction)=\"onRangeStep('increase')\">\n </cw-button>\n </div>\n }\n\n @if (isInInputGroup() && clearable && !isDisabledOrReadonly && type !== typeField.autocompleteMultiple) {\n @if (type === typeField.autocomplete) {\n @if (autocompleteRef()?.hasAnyContent()) {\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_FIELD' | translate: { label: label | translate }\"\n (click)=\"onClearAutocomplete()\"><span aria-hidden=\"true\">×</span></button>\n }\n } @else if (type === typeField.ngSelectMultiple) {\n <!-- value est un tableau : un [] vide \u00E9tant truthy, on teste .length pour n'afficher le clear global que s'il y a au moins une s\u00E9lection. -->\n @if (formControl?.value?.length) {\n <button class=\"btn btn-ghost btn-clear-field\" type=\"button\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_FIELD' | translate: { label: label | translate }\"\n (click)=\"onClearField(formControl)\"><span aria-hidden=\"true\">×</span></button>\n }\n } @else {\n @if(formControl?.value) {\n <button class=\"btn btn-ghost btn-clear-field\" type=\"button\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_FIELD' | translate: { label: label | translate }\"\n (click)=\"onClearField(formControl)\"><span aria-hidden=\"true\">×</span></button>\n }\n }\n }\n\n</ng-template>\n\n<ng-template #fieldLabel>\n <label [for]=\"name\" class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\n {{ label | translate }}\n\n @if (isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n</ng-template>\n\n<!-- Bouton d'aide (tooltip) partage label/legend. Hors du <label> (sinon son libelle\n s'ajoute au nom du champ et le clic active le label) ; dans un <legend>, le fieldset\n est nomme par aria-labelledby sur le seul texte (legendId) pour la meme raison. -->\n<ng-template #fieldTooltip>\n <button type=\"button\" class=\"btn btn-ghost btn-field-tooltip\"\n [cwTooltip]=\"tooltip ?? ''\"\n [attr.data-test-ctw]=\"'tooltip-' + name\">\n <cw-icon [icon]=\"spriteIcon.alertHelp\" [type]=\"iconType.circular\" [iconUiType]=\"iconUiType.info\"\n [iconSize]=\"iconSize.xs\" [label]=\"'_COMMON._FORM.TOOLTIP_HELP' | translate\"></cw-icon>\n </button>\n</ng-template>\n" }]
|
|
4598
|
+
], template: "@if (!isInAddon) {\n @if (\n type !== typeField.checkbox &&\n type !== typeField.radio &&\n type !== typeField.checkboxButton &&\n type !== typeField.radioButton &&\n type !== typeField.checkboxInline &&\n type !== typeField.radioInline &&\n type !== typeField.switch &&\n type !== typeField.range &&\n type !== typeField.switchSmall &&\n !isChoiceCard &&\n !isPeriod\n ) {\n <!-- Bouton d'aide HORS du <label> (bouton dans un label = HTML invalide, son libelle\n polluerait le nom accessible du champ et un clic activerait le label) : on aligne\n label + bouton dans un conteneur flex, seulement quand il y a une aide. -->\n @if (hasFieldTooltip) {\n <div class=\"d-flex-h gap-2xs\">\n <ng-container *ngTemplateOutlet=\"fieldLabel\"></ng-container>\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n </div>\n } @else {\n <ng-container *ngTemplateOutlet=\"fieldLabel\"></ng-container>\n }\n }\n\n <!-- Une p\u00E9riode rend ses addons dans son propre field-group (entre les bornes et le fieldset). -->\n @if ((addonLeft || addonRight) && !isPeriod) {\n <div class=\"field-group\" [class.field-group-invalid]=\"isInvalid\" [class.field-group-disabled]=\"isDisabledOrReadonly\">\n @if(addonLeft) {\n <div class=\"field-group-addon-left\">\n <ng-container [ngTemplateOutlet]=\"addonLeft\"></ng-container>\n </div>\n }\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\n @if(addonRight) {\n <div class=\"field-group-addon-right\">\n <ng-container [ngTemplateOutlet]=\"addonRight\"></ng-container>\n </div>\n }\n </div>\n }\n @else {\n @if ( isInInputGroup() ) {\n <div class=\"field-group\" [class.field-group-invalid]=\"isInvalid\" [class.field-group-disabled]=\"isDisabledOrReadonly\">\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\n </div>\n }\n @else {\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\n }\n }\n\n <!-- Error message -->\n @if (controlOrGroup?.invalid && controlOrGroup?.touched) {\n <div class=\"field-invalid\" [id]=\"'error-' + name\">\n @if (\n !errorMessages?.['required'] &&\n ((controlOrGroup?.errors?.['required']) || (getControl('start')?.errors?.['required'] || getControl('end')?.errors?.['required']))\n ) {\n <span [innerHtml]=\"'_COMMON._FORM.ERROR_IS_MANDATORY' | translate: {label: label | translate}\"></span>\n }\n @if (!errorMessages?.['rangeInvalid'] && controlOrGroup?.errors?.['rangeInvalid']) {\n <span>{{'_COMMON._DATES.ERROR_START_END_PERIOD' | translate}}</span>\n }\n @if (!errorMessages?.['fileExtension'] && controlOrGroup?.errors?.['fileExtension']) {\n <span>{{ '_COMMON._FORM.ERROR_FILE_EXTENSION' | translate: { accept: acceptLabel } }}</span>\n }\n @if (!errorMessages?.['fileSize'] && controlOrGroup?.errors?.['fileSize']) {\n <span>{{ '_COMMON._FORM.ERROR_FILE_SIZE' | translate: { maxSize: maxSizeLabel } }}</span>\n }\n @if (!errorMessages?.['email'] && controlOrGroup?.errors?.['email']) {\n <span>{{ '_COMMON._FORM.ERROR_INVALID_EMAIL' | translate }}</span>\n }\n @if (!errorMessages?.['phone'] && controlOrGroup?.errors?.['phone']) {\n <span>{{ '_COMMON._FORM.ERROR_INVALID_PHONE' | translate }}</span>\n }\n @if (errorMessages) {\n @for (entry of errorMessages | keyvalue: keepOrder; track entry.key) {\n @if (controlOrGroup?.errors?.[entry.key]; as errVal) {\n <span>{{ entry.value | translate: (errVal === true ? null : errVal) }}</span>\n }\n }\n }\n </div>\n }\n\n @if (help || autoHelpEntries.length) {\n <div [id]=\"name + '-help'\" class=\"field-text\">\n @if (help) {\n <span>{{ help | translate: helpParams }}</span>\n }\n @for (entry of autoHelpEntries; track entry.key) {\n <!-- Espace explicite : les blancs entre balises sont supprim\u00E9s \u00E0 la compilation. -->\n {{ ' ' }}<span>{{ entry.key | translate: entry.params }}</span>\n }\n </div>\n }\n\n <!-- Aper\u00E7u du fichier (type=file, opt-in) : sous le champ et ses aides, comme dans la\n maquette DS. La croix native du champ n'est pas retir\u00E9e \u2014 les deux vident le m\u00EAme\n control, l'aper\u00E7u ajoute juste \u00AB Visualiser \u00BB et une cible plus grande. -->\n @if (isPreviewVisible) {\n <cw-file-preview [file]=\"previewFile\" [existingFile]=\"existingFile ?? null\"\n [disabled]=\"!!isDisabledOrReadonly\" (remove)=\"onPreviewRemove()\" />\n }\n\n <!-- Chips de la multi-s\u00E9lection (autocomplete) : rendus ici, hors du field-group et apr\u00E8s\n erreur/help, pour \u00EAtre visuellement d\u00E9tach\u00E9s du champ. La donn\u00E9e et le retrait restent\n port\u00E9s par cw-autocomplete (`chips()` / `onChipRemove()`), seul l'affichage est d\u00E9l\u00E9gu\u00E9. -->\n @if (type === typeField.autocompleteMultiple && autocompleteRef()?.chips()?.length) {\n <ul class=\"autocomplete-chips\" role=\"list\">\n @for (chip of autocompleteRef()!.chips(); track chip.item) {\n <li>\n <button type=\"button\" class=\"autocomplete-chip\"\n [disabled]=\"isEffectivelyDisabled || isReadonly\"\n (click)=\"autocompleteRef()!.onChipRemove(chip.item)\">\n <span>{{ chip.label }}</span>\n @if (!isEffectivelyDisabled && !isReadonly) {\n <span aria-hidden=\"true\" class=\"autocomplete-chip-x\">×</span>\n <span class=\"visually-hidden\">{{ '_COMMON._ACTION.DELETE' | translate }}</span>\n }\n </button>\n </li>\n }\n </ul>\n }\n}\n@else {\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\n}\n\n<ng-template #field>\n <!-- Autocomplete (mono / multi) -->\n @if ((type === typeField.autocomplete || type === typeField.autocompleteMultiple) && autocompleteOptions) {\n <cw-autocomplete\n [id]=\"name\"\n [control]=\"formControl\"\n [fetcher]=\"autocompleteOptions.fetcher\"\n [displayField]=\"autocompleteOptions.displayField ?? 'label'\"\n [valueField]=\"autocompleteOptions.valueField ?? 'id'\"\n [columns]=\"autocompleteOptions.columns ?? []\"\n [optionTemplate]=\"autocompleteOptions.optionTemplate ?? autocompleteOptionTpl?.templateRef ?? null\"\n [resolver]=\"autocompleteOptions.resolver ?? null\"\n [selectedItem]=\"autocompleteOptions.selectedItem ?? null\"\n [selectedItems]=\"autocompleteOptions.selectedItems ?? []\"\n [minChars]=\"autocompleteOptions.minChars ?? 2\"\n [debounceMs]=\"autocompleteOptions.debounceMs ?? 250\"\n [multiple]=\"type === typeField.autocompleteMultiple\"\n [isRequired]=\"isRequired\"\n [isReadonly]=\"!!isReadonly\"\n [isDisabled]=\"isEffectivelyDisabled\"\n [ariaInvalid]=\"control.invalid && control.touched\"\n [ariaDescribedBy]=\"getDescribedBy(control)\"\n [placeholder]=\"placeholder\">\n </cw-autocomplete>\n }\n\n <!-- Rich text editor (Quill) : sous-composant interne, sans field-group ni bouton clear\n (il porte sa propre bordure + toolbar). Le label statique du form-field reste au-dessus. -->\n @if (type === typeField.richText) {\n <cw-rich-text-editor\n [id]=\"name\"\n [control]=\"formControl\"\n [options]=\"richTextOptions\"\n [placeholder]=\"placeholder ? (placeholder | translate) : ''\"\n [isRequired]=\"isRequired\"\n [isReadonly]=\"!!isReadonly\"\n [isDisabled]=\"isEffectivelyDisabled\"\n [ariaInvalid]=\"control.invalid && control.touched\"\n [ariaDescribedBy]=\"getDescribedBy(control)\">\n </cw-rich-text-editor>\n }\n\n <!-- Text -->\n @if ([typeField.text, typeField.date, typeField.time, typeField.dateTime, typeField.number,\n typeField.email,\n typeField.color, typeField.zipCode].includes(type)) {\n <input [type]=\"type === typeField.zipCode ? 'text' : type\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\n [attr.title]=\"fieldTitle ? (fieldTitle | translate) : null\"\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '', type === typeField.zipCode ? 'field-control-zipcode' : '']\"\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [attr.aria-required]=\"isRequired\"\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\"\n [attr.min]=\"minAttr\" [attr.max]=\"maxAttr\" [attr.step]=\"stepAttr\" [attr.pattern]=\"patternAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\n }\n\n <!-- Phone (intl-tel-input) -->\n @if (type === typeField.phone) {\n <input #phoneInput type=\"tel\" class=\"field-control\" [id]=\"name\"\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [disabled]=\"isEffectivelyDisabled\" [attr.aria-required]=\"isRequired\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (focus)=\"onFocus()\" (blur)=\"onPhoneBlur($event)\" />\n }\n\n <!-- File -->\n @if (type === typeField.file) {\n <!-- L'input natif reste LE controle (focus, clavier, restitution aux lecteurs d'ecran,\n validation), mais il est masque visuellement : le libelle de son bouton et son\n \u00AB aucun fichier choisi \u00BB sont ecrits par le NAVIGATEUR, dans SA langue. Ils sont\n intraduisibles et ne suivent pas la langue de l'application \u2014 un utilisateur qui\n bascule en anglais garderait \u00AB Choisir un fichier \u00BB. On les reecrit donc a cote,\n traduits, dans une couche purement visuelle. -->\n <input #fileInput type=\"file\" class=\"field-control visually-hidden\" [id]=\"name\"\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\n [attr.required]=\"isRequired ? 'required' : null\"\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [disabled]=\"isEffectivelyDisabled\" [attr.aria-required]=\"isRequired\"\n [attr.accept]=\"acceptAttr\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (change)=\"onFileChange($event)\" (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\n\n <!-- `aria-hidden` : doublon visuel de l'input, que les lecteurs d'ecran restituent deja\n (nom du champ, bouton de parcours, fichier selectionne). L'annoncer une seconde fois\n ne ferait que bavarder. Le clic est relaye a l'input, le clavier passe par lui. -->\n <span class=\"field-file\" aria-hidden=\"true\" (click)=\"openFilePicker()\">\n <span class=\"field-file-button\">{{ '_COMMON._FORM.CHOOSE_FILE' | translate }}</span>\n <span class=\"field-file-name\" [class.field-file-name-empty]=\"!selectedFileName\">\n {{ selectedFileName ?? ('_COMMON._FORM.NO_FILE_SELECTED' | translate) }}\n </span>\n </span>\n }\n\n @if (type === typeField.password) {\n <input [type]=\"isPasswordShown ? 'text' : 'password'\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\n [attr.required]=\"isRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.aria-required]=\"isRequired\"\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\" [attr.pattern]=\"patternAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\n <cw-button [type]=\"buttonType.ghost\"\n cssClass=\"btn-password-field\"\n [withIcon]=\"isPasswordShown ? spriteIcon.toolbarHidePassword : spriteIcon.toolbarShowPassword\"\n [withOnlyIcon]=\"true\"\n [label]=\"isPasswordShown ? '_COMMON._FORM._SHOW_HIDE_PWD.HIDE' : '_COMMON._FORM._SHOW_HIDE_PWD.SHOW'\"\n (btnAction)=\"togglePasswordVisibility()\">\n </cw-button>\n }\n\n <!-- Textarea -->\n @if (type === typeField.textarea) {\n <textarea class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"\n [attr.aria-required]=\"isRequired\" [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\" [attr.pattern]=\"patternAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\"></textarea>\n }\n\n <!-- Select -->\n @if (type === typeField.select) {\n <ng-select [formControl]=\"formControl\" [items]=\"options\" bindLabel=\"label\" [labelForId]=\"name\" [appendTo]=\"appendTo ?? ''\" bindValue=\"value\"\n [ngClass]=\"cssClass\" [searchable]=\"false\" [placeholder]=\"placeholder ? (placeholder | translate) : ''\" [readonly]=\"isReadonly\" [clearable]=\"false\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.required]=\"isRequired ? 'required' : null\"\n [attr.aria-required]=\"isRequired\" [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\" [attr.id]=\"name\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" (open)=\"onDropdownOpen()\" (close)=\"onDropdownClose()\">\n\n <!-- Template pour les options -->\n <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\">\n @if (optionTemplate) {\n <ng-container *ngTemplateOutlet=\"optionTemplate; context: { item: item | translate, index: index, searchTerm: search }\"></ng-container>\n }\n @else {\n <div>{{ item.label | translate }}</div>\n }\n </ng-template>\n\n <!-- Template pour le label -->\n <ng-template ng-label-tmp let-item=\"item\">\n @if (labelTemplate) {\n <ng-container *ngTemplateOutlet=\"labelTemplate; context: { item: item | translate }\"></ng-container>\n }\n @else {\n {{ (item.label | translate) || (placeholder | translate) }}\n }\n </ng-template>\n </ng-select>\n }\n\n <!-- NgSelect -->\n @if (type === typeField.ngSelect || type === typeField.ngSelectMultiple) {\n <ng-select [formControl]=\"formControl\" [items]=\"options\" bindLabel=\"label\" [labelForId]=\"name\" [appendTo]=\"appendTo ?? ''\" bindValue=\"value\"\n [multiple]=\"type === typeField.ngSelectMultiple\" [ngClass]=\"cssClass\" [clearable]=\"false\"\n [placeholder]=\"placeholder ? (placeholder | translate) : ''\" [readonly]=\"isReadonly\"\n [notFoundText]=\"'_COMMON.NO_RESULT' | translate\" [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"\n [attr.required]=\"isRequired ? 'required' : null\" [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\" [attr.id]=\"name\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" (search)=\"textChanged.emit($event?.term)\"\n (open)=\"onDropdownOpen()\" (close)=\"onDropdownClose()\">\n\n <!-- Template pour les options -->\n <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\">\n @if (optionTemplate) {\n <ng-container *ngTemplateOutlet=\"optionTemplate; context: { item: item, index: index, searchTerm: search }\"></ng-container>\n }\n @else {\n <div>{{ item.label | translate }}</div>\n }\n </ng-template>\n\n <!-- Template pour le label -->\n <ng-template ng-label-tmp let-item=\"item\" let-clear=\"clear\">\n <span class=\"ng-value-icon left\" (click)=\"clear(item)\" aria-hidden=\"true\">\u00D7</span>\n @if (labelTemplate) {\n <ng-container *ngTemplateOutlet=\"labelTemplate; context: { item: item | translate }\"></ng-container>\n }\n @else {\n {{ (item.label | translate) || (placeholder | translate) }}\n }\n </ng-template>\n </ng-select>\n }\n\n <!-- Radio -->\n @if (type === typeField.radioInline || type === typeField.radio) {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.radioInline ? 'd-flex-h gap-md flex-wrap' : 'd-flex-v gap-sm'\">\n @for (opt of options; track opt.value) {\n <li class=\"field-check\">\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [attr.name]=\"name\" [value]=\"opt.value\" [formControl]=\"formControl\"\n class=\"field-check-input\" [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" (change)=\"onRadioChange(opt.value)\" />\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">{{ opt.label | translate }}</label>\n </li>\n }\n </ul>\n </fieldset>\n }\n\n <!-- Radio button -->\n @if (type === typeField.radioButton) {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <div class=\"field-group field-group-btn\">\n @for (opt of options; track opt.value) {\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [attr.name]=\"name\" [value]=\"opt.value\" [formControl]=\"formControl\"\n class=\"visually-hidden\" [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" (change)=\"onRadioChange(opt.value)\"/>\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">{{ opt.label | translate }}</label>\n }\n </div>\n </fieldset>\n }\n\n <!-- Cartes : checkbox / radio / switch (contr\u00F4le \u00E0 gauche, titre, description facultative) -->\n @if (isChoiceCard) {\n @if (isBooleanChoiceCard) {\n <!-- Carte bool\u00E9enne (sans options) : une case li\u00E9e au FormControl<boolean>, nomm\u00E9e par le titre. -->\n <div class=\"field-card-list\" [class.field-card-list-compact]=\"isChoiceCardCompact\">\n <label class=\"field-card d-flex-h items-start gap-xs\" [for]=\"name\" [class.field-switch]=\"isSwitchCard\" [class.field-switch-small]=\"isSwitchCard\">\n <input type=\"checkbox\" [id]=\"name\" [formControl]=\"formControl\" class=\"field-check-input\"\n [attr.role]=\"isSwitchCard ? 'switch' : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"booleanCardDescribedBy\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" />\n <span class=\"d-flex-v gap-5xs\">\n <span class=\"field-card-title\">\n {{ label | translate }}\n @if (isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (!isChoiceCardCompact && description) {\n <span class=\"field-text\" [id]=\"name + '-desc'\">{{ description | translate }}</span>\n }\n </span>\n </label>\n </div>\n } @else {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <ul class=\"field-card-list list-unstyled mb-none\" [class.field-card-list-compact]=\"isChoiceCardCompact\">\n @for (opt of options; track opt.value) {\n <li class=\"d-flex-v\">\n <!-- Le label englobe toute la carte : un clic n'importe o\u00F9 coche l'option. -->\n <label class=\"field-card d-flex-h items-start gap-xs flex-1\" [for]=\"name + '_' + opt.value\" [class.field-switch]=\"isSwitchCard\" [class.field-switch-small]=\"isSwitchCard\">\n @if (isRadioCard) {\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [attr.name]=\"name\" [value]=\"opt.value\" [formControl]=\"formControl\"\n class=\"field-check-input\"\n [attr.aria-describedby]=\"(!isChoiceCardCompact && opt.description) ? name + '_' + opt.value + '-desc' : null\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" (change)=\"onRadioChange(opt.value)\" />\n } @else {\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\n [checked]=\"control.value?.includes(opt.value)\" class=\"field-check-input\"\n [attr.role]=\"isSwitchCard ? 'switch' : null\"\n [attr.aria-describedby]=\"(!isChoiceCardCompact && opt.description) ? name + '_' + opt.value + '-desc' : null\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\n }\n <span class=\"d-flex-v gap-5xs\">\n <span class=\"field-card-title\">{{ opt.label | translate }}</span>\n @if (!isChoiceCardCompact && opt.description) {\n <span class=\"field-text\" [id]=\"name + '_' + opt.value + '-desc'\">{{ opt.description | translate }}</span>\n }\n </span>\n </label>\n </li>\n }\n </ul>\n </fieldset>\n }\n }\n\n <!-- Checkbox Switch -->\n @if ( type === typeField.switch || type === typeField.switchSmall)\n {\n <div class=\"field-check field-switch\" [ngClass]=\"{'field-switch-small': type === typeField.switchSmall}\">\n <input type=\"checkbox\" [id]=\"name\" [formControl]=\"formControl\" class=\"field-check-input\" [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"/>\n <label [for]=\"name\" class=\"field-check-label\">{{ label | translate }}</label>\n </div>\n }\n\n <!-- Checkbox -->\n @if (type === typeField.checkboxInline || type === typeField.checkbox) {\n @if (isSingleCheckbox()) {\n <div class=\"field-check\" [class.field-check-inline]=\"type === typeField.checkboxInline\">\n <input #checkboxInput type=\"checkbox\" [id]=\"name\" [formControl]=\"formControl\"\n class=\"field-check-input\"\n [class.is-invalid]=\"control?.invalid && control?.touched\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control?.invalid && control?.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" />\n <label [for]=\"name\" class=\"field-check-label\">\n {{ label | translate }}\n @if (isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n </div>\n }\n @else if( options.length > 1) {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n [ngClass]=\"{ 'flex-column': type === typeField.checkbox }\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.checkboxInline ? 'd-flex-h gap-md' : 'd-flex-v gap-sm'\">\n @for (opt of options; track opt.value) {\n <li class=\"field-check\" [ngClass]=\"{ 'field-check-inline': type === typeField.checkboxInline }\">\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\n [checked]=\"control.value?.includes(opt.value)\" class=\"field-check-input\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">\n {{ opt.label | translate }}\n </label>\n </li>\n }\n </ul>\n </fieldset>\n }\n @else {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.checkboxInline ? 'd-flex-h gap-md' : 'd-flex-v gap-sm'\">\n @for (opt of options; track opt.value) {\n <li class=\"field-check\" [ngClass]=\"{ 'field-check-inline': type === typeField.checkboxInline }\">\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\n [checked]=\"control.value?.includes(opt.value)\" class=\"field-check-input\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">\n {{ opt.label | translate }}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n </li>\n }\n </ul>\n </fieldset>\n }\n }\n\n <!-- Checkbox button -->\n @if (type === typeField.checkboxButton && options.length > 0) {\n\n @if(options.length > 1) {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <div class=\"field-group field-group-btn\">\n @for (opt of options; track opt.value) {\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\n [checked]=\"control.value?.includes(opt.value)\" class=\"visually-hidden\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">{{ opt.label | translate }}</label>\n }\n </div>\n </fieldset>\n }\n @else {\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <div class=\"btn-group btn-group-secondary\">\n @for (opt of options; track opt.value) {\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\n [checked]=\"control.value?.includes(opt.value)\" class=\"visually-hidden\"\n [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\"/>\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">\n {{ opt.label | translate}}\n @if(isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n }\n </div>\n </fieldset>\n }\n }\n\n <!-- Period - DateToDate / TimeToTime / DateTimeToDateTime -->\n @if (isPeriod) {\n <!-- Fieldset : le legend nomme la p\u00E9riode, \u00AB Du \u00BB / \u00AB au \u00BB sont les labels de chaque input. -->\n <fieldset [attr.aria-labelledby]=\"hasFieldTooltip ? legendId : null\">\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\" [class.d-flex-h]=\"hasFieldTooltip\" [class.gap-2xs]=\"hasFieldTooltip\">\n <span [id]=\"legendId\">\n {{label | translate}}\n <!-- Deux bornes obligatoires : ast\u00E9risque sur la p\u00E9riode ; une seule : sur sa borne. -->\n @if(isStartRequired && isEndRequired) {\n <span class=\"text-danger\">*</span>\n }\n </span>\n @if (hasFieldTooltip) {\n <ng-container *ngTemplateOutlet=\"fieldTooltip\"></ng-container>\n }\n </legend>\n <!-- \u00C9tats invalide / d\u00E9sactiv\u00E9 pos\u00E9s seulement avec addon ou raccourcis (rendu historique sinon). -->\n <div class=\"field-group\"\n [class.field-group-invalid]=\"hasPeriodAddons && isInvalid\"\n [class.field-group-disabled]=\"hasPeriodAddons && isDisabledOrReadonly\">\n @if (addonLeft) {\n <div class=\"field-group-addon-left\">\n <ng-container [ngTemplateOutlet]=\"addonLeft\"></ng-container>\n </div>\n }\n <label class=\"field-group-addon-left\" [for]=\"name + '_start'\">\n {{ '_COMMON._DATES.FROM_TO_1' | translate }}\n @if(isStartRequired && !isEndRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n <input [type]=\"getInputType()\" class=\"field-control\" [id]=\"name + '_start'\" [formControl]=\"getControl('start')!\"\n [attr.title]=\"fieldTitle ? (fieldTitle | translate) + ' \u2013 ' + ('_COMMON._DATES.FROM_TO_1' | translate) : null\"\n [attr.placeholder]=\"type === typeField.timeToTime ? ('_COMMON._DATES.FROM' | translate) : ('_COMMON._DATES.FROM_TO_1' | translate)\"\n [ngClass]=\"[(cssClass || ''), getControl('start')?.value ? 'has-value' : '']\"\n [attr.required]=\"isStartRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.aria-required]=\"isStartRequired\"\n [attr.min]=\"minStartAttr\" [attr.max]=\"maxStartAttr\" [attr.step]=\"stepAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"getControl('start')?.invalid && getControl('start')?.touched\"\n [attr.aria-describedby]=\"getDescribedBy(getControl('start'))\"\n (focus)=\"onFocusRange('start')\" (blur)=\"onBlurRange('start')\" />\n\n @if(getControl('start')?.value && !isDisabledOrReadonly) {\n <button type=\"button\" class=\"btn btn-secondary btn-clear-field\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_START' | translate: { label: label | translate }\"\n (click)=\"onClearFieldPeriod('start')\">\n <span aria-hidden=\"true\">×</span>\n </button>\n }\n <label class=\"field-group-addon-center\" [for]=\"name + '_end'\">\n {{ '_COMMON._DATES.FROM_TO_2' | translate }}\n @if(isEndRequired && !isStartRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n <input [type]=\"getInputType()\" class=\"field-control\" [id]=\"name + '_end'\" [formControl]=\"getControl('end')!\"\n [attr.title]=\"fieldTitle ? (fieldTitle | translate) + ' \u2013 ' + ('_COMMON._DATES.FROM_TO_2' | translate) : null\"\n [attr.placeholder]=\"type === typeField.timeToTime ? ('_COMMON._DATES.TO' | translate) : ('_COMMON._DATES.FROM_TO_2' | translate)\"\n [ngClass]=\"[(cssClass || ''), getControl('end')?.value ? 'has-value' : '']\"\n [attr.required]=\"isEndRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.aria-required]=\"isEndRequired\"\n [attr.min]=\"minEndAttr\" [attr.max]=\"maxEndAttr\" [attr.step]=\"stepAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"getControl('end')?.invalid && getControl('end')?.touched\"\n [attr.aria-describedby]=\"getDescribedBy(getControl('end'))\"\n (focus)=\"onFocusRange('end')\" (blur)=\"onBlurRange('end')\" />\n\n @if(getControl('end')?.value && !isDisabledOrReadonly) {\n <button type=\"button\" class=\"btn btn-ghost btn-clear-field\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_END' | translate: { label: label | translate }\"\n (click)=\"onClearFieldPeriod('end')\">\n <span aria-hidden=\"true\">×</span>\n </button>\n }\n\n <!-- Raccourcis (dateToDate) puis addon droit : dans le fieldset, apr\u00E8s la borne de fin. -->\n @for (shortcut of activePeriodShortcuts; track $index) {\n <div class=\"field-group-addon-right\">\n <button type=\"button\" class=\"btn btn-ghost\"\n [class.active]=\"isPeriodShortcutActive(shortcut)\"\n [attr.aria-pressed]=\"isPeriodShortcutActive(shortcut)\"\n [attr.aria-label]=\"shortcut.ariaLabel ? (shortcut.ariaLabel | translate) : null\"\n [attr.disabled]=\"isDisabledOrReadonly ? 'disabled' : null\"\n (click)=\"onPeriodShortcut(shortcut)\">\n {{ shortcut.label | translate }}\n </button>\n </div>\n }\n @if (addonRight) {\n <div class=\"field-group-addon-right\">\n <ng-container [ngTemplateOutlet]=\"addonRight\"></ng-container>\n </div>\n }\n </div>\n </fieldset>\n }\n\n @if ([typeField.datePlusOne, typeField.datePlusTwo, typeField.datePlusSeven, typeField.dateComplexe].includes(type)) {\n\n <div class=\"field-group\">\n @if (type === typeField.dateComplexe) {\n <div class=\"field-group-addon-left\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onDateAddDay('prev')\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.nextLeft\" [label]=\"'Jour pr\u00E9c\u00E9dent'\"></cw-icon>\n </button>\n </div>\n }\n\n <input type=\"date\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\n [attr.title]=\"fieldTitle ? (fieldTitle | translate) : null\"\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [attr.aria-required]=\"isRequired\"\n [attr.min]=\"minAttr\" [attr.max]=\"maxAttr\" [attr.step]=\"stepAttr\"\n [attr.autocomplete]=\"autocomplete\"\n [attr.aria-invalid]=\"control.invalid && control.touched\"\n [attr.aria-describedby]=\"getDescribedBy(control)\"\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\n\n @if(formControl?.value && !isDisabledOrReadonly) {\n <button class=\"btn btn-ghost btn-clear-field\" type=\"button\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_FIELD' | translate: { label: label | translate }\"\n (click)=\"onClearField(formControl)\"><span aria-hidden=\"true\">×</span></button>\n }\n\n\n @if (type === typeField.dateComplexe) {\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onDateAddDay('next')\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.nextRight\" [label]=\"'Jour suivant'\"></cw-icon>\n </button>\n </div>\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onRefresh()\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.toolbarRefresh\" [label]=\"'Rafra\u00EEchir'\"></cw-icon>\n </button>\n </div>\n }\n\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onTodayAddDay(0)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n J\n <span class=\"visually-hidden\">Aujourd'hui</span>\n </button>\n </div>\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onTodayAddDay(1)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n J+1\n <span class=\"visually-hidden\">Demain</span>\n </button>\n </div>\n\n @if (type !== typeField.datePlusOne && type !== typeField.dateComplexe) {\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost \" type=\"button\" (click)=\"onTodayAddDay(2)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n J+2\n <span class=\"visually-hidden\">Dans 2 jours</span>\n </button>\n </div>\n\n @if (type !== typeField.datePlusTwo) {\n <div class=\"field-group-addon-right\">\n <button class=\"btn btn-ghost\" type=\"button\" (click)=\"onTodayAddDay(7)\"\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\n J+7\n <span class=\"visually-hidden\">Dans 7 jours</span>\n </button>\n </div>\n }\n }\n </div>\n }\n\n @if (type === typeField.slider) {\n <ngx-slider [(value)]=\"sliderValue\" [options]=\"sliderOptions\" [formControl]=\"formControl\"></ngx-slider>\n }\n\n @if (type === typeField.range) {\n <div class=\"slider\">\n\n <cw-button [isDisabled]=\"formControl.value <= rangeOptions.floor\" [label]=\"'Diminuer ' + formControl.value + ' ' + label\"\n [withIcon]=\"spriteIcon.toolbarMinus\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\"\n [iconSize]=\"buttonIconSize.small\" (btnAction)=\"onRangeStep('decrease')\">\n </cw-button>\n\n <div class=\"slider-input\">\n <label [for]=\"name\" class=\"slider-tooltip\" [style.left]=\"getRangePercent() + '%'\" aria-live=\"polite\"\n aria-atomic=\"true\">\n {{ label | translate }} {{ formControl.value }}\n @if (rangeOptions.unit) {\n <abbr [title]=\"rangeOptions.unit\">{{ rangeOptions.unit }}</abbr>\n }\n </label>\n\n <div class=\"slider-custom-bar\">\n <div class=\"slider-custom-bar-selection\" [style.width]=\"getRangePercent() + '%'\">\n </div>\n </div>\n\n <input type=\"range\" [id]=\"name\" [formControl]=\"formControl\" [min]=\"rangeOptions.floor\" [max]=\"rangeOptions.ceil\"\n [step]=\"rangeOptions.step || 1\" class=\"field-control-range\" [attr.aria-required]=\"isRequired\"\n [attr.aria-invalid]=\"control.invalid && control.touched\">\n </div>\n\n <cw-button [isDisabled]=\"formControl.value >= rangeOptions.ceil\" [label]=\"'Augmenter ' + formControl.value + ' ' + label\"\n [withIcon]=\"spriteIcon.toolbarPlus\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\"\n [iconSize]=\"buttonIconSize.small\" (btnAction)=\"onRangeStep('increase')\">\n </cw-button>\n </div>\n }\n\n @if (isInInputGroup() && clearable && !isDisabledOrReadonly && type !== typeField.autocompleteMultiple) {\n @if (type === typeField.autocomplete) {\n @if (autocompleteRef()?.hasAnyContent()) {\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_FIELD' | translate: { label: label | translate }\"\n (click)=\"onClearAutocomplete()\"><span aria-hidden=\"true\">×</span></button>\n }\n } @else if (type === typeField.ngSelectMultiple) {\n <!-- value est un tableau : un [] vide \u00E9tant truthy, on teste .length pour n'afficher le clear global que s'il y a au moins une s\u00E9lection. -->\n @if (formControl?.value?.length) {\n <button class=\"btn btn-ghost btn-clear-field\" type=\"button\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_FIELD' | translate: { label: label | translate }\"\n (click)=\"onClearField(formControl)\"><span aria-hidden=\"true\">×</span></button>\n }\n } @else {\n @if(formControl?.value) {\n <button class=\"btn btn-ghost btn-clear-field\" type=\"button\"\n [attr.aria-label]=\"'_COMMON._FORM.CLEAR_FIELD' | translate: { label: label | translate }\"\n (click)=\"onClearField(formControl)\"><span aria-hidden=\"true\">×</span></button>\n }\n }\n }\n\n</ng-template>\n\n<ng-template #fieldLabel>\n <label [for]=\"name\" class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\n {{ label | translate }}\n\n @if (isRequired) {\n <span class=\"text-danger\">*</span>\n }\n </label>\n</ng-template>\n\n<!-- Bouton d'aide (tooltip) partage label/legend. Hors du <label> (sinon son libelle\n s'ajoute au nom du champ et le clic active le label) ; dans un <legend>, le fieldset\n est nomme par aria-labelledby sur le seul texte (legendId) pour la meme raison. -->\n<ng-template #fieldTooltip>\n <button type=\"button\" class=\"btn btn-ghost btn-field-tooltip\"\n [cwTooltip]=\"tooltip ?? ''\"\n [attr.data-test-ctw]=\"'tooltip-' + name\">\n <cw-icon [icon]=\"spriteIcon.alertHelp\" [type]=\"iconType.circular\" [iconUiType]=\"iconUiType.info\"\n [iconSize]=\"iconSize.xs\" [label]=\"'_COMMON._FORM.TOOLTIP_HELP' | translate\"></cw-icon>\n </button>\n</ng-template>\n" }]
|
|
4474
4599
|
}], ctorParameters: () => [], propDecorators: { control: [{
|
|
4475
4600
|
type: Input
|
|
4476
4601
|
}], formGroup: [{
|
|
@@ -4507,6 +4632,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImpo
|
|
|
4507
4632
|
type: Input
|
|
4508
4633
|
}], requiredEnd: [{
|
|
4509
4634
|
type: Input
|
|
4635
|
+
}], periodShortcuts: [{
|
|
4636
|
+
type: Input
|
|
4637
|
+
}], description: [{
|
|
4638
|
+
type: Input
|
|
4510
4639
|
}], help: [{
|
|
4511
4640
|
type: Input
|
|
4512
4641
|
}], helpParams: [{
|
|
@@ -4561,6 +4690,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImpo
|
|
|
4561
4690
|
}], labelTemplate: [{
|
|
4562
4691
|
type: ContentChild,
|
|
4563
4692
|
args: ['ngLabelTpl', { read: TemplateRef }]
|
|
4693
|
+
}], autocompleteOptionTpl: [{
|
|
4694
|
+
type: ContentChild,
|
|
4695
|
+
args: [CwAutocompleteOptionDirective]
|
|
4564
4696
|
}], hostClasses: [{
|
|
4565
4697
|
type: HostBinding,
|
|
4566
4698
|
args: ['class']
|
|
@@ -5056,6 +5188,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImpo
|
|
|
5056
5188
|
args: [{ selector: 'cw-modals', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [CommonModule, TranslateModule, NgClass, NgTemplateOutlet, ButtonComponent, LoaderComponent, IconComponent], template: "<div class=\"cityway-v8 modal-backdrop fade show\" style=\"z-index: 1050;\" aria-hidden=\"true\"></div>\r\n\r\n<div role=\"dialog\" tabindex=\"-1\" aria-modal=\"true\"\r\n [attr.aria-labelledby]=\"type() === modalsType.loader ? null : titleId\"\r\n [attr.aria-label]=\"type() === modalsType.loader ? ('_COMMON._HTTP.TXT_LOADING' | translate) : null\"\r\n [attr.aria-describedby]=\"modalSubtitle() && !isStateLike() && type() !== modalsType.loader ? subtitleId : null\"\r\n class=\"cityway-v8 d-flex modal show\" [ngClass]=\"customClass()\" data-test-ctw=\"modal\" (keydown)=\"onKeyDown($event)\">\r\n\r\n <!-- Backdrop : fermeture a la souris (confort). Le clavier (Escape) est gere\r\n par onKeyDown du dialog ; le backdrop n'est pas un element interactif focusable.\r\n requestClose() applique le verrou (cf. isCloseLocked) : plus de test sur le type ici. -->\r\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\r\n <div class=\"modal-inner-backdrop\" (click)=\"requestClose()\"></div>\r\n\r\n <div #modalContainer role=\"document\" class=\"modal-dialog\"\r\n [ngClass]=\"['modal-' + size(), scrollable() ? 'modal-dialog-scrollable' : '']\">\r\n\r\n <div class=\"modal-content\">\r\n\r\n <!-- Verrou actif : region live qui annonce chaque tentative de fermeture refusee\r\n (Echap, backdrop, croix). Rendue vide au repos car une region live doit\r\n pre-exister dans le DOM pour que son remplissage soit annonce. Absente pour\r\n le loader, qui possede deja la sienne dans cw-loader. -->\r\n @if (showCloseLockedStatus()) {\r\n <span class=\"visually-hidden\" role=\"status\" aria-live=\"polite\">{{ closeLockedAnnouncement() | translate }}</span>\r\n }\r\n\r\n @if (type() === modalsType.loader) {\r\n <div class=\"modal-body\">\r\n <cw-loader></cw-loader>\r\n </div>\r\n }\r\n @else {\r\n @if (isStateLike()) {\r\n <!-- state + delete : close en absolu (top-right, hors flux donc ne reserve\r\n pas de hauteur), body centre avec le picto de statut EN TETE du flux\r\n (il pousse donc le titre normalement) -->\r\n <!-- aria-disabled + .disabled (Bootstrap) plutot que `disabled` natif : la croix\r\n reste focusable et annoncee \u00AB desactivee \u00BB, et le focus trap conserve une\r\n cible. Un `disabled` natif la sortirait du selecteur de focusables. -->\r\n <button type=\"button\" class=\"btn-close modal-close-floating\" [attr.aria-label]=\"'_COMMON._ACTION.CLOSE' | translate\"\r\n [class.disabled]=\"isCloseLocked()\" [attr.aria-disabled]=\"isCloseLocked() ? 'true' : null\"\r\n (click)=\"requestClose()\" data-test-ctw=\"btn-close-modal\">\r\n <cw-icon [icon]=\"spriteIcon.toolbarClose\" [iconSize]=\"iconSize['lg']\" [type]=\"iconType.default\" aria-hidden=\"true\"></cw-icon>\r\n </button>\r\n\r\n <div class=\"modal-body modal-body-state d-flex-v gap-md items-center\" [class.modal-text-center]=\"isBodyCentered()\">\r\n <cw-icon [icon]=\"statusIcon()\" [iconSize]=\"iconSize['xl']\" [type]=\"iconType.square\"\r\n [iconUiType]=\"statusUiType()\" aria-hidden=\"true\"></cw-icon>\r\n\r\n <h1 class=\"modal-title\" [id]=\"titleId\">\r\n @if (type() === modalsType.delete) {\r\n {{ '_COMMON._MODAL_DELETE.TITLE' | translate: { number: itemsToDelete().length, name: itemsToDeleteTitle() | translate } }}\r\n }\r\n @else {\r\n {{ (modalTitle() ?? '') | translate: modalTitleParams() }}\r\n }\r\n </h1>\r\n\r\n @if (type() === modalsType.delete) {\r\n <!-- zone delete en dur : texte + liste + avertissement, pleine largeur aligne a gauche -->\r\n <div class=\"w-100 d-flex-v gap-md\">\r\n @if (itemsToDelete().length > 1) {\r\n <div [innerHTML]=\"'_COMMON._MODAL_DELETE.MULTIPLE_TEXT' | translate\"></div>\r\n }\r\n @else {\r\n <div [innerHTML]=\"'_COMMON._MODAL_DELETE.SIMPLE_TEXT' | translate\"></div>\r\n }\r\n\r\n @if (itemsToDelete().length > 0) {\r\n <ul class=\"mb-none\">\r\n @for (item of itemsToDelete(); track item) {\r\n <li>{{ item }}</li>\r\n }\r\n </ul>\r\n }\r\n\r\n <div [innerHTML]=\"'_COMMON._MODAL_DELETE.IRREVERSIBLE' | translate\"></div>\r\n </div>\r\n }\r\n\r\n @if (customBodyTemplate()) {\r\n <div class=\"w-100\">\r\n <ng-container [ngTemplateOutlet]=\"customBodyTemplate()\" [ngTemplateOutletContext]=\"customBodyContext()\">\r\n </ng-container>\r\n </div>\r\n }\r\n </div>\r\n }\r\n @else {\r\n <!-- default + sidepanel : header titre + close, body = contenu libre (slot) -->\r\n <div class=\"modal-header\">\r\n <!-- Titre + sous-titre empiles ; sous-titre aux classes du sous-titre de cw-card. -->\r\n <div class=\"flex-1\">\r\n <h1 class=\"modal-title\" [id]=\"titleId\">\r\n {{ (modalTitle() ?? '') | translate: modalTitleParams() }}\r\n </h1>\r\n @if (modalSubtitle(); as subtitle) {\r\n <div class=\"modal-subtitle fs fs-xs text-light\" [id]=\"subtitleId\">{{ subtitle }}</div>\r\n }\r\n </div>\r\n\r\n <!-- cf. croix state/delete : aria-disabled, pas `disabled` natif -->\r\n <button type=\"button\" class=\"btn-close\" [attr.aria-label]=\"'_COMMON._ACTION.CLOSE' | translate\"\r\n [class.disabled]=\"isCloseLocked()\" [attr.aria-disabled]=\"isCloseLocked() ? 'true' : null\"\r\n (click)=\"requestClose()\" data-test-ctw=\"btn-close-modal\">\r\n <cw-icon [icon]=\"spriteIcon.toolbarClose\" [iconSize]=\"iconSize['lg']\" [type]=\"iconType.default\" aria-hidden=\"true\"></cw-icon>\r\n </button>\r\n </div>\r\n\r\n <div class=\"modal-body d-flex-v gap-md\">\r\n @if (customBodyTemplate()) {\r\n <ng-container [ngTemplateOutlet]=\"customBodyTemplate()\" [ngTemplateOutletContext]=\"customBodyContext()\">\r\n </ng-container>\r\n }\r\n </div>\r\n }\r\n\r\n <!-- footer commun : secondaire a gauche, primaire/danger a droite (ordre DS) -->\r\n <div class=\"modal-footer\">\r\n @if (type() === modalsType.delete) {\r\n <cw-button label=\"_COMMON._ACTION.CLOSE\" [type]=\"buttonTypeEnum.secondary\"\r\n [isDisabled]=\"isCloseLocked()\" (btnAction)=\"requestClose()\" dataTest=\"btn-close-modal\">\r\n </cw-button>\r\n\r\n <cw-button label=\"_COMMON._ACTION.DELETE\" [type]=\"buttonTypeEnum.danger\"\r\n [isDisabled]=\"disableBtnAction1()\" (btnAction)=\"action1Click()\" dataTest=\"btn-action-modal\">\r\n </cw-button>\r\n }\r\n @else {\r\n @if (labelBtnAction2()) {\r\n <cw-button [label]=\"labelBtnAction2()\" [type]=\"buttonTypeEnum.secondary\"\r\n [isDisabled]=\"disableBtnAction2()\" (btnAction)=\"action2Click()\" dataTest=\"btn-action-modal\">\r\n </cw-button>\r\n }\r\n @else {\r\n <!-- Bouton de repli : il occupe la place de l'action 2, il applique donc\r\n disableBtnAction2 (auparavant le seul bouton du composant a ignorer\r\n son input de desactivation). -->\r\n <cw-button label=\"_COMMON._ACTION.CLOSE\" [type]=\"buttonTypeEnum.secondary\"\r\n [isDisabled]=\"isCloseLocked() || disableBtnAction2()\"\r\n (btnAction)=\"fallbackCloseClick()\" dataTest=\"btn-close-modal\">\r\n </cw-button>\r\n }\r\n @if (labelBtnAction1()) {\r\n <cw-button [label]=\"labelBtnAction1()\" [type]=\"buttonTypeEnum.primary\"\r\n [isDisabled]=\"disableBtnAction1()\" (btnAction)=\"action1Click()\" dataTest=\"btn-action-modal\">\r\n </cw-button>\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n </div>\r\n </div>\r\n</div>\r\n" }]
|
|
5057
5189
|
}], propDecorators: { modalContainer: [{ type: i0.ViewChild, args: ['modalContainer', { isSignal: true }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], customClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "customClass", required: false }] }], scrollable: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollable", required: false }] }], isAutcompModal: [{ type: i0.Input, args: [{ isSignal: true, alias: "isAutcompModal", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: true }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], textType: [{ type: i0.Input, args: [{ isSignal: true, alias: "textType", required: false }] }], modalTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "modalTitle", required: false }] }], modalTitleParams: [{ type: i0.Input, args: [{ isSignal: true, alias: "modalTitleParams", required: false }] }], modalSubtitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "modalSubtitle", required: false }] }], itemsToDelete: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemsToDelete", required: false }] }], itemsToDeleteTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemsToDeleteTitle", required: false }] }], labelBtnAction1: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelBtnAction1", required: false }] }], labelBtnAction2: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelBtnAction2", required: false }] }], disableBtnAction1: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableBtnAction1", required: false }] }], disableBtnAction2: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableBtnAction2", required: false }] }], customBodyTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "customBodyTemplate", required: false }] }], customBodyContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "customBodyContext", required: false }] }], closeLocked: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeLocked", required: false }] }], closeLockedMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeLockedMessage", required: false }] }], keepOpenOnAction1: [{ type: i0.Input, args: [{ isSignal: true, alias: "keepOpenOnAction1", required: false }] }], keepOpenOnAction2: [{ type: i0.Input, args: [{ isSignal: true, alias: "keepOpenOnAction2", required: false }] }], btnAction1: [{ type: i0.Output, args: ["btnAction1"] }], btnAction2: [{ type: i0.Output, args: ["btnAction2"] }] } });
|
|
5058
5190
|
|
|
5191
|
+
/**
|
|
5192
|
+
* Contenu d'onglet cree a la premiere ouverture de l'onglet (puis conserve) :
|
|
5193
|
+
* `<ng-template cwTabLazy>…</ng-template>` dans un `cw-tab-content`. Sans lui, le contenu est cree
|
|
5194
|
+
* des l'arrivee sur la page et seulement masque (tableaux et appels API de tous les onglets).
|
|
5195
|
+
*/
|
|
5196
|
+
class TabLazyDirective {
|
|
5197
|
+
constructor() {
|
|
5198
|
+
this.templateRef = inject(TemplateRef);
|
|
5199
|
+
}
|
|
5200
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: TabLazyDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
5201
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.20", type: TabLazyDirective, isStandalone: true, selector: "ng-template[cwTabLazy]", ngImport: i0 }); }
|
|
5202
|
+
}
|
|
5203
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: TabLazyDirective, decorators: [{
|
|
5204
|
+
type: Directive,
|
|
5205
|
+
args: [{
|
|
5206
|
+
selector: 'ng-template[cwTabLazy]',
|
|
5207
|
+
standalone: true,
|
|
5208
|
+
}]
|
|
5209
|
+
}] });
|
|
5059
5210
|
class TabContentComponent {
|
|
5060
5211
|
constructor() {
|
|
5061
5212
|
this.title = input.required(...(ngDevMode ? [{ debugName: "title" }] : []));
|
|
@@ -5063,45 +5214,71 @@ class TabContentComponent {
|
|
|
5063
5214
|
this.withIcon = input(...(ngDevMode ? [undefined, { debugName: "withIcon" }] : []));
|
|
5064
5215
|
/** Badge affiché après le libellé de l'onglet (compteur, statut). */
|
|
5065
5216
|
this.badge = input(...(ngDevMode ? [undefined, { debugName: "badge" }] : []));
|
|
5217
|
+
/**
|
|
5218
|
+
* Sous-onglets : `cw-tab-content` imbriques directement dans celui-ci. Leur barre est dessinee
|
|
5219
|
+
* par le `cw-tab` parent, sous la barre principale ; leurs panneaux restent dans ce panneau.
|
|
5220
|
+
*/
|
|
5221
|
+
this.children = contentChildren(TabContentComponent, ...(ngDevMode ? [{ debugName: "children" }] : []));
|
|
5222
|
+
/** Contenu differe (`ng-template cwTabLazy`) de CE panneau, pas d'un sous-onglet. */
|
|
5223
|
+
this.lazy = contentChild(TabLazyDirective, ...(ngDevMode ? [{ debugName: "lazy", descendants: false }] : [{ descendants: false }]));
|
|
5066
5224
|
// Etat pilote par le parent `cw-tab` : signaux writable (le parent appelle `.set()`)
|
|
5067
5225
|
// pour declencher la detection de changement sous OnPush.
|
|
5068
5226
|
this.id = signal(0, ...(ngDevMode ? [{ debugName: "id" }] : []));
|
|
5069
5227
|
this.active = signal(false, ...(ngDevMode ? [{ debugName: "active" }] : []));
|
|
5228
|
+
/** Ids DOM de l'onglet et de son panneau, uniques par `cw-tab` (pose par le parent). */
|
|
5229
|
+
this.tabId = signal('', ...(ngDevMode ? [{ debugName: "tabId" }] : []));
|
|
5230
|
+
this.panelId = signal('', ...(ngDevMode ? [{ debugName: "panelId" }] : []));
|
|
5231
|
+
/** Index du sous-onglet choisi, memorise quand on change d'onglet principal. */
|
|
5232
|
+
this.selectedChild = signal(0, ...(ngDevMode ? [{ debugName: "selectedChild" }] : []));
|
|
5233
|
+
/** Le contenu differe est cree a la 1re activation, puis garde (etat, filtres, scroll). */
|
|
5234
|
+
this.opened = signal(false, ...(ngDevMode ? [{ debugName: "opened" }] : []));
|
|
5235
|
+
this.lazyRendered = computed(() => !!this.lazy() && (this.active() || this.opened()), ...(ngDevMode ? [{ debugName: "lazyRendered" }] : []));
|
|
5236
|
+
effect(() => {
|
|
5237
|
+
if (this.active())
|
|
5238
|
+
this.opened.set(true);
|
|
5239
|
+
});
|
|
5070
5240
|
}
|
|
5071
5241
|
get fragment() {
|
|
5072
5242
|
return UtilsHelper.slugify(this.title());
|
|
5073
5243
|
}
|
|
5074
5244
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: TabContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
5075
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
5076
|
-
<div class="tab-pane"
|
|
5077
|
-
[class.fade]="!active()"
|
|
5078
|
-
[class.active]="active()"
|
|
5079
|
-
[class.show]="active()"
|
|
5080
|
-
[class.d-none]="!active()"
|
|
5081
|
-
[id]="
|
|
5082
|
-
role="tabpanel"
|
|
5083
|
-
[attr.aria-labelledby]="
|
|
5084
|
-
<ng-content></ng-content>
|
|
5085
|
-
|
|
5086
|
-
|
|
5245
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: TabContentComponent, isStandalone: true, selector: "cw-tab-content", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, withIcon: { classPropertyName: "withIcon", publicName: "withIcon", isSignal: true, isRequired: false, transformFunction: null }, badge: { classPropertyName: "badge", publicName: "badge", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.title": "null" } }, queries: [{ propertyName: "children", predicate: TabContentComponent, isSignal: true }, { propertyName: "lazy", first: true, predicate: TabLazyDirective, isSignal: true }], ngImport: i0, template: `
|
|
5246
|
+
<div class="tab-pane"
|
|
5247
|
+
[class.fade]="!active()"
|
|
5248
|
+
[class.active]="active()"
|
|
5249
|
+
[class.show]="active()"
|
|
5250
|
+
[class.d-none]="!active()"
|
|
5251
|
+
[id]="panelId()"
|
|
5252
|
+
role="tabpanel"
|
|
5253
|
+
[attr.aria-labelledby]="tabId()">
|
|
5254
|
+
<ng-content></ng-content>
|
|
5255
|
+
@if (lazyRendered()) {
|
|
5256
|
+
<ng-container [ngTemplateOutlet]="lazy()!.templateRef"></ng-container>
|
|
5257
|
+
}
|
|
5258
|
+
</div>
|
|
5259
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
5087
5260
|
}
|
|
5088
5261
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: TabContentComponent, decorators: [{
|
|
5089
5262
|
type: Component,
|
|
5090
5263
|
args: [{
|
|
5091
5264
|
selector: 'cw-tab-content',
|
|
5092
|
-
template: `
|
|
5093
|
-
<div class="tab-pane"
|
|
5094
|
-
[class.fade]="!active()"
|
|
5095
|
-
[class.active]="active()"
|
|
5096
|
-
[class.show]="active()"
|
|
5097
|
-
[class.d-none]="!active()"
|
|
5098
|
-
[id]="
|
|
5099
|
-
role="tabpanel"
|
|
5100
|
-
[attr.aria-labelledby]="
|
|
5101
|
-
<ng-content></ng-content>
|
|
5102
|
-
|
|
5265
|
+
template: `
|
|
5266
|
+
<div class="tab-pane"
|
|
5267
|
+
[class.fade]="!active()"
|
|
5268
|
+
[class.active]="active()"
|
|
5269
|
+
[class.show]="active()"
|
|
5270
|
+
[class.d-none]="!active()"
|
|
5271
|
+
[id]="panelId()"
|
|
5272
|
+
role="tabpanel"
|
|
5273
|
+
[attr.aria-labelledby]="tabId()">
|
|
5274
|
+
<ng-content></ng-content>
|
|
5275
|
+
@if (lazyRendered()) {
|
|
5276
|
+
<ng-container [ngTemplateOutlet]="lazy()!.templateRef"></ng-container>
|
|
5277
|
+
}
|
|
5278
|
+
</div>
|
|
5103
5279
|
`,
|
|
5104
5280
|
standalone: true,
|
|
5281
|
+
imports: [NgTemplateOutlet],
|
|
5105
5282
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
5106
5283
|
host: {
|
|
5107
5284
|
// `title` est aussi un attribut HTML global : écrit en attribut statique (`title="KEY"`),
|
|
@@ -5110,7 +5287,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImpo
|
|
|
5110
5287
|
'[attr.title]': 'null'
|
|
5111
5288
|
}
|
|
5112
5289
|
}]
|
|
5113
|
-
}], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], withIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "withIcon", required: false }] }], badge: [{ type: i0.Input, args: [{ isSignal: true, alias: "badge", required: false }] }] } });
|
|
5290
|
+
}], ctorParameters: () => [], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], withIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "withIcon", required: false }] }], badge: [{ type: i0.Input, args: [{ isSignal: true, alias: "badge", required: false }] }], children: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => TabContentComponent), { isSignal: true }] }], lazy: [{ type: i0.ContentChild, args: [i0.forwardRef(() => TabLazyDirective), { ...{ descendants: false }, isSignal: true }] }] } });
|
|
5114
5291
|
|
|
5115
5292
|
var FoTabTypeEnum;
|
|
5116
5293
|
(function (FoTabTypeEnum) {
|
|
@@ -5123,6 +5300,8 @@ var BoTabTypeEnum;
|
|
|
5123
5300
|
BoTabTypeEnum["card"] = "card";
|
|
5124
5301
|
})(BoTabTypeEnum || (BoTabTypeEnum = {}));
|
|
5125
5302
|
|
|
5303
|
+
/** Separateur onglet / sous-onglet dans le fragment d'URL (`#mtickets/validations`). */
|
|
5304
|
+
const FRAGMENT_SEPARATOR = '/';
|
|
5126
5305
|
class TabComponent {
|
|
5127
5306
|
constructor() {
|
|
5128
5307
|
this.router = inject(Router);
|
|
@@ -5134,33 +5313,51 @@ class TabComponent {
|
|
|
5134
5313
|
this.title = input(...(ngDevMode ? [undefined, { debugName: "title" }] : []));
|
|
5135
5314
|
this.tabContentCssClass = input('', ...(ngDevMode ? [{ debugName: "tabContentCssClass" }] : []));
|
|
5136
5315
|
this.activeTabIndex = input(0, ...(ngDevMode ? [{ debugName: "activeTabIndex" }] : []));
|
|
5316
|
+
/** Onglets principaux : `cw-tab-content` enfants directs (les sous-onglets sont dans ceux-ci). */
|
|
5137
5317
|
this.tabs = contentChildren(TabContentComponent, ...(ngDevMode ? [{ debugName: "tabs" }] : []));
|
|
5138
5318
|
this.tabLinks = viewChildren('tabLink', ...(ngDevMode ? [{ debugName: "tabLinks" }] : []));
|
|
5139
5319
|
this.tabChanged = output();
|
|
5320
|
+
/** Emis au choix d'un sous-onglet (clic, clavier, fragment d'URL). */
|
|
5321
|
+
this.subTabChanged = output();
|
|
5322
|
+
/**
|
|
5323
|
+
* Prefixe des ids DOM, unique par instance : deux `cw-tab` sur une page (ou une page qui en
|
|
5324
|
+
* contenait un dans un onglet d'un autre) produisaient deux `cw-nav-0`, et `aria-controls` /
|
|
5325
|
+
* `aria-labelledby` pointaient sur le mauvais element.
|
|
5326
|
+
*/
|
|
5327
|
+
this.uid = uniqueId('cw-tab');
|
|
5140
5328
|
this.activeId = 0;
|
|
5141
5329
|
this.iconSize = IconSizeEnum['md'];
|
|
5330
|
+
/** Onglet principal actif : sa liste de sous-onglets alimente la seconde barre. */
|
|
5331
|
+
this.activeTab = signal(undefined, ...(ngDevMode ? [{ debugName: "activeTab" }] : []));
|
|
5332
|
+
this.subTabs = computed(() => this.activeTab()?.children() ?? [], ...(ngDevMode ? [{ debugName: "subTabs" }] : []));
|
|
5333
|
+
// Ids DOM des onglets et panneaux, recalcules si la liste change (`@for`, `@if`).
|
|
5334
|
+
effect(() => {
|
|
5335
|
+
this.tabs().forEach((tab, i) => {
|
|
5336
|
+
tab.id.set(i);
|
|
5337
|
+
tab.tabId.set(`${this.uid}-tab-${i}`);
|
|
5338
|
+
tab.panelId.set(`${this.uid}-panel-${i}`);
|
|
5339
|
+
tab.children().forEach((child, j) => {
|
|
5340
|
+
child.id.set(j);
|
|
5341
|
+
child.tabId.set(`${this.uid}-tab-${i}-${j}`);
|
|
5342
|
+
child.panelId.set(`${this.uid}-panel-${i}-${j}`);
|
|
5343
|
+
});
|
|
5344
|
+
});
|
|
5345
|
+
});
|
|
5142
5346
|
}
|
|
5143
5347
|
ngAfterContentInit() {
|
|
5144
5348
|
const tabsArray = [...this.tabs()];
|
|
5145
|
-
tabsArray.forEach(
|
|
5146
|
-
|
|
5147
|
-
tab.active.set(false);
|
|
5148
|
-
});
|
|
5149
|
-
const firstActiveIndex = tabsArray.findIndex(t => !t.disabled());
|
|
5349
|
+
tabsArray.forEach(tab => tab.selectedChild.set(this.firstEnabledIndex(tab.children())));
|
|
5350
|
+
const firstActiveIndex = this.firstEnabledIndex(tabsArray);
|
|
5150
5351
|
// Onglet demande s'il est valide et non desactive ; sinon 1er onglet actif ; sinon 0.
|
|
5151
5352
|
const requested = this.activeTabIndex();
|
|
5152
5353
|
const requestedOk = requested >= 0 && requested < tabsArray.length && !tabsArray[requested]?.disabled();
|
|
5153
|
-
this.activeId = requestedOk ? requested :
|
|
5354
|
+
this.activeId = requestedOk ? requested : firstActiveIndex;
|
|
5154
5355
|
if (this.useFragment()) {
|
|
5155
5356
|
this.route.fragment
|
|
5156
5357
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
5157
5358
|
.subscribe(fragment => {
|
|
5158
|
-
if (fragment)
|
|
5159
|
-
|
|
5160
|
-
if (foundIndex !== -1) {
|
|
5161
|
-
this.activeId = foundIndex;
|
|
5162
|
-
}
|
|
5163
|
-
}
|
|
5359
|
+
if (fragment)
|
|
5360
|
+
this.applyFragment(fragment);
|
|
5164
5361
|
this.activateTabByIndex(this.activeId);
|
|
5165
5362
|
});
|
|
5166
5363
|
}
|
|
@@ -5171,74 +5368,122 @@ class TabComponent {
|
|
|
5171
5368
|
selectTab(tab) {
|
|
5172
5369
|
if (tab.disabled())
|
|
5173
5370
|
return;
|
|
5174
|
-
this.tabs().forEach(t => t.active.set(false));
|
|
5175
|
-
tab.active.set(true);
|
|
5176
5371
|
this.activeId = tab.id();
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
relativeTo: this.route,
|
|
5180
|
-
fragment: tab.fragment,
|
|
5181
|
-
queryParamsHandling: 'preserve',
|
|
5182
|
-
replaceUrl: true
|
|
5183
|
-
});
|
|
5184
|
-
}
|
|
5372
|
+
this.syncActive();
|
|
5373
|
+
this.writeFragment();
|
|
5185
5374
|
this.tabChanged.emit(this.activeId);
|
|
5186
5375
|
}
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5376
|
+
/**
|
|
5377
|
+
* Choisit un sous-onglet de l'onglet principal `parent`. Si l'onglet principal change, émet
|
|
5378
|
+
* `tabChanged` avant `subTabChanged`.
|
|
5379
|
+
*/
|
|
5380
|
+
selectSubTab(parent, child) {
|
|
5381
|
+
if (child.disabled() || parent.disabled())
|
|
5382
|
+
return;
|
|
5383
|
+
const tabChanged = this.activeId !== parent.id();
|
|
5384
|
+
this.activeId = parent.id();
|
|
5385
|
+
parent.selectedChild.set(child.id());
|
|
5386
|
+
this.syncActive();
|
|
5387
|
+
this.writeFragment();
|
|
5388
|
+
if (tabChanged)
|
|
5389
|
+
this.tabChanged.emit(this.activeId);
|
|
5390
|
+
this.subTabChanged.emit({ tabIndex: parent.id(), subTabIndex: child.id() });
|
|
5391
|
+
}
|
|
5392
|
+
/** Fleches / Debut / Fin dans une barre (principale ou sous-onglets), focus suivant la selection. */
|
|
5393
|
+
onKeydown(event, level = 'tab') {
|
|
5394
|
+
const list = level === 'tab' ? [...this.tabs()] : [...this.subTabs()];
|
|
5395
|
+
const current = level === 'tab' ? this.activeId : (this.activeTab()?.selectedChild() ?? 0);
|
|
5396
|
+
let next;
|
|
5194
5397
|
switch (event.key) {
|
|
5195
5398
|
case 'ArrowLeft':
|
|
5196
|
-
|
|
5197
|
-
this.selectPreviousTab();
|
|
5399
|
+
next = this.nextEnabled(list, current, -1);
|
|
5198
5400
|
break;
|
|
5199
5401
|
case 'ArrowRight':
|
|
5200
|
-
|
|
5201
|
-
this.selectNextTab();
|
|
5402
|
+
next = this.nextEnabled(list, current, 1);
|
|
5202
5403
|
break;
|
|
5404
|
+
case 'Home':
|
|
5405
|
+
next = this.nextEnabled(list, -1, 1);
|
|
5406
|
+
break;
|
|
5407
|
+
case 'End':
|
|
5408
|
+
next = this.nextEnabled(list, list.length, -1);
|
|
5409
|
+
break;
|
|
5410
|
+
default: return;
|
|
5411
|
+
}
|
|
5412
|
+
event.preventDefault();
|
|
5413
|
+
if (next === undefined || next === current)
|
|
5414
|
+
return;
|
|
5415
|
+
if (level === 'tab') {
|
|
5416
|
+
this.selectTab(list[next]);
|
|
5203
5417
|
}
|
|
5418
|
+
else {
|
|
5419
|
+
this.selectSubTab(this.activeTab(), list[next]);
|
|
5420
|
+
}
|
|
5421
|
+
// Focus sur l'onglet selectionne de LA MEME barre (roving tabindex).
|
|
5422
|
+
const tablist = event.currentTarget?.closest('[role="tablist"]');
|
|
5423
|
+
setTimeout(() => tablist?.querySelector('[aria-selected="true"]')?.focus());
|
|
5204
5424
|
}
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5425
|
+
/** Etat `active` de tous les panneaux : onglet actif, et son sous-onglet choisi. */
|
|
5426
|
+
syncActive() {
|
|
5427
|
+
const tabsArray = [...this.tabs()];
|
|
5428
|
+
tabsArray.forEach((tab, i) => {
|
|
5429
|
+
const isActive = i === this.activeId;
|
|
5430
|
+
tab.active.set(isActive);
|
|
5431
|
+
tab.children().forEach((child, j) => child.active.set(isActive && j === tab.selectedChild()));
|
|
5210
5432
|
});
|
|
5433
|
+
this.activeTab.set(tabsArray[this.activeId]);
|
|
5211
5434
|
}
|
|
5212
|
-
|
|
5213
|
-
const
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
let newIndex = (activeIndex - 1 + tabsArray.length) % tabsArray.length;
|
|
5217
|
-
while (tabsArray[newIndex].disabled() && newIndex !== activeIndex) {
|
|
5218
|
-
newIndex = (newIndex - 1 + tabsArray.length) % tabsArray.length;
|
|
5219
|
-
}
|
|
5220
|
-
if (!tabsArray[newIndex].disabled()) {
|
|
5221
|
-
this.selectTab(tabsArray[newIndex]);
|
|
5222
|
-
setTimeout(() => this.moveFocus());
|
|
5223
|
-
}
|
|
5435
|
+
activateTabByIndex(index) {
|
|
5436
|
+
const tab = this.tabs()[index];
|
|
5437
|
+
if (tab && !tab.disabled()) {
|
|
5438
|
+
this.selectTab(tab);
|
|
5224
5439
|
}
|
|
5225
5440
|
}
|
|
5226
|
-
|
|
5441
|
+
/** `#onglet` ou `#onglet/sous-onglet` (slugs des titres). Un fragment inconnu est ignore. */
|
|
5442
|
+
applyFragment(fragment) {
|
|
5443
|
+
const [tabSlug, subSlug] = fragment.split(FRAGMENT_SEPARATOR);
|
|
5227
5444
|
const tabsArray = [...this.tabs()];
|
|
5228
|
-
const
|
|
5229
|
-
if (
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
}
|
|
5445
|
+
const tabIndex = tabsArray.findIndex(t => t.fragment === tabSlug && !t.disabled());
|
|
5446
|
+
if (tabIndex === -1)
|
|
5447
|
+
return;
|
|
5448
|
+
this.activeId = tabIndex;
|
|
5449
|
+
if (subSlug) {
|
|
5450
|
+
const children = tabsArray[tabIndex].children();
|
|
5451
|
+
const subIndex = children.findIndex(c => c.fragment === subSlug && !c.disabled());
|
|
5452
|
+
if (subIndex !== -1)
|
|
5453
|
+
tabsArray[tabIndex].selectedChild.set(subIndex);
|
|
5238
5454
|
}
|
|
5239
5455
|
}
|
|
5456
|
+
writeFragment() {
|
|
5457
|
+
if (!this.useFragment())
|
|
5458
|
+
return;
|
|
5459
|
+
const tab = this.tabs()[this.activeId];
|
|
5460
|
+
if (!tab)
|
|
5461
|
+
return;
|
|
5462
|
+
const sub = tab.children()[tab.selectedChild()];
|
|
5463
|
+
this.router.navigate([], {
|
|
5464
|
+
relativeTo: this.route,
|
|
5465
|
+
fragment: sub ? `${tab.fragment}${FRAGMENT_SEPARATOR}${sub.fragment}` : tab.fragment,
|
|
5466
|
+
queryParamsHandling: 'preserve',
|
|
5467
|
+
replaceUrl: true
|
|
5468
|
+
});
|
|
5469
|
+
}
|
|
5470
|
+
firstEnabledIndex(list) {
|
|
5471
|
+
const index = list.findIndex(t => !t.disabled());
|
|
5472
|
+
return index === -1 ? 0 : index;
|
|
5473
|
+
}
|
|
5474
|
+
/** Prochain onglet non desactive dans le sens `step`, en bouclant ; `undefined` si aucun. */
|
|
5475
|
+
nextEnabled(list, from, step) {
|
|
5476
|
+
if (!list.length)
|
|
5477
|
+
return undefined;
|
|
5478
|
+
for (let k = 1; k <= list.length; k++) {
|
|
5479
|
+
const index = (((from + step * k) % list.length) + list.length) % list.length;
|
|
5480
|
+
if (!list[index].disabled())
|
|
5481
|
+
return index;
|
|
5482
|
+
}
|
|
5483
|
+
return undefined;
|
|
5484
|
+
}
|
|
5240
5485
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: TabComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
5241
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: TabComponent, isStandalone: true, selector: "cw-tab", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, useFragment: { classPropertyName: "useFragment", publicName: "useFragment", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, tabContentCssClass: { classPropertyName: "tabContentCssClass", publicName: "tabContentCssClass", isSignal: true, isRequired: false, transformFunction: null }, activeTabIndex: { classPropertyName: "activeTabIndex", publicName: "activeTabIndex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { tabChanged: "tabChanged" }, host: { classAttribute: "cw-tab" }, queries: [{ propertyName: "tabs", predicate: TabContentComponent, isSignal: true }], viewQueries: [{ propertyName: "tabLinks", predicate: ["tabLink"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"tab\" [ngClass]=\"'tab-' + type()\">\
|
|
5486
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: TabComponent, isStandalone: true, selector: "cw-tab", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, useFragment: { classPropertyName: "useFragment", publicName: "useFragment", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, tabContentCssClass: { classPropertyName: "tabContentCssClass", publicName: "tabContentCssClass", isSignal: true, isRequired: false, transformFunction: null }, activeTabIndex: { classPropertyName: "activeTabIndex", publicName: "activeTabIndex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { tabChanged: "tabChanged", subTabChanged: "subTabChanged" }, host: { classAttribute: "cw-tab" }, queries: [{ propertyName: "tabs", predicate: TabContentComponent, isSignal: true }], viewQueries: [{ propertyName: "tabLinks", predicate: ["tabLink"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"tab\" [ngClass]=\"'tab-' + type()\">\n <!-- En-tete libre au-dessus des onglets (identite d'une fiche...), dans la meme carte en variante\n `card`. Masque quand rien n'est projete (`:empty`). -->\n <div class=\"tab-header\"><ng-content select=\"[tab-header]\"></ng-content></div>\n\n @if (title(); as title) {\n <h2>{{ title | translate }}</h2>\n }\n <ul class=\"tab-items d-flex-h\" [ngClass]=\"'tab-items-' + type()\" role=\"tablist\">\n @for (tab of tabs(); track tab; let i = $index) {\n <li class=\"tab-item\" role=\"presentation\">\n <button #tabLink type=\"button\" class=\"tab-link btn\" [class.active]=\"tab.active()\" [class.disabled]=\"tab.disabled()\"\n [disabled]=\"tab.disabled()\" [attr.id]=\"tab.tabId()\" [attr.data-test-ctw]=\"'link-tab-' + id() + '-' + i\"\n [attr.aria-selected]=\"tab.active()\" [attr.aria-controls]=\"tab.panelId()\"\n [attr.tabindex]=\"tab.active() ? '0' : '-1'\" (click)=\"selectTab(tab)\" (keydown)=\"onKeydown($event)\" role=\"tab\">\n <ng-container *ngTemplateOutlet=\"tabLabel; context: { $implicit: tab }\"></ng-container>\n </button>\n </li>\n }\n </ul>\n\n <!-- Sous-onglets de l'onglet actif (`cw-tab-content` imbriques), sous la barre principale :\n seconde tablist, nommee par l'onglet principal actif. -->\n @if (activeTab(); as parent) {\n @if (subTabs().length) {\n <ul class=\"tab-items tab-items-sub d-flex-h\" role=\"tablist\" [attr.aria-labelledby]=\"parent.tabId()\">\n @for (sub of subTabs(); track sub; let j = $index) {\n <li class=\"tab-item\" role=\"presentation\">\n <button type=\"button\" class=\"tab-link btn\" [class.active]=\"sub.active()\" [class.disabled]=\"sub.disabled()\"\n [disabled]=\"sub.disabled()\" [attr.id]=\"sub.tabId()\" [attr.data-test-ctw]=\"'link-tab-' + id() + '-' + activeId + '-' + j\"\n [attr.aria-selected]=\"sub.active()\" [attr.aria-controls]=\"sub.panelId()\"\n [attr.tabindex]=\"sub.active() ? '0' : '-1'\" (click)=\"selectSubTab(parent, sub)\" (keydown)=\"onKeydown($event, 'sub')\" role=\"tab\">\n <ng-container *ngTemplateOutlet=\"tabLabel; context: { $implicit: sub }\"></ng-container>\n </button>\n </li>\n }\n </ul>\n }\n }\n</div>\n\n<div [class]=\"'tab-content ' + tabContentCssClass()\" [ngClass]=\"'tab-content-' + type()\">\n <ng-content></ng-content>\n</div>\n\n<!-- Libelle d'un onglet (principal ou sous-onglet) : picto, titre, badge. -->\n<ng-template #tabLabel let-tab>\n @if (tab.withIcon(); as icon) {\n <cw-icon [icon]=\"icon\" [iconSize]=\"iconSize\"></cw-icon>\n }\n {{ tab.title() | translate }}\n @if (tab.badge(); as badge) {\n <cw-badge [type]=\"badge.type\" [label]=\"badge.label\" [withIcon]=\"badge.withIcon\"\n [iconPosition]=\"badge.iconPosition\" [cssClass]=\"badge.cssClass ?? ''\" [dataTest]=\"badge.dataTest\"></cw-badge>\n }\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "text", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom", "spritePath"] }, { kind: "component", type: BadgeComponent, selector: "cw-badge", inputs: ["type", "label", "labelParams", "withIcon", "iconPosition", "cssClass", "skeletonMode", "dataTest"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
5242
5487
|
}
|
|
5243
5488
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: TabComponent, decorators: [{
|
|
5244
5489
|
type: Component,
|
|
@@ -5251,8 +5496,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImpo
|
|
|
5251
5496
|
IconComponent,
|
|
5252
5497
|
BadgeComponent,
|
|
5253
5498
|
TranslateModule
|
|
5254
|
-
], template: "<div class=\"tab\" [ngClass]=\"'tab-' + type()\">\
|
|
5255
|
-
}], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], useFragment: [{ type: i0.Input, args: [{ isSignal: true, alias: "useFragment", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], tabContentCssClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabContentCssClass", required: false }] }], activeTabIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeTabIndex", required: false }] }], tabs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => TabContentComponent), { isSignal: true }] }], tabLinks: [{ type: i0.ViewChildren, args: ['tabLink', { isSignal: true }] }], tabChanged: [{ type: i0.Output, args: ["tabChanged"] }] } });
|
|
5499
|
+
], template: "<div class=\"tab\" [ngClass]=\"'tab-' + type()\">\n <!-- En-tete libre au-dessus des onglets (identite d'une fiche...), dans la meme carte en variante\n `card`. Masque quand rien n'est projete (`:empty`). -->\n <div class=\"tab-header\"><ng-content select=\"[tab-header]\"></ng-content></div>\n\n @if (title(); as title) {\n <h2>{{ title | translate }}</h2>\n }\n <ul class=\"tab-items d-flex-h\" [ngClass]=\"'tab-items-' + type()\" role=\"tablist\">\n @for (tab of tabs(); track tab; let i = $index) {\n <li class=\"tab-item\" role=\"presentation\">\n <button #tabLink type=\"button\" class=\"tab-link btn\" [class.active]=\"tab.active()\" [class.disabled]=\"tab.disabled()\"\n [disabled]=\"tab.disabled()\" [attr.id]=\"tab.tabId()\" [attr.data-test-ctw]=\"'link-tab-' + id() + '-' + i\"\n [attr.aria-selected]=\"tab.active()\" [attr.aria-controls]=\"tab.panelId()\"\n [attr.tabindex]=\"tab.active() ? '0' : '-1'\" (click)=\"selectTab(tab)\" (keydown)=\"onKeydown($event)\" role=\"tab\">\n <ng-container *ngTemplateOutlet=\"tabLabel; context: { $implicit: tab }\"></ng-container>\n </button>\n </li>\n }\n </ul>\n\n <!-- Sous-onglets de l'onglet actif (`cw-tab-content` imbriques), sous la barre principale :\n seconde tablist, nommee par l'onglet principal actif. -->\n @if (activeTab(); as parent) {\n @if (subTabs().length) {\n <ul class=\"tab-items tab-items-sub d-flex-h\" role=\"tablist\" [attr.aria-labelledby]=\"parent.tabId()\">\n @for (sub of subTabs(); track sub; let j = $index) {\n <li class=\"tab-item\" role=\"presentation\">\n <button type=\"button\" class=\"tab-link btn\" [class.active]=\"sub.active()\" [class.disabled]=\"sub.disabled()\"\n [disabled]=\"sub.disabled()\" [attr.id]=\"sub.tabId()\" [attr.data-test-ctw]=\"'link-tab-' + id() + '-' + activeId + '-' + j\"\n [attr.aria-selected]=\"sub.active()\" [attr.aria-controls]=\"sub.panelId()\"\n [attr.tabindex]=\"sub.active() ? '0' : '-1'\" (click)=\"selectSubTab(parent, sub)\" (keydown)=\"onKeydown($event, 'sub')\" role=\"tab\">\n <ng-container *ngTemplateOutlet=\"tabLabel; context: { $implicit: sub }\"></ng-container>\n </button>\n </li>\n }\n </ul>\n }\n }\n</div>\n\n<div [class]=\"'tab-content ' + tabContentCssClass()\" [ngClass]=\"'tab-content-' + type()\">\n <ng-content></ng-content>\n</div>\n\n<!-- Libelle d'un onglet (principal ou sous-onglet) : picto, titre, badge. -->\n<ng-template #tabLabel let-tab>\n @if (tab.withIcon(); as icon) {\n <cw-icon [icon]=\"icon\" [iconSize]=\"iconSize\"></cw-icon>\n }\n {{ tab.title() | translate }}\n @if (tab.badge(); as badge) {\n <cw-badge [type]=\"badge.type\" [label]=\"badge.label\" [withIcon]=\"badge.withIcon\"\n [iconPosition]=\"badge.iconPosition\" [cssClass]=\"badge.cssClass ?? ''\" [dataTest]=\"badge.dataTest\"></cw-badge>\n }\n</ng-template>\n" }]
|
|
5500
|
+
}], ctorParameters: () => [], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], useFragment: [{ type: i0.Input, args: [{ isSignal: true, alias: "useFragment", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], tabContentCssClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabContentCssClass", required: false }] }], activeTabIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeTabIndex", required: false }] }], tabs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => TabContentComponent), { isSignal: true }] }], tabLinks: [{ type: i0.ViewChildren, args: ['tabLink', { isSignal: true }] }], tabChanged: [{ type: i0.Output, args: ["tabChanged"] }], subTabChanged: [{ type: i0.Output, args: ["subTabChanged"] }] } });
|
|
5256
5501
|
|
|
5257
5502
|
class StepperComponent {
|
|
5258
5503
|
constructor() {
|
|
@@ -6146,5 +6391,5 @@ const CW_DEFAULT_THEME_OPTIONS = [
|
|
|
6146
6391
|
* Generated bundle index. Do not edit.
|
|
6147
6392
|
*/
|
|
6148
6393
|
|
|
6149
|
-
export { AccordionComponent, AlertComponent, AlertLiveEnum, AlertTypeEnum, BadgeComponent, BadgePositionEnum, BadgeTypeEnum, BoButtonTypeEnum, BoTabTypeEnum, BreadcrumbComponent, ButtonComponent, ButtonIconSizeEnum, ButtonPositionEnum, CW_DEFAULT_THEME_OPTIONS, CardComponent, CardTitleRankEnum, CardTypeEnum, ClickOutsideDirective, CollapseDirective, CwThemeKeyEnum, CwTooltipDirective, DividerComponent, DropdownComponent, DropdownItemDirective, DropdownPositionEnum, EmptyStateComponent, EmptyStateIllustrationEnum, FileDropComponent, FileDropFileStatusEnum, FileDropModeEnum, FileDropRejectReasonEnum, FilePreviewComponent, FileToDownloadComponent, FoButtonTypeEnum, FoTabTypeEnum, FocusTrackerService, FormFieldComponent, FormFieldTypeEnum, IconComponent, IconNotifSizeEnum, IconNotifTypeEnum, IconNotificationComponent, IconSizeEnum, IconTypeEnum, IconUiTypeEnum, ImageComponent, LanguageSelectorComponent, LegendColorEnum, LegendComponent, LegendTypeEnum, LoaderComponent, LoaderSizeEnum, ModalsComponent, ModalsService, ModalsSize, ModalsState, ModalsTextType, ModalsType, NumericalRangeComponent, NumericalRangeLabelPositionEnum, NumericalRangeTypeEnum, PlacementEnum, RequiredInfoComponent, ResponsiveService, SkipLinksComponent, SpriteIconEnum, StepperComponent, TOAST_AUTOHIDE_DELAY_MS, TabComponent, TabContentComponent, ThemeSelectorComponent, ThemeService, TitleComponent, TitleContextEnum, TitleTagEnum, ToastComponent, ToastItemComponent, ToastService, TooltipPositionEnum, TriggerTooltipEnum, TypeTooltipEnum, rangeValidator, resolveArrowPos };
|
|
6394
|
+
export { AccordionComponent, AlertComponent, AlertLiveEnum, AlertTypeEnum, BadgeComponent, BadgePositionEnum, BadgeTypeEnum, BoButtonTypeEnum, BoTabTypeEnum, BreadcrumbComponent, ButtonComponent, ButtonIconSizeEnum, ButtonPositionEnum, CW_DEFAULT_THEME_OPTIONS, CardComponent, CardTitleRankEnum, CardTypeEnum, ClickOutsideDirective, CollapseDirective, CwAutocompleteOptionDirective, CwHighlightPipe, CwThemeKeyEnum, CwTooltipDirective, DividerComponent, DropdownComponent, DropdownItemDirective, DropdownPositionEnum, EmptyStateComponent, EmptyStateIllustrationEnum, FileDropComponent, FileDropFileStatusEnum, FileDropModeEnum, FileDropRejectReasonEnum, FilePreviewComponent, FileToDownloadComponent, FoButtonTypeEnum, FoTabTypeEnum, FocusTrackerService, FormFieldComponent, FormFieldTypeEnum, IconComponent, IconNotifSizeEnum, IconNotifTypeEnum, IconNotificationComponent, IconSizeEnum, IconTypeEnum, IconUiTypeEnum, ImageComponent, LanguageSelectorComponent, LegendColorEnum, LegendComponent, LegendTypeEnum, LoaderComponent, LoaderSizeEnum, ModalsComponent, ModalsService, ModalsSize, ModalsState, ModalsTextType, ModalsType, NumericalRangeComponent, NumericalRangeLabelPositionEnum, NumericalRangeTypeEnum, PlacementEnum, RequiredInfoComponent, ResponsiveService, SkipLinksComponent, SpriteIconEnum, StepperComponent, TOAST_AUTOHIDE_DELAY_MS, TabComponent, TabContentComponent, TabLazyDirective, ThemeSelectorComponent, ThemeService, TitleComponent, TitleContextEnum, TitleTagEnum, ToastComponent, ToastItemComponent, ToastService, TooltipPositionEnum, TriggerTooltipEnum, TypeTooltipEnum, highlightTerm, rangeValidator, resolveArrowPos };
|
|
6150
6395
|
//# sourceMappingURL=cityway-basic-ui.mjs.map
|