@cityway/basic-ui 1.0.2-beta021 → 1.0.2-beta023
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/cityway-basic-ui-1.0.2-beta023.tgz +0 -0
- package/fesm2022/cityway-basic-ui.mjs +1068 -76
- package/fesm2022/cityway-basic-ui.mjs.map +1 -1
- package/img/flags.png +0 -0
- package/img/flags.webp +0 -0
- package/img/flags@2x.png +0 -0
- package/img/flags@2x.webp +0 -0
- package/index.d.ts +390 -14
- package/lib/assets/i18n/common.en.json +7 -1
- package/lib/assets/i18n/common.fr.json +7 -1
- package/lib/assets/icons/sprite.svg +3 -1
- package/package.json +6 -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.0.2-beta021.tgz +0 -0
- package/lib/assets/styles/scss/_reboot.scss +0 -494
- package/lib/assets/styles/scss/_root-bo.scss +0 -22
- package/lib/assets/styles/scss/_root-fo.scss +0 -14
- package/lib/assets/styles/scss/basic-ui.styles.bo.scss +0 -49
- package/lib/assets/styles/scss/basic-ui.styles.fo.scss +0 -49
- package/lib/assets/styles/scss/components/_accordion.scss +0 -35
- package/lib/assets/styles/scss/components/_alert.scss +0 -78
- package/lib/assets/styles/scss/components/_badge.scss +0 -111
- package/lib/assets/styles/scss/components/_breadcrumb.scss +0 -51
- package/lib/assets/styles/scss/components/_btn-collapse.scss +0 -23
- package/lib/assets/styles/scss/components/_card.scss +0 -98
- package/lib/assets/styles/scss/components/_close.scss +0 -11
- package/lib/assets/styles/scss/components/_dropdown.scss +0 -91
- package/lib/assets/styles/scss/components/_file-to-download.scss +0 -46
- package/lib/assets/styles/scss/components/_icon-notification.scss +0 -30
- package/lib/assets/styles/scss/components/_icon.scss +0 -138
- package/lib/assets/styles/scss/components/_modal.scss +0 -165
- package/lib/assets/styles/scss/components/_numerical-range.scss +0 -60
- package/lib/assets/styles/scss/components/_stepper.scss +0 -78
- package/lib/assets/styles/scss/components/_toast.scss +0 -27
- package/lib/assets/styles/scss/components/_tooltip.scss +0 -35
- package/lib/assets/styles/scss/components/button/_button-bo-variant.scss +0 -112
- package/lib/assets/styles/scss/components/button/_button-fo-variant.scss +0 -57
- package/lib/assets/styles/scss/components/button/_button.scss +0 -152
- package/lib/assets/styles/scss/components/form-field/_field-check.scss +0 -137
- package/lib/assets/styles/scss/components/form-field/_form-field.scss +0 -153
- package/lib/assets/styles/scss/components/form-field/_ng-select.scss +0 -93
- package/lib/assets/styles/scss/components/form-field/_slider-range.scss +0 -68
- package/lib/assets/styles/scss/components/tab/_tab-bo.scss +0 -95
- package/lib/assets/styles/scss/components/tab/_tab-fo.scss +0 -83
- package/lib/assets/styles/scss/helpers/_skeleton.scss +0 -67
- package/lib/assets/styles/scss/helpers/_spinner.scss +0 -37
- package/lib/assets/styles/scss/helpers/_stretched-link.scss +0 -9
- package/lib/assets/styles/scss/helpers/_visually-hidden.scss +0 -18
- package/lib/assets/styles/scss/mixins/_color.scss +0 -16
- package/lib/assets/styles/scss/mixins/_flex.scss +0 -11
- package/lib/assets/styles/scss/mixins/_popover-tooltip.scss +0 -144
- package/lib/assets/styles/scss/mixins/_root.scss +0 -26
- package/lib/assets/styles/scss/mixins/_spacing.scss +0 -84
- package/lib/assets/styles/scss/mixins/_type.scss +0 -44
- package/lib/assets/styles/scss/utilities/_alignment.scss +0 -23
- package/lib/assets/styles/scss/utilities/_breakpoints.scss +0 -30
- package/lib/assets/styles/scss/utilities/_flex.scss +0 -142
- package/lib/assets/styles/scss/utilities/_grid.scss +0 -64
- package/lib/assets/styles/scss/utilities/_position.scss +0 -24
- package/lib/assets/styles/scss/utilities/_spacing.scss +0 -3
- package/lib/assets/styles/scss/utilities/type/_type-bo.scss +0 -40
- package/lib/assets/styles/scss/utilities/type/_type-fo.scss +0 -132
- package/lib/assets/styles/scss/utilities/type/_type.scss +0 -34
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import * as i1 from '@angular/common';
|
|
2
2
|
import { CommonModule, NgClass, NgTemplateOutlet } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { inject, ElementRef, signal, EventEmitter, effect, Output, Input, Directive, input, HostBinding, Component, ChangeDetectorRef, model, output, viewChild, contentChildren, Injectable, NgZone, HostListener, ChangeDetectionStrategy, Renderer2, ViewChild, TemplateRef, ContentChild, ApplicationRef, Injector, createComponent, viewChildren, Pipe
|
|
4
|
+
import { inject, ElementRef, signal, EventEmitter, effect, Output, Input, Directive, input, HostBinding, Component, ChangeDetectorRef, model, output, viewChild, contentChildren, Injectable, NgZone, HostListener, ChangeDetectionStrategy, Renderer2, ViewChild, DestroyRef, computed, TemplateRef, ContentChild, ApplicationRef, Injector, createComponent, viewChildren, Pipe } from '@angular/core';
|
|
5
5
|
import * as i2 from '@ngx-translate/core';
|
|
6
6
|
import { TranslatePipe, TranslateModule, TranslateService } from '@ngx-translate/core';
|
|
7
|
-
import {
|
|
7
|
+
import { RouterLink, Router, ActivatedRoute } from '@angular/router';
|
|
8
|
+
import { BehaviorSubject, fromEvent, tap, filter, debounceTime, switchMap, catchError, of } from 'rxjs';
|
|
8
9
|
import * as i4 from '@angular-slider/ngx-slider';
|
|
9
10
|
import { NgxSliderModule } from '@angular-slider/ngx-slider';
|
|
10
11
|
export { Options } from '@angular-slider/ngx-slider';
|
|
12
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
11
13
|
import * as i2$1 from '@angular/forms';
|
|
12
|
-
import { FormGroup, Validators, FormsModule
|
|
14
|
+
import { FormControl, ReactiveFormsModule, FormGroup, Validators, FormsModule } from '@angular/forms';
|
|
15
|
+
import intlTelInput from 'intl-tel-input';
|
|
16
|
+
import itiEn from 'intl-tel-input/dist/js/i18n/en.js';
|
|
17
|
+
import itiFr from 'intl-tel-input/dist/js/i18n/fr.js';
|
|
13
18
|
import * as i3 from '@ng-select/ng-select';
|
|
14
19
|
import { NgSelectModule } from '@ng-select/ng-select';
|
|
15
|
-
import { Router, ActivatedRoute, RouterLink } from '@angular/router';
|
|
16
20
|
|
|
17
21
|
class CollapseDirective {
|
|
18
22
|
set cwCollapse(value) {
|
|
@@ -626,6 +630,7 @@ var SpriteIconEnum;
|
|
|
626
630
|
SpriteIconEnum["wrench"] = "wrench";
|
|
627
631
|
SpriteIconEnum["xls"] = "xls";
|
|
628
632
|
SpriteIconEnum["zip"] = "zip";
|
|
633
|
+
SpriteIconEnum["undefined"] = "undefined";
|
|
629
634
|
})(SpriteIconEnum || (SpriteIconEnum = {}));
|
|
630
635
|
|
|
631
636
|
class IconComponent {
|
|
@@ -1384,6 +1389,7 @@ class ButtonComponent {
|
|
|
1384
1389
|
this.buttonPositionEnum = ButtonPositionEnum;
|
|
1385
1390
|
this.id = '';
|
|
1386
1391
|
this.isDropdown = false;
|
|
1392
|
+
this.hideCaret = false;
|
|
1387
1393
|
this.withOnlyIcon = false;
|
|
1388
1394
|
this.iconSize = ButtonIconSizeEnum.default;
|
|
1389
1395
|
this.iconPosition = this.buttonPositionEnum.left;
|
|
@@ -1439,6 +1445,14 @@ class ButtonComponent {
|
|
|
1439
1445
|
onBtnAction() {
|
|
1440
1446
|
this.btnAction.emit();
|
|
1441
1447
|
}
|
|
1448
|
+
onLinkClick(event) {
|
|
1449
|
+
if (this.isDisabled) {
|
|
1450
|
+
event.preventDefault();
|
|
1451
|
+
event.stopPropagation();
|
|
1452
|
+
return;
|
|
1453
|
+
}
|
|
1454
|
+
this.btnAction.emit();
|
|
1455
|
+
}
|
|
1442
1456
|
toggleDropdown() {
|
|
1443
1457
|
this.getPlacement(this.dropdownPosition);
|
|
1444
1458
|
this.setAriaExpanded();
|
|
@@ -1452,9 +1466,17 @@ class ButtonComponent {
|
|
|
1452
1466
|
}
|
|
1453
1467
|
}
|
|
1454
1468
|
onClickOutside() {
|
|
1469
|
+
this.closeDropdown();
|
|
1470
|
+
}
|
|
1471
|
+
/**
|
|
1472
|
+
* Ferme le panneau dropdown de façon programmatique (no-op si déjà fermé).
|
|
1473
|
+
* Symétrique de `DropdownComponent.closeDropdown()` : retire la classe `show`,
|
|
1474
|
+
* repositionne `aria-expanded`, met `isOpen` à false et émet `dropDownClicked(false)`.
|
|
1475
|
+
*/
|
|
1476
|
+
closeDropdown() {
|
|
1455
1477
|
this.dropdownToggle?.nativeElement.setAttribute('aria-expanded', 'false');
|
|
1456
1478
|
this.dropdown?.nativeElement.classList.remove("show");
|
|
1457
|
-
this.dropdownMenu
|
|
1479
|
+
this.dropdownMenu?.nativeElement.classList.remove("show");
|
|
1458
1480
|
this.isOpen = false;
|
|
1459
1481
|
this.dropDownClicked.emit(this.isOpen);
|
|
1460
1482
|
}
|
|
@@ -1521,7 +1543,7 @@ class ButtonComponent {
|
|
|
1521
1543
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
1522
1544
|
}
|
|
1523
1545
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1524
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: ButtonComponent, isStandalone: true, selector: "cw-button", inputs: { type: "type", label: "label", id: "id", isDropdown: "isDropdown", withIcon: "withIcon", withOnlyIcon: "withOnlyIcon", iconSize: "iconSize", iconPosition: "iconPosition", dropdownPosition: "dropdownPosition", isMinWidth: "isMinWidth", isDisabled: "isDisabled", isLoading: "isLoading", cssClass: "cssClass", dataTest: "dataTest", skeletonMode: "skeletonMode", withTooltip: "withTooltip", tooltipText: "tooltipText", tooltipTitle: "tooltipTitle", tooltipTrigger: "tooltipTrigger", tooltipPosition: "tooltipPosition", tooltipType: "tooltipType" }, outputs: { btnAction: "btnAction", dropDownClicked: "dropDownClicked" }, host: { properties: { "class": "this.hostClasses" } }, viewQueries: [{ propertyName: "dropdown", first: true, predicate: ["dropdown"], descendants: true }, { propertyName: "dropdownMenu", first: true, predicate: ["dropdownMenu"], descendants: true }, { propertyName: "dropdownToggle", first: true, predicate: ["dropdownToggle"], descendants: true }], ngImport: i0, template: "<!-- Wrapper pour le tooltip -->\r\n@if (withTooltip) {\r\n <div class=\"d-inline-block p-relative\" (clickOutside)=\"onTooltipClickOutside()\" ctwClickOutside>\r\n\r\n <ng-container *ngTemplateOutlet=\"buttonTemplate\"></ng-container>\r\n\r\n <!-- Tooltip/Popover -->\r\n @if (isTooltipOpened) {\r\n <div role=\"tooltip\" [id]=\"'ctw-tooltip-' + tooltipRandomId\" [ngClass]=\"tooltipType + ' fade show ' + tooltipType + '-' + tooltipPosition\">\r\n <div class=\"arrow\"></div>\r\n @if (tooltipTitle) {\r\n <div [ngClass]=\"(tooltipType === typeTooltipEnum.popover ? 'popover' : 'tooltip') + '-header'\"\r\n [innerHTML]=\"tooltipTitle | translate\"></div>\r\n }\r\n <div [ngClass]=\"tooltipType + '-body'\"\r\n [innerHTML]=\"tooltipText | translate\"></div>\r\n </div>\r\n }\r\n </div>\r\n}\r\n@else {\r\n <ng-container *ngTemplateOutlet=\"buttonTemplate\"></ng-container>\r\n}\r\n\r\n<!-- Template du bouton (code existant envelopp\u00E9) -->\r\n<ng-template #buttonTemplate>\r\n @if (!isDropdown) {\r\n <button type=\"button\" class=\"btn\" [class]=\"'btn-' + type + ' ' + cssClass\" [ngClass]=\"getButtonClasses()\"\r\n
|
|
1546
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: ButtonComponent, isStandalone: true, selector: "cw-button", inputs: { type: "type", label: "label", id: "id", link: "link", isDropdown: "isDropdown", hideCaret: "hideCaret", withIcon: "withIcon", withOnlyIcon: "withOnlyIcon", iconSize: "iconSize", iconPosition: "iconPosition", dropdownPosition: "dropdownPosition", isMinWidth: "isMinWidth", isDisabled: "isDisabled", isLoading: "isLoading", cssClass: "cssClass", dataTest: "dataTest", skeletonMode: "skeletonMode", withTooltip: "withTooltip", tooltipText: "tooltipText", tooltipTitle: "tooltipTitle", tooltipTrigger: "tooltipTrigger", tooltipPosition: "tooltipPosition", tooltipType: "tooltipType" }, outputs: { btnAction: "btnAction", dropDownClicked: "dropDownClicked" }, host: { properties: { "class": "this.hostClasses" } }, viewQueries: [{ propertyName: "dropdown", first: true, predicate: ["dropdown"], descendants: true }, { propertyName: "dropdownMenu", first: true, predicate: ["dropdownMenu"], descendants: true }, { propertyName: "dropdownToggle", first: true, predicate: ["dropdownToggle"], descendants: true }], ngImport: i0, template: "<!-- Wrapper pour le tooltip -->\r\n@if (withTooltip) {\r\n <div class=\"d-inline-block p-relative\" (clickOutside)=\"onTooltipClickOutside()\" ctwClickOutside>\r\n\r\n <ng-container *ngTemplateOutlet=\"buttonTemplate\"></ng-container>\r\n\r\n <!-- Tooltip/Popover -->\r\n @if (isTooltipOpened) {\r\n <div role=\"tooltip\" [id]=\"'ctw-tooltip-' + tooltipRandomId\" [ngClass]=\"tooltipType + ' fade show ' + tooltipType + '-' + tooltipPosition\">\r\n <div class=\"arrow\"></div>\r\n @if (tooltipTitle) {\r\n <div [ngClass]=\"(tooltipType === typeTooltipEnum.popover ? 'popover' : 'tooltip') + '-header'\"\r\n [innerHTML]=\"tooltipTitle | translate\"></div>\r\n }\r\n <div [ngClass]=\"tooltipType + '-body'\"\r\n [innerHTML]=\"tooltipText | translate\"></div>\r\n </div>\r\n }\r\n </div>\r\n}\r\n@else {\r\n <ng-container *ngTemplateOutlet=\"buttonTemplate\"></ng-container>\r\n}\r\n\r\n<!-- Template du bouton (code existant envelopp\u00E9) -->\r\n<ng-template #buttonTemplate>\r\n @if (!isDropdown) {\r\n @if (link != null) {\r\n <a class=\"btn\" [class]=\"'btn-' + type + ' ' + cssClass\" [ngClass]=\"getButtonClasses()\"\r\n [class.disabled]=\"isDisabled\"\r\n [routerLink]=\"isDisabled ? null : link\"\r\n [attr.aria-disabled]=\"isDisabled ? 'true' : null\"\r\n [attr.tabindex]=\"isDisabled ? -1 : null\"\r\n [attr.data-test-ctw]=\"dataTest\"\r\n [attr.aria-describedby]=\"withTooltip && isTooltipOpened ? 'ctw-tooltip-' + tooltipRandomId : null\"\r\n (click)=\"onLinkClick($event); withTooltip && tooltipTrigger === 'click' ? showTooltip() : null\"\r\n (mouseenter)=\"withTooltip && tooltipTrigger === 'hover' ? showTooltip() : null\"\r\n (mouseleave)=\"withTooltip && tooltipTrigger === 'hover' ? hideTooltip() : null\">\r\n\r\n <ng-container *ngTemplateOutlet=\"buttonContent\"></ng-container>\r\n </a>\r\n } @else {\r\n <button type=\"button\" class=\"btn\" [class]=\"'btn-' + type + ' ' + cssClass\" [ngClass]=\"getButtonClasses()\"\r\n [disabled]=\"isDisabled\" (click)=\"onBtnAction()\" [attr.data-test-ctw]=\"dataTest\"\r\n [attr.aria-describedby]=\"withTooltip && isTooltipOpened ? 'ctw-tooltip-' + tooltipRandomId : null\"\r\n (mouseenter)=\"withTooltip && tooltipTrigger === 'hover' ? showTooltip() : null\"\r\n (mouseleave)=\"withTooltip && tooltipTrigger === 'hover' ? hideTooltip() : null\"\r\n (click)=\"withTooltip && tooltipTrigger === 'click' ? showTooltip() : null\">\r\n\r\n @if (isLoading) {\r\n <span class=\"spinner-border spinner-border-sm\" aria-hidden=\"true\"></span>\r\n <span class=\"visually-hidden\" role=\"status\">{{ '_COMMON._HTTP.TXT_LOADING' | translate }}</span>\r\n }\r\n\r\n <ng-container *ngTemplateOutlet=\"buttonContent\"></ng-container>\r\n </button>\r\n }\r\n }\r\n @else {\r\n <div (clickOutside)=\"onClickOutside()\" ctwClickOutside #dropdown class=\"dropdown d-inline-block\">\r\n <button class=\"btn\" [class]=\"'btn-' + type + ' ' + cssClass\" type=\"button\"\r\n [ngClass]=\"getButtonClasses()\"\r\n [disabled]=\"isDisabled\" [id]=\"id\" aria-expanded=\"false\" (click)=\"toggleDropdown()\" #dropdownToggle\r\n [attr.data-test-ctw]=\"dataTest\"\r\n [attr.aria-describedby]=\"withTooltip && isTooltipOpened ? 'ctw-tooltip-' + tooltipRandomId : null\"\r\n (mouseenter)=\"withTooltip && tooltipTrigger === 'hover' ? showTooltip() : null\"\r\n (mouseleave)=\"withTooltip && tooltipTrigger === 'hover' ? hideTooltip() : null\">\r\n\r\n <ng-container *ngTemplateOutlet=\"buttonContent\"></ng-container>\r\n\r\n @if(!hideCaret) {\r\n <cw-icon [icon]=\"spriteIcon.down\" [iconSize]=\"iconSizeEnum['2xs']\" class=\"dropdown-icon\"></cw-icon>\r\n }\r\n </button>\r\n\r\n <div [attr.aria-labelledby]=\"id\" class=\"dropdown-menu\" [ngClass]=\"placementCss\" #dropdownMenu>\r\n <ng-content></ng-content>\r\n </div>\r\n </div>\r\n }\r\n</ng-template>\r\n\r\n<!-- Template existant du contenu du bouton -->\r\n<ng-template #buttonContent>\r\n @if (withIcon && iconPosition === buttonPositionEnum.left) {\r\n <ng-container *ngTemplateOutlet=\"iconContent\"></ng-container>\r\n }\r\n\r\n @if(withOnlyIcon) {\r\n <span class=\"visually-hidden\">{{label | translate }}</span>\r\n }\r\n @else {\r\n {{ label | translate }}\r\n }\r\n\r\n @if (withIcon && iconPosition === buttonPositionEnum.right) {\r\n <ng-container *ngTemplateOutlet=\"iconContent\"></ng-container>\r\n }\r\n</ng-template>\r\n\r\n<ng-template #iconContent>\r\n @if(withOnlyIcon) {\r\n @switch(iconSize) {\r\n @case(buttonIconSizeEnum.xsmall) {\r\n <cw-icon [icon]=\"withIcon\" [iconSize]=\"iconSizeEnum['xs']\"></cw-icon>\r\n }\r\n @case(buttonIconSizeEnum.small) {\r\n <cw-icon [icon]=\"withIcon\" [iconSize]=\"iconSizeEnum['xs']\"></cw-icon>\r\n }\r\n @default {\r\n <cw-icon [icon]=\"withIcon\" [iconSize]=\"iconSizeEnum['sm']\"></cw-icon>\r\n }\r\n }\r\n }\r\n @else {\r\n <cw-icon [icon]=\"withIcon\" [iconSize]=\"iconSizeEnum['sm']\"></cw-icon>\r\n }\r\n</ng-template>\r\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: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom", "spritePath"] }, { kind: "directive", type: ClickOutsideDirective, selector: "[clickOutside]", outputs: ["clickOutside"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
|
|
1525
1547
|
}
|
|
1526
1548
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: ButtonComponent, decorators: [{
|
|
1527
1549
|
type: Component,
|
|
@@ -1529,16 +1551,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImpo
|
|
|
1529
1551
|
CommonModule,
|
|
1530
1552
|
TranslateModule,
|
|
1531
1553
|
IconComponent,
|
|
1532
|
-
ClickOutsideDirective
|
|
1533
|
-
|
|
1554
|
+
ClickOutsideDirective,
|
|
1555
|
+
RouterLink
|
|
1556
|
+
], template: "<!-- Wrapper pour le tooltip -->\r\n@if (withTooltip) {\r\n <div class=\"d-inline-block p-relative\" (clickOutside)=\"onTooltipClickOutside()\" ctwClickOutside>\r\n\r\n <ng-container *ngTemplateOutlet=\"buttonTemplate\"></ng-container>\r\n\r\n <!-- Tooltip/Popover -->\r\n @if (isTooltipOpened) {\r\n <div role=\"tooltip\" [id]=\"'ctw-tooltip-' + tooltipRandomId\" [ngClass]=\"tooltipType + ' fade show ' + tooltipType + '-' + tooltipPosition\">\r\n <div class=\"arrow\"></div>\r\n @if (tooltipTitle) {\r\n <div [ngClass]=\"(tooltipType === typeTooltipEnum.popover ? 'popover' : 'tooltip') + '-header'\"\r\n [innerHTML]=\"tooltipTitle | translate\"></div>\r\n }\r\n <div [ngClass]=\"tooltipType + '-body'\"\r\n [innerHTML]=\"tooltipText | translate\"></div>\r\n </div>\r\n }\r\n </div>\r\n}\r\n@else {\r\n <ng-container *ngTemplateOutlet=\"buttonTemplate\"></ng-container>\r\n}\r\n\r\n<!-- Template du bouton (code existant envelopp\u00E9) -->\r\n<ng-template #buttonTemplate>\r\n @if (!isDropdown) {\r\n @if (link != null) {\r\n <a class=\"btn\" [class]=\"'btn-' + type + ' ' + cssClass\" [ngClass]=\"getButtonClasses()\"\r\n [class.disabled]=\"isDisabled\"\r\n [routerLink]=\"isDisabled ? null : link\"\r\n [attr.aria-disabled]=\"isDisabled ? 'true' : null\"\r\n [attr.tabindex]=\"isDisabled ? -1 : null\"\r\n [attr.data-test-ctw]=\"dataTest\"\r\n [attr.aria-describedby]=\"withTooltip && isTooltipOpened ? 'ctw-tooltip-' + tooltipRandomId : null\"\r\n (click)=\"onLinkClick($event); withTooltip && tooltipTrigger === 'click' ? showTooltip() : null\"\r\n (mouseenter)=\"withTooltip && tooltipTrigger === 'hover' ? showTooltip() : null\"\r\n (mouseleave)=\"withTooltip && tooltipTrigger === 'hover' ? hideTooltip() : null\">\r\n\r\n <ng-container *ngTemplateOutlet=\"buttonContent\"></ng-container>\r\n </a>\r\n } @else {\r\n <button type=\"button\" class=\"btn\" [class]=\"'btn-' + type + ' ' + cssClass\" [ngClass]=\"getButtonClasses()\"\r\n [disabled]=\"isDisabled\" (click)=\"onBtnAction()\" [attr.data-test-ctw]=\"dataTest\"\r\n [attr.aria-describedby]=\"withTooltip && isTooltipOpened ? 'ctw-tooltip-' + tooltipRandomId : null\"\r\n (mouseenter)=\"withTooltip && tooltipTrigger === 'hover' ? showTooltip() : null\"\r\n (mouseleave)=\"withTooltip && tooltipTrigger === 'hover' ? hideTooltip() : null\"\r\n (click)=\"withTooltip && tooltipTrigger === 'click' ? showTooltip() : null\">\r\n\r\n @if (isLoading) {\r\n <span class=\"spinner-border spinner-border-sm\" aria-hidden=\"true\"></span>\r\n <span class=\"visually-hidden\" role=\"status\">{{ '_COMMON._HTTP.TXT_LOADING' | translate }}</span>\r\n }\r\n\r\n <ng-container *ngTemplateOutlet=\"buttonContent\"></ng-container>\r\n </button>\r\n }\r\n }\r\n @else {\r\n <div (clickOutside)=\"onClickOutside()\" ctwClickOutside #dropdown class=\"dropdown d-inline-block\">\r\n <button class=\"btn\" [class]=\"'btn-' + type + ' ' + cssClass\" type=\"button\"\r\n [ngClass]=\"getButtonClasses()\"\r\n [disabled]=\"isDisabled\" [id]=\"id\" aria-expanded=\"false\" (click)=\"toggleDropdown()\" #dropdownToggle\r\n [attr.data-test-ctw]=\"dataTest\"\r\n [attr.aria-describedby]=\"withTooltip && isTooltipOpened ? 'ctw-tooltip-' + tooltipRandomId : null\"\r\n (mouseenter)=\"withTooltip && tooltipTrigger === 'hover' ? showTooltip() : null\"\r\n (mouseleave)=\"withTooltip && tooltipTrigger === 'hover' ? hideTooltip() : null\">\r\n\r\n <ng-container *ngTemplateOutlet=\"buttonContent\"></ng-container>\r\n\r\n @if(!hideCaret) {\r\n <cw-icon [icon]=\"spriteIcon.down\" [iconSize]=\"iconSizeEnum['2xs']\" class=\"dropdown-icon\"></cw-icon>\r\n }\r\n </button>\r\n\r\n <div [attr.aria-labelledby]=\"id\" class=\"dropdown-menu\" [ngClass]=\"placementCss\" #dropdownMenu>\r\n <ng-content></ng-content>\r\n </div>\r\n </div>\r\n }\r\n</ng-template>\r\n\r\n<!-- Template existant du contenu du bouton -->\r\n<ng-template #buttonContent>\r\n @if (withIcon && iconPosition === buttonPositionEnum.left) {\r\n <ng-container *ngTemplateOutlet=\"iconContent\"></ng-container>\r\n }\r\n\r\n @if(withOnlyIcon) {\r\n <span class=\"visually-hidden\">{{label | translate }}</span>\r\n }\r\n @else {\r\n {{ label | translate }}\r\n }\r\n\r\n @if (withIcon && iconPosition === buttonPositionEnum.right) {\r\n <ng-container *ngTemplateOutlet=\"iconContent\"></ng-container>\r\n }\r\n</ng-template>\r\n\r\n<ng-template #iconContent>\r\n @if(withOnlyIcon) {\r\n @switch(iconSize) {\r\n @case(buttonIconSizeEnum.xsmall) {\r\n <cw-icon [icon]=\"withIcon\" [iconSize]=\"iconSizeEnum['xs']\"></cw-icon>\r\n }\r\n @case(buttonIconSizeEnum.small) {\r\n <cw-icon [icon]=\"withIcon\" [iconSize]=\"iconSizeEnum['xs']\"></cw-icon>\r\n }\r\n @default {\r\n <cw-icon [icon]=\"withIcon\" [iconSize]=\"iconSizeEnum['sm']\"></cw-icon>\r\n }\r\n }\r\n }\r\n @else {\r\n <cw-icon [icon]=\"withIcon\" [iconSize]=\"iconSizeEnum['sm']\"></cw-icon>\r\n }\r\n</ng-template>\r\n" }]
|
|
1534
1557
|
}], ctorParameters: () => [], propDecorators: { type: [{
|
|
1535
1558
|
type: Input
|
|
1536
1559
|
}], label: [{
|
|
1537
1560
|
type: Input
|
|
1538
1561
|
}], id: [{
|
|
1539
1562
|
type: Input
|
|
1563
|
+
}], link: [{
|
|
1564
|
+
type: Input
|
|
1540
1565
|
}], isDropdown: [{
|
|
1541
1566
|
type: Input
|
|
1567
|
+
}], hideCaret: [{
|
|
1568
|
+
type: Input
|
|
1542
1569
|
}], withIcon: [{
|
|
1543
1570
|
type: Input
|
|
1544
1571
|
}], withOnlyIcon: [{
|
|
@@ -1679,61 +1706,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImpo
|
|
|
1679
1706
|
args: ['dropdownToggle']
|
|
1680
1707
|
}] } });
|
|
1681
1708
|
|
|
1682
|
-
class ShowHidePasswordDirective {
|
|
1683
|
-
constructor(el, renderer, translateService) {
|
|
1684
|
-
this.el = el;
|
|
1685
|
-
this.renderer = renderer;
|
|
1686
|
-
this.translateService = translateService;
|
|
1687
|
-
this.isShown = false;
|
|
1688
|
-
}
|
|
1689
|
-
ngOnInit() {
|
|
1690
|
-
this.setup();
|
|
1691
|
-
}
|
|
1692
|
-
setup() {
|
|
1693
|
-
const div = this.renderer.createElement('div');
|
|
1694
|
-
this.renderer.insertBefore(this.el.nativeElement.parentNode, div, this.el.nativeElement);
|
|
1695
|
-
this.renderer.appendChild(div, this.el.nativeElement);
|
|
1696
|
-
this.renderer.addClass(div, 'see-password-container');
|
|
1697
|
-
const button = this.renderer.createElement('button');
|
|
1698
|
-
this.renderer.appendChild(this.el.nativeElement.parentNode, button);
|
|
1699
|
-
this.renderer.addClass(button, 'btn');
|
|
1700
|
-
this.renderer.setAttribute(button, 'type', 'button');
|
|
1701
|
-
this.renderer.addClass(button, 'optyweb');
|
|
1702
|
-
this.renderer.addClass(button, 'cw-hide-map');
|
|
1703
|
-
this.renderer.addClass(button, 'py-2');
|
|
1704
|
-
this.renderer.addClass(button, 'see-password');
|
|
1705
|
-
const srOnly = this.renderer.createElement('span');
|
|
1706
|
-
this.renderer.appendChild(button, srOnly);
|
|
1707
|
-
this.renderer.addClass(srOnly, 'visually-hidden');
|
|
1708
|
-
this.renderer.setProperty(srOnly, 'innerHTML', this.translateService.instant('_COMMON._FORM._SHOW_HIDE_PWD.SHOW'));
|
|
1709
|
-
this.renderer.listen(button, 'click', (event) => {
|
|
1710
|
-
this.isShown = !this.isShown;
|
|
1711
|
-
if (this.isShown) {
|
|
1712
|
-
this.el.nativeElement.setAttribute('type', 'text');
|
|
1713
|
-
this.renderer.removeClass(button, 'cw-hide-map');
|
|
1714
|
-
this.renderer.addClass(button, 'cw-show-map');
|
|
1715
|
-
this.renderer.setProperty(srOnly, 'innerHTML', this.translateService.instant('_COMMON._FORM._SHOW_HIDE_PWD.HIDE'));
|
|
1716
|
-
}
|
|
1717
|
-
else {
|
|
1718
|
-
this.el.nativeElement.setAttribute('type', 'password');
|
|
1719
|
-
this.renderer.addClass(button, 'cw-hide-map');
|
|
1720
|
-
this.renderer.removeClass(button, 'cw-show-map');
|
|
1721
|
-
this.renderer.setProperty(srOnly, 'innerHTML', this.translateService.instant('_COMMON._FORM._SHOW_HIDE_PWD.SHOW'));
|
|
1722
|
-
}
|
|
1723
|
-
});
|
|
1724
|
-
}
|
|
1725
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: ShowHidePasswordDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i2.TranslateService }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1726
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.20", type: ShowHidePasswordDirective, isStandalone: true, selector: "[showHidePassword]", ngImport: i0 }); }
|
|
1727
|
-
}
|
|
1728
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: ShowHidePasswordDirective, decorators: [{
|
|
1729
|
-
type: Directive,
|
|
1730
|
-
args: [{
|
|
1731
|
-
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
1732
|
-
selector: '[showHidePassword]',
|
|
1733
|
-
standalone: true
|
|
1734
|
-
}]
|
|
1735
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i2.TranslateService }] });
|
|
1736
|
-
|
|
1737
1709
|
var FormFieldTypeEnum;
|
|
1738
1710
|
(function (FormFieldTypeEnum) {
|
|
1739
1711
|
FormFieldTypeEnum["text"] = "text";
|
|
@@ -1766,8 +1738,742 @@ var FormFieldTypeEnum;
|
|
|
1766
1738
|
FormFieldTypeEnum["dateComplexe"] = "dateComplexe";
|
|
1767
1739
|
FormFieldTypeEnum["dateTimeToDateTime"] = "dateTimeToDateTime";
|
|
1768
1740
|
FormFieldTypeEnum["timeToTime"] = "timeToTime";
|
|
1741
|
+
FormFieldTypeEnum["zipCode"] = "zipCode";
|
|
1742
|
+
FormFieldTypeEnum["phone"] = "phone";
|
|
1743
|
+
FormFieldTypeEnum["autocomplete"] = "autocomplete";
|
|
1744
|
+
FormFieldTypeEnum["autocompleteMultiple"] = "autocompleteMultiple";
|
|
1769
1745
|
})(FormFieldTypeEnum || (FormFieldTypeEnum = {}));
|
|
1770
1746
|
|
|
1747
|
+
/**
|
|
1748
|
+
* Logique clavier W3C grid-combo, isolée en fonctions pures pour testabilité.
|
|
1749
|
+
*
|
|
1750
|
+
* Pattern : https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/grid-combo/
|
|
1751
|
+
*
|
|
1752
|
+
* Le focus DOM reste toujours sur l'input combobox. La navigation dans la grille
|
|
1753
|
+
* est virtuelle, via `aria-activedescendant`. Toutes les touches sont reçues sur
|
|
1754
|
+
* l'input ; ces helpers décident des actions à appliquer en fonction de l'état.
|
|
1755
|
+
*
|
|
1756
|
+
* Conventions sur `activeRow` :
|
|
1757
|
+
* -1 : aucune ligne focalisée
|
|
1758
|
+
* -2 : ligne master (mode multi uniquement — sélection en masse)
|
|
1759
|
+
* >=0 : index dans `items[]`
|
|
1760
|
+
*/
|
|
1761
|
+
/** Constante pour identifier la ligne master (mode multi). */
|
|
1762
|
+
const MASTER_ROW = -2;
|
|
1763
|
+
/**
|
|
1764
|
+
* Décide quoi faire quand une touche est pressée sur l'input combobox.
|
|
1765
|
+
* Appelle `event.preventDefault()` quand l'action interceptée empêche
|
|
1766
|
+
* le comportement natif (navigation, édition).
|
|
1767
|
+
*/
|
|
1768
|
+
function handleComboboxKey(event, state) {
|
|
1769
|
+
const { isOpen, itemsCount, totalCols, activeRow, activeCol, multi } = state;
|
|
1770
|
+
switch (event.key) {
|
|
1771
|
+
case 'ArrowDown': {
|
|
1772
|
+
event.preventDefault();
|
|
1773
|
+
if (!isOpen) {
|
|
1774
|
+
// Ouvre la grille. En multi, on commence par la master pour exposer le toggle global.
|
|
1775
|
+
const firstRow = multi ? MASTER_ROW : 0;
|
|
1776
|
+
return [{ type: 'open' }, { type: 'setActive', row: firstRow, col: 0 }];
|
|
1777
|
+
}
|
|
1778
|
+
if (itemsCount === 0)
|
|
1779
|
+
return [{ type: 'noop' }];
|
|
1780
|
+
// Master → première row réelle
|
|
1781
|
+
if (multi && activeRow === MASTER_ROW) {
|
|
1782
|
+
return [{ type: 'setActive', row: 0, col: activeCol }];
|
|
1783
|
+
}
|
|
1784
|
+
// Dernière row → master (en multi) ou wrap top
|
|
1785
|
+
if (activeRow + 1 >= itemsCount) {
|
|
1786
|
+
return [{ type: 'setActive', row: multi ? MASTER_ROW : 0, col: activeCol }];
|
|
1787
|
+
}
|
|
1788
|
+
return [{ type: 'setActive', row: activeRow + 1, col: activeCol }];
|
|
1789
|
+
}
|
|
1790
|
+
case 'ArrowUp': {
|
|
1791
|
+
event.preventDefault();
|
|
1792
|
+
if (!isOpen) {
|
|
1793
|
+
const lastRow = itemsCount > 0 ? itemsCount - 1 : (multi ? MASTER_ROW : -1);
|
|
1794
|
+
return [
|
|
1795
|
+
{ type: 'open' },
|
|
1796
|
+
{ type: 'setActive', row: Math.max(MASTER_ROW, lastRow), col: 0 },
|
|
1797
|
+
];
|
|
1798
|
+
}
|
|
1799
|
+
if (itemsCount === 0 && !multi)
|
|
1800
|
+
return [{ type: 'noop' }];
|
|
1801
|
+
// Master → dernière row (wrap)
|
|
1802
|
+
if (multi && activeRow === MASTER_ROW) {
|
|
1803
|
+
return [{ type: 'setActive', row: itemsCount - 1, col: activeCol }];
|
|
1804
|
+
}
|
|
1805
|
+
// Row 0 → master (en multi) ou wrap fin
|
|
1806
|
+
if (activeRow - 1 < 0) {
|
|
1807
|
+
return [{ type: 'setActive', row: multi ? MASTER_ROW : itemsCount - 1, col: activeCol }];
|
|
1808
|
+
}
|
|
1809
|
+
return [{ type: 'setActive', row: activeRow - 1, col: activeCol }];
|
|
1810
|
+
}
|
|
1811
|
+
case 'ArrowRight': {
|
|
1812
|
+
// W3C : navigation 2D dans la grille quand popup ouverte.
|
|
1813
|
+
// Si grille fermée, master row, aucune ligne active, ou < 2 colonnes : édition native.
|
|
1814
|
+
if (!isOpen || activeRow < 0 || totalCols <= 1)
|
|
1815
|
+
return [{ type: 'noop' }];
|
|
1816
|
+
event.preventDefault();
|
|
1817
|
+
let nextCol = activeCol + 1;
|
|
1818
|
+
let nextRow = activeRow;
|
|
1819
|
+
if (nextCol >= totalCols) {
|
|
1820
|
+
nextCol = 0;
|
|
1821
|
+
nextRow = (nextRow + 1) % itemsCount;
|
|
1822
|
+
}
|
|
1823
|
+
return [{ type: 'setActive', row: nextRow, col: nextCol }];
|
|
1824
|
+
}
|
|
1825
|
+
case 'ArrowLeft': {
|
|
1826
|
+
if (!isOpen || activeRow < 0 || totalCols <= 1)
|
|
1827
|
+
return [{ type: 'noop' }];
|
|
1828
|
+
event.preventDefault();
|
|
1829
|
+
let nextCol = activeCol - 1;
|
|
1830
|
+
let nextRow = activeRow;
|
|
1831
|
+
if (nextCol < 0) {
|
|
1832
|
+
nextCol = totalCols - 1;
|
|
1833
|
+
nextRow = nextRow - 1 < 0 ? itemsCount - 1 : nextRow - 1;
|
|
1834
|
+
}
|
|
1835
|
+
return [{ type: 'setActive', row: nextRow, col: nextCol }];
|
|
1836
|
+
}
|
|
1837
|
+
case 'Enter': {
|
|
1838
|
+
if (!isOpen)
|
|
1839
|
+
return [{ type: 'noop' }];
|
|
1840
|
+
if (multi) {
|
|
1841
|
+
if (activeRow === MASTER_ROW) {
|
|
1842
|
+
event.preventDefault();
|
|
1843
|
+
return [{ type: 'toggleMaster' }];
|
|
1844
|
+
}
|
|
1845
|
+
if (activeRow >= 0 && activeRow < itemsCount) {
|
|
1846
|
+
event.preventDefault();
|
|
1847
|
+
return [{ type: 'toggle', row: activeRow }];
|
|
1848
|
+
}
|
|
1849
|
+
return [{ type: 'noop' }];
|
|
1850
|
+
}
|
|
1851
|
+
if (activeRow >= 0 && activeRow < itemsCount) {
|
|
1852
|
+
event.preventDefault();
|
|
1853
|
+
return [{ type: 'select', row: activeRow }];
|
|
1854
|
+
}
|
|
1855
|
+
return [{ type: 'noop' }];
|
|
1856
|
+
}
|
|
1857
|
+
case ' ': {
|
|
1858
|
+
// Space dans l'input = caractère par défaut. En multi, si une ligne est focalisée,
|
|
1859
|
+
// c'est un toggle (sinon on insère un espace dans la recherche, comportement natif).
|
|
1860
|
+
if (!multi || !isOpen)
|
|
1861
|
+
return [{ type: 'noop' }];
|
|
1862
|
+
if (activeRow === MASTER_ROW) {
|
|
1863
|
+
event.preventDefault();
|
|
1864
|
+
return [{ type: 'toggleMaster' }];
|
|
1865
|
+
}
|
|
1866
|
+
if (activeRow >= 0 && activeRow < itemsCount) {
|
|
1867
|
+
event.preventDefault();
|
|
1868
|
+
return [{ type: 'toggle', row: activeRow }];
|
|
1869
|
+
}
|
|
1870
|
+
return [{ type: 'noop' }];
|
|
1871
|
+
}
|
|
1872
|
+
case 'Escape': {
|
|
1873
|
+
if (isOpen) {
|
|
1874
|
+
event.preventDefault();
|
|
1875
|
+
return [{ type: 'close' }];
|
|
1876
|
+
}
|
|
1877
|
+
// W3C : Esc avec popup fermée vide le champ
|
|
1878
|
+
return [{ type: 'clearInput' }];
|
|
1879
|
+
}
|
|
1880
|
+
case 'Home':
|
|
1881
|
+
case 'End': {
|
|
1882
|
+
// W3C : Home/End ramène le focus dans l'input + position curseur natif.
|
|
1883
|
+
// Comme le focus est déjà sur l'input, on ferme juste la grille
|
|
1884
|
+
// et on laisse le caret se déplacer naturellement (pas de preventDefault).
|
|
1885
|
+
if (isOpen)
|
|
1886
|
+
return [{ type: 'close' }];
|
|
1887
|
+
return [{ type: 'noop' }];
|
|
1888
|
+
}
|
|
1889
|
+
case 'Tab': {
|
|
1890
|
+
// Laisser le Tab natif sortir du champ. On ferme juste la grille.
|
|
1891
|
+
if (isOpen)
|
|
1892
|
+
return [{ type: 'close' }];
|
|
1893
|
+
return [{ type: 'noop' }];
|
|
1894
|
+
}
|
|
1895
|
+
default:
|
|
1896
|
+
return [{ type: 'noop' }];
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
class AutocompleteComponent {
|
|
1901
|
+
constructor() {
|
|
1902
|
+
this.destroyRef = inject(DestroyRef);
|
|
1903
|
+
// ---------- Required ----------
|
|
1904
|
+
/** FormControl piloté par le parent. Stocke la `valueField` sélectionnée (mono) ou un tableau (multi). */
|
|
1905
|
+
this.control = input.required(...(ngDevMode ? [{ debugName: "control" }] : []));
|
|
1906
|
+
/** Fonction de recherche : reçoit le terme, renvoie un Observable de résultats. */
|
|
1907
|
+
this.fetcher = input.required(...(ngDevMode ? [{ debugName: "fetcher" }] : []));
|
|
1908
|
+
// ---------- Display config ----------
|
|
1909
|
+
/** Clé de l'item utilisée pour l'affichage dans l'input et dans la 1ère colonne de la grille. */
|
|
1910
|
+
this.displayField = input('label', ...(ngDevMode ? [{ debugName: "displayField" }] : []));
|
|
1911
|
+
/** Clé de l'item utilisée pour la valeur stockée dans le FormControl. */
|
|
1912
|
+
this.valueField = input('id', ...(ngDevMode ? [{ debugName: "valueField" }] : []));
|
|
1913
|
+
/** Colonnes additionnelles (au-delà de la colonne 1 qui contient toujours displayField). */
|
|
1914
|
+
this.columns = input([], ...(ngDevMode ? [{ debugName: "columns" }] : []));
|
|
1915
|
+
// ---------- Behavior ----------
|
|
1916
|
+
/** Active la multi-sélection (impl. à l'étape 4). */
|
|
1917
|
+
this.multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple" }] : []));
|
|
1918
|
+
/** Nombre minimum de caractères avant déclenchement du fetcher. */
|
|
1919
|
+
this.minChars = input(2, ...(ngDevMode ? [{ debugName: "minChars" }] : []));
|
|
1920
|
+
/** Délai d'inactivité (ms) avant déclenchement du fetcher après la frappe. */
|
|
1921
|
+
this.debounceMs = input(250, ...(ngDevMode ? [{ debugName: "debounceMs" }] : []));
|
|
1922
|
+
// ---------- Pre-fill ----------
|
|
1923
|
+
/**
|
|
1924
|
+
* Objet sélectionné initial (mono). Si fourni, le composant l'utilise
|
|
1925
|
+
* directement pour afficher le `displayField`. Réactif : si le parent
|
|
1926
|
+
* pousse l'objet plus tard, l'affichage se met à jour automatiquement
|
|
1927
|
+
* (sauf si une frappe utilisateur est en cours).
|
|
1928
|
+
*/
|
|
1929
|
+
this.selectedItem = input(null, ...(ngDevMode ? [{ debugName: "selectedItem" }] : []));
|
|
1930
|
+
/**
|
|
1931
|
+
* Resolver optionnel : si seul la `valueField` est connue (ex. FormControl
|
|
1932
|
+
* initialisé avec un id depuis un store), le composant appelle ce resolver
|
|
1933
|
+
* pour récupérer l'item complet et afficher le bon `displayField`.
|
|
1934
|
+
* Non appelé si `selectedItem` est déjà fourni.
|
|
1935
|
+
*/
|
|
1936
|
+
this.resolver = input(null, ...(ngDevMode ? [{ debugName: "resolver" }] : []));
|
|
1937
|
+
/** Objets sélectionnés initiaux (multi) — impl. à l'étape 4. */
|
|
1938
|
+
this.selectedItems = input([], ...(ngDevMode ? [{ debugName: "selectedItems" }] : []));
|
|
1939
|
+
// ---------- Standard form-field ----------
|
|
1940
|
+
// Le label visible et l'astérisque required sont rendus par le parent
|
|
1941
|
+
// (cw-form-field). cw-autocomplete ne porte que la sémantique du champ lui-même.
|
|
1942
|
+
this.placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
1943
|
+
this.id = input('', ...(ngDevMode ? [{ debugName: "id" }] : []));
|
|
1944
|
+
/** Pose `aria-required="true"` sur le combobox. L'astérisque visible relève du parent. */
|
|
1945
|
+
this.isRequired = input(false, ...(ngDevMode ? [{ debugName: "isRequired" }] : []));
|
|
1946
|
+
this.isReadonly = input(false, ...(ngDevMode ? [{ debugName: "isReadonly" }] : []));
|
|
1947
|
+
this.isDisabled = input(false, ...(ngDevMode ? [{ debugName: "isDisabled" }] : []));
|
|
1948
|
+
/**
|
|
1949
|
+
* Reflète `aria-invalid` sur l'input combobox. Typiquement piloté par form-field
|
|
1950
|
+
* via `control.invalid && control.touched`.
|
|
1951
|
+
*/
|
|
1952
|
+
this.ariaInvalid = input(false, ...(ngDevMode ? [{ debugName: "ariaInvalid" }] : []));
|
|
1953
|
+
/**
|
|
1954
|
+
* Reflète `aria-describedby` sur l'input combobox. Typiquement piloté par form-field
|
|
1955
|
+
* pour pointer ses div d'erreur / d'aide (`error-{name}`, `{name}-help`).
|
|
1956
|
+
*/
|
|
1957
|
+
this.ariaDescribedBy = input(null, ...(ngDevMode ? [{ debugName: "ariaDescribedBy" }] : []));
|
|
1958
|
+
// ---------- Outputs ----------
|
|
1959
|
+
this.itemSelected = output();
|
|
1960
|
+
this.itemsChange = output();
|
|
1961
|
+
// ---------- View refs ----------
|
|
1962
|
+
this.gridEl = viewChild('gridEl', ...(ngDevMode ? [{ debugName: "gridEl" }] : []));
|
|
1963
|
+
this.masterCheckbox = viewChild('masterCheckbox', ...(ngDevMode ? [{ debugName: "masterCheckbox" }] : []));
|
|
1964
|
+
/** Exposé au template pour comparer activeRow() à la sentinelle master. */
|
|
1965
|
+
this.MASTER_ROW = MASTER_ROW;
|
|
1966
|
+
// ---------- Internal state ----------
|
|
1967
|
+
/** FormControl interne lié à l'input HTML — porte le texte tapé, pas la valueField. */
|
|
1968
|
+
this.searchInput = new FormControl('', { nonNullable: true });
|
|
1969
|
+
/** Signal miroir de searchInput.value pour réactivité dans les computed. */
|
|
1970
|
+
this.term = signal('', ...(ngDevMode ? [{ debugName: "term" }] : []));
|
|
1971
|
+
this.isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
1972
|
+
this.loading = signal(false, ...(ngDevMode ? [{ debugName: "loading" }] : []));
|
|
1973
|
+
this.items = signal([], ...(ngDevMode ? [{ debugName: "items" }] : []));
|
|
1974
|
+
this.activeRow = signal(-1, ...(ngDevMode ? [{ debugName: "activeRow" }] : []));
|
|
1975
|
+
this.activeCol = signal(0, ...(ngDevMode ? [{ debugName: "activeCol" }] : []));
|
|
1976
|
+
/** Dernier item sélectionné (mono), pour restaurer l'affichage si l'utilisateur quitte sans valider. */
|
|
1977
|
+
this.lastSelected = null;
|
|
1978
|
+
/** État interne de la multi-sélection (liste cumulative à travers les recherches). */
|
|
1979
|
+
this.selectedItemsState = signal([], ...(ngDevMode ? [{ debugName: "selectedItemsState" }] : []));
|
|
1980
|
+
/** Id stable utilisé pour préfixer les ids ARIA (combobox, grid, cells). */
|
|
1981
|
+
this._randomId = Math.floor(Math.random() * 1_000_000);
|
|
1982
|
+
/** Devient true après le passage de ngOnInit — les effects ignorent les runs avant ça. */
|
|
1983
|
+
this._initialized = signal(false, ...(ngDevMode ? [{ debugName: "_initialized" }] : []));
|
|
1984
|
+
// ---------- Computed ----------
|
|
1985
|
+
this.resolvedId = computed(() => this.id() || `cw-ac-${this._randomId}`, ...(ngDevMode ? [{ debugName: "resolvedId" }] : []));
|
|
1986
|
+
this.gridId = computed(() => `${this.resolvedId()}-grid`, ...(ngDevMode ? [{ debugName: "gridId" }] : []));
|
|
1987
|
+
this.liveId = computed(() => `${this.resolvedId()}-live`, ...(ngDevMode ? [{ debugName: "liveId" }] : []));
|
|
1988
|
+
this.totalCols = computed(() => 1 + this.columns().length, ...(ngDevMode ? [{ debugName: "totalCols" }] : []));
|
|
1989
|
+
this.showGrid = computed(() => this.isOpen() && this.items().length > 0, ...(ngDevMode ? [{ debugName: "showGrid" }] : []));
|
|
1990
|
+
this.showNoResult = computed(() => this.isOpen() &&
|
|
1991
|
+
!this.loading() &&
|
|
1992
|
+
this.items().length === 0 &&
|
|
1993
|
+
this.term().length >= this.minChars(), ...(ngDevMode ? [{ debugName: "showNoResult" }] : []));
|
|
1994
|
+
/** Id de la cellule active courante (alimente aria-activedescendant). */
|
|
1995
|
+
this.activeDescendant = computed(() => {
|
|
1996
|
+
if (!this.isOpen())
|
|
1997
|
+
return null;
|
|
1998
|
+
const row = this.activeRow();
|
|
1999
|
+
if (row === MASTER_ROW)
|
|
2000
|
+
return this.masterCellId();
|
|
2001
|
+
if (row < 0)
|
|
2002
|
+
return null;
|
|
2003
|
+
return this.cellId(row, this.activeCol());
|
|
2004
|
+
}, ...(ngDevMode ? [{ debugName: "activeDescendant" }] : []));
|
|
2005
|
+
/**
|
|
2006
|
+
* Items visibles éligibles au master (exclut les `disabled` qui ne sont jamais
|
|
2007
|
+
* cochables/décochables via select-all).
|
|
2008
|
+
*/
|
|
2009
|
+
this.selectableItems = computed(() => this.items().filter((it) => !this.isItemDisabled(it)), ...(ngDevMode ? [{ debugName: "selectableItems" }] : []));
|
|
2010
|
+
/** Combien d'items affichés (hors disabled) sont sélectionnés. Sert au master state. */
|
|
2011
|
+
this.currentSelectedCount = computed(() => {
|
|
2012
|
+
const sel = this.selectedItemsState();
|
|
2013
|
+
const val = this.valueField();
|
|
2014
|
+
return this.selectableItems().filter((it) => sel.some((s) => s[val] === it[val])).length;
|
|
2015
|
+
}, ...(ngDevMode ? [{ debugName: "currentSelectedCount" }] : []));
|
|
2016
|
+
/** État de la case master : 'unchecked' | 'indeterminate' | 'checked'. */
|
|
2017
|
+
this.masterState = computed(() => {
|
|
2018
|
+
const total = this.selectableItems().length;
|
|
2019
|
+
const sel = this.currentSelectedCount();
|
|
2020
|
+
if (total === 0)
|
|
2021
|
+
return 'unchecked';
|
|
2022
|
+
if (sel === 0)
|
|
2023
|
+
return 'unchecked';
|
|
2024
|
+
if (sel === total)
|
|
2025
|
+
return 'checked';
|
|
2026
|
+
return 'indeterminate';
|
|
2027
|
+
}, ...(ngDevMode ? [{ debugName: "masterState" }] : []));
|
|
2028
|
+
/**
|
|
2029
|
+
* Indique s'il y a quelque chose à vider via un bouton clear externe.
|
|
2030
|
+
* Mono : texte tapé OU valueField sélectionnée non nulle.
|
|
2031
|
+
* Multi : texte tapé OU au moins un item sélectionné.
|
|
2032
|
+
* Utilisé par form-field pour décider d'afficher son bouton clear.
|
|
2033
|
+
*/
|
|
2034
|
+
this.hasAnyContent = computed(() => {
|
|
2035
|
+
if (this.multiple()) {
|
|
2036
|
+
return this.term().length > 0 || this.selectedItemsState().length > 0;
|
|
2037
|
+
}
|
|
2038
|
+
return this.term().length > 0 || this.control().value != null;
|
|
2039
|
+
}, ...(ngDevMode ? [{ debugName: "hasAnyContent" }] : []));
|
|
2040
|
+
/** Clé i18n du message de live region (annonces SR). */
|
|
2041
|
+
this.liveMessageKey = computed(() => {
|
|
2042
|
+
if (this.loading())
|
|
2043
|
+
return null;
|
|
2044
|
+
if (this.showNoResult())
|
|
2045
|
+
return '_COMMON.NO_RESULT';
|
|
2046
|
+
if (!this.isOpen() || this.items().length === 0)
|
|
2047
|
+
return null;
|
|
2048
|
+
return this.items().length === 1
|
|
2049
|
+
? '_COMMON._PAGINATION.RESULT_S'
|
|
2050
|
+
: '_COMMON._PAGINATION.RESULT_P';
|
|
2051
|
+
}, ...(ngDevMode ? [{ debugName: "liveMessageKey" }] : []));
|
|
2052
|
+
// Sync isDisabled signal -> FormControl interne (évite le warning runtime
|
|
2053
|
+
// "disabled attribute on a reactive form directive").
|
|
2054
|
+
effect(() => {
|
|
2055
|
+
if (this.isDisabled()) {
|
|
2056
|
+
this.searchInput.disable({ emitEvent: false });
|
|
2057
|
+
}
|
|
2058
|
+
else {
|
|
2059
|
+
this.searchInput.enable({ emitEvent: false });
|
|
2060
|
+
}
|
|
2061
|
+
});
|
|
2062
|
+
// Sync selectedItem -> affichage. Ne touche à rien tant que ngOnInit
|
|
2063
|
+
// n'a pas posé l'état initial (sinon on doublonne avec resolveInitialValue).
|
|
2064
|
+
effect(() => {
|
|
2065
|
+
const item = this.selectedItem();
|
|
2066
|
+
if (!this._initialized())
|
|
2067
|
+
return;
|
|
2068
|
+
if (this.multiple())
|
|
2069
|
+
return; // ignoré en multi
|
|
2070
|
+
if (this.isOpen())
|
|
2071
|
+
return; // ne pas écraser une saisie en cours
|
|
2072
|
+
if (item) {
|
|
2073
|
+
this.applySelected(item);
|
|
2074
|
+
}
|
|
2075
|
+
});
|
|
2076
|
+
// Sync selectedItems (multi) -> état interne, après init seulement.
|
|
2077
|
+
effect(() => {
|
|
2078
|
+
const items = this.selectedItems();
|
|
2079
|
+
if (!this._initialized())
|
|
2080
|
+
return;
|
|
2081
|
+
if (!this.multiple())
|
|
2082
|
+
return;
|
|
2083
|
+
// Évite reset si déjà identique (référence) — Angular signals court-circuitent déjà.
|
|
2084
|
+
this.selectedItemsState.set([...items]);
|
|
2085
|
+
});
|
|
2086
|
+
// Sync masterState -> propriété DOM 'indeterminate' (pas d'attribut HTML natif).
|
|
2087
|
+
effect(() => {
|
|
2088
|
+
const state = this.masterState();
|
|
2089
|
+
const ref = this.masterCheckbox();
|
|
2090
|
+
if (ref) {
|
|
2091
|
+
ref.nativeElement.indeterminate = state === 'indeterminate';
|
|
2092
|
+
}
|
|
2093
|
+
});
|
|
2094
|
+
}
|
|
2095
|
+
// ---------- Lifecycle ----------
|
|
2096
|
+
ngOnInit() {
|
|
2097
|
+
// Init multi : copie initiale depuis [selectedItems] (avant que _initialized passe à true).
|
|
2098
|
+
if (this.multiple()) {
|
|
2099
|
+
this.selectedItemsState.set([...this.selectedItems()]);
|
|
2100
|
+
}
|
|
2101
|
+
// Résolution de la valeur initiale dans cet ordre (mono uniquement) :
|
|
2102
|
+
// 1. [selectedItem] fourni → utilisé directement (synchrone)
|
|
2103
|
+
// 2. control.value présent + [resolver] fourni → appel async puis affichage
|
|
2104
|
+
// 3. control.value présent sans resolver → fallback : affichage brut du cast string
|
|
2105
|
+
if (!this.multiple()) {
|
|
2106
|
+
this.resolveInitialValue();
|
|
2107
|
+
}
|
|
2108
|
+
this._initialized.set(true);
|
|
2109
|
+
// Observe le control parent pour réagir aux resets externes (bouton clear
|
|
2110
|
+
// de form-field en mono, patchValue programmatique, etc.). Si le control
|
|
2111
|
+
// est remis à null/undefined (mono) ou à [] (multi), on vide l'état interne.
|
|
2112
|
+
this.control().valueChanges
|
|
2113
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
2114
|
+
.subscribe((value) => {
|
|
2115
|
+
if (this.multiple()) {
|
|
2116
|
+
if (value == null || (Array.isArray(value) && value.length === 0)) {
|
|
2117
|
+
this.selectedItemsState.set([]);
|
|
2118
|
+
this.searchInput.setValue('', { emitEvent: false });
|
|
2119
|
+
this.term.set('');
|
|
2120
|
+
this.items.set([]);
|
|
2121
|
+
this.isOpen.set(false);
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
else {
|
|
2125
|
+
if (value == null || value === '') {
|
|
2126
|
+
this.lastSelected = null;
|
|
2127
|
+
this.searchInput.setValue('', { emitEvent: false });
|
|
2128
|
+
this.term.set('');
|
|
2129
|
+
this.items.set([]);
|
|
2130
|
+
this.isOpen.set(false);
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
});
|
|
2134
|
+
// Pipe typeahead : déclenche le fetcher avec debounce + minChars + switchMap.
|
|
2135
|
+
this.searchInput.valueChanges
|
|
2136
|
+
.pipe(tap((t) => this.term.set(t ?? '')), tap((t) => {
|
|
2137
|
+
if ((t?.length ?? 0) < this.minChars()) {
|
|
2138
|
+
this.items.set([]);
|
|
2139
|
+
this.activeRow.set(-1);
|
|
2140
|
+
this.loading.set(false);
|
|
2141
|
+
}
|
|
2142
|
+
}), filter((t) => (t?.length ?? 0) >= this.minChars()), tap(() => {
|
|
2143
|
+
this.loading.set(true);
|
|
2144
|
+
this.isOpen.set(true);
|
|
2145
|
+
}), debounceTime(this.debounceMs()), switchMap((t) => this.fetcher()(t).pipe(catchError(() => of([])))), tap((items) => {
|
|
2146
|
+
this.items.set(items);
|
|
2147
|
+
this.loading.set(false);
|
|
2148
|
+
this.activeRow.set(items.length > 0 ? 0 : -1);
|
|
2149
|
+
this.activeCol.set(0);
|
|
2150
|
+
}), takeUntilDestroyed(this.destroyRef))
|
|
2151
|
+
.subscribe();
|
|
2152
|
+
}
|
|
2153
|
+
// ---------- Template helpers ----------
|
|
2154
|
+
cellId(row, col) {
|
|
2155
|
+
return `${this.resolvedId()}-r${row}-c${col}`;
|
|
2156
|
+
}
|
|
2157
|
+
rowId(row) {
|
|
2158
|
+
return `${this.resolvedId()}-r${row}`;
|
|
2159
|
+
}
|
|
2160
|
+
masterRowId() {
|
|
2161
|
+
return `${this.resolvedId()}-master-row`;
|
|
2162
|
+
}
|
|
2163
|
+
masterCellId() {
|
|
2164
|
+
return `${this.resolvedId()}-master-cell`;
|
|
2165
|
+
}
|
|
2166
|
+
/** Compare un item à la liste des sélectionnés via valueField. */
|
|
2167
|
+
isItemSelected(item) {
|
|
2168
|
+
const val = this.valueField();
|
|
2169
|
+
return this.selectedItemsState().some((s) => s[val] === item[val]);
|
|
2170
|
+
}
|
|
2171
|
+
/** Convention `disabled: true` sur l'item — non sélectionnable, non togglable. */
|
|
2172
|
+
isItemDisabled(item) {
|
|
2173
|
+
return !!item['disabled'];
|
|
2174
|
+
}
|
|
2175
|
+
getDisplay(item) {
|
|
2176
|
+
if (!item)
|
|
2177
|
+
return '';
|
|
2178
|
+
return String(item[this.displayField()] ?? '');
|
|
2179
|
+
}
|
|
2180
|
+
getCellText(item, colIndex) {
|
|
2181
|
+
const field = colIndex === 0 ? this.displayField() : this.columns()[colIndex - 1].field;
|
|
2182
|
+
return String(item[field] ?? '');
|
|
2183
|
+
}
|
|
2184
|
+
/**
|
|
2185
|
+
* Échappe le HTML puis entoure les occurrences du terme courant par <mark>.
|
|
2186
|
+
* Le résultat est binding-é via [innerHTML] (Angular sanitize la sortie).
|
|
2187
|
+
*/
|
|
2188
|
+
highlight(text) {
|
|
2189
|
+
const t = this.term();
|
|
2190
|
+
const escaped = this.escapeHtml(text);
|
|
2191
|
+
if (!t)
|
|
2192
|
+
return escaped;
|
|
2193
|
+
const re = new RegExp(`(${this.escapeRegex(t)})`, 'gi');
|
|
2194
|
+
return escaped.replace(re, '<mark>$1</mark>');
|
|
2195
|
+
}
|
|
2196
|
+
// ---------- DOM event handlers ----------
|
|
2197
|
+
onFocus() {
|
|
2198
|
+
// Si on a déjà des résultats en mémoire, on rouvre directement.
|
|
2199
|
+
if (this.items().length > 0) {
|
|
2200
|
+
this.isOpen.set(true);
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
/**
|
|
2204
|
+
* Marque le `control` parent comme `touched` à la perte de focus.
|
|
2205
|
+
* Sans ça, form-field ne voit jamais le control comme touché (le blur de
|
|
2206
|
+
* l'input HTML interne touche seulement `searchInput`, pas `control`),
|
|
2207
|
+
* et le message d'erreur required ne s'affiche pas.
|
|
2208
|
+
* Le clic sur la grille ne déclenche pas ce blur grâce au preventDefault
|
|
2209
|
+
* posé sur son mousedown.
|
|
2210
|
+
*/
|
|
2211
|
+
onBlur() {
|
|
2212
|
+
this.control().markAsTouched();
|
|
2213
|
+
}
|
|
2214
|
+
onClickOutside() {
|
|
2215
|
+
this.close();
|
|
2216
|
+
}
|
|
2217
|
+
onKeyDown(event) {
|
|
2218
|
+
const actions = handleComboboxKey(event, {
|
|
2219
|
+
isOpen: this.isOpen(),
|
|
2220
|
+
itemsCount: this.items().length,
|
|
2221
|
+
totalCols: this.totalCols(),
|
|
2222
|
+
activeRow: this.activeRow(),
|
|
2223
|
+
activeCol: this.activeCol(),
|
|
2224
|
+
multi: this.multiple(),
|
|
2225
|
+
});
|
|
2226
|
+
for (const a of actions)
|
|
2227
|
+
this.applyAction(a);
|
|
2228
|
+
}
|
|
2229
|
+
onChipRemove(item) {
|
|
2230
|
+
if (this.isDisabled() || this.isReadonly())
|
|
2231
|
+
return;
|
|
2232
|
+
this.toggleItem(item);
|
|
2233
|
+
}
|
|
2234
|
+
/**
|
|
2235
|
+
* Vide intégralement l'état du composant. Appelé par le bouton clear de
|
|
2236
|
+
* form-field. Vide le texte tapé, ferme la grille, et reset le control parent
|
|
2237
|
+
* (null en mono, [] en multi) — ce qui déclenche aussi notre subscription
|
|
2238
|
+
* valueChanges (idempotente).
|
|
2239
|
+
*/
|
|
2240
|
+
clear() {
|
|
2241
|
+
this.searchInput.setValue('', { emitEvent: false });
|
|
2242
|
+
this.term.set('');
|
|
2243
|
+
this.items.set([]);
|
|
2244
|
+
this.isOpen.set(false);
|
|
2245
|
+
if (this.multiple()) {
|
|
2246
|
+
this.selectedItemsState.set([]);
|
|
2247
|
+
this.control().setValue([]);
|
|
2248
|
+
this.itemsChange.emit([]);
|
|
2249
|
+
}
|
|
2250
|
+
else {
|
|
2251
|
+
this.lastSelected = null;
|
|
2252
|
+
this.control().setValue(null);
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
onMasterClick() {
|
|
2256
|
+
this.toggleMaster();
|
|
2257
|
+
}
|
|
2258
|
+
onMasterMouseEnter() {
|
|
2259
|
+
this.activeRow.set(MASTER_ROW);
|
|
2260
|
+
this.activeCol.set(0);
|
|
2261
|
+
}
|
|
2262
|
+
onRowClick(row) {
|
|
2263
|
+
this.selectRow(row);
|
|
2264
|
+
}
|
|
2265
|
+
onRowMouseEnter(row) {
|
|
2266
|
+
this.activeRow.set(row);
|
|
2267
|
+
this.activeCol.set(0);
|
|
2268
|
+
}
|
|
2269
|
+
// ---------- Internal logic ----------
|
|
2270
|
+
resolveInitialValue() {
|
|
2271
|
+
const item = this.selectedItem();
|
|
2272
|
+
if (item) {
|
|
2273
|
+
this.applySelected(item);
|
|
2274
|
+
return;
|
|
2275
|
+
}
|
|
2276
|
+
const value = this.control().value;
|
|
2277
|
+
if (value == null || value === '')
|
|
2278
|
+
return;
|
|
2279
|
+
const resolver = this.resolver();
|
|
2280
|
+
if (resolver) {
|
|
2281
|
+
resolver(value)
|
|
2282
|
+
.pipe(catchError(() => of(null)), takeUntilDestroyed(this.destroyRef))
|
|
2283
|
+
.subscribe((resolved) => {
|
|
2284
|
+
if (resolved) {
|
|
2285
|
+
this.applySelected(resolved);
|
|
2286
|
+
}
|
|
2287
|
+
else {
|
|
2288
|
+
this.applyRawValue(value);
|
|
2289
|
+
}
|
|
2290
|
+
});
|
|
2291
|
+
}
|
|
2292
|
+
else {
|
|
2293
|
+
this.applyRawValue(value);
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
/** Pose un item sélectionné comme état courant (init ou changement externe). */
|
|
2297
|
+
applySelected(item) {
|
|
2298
|
+
this.lastSelected = item;
|
|
2299
|
+
const display = this.getDisplay(item);
|
|
2300
|
+
this.searchInput.setValue(display, { emitEvent: false });
|
|
2301
|
+
this.term.set(display);
|
|
2302
|
+
}
|
|
2303
|
+
/** Fallback quand on n'a ni selectedItem ni resolver : affiche la valueField castée. */
|
|
2304
|
+
applyRawValue(value) {
|
|
2305
|
+
this.lastSelected = null;
|
|
2306
|
+
const display = value == null ? '' : String(value);
|
|
2307
|
+
this.searchInput.setValue(display, { emitEvent: false });
|
|
2308
|
+
this.term.set(display);
|
|
2309
|
+
}
|
|
2310
|
+
applyAction(a) {
|
|
2311
|
+
switch (a.type) {
|
|
2312
|
+
case 'open':
|
|
2313
|
+
this.isOpen.set(true);
|
|
2314
|
+
break;
|
|
2315
|
+
case 'close':
|
|
2316
|
+
this.close();
|
|
2317
|
+
break;
|
|
2318
|
+
case 'setActive':
|
|
2319
|
+
// Master row (-2) est valide en multi ; sinon on borne aux items réels.
|
|
2320
|
+
if (a.row === MASTER_ROW && this.multiple()) {
|
|
2321
|
+
this.activeRow.set(MASTER_ROW);
|
|
2322
|
+
this.activeCol.set(0);
|
|
2323
|
+
this.scrollActiveIntoView();
|
|
2324
|
+
}
|
|
2325
|
+
else if (a.row >= 0 && a.row < this.items().length) {
|
|
2326
|
+
this.activeRow.set(a.row);
|
|
2327
|
+
this.activeCol.set(a.col);
|
|
2328
|
+
this.scrollActiveIntoView();
|
|
2329
|
+
}
|
|
2330
|
+
break;
|
|
2331
|
+
case 'select':
|
|
2332
|
+
this.selectRow(a.row);
|
|
2333
|
+
break;
|
|
2334
|
+
case 'toggle': {
|
|
2335
|
+
const item = this.items()[a.row];
|
|
2336
|
+
if (item)
|
|
2337
|
+
this.toggleItem(item);
|
|
2338
|
+
break;
|
|
2339
|
+
}
|
|
2340
|
+
case 'toggleMaster':
|
|
2341
|
+
this.toggleMaster();
|
|
2342
|
+
break;
|
|
2343
|
+
case 'clearInput':
|
|
2344
|
+
this.searchInput.setValue('');
|
|
2345
|
+
this.term.set('');
|
|
2346
|
+
if (!this.multiple()) {
|
|
2347
|
+
this.lastSelected = null;
|
|
2348
|
+
this.control().setValue(null);
|
|
2349
|
+
}
|
|
2350
|
+
break;
|
|
2351
|
+
case 'noop':
|
|
2352
|
+
break;
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
/**
|
|
2356
|
+
* Toggle d'un item en multi-sélection. La grille reste ouverte, le terme tapé
|
|
2357
|
+
* est conservé. Le FormControl reçoit le tableau des valueFields.
|
|
2358
|
+
* Un item `disabled` est ignoré (ni ajout ni retrait).
|
|
2359
|
+
*/
|
|
2360
|
+
toggleItem(item) {
|
|
2361
|
+
if (this.isItemDisabled(item))
|
|
2362
|
+
return;
|
|
2363
|
+
const val = this.valueField();
|
|
2364
|
+
const current = this.selectedItemsState();
|
|
2365
|
+
const idx = current.findIndex((s) => s[val] === item[val]);
|
|
2366
|
+
const next = idx >= 0
|
|
2367
|
+
? [...current.slice(0, idx), ...current.slice(idx + 1)]
|
|
2368
|
+
: [...current, item];
|
|
2369
|
+
this.selectedItemsState.set(next);
|
|
2370
|
+
this.control().setValue(next.map((s) => s[val]));
|
|
2371
|
+
this.itemSelected.emit(item);
|
|
2372
|
+
this.itemsChange.emit(next);
|
|
2373
|
+
}
|
|
2374
|
+
/**
|
|
2375
|
+
* Toggle master : si tous les items affichés (hors disabled) sont cochés → décoche
|
|
2376
|
+
* les N éligibles affichés ; sinon → coche tous les non-cochés éligibles affichés.
|
|
2377
|
+
* Les items hors recherche actuelle et les items `disabled` ne sont jamais touchés.
|
|
2378
|
+
*/
|
|
2379
|
+
toggleMaster() {
|
|
2380
|
+
const val = this.valueField();
|
|
2381
|
+
const eligible = this.selectableItems();
|
|
2382
|
+
const current = this.selectedItemsState();
|
|
2383
|
+
const allChecked = this.masterState() === 'checked';
|
|
2384
|
+
let next;
|
|
2385
|
+
if (allChecked) {
|
|
2386
|
+
next = current.filter((s) => !eligible.some((v) => v[val] === s[val]));
|
|
2387
|
+
}
|
|
2388
|
+
else {
|
|
2389
|
+
const toAdd = eligible.filter((v) => !current.some((s) => s[val] === v[val]));
|
|
2390
|
+
next = [...current, ...toAdd];
|
|
2391
|
+
}
|
|
2392
|
+
this.selectedItemsState.set(next);
|
|
2393
|
+
this.control().setValue(next.map((s) => s[val]));
|
|
2394
|
+
this.itemsChange.emit(next);
|
|
2395
|
+
}
|
|
2396
|
+
selectRow(row) {
|
|
2397
|
+
const item = this.items()[row];
|
|
2398
|
+
if (!item)
|
|
2399
|
+
return;
|
|
2400
|
+
if (this.isItemDisabled(item))
|
|
2401
|
+
return;
|
|
2402
|
+
// En multi, la sélection passe par toggle (clic ligne = coche/décoche sans fermer).
|
|
2403
|
+
if (this.multiple()) {
|
|
2404
|
+
this.toggleItem(item);
|
|
2405
|
+
return;
|
|
2406
|
+
}
|
|
2407
|
+
this.lastSelected = item;
|
|
2408
|
+
const display = this.getDisplay(item);
|
|
2409
|
+
this.searchInput.setValue(display, { emitEvent: false });
|
|
2410
|
+
this.term.set(display);
|
|
2411
|
+
this.control().setValue(item[this.valueField()]);
|
|
2412
|
+
this.itemSelected.emit(item);
|
|
2413
|
+
this.close();
|
|
2414
|
+
}
|
|
2415
|
+
close() {
|
|
2416
|
+
this.isOpen.set(false);
|
|
2417
|
+
this.activeRow.set(-1);
|
|
2418
|
+
this.activeCol.set(0);
|
|
2419
|
+
if (this.multiple()) {
|
|
2420
|
+
// En multi : on vide le terme tapé à la fermeture, les items sélectionnés
|
|
2421
|
+
// restent dans formControl + chips. Pas de notion de lastSelected.
|
|
2422
|
+
this.searchInput.setValue('', { emitEvent: false });
|
|
2423
|
+
this.term.set('');
|
|
2424
|
+
this.items.set([]);
|
|
2425
|
+
return;
|
|
2426
|
+
}
|
|
2427
|
+
// Mono — sélection obligatoire : si la valeur tapée ne correspond pas au
|
|
2428
|
+
// lastSelected, on restaure (l'utilisateur a quitté sans valider).
|
|
2429
|
+
const expected = this.getDisplay(this.lastSelected);
|
|
2430
|
+
if (this.searchInput.value !== expected) {
|
|
2431
|
+
this.searchInput.setValue(expected, { emitEvent: false });
|
|
2432
|
+
this.term.set(expected);
|
|
2433
|
+
this.control().setValue(this.lastSelected ? this.lastSelected[this.valueField()] : null);
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
/**
|
|
2437
|
+
* Scroll la cellule active dans la vue. W3C : les navigateurs ne le font pas
|
|
2438
|
+
* pour aria-activedescendant, c'est à nous de le faire (critique pour le zoom).
|
|
2439
|
+
*/
|
|
2440
|
+
scrollActiveIntoView() {
|
|
2441
|
+
queueMicrotask(() => {
|
|
2442
|
+
const grid = this.gridEl()?.nativeElement;
|
|
2443
|
+
const id = this.activeDescendant();
|
|
2444
|
+
if (!grid || !id)
|
|
2445
|
+
return;
|
|
2446
|
+
const cell = grid.querySelector(`[id="${id}"]`);
|
|
2447
|
+
cell?.scrollIntoView({ block: 'nearest', inline: 'nearest' });
|
|
2448
|
+
});
|
|
2449
|
+
}
|
|
2450
|
+
// ---------- Utilities ----------
|
|
2451
|
+
escapeHtml(s) {
|
|
2452
|
+
const map = {
|
|
2453
|
+
'&': '&',
|
|
2454
|
+
'<': '<',
|
|
2455
|
+
'>': '>',
|
|
2456
|
+
'"': '"',
|
|
2457
|
+
"'": ''',
|
|
2458
|
+
};
|
|
2459
|
+
return s.replace(/[&<>"']/g, (c) => map[c]);
|
|
2460
|
+
}
|
|
2461
|
+
escapeRegex(s) {
|
|
2462
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
2463
|
+
}
|
|
2464
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: AutocompleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2465
|
+
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: "gridEl", first: true, predicate: ["gridEl"], descendants: true, isSignal: true }, { propertyName: "masterCheckbox", first: true, predicate: ["masterCheckbox"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\n class=\"cw-autocomplete-wrapper\"\n (clickOutside)=\"onClickOutside()\">\n\n <div class=\"field-group\">\n <input\n type=\"text\"\n class=\"field-control cw-autocomplete-input\"\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=\"grid\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-controls]=\"gridId()\"\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 <span class=\"spinner-border spinner-border-sm\" aria-hidden=\"true\"></span>\n }\n </div>\n\n @if (showGrid()) {\n <div\n #gridEl\n class=\"cw-autocomplete-grid\"\n role=\"grid\"\n [id]=\"gridId()\"\n [attr.aria-labelledby]=\"resolvedId()\"\n [style.--cw-ac-cols]=\"totalCols() + (multiple() ? 1 : 0)\"\n (mousedown)=\"$event.preventDefault()\">\n\n @if (multiple()) {\n <div\n role=\"row\"\n [id]=\"masterRowId()\"\n class=\"cw-autocomplete-row cw-autocomplete-row-master\"\n [class.is-active]=\"activeRow() === MASTER_ROW\"\n (mouseenter)=\"onMasterMouseEnter()\"\n (click)=\"onMasterClick()\">\n <div\n role=\"gridcell\"\n [id]=\"masterCellId()\"\n class=\"cw-autocomplete-cell cw-autocomplete-cell-check\"\n [class.is-active]=\"activeRow() === MASTER_ROW\"\n [attr.aria-selected]=\"activeRow() === MASTER_ROW ? 'true' : null\">\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=\"cw-autocomplete-master-label\">\n {{ (masterState() === 'checked'\n ? '_COMMON._ACTION.DESELECT_ALL'\n : '_COMMON._ACTION.SELECT_ALL') | translate }}\n </span>\n </div>\n </div>\n }\n\n @for (item of items(); track $index; let rowIdx = $index) {\n <div\n role=\"row\"\n [id]=\"rowId(rowIdx)\"\n class=\"cw-autocomplete-row\"\n [class.is-active]=\"activeRow() === rowIdx\"\n [class.is-disabled]=\"isItemDisabled(item)\"\n [attr.aria-selected]=\"multiple() ? (isItemSelected(item) ? 'true' : 'false') : null\"\n [attr.aria-disabled]=\"isItemDisabled(item) ? 'true' : null\"\n (mouseenter)=\"onRowMouseEnter(rowIdx)\"\n (click)=\"onRowClick(rowIdx)\">\n\n @if (multiple()) {\n <div\n role=\"gridcell\"\n class=\"cw-autocomplete-cell cw-autocomplete-cell-check\"\n [attr.aria-selected]=\"null\">\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 </div>\n }\n\n <div\n role=\"gridcell\"\n [id]=\"cellId(rowIdx, 0)\"\n class=\"cw-autocomplete-cell\"\n [class.is-active]=\"activeRow() === rowIdx && activeCol() === 0\"\n [attr.aria-selected]=\"activeRow() === rowIdx && activeCol() === 0 ? 'true' : null\"\n [innerHTML]=\"highlight(getCellText(item, 0))\">\n </div>\n\n @for (col of columns(); track col.field; let colIdx = $index) {\n <div\n role=\"gridcell\"\n [id]=\"cellId(rowIdx, colIdx + 1)\"\n class=\"cw-autocomplete-cell\"\n [class.is-active]=\"activeRow() === rowIdx && activeCol() === (colIdx + 1)\"\n [attr.aria-selected]=\"activeRow() === rowIdx && activeCol() === (colIdx + 1) ? 'true' : null\"\n [innerHTML]=\"highlight(getCellText(item, colIdx + 1))\">\n </div>\n }\n </div>\n }\n </div>\n }\n\n @if (showNoResult()) {\n <div class=\"cw-autocomplete-no-result\" aria-hidden=\"true\">\n {{ '_COMMON.NO_RESULT' | translate }}\n </div>\n }\n</div>\n\n @if (multiple() && selectedItemsState().length > 0) {\n <ul class=\"cw-autocomplete-chips\" role=\"list\">\n @for (item of selectedItemsState(); track item[valueField()]) {\n <li>\n <button\n type=\"button\"\n class=\"cw-autocomplete-chip\"\n [disabled]=\"isDisabled() || isReadonly()\"\n (click)=\"onChipRemove(item)\">\n <span>{{ getDisplay(item) }}</span>\n @if (!isDisabled() && !isReadonly()) {\n <span aria-hidden=\"true\" class=\"cw-autocomplete-chip-x\">×</span>\n <span class=\"visually-hidden\">\n {{ '_COMMON._ACTION.DELETE' | translate }}\n </span>\n }\n </button>\n </li>\n }\n </ul>\n }\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%}.cw-autocomplete-wrapper{position:relative}.cw-autocomplete-grid{position:absolute;top:100%;left:0;right:0;z-index:1100;margin-top:2px;max-height:16rem;overflow-y:auto;background-color:var(--bs-body-bg, #fff);border:1px solid var(--bs-border-color, #dee2e6);border-radius:.25rem;box-shadow:0 .25rem .75rem #0000001a}.cw-autocomplete-row{display:grid;grid-template-columns:repeat(var(--cw-ac-cols, 1),minmax(0,1fr));align-items:center;cursor:pointer;padding:0}.cw-autocomplete-row.is-active{background-color:var(--bs-primary-bg-subtle, rgba(13, 110, 253, .08))}.cw-autocomplete-row.is-disabled{cursor:not-allowed;opacity:.55}.cw-autocomplete-row.is-disabled.is-active{background-color:var(--bs-secondary-bg-subtle, rgba(0, 0, 0, .04))}.cw-autocomplete-row-master{display:flex;align-items:center;gap:.5rem;padding:.375rem .75rem;background-color:var(--bs-tertiary-bg, #f8f9fa);border-bottom:1px solid var(--bs-border-color, #dee2e6);font-weight:500}.cw-autocomplete-row-master.is-active{background-color:var(--bs-primary-bg-subtle, rgba(13, 110, 253, .12))}.cw-autocomplete-cell{padding:.375rem .75rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cw-autocomplete-cell mark{background-color:transparent;color:inherit;font-weight:700;padding:0}.cw-autocomplete-cell-check{display:flex;align-items:center;gap:.5rem;padding:.375rem .5rem;width:auto;flex:0 0 auto}.cw-autocomplete-cell-check input[type=checkbox]{margin:0;pointer-events:none}.cw-autocomplete-master-label{-webkit-user-select:none;user-select:none}.cw-autocomplete-no-result{position:absolute;top:100%;left:0;right:0;z-index:1100;margin-top:2px;padding:.5rem .75rem;background-color:var(--bs-body-bg, #fff);border:1px solid var(--bs-border-color, #dee2e6);border-radius:.25rem;color:var(--bs-secondary-color, #6c757d);font-style:italic}.cw-autocomplete-chips{display:flex;flex-wrap:wrap;gap:.25rem;margin:.5rem 0 0;padding:0;list-style:none}.cw-autocomplete-chip{display:inline-flex;align-items:center;gap:.375rem;padding:.125rem .5rem;background-color:var(--bs-secondary-bg-subtle, #e9ecef);border:1px solid var(--bs-border-color, #dee2e6);border-radius:1rem;font-size:.875rem;line-height:1.4;cursor:pointer;color:inherit}.cw-autocomplete-chip:hover,.cw-autocomplete-chip:focus-visible{background-color:var(--bs-secondary-bg, #dee2e6);outline:none}.cw-autocomplete-chip:disabled{cursor:not-allowed;opacity:.65;pointer-events:none}.cw-autocomplete-chip-x{font-size:1rem;line-height:1;font-weight:700}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { 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" }] }); }
|
|
2466
|
+
}
|
|
2467
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: AutocompleteComponent, decorators: [{
|
|
2468
|
+
type: Component,
|
|
2469
|
+
args: [{ selector: 'cw-autocomplete', standalone: true, imports: [
|
|
2470
|
+
CommonModule,
|
|
2471
|
+
ReactiveFormsModule,
|
|
2472
|
+
TranslateModule,
|
|
2473
|
+
ClickOutsideDirective
|
|
2474
|
+
], template: "<div\n class=\"cw-autocomplete-wrapper\"\n (clickOutside)=\"onClickOutside()\">\n\n <div class=\"field-group\">\n <input\n type=\"text\"\n class=\"field-control cw-autocomplete-input\"\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=\"grid\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-controls]=\"gridId()\"\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 <span class=\"spinner-border spinner-border-sm\" aria-hidden=\"true\"></span>\n }\n </div>\n\n @if (showGrid()) {\n <div\n #gridEl\n class=\"cw-autocomplete-grid\"\n role=\"grid\"\n [id]=\"gridId()\"\n [attr.aria-labelledby]=\"resolvedId()\"\n [style.--cw-ac-cols]=\"totalCols() + (multiple() ? 1 : 0)\"\n (mousedown)=\"$event.preventDefault()\">\n\n @if (multiple()) {\n <div\n role=\"row\"\n [id]=\"masterRowId()\"\n class=\"cw-autocomplete-row cw-autocomplete-row-master\"\n [class.is-active]=\"activeRow() === MASTER_ROW\"\n (mouseenter)=\"onMasterMouseEnter()\"\n (click)=\"onMasterClick()\">\n <div\n role=\"gridcell\"\n [id]=\"masterCellId()\"\n class=\"cw-autocomplete-cell cw-autocomplete-cell-check\"\n [class.is-active]=\"activeRow() === MASTER_ROW\"\n [attr.aria-selected]=\"activeRow() === MASTER_ROW ? 'true' : null\">\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=\"cw-autocomplete-master-label\">\n {{ (masterState() === 'checked'\n ? '_COMMON._ACTION.DESELECT_ALL'\n : '_COMMON._ACTION.SELECT_ALL') | translate }}\n </span>\n </div>\n </div>\n }\n\n @for (item of items(); track $index; let rowIdx = $index) {\n <div\n role=\"row\"\n [id]=\"rowId(rowIdx)\"\n class=\"cw-autocomplete-row\"\n [class.is-active]=\"activeRow() === rowIdx\"\n [class.is-disabled]=\"isItemDisabled(item)\"\n [attr.aria-selected]=\"multiple() ? (isItemSelected(item) ? 'true' : 'false') : null\"\n [attr.aria-disabled]=\"isItemDisabled(item) ? 'true' : null\"\n (mouseenter)=\"onRowMouseEnter(rowIdx)\"\n (click)=\"onRowClick(rowIdx)\">\n\n @if (multiple()) {\n <div\n role=\"gridcell\"\n class=\"cw-autocomplete-cell cw-autocomplete-cell-check\"\n [attr.aria-selected]=\"null\">\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 </div>\n }\n\n <div\n role=\"gridcell\"\n [id]=\"cellId(rowIdx, 0)\"\n class=\"cw-autocomplete-cell\"\n [class.is-active]=\"activeRow() === rowIdx && activeCol() === 0\"\n [attr.aria-selected]=\"activeRow() === rowIdx && activeCol() === 0 ? 'true' : null\"\n [innerHTML]=\"highlight(getCellText(item, 0))\">\n </div>\n\n @for (col of columns(); track col.field; let colIdx = $index) {\n <div\n role=\"gridcell\"\n [id]=\"cellId(rowIdx, colIdx + 1)\"\n class=\"cw-autocomplete-cell\"\n [class.is-active]=\"activeRow() === rowIdx && activeCol() === (colIdx + 1)\"\n [attr.aria-selected]=\"activeRow() === rowIdx && activeCol() === (colIdx + 1) ? 'true' : null\"\n [innerHTML]=\"highlight(getCellText(item, colIdx + 1))\">\n </div>\n }\n </div>\n }\n </div>\n }\n\n @if (showNoResult()) {\n <div class=\"cw-autocomplete-no-result\" aria-hidden=\"true\">\n {{ '_COMMON.NO_RESULT' | translate }}\n </div>\n }\n</div>\n\n @if (multiple() && selectedItemsState().length > 0) {\n <ul class=\"cw-autocomplete-chips\" role=\"list\">\n @for (item of selectedItemsState(); track item[valueField()]) {\n <li>\n <button\n type=\"button\"\n class=\"cw-autocomplete-chip\"\n [disabled]=\"isDisabled() || isReadonly()\"\n (click)=\"onChipRemove(item)\">\n <span>{{ getDisplay(item) }}</span>\n @if (!isDisabled() && !isReadonly()) {\n <span aria-hidden=\"true\" class=\"cw-autocomplete-chip-x\">×</span>\n <span class=\"visually-hidden\">\n {{ '_COMMON._ACTION.DELETE' | translate }}\n </span>\n }\n </button>\n </li>\n }\n </ul>\n }\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%}.cw-autocomplete-wrapper{position:relative}.cw-autocomplete-grid{position:absolute;top:100%;left:0;right:0;z-index:1100;margin-top:2px;max-height:16rem;overflow-y:auto;background-color:var(--bs-body-bg, #fff);border:1px solid var(--bs-border-color, #dee2e6);border-radius:.25rem;box-shadow:0 .25rem .75rem #0000001a}.cw-autocomplete-row{display:grid;grid-template-columns:repeat(var(--cw-ac-cols, 1),minmax(0,1fr));align-items:center;cursor:pointer;padding:0}.cw-autocomplete-row.is-active{background-color:var(--bs-primary-bg-subtle, rgba(13, 110, 253, .08))}.cw-autocomplete-row.is-disabled{cursor:not-allowed;opacity:.55}.cw-autocomplete-row.is-disabled.is-active{background-color:var(--bs-secondary-bg-subtle, rgba(0, 0, 0, .04))}.cw-autocomplete-row-master{display:flex;align-items:center;gap:.5rem;padding:.375rem .75rem;background-color:var(--bs-tertiary-bg, #f8f9fa);border-bottom:1px solid var(--bs-border-color, #dee2e6);font-weight:500}.cw-autocomplete-row-master.is-active{background-color:var(--bs-primary-bg-subtle, rgba(13, 110, 253, .12))}.cw-autocomplete-cell{padding:.375rem .75rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cw-autocomplete-cell mark{background-color:transparent;color:inherit;font-weight:700;padding:0}.cw-autocomplete-cell-check{display:flex;align-items:center;gap:.5rem;padding:.375rem .5rem;width:auto;flex:0 0 auto}.cw-autocomplete-cell-check input[type=checkbox]{margin:0;pointer-events:none}.cw-autocomplete-master-label{-webkit-user-select:none;user-select:none}.cw-autocomplete-no-result{position:absolute;top:100%;left:0;right:0;z-index:1100;margin-top:2px;padding:.5rem .75rem;background-color:var(--bs-body-bg, #fff);border:1px solid var(--bs-border-color, #dee2e6);border-radius:.25rem;color:var(--bs-secondary-color, #6c757d);font-style:italic}.cw-autocomplete-chips{display:flex;flex-wrap:wrap;gap:.25rem;margin:.5rem 0 0;padding:0;list-style:none}.cw-autocomplete-chip{display:inline-flex;align-items:center;gap:.375rem;padding:.125rem .5rem;background-color:var(--bs-secondary-bg-subtle, #e9ecef);border:1px solid var(--bs-border-color, #dee2e6);border-radius:1rem;font-size:.875rem;line-height:1.4;cursor:pointer;color:inherit}.cw-autocomplete-chip:hover,.cw-autocomplete-chip:focus-visible{background-color:var(--bs-secondary-bg, #dee2e6);outline:none}.cw-autocomplete-chip:disabled{cursor:not-allowed;opacity:.65;pointer-events:none}.cw-autocomplete-chip-x{font-size:1rem;line-height:1;font-weight:700}\n"] }]
|
|
2475
|
+
}], 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"] }], gridEl: [{ type: i0.ViewChild, args: ['gridEl', { isSignal: true }] }], masterCheckbox: [{ type: i0.ViewChild, args: ['masterCheckbox', { isSignal: true }] }] } });
|
|
2476
|
+
|
|
1771
2477
|
function rangeValidator(group, type) {
|
|
1772
2478
|
const startControl = group.get('start');
|
|
1773
2479
|
const endControl = group.get('end');
|
|
@@ -1824,6 +2530,17 @@ class FormFieldComponent {
|
|
|
1824
2530
|
}
|
|
1825
2531
|
constructor() {
|
|
1826
2532
|
this.displayLabel = true;
|
|
2533
|
+
/**
|
|
2534
|
+
* Valeur de l'attribut HTML `autocomplete` posée sur les inputs texte / date /
|
|
2535
|
+
* password / textarea / phone / etc. Défaut `'off'` pour désactiver les
|
|
2536
|
+
* suggestions du navigateur (sources d'auto-remplissages parasites dans les
|
|
2537
|
+
* formulaires métier). À surcharger ponctuellement avec un token standard
|
|
2538
|
+
* (`'email'`, `'name'`, `'street-address'`, `'postal-code'`, `'tel'`,
|
|
2539
|
+
* `'current-password'`, `'new-password'`, etc.) sur les champs où l'auto-fill
|
|
2540
|
+
* est utile pour l'utilisateur. Note : `autocomplete="off"` peut être ignoré
|
|
2541
|
+
* par certains navigateurs pour les champs password (sécurité), c'est attendu.
|
|
2542
|
+
*/
|
|
2543
|
+
this.autocomplete = 'off';
|
|
1827
2544
|
this.options = [];
|
|
1828
2545
|
this.isRequired = false;
|
|
1829
2546
|
this.isInAddon = false;
|
|
@@ -1832,22 +2549,44 @@ class FormFieldComponent {
|
|
|
1832
2549
|
this.skeletonMode = false;
|
|
1833
2550
|
this.clearable = true;
|
|
1834
2551
|
this.appendTo = 'body';
|
|
2552
|
+
/** Code pays ISO 3166-1 alpha-2 utilisé comme pays initial pour `type=phone` (ex. 'fr', 'be'). */
|
|
2553
|
+
this.initialCountry = 'fr';
|
|
1835
2554
|
this.indeterminate = input(false, ...(ngDevMode ? [{ debugName: "indeterminate" }] : []));
|
|
1836
2555
|
this.checkboxInputRef = viewChild('checkboxInput', ...(ngDevMode ? [{ debugName: "checkboxInputRef" }] : []));
|
|
1837
2556
|
this.fileInputRef = viewChild('fileInput', ...(ngDevMode ? [{ debugName: "fileInputRef" }] : []));
|
|
2557
|
+
this.phoneInputRef = viewChild('phoneInput', ...(ngDevMode ? [{ debugName: "phoneInputRef" }] : []));
|
|
2558
|
+
/** Référence à cw-autocomplete (rendu conditionnellement) — sert au bouton clear externe. */
|
|
2559
|
+
this.autocompleteRef = viewChild(AutocompleteComponent, ...(ngDevMode ? [{ debugName: "autocompleteRef" }] : []));
|
|
2560
|
+
this.destroyRef = inject(DestroyRef);
|
|
2561
|
+
this.translateService = inject(TranslateService);
|
|
2562
|
+
this.iti = null;
|
|
2563
|
+
/** True dès que `intl-tel-input/utils` (libphonenumber-js) est chargé — sans ça, getNumber()/isValidNumber() sont indisponibles. */
|
|
2564
|
+
this.utilsReady = false;
|
|
1838
2565
|
/** True si on a ajouté `Validators.required` nous-mêmes — sert à ne retirer que ce qu'on a mis. */
|
|
1839
2566
|
this.requiredAppliedMain = false;
|
|
1840
2567
|
this.requiredAppliedStart = false;
|
|
1841
2568
|
this.requiredAppliedEnd = false;
|
|
2569
|
+
/** True si c'est nous (via l'input `isDisabled`) qui avons désactivé le control — sert à ne ré-activer que ce qu'on a désactivé. */
|
|
2570
|
+
this.disabledAppliedByUs = false;
|
|
1842
2571
|
this.refreshEvent = new EventEmitter();
|
|
1843
2572
|
this.textChanged = new EventEmitter();
|
|
1844
2573
|
this.valueChange = new EventEmitter();
|
|
1845
2574
|
this.typeField = FormFieldTypeEnum;
|
|
2575
|
+
/** True quand l'input password est affiché en clair (type=text). Pilote l'icône œil et le SR text. */
|
|
2576
|
+
this.isPasswordShown = false;
|
|
1846
2577
|
this.spriteIcon = SpriteIconEnum;
|
|
1847
2578
|
this.buttonType = FoButtonTypeEnum && BoButtonTypeEnum;
|
|
1848
2579
|
this.buttonIconSize = ButtonIconSizeEnum;
|
|
1849
2580
|
/** Comparator passé au pipe `keyvalue` pour préserver l'ordre d'insertion de `errorMessages`. */
|
|
1850
2581
|
this.keepOrder = () => 0;
|
|
2582
|
+
/** Validator phone : skip tant que utils non chargé (renvoie null), sinon délègue à iti.isValidNumber(). */
|
|
2583
|
+
this.phoneValidator = (ctrl) => {
|
|
2584
|
+
if (!ctrl.value)
|
|
2585
|
+
return null;
|
|
2586
|
+
if (!this.utilsReady || !this.iti)
|
|
2587
|
+
return null;
|
|
2588
|
+
return this.iti.isValidNumber() ? null : { phone: true };
|
|
2589
|
+
};
|
|
1851
2590
|
effect(() => {
|
|
1852
2591
|
const indeterminateValue = this.indeterminate();
|
|
1853
2592
|
const ref = this.checkboxInputRef();
|
|
@@ -1880,11 +2619,39 @@ class FormFieldComponent {
|
|
|
1880
2619
|
}
|
|
1881
2620
|
/**
|
|
1882
2621
|
* `true` si le champ doit être désactivé visuellement et fonctionnellement.
|
|
1883
|
-
*
|
|
1884
|
-
*
|
|
2622
|
+
* Reflète l'état `disabled` du FormControl/FormGroup lié (piloté par `syncDisabledState()`
|
|
2623
|
+
* à partir de l'input `isDisabled`) ; le fallback sur `isDisabled` couvre les types non liés
|
|
2624
|
+
* par `[formControl]` (file, phone) dont l'attribut DOM est posé via le template.
|
|
1885
2625
|
*/
|
|
1886
2626
|
get isEffectivelyDisabled() {
|
|
1887
|
-
return !!this.
|
|
2627
|
+
return !!this.controlOrGroup?.disabled || !!this.isDisabled;
|
|
2628
|
+
}
|
|
2629
|
+
/**
|
|
2630
|
+
* Synchronise l'état `disabled` du control lié avec l'input `isDisabled`.
|
|
2631
|
+
*
|
|
2632
|
+
* Indispensable avec les Reactive Forms : sur un input lié par `[formControl]`, le binding
|
|
2633
|
+
* `[disabled]` du template est ignoré — c'est `control.disable()/enable()` qui pilote l'état
|
|
2634
|
+
* (Angular émet sinon un warning et force `disabled=false` dans le DOM). On ne ré-active que
|
|
2635
|
+
* ce qu'on a désactivé nous-mêmes (flag) pour ne pas écraser un `disable()` posé par le parent.
|
|
2636
|
+
*/
|
|
2637
|
+
syncDisabledState() {
|
|
2638
|
+
const ctrl = this.controlOrGroup;
|
|
2639
|
+
if (!ctrl)
|
|
2640
|
+
return;
|
|
2641
|
+
if (this.isDisabled) {
|
|
2642
|
+
if (ctrl.enabled) {
|
|
2643
|
+
ctrl.disable({ emitEvent: false });
|
|
2644
|
+
this.disabledAppliedByUs = true;
|
|
2645
|
+
}
|
|
2646
|
+
}
|
|
2647
|
+
else if (this.disabledAppliedByUs) {
|
|
2648
|
+
ctrl.enable({ emitEvent: false });
|
|
2649
|
+
this.disabledAppliedByUs = false;
|
|
2650
|
+
}
|
|
2651
|
+
// type=phone n'est pas lié par [formControl] : on pilote l'instance intl-tel-input directement.
|
|
2652
|
+
if (this.type === this.typeField.phone) {
|
|
2653
|
+
this.iti?.setDisabled(this.isEffectivelyDisabled);
|
|
2654
|
+
}
|
|
1888
2655
|
}
|
|
1889
2656
|
/** Types dont min/max représentent un nombre de caractères (→ minlength/maxlength). */
|
|
1890
2657
|
isTextLengthBased() {
|
|
@@ -1899,6 +2666,8 @@ class FormFieldComponent {
|
|
|
1899
2666
|
return this.isTextLengthBased() ? (this.validationOptions?.min ?? null) : null;
|
|
1900
2667
|
}
|
|
1901
2668
|
get maxLengthAttr() {
|
|
2669
|
+
if (this.type === this.typeField.zipCode)
|
|
2670
|
+
return 6;
|
|
1902
2671
|
return this.isTextLengthBased() ? (this.validationOptions?.max ?? null) : null;
|
|
1903
2672
|
}
|
|
1904
2673
|
get minAttr() {
|
|
@@ -2016,10 +2785,36 @@ class FormFieldComponent {
|
|
|
2016
2785
|
group.updateValueAndValidity();
|
|
2017
2786
|
}
|
|
2018
2787
|
}
|
|
2019
|
-
|
|
2788
|
+
// Pour `type=file`, on applique TOUJOURS les validators Angular dès qu'au moins
|
|
2789
|
+
// une option (`accept` ou `maxSize`) est fournie : l'attribut HTML `accept` ne
|
|
2790
|
+
// valide rien (juste un hint pour le file picker) et `maxSize` n'a aucun
|
|
2791
|
+
// équivalent natif — sans validator, l'erreur n'apparaît jamais alors que
|
|
2792
|
+
// l'aide affichée (`autoHelpEntries`) promet à l'utilisateur que la règle est
|
|
2793
|
+
// imposée. Cas spécial assumé : les autres types gardent l'opt-in `applyValidators`.
|
|
2794
|
+
const opts = this.validationOptions;
|
|
2795
|
+
const fileHasValidationOpts = this.type === this.typeField.file
|
|
2796
|
+
&& (!!opts?.accept?.length || opts?.maxSize != null);
|
|
2797
|
+
if (opts?.applyValidators || fileHasValidationOpts) {
|
|
2020
2798
|
this.applyAngularValidators();
|
|
2021
2799
|
}
|
|
2800
|
+
if (this.type === this.typeField.email && this.control && !this.control.hasValidator(Validators.email)) {
|
|
2801
|
+
this.control.addValidators(Validators.email);
|
|
2802
|
+
this.control.updateValueAndValidity();
|
|
2803
|
+
}
|
|
2022
2804
|
this.syncRequiredValidator();
|
|
2805
|
+
this.syncDisabledState();
|
|
2806
|
+
if (this.type === this.typeField.file && this.control) {
|
|
2807
|
+
this.control.valueChanges
|
|
2808
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
2809
|
+
.subscribe(value => {
|
|
2810
|
+
if (value == null || value === '') {
|
|
2811
|
+
const ref = this.fileInputRef();
|
|
2812
|
+
if (ref) {
|
|
2813
|
+
ref.nativeElement.value = '';
|
|
2814
|
+
}
|
|
2815
|
+
}
|
|
2816
|
+
});
|
|
2817
|
+
}
|
|
2023
2818
|
}
|
|
2024
2819
|
/**
|
|
2025
2820
|
* Synchronise `Validators.required` sur le control lié en fonction de `isRequired`.
|
|
@@ -2167,6 +2962,100 @@ class FormFieldComponent {
|
|
|
2167
2962
|
if (changes['isRequired'] && !changes['isRequired'].firstChange) {
|
|
2168
2963
|
this.syncRequiredValidator();
|
|
2169
2964
|
}
|
|
2965
|
+
if (changes['isDisabled'] && !changes['isDisabled'].firstChange) {
|
|
2966
|
+
this.syncDisabledState();
|
|
2967
|
+
}
|
|
2968
|
+
}
|
|
2969
|
+
ngAfterViewInit() {
|
|
2970
|
+
if (this.type === this.typeField.phone) {
|
|
2971
|
+
this.initPhone();
|
|
2972
|
+
}
|
|
2973
|
+
}
|
|
2974
|
+
ngOnDestroy() {
|
|
2975
|
+
this.iti?.destroy();
|
|
2976
|
+
this.iti = null;
|
|
2977
|
+
}
|
|
2978
|
+
/**
|
|
2979
|
+
* Instancie `intl-tel-input` sur le champ `#phoneInput` et câble la sync bidirectionnelle
|
|
2980
|
+
* avec le FormControl + le validator `phone`. Utils (libphonenumber-js) chargés en lazy.
|
|
2981
|
+
*/
|
|
2982
|
+
initPhone() {
|
|
2983
|
+
const ref = this.phoneInputRef();
|
|
2984
|
+
if (!ref || !this.control)
|
|
2985
|
+
return;
|
|
2986
|
+
const el = ref.nativeElement;
|
|
2987
|
+
const lang = (this.translateService.currentLang || this.translateService.defaultLang || 'fr').toLowerCase();
|
|
2988
|
+
// Packs i18n natifs de la lib : couvrent `searchPlaceholder`, `searchEmptyState`
|
|
2989
|
+
// ("Aucun résultat trouvé"), `noCountrySelected` et tous les aria-labels en un objet.
|
|
2990
|
+
// Fallback `en` si la langue de l'app n'est pas couverte par les packs importés.
|
|
2991
|
+
const i18nPack = lang === 'fr' ? itiFr : itiEn;
|
|
2992
|
+
this.iti = intlTelInput(el, {
|
|
2993
|
+
initialCountry: (this.initialCountry || 'fr').toLowerCase(),
|
|
2994
|
+
countrySearch: true,
|
|
2995
|
+
separateDialCode: true,
|
|
2996
|
+
formatAsYouType: true,
|
|
2997
|
+
formatOnDisplay: true,
|
|
2998
|
+
nationalMode: false,
|
|
2999
|
+
countryNameLocale: lang,
|
|
3000
|
+
i18n: i18nPack,
|
|
3001
|
+
loadUtils: () => import('intl-tel-input/utils')
|
|
3002
|
+
});
|
|
3003
|
+
const initialValue = this.control.value;
|
|
3004
|
+
if (typeof initialValue === 'string' && initialValue) {
|
|
3005
|
+
this.iti.setNumber(initialValue);
|
|
3006
|
+
}
|
|
3007
|
+
if (this.isEffectivelyDisabled) {
|
|
3008
|
+
this.iti.setDisabled(true);
|
|
3009
|
+
}
|
|
3010
|
+
this.iti.promise.then(() => {
|
|
3011
|
+
this.utilsReady = true;
|
|
3012
|
+
this.syncPhoneFromInput();
|
|
3013
|
+
this.control?.updateValueAndValidity({ emitEvent: false });
|
|
3014
|
+
});
|
|
3015
|
+
const onPhoneChange = () => this.syncPhoneFromInput();
|
|
3016
|
+
el.addEventListener('countrychange', onPhoneChange);
|
|
3017
|
+
el.addEventListener('input', onPhoneChange);
|
|
3018
|
+
el.addEventListener('change', onPhoneChange);
|
|
3019
|
+
this.destroyRef.onDestroy(() => {
|
|
3020
|
+
el.removeEventListener('countrychange', onPhoneChange);
|
|
3021
|
+
el.removeEventListener('input', onPhoneChange);
|
|
3022
|
+
el.removeEventListener('change', onPhoneChange);
|
|
3023
|
+
});
|
|
3024
|
+
this.control.valueChanges
|
|
3025
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
3026
|
+
.subscribe(value => {
|
|
3027
|
+
if (!this.iti)
|
|
3028
|
+
return;
|
|
3029
|
+
const current = this.utilsReady ? this.iti.getNumber() : el.value;
|
|
3030
|
+
if (value === current)
|
|
3031
|
+
return;
|
|
3032
|
+
if (value == null || value === '') {
|
|
3033
|
+
this.iti.setNumber('');
|
|
3034
|
+
}
|
|
3035
|
+
else if (typeof value === 'string') {
|
|
3036
|
+
this.iti.setNumber(value);
|
|
3037
|
+
}
|
|
3038
|
+
this.control?.updateValueAndValidity({ emitEvent: false });
|
|
3039
|
+
});
|
|
3040
|
+
this.control.addValidators(this.phoneValidator);
|
|
3041
|
+
this.control.updateValueAndValidity({ emitEvent: false });
|
|
3042
|
+
}
|
|
3043
|
+
/**
|
|
3044
|
+
* Lit la valeur courante depuis l'instance iti et la pousse dans le FormControl (E.164 dès que utils chargés).
|
|
3045
|
+
* Ne marque pas comme `touched` — on s'aligne sur le comportement standard Angular : `touched` est posé sur blur
|
|
3046
|
+
* (via `(blur)="onBlur()"` câblé dans le template), pour ne montrer l'erreur de format qu'après sortie du champ.
|
|
3047
|
+
*/
|
|
3048
|
+
syncPhoneFromInput() {
|
|
3049
|
+
if (!this.iti || !this.control)
|
|
3050
|
+
return;
|
|
3051
|
+
const el = this.phoneInputRef()?.nativeElement;
|
|
3052
|
+
if (!el)
|
|
3053
|
+
return;
|
|
3054
|
+
const number = this.utilsReady ? (this.iti.getNumber() || '') : (el.value || '');
|
|
3055
|
+
if (this.control.value === number)
|
|
3056
|
+
return;
|
|
3057
|
+
this.control.setValue(number);
|
|
3058
|
+
this.valueChange.emit(number);
|
|
2170
3059
|
}
|
|
2171
3060
|
onCheckboxChange(event) {
|
|
2172
3061
|
const checkbox = event.target;
|
|
@@ -2196,6 +3085,41 @@ class FormFieldComponent {
|
|
|
2196
3085
|
this.control.markAsTouched();
|
|
2197
3086
|
}
|
|
2198
3087
|
}
|
|
3088
|
+
/**
|
|
3089
|
+
* Au focus du champ : reset `touched` pour cacher l'erreur tant que l'utilisateur
|
|
3090
|
+
* saisit/corrige. `touched` sera reposé au blur via `onBlur()`. Sans ça, après le
|
|
3091
|
+
* premier blur l'erreur reste affichée et "flicker" à chaque caractère pendant la
|
|
3092
|
+
* correction (pas user-friendly).
|
|
3093
|
+
*/
|
|
3094
|
+
onFocus() {
|
|
3095
|
+
if (this.control?.touched) {
|
|
3096
|
+
this.control.markAsUntouched();
|
|
3097
|
+
}
|
|
3098
|
+
}
|
|
3099
|
+
/** Variante de `onFocus` pour les types période (start/end portés par des sous-controls). */
|
|
3100
|
+
onFocusRange(path) {
|
|
3101
|
+
const ctrl = this.getControl(path);
|
|
3102
|
+
if (ctrl?.touched) {
|
|
3103
|
+
ctrl.markAsUntouched();
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
/**
|
|
3107
|
+
* Blur spécifique au type `phone` : ignore les blurs internes au wrapper `.iti` (sélecteur de pays,
|
|
3108
|
+
* recherche). Sans ça, ouvrir le dropdown pays poserait `touched=true` prématurément et l'erreur
|
|
3109
|
+
* de format apparaîtrait dès la frappe suivante alors que l'utilisateur n'a pas quitté le champ.
|
|
3110
|
+
*/
|
|
3111
|
+
onPhoneBlur(event) {
|
|
3112
|
+
const relatedTarget = event.relatedTarget;
|
|
3113
|
+
const itiContainer = this.phoneInputRef()?.nativeElement.closest('.iti');
|
|
3114
|
+
if (relatedTarget && itiContainer?.contains(relatedTarget)) {
|
|
3115
|
+
return;
|
|
3116
|
+
}
|
|
3117
|
+
this.onBlur();
|
|
3118
|
+
}
|
|
3119
|
+
/** Toggle de l'affichage en clair pour `type=password`. */
|
|
3120
|
+
togglePasswordVisibility() {
|
|
3121
|
+
this.isPasswordShown = !this.isPasswordShown;
|
|
3122
|
+
}
|
|
2199
3123
|
isInInputGroup() {
|
|
2200
3124
|
const inInputGroup = [
|
|
2201
3125
|
this.typeField.text,
|
|
@@ -2210,6 +3134,9 @@ class FormFieldComponent {
|
|
|
2210
3134
|
this.typeField.select,
|
|
2211
3135
|
this.typeField.ngSelect,
|
|
2212
3136
|
this.typeField.ngSelectMultiple,
|
|
3137
|
+
this.typeField.zipCode,
|
|
3138
|
+
this.typeField.autocomplete,
|
|
3139
|
+
this.typeField.autocompleteMultiple,
|
|
2213
3140
|
].includes(this.type);
|
|
2214
3141
|
return inInputGroup;
|
|
2215
3142
|
}
|
|
@@ -2295,7 +3222,7 @@ class FormFieldComponent {
|
|
|
2295
3222
|
this.formControl.markAsTouched();
|
|
2296
3223
|
}
|
|
2297
3224
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: FormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2298
|
-
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 }, name: { classPropertyName: "name", publicName: "name", isSignal: false, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", 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 }, errorMessages: { classPropertyName: "errorMessages", publicName: "errorMessages", isSignal: false, isRequired: false, transformFunction: null }, isRequired: { classPropertyName: "isRequired", publicName: "isRequired", isSignal: false, isRequired: false, transformFunction: null }, help: { classPropertyName: "help", publicName: "help", isSignal: false, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", 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 }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { refreshEvent: "refreshEvent", textChanged: "textChanged", valueChange: "valueChange" }, 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 }], usesOnChanges: true, ngImport: i0, template: "@if (!isInAddon) {\r\n @if (\r\n type !== typeField.checkbox &&\r\n type !== typeField.radio &&\r\n type !== typeField.checkboxButton &&\r\n type !== typeField.radioButton &&\r\n type !== typeField.checkboxInline &&\r\n type !== typeField.radioInline &&\r\n type !== typeField.switch &&\r\n type !== typeField.range &&\r\n type !== typeField.switchSmall\r\n ) {\r\n <label [for]=\"name\" class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{ label | translate }}\r\n\r\n @if (isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n\r\n @if (tooltip) {\r\n <!-- <button type=\"button\" class=\"btn btn-link btn-popover\" placement=\"bottom\" [ngbPopover]=\"popContent\" container=\"body\"\r\n triggers=\"mouseenter:mouseleave\">\r\n <span class=\"btn-popover-icon bo-icons bo-help\"></span>\r\n </button>\r\n <ng-template #popContent>\r\n <div [innerHTML]=\"tooltip\"></div>\r\n </ng-template> -->\r\n }\r\n </label>\r\n }\r\n\r\n @if (addonLeft || addonRight) {\r\n <div class=\"field-group\">\r\n @if(addonLeft) {\r\n <ng-container [ngTemplateOutlet]=\"addonLeft\"></ng-container>\r\n }\r\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\r\n @if(addonRight) {\r\n <ng-container [ngTemplateOutlet]=\"addonRight\"></ng-container>\r\n }\r\n </div>\r\n }\r\n @else {\r\n @if ( isInInputGroup() ) {\r\n <div class=\"field-group\">\r\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\r\n </div>\r\n }\r\n @else {\r\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\r\n }\r\n }\r\n\r\n <!-- Error message -->\r\n @if (controlOrGroup?.invalid && controlOrGroup?.touched) {\r\n <div class=\"field-invalid\" [id]=\"'error-' + name\">\r\n @if (\r\n !errorMessages?.['required'] &&\r\n ((controlOrGroup?.errors?.['required']) || (getControl('start')?.errors?.['required'] || getControl('end')?.errors?.['required']))\r\n ) {\r\n <span [innerHtml]=\"'_COMMON._FORM.ERROR_IS_MANDATORY' | translate: {label: label | translate}\"></span>\r\n }\r\n @if (!errorMessages?.['rangeInvalid'] && controlOrGroup?.errors?.['rangeInvalid']) {\r\n <span>{{'_COMMON._DATES.ERROR_START_END_PERIOD' | translate}}</span>\r\n }\r\n @if (!errorMessages?.['fileExtension'] && controlOrGroup?.errors?.['fileExtension']) {\r\n <span>{{ '_COMMON._FORM.ERROR_FILE_EXTENSION' | translate: { accept: acceptLabel } }}</span>\r\n }\r\n @if (!errorMessages?.['fileSize'] && controlOrGroup?.errors?.['fileSize']) {\r\n <span>{{ '_COMMON._FORM.ERROR_FILE_SIZE' | translate: { maxSize: maxSizeLabel } }}</span>\r\n }\r\n @if (errorMessages) {\r\n @for (entry of errorMessages | keyvalue: keepOrder; track entry.key) {\r\n @if (controlOrGroup?.errors?.[entry.key]; as errVal) {\r\n <span>{{ entry.value | translate: (errVal === true ? null : errVal) }}</span>\r\n }\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n @if (help || autoHelpEntries.length) {\r\n <div [id]=\"name + '-help'\" class=\"field-text\">\r\n @if (help) {\r\n <div>{{ help | translate }}</div>\r\n }\r\n @for (entry of autoHelpEntries; track entry.key) {\r\n <div>{{ entry.key | translate: entry.params }}</div>\r\n }\r\n </div>\r\n }\r\n}\r\n@else {\r\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\r\n}\r\n\r\n<ng-template #field>\r\n <!-- Text -->\r\n @if ([typeField.text, typeField.date, typeField.time, typeField.dateTime, typeField.number,\r\n typeField.email,\r\n typeField.color].includes(type)) {\r\n <input [type]=\"type\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\r\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\r\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [disabled]=\"isEffectivelyDisabled\" [attr.aria-required]=\"isRequired\"\r\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\"\r\n [attr.min]=\"minAttr\" [attr.max]=\"maxAttr\" [attr.step]=\"stepAttr\" [attr.pattern]=\"patternAttr\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\" />\r\n }\r\n\r\n <!-- File -->\r\n @if (type === typeField.file) {\r\n <input #fileInput type=\"file\" class=\"field-control\" [id]=\"name\"\r\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\r\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [disabled]=\"isEffectivelyDisabled\" [attr.aria-required]=\"isRequired\"\r\n [attr.accept]=\"acceptAttr\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n (change)=\"onFileChange($event)\" (blur)=\"onBlur()\" />\r\n }\r\n\r\n @if (type === typeField.password) {\r\n <input showHidePassword [type]=\"type\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\r\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\r\n [attr.required]=\"isRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.aria-required]=\"isRequired\"\r\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\" [attr.pattern]=\"patternAttr\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\" />\r\n }\r\n\r\n <!-- Textarea -->\r\n @if (type === typeField.textarea) {\r\n <textarea class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\r\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\r\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"\r\n [attr.aria-required]=\"isRequired\" [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\" [attr.pattern]=\"patternAttr\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"></textarea>\r\n }\r\n\r\n <!-- Select -->\r\n @if (type === typeField.select) {\r\n <ng-select [formControl]=\"formControl\" [items]=\"options\" bindLabel=\"label\" [labelForId]=\"name\" [appendTo]=\"appendTo\" bindValue=\"value\"\r\n [ngClass]=\"cssClass\" [searchable]=\"false\" [placeholder]=\"placeholder ? (placeholder | translate) : null\" [readonly]=\"isReadonly\" [clearable]=\"false\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.aria-required]=\"isRequired\" [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\" [attr.id]=\"name\"\r\n (blur)=\"onBlur()\">\r\n\r\n <!-- Template pour les options -->\r\n <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\">\r\n @if (optionTemplate) {\r\n <ng-container *ngTemplateOutlet=\"optionTemplate; context: { item: item | translate, index: index, searchTerm: search }\"></ng-container>\r\n }\r\n @else {\r\n <div>{{ item.label | translate }}</div>\r\n }\r\n </ng-template>\r\n\r\n <!-- Template pour le label -->\r\n <ng-template ng-label-tmp let-item=\"item\">\r\n @if (labelTemplate) {\r\n <ng-container *ngTemplateOutlet=\"labelTemplate; context: { item: item | translate }\"></ng-container>\r\n }\r\n @else {\r\n {{ (item.label | translate) || (placeholder | translate) }}\r\n }\r\n </ng-template>\r\n </ng-select>\r\n }\r\n\r\n <!-- NgSelect -->\r\n @if (type === typeField.ngSelect || type === typeField.ngSelectMultiple) {\r\n <ng-select [formControl]=\"formControl\" [items]=\"options\" bindLabel=\"label\" [labelForId]=\"name\" [appendTo]=\"appendTo\" bindValue=\"value\"\r\n [multiple]=\"type === typeField.ngSelectMultiple\" [ngClass]=\"cssClass\" [clearable]=\"false\"\r\n [placeholder]=\"placeholder ? (placeholder | translate) : null\" [readonly]=\"isReadonly\"\r\n [notFoundText]=\"'_COMMON.NO_RESULT' | translate\" [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"\r\n [attr.required]=\"isRequired ? 'required' : null\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\" [attr.id]=\"name\"\r\n (blur)=\"onBlur()\" (search)=\"textChanged.emit($event?.term)\">\r\n\r\n <!-- Template pour les options -->\r\n <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\">\r\n @if (optionTemplate) {\r\n <ng-container *ngTemplateOutlet=\"optionTemplate; context: { item: item, index: index, searchTerm: search }\"></ng-container>\r\n }\r\n @else {\r\n <div>{{ item.label | translate }}</div>\r\n }\r\n </ng-template>\r\n\r\n <!-- Template pour le label -->\r\n <ng-template ng-label-tmp let-item=\"item\" let-clear=\"clear\">\r\n <span class=\"ng-value-icon left\" (click)=\"clear(item)\" aria-hidden=\"true\">\u00D7</span>\r\n @if (labelTemplate) {\r\n <ng-container *ngTemplateOutlet=\"labelTemplate; context: { item: item | translate }\"></ng-container>\r\n }\r\n @else {\r\n {{ (item.label | translate) || (placeholder | translate) }}\r\n }\r\n </ng-template>\r\n </ng-select>\r\n }\r\n\r\n <!-- Radio -->\r\n @if (type === typeField.radioInline || type === typeField.radio) {\r\n <fieldset\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\">\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </legend>\r\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.radioInline ? 'd-flex-h gap-md flex-wrap' : 'd-flex-v'\">\r\n @for (opt of options; track opt.value) {\r\n <li class=\"field-check\">\r\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" [formControl]=\"formControl\"\r\n class=\"field-check-input\" [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" (change)=\"onRadioChange(opt.value)\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">{{ opt.label | translate }}</label>\r\n </li>\r\n }\r\n </ul>\r\n </fieldset>\r\n }\r\n\r\n <!-- Radio button -->\r\n @if (type === typeField.radioButton) {\r\n <fieldset\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\">\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </legend>\r\n <div class=\"field-group field-group-btn\">\r\n @for (opt of options; track opt.value) {\r\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" [formControl]=\"formControl\"\r\n class=\"visually-hidden\" [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" (change)=\"onRadioChange(opt.value)\"/>\r\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">{{ opt.label | translate }}</label>\r\n }\r\n </div>\r\n </fieldset>\r\n }\r\n\r\n <!-- Checkbox Switch -->\r\n @if ( type === typeField.switch || type === typeField.switchSmall)\r\n {\r\n <div class=\"field-check field-switch\" [ngClass]=\"{'field-switch-small': type === typeField.switchSmall}\">\r\n <input type=\"checkbox\" [id]=\"name\" [formControl]=\"formControl\" class=\"field-check-input\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"/>\r\n <label [for]=\"name\" class=\"field-check-label\">{{ label | translate }}</label>\r\n </div>\r\n }\r\n\r\n <!-- Checkbox -->\r\n @if (type === typeField.checkboxInline || type === typeField.checkbox) {\r\n @if (isSingleCheckbox()) {\r\n <div class=\"field-check\" [class.field-check-inline]=\"type === typeField.checkboxInline\">\r\n <input #checkboxInput type=\"checkbox\" [id]=\"name\" [formControl]=\"formControl\"\r\n class=\"field-check-input\"\r\n [class.is-invalid]=\"control?.invalid && control?.touched\"\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control?.invalid && control?.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" />\r\n <label [for]=\"name\" class=\"field-check-label\">\r\n {{ label | translate }}\r\n @if (isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </label>\r\n </div>\r\n }\r\n @else if( options.length > 1) {\r\n <fieldset\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n [ngClass]=\"{ 'flex-column': type === typeField.checkbox }\">\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </legend>\r\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.checkboxInline ? 'd-flex-h gap-md' : 'd-flex-v'\">\r\n @for (opt of options; track opt.value) {\r\n <li class=\"field-check\" [ngClass]=\"{ 'field-check-inline': type === typeField.checkboxInline }\">\r\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\r\n [checked]=\"control.value?.includes(opt.value)\" class=\"field-check-input\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">\r\n {{ opt.label | translate }}\r\n </label>\r\n </li>\r\n }\r\n </ul>\r\n </fieldset>\r\n }\r\n @else {\r\n <fieldset>\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n </legend>\r\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.checkboxInline ? 'd-flex-h gap-md' : 'd-flex-v'\">\r\n @for (opt of options; track opt.value) {\r\n <li class=\"field-check\" [ngClass]=\"{ 'field-check-inline': type === typeField.checkboxInline }\">\r\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\r\n [checked]=\"control.value?.includes(opt.value)\" class=\"field-check-input\"\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">\r\n {{ opt.label | translate }}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </label>\r\n </li>\r\n }\r\n </ul>\r\n </fieldset>\r\n }\r\n }\r\n\r\n <!-- Checkbox button -->\r\n @if (type === typeField.checkboxButton && options.length > 0) {\r\n\r\n @if(options.length > 1) {\r\n <fieldset\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\">\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </legend>\r\n <div class=\"field-group field-group-btn\">\r\n @for (opt of options; track opt.value) {\r\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\r\n [checked]=\"control.value?.includes(opt.value)\" class=\"visually-hidden\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">{{ opt.label | translate }}</label>\r\n }\r\n </div>\r\n </fieldset>\r\n }\r\n @else {\r\n <fieldset>\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n </legend>\r\n <div class=\"btn-group btn-group-secondary\">\r\n @for (opt of options; track opt.value) {\r\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\r\n [checked]=\"control.value?.includes(opt.value)\" class=\"visually-hidden\"\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"/>\r\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">\r\n {{ opt.label | translate}}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </label>\r\n }\r\n </div>\r\n </fieldset>\r\n }\r\n }\r\n\r\n <!-- Period - DateToDate / TimeToTime / DateTimeToDateTime -->\r\n @if ([typeField.dateToDate, typeField.timeToTime, typeField.dateTimeToDateTime].includes(type) && isRange) {\r\n\r\n <div class=\"field-group\">\r\n <input [type]=\"getInputType()\" class=\"field-control\" [id]=\"name + '_start'\" [formControl]=\"getControl('start')\"\r\n [attr.placeholder]=\"type === typeField.timeToTime ? ('_COMMON._DATES.FROM' | translate) : ('_COMMON._DATES.FROM_TO_1' | translate)\"\r\n [ngClass]=\"[(cssClass || ''), getControl('start')?.value ? 'has-value' : '']\"\r\n [attr.required]=\"isRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.aria-required]=\"isRequired\"\r\n [attr.min]=\"minStartAttr\" [attr.max]=\"maxStartAttr\" [attr.step]=\"stepAttr\"\r\n [attr.aria-invalid]=\"getControl('start')?.invalid && getControl('start')?.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(getControl('start'))\" />\r\n\r\n @if(getControl('start')?.value && !isEffectivelyDisabled) {\r\n <button type=\"button\" class=\"btn btn-secondary btn-clear-field\"\r\n (click)=\"onClearFieldPeriod('start')\">\r\n ×\r\n </button>\r\n }\r\n\r\n <input [type]=\"getInputType()\" class=\"field-control\" [id]=\"name + '_end'\" [formControl]=\"getControl('end')\"\r\n [attr.placeholder]=\"type === typeField.timeToTime ? ('_COMMON._DATES.TO' | translate) : ('_COMMON._DATES.FROM_TO_2' | translate)\"\r\n [ngClass]=\"[(cssClass || ''), getControl('end')?.value ? 'has-value' : '']\"\r\n [attr.required]=\"isRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"\r\n [attr.min]=\"minEndAttr\" [attr.max]=\"maxEndAttr\" [attr.step]=\"stepAttr\"\r\n [attr.aria-invalid]=\"getControl('end')?.invalid && getControl('end')?.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(getControl('end'))\" />\r\n\r\n @if(getControl('end')?.value && !isEffectivelyDisabled) {\r\n <button type=\"button\" class=\"btn btn-secondary btn-clear-field\"\r\n (click)=\"onClearFieldPeriod('end')\">\r\n ×\r\n </button>\r\n }\r\n </div>\r\n }\r\n\r\n @if ([typeField.datePlusOne, typeField.datePlusTwo, typeField.datePlusSeven, typeField.dateComplexe].includes(type)) {\r\n\r\n @if (type === typeField.dateComplexe) {\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onDateAddDay('prev')\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.nextLeft\" [label]=\"'Jour pr\u00E9c\u00E9dent'\"></cw-icon>\r\n </button>\r\n }\r\n\r\n <input type=\"date\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\r\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\r\n [attr.placeholder]=\"placeholder ? placeholder : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [disabled]=\"isEffectivelyDisabled\" [attr.aria-required]=\"isRequired\"\r\n [attr.min]=\"minAttr\" [attr.max]=\"maxAttr\" [attr.step]=\"stepAttr\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\" />\r\n\r\n @if(formControl?.value && !isEffectivelyDisabled) {\r\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\"\r\n (click)=\"onClearField(formControl)\">×</button>\r\n }\r\n\r\n @if (type === typeField.dateComplexe) {\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onDateAddDay('next')\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.nextRight\" [label]=\"'Jour suivant'\"></cw-icon>\r\n </button>\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onRefresh()\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.toolbarRefresh\" [label]=\"'Rafra\u00EEchir'\"></cw-icon>\r\n </button>\r\n }\r\n\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onTodayAddDay(0)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n J\r\n <span class=\"visually-hidden\">Aujourd'hui</span>\r\n </button>\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onTodayAddDay(1)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n J+1\r\n <span class=\"visually-hidden\">Demain</span>\r\n </button>\r\n\r\n @if (type !== typeField.datePlusOne && type !== typeField.dateComplexe) {\r\n <button class=\"btn btn-secondary \" type=\"button\" (click)=\"onTodayAddDay(2)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n J+2\r\n <span class=\"visually-hidden\">Dans 2 jours</span>\r\n </button>\r\n\r\n @if (type !== typeField.datePlusTwo) {\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onTodayAddDay(7)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n J+7\r\n <span class=\"visually-hidden\">Dans 7 jours</span>\r\n </button>\r\n }\r\n }\r\n }\r\n\r\n @if (type === typeField.slider) {\r\n <ngx-slider [(value)]=\"sliderValue\" [options]=\"sliderOptions\" [formControl]=\"formControl\"></ngx-slider>\r\n }\r\n\r\n @if (type === typeField.range) {\r\n <div class=\"slider\">\r\n\r\n <cw-button [isDisabled]=\"formControl.value <= rangeOptions.floor\" [label]=\"'Diminuer ' + formControl.value + ' ' + label\"\r\n [withIcon]=\"spriteIcon.toolbarMinus\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\"\r\n [iconSize]=\"buttonIconSize.small\" (btnAction)=\"onRangeStep('decrease')\">\r\n </cw-button>\r\n\r\n <div class=\"slider-input\">\r\n <label [for]=\"name\" class=\"slider-tooltip\" [style.left]=\"getRangePercent() + '%'\" aria-live=\"polite\"\r\n aria-atomic=\"true\">\r\n {{ label | translate }} {{ formControl.value }}\r\n @if (rangeOptions.unit) {\r\n <abbr [title]=\"rangeOptions.unit\">{{ rangeOptions.unit }}</abbr>\r\n }\r\n </label>\r\n\r\n <div class=\"slider-custom-bar\">\r\n <div class=\"slider-custom-bar-selection\" [style.width]=\"getRangePercent() + '%'\">\r\n </div>\r\n </div>\r\n\r\n <input type=\"range\" [id]=\"name\" [formControl]=\"formControl\" [min]=\"rangeOptions.floor\" [max]=\"rangeOptions.ceil\"\r\n [step]=\"rangeOptions.step || 1\" class=\"field-control-range\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\" [disabled]=\"isEffectivelyDisabled\">\r\n </div>\r\n\r\n <cw-button [isDisabled]=\"formControl.value >= rangeOptions.ceil\" [label]=\"'Augmenter ' + formControl.value + ' ' + label\"\r\n [withIcon]=\"spriteIcon.toolbarPlus\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\"\r\n [iconSize]=\"buttonIconSize.small\" (btnAction)=\"onRangeStep('increase')\">\r\n </cw-button>\r\n </div>\r\n }\r\n\r\n @if (isInInputGroup() && clearable && !isEffectivelyDisabled) {\r\n @if(formControl?.value) {\r\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\"\r\n (click)=\"onClearField(formControl)\">×</button>\r\n }\r\n }\r\n\r\n</ng-template>\r\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: "directive", type: ShowHidePasswordDirective, selector: "[showHidePassword]" }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom", "spritePath"] }, { kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "id", "isDropdown", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "cssClass", "dataTest", "skeletonMode", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { kind: "pipe", type: i1.KeyValuePipe, name: "keyvalue" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
|
|
3225
|
+
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 }, 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 }, errorMessages: { classPropertyName: "errorMessages", publicName: "errorMessages", isSignal: false, isRequired: false, transformFunction: null }, isRequired: { classPropertyName: "isRequired", publicName: "isRequired", isSignal: false, isRequired: false, transformFunction: null }, help: { classPropertyName: "help", publicName: "help", isSignal: false, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", 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 }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { refreshEvent: "refreshEvent", textChanged: "textChanged", valueChange: "valueChange" }, 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 }], usesOnChanges: true, ngImport: i0, template: "@if (!isInAddon) {\r\n @if (\r\n type !== typeField.checkbox &&\r\n type !== typeField.radio &&\r\n type !== typeField.checkboxButton &&\r\n type !== typeField.radioButton &&\r\n type !== typeField.checkboxInline &&\r\n type !== typeField.radioInline &&\r\n type !== typeField.switch &&\r\n type !== typeField.range &&\r\n type !== typeField.switchSmall\r\n ) {\r\n <label [for]=\"name\" class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{ label | translate }}\r\n\r\n @if (isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n\r\n @if (tooltip) {\r\n <!-- <button type=\"button\" class=\"btn btn-link btn-popover\" placement=\"bottom\" [ngbPopover]=\"popContent\" container=\"body\"\r\n triggers=\"mouseenter:mouseleave\">\r\n <span class=\"btn-popover-icon bo-icons bo-help\"></span>\r\n </button>\r\n <ng-template #popContent>\r\n <div [innerHTML]=\"tooltip\"></div>\r\n </ng-template> -->\r\n }\r\n </label>\r\n }\r\n\r\n @if (addonLeft || addonRight) {\r\n <div class=\"field-group\">\r\n @if(addonLeft) {\r\n <ng-container [ngTemplateOutlet]=\"addonLeft\"></ng-container>\r\n }\r\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\r\n @if(addonRight) {\r\n <ng-container [ngTemplateOutlet]=\"addonRight\"></ng-container>\r\n }\r\n </div>\r\n }\r\n @else {\r\n @if ( isInInputGroup() ) {\r\n <div class=\"field-group\">\r\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\r\n </div>\r\n }\r\n @else {\r\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\r\n }\r\n }\r\n\r\n <!-- Error message -->\r\n @if (controlOrGroup?.invalid && controlOrGroup?.touched) {\r\n <div class=\"field-invalid\" [id]=\"'error-' + name\">\r\n @if (\r\n !errorMessages?.['required'] &&\r\n ((controlOrGroup?.errors?.['required']) || (getControl('start')?.errors?.['required'] || getControl('end')?.errors?.['required']))\r\n ) {\r\n <span [innerHtml]=\"'_COMMON._FORM.ERROR_IS_MANDATORY' | translate: {label: label | translate}\"></span>\r\n }\r\n @if (!errorMessages?.['rangeInvalid'] && controlOrGroup?.errors?.['rangeInvalid']) {\r\n <span>{{'_COMMON._DATES.ERROR_START_END_PERIOD' | translate}}</span>\r\n }\r\n @if (!errorMessages?.['fileExtension'] && controlOrGroup?.errors?.['fileExtension']) {\r\n <span>{{ '_COMMON._FORM.ERROR_FILE_EXTENSION' | translate: { accept: acceptLabel } }}</span>\r\n }\r\n @if (!errorMessages?.['fileSize'] && controlOrGroup?.errors?.['fileSize']) {\r\n <span>{{ '_COMMON._FORM.ERROR_FILE_SIZE' | translate: { maxSize: maxSizeLabel } }}</span>\r\n }\r\n @if (!errorMessages?.['email'] && controlOrGroup?.errors?.['email']) {\r\n <span>{{ '_COMMON._FORM.ERROR_INVALID_EMAIL' | translate }}</span>\r\n }\r\n @if (!errorMessages?.['phone'] && controlOrGroup?.errors?.['phone']) {\r\n <span>{{ '_COMMON._FORM.ERROR_INVALID_PHONE' | translate }}</span>\r\n }\r\n @if (errorMessages) {\r\n @for (entry of errorMessages | keyvalue: keepOrder; track entry.key) {\r\n @if (controlOrGroup?.errors?.[entry.key]; as errVal) {\r\n <span>{{ entry.value | translate: (errVal === true ? null : errVal) }}</span>\r\n }\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n @if (help || autoHelpEntries.length) {\r\n <div [id]=\"name + '-help'\" class=\"field-text\">\r\n @if (help) {\r\n <span>{{ help | translate }}</span>\r\n }\r\n @for (entry of autoHelpEntries; track entry.key) {\r\n <span>{{ entry.key | translate: entry.params }}</span>\r\n }\r\n </div>\r\n }\r\n}\r\n@else {\r\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\r\n}\r\n\r\n<ng-template #field>\r\n <!-- Autocomplete (mono / multi) -->\r\n @if ((type === typeField.autocomplete || type === typeField.autocompleteMultiple) && autocompleteOptions) {\r\n <cw-autocomplete\r\n [id]=\"name\"\r\n [control]=\"formControl\"\r\n [fetcher]=\"autocompleteOptions.fetcher\"\r\n [displayField]=\"autocompleteOptions.displayField ?? 'label'\"\r\n [valueField]=\"autocompleteOptions.valueField ?? 'id'\"\r\n [columns]=\"autocompleteOptions.columns ?? []\"\r\n [resolver]=\"autocompleteOptions.resolver ?? null\"\r\n [selectedItem]=\"autocompleteOptions.selectedItem ?? null\"\r\n [selectedItems]=\"autocompleteOptions.selectedItems ?? []\"\r\n [minChars]=\"autocompleteOptions.minChars ?? 2\"\r\n [debounceMs]=\"autocompleteOptions.debounceMs ?? 250\"\r\n [multiple]=\"type === typeField.autocompleteMultiple\"\r\n [isRequired]=\"isRequired\"\r\n [isReadonly]=\"!!isReadonly\"\r\n [isDisabled]=\"isEffectivelyDisabled\"\r\n [ariaInvalid]=\"control.invalid && control.touched\"\r\n [ariaDescribedBy]=\"getDescribedBy(control)\"\r\n [placeholder]=\"placeholder\">\r\n </cw-autocomplete>\r\n }\r\n\r\n <!-- Text -->\r\n @if ([typeField.text, typeField.date, typeField.time, typeField.dateTime, typeField.number,\r\n typeField.email,\r\n typeField.color, typeField.zipCode].includes(type)) {\r\n <input [type]=\"type === typeField.zipCode ? 'text' : type\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\r\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '', type === typeField.zipCode ? 'field-control-zipcode' : '']\"\r\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [attr.aria-required]=\"isRequired\"\r\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\"\r\n [attr.min]=\"minAttr\" [attr.max]=\"maxAttr\" [attr.step]=\"stepAttr\" [attr.pattern]=\"patternAttr\"\r\n [attr.autocomplete]=\"autocomplete\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\r\n }\r\n\r\n <!-- Phone (intl-tel-input) -->\r\n @if (type === typeField.phone) {\r\n <input #phoneInput type=\"tel\" class=\"field-control\" [id]=\"name\"\r\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [disabled]=\"isEffectivelyDisabled\" [attr.aria-required]=\"isRequired\"\r\n [attr.autocomplete]=\"autocomplete\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n (focus)=\"onFocus()\" (blur)=\"onPhoneBlur($event)\" />\r\n }\r\n\r\n <!-- File -->\r\n @if (type === typeField.file) {\r\n <input #fileInput type=\"file\" class=\"field-control\" [id]=\"name\"\r\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\r\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [disabled]=\"isEffectivelyDisabled\" [attr.aria-required]=\"isRequired\"\r\n [attr.accept]=\"acceptAttr\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n (change)=\"onFileChange($event)\" (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\r\n }\r\n\r\n @if (type === typeField.password) {\r\n <input [type]=\"isPasswordShown ? 'text' : 'password'\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\r\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\r\n [attr.required]=\"isRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.aria-required]=\"isRequired\"\r\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\" [attr.pattern]=\"patternAttr\"\r\n [attr.autocomplete]=\"autocomplete\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\r\n <cw-button [type]=\"buttonType.secondary\"\r\n [withIcon]=\"isPasswordShown ? spriteIcon.toolbarHidePassword : spriteIcon.toolbarShowPassword\"\r\n [withOnlyIcon]=\"true\"\r\n [label]=\"isPasswordShown ? '_COMMON._FORM._SHOW_HIDE_PWD.HIDE' : '_COMMON._FORM._SHOW_HIDE_PWD.SHOW'\"\r\n (btnAction)=\"togglePasswordVisibility()\">\r\n </cw-button>\r\n }\r\n\r\n <!-- Textarea -->\r\n @if (type === typeField.textarea) {\r\n <textarea class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\r\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\r\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"\r\n [attr.aria-required]=\"isRequired\" [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\" [attr.pattern]=\"patternAttr\"\r\n [attr.autocomplete]=\"autocomplete\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n (focus)=\"onFocus()\" (blur)=\"onBlur()\"></textarea>\r\n }\r\n\r\n <!-- Select -->\r\n @if (type === typeField.select) {\r\n <ng-select [formControl]=\"formControl\" [items]=\"options\" bindLabel=\"label\" [labelForId]=\"name\" [appendTo]=\"appendTo\" bindValue=\"value\"\r\n [ngClass]=\"cssClass\" [searchable]=\"false\" [placeholder]=\"placeholder ? (placeholder | translate) : null\" [readonly]=\"isReadonly\" [clearable]=\"false\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.aria-required]=\"isRequired\" [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\" [attr.id]=\"name\"\r\n (focus)=\"onFocus()\" (blur)=\"onBlur()\">\r\n\r\n <!-- Template pour les options -->\r\n <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\">\r\n @if (optionTemplate) {\r\n <ng-container *ngTemplateOutlet=\"optionTemplate; context: { item: item | translate, index: index, searchTerm: search }\"></ng-container>\r\n }\r\n @else {\r\n <div>{{ item.label | translate }}</div>\r\n }\r\n </ng-template>\r\n\r\n <!-- Template pour le label -->\r\n <ng-template ng-label-tmp let-item=\"item\">\r\n @if (labelTemplate) {\r\n <ng-container *ngTemplateOutlet=\"labelTemplate; context: { item: item | translate }\"></ng-container>\r\n }\r\n @else {\r\n {{ (item.label | translate) || (placeholder | translate) }}\r\n }\r\n </ng-template>\r\n </ng-select>\r\n }\r\n\r\n <!-- NgSelect -->\r\n @if (type === typeField.ngSelect || type === typeField.ngSelectMultiple) {\r\n <ng-select [formControl]=\"formControl\" [items]=\"options\" bindLabel=\"label\" [labelForId]=\"name\" [appendTo]=\"appendTo\" bindValue=\"value\"\r\n [multiple]=\"type === typeField.ngSelectMultiple\" [ngClass]=\"cssClass\" [clearable]=\"false\"\r\n [placeholder]=\"placeholder ? (placeholder | translate) : null\" [readonly]=\"isReadonly\"\r\n [notFoundText]=\"'_COMMON.NO_RESULT' | translate\" [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"\r\n [attr.required]=\"isRequired ? 'required' : null\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\" [attr.id]=\"name\"\r\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" (search)=\"textChanged.emit($event?.term)\">\r\n\r\n <!-- Template pour les options -->\r\n <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\">\r\n @if (optionTemplate) {\r\n <ng-container *ngTemplateOutlet=\"optionTemplate; context: { item: item, index: index, searchTerm: search }\"></ng-container>\r\n }\r\n @else {\r\n <div>{{ item.label | translate }}</div>\r\n }\r\n </ng-template>\r\n\r\n <!-- Template pour le label -->\r\n <ng-template ng-label-tmp let-item=\"item\" let-clear=\"clear\">\r\n <span class=\"ng-value-icon left\" (click)=\"clear(item)\" aria-hidden=\"true\">\u00D7</span>\r\n @if (labelTemplate) {\r\n <ng-container *ngTemplateOutlet=\"labelTemplate; context: { item: item | translate }\"></ng-container>\r\n }\r\n @else {\r\n {{ (item.label | translate) || (placeholder | translate) }}\r\n }\r\n </ng-template>\r\n </ng-select>\r\n }\r\n\r\n <!-- Radio -->\r\n @if (type === typeField.radioInline || type === typeField.radio) {\r\n <fieldset\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\">\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </legend>\r\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.radioInline ? 'd-flex-h gap-md flex-wrap' : 'd-flex-v'\">\r\n @for (opt of options; track opt.value) {\r\n <li class=\"field-check\">\r\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" [formControl]=\"formControl\"\r\n class=\"field-check-input\" [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" (change)=\"onRadioChange(opt.value)\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">{{ opt.label | translate }}</label>\r\n </li>\r\n }\r\n </ul>\r\n </fieldset>\r\n }\r\n\r\n <!-- Radio button -->\r\n @if (type === typeField.radioButton) {\r\n <fieldset\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\">\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </legend>\r\n <div class=\"field-group field-group-btn\">\r\n @for (opt of options; track opt.value) {\r\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" [formControl]=\"formControl\"\r\n class=\"visually-hidden\" [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" (change)=\"onRadioChange(opt.value)\"/>\r\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">{{ opt.label | translate }}</label>\r\n }\r\n </div>\r\n </fieldset>\r\n }\r\n\r\n <!-- Checkbox Switch -->\r\n @if ( type === typeField.switch || type === typeField.switchSmall)\r\n {\r\n <div class=\"field-check field-switch\" [ngClass]=\"{'field-switch-small': type === typeField.switchSmall}\">\r\n <input type=\"checkbox\" [id]=\"name\" [formControl]=\"formControl\" class=\"field-check-input\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"/>\r\n <label [for]=\"name\" class=\"field-check-label\">{{ label | translate }}</label>\r\n </div>\r\n }\r\n\r\n <!-- Checkbox -->\r\n @if (type === typeField.checkboxInline || type === typeField.checkbox) {\r\n @if (isSingleCheckbox()) {\r\n <div class=\"field-check\" [class.field-check-inline]=\"type === typeField.checkboxInline\">\r\n <input #checkboxInput type=\"checkbox\" [id]=\"name\" [formControl]=\"formControl\"\r\n class=\"field-check-input\"\r\n [class.is-invalid]=\"control?.invalid && control?.touched\"\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control?.invalid && control?.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" />\r\n <label [for]=\"name\" class=\"field-check-label\">\r\n {{ label | translate }}\r\n @if (isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </label>\r\n </div>\r\n }\r\n @else if( options.length > 1) {\r\n <fieldset\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n [ngClass]=\"{ 'flex-column': type === typeField.checkbox }\">\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </legend>\r\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.checkboxInline ? 'd-flex-h gap-md' : 'd-flex-v'\">\r\n @for (opt of options; track opt.value) {\r\n <li class=\"field-check\" [ngClass]=\"{ 'field-check-inline': type === typeField.checkboxInline }\">\r\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\r\n [checked]=\"control.value?.includes(opt.value)\" class=\"field-check-input\"\r\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">\r\n {{ opt.label | translate }}\r\n </label>\r\n </li>\r\n }\r\n </ul>\r\n </fieldset>\r\n }\r\n @else {\r\n <fieldset>\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n </legend>\r\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.checkboxInline ? 'd-flex-h gap-md' : 'd-flex-v'\">\r\n @for (opt of options; track opt.value) {\r\n <li class=\"field-check\" [ngClass]=\"{ 'field-check-inline': type === typeField.checkboxInline }\">\r\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\r\n [checked]=\"control.value?.includes(opt.value)\" class=\"field-check-input\"\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">\r\n {{ opt.label | translate }}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </label>\r\n </li>\r\n }\r\n </ul>\r\n </fieldset>\r\n }\r\n }\r\n\r\n <!-- Checkbox button -->\r\n @if (type === typeField.checkboxButton && options.length > 0) {\r\n\r\n @if(options.length > 1) {\r\n <fieldset\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\">\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </legend>\r\n <div class=\"field-group field-group-btn\">\r\n @for (opt of options; track opt.value) {\r\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\r\n [checked]=\"control.value?.includes(opt.value)\" class=\"visually-hidden\"\r\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">{{ opt.label | translate }}</label>\r\n }\r\n </div>\r\n </fieldset>\r\n }\r\n @else {\r\n <fieldset>\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n </legend>\r\n <div class=\"btn-group btn-group-secondary\">\r\n @for (opt of options; track opt.value) {\r\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\r\n [checked]=\"control.value?.includes(opt.value)\" class=\"visually-hidden\"\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\"/>\r\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">\r\n {{ opt.label | translate}}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </label>\r\n }\r\n </div>\r\n </fieldset>\r\n }\r\n }\r\n\r\n <!-- Period - DateToDate / TimeToTime / DateTimeToDateTime -->\r\n @if ([typeField.dateToDate, typeField.timeToTime, typeField.dateTimeToDateTime].includes(type) && isRange) {\r\n\r\n <div class=\"field-group\">\r\n <div class=\"field-group-text\">Du</div>\r\n <input [type]=\"getInputType()\" class=\"field-control\" [id]=\"name + '_start'\" [formControl]=\"getControl('start')\"\r\n [attr.placeholder]=\"type === typeField.timeToTime ? ('_COMMON._DATES.FROM' | translate) : ('_COMMON._DATES.FROM_TO_1' | translate)\"\r\n [ngClass]=\"[(cssClass || ''), getControl('start')?.value ? 'has-value' : '']\"\r\n [attr.required]=\"isRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.aria-required]=\"isRequired\"\r\n [attr.min]=\"minStartAttr\" [attr.max]=\"maxStartAttr\" [attr.step]=\"stepAttr\"\r\n [attr.autocomplete]=\"autocomplete\"\r\n [attr.aria-invalid]=\"getControl('start')?.invalid && getControl('start')?.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(getControl('start'))\"\r\n (focus)=\"onFocusRange('start')\" />\r\n\r\n @if(getControl('start')?.value && !isEffectivelyDisabled) {\r\n <button type=\"button\" class=\"btn btn-secondary btn-clear-field\"\r\n (click)=\"onClearFieldPeriod('start')\">\r\n ×\r\n </button>\r\n }\r\n <div class=\"field-group-text\">au</div>\r\n <input [type]=\"getInputType()\" class=\"field-control\" [id]=\"name + '_end'\" [formControl]=\"getControl('end')\"\r\n [attr.placeholder]=\"type === typeField.timeToTime ? ('_COMMON._DATES.TO' | translate) : ('_COMMON._DATES.FROM_TO_2' | translate)\"\r\n [ngClass]=\"[(cssClass || ''), getControl('end')?.value ? 'has-value' : '']\"\r\n [attr.required]=\"isRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"\r\n [attr.min]=\"minEndAttr\" [attr.max]=\"maxEndAttr\" [attr.step]=\"stepAttr\"\r\n [attr.autocomplete]=\"autocomplete\"\r\n [attr.aria-invalid]=\"getControl('end')?.invalid && getControl('end')?.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(getControl('end'))\"\r\n (focus)=\"onFocusRange('end')\" />\r\n\r\n @if(getControl('end')?.value && !isEffectivelyDisabled) {\r\n <button type=\"button\" class=\"btn btn-secondary btn-clear-field\"\r\n (click)=\"onClearFieldPeriod('end')\">\r\n ×\r\n </button>\r\n }\r\n </div>\r\n }\r\n\r\n @if ([typeField.datePlusOne, typeField.datePlusTwo, typeField.datePlusSeven, typeField.dateComplexe].includes(type)) {\r\n\r\n <div class=\"field-group\">\r\n @if (type === typeField.dateComplexe) {\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onDateAddDay('prev')\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.nextLeft\" [label]=\"'Jour pr\u00E9c\u00E9dent'\"></cw-icon>\r\n </button>\r\n }\r\n\r\n <input type=\"date\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\r\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\r\n [attr.placeholder]=\"placeholder ? placeholder : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [attr.aria-required]=\"isRequired\"\r\n [attr.min]=\"minAttr\" [attr.max]=\"maxAttr\" [attr.step]=\"stepAttr\"\r\n [attr.autocomplete]=\"autocomplete\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\r\n\r\n @if(formControl?.value && !isEffectivelyDisabled) {\r\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\"\r\n (click)=\"onClearField(formControl)\">×</button>\r\n }\r\n\r\n @if (type === typeField.dateComplexe) {\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onDateAddDay('next')\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.nextRight\" [label]=\"'Jour suivant'\"></cw-icon>\r\n </button>\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onRefresh()\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.toolbarRefresh\" [label]=\"'Rafra\u00EEchir'\"></cw-icon>\r\n </button>\r\n }\r\n\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onTodayAddDay(0)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n J\r\n <span class=\"visually-hidden\">Aujourd'hui</span>\r\n </button>\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onTodayAddDay(1)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n J+1\r\n <span class=\"visually-hidden\">Demain</span>\r\n </button>\r\n\r\n @if (type !== typeField.datePlusOne && type !== typeField.dateComplexe) {\r\n <button class=\"btn btn-secondary \" type=\"button\" (click)=\"onTodayAddDay(2)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n J+2\r\n <span class=\"visually-hidden\">Dans 2 jours</span>\r\n </button>\r\n\r\n @if (type !== typeField.datePlusTwo) {\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onTodayAddDay(7)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n J+7\r\n <span class=\"visually-hidden\">Dans 7 jours</span>\r\n </button>\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n @if (type === typeField.slider) {\r\n <ngx-slider [(value)]=\"sliderValue\" [options]=\"sliderOptions\" [formControl]=\"formControl\"></ngx-slider>\r\n }\r\n\r\n @if (type === typeField.range) {\r\n <div class=\"slider\">\r\n\r\n <cw-button [isDisabled]=\"formControl.value <= rangeOptions.floor\" [label]=\"'Diminuer ' + formControl.value + ' ' + label\"\r\n [withIcon]=\"spriteIcon.toolbarMinus\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\"\r\n [iconSize]=\"buttonIconSize.small\" (btnAction)=\"onRangeStep('decrease')\">\r\n </cw-button>\r\n\r\n <div class=\"slider-input\">\r\n <label [for]=\"name\" class=\"slider-tooltip\" [style.left]=\"getRangePercent() + '%'\" aria-live=\"polite\"\r\n aria-atomic=\"true\">\r\n {{ label | translate }} {{ formControl.value }}\r\n @if (rangeOptions.unit) {\r\n <abbr [title]=\"rangeOptions.unit\">{{ rangeOptions.unit }}</abbr>\r\n }\r\n </label>\r\n\r\n <div class=\"slider-custom-bar\">\r\n <div class=\"slider-custom-bar-selection\" [style.width]=\"getRangePercent() + '%'\">\r\n </div>\r\n </div>\r\n\r\n <input type=\"range\" [id]=\"name\" [formControl]=\"formControl\" [min]=\"rangeOptions.floor\" [max]=\"rangeOptions.ceil\"\r\n [step]=\"rangeOptions.step || 1\" class=\"field-control-range\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\">\r\n </div>\r\n\r\n <cw-button [isDisabled]=\"formControl.value >= rangeOptions.ceil\" [label]=\"'Augmenter ' + formControl.value + ' ' + label\"\r\n [withIcon]=\"spriteIcon.toolbarPlus\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\"\r\n [iconSize]=\"buttonIconSize.small\" (btnAction)=\"onRangeStep('increase')\">\r\n </cw-button>\r\n </div>\r\n }\r\n\r\n @if (isInInputGroup() && clearable && !isEffectivelyDisabled && type !== typeField.autocompleteMultiple && type !== typeField.ngSelectMultiple) {\r\n @if (type === typeField.autocomplete) {\r\n @if (autocompleteRef()?.hasAnyContent()) {\r\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\"\r\n (click)=\"autocompleteRef()!.clear()\">×</button>\r\n }\r\n } @else {\r\n @if(formControl?.value) {\r\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\"\r\n (click)=\"onClearField(formControl)\">×</button>\r\n }\r\n }\r\n }\r\n\r\n</ng-template>\r\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", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom", "spritePath"] }, { kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "cssClass", "dataTest", "skeletonMode", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { 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: "pipe", type: i1.KeyValuePipe, name: "keyvalue" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
|
|
2299
3226
|
}
|
|
2300
3227
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: FormFieldComponent, decorators: [{
|
|
2301
3228
|
type: Component,
|
|
@@ -2306,10 +3233,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImpo
|
|
|
2306
3233
|
ReactiveFormsModule,
|
|
2307
3234
|
NgSelectModule,
|
|
2308
3235
|
NgxSliderModule,
|
|
2309
|
-
ShowHidePasswordDirective,
|
|
2310
3236
|
IconComponent,
|
|
2311
|
-
ButtonComponent
|
|
2312
|
-
], template: "@if (!isInAddon) {\r\n @if (\r\n type !== typeField.checkbox &&\r\n type !== typeField.radio &&\r\n type !== typeField.checkboxButton &&\r\n type !== typeField.radioButton &&\r\n type !== typeField.checkboxInline &&\r\n type !== typeField.radioInline &&\r\n type !== typeField.switch &&\r\n type !== typeField.range &&\r\n type !== typeField.switchSmall\r\n ) {\r\n <label [for]=\"name\" class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{ label | translate }}\r\n\r\n @if (isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n\r\n @if (tooltip) {\r\n <!-- <button type=\"button\" class=\"btn btn-link btn-popover\" placement=\"bottom\" [ngbPopover]=\"popContent\" container=\"body\"\r\n triggers=\"mouseenter:mouseleave\">\r\n <span class=\"btn-popover-icon bo-icons bo-help\"></span>\r\n </button>\r\n <ng-template #popContent>\r\n <div [innerHTML]=\"tooltip\"></div>\r\n </ng-template> -->\r\n }\r\n </label>\r\n }\r\n\r\n @if (addonLeft || addonRight) {\r\n <div class=\"field-group\">\r\n @if(addonLeft) {\r\n <ng-container [ngTemplateOutlet]=\"addonLeft\"></ng-container>\r\n }\r\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\r\n @if(addonRight) {\r\n <ng-container [ngTemplateOutlet]=\"addonRight\"></ng-container>\r\n }\r\n </div>\r\n }\r\n @else {\r\n @if ( isInInputGroup() ) {\r\n <div class=\"field-group\">\r\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\r\n </div>\r\n }\r\n @else {\r\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\r\n }\r\n }\r\n\r\n <!-- Error message -->\r\n @if (controlOrGroup?.invalid && controlOrGroup?.touched) {\r\n <div class=\"field-invalid\" [id]=\"'error-' + name\">\r\n @if (\r\n !errorMessages?.['required'] &&\r\n ((controlOrGroup?.errors?.['required']) || (getControl('start')?.errors?.['required'] || getControl('end')?.errors?.['required']))\r\n ) {\r\n <span [innerHtml]=\"'_COMMON._FORM.ERROR_IS_MANDATORY' | translate: {label: label | translate}\"></span>\r\n }\r\n @if (!errorMessages?.['rangeInvalid'] && controlOrGroup?.errors?.['rangeInvalid']) {\r\n <span>{{'_COMMON._DATES.ERROR_START_END_PERIOD' | translate}}</span>\r\n }\r\n @if (!errorMessages?.['fileExtension'] && controlOrGroup?.errors?.['fileExtension']) {\r\n <span>{{ '_COMMON._FORM.ERROR_FILE_EXTENSION' | translate: { accept: acceptLabel } }}</span>\r\n }\r\n @if (!errorMessages?.['fileSize'] && controlOrGroup?.errors?.['fileSize']) {\r\n <span>{{ '_COMMON._FORM.ERROR_FILE_SIZE' | translate: { maxSize: maxSizeLabel } }}</span>\r\n }\r\n @if (errorMessages) {\r\n @for (entry of errorMessages | keyvalue: keepOrder; track entry.key) {\r\n @if (controlOrGroup?.errors?.[entry.key]; as errVal) {\r\n <span>{{ entry.value | translate: (errVal === true ? null : errVal) }}</span>\r\n }\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n @if (help || autoHelpEntries.length) {\r\n <div [id]=\"name + '-help'\" class=\"field-text\">\r\n @if (help) {\r\n <div>{{ help | translate }}</div>\r\n }\r\n @for (entry of autoHelpEntries; track entry.key) {\r\n <div>{{ entry.key | translate: entry.params }}</div>\r\n }\r\n </div>\r\n }\r\n}\r\n@else {\r\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\r\n}\r\n\r\n<ng-template #field>\r\n <!-- Text -->\r\n @if ([typeField.text, typeField.date, typeField.time, typeField.dateTime, typeField.number,\r\n typeField.email,\r\n typeField.color].includes(type)) {\r\n <input [type]=\"type\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\r\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\r\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [disabled]=\"isEffectivelyDisabled\" [attr.aria-required]=\"isRequired\"\r\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\"\r\n [attr.min]=\"minAttr\" [attr.max]=\"maxAttr\" [attr.step]=\"stepAttr\" [attr.pattern]=\"patternAttr\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\" />\r\n }\r\n\r\n <!-- File -->\r\n @if (type === typeField.file) {\r\n <input #fileInput type=\"file\" class=\"field-control\" [id]=\"name\"\r\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\r\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [disabled]=\"isEffectivelyDisabled\" [attr.aria-required]=\"isRequired\"\r\n [attr.accept]=\"acceptAttr\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n (change)=\"onFileChange($event)\" (blur)=\"onBlur()\" />\r\n }\r\n\r\n @if (type === typeField.password) {\r\n <input showHidePassword [type]=\"type\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\r\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\r\n [attr.required]=\"isRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.aria-required]=\"isRequired\"\r\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\" [attr.pattern]=\"patternAttr\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\" />\r\n }\r\n\r\n <!-- Textarea -->\r\n @if (type === typeField.textarea) {\r\n <textarea class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\r\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\r\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"\r\n [attr.aria-required]=\"isRequired\" [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\" [attr.pattern]=\"patternAttr\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"></textarea>\r\n }\r\n\r\n <!-- Select -->\r\n @if (type === typeField.select) {\r\n <ng-select [formControl]=\"formControl\" [items]=\"options\" bindLabel=\"label\" [labelForId]=\"name\" [appendTo]=\"appendTo\" bindValue=\"value\"\r\n [ngClass]=\"cssClass\" [searchable]=\"false\" [placeholder]=\"placeholder ? (placeholder | translate) : null\" [readonly]=\"isReadonly\" [clearable]=\"false\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.aria-required]=\"isRequired\" [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\" [attr.id]=\"name\"\r\n (blur)=\"onBlur()\">\r\n\r\n <!-- Template pour les options -->\r\n <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\">\r\n @if (optionTemplate) {\r\n <ng-container *ngTemplateOutlet=\"optionTemplate; context: { item: item | translate, index: index, searchTerm: search }\"></ng-container>\r\n }\r\n @else {\r\n <div>{{ item.label | translate }}</div>\r\n }\r\n </ng-template>\r\n\r\n <!-- Template pour le label -->\r\n <ng-template ng-label-tmp let-item=\"item\">\r\n @if (labelTemplate) {\r\n <ng-container *ngTemplateOutlet=\"labelTemplate; context: { item: item | translate }\"></ng-container>\r\n }\r\n @else {\r\n {{ (item.label | translate) || (placeholder | translate) }}\r\n }\r\n </ng-template>\r\n </ng-select>\r\n }\r\n\r\n <!-- NgSelect -->\r\n @if (type === typeField.ngSelect || type === typeField.ngSelectMultiple) {\r\n <ng-select [formControl]=\"formControl\" [items]=\"options\" bindLabel=\"label\" [labelForId]=\"name\" [appendTo]=\"appendTo\" bindValue=\"value\"\r\n [multiple]=\"type === typeField.ngSelectMultiple\" [ngClass]=\"cssClass\" [clearable]=\"false\"\r\n [placeholder]=\"placeholder ? (placeholder | translate) : null\" [readonly]=\"isReadonly\"\r\n [notFoundText]=\"'_COMMON.NO_RESULT' | translate\" [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"\r\n [attr.required]=\"isRequired ? 'required' : null\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\" [attr.id]=\"name\"\r\n (blur)=\"onBlur()\" (search)=\"textChanged.emit($event?.term)\">\r\n\r\n <!-- Template pour les options -->\r\n <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\">\r\n @if (optionTemplate) {\r\n <ng-container *ngTemplateOutlet=\"optionTemplate; context: { item: item, index: index, searchTerm: search }\"></ng-container>\r\n }\r\n @else {\r\n <div>{{ item.label | translate }}</div>\r\n }\r\n </ng-template>\r\n\r\n <!-- Template pour le label -->\r\n <ng-template ng-label-tmp let-item=\"item\" let-clear=\"clear\">\r\n <span class=\"ng-value-icon left\" (click)=\"clear(item)\" aria-hidden=\"true\">\u00D7</span>\r\n @if (labelTemplate) {\r\n <ng-container *ngTemplateOutlet=\"labelTemplate; context: { item: item | translate }\"></ng-container>\r\n }\r\n @else {\r\n {{ (item.label | translate) || (placeholder | translate) }}\r\n }\r\n </ng-template>\r\n </ng-select>\r\n }\r\n\r\n <!-- Radio -->\r\n @if (type === typeField.radioInline || type === typeField.radio) {\r\n <fieldset\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\">\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </legend>\r\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.radioInline ? 'd-flex-h gap-md flex-wrap' : 'd-flex-v'\">\r\n @for (opt of options; track opt.value) {\r\n <li class=\"field-check\">\r\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" [formControl]=\"formControl\"\r\n class=\"field-check-input\" [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" (change)=\"onRadioChange(opt.value)\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">{{ opt.label | translate }}</label>\r\n </li>\r\n }\r\n </ul>\r\n </fieldset>\r\n }\r\n\r\n <!-- Radio button -->\r\n @if (type === typeField.radioButton) {\r\n <fieldset\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\">\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </legend>\r\n <div class=\"field-group field-group-btn\">\r\n @for (opt of options; track opt.value) {\r\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" [formControl]=\"formControl\"\r\n class=\"visually-hidden\" [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" (change)=\"onRadioChange(opt.value)\"/>\r\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">{{ opt.label | translate }}</label>\r\n }\r\n </div>\r\n </fieldset>\r\n }\r\n\r\n <!-- Checkbox Switch -->\r\n @if ( type === typeField.switch || type === typeField.switchSmall)\r\n {\r\n <div class=\"field-check field-switch\" [ngClass]=\"{'field-switch-small': type === typeField.switchSmall}\">\r\n <input type=\"checkbox\" [id]=\"name\" [formControl]=\"formControl\" class=\"field-check-input\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"/>\r\n <label [for]=\"name\" class=\"field-check-label\">{{ label | translate }}</label>\r\n </div>\r\n }\r\n\r\n <!-- Checkbox -->\r\n @if (type === typeField.checkboxInline || type === typeField.checkbox) {\r\n @if (isSingleCheckbox()) {\r\n <div class=\"field-check\" [class.field-check-inline]=\"type === typeField.checkboxInline\">\r\n <input #checkboxInput type=\"checkbox\" [id]=\"name\" [formControl]=\"formControl\"\r\n class=\"field-check-input\"\r\n [class.is-invalid]=\"control?.invalid && control?.touched\"\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control?.invalid && control?.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" />\r\n <label [for]=\"name\" class=\"field-check-label\">\r\n {{ label | translate }}\r\n @if (isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </label>\r\n </div>\r\n }\r\n @else if( options.length > 1) {\r\n <fieldset\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n [ngClass]=\"{ 'flex-column': type === typeField.checkbox }\">\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </legend>\r\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.checkboxInline ? 'd-flex-h gap-md' : 'd-flex-v'\">\r\n @for (opt of options; track opt.value) {\r\n <li class=\"field-check\" [ngClass]=\"{ 'field-check-inline': type === typeField.checkboxInline }\">\r\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\r\n [checked]=\"control.value?.includes(opt.value)\" class=\"field-check-input\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">\r\n {{ opt.label | translate }}\r\n </label>\r\n </li>\r\n }\r\n </ul>\r\n </fieldset>\r\n }\r\n @else {\r\n <fieldset>\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n </legend>\r\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.checkboxInline ? 'd-flex-h gap-md' : 'd-flex-v'\">\r\n @for (opt of options; track opt.value) {\r\n <li class=\"field-check\" [ngClass]=\"{ 'field-check-inline': type === typeField.checkboxInline }\">\r\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\r\n [checked]=\"control.value?.includes(opt.value)\" class=\"field-check-input\"\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">\r\n {{ opt.label | translate }}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </label>\r\n </li>\r\n }\r\n </ul>\r\n </fieldset>\r\n }\r\n }\r\n\r\n <!-- Checkbox button -->\r\n @if (type === typeField.checkboxButton && options.length > 0) {\r\n\r\n @if(options.length > 1) {\r\n <fieldset\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\">\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </legend>\r\n <div class=\"field-group field-group-btn\">\r\n @for (opt of options; track opt.value) {\r\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\r\n [checked]=\"control.value?.includes(opt.value)\" class=\"visually-hidden\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">{{ opt.label | translate }}</label>\r\n }\r\n </div>\r\n </fieldset>\r\n }\r\n @else {\r\n <fieldset>\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n </legend>\r\n <div class=\"btn-group btn-group-secondary\">\r\n @for (opt of options; track opt.value) {\r\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\r\n [checked]=\"control.value?.includes(opt.value)\" class=\"visually-hidden\"\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"/>\r\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">\r\n {{ opt.label | translate}}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </label>\r\n }\r\n </div>\r\n </fieldset>\r\n }\r\n }\r\n\r\n <!-- Period - DateToDate / TimeToTime / DateTimeToDateTime -->\r\n @if ([typeField.dateToDate, typeField.timeToTime, typeField.dateTimeToDateTime].includes(type) && isRange) {\r\n\r\n <div class=\"field-group\">\r\n <input [type]=\"getInputType()\" class=\"field-control\" [id]=\"name + '_start'\" [formControl]=\"getControl('start')\"\r\n [attr.placeholder]=\"type === typeField.timeToTime ? ('_COMMON._DATES.FROM' | translate) : ('_COMMON._DATES.FROM_TO_1' | translate)\"\r\n [ngClass]=\"[(cssClass || ''), getControl('start')?.value ? 'has-value' : '']\"\r\n [attr.required]=\"isRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.aria-required]=\"isRequired\"\r\n [attr.min]=\"minStartAttr\" [attr.max]=\"maxStartAttr\" [attr.step]=\"stepAttr\"\r\n [attr.aria-invalid]=\"getControl('start')?.invalid && getControl('start')?.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(getControl('start'))\" />\r\n\r\n @if(getControl('start')?.value && !isEffectivelyDisabled) {\r\n <button type=\"button\" class=\"btn btn-secondary btn-clear-field\"\r\n (click)=\"onClearFieldPeriod('start')\">\r\n ×\r\n </button>\r\n }\r\n\r\n <input [type]=\"getInputType()\" class=\"field-control\" [id]=\"name + '_end'\" [formControl]=\"getControl('end')\"\r\n [attr.placeholder]=\"type === typeField.timeToTime ? ('_COMMON._DATES.TO' | translate) : ('_COMMON._DATES.FROM_TO_2' | translate)\"\r\n [ngClass]=\"[(cssClass || ''), getControl('end')?.value ? 'has-value' : '']\"\r\n [attr.required]=\"isRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"\r\n [attr.min]=\"minEndAttr\" [attr.max]=\"maxEndAttr\" [attr.step]=\"stepAttr\"\r\n [attr.aria-invalid]=\"getControl('end')?.invalid && getControl('end')?.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(getControl('end'))\" />\r\n\r\n @if(getControl('end')?.value && !isEffectivelyDisabled) {\r\n <button type=\"button\" class=\"btn btn-secondary btn-clear-field\"\r\n (click)=\"onClearFieldPeriod('end')\">\r\n ×\r\n </button>\r\n }\r\n </div>\r\n }\r\n\r\n @if ([typeField.datePlusOne, typeField.datePlusTwo, typeField.datePlusSeven, typeField.dateComplexe].includes(type)) {\r\n\r\n @if (type === typeField.dateComplexe) {\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onDateAddDay('prev')\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.nextLeft\" [label]=\"'Jour pr\u00E9c\u00E9dent'\"></cw-icon>\r\n </button>\r\n }\r\n\r\n <input type=\"date\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\r\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\r\n [attr.placeholder]=\"placeholder ? placeholder : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [disabled]=\"isEffectivelyDisabled\" [attr.aria-required]=\"isRequired\"\r\n [attr.min]=\"minAttr\" [attr.max]=\"maxAttr\" [attr.step]=\"stepAttr\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\" />\r\n\r\n @if(formControl?.value && !isEffectivelyDisabled) {\r\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\"\r\n (click)=\"onClearField(formControl)\">×</button>\r\n }\r\n\r\n @if (type === typeField.dateComplexe) {\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onDateAddDay('next')\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.nextRight\" [label]=\"'Jour suivant'\"></cw-icon>\r\n </button>\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onRefresh()\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.toolbarRefresh\" [label]=\"'Rafra\u00EEchir'\"></cw-icon>\r\n </button>\r\n }\r\n\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onTodayAddDay(0)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n J\r\n <span class=\"visually-hidden\">Aujourd'hui</span>\r\n </button>\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onTodayAddDay(1)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n J+1\r\n <span class=\"visually-hidden\">Demain</span>\r\n </button>\r\n\r\n @if (type !== typeField.datePlusOne && type !== typeField.dateComplexe) {\r\n <button class=\"btn btn-secondary \" type=\"button\" (click)=\"onTodayAddDay(2)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n J+2\r\n <span class=\"visually-hidden\">Dans 2 jours</span>\r\n </button>\r\n\r\n @if (type !== typeField.datePlusTwo) {\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onTodayAddDay(7)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n J+7\r\n <span class=\"visually-hidden\">Dans 7 jours</span>\r\n </button>\r\n }\r\n }\r\n }\r\n\r\n @if (type === typeField.slider) {\r\n <ngx-slider [(value)]=\"sliderValue\" [options]=\"sliderOptions\" [formControl]=\"formControl\"></ngx-slider>\r\n }\r\n\r\n @if (type === typeField.range) {\r\n <div class=\"slider\">\r\n\r\n <cw-button [isDisabled]=\"formControl.value <= rangeOptions.floor\" [label]=\"'Diminuer ' + formControl.value + ' ' + label\"\r\n [withIcon]=\"spriteIcon.toolbarMinus\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\"\r\n [iconSize]=\"buttonIconSize.small\" (btnAction)=\"onRangeStep('decrease')\">\r\n </cw-button>\r\n\r\n <div class=\"slider-input\">\r\n <label [for]=\"name\" class=\"slider-tooltip\" [style.left]=\"getRangePercent() + '%'\" aria-live=\"polite\"\r\n aria-atomic=\"true\">\r\n {{ label | translate }} {{ formControl.value }}\r\n @if (rangeOptions.unit) {\r\n <abbr [title]=\"rangeOptions.unit\">{{ rangeOptions.unit }}</abbr>\r\n }\r\n </label>\r\n\r\n <div class=\"slider-custom-bar\">\r\n <div class=\"slider-custom-bar-selection\" [style.width]=\"getRangePercent() + '%'\">\r\n </div>\r\n </div>\r\n\r\n <input type=\"range\" [id]=\"name\" [formControl]=\"formControl\" [min]=\"rangeOptions.floor\" [max]=\"rangeOptions.ceil\"\r\n [step]=\"rangeOptions.step || 1\" class=\"field-control-range\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\" [disabled]=\"isEffectivelyDisabled\">\r\n </div>\r\n\r\n <cw-button [isDisabled]=\"formControl.value >= rangeOptions.ceil\" [label]=\"'Augmenter ' + formControl.value + ' ' + label\"\r\n [withIcon]=\"spriteIcon.toolbarPlus\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\"\r\n [iconSize]=\"buttonIconSize.small\" (btnAction)=\"onRangeStep('increase')\">\r\n </cw-button>\r\n </div>\r\n }\r\n\r\n @if (isInInputGroup() && clearable && !isEffectivelyDisabled) {\r\n @if(formControl?.value) {\r\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\"\r\n (click)=\"onClearField(formControl)\">×</button>\r\n }\r\n }\r\n\r\n</ng-template>\r\n" }]
|
|
3237
|
+
ButtonComponent,
|
|
3238
|
+
AutocompleteComponent
|
|
3239
|
+
], template: "@if (!isInAddon) {\r\n @if (\r\n type !== typeField.checkbox &&\r\n type !== typeField.radio &&\r\n type !== typeField.checkboxButton &&\r\n type !== typeField.radioButton &&\r\n type !== typeField.checkboxInline &&\r\n type !== typeField.radioInline &&\r\n type !== typeField.switch &&\r\n type !== typeField.range &&\r\n type !== typeField.switchSmall\r\n ) {\r\n <label [for]=\"name\" class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{ label | translate }}\r\n\r\n @if (isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n\r\n @if (tooltip) {\r\n <!-- <button type=\"button\" class=\"btn btn-link btn-popover\" placement=\"bottom\" [ngbPopover]=\"popContent\" container=\"body\"\r\n triggers=\"mouseenter:mouseleave\">\r\n <span class=\"btn-popover-icon bo-icons bo-help\"></span>\r\n </button>\r\n <ng-template #popContent>\r\n <div [innerHTML]=\"tooltip\"></div>\r\n </ng-template> -->\r\n }\r\n </label>\r\n }\r\n\r\n @if (addonLeft || addonRight) {\r\n <div class=\"field-group\">\r\n @if(addonLeft) {\r\n <ng-container [ngTemplateOutlet]=\"addonLeft\"></ng-container>\r\n }\r\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\r\n @if(addonRight) {\r\n <ng-container [ngTemplateOutlet]=\"addonRight\"></ng-container>\r\n }\r\n </div>\r\n }\r\n @else {\r\n @if ( isInInputGroup() ) {\r\n <div class=\"field-group\">\r\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\r\n </div>\r\n }\r\n @else {\r\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\r\n }\r\n }\r\n\r\n <!-- Error message -->\r\n @if (controlOrGroup?.invalid && controlOrGroup?.touched) {\r\n <div class=\"field-invalid\" [id]=\"'error-' + name\">\r\n @if (\r\n !errorMessages?.['required'] &&\r\n ((controlOrGroup?.errors?.['required']) || (getControl('start')?.errors?.['required'] || getControl('end')?.errors?.['required']))\r\n ) {\r\n <span [innerHtml]=\"'_COMMON._FORM.ERROR_IS_MANDATORY' | translate: {label: label | translate}\"></span>\r\n }\r\n @if (!errorMessages?.['rangeInvalid'] && controlOrGroup?.errors?.['rangeInvalid']) {\r\n <span>{{'_COMMON._DATES.ERROR_START_END_PERIOD' | translate}}</span>\r\n }\r\n @if (!errorMessages?.['fileExtension'] && controlOrGroup?.errors?.['fileExtension']) {\r\n <span>{{ '_COMMON._FORM.ERROR_FILE_EXTENSION' | translate: { accept: acceptLabel } }}</span>\r\n }\r\n @if (!errorMessages?.['fileSize'] && controlOrGroup?.errors?.['fileSize']) {\r\n <span>{{ '_COMMON._FORM.ERROR_FILE_SIZE' | translate: { maxSize: maxSizeLabel } }}</span>\r\n }\r\n @if (!errorMessages?.['email'] && controlOrGroup?.errors?.['email']) {\r\n <span>{{ '_COMMON._FORM.ERROR_INVALID_EMAIL' | translate }}</span>\r\n }\r\n @if (!errorMessages?.['phone'] && controlOrGroup?.errors?.['phone']) {\r\n <span>{{ '_COMMON._FORM.ERROR_INVALID_PHONE' | translate }}</span>\r\n }\r\n @if (errorMessages) {\r\n @for (entry of errorMessages | keyvalue: keepOrder; track entry.key) {\r\n @if (controlOrGroup?.errors?.[entry.key]; as errVal) {\r\n <span>{{ entry.value | translate: (errVal === true ? null : errVal) }}</span>\r\n }\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n @if (help || autoHelpEntries.length) {\r\n <div [id]=\"name + '-help'\" class=\"field-text\">\r\n @if (help) {\r\n <span>{{ help | translate }}</span>\r\n }\r\n @for (entry of autoHelpEntries; track entry.key) {\r\n <span>{{ entry.key | translate: entry.params }}</span>\r\n }\r\n </div>\r\n }\r\n}\r\n@else {\r\n <ng-container [ngTemplateOutlet]=\"field\"></ng-container>\r\n}\r\n\r\n<ng-template #field>\r\n <!-- Autocomplete (mono / multi) -->\r\n @if ((type === typeField.autocomplete || type === typeField.autocompleteMultiple) && autocompleteOptions) {\r\n <cw-autocomplete\r\n [id]=\"name\"\r\n [control]=\"formControl\"\r\n [fetcher]=\"autocompleteOptions.fetcher\"\r\n [displayField]=\"autocompleteOptions.displayField ?? 'label'\"\r\n [valueField]=\"autocompleteOptions.valueField ?? 'id'\"\r\n [columns]=\"autocompleteOptions.columns ?? []\"\r\n [resolver]=\"autocompleteOptions.resolver ?? null\"\r\n [selectedItem]=\"autocompleteOptions.selectedItem ?? null\"\r\n [selectedItems]=\"autocompleteOptions.selectedItems ?? []\"\r\n [minChars]=\"autocompleteOptions.minChars ?? 2\"\r\n [debounceMs]=\"autocompleteOptions.debounceMs ?? 250\"\r\n [multiple]=\"type === typeField.autocompleteMultiple\"\r\n [isRequired]=\"isRequired\"\r\n [isReadonly]=\"!!isReadonly\"\r\n [isDisabled]=\"isEffectivelyDisabled\"\r\n [ariaInvalid]=\"control.invalid && control.touched\"\r\n [ariaDescribedBy]=\"getDescribedBy(control)\"\r\n [placeholder]=\"placeholder\">\r\n </cw-autocomplete>\r\n }\r\n\r\n <!-- Text -->\r\n @if ([typeField.text, typeField.date, typeField.time, typeField.dateTime, typeField.number,\r\n typeField.email,\r\n typeField.color, typeField.zipCode].includes(type)) {\r\n <input [type]=\"type === typeField.zipCode ? 'text' : type\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\r\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '', type === typeField.zipCode ? 'field-control-zipcode' : '']\"\r\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [attr.aria-required]=\"isRequired\"\r\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\"\r\n [attr.min]=\"minAttr\" [attr.max]=\"maxAttr\" [attr.step]=\"stepAttr\" [attr.pattern]=\"patternAttr\"\r\n [attr.autocomplete]=\"autocomplete\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\r\n }\r\n\r\n <!-- Phone (intl-tel-input) -->\r\n @if (type === typeField.phone) {\r\n <input #phoneInput type=\"tel\" class=\"field-control\" [id]=\"name\"\r\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [disabled]=\"isEffectivelyDisabled\" [attr.aria-required]=\"isRequired\"\r\n [attr.autocomplete]=\"autocomplete\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n (focus)=\"onFocus()\" (blur)=\"onPhoneBlur($event)\" />\r\n }\r\n\r\n <!-- File -->\r\n @if (type === typeField.file) {\r\n <input #fileInput type=\"file\" class=\"field-control\" [id]=\"name\"\r\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\r\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [disabled]=\"isEffectivelyDisabled\" [attr.aria-required]=\"isRequired\"\r\n [attr.accept]=\"acceptAttr\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n (change)=\"onFileChange($event)\" (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\r\n }\r\n\r\n @if (type === typeField.password) {\r\n <input [type]=\"isPasswordShown ? 'text' : 'password'\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\r\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\r\n [attr.required]=\"isRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.aria-required]=\"isRequired\"\r\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\" [attr.pattern]=\"patternAttr\"\r\n [attr.autocomplete]=\"autocomplete\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\r\n <cw-button [type]=\"buttonType.secondary\"\r\n [withIcon]=\"isPasswordShown ? spriteIcon.toolbarHidePassword : spriteIcon.toolbarShowPassword\"\r\n [withOnlyIcon]=\"true\"\r\n [label]=\"isPasswordShown ? '_COMMON._FORM._SHOW_HIDE_PWD.HIDE' : '_COMMON._FORM._SHOW_HIDE_PWD.SHOW'\"\r\n (btnAction)=\"togglePasswordVisibility()\">\r\n </cw-button>\r\n }\r\n\r\n <!-- Textarea -->\r\n @if (type === typeField.textarea) {\r\n <textarea class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\r\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\r\n [attr.placeholder]=\"placeholder ? (placeholder | translate) : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"\r\n [attr.aria-required]=\"isRequired\" [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.minlength]=\"minLengthAttr\" [attr.maxlength]=\"maxLengthAttr\" [attr.pattern]=\"patternAttr\"\r\n [attr.autocomplete]=\"autocomplete\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n (focus)=\"onFocus()\" (blur)=\"onBlur()\"></textarea>\r\n }\r\n\r\n <!-- Select -->\r\n @if (type === typeField.select) {\r\n <ng-select [formControl]=\"formControl\" [items]=\"options\" bindLabel=\"label\" [labelForId]=\"name\" [appendTo]=\"appendTo\" bindValue=\"value\"\r\n [ngClass]=\"cssClass\" [searchable]=\"false\" [placeholder]=\"placeholder ? (placeholder | translate) : null\" [readonly]=\"isReadonly\" [clearable]=\"false\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.aria-required]=\"isRequired\" [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\" [attr.id]=\"name\"\r\n (focus)=\"onFocus()\" (blur)=\"onBlur()\">\r\n\r\n <!-- Template pour les options -->\r\n <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\">\r\n @if (optionTemplate) {\r\n <ng-container *ngTemplateOutlet=\"optionTemplate; context: { item: item | translate, index: index, searchTerm: search }\"></ng-container>\r\n }\r\n @else {\r\n <div>{{ item.label | translate }}</div>\r\n }\r\n </ng-template>\r\n\r\n <!-- Template pour le label -->\r\n <ng-template ng-label-tmp let-item=\"item\">\r\n @if (labelTemplate) {\r\n <ng-container *ngTemplateOutlet=\"labelTemplate; context: { item: item | translate }\"></ng-container>\r\n }\r\n @else {\r\n {{ (item.label | translate) || (placeholder | translate) }}\r\n }\r\n </ng-template>\r\n </ng-select>\r\n }\r\n\r\n <!-- NgSelect -->\r\n @if (type === typeField.ngSelect || type === typeField.ngSelectMultiple) {\r\n <ng-select [formControl]=\"formControl\" [items]=\"options\" bindLabel=\"label\" [labelForId]=\"name\" [appendTo]=\"appendTo\" bindValue=\"value\"\r\n [multiple]=\"type === typeField.ngSelectMultiple\" [ngClass]=\"cssClass\" [clearable]=\"false\"\r\n [placeholder]=\"placeholder ? (placeholder | translate) : null\" [readonly]=\"isReadonly\"\r\n [notFoundText]=\"'_COMMON.NO_RESULT' | translate\" [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"\r\n [attr.required]=\"isRequired ? 'required' : null\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\" [attr.id]=\"name\"\r\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" (search)=\"textChanged.emit($event?.term)\">\r\n\r\n <!-- Template pour les options -->\r\n <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\">\r\n @if (optionTemplate) {\r\n <ng-container *ngTemplateOutlet=\"optionTemplate; context: { item: item, index: index, searchTerm: search }\"></ng-container>\r\n }\r\n @else {\r\n <div>{{ item.label | translate }}</div>\r\n }\r\n </ng-template>\r\n\r\n <!-- Template pour le label -->\r\n <ng-template ng-label-tmp let-item=\"item\" let-clear=\"clear\">\r\n <span class=\"ng-value-icon left\" (click)=\"clear(item)\" aria-hidden=\"true\">\u00D7</span>\r\n @if (labelTemplate) {\r\n <ng-container *ngTemplateOutlet=\"labelTemplate; context: { item: item | translate }\"></ng-container>\r\n }\r\n @else {\r\n {{ (item.label | translate) || (placeholder | translate) }}\r\n }\r\n </ng-template>\r\n </ng-select>\r\n }\r\n\r\n <!-- Radio -->\r\n @if (type === typeField.radioInline || type === typeField.radio) {\r\n <fieldset\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\">\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </legend>\r\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.radioInline ? 'd-flex-h gap-md flex-wrap' : 'd-flex-v'\">\r\n @for (opt of options; track opt.value) {\r\n <li class=\"field-check\">\r\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" [formControl]=\"formControl\"\r\n class=\"field-check-input\" [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" (change)=\"onRadioChange(opt.value)\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">{{ opt.label | translate }}</label>\r\n </li>\r\n }\r\n </ul>\r\n </fieldset>\r\n }\r\n\r\n <!-- Radio button -->\r\n @if (type === typeField.radioButton) {\r\n <fieldset\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\">\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </legend>\r\n <div class=\"field-group field-group-btn\">\r\n @for (opt of options; track opt.value) {\r\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" [formControl]=\"formControl\"\r\n class=\"visually-hidden\" [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" (change)=\"onRadioChange(opt.value)\"/>\r\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">{{ opt.label | translate }}</label>\r\n }\r\n </div>\r\n </fieldset>\r\n }\r\n\r\n <!-- Checkbox Switch -->\r\n @if ( type === typeField.switch || type === typeField.switchSmall)\r\n {\r\n <div class=\"field-check field-switch\" [ngClass]=\"{'field-switch-small': type === typeField.switchSmall}\">\r\n <input type=\"checkbox\" [id]=\"name\" [formControl]=\"formControl\" class=\"field-check-input\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"/>\r\n <label [for]=\"name\" class=\"field-check-label\">{{ label | translate }}</label>\r\n </div>\r\n }\r\n\r\n <!-- Checkbox -->\r\n @if (type === typeField.checkboxInline || type === typeField.checkbox) {\r\n @if (isSingleCheckbox()) {\r\n <div class=\"field-check\" [class.field-check-inline]=\"type === typeField.checkboxInline\">\r\n <input #checkboxInput type=\"checkbox\" [id]=\"name\" [formControl]=\"formControl\"\r\n class=\"field-check-input\"\r\n [class.is-invalid]=\"control?.invalid && control?.touched\"\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control?.invalid && control?.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" />\r\n <label [for]=\"name\" class=\"field-check-label\">\r\n {{ label | translate }}\r\n @if (isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </label>\r\n </div>\r\n }\r\n @else if( options.length > 1) {\r\n <fieldset\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n [ngClass]=\"{ 'flex-column': type === typeField.checkbox }\">\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </legend>\r\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.checkboxInline ? 'd-flex-h gap-md' : 'd-flex-v'\">\r\n @for (opt of options; track opt.value) {\r\n <li class=\"field-check\" [ngClass]=\"{ 'field-check-inline': type === typeField.checkboxInline }\">\r\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\r\n [checked]=\"control.value?.includes(opt.value)\" class=\"field-check-input\"\r\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">\r\n {{ opt.label | translate }}\r\n </label>\r\n </li>\r\n }\r\n </ul>\r\n </fieldset>\r\n }\r\n @else {\r\n <fieldset>\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n </legend>\r\n <ul class=\"list-unstyled mb-none\" [ngClass]=\"type === typeField.checkboxInline ? 'd-flex-h gap-md' : 'd-flex-v'\">\r\n @for (opt of options; track opt.value) {\r\n <li class=\"field-check\" [ngClass]=\"{ 'field-check-inline': type === typeField.checkboxInline }\">\r\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\r\n [checked]=\"control.value?.includes(opt.value)\" class=\"field-check-input\"\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"field-check-label\">\r\n {{ opt.label | translate }}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </label>\r\n </li>\r\n }\r\n </ul>\r\n </fieldset>\r\n }\r\n }\r\n\r\n <!-- Checkbox button -->\r\n @if (type === typeField.checkboxButton && options.length > 0) {\r\n\r\n @if(options.length > 1) {\r\n <fieldset\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\">\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </legend>\r\n <div class=\"field-group field-group-btn\">\r\n @for (opt of options; track opt.value) {\r\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\r\n [checked]=\"control.value?.includes(opt.value)\" class=\"visually-hidden\"\r\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">{{ opt.label | translate }}</label>\r\n }\r\n </div>\r\n </fieldset>\r\n }\r\n @else {\r\n <fieldset>\r\n <legend class=\"field-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{label | translate}}\r\n </legend>\r\n <div class=\"btn-group btn-group-secondary\">\r\n @for (opt of options; track opt.value) {\r\n <input type=\"checkbox\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" (change)=\"onCheckboxChange($event)\"\r\n [checked]=\"control.value?.includes(opt.value)\" class=\"visually-hidden\"\r\n [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n [attr.disabled]=\"(isEffectivelyDisabled || opt.disabled) ? 'disabled' : null\"/>\r\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-field-group\">\r\n {{ opt.label | translate}}\r\n @if(isRequired) {\r\n <span class=\"text-danger\">*</span>\r\n }\r\n </label>\r\n }\r\n </div>\r\n </fieldset>\r\n }\r\n }\r\n\r\n <!-- Period - DateToDate / TimeToTime / DateTimeToDateTime -->\r\n @if ([typeField.dateToDate, typeField.timeToTime, typeField.dateTimeToDateTime].includes(type) && isRange) {\r\n\r\n <div class=\"field-group\">\r\n <div class=\"field-group-text\">Du</div>\r\n <input [type]=\"getInputType()\" class=\"field-control\" [id]=\"name + '_start'\" [formControl]=\"getControl('start')\"\r\n [attr.placeholder]=\"type === typeField.timeToTime ? ('_COMMON._DATES.FROM' | translate) : ('_COMMON._DATES.FROM_TO_1' | translate)\"\r\n [ngClass]=\"[(cssClass || ''), getControl('start')?.value ? 'has-value' : '']\"\r\n [attr.required]=\"isRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\" [attr.aria-required]=\"isRequired\"\r\n [attr.min]=\"minStartAttr\" [attr.max]=\"maxStartAttr\" [attr.step]=\"stepAttr\"\r\n [attr.autocomplete]=\"autocomplete\"\r\n [attr.aria-invalid]=\"getControl('start')?.invalid && getControl('start')?.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(getControl('start'))\"\r\n (focus)=\"onFocusRange('start')\" />\r\n\r\n @if(getControl('start')?.value && !isEffectivelyDisabled) {\r\n <button type=\"button\" class=\"btn btn-secondary btn-clear-field\"\r\n (click)=\"onClearFieldPeriod('start')\">\r\n ×\r\n </button>\r\n }\r\n <div class=\"field-group-text\">au</div>\r\n <input [type]=\"getInputType()\" class=\"field-control\" [id]=\"name + '_end'\" [formControl]=\"getControl('end')\"\r\n [attr.placeholder]=\"type === typeField.timeToTime ? ('_COMMON._DATES.TO' | translate) : ('_COMMON._DATES.FROM_TO_2' | translate)\"\r\n [ngClass]=\"[(cssClass || ''), getControl('end')?.value ? 'has-value' : '']\"\r\n [attr.required]=\"isRequired ? 'required' : null\" [attr.readonly]=\"isReadonly ? 'readonly' : null\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\"\r\n [attr.min]=\"minEndAttr\" [attr.max]=\"maxEndAttr\" [attr.step]=\"stepAttr\"\r\n [attr.autocomplete]=\"autocomplete\"\r\n [attr.aria-invalid]=\"getControl('end')?.invalid && getControl('end')?.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(getControl('end'))\"\r\n (focus)=\"onFocusRange('end')\" />\r\n\r\n @if(getControl('end')?.value && !isEffectivelyDisabled) {\r\n <button type=\"button\" class=\"btn btn-secondary btn-clear-field\"\r\n (click)=\"onClearFieldPeriod('end')\">\r\n ×\r\n </button>\r\n }\r\n </div>\r\n }\r\n\r\n @if ([typeField.datePlusOne, typeField.datePlusTwo, typeField.datePlusSeven, typeField.dateComplexe].includes(type)) {\r\n\r\n <div class=\"field-group\">\r\n @if (type === typeField.dateComplexe) {\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onDateAddDay('prev')\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.nextLeft\" [label]=\"'Jour pr\u00E9c\u00E9dent'\"></cw-icon>\r\n </button>\r\n }\r\n\r\n <input type=\"date\" class=\"field-control\" [id]=\"name\" [formControl]=\"formControl\"\r\n [ngClass]=\"[(cssClass || ''), formControl?.value ? 'has-value' : '']\"\r\n [attr.placeholder]=\"placeholder ? placeholder : null\" [attr.required]=\"isRequired ? 'required' : null\"\r\n [attr.readonly]=\"isReadonly ? 'readonly' : null\" [attr.aria-required]=\"isRequired\"\r\n [attr.min]=\"minAttr\" [attr.max]=\"maxAttr\" [attr.step]=\"stepAttr\"\r\n [attr.autocomplete]=\"autocomplete\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"getDescribedBy(control)\"\r\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\r\n\r\n @if(formControl?.value && !isEffectivelyDisabled) {\r\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\"\r\n (click)=\"onClearField(formControl)\">×</button>\r\n }\r\n\r\n @if (type === typeField.dateComplexe) {\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onDateAddDay('next')\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.nextRight\" [label]=\"'Jour suivant'\"></cw-icon>\r\n </button>\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onRefresh()\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n <cw-icon font=\"optyweb\" [icon]=\"spriteIcon.toolbarRefresh\" [label]=\"'Rafra\u00EEchir'\"></cw-icon>\r\n </button>\r\n }\r\n\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onTodayAddDay(0)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n J\r\n <span class=\"visually-hidden\">Aujourd'hui</span>\r\n </button>\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onTodayAddDay(1)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n J+1\r\n <span class=\"visually-hidden\">Demain</span>\r\n </button>\r\n\r\n @if (type !== typeField.datePlusOne && type !== typeField.dateComplexe) {\r\n <button class=\"btn btn-secondary \" type=\"button\" (click)=\"onTodayAddDay(2)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n J+2\r\n <span class=\"visually-hidden\">Dans 2 jours</span>\r\n </button>\r\n\r\n @if (type !== typeField.datePlusTwo) {\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onTodayAddDay(7)\"\r\n [attr.disabled]=\"isEffectivelyDisabled ? 'disabled' : null\">\r\n J+7\r\n <span class=\"visually-hidden\">Dans 7 jours</span>\r\n </button>\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n @if (type === typeField.slider) {\r\n <ngx-slider [(value)]=\"sliderValue\" [options]=\"sliderOptions\" [formControl]=\"formControl\"></ngx-slider>\r\n }\r\n\r\n @if (type === typeField.range) {\r\n <div class=\"slider\">\r\n\r\n <cw-button [isDisabled]=\"formControl.value <= rangeOptions.floor\" [label]=\"'Diminuer ' + formControl.value + ' ' + label\"\r\n [withIcon]=\"spriteIcon.toolbarMinus\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\"\r\n [iconSize]=\"buttonIconSize.small\" (btnAction)=\"onRangeStep('decrease')\">\r\n </cw-button>\r\n\r\n <div class=\"slider-input\">\r\n <label [for]=\"name\" class=\"slider-tooltip\" [style.left]=\"getRangePercent() + '%'\" aria-live=\"polite\"\r\n aria-atomic=\"true\">\r\n {{ label | translate }} {{ formControl.value }}\r\n @if (rangeOptions.unit) {\r\n <abbr [title]=\"rangeOptions.unit\">{{ rangeOptions.unit }}</abbr>\r\n }\r\n </label>\r\n\r\n <div class=\"slider-custom-bar\">\r\n <div class=\"slider-custom-bar-selection\" [style.width]=\"getRangePercent() + '%'\">\r\n </div>\r\n </div>\r\n\r\n <input type=\"range\" [id]=\"name\" [formControl]=\"formControl\" [min]=\"rangeOptions.floor\" [max]=\"rangeOptions.ceil\"\r\n [step]=\"rangeOptions.step || 1\" class=\"field-control-range\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\">\r\n </div>\r\n\r\n <cw-button [isDisabled]=\"formControl.value >= rangeOptions.ceil\" [label]=\"'Augmenter ' + formControl.value + ' ' + label\"\r\n [withIcon]=\"spriteIcon.toolbarPlus\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\"\r\n [iconSize]=\"buttonIconSize.small\" (btnAction)=\"onRangeStep('increase')\">\r\n </cw-button>\r\n </div>\r\n }\r\n\r\n @if (isInInputGroup() && clearable && !isEffectivelyDisabled && type !== typeField.autocompleteMultiple && type !== typeField.ngSelectMultiple) {\r\n @if (type === typeField.autocomplete) {\r\n @if (autocompleteRef()?.hasAnyContent()) {\r\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\"\r\n (click)=\"autocompleteRef()!.clear()\">×</button>\r\n }\r\n } @else {\r\n @if(formControl?.value) {\r\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\"\r\n (click)=\"onClearField(formControl)\">×</button>\r\n }\r\n }\r\n }\r\n\r\n</ng-template>\r\n" }]
|
|
2313
3240
|
}], ctorParameters: () => [], propDecorators: { control: [{
|
|
2314
3241
|
type: Input
|
|
2315
3242
|
}], formGroup: [{
|
|
@@ -2324,12 +3251,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImpo
|
|
|
2324
3251
|
type: Input
|
|
2325
3252
|
}], placeholder: [{
|
|
2326
3253
|
type: Input
|
|
3254
|
+
}], autocomplete: [{
|
|
3255
|
+
type: Input
|
|
2327
3256
|
}], options: [{
|
|
2328
3257
|
type: Input
|
|
2329
3258
|
}], rangeOptions: [{
|
|
2330
3259
|
type: Input
|
|
2331
3260
|
}], validationOptions: [{
|
|
2332
3261
|
type: Input
|
|
3262
|
+
}], autocompleteOptions: [{
|
|
3263
|
+
type: Input
|
|
2333
3264
|
}], errorMessages: [{
|
|
2334
3265
|
type: Input
|
|
2335
3266
|
}], isRequired: [{
|
|
@@ -2360,7 +3291,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImpo
|
|
|
2360
3291
|
type: Input
|
|
2361
3292
|
}], appendTo: [{
|
|
2362
3293
|
type: Input
|
|
2363
|
-
}],
|
|
3294
|
+
}], initialCountry: [{
|
|
3295
|
+
type: Input
|
|
3296
|
+
}], indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }], checkboxInputRef: [{ type: i0.ViewChild, args: ['checkboxInput', { isSignal: true }] }], fileInputRef: [{ type: i0.ViewChild, args: ['fileInput', { isSignal: true }] }], phoneInputRef: [{ type: i0.ViewChild, args: ['phoneInput', { isSignal: true }] }], autocompleteRef: [{ type: i0.ViewChild, args: [i0.forwardRef(() => AutocompleteComponent), { isSignal: true }] }], refreshEvent: [{
|
|
2364
3297
|
type: Output
|
|
2365
3298
|
}], textChanged: [{
|
|
2366
3299
|
type: Output
|
|
@@ -2630,11 +3563,11 @@ class ModalsComponent {
|
|
|
2630
3563
|
});
|
|
2631
3564
|
}
|
|
2632
3565
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: ModalsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2633
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: ModalsComponent, isStandalone: true, selector: "cw-modals", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, customClass: { classPropertyName: "customClass", publicName: "customClass", isSignal: true, isRequired: false, transformFunction: null }, scrollable: { classPropertyName: "scrollable", publicName: "scrollable", isSignal: true, isRequired: false, transformFunction: null }, isAutcompModal: { classPropertyName: "isAutcompModal", publicName: "isAutcompModal", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: true, transformFunction: null }, modalTitle: { classPropertyName: "modalTitle", publicName: "modalTitle", isSignal: true, isRequired: false, transformFunction: null }, itemsToDelete: { classPropertyName: "itemsToDelete", publicName: "itemsToDelete", isSignal: true, isRequired: false, transformFunction: null }, itemsToDeleteTitle: { classPropertyName: "itemsToDeleteTitle", publicName: "itemsToDeleteTitle", isSignal: true, isRequired: false, transformFunction: null }, labelBtnAction1: { classPropertyName: "labelBtnAction1", publicName: "labelBtnAction1", isSignal: true, isRequired: false, transformFunction: null }, labelBtnAction2: { classPropertyName: "labelBtnAction2", publicName: "labelBtnAction2", isSignal: true, isRequired: false, transformFunction: null }, customBodyTemplate: { classPropertyName: "customBodyTemplate", publicName: "customBodyTemplate", isSignal: true, isRequired: false, transformFunction: null }, customBodyContext: { classPropertyName: "customBodyContext", publicName: "customBodyContext", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { btnAction1: "btnAction1", btnAction2: "btnAction2" }, viewQueries: [{ propertyName: "modalContainer", first: true, predicate: ["modalContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"cityway-v8 modal-backdrop fade show\" style=\"z-index: 1050;\" aria-hidden=\"true\"></div>\n\n<div role=\"dialog\" tabindex=\"-1\" aria-modal=\"true\" aria-labelledby=\"modal-basic-title\"\n class=\"cityway-v8 d-flex modal show\" [ngClass]=\"customClass()\" data-test-ctw=\"modal\" (keydown)=\"onKeyDown($event)\">\n\n <div class=\"modal-inner-backdrop\" (click)=\"type() !== modalsType.loader && closeModal()\"></div>\n\n <div #modalContainer role=\"document\" class=\"modal-dialog modal-dialog-centered\"\n [ngClass]=\"['modal-' + size(), scrollable() ? 'modal-dialog-scrollable' : '']\">\n\n <div class=\"modal-content\">\n\n @if (type() !== modalsType.loader) {\n @if (type() == modalsType.delete || type() == modalsType.quickSideView || type() == modalsType.custom) {\n <div class=\"modal-header\">\n @if (type() === modalsType.delete) {\n <h1 class=\"modal-title\" id=\"modal-basic-title\">\n {{ '_COMMON._MODAL_DELETE.TITLE' | translate: { number: itemsToDelete().length, name: itemsToDeleteTitle() | translate } }}\n </h1>\n }\n @else {\n <h1 class=\"modal-title\" id=\"modal-basic-title\">\n {{ modalTitle() | translate }}\n </h1>\n }\n\n <cw-button [label]=\"'_COMMON._ACTION.CLOSE' | translate\" [type]=\"buttonTypeEnum.light\" [withOnlyIcon]=\"true\"\n [withIcon]=\"spriteIcon.toolbarClose\" (btnAction)=\"closeModal()\" dataTest=\"btn-close-modal\"\n cssClass=\"btn-close\">\n </cw-button>\n </div>\n\n <div class=\"modal-body\">\n @if (type() === modalsType.delete) {\n @if (itemsToDelete().length === 1) {\n <div [innerHTML]=\"'_COMMON._MODAL_DELETE.SIMPLE_TEXT' | translate\"></div>\n }\n @if (itemsToDelete().length > 1) {\n <div [innerHTML]=\"'_COMMON._MODAL_DELETE.MULTIPLE_TEXT' | translate\"></div>\n }\n @if (itemsToDelete().length > 0) {\n <ul class=\"mb-none\">\n @for (item of itemsToDelete(); track item) {\n <li>{{ item }}</li>\n }\n </ul>\n }\n }\n
|
|
3566
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: ModalsComponent, isStandalone: true, selector: "cw-modals", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, customClass: { classPropertyName: "customClass", publicName: "customClass", isSignal: true, isRequired: false, transformFunction: null }, scrollable: { classPropertyName: "scrollable", publicName: "scrollable", isSignal: true, isRequired: false, transformFunction: null }, isAutcompModal: { classPropertyName: "isAutcompModal", publicName: "isAutcompModal", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: true, transformFunction: null }, modalTitle: { classPropertyName: "modalTitle", publicName: "modalTitle", isSignal: true, isRequired: false, transformFunction: null }, itemsToDelete: { classPropertyName: "itemsToDelete", publicName: "itemsToDelete", isSignal: true, isRequired: false, transformFunction: null }, itemsToDeleteTitle: { classPropertyName: "itemsToDeleteTitle", publicName: "itemsToDeleteTitle", isSignal: true, isRequired: false, transformFunction: null }, labelBtnAction1: { classPropertyName: "labelBtnAction1", publicName: "labelBtnAction1", isSignal: true, isRequired: false, transformFunction: null }, labelBtnAction2: { classPropertyName: "labelBtnAction2", publicName: "labelBtnAction2", isSignal: true, isRequired: false, transformFunction: null }, customBodyTemplate: { classPropertyName: "customBodyTemplate", publicName: "customBodyTemplate", isSignal: true, isRequired: false, transformFunction: null }, customBodyContext: { classPropertyName: "customBodyContext", publicName: "customBodyContext", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { btnAction1: "btnAction1", btnAction2: "btnAction2" }, viewQueries: [{ propertyName: "modalContainer", first: true, predicate: ["modalContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"cityway-v8 modal-backdrop fade show\" style=\"z-index: 1050;\" aria-hidden=\"true\"></div>\n\n<div role=\"dialog\" tabindex=\"-1\" aria-modal=\"true\" aria-labelledby=\"modal-basic-title\"\n class=\"cityway-v8 d-flex modal show\" [ngClass]=\"customClass()\" data-test-ctw=\"modal\" (keydown)=\"onKeyDown($event)\">\n\n <div class=\"modal-inner-backdrop\" (click)=\"type() !== modalsType.loader && closeModal()\"></div>\n\n <div #modalContainer role=\"document\" class=\"modal-dialog modal-dialog-centered\"\n [ngClass]=\"['modal-' + size(), scrollable() ? 'modal-dialog-scrollable' : '']\">\n\n <div class=\"modal-content\">\n\n @if (type() !== modalsType.loader) {\n @if (type() == modalsType.delete || type() == modalsType.quickSideView || type() == modalsType.custom) {\n <div class=\"modal-header\">\n @if (type() === modalsType.delete) {\n <h1 class=\"modal-title\" id=\"modal-basic-title\">\n {{ '_COMMON._MODAL_DELETE.TITLE' | translate: { number: itemsToDelete().length, name: itemsToDeleteTitle() | translate } }}\n </h1>\n }\n @else {\n <h1 class=\"modal-title\" id=\"modal-basic-title\">\n {{ modalTitle() | translate }}\n </h1>\n }\n\n <cw-button [label]=\"'_COMMON._ACTION.CLOSE' | translate\" [type]=\"buttonTypeEnum.light\" [withOnlyIcon]=\"true\"\n [withIcon]=\"spriteIcon.toolbarClose\" (btnAction)=\"closeModal()\" dataTest=\"btn-close-modal\"\n cssClass=\"btn-close\">\n </cw-button>\n </div>\n\n <div class=\"modal-body\">\n @if (customBodyTemplate()) {\n <ng-container [ngTemplateOutlet]=\"customBodyTemplate()\" [ngTemplateOutletContext]=\"customBodyContext()\">\n </ng-container>\n }\n\n @if (type() === modalsType.delete) {\n @if (itemsToDelete().length === 1) {\n <div [innerHTML]=\"'_COMMON._MODAL_DELETE.SIMPLE_TEXT' | translate\"></div>\n }\n @if (itemsToDelete().length > 1) {\n <div [innerHTML]=\"'_COMMON._MODAL_DELETE.MULTIPLE_TEXT' | translate\"></div>\n }\n @if (itemsToDelete().length > 0) {\n <ul class=\"mb-none\">\n @for (item of itemsToDelete(); track item) {\n <li>{{ item }}</li>\n }\n </ul>\n }\n }\n </div>\n }\n @else {\n <div class=\"modal-header justify-content-end\">\n <cw-button [label]=\"'_COMMON._ACTION.CLOSE' | translate\" [type]=\"buttonTypeEnum.light\" [withOnlyIcon]=\"true\"\n [withIcon]=\"spriteIcon.toolbarClose\" (btnAction)=\"closeModal()\" dataTest=\"btn-close-modal\"\n cssClass=\"btn-close\">\n </cw-button>\n </div>\n <div class=\"modal-body\">\n <cw-icon [label]=\"'Sucess'\" [iconSize]=\"iconSize['5xl']\" [icon]=\"spriteIcon.toolbarClose\" [type]=\"iconType.rounded\" [iconUiType]=\"iconUiType.success\"></cw-icon>\n\n <h1 class=\"modal-title\" id=\"modal-basic-title\">\n {{ modalTitle() | translate }}\n </h1>\n\n @if (customBodyTemplate()) {\n <ng-container [ngTemplateOutlet]=\"customBodyTemplate()\" [ngTemplateOutletContext]=\"customBodyContext()\">\n </ng-container>\n }\n </div>\n }\n\n <div class=\"modal-footer\">\n @if (type() === modalsType.delete) {\n <cw-button label=\"_COMMON._ACTION.DELETE\" [type]=\"buttonTypeEnum.danger\" [isMinWidth]=\"true\"\n (btnAction)=\"action1Click()\" dataTest=\"btn-action-modal\">\n </cw-button>\n\n <cw-button label=\"_COMMON._ACTION.CLOSE\" [type]=\"buttonTypeEnum.secondary\" [isMinWidth]=\"true\"\n (btnAction)=\"closeModal()\" dataTest=\"btn-close-modal\">\n </cw-button>\n }\n @else {\n @if (labelBtnAction1()) {\n <cw-button [label]=\"labelBtnAction1()\" [type]=\"buttonTypeEnum.primary\" [isMinWidth]=\"true\"\n (btnAction)=\"action1Click()\" dataTest=\"btn-action-modal\">\n </cw-button>\n }\n @if (labelBtnAction2()) {\n <cw-button [label]=\"labelBtnAction2()\" [type]=\"buttonTypeEnum.secondary\" [isMinWidth]=\"true\"\n (btnAction)=\"action2Click()\" dataTest=\"btn-action-modal\">\n </cw-button>\n }\n @else {\n <cw-button label=\"_COMMON._ACTION.CLOSE\" [type]=\"buttonTypeEnum.secondary\" [isMinWidth]=\"true\"\n (btnAction)=\"closeModal()\" dataTest=\"btn-close-modal\">\n </cw-button>\n }\n }\n </div>\n }\n @else {\n <div class=\"modal-body\">\n <cw-loader></cw-loader>\n </div>\n }\n\n </div>\n </div>\n</div>\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: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "cssClass", "dataTest", "skeletonMode", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { kind: "component", type: LoaderComponent, selector: "cw-loader" }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom", "spritePath"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
|
|
2634
3567
|
}
|
|
2635
3568
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: ModalsComponent, decorators: [{
|
|
2636
3569
|
type: Component,
|
|
2637
|
-
args: [{ selector: 'cw-modals', standalone: true, 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>\n\n<div role=\"dialog\" tabindex=\"-1\" aria-modal=\"true\" aria-labelledby=\"modal-basic-title\"\n class=\"cityway-v8 d-flex modal show\" [ngClass]=\"customClass()\" data-test-ctw=\"modal\" (keydown)=\"onKeyDown($event)\">\n\n <div class=\"modal-inner-backdrop\" (click)=\"type() !== modalsType.loader && closeModal()\"></div>\n\n <div #modalContainer role=\"document\" class=\"modal-dialog modal-dialog-centered\"\n [ngClass]=\"['modal-' + size(), scrollable() ? 'modal-dialog-scrollable' : '']\">\n\n <div class=\"modal-content\">\n\n @if (type() !== modalsType.loader) {\n @if (type() == modalsType.delete || type() == modalsType.quickSideView || type() == modalsType.custom) {\n <div class=\"modal-header\">\n @if (type() === modalsType.delete) {\n <h1 class=\"modal-title\" id=\"modal-basic-title\">\n {{ '_COMMON._MODAL_DELETE.TITLE' | translate: { number: itemsToDelete().length, name: itemsToDeleteTitle() | translate } }}\n </h1>\n }\n @else {\n <h1 class=\"modal-title\" id=\"modal-basic-title\">\n {{ modalTitle() | translate }}\n </h1>\n }\n\n <cw-button [label]=\"'_COMMON._ACTION.CLOSE' | translate\" [type]=\"buttonTypeEnum.light\" [withOnlyIcon]=\"true\"\n [withIcon]=\"spriteIcon.toolbarClose\" (btnAction)=\"closeModal()\" dataTest=\"btn-close-modal\"\n cssClass=\"btn-close\">\n </cw-button>\n </div>\n\n <div class=\"modal-body\">\n @if (type() === modalsType.delete) {\n @if (itemsToDelete().length === 1) {\n <div [innerHTML]=\"'_COMMON._MODAL_DELETE.SIMPLE_TEXT' | translate\"></div>\n }\n @if (itemsToDelete().length > 1) {\n <div [innerHTML]=\"'_COMMON._MODAL_DELETE.MULTIPLE_TEXT' | translate\"></div>\n }\n @if (itemsToDelete().length > 0) {\n <ul class=\"mb-none\">\n @for (item of itemsToDelete(); track item) {\n <li>{{ item }}</li>\n }\n </ul>\n }\n }\n
|
|
3570
|
+
args: [{ selector: 'cw-modals', standalone: true, 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>\n\n<div role=\"dialog\" tabindex=\"-1\" aria-modal=\"true\" aria-labelledby=\"modal-basic-title\"\n class=\"cityway-v8 d-flex modal show\" [ngClass]=\"customClass()\" data-test-ctw=\"modal\" (keydown)=\"onKeyDown($event)\">\n\n <div class=\"modal-inner-backdrop\" (click)=\"type() !== modalsType.loader && closeModal()\"></div>\n\n <div #modalContainer role=\"document\" class=\"modal-dialog modal-dialog-centered\"\n [ngClass]=\"['modal-' + size(), scrollable() ? 'modal-dialog-scrollable' : '']\">\n\n <div class=\"modal-content\">\n\n @if (type() !== modalsType.loader) {\n @if (type() == modalsType.delete || type() == modalsType.quickSideView || type() == modalsType.custom) {\n <div class=\"modal-header\">\n @if (type() === modalsType.delete) {\n <h1 class=\"modal-title\" id=\"modal-basic-title\">\n {{ '_COMMON._MODAL_DELETE.TITLE' | translate: { number: itemsToDelete().length, name: itemsToDeleteTitle() | translate } }}\n </h1>\n }\n @else {\n <h1 class=\"modal-title\" id=\"modal-basic-title\">\n {{ modalTitle() | translate }}\n </h1>\n }\n\n <cw-button [label]=\"'_COMMON._ACTION.CLOSE' | translate\" [type]=\"buttonTypeEnum.light\" [withOnlyIcon]=\"true\"\n [withIcon]=\"spriteIcon.toolbarClose\" (btnAction)=\"closeModal()\" dataTest=\"btn-close-modal\"\n cssClass=\"btn-close\">\n </cw-button>\n </div>\n\n <div class=\"modal-body\">\n @if (customBodyTemplate()) {\n <ng-container [ngTemplateOutlet]=\"customBodyTemplate()\" [ngTemplateOutletContext]=\"customBodyContext()\">\n </ng-container>\n }\n\n @if (type() === modalsType.delete) {\n @if (itemsToDelete().length === 1) {\n <div [innerHTML]=\"'_COMMON._MODAL_DELETE.SIMPLE_TEXT' | translate\"></div>\n }\n @if (itemsToDelete().length > 1) {\n <div [innerHTML]=\"'_COMMON._MODAL_DELETE.MULTIPLE_TEXT' | translate\"></div>\n }\n @if (itemsToDelete().length > 0) {\n <ul class=\"mb-none\">\n @for (item of itemsToDelete(); track item) {\n <li>{{ item }}</li>\n }\n </ul>\n }\n }\n </div>\n }\n @else {\n <div class=\"modal-header justify-content-end\">\n <cw-button [label]=\"'_COMMON._ACTION.CLOSE' | translate\" [type]=\"buttonTypeEnum.light\" [withOnlyIcon]=\"true\"\n [withIcon]=\"spriteIcon.toolbarClose\" (btnAction)=\"closeModal()\" dataTest=\"btn-close-modal\"\n cssClass=\"btn-close\">\n </cw-button>\n </div>\n <div class=\"modal-body\">\n <cw-icon [label]=\"'Sucess'\" [iconSize]=\"iconSize['5xl']\" [icon]=\"spriteIcon.toolbarClose\" [type]=\"iconType.rounded\" [iconUiType]=\"iconUiType.success\"></cw-icon>\n\n <h1 class=\"modal-title\" id=\"modal-basic-title\">\n {{ modalTitle() | translate }}\n </h1>\n\n @if (customBodyTemplate()) {\n <ng-container [ngTemplateOutlet]=\"customBodyTemplate()\" [ngTemplateOutletContext]=\"customBodyContext()\">\n </ng-container>\n }\n </div>\n }\n\n <div class=\"modal-footer\">\n @if (type() === modalsType.delete) {\n <cw-button label=\"_COMMON._ACTION.DELETE\" [type]=\"buttonTypeEnum.danger\" [isMinWidth]=\"true\"\n (btnAction)=\"action1Click()\" dataTest=\"btn-action-modal\">\n </cw-button>\n\n <cw-button label=\"_COMMON._ACTION.CLOSE\" [type]=\"buttonTypeEnum.secondary\" [isMinWidth]=\"true\"\n (btnAction)=\"closeModal()\" dataTest=\"btn-close-modal\">\n </cw-button>\n }\n @else {\n @if (labelBtnAction1()) {\n <cw-button [label]=\"labelBtnAction1()\" [type]=\"buttonTypeEnum.primary\" [isMinWidth]=\"true\"\n (btnAction)=\"action1Click()\" dataTest=\"btn-action-modal\">\n </cw-button>\n }\n @if (labelBtnAction2()) {\n <cw-button [label]=\"labelBtnAction2()\" [type]=\"buttonTypeEnum.secondary\" [isMinWidth]=\"true\"\n (btnAction)=\"action2Click()\" dataTest=\"btn-action-modal\">\n </cw-button>\n }\n @else {\n <cw-button label=\"_COMMON._ACTION.CLOSE\" [type]=\"buttonTypeEnum.secondary\" [isMinWidth]=\"true\"\n (btnAction)=\"closeModal()\" dataTest=\"btn-close-modal\">\n </cw-button>\n }\n }\n </div>\n }\n @else {\n <div class=\"modal-body\">\n <cw-loader></cw-loader>\n </div>\n }\n\n </div>\n </div>\n</div>\n" }]
|
|
2638
3571
|
}], 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 }] }], modalTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "modalTitle", 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 }] }], customBodyTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "customBodyTemplate", required: false }] }], customBodyContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "customBodyContext", required: false }] }], btnAction1: [{ type: i0.Output, args: ["btnAction1"] }], btnAction2: [{ type: i0.Output, args: ["btnAction2"] }] } });
|
|
2639
3572
|
|
|
2640
3573
|
class TabContentComponent {
|
|
@@ -3003,7 +3936,7 @@ class NumericalRangeComponent {
|
|
|
3003
3936
|
this.newAmount.emit(next);
|
|
3004
3937
|
}
|
|
3005
3938
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: NumericalRangeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3006
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: NumericalRangeComponent, isStandalone: true, selector: "cw-numerical-range", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, amount: { classPropertyName: "amount", publicName: "amount", isSignal: true, isRequired: false, transformFunction: null }, withIcon: { classPropertyName: "withIcon", publicName: "withIcon", isSignal: true, isRequired: false, transformFunction: null }, withLabelVisible: { classPropertyName: "withLabelVisible", publicName: "withLabelVisible", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, ceil: { classPropertyName: "ceil", publicName: "ceil", isSignal: true, isRequired: false, transformFunction: null }, floor: { classPropertyName: "floor", publicName: "floor", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, autoChangeAmount: { classPropertyName: "autoChangeAmount", publicName: "autoChangeAmount", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { amount: "amountChange", newAmount: "newAmount" }, ngImport: i0, template: "<div class=\"numerical-range text-center\" [ngClass]=\"'numerical-range-' + type()\">\n\n @if (labelPosition() == labelPositionValue.outside && withLabelVisible()) {\n <div class=\"numerical-range-label\" aria-hidden=\"true\">\n @if (withIcon() && (type() == numericalRangeType.largeWhite || type() == numericalRangeType.largeGrey)) {\n <cw-icon [icon]=\"withIcon()\" [iconSize]=\"iconSize['lg']\"></cw-icon>\n }\n <span>{{ label() }}</span>\n </div>\n }\n\n <div class=\"numerical-range-container\">\n <cw-button [isDisabled]=\"isDisabled() || amount() <= floor()\" [label]=\"'Diminuer ' + amount() + ' ' + label()\"\n [withIcon]=\"spriteIcon.toolbarMinus\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\"\n [iconSize]=\"buttonIconSize.small\" (btnAction)=\"decreaseAmount()\">\n </cw-button>\n\n <div class=\"numerical-range-wrapper\">\n <div class=\"numerical-range-amount\" aria-live=\"polite\" aria-atomic=\"true\">\n {{ amount() }}\n @if (!withLabelVisible() && !withIcon()) {\n <span class=\"sr-only\">{{ label() }}</span>\n }\n </div>\n\n @if ((type() !== numericalRangeType.largeGrey && type() !== numericalRangeType.largeWhite) && (withIcon() ||\n withLabelVisible())) {\n <div class=\"numerical-range-label\">\n @if (withLabelVisible() && labelPosition() == labelPositionValue.inside) {\n @if (withIcon()) {\n <cw-icon [icon]=\"withIcon()\" [iconSize]=\"iconSize['lg']\" aria-hidden=\"true\"></cw-icon>\n }\n <span>{{ label() }}</span>\n }\n @else {\n @if (withIcon()) {\n <cw-icon [icon]=\"withIcon()\" [label]=\"label()\" [iconSize]=\"iconSize['lg']\"></cw-icon>\n }\n }\n </div>\n }\n </div>\n\n <cw-button [isDisabled]=\"isDisabled() || amount() >= ceil()\" [label]=\"'Augmenter ' + amount() + ' ' + label()\"\n [withIcon]=\"spriteIcon.toolbarPlus\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\"\n [iconSize]=\"buttonIconSize.small\" (btnAction)=\"increaseAmount()\">\n </cw-button>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom", "spritePath"] }, { kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "id", "isDropdown", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "cssClass", "dataTest", "skeletonMode", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }] }); }
|
|
3939
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: NumericalRangeComponent, isStandalone: true, selector: "cw-numerical-range", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, amount: { classPropertyName: "amount", publicName: "amount", isSignal: true, isRequired: false, transformFunction: null }, withIcon: { classPropertyName: "withIcon", publicName: "withIcon", isSignal: true, isRequired: false, transformFunction: null }, withLabelVisible: { classPropertyName: "withLabelVisible", publicName: "withLabelVisible", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, ceil: { classPropertyName: "ceil", publicName: "ceil", isSignal: true, isRequired: false, transformFunction: null }, floor: { classPropertyName: "floor", publicName: "floor", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, autoChangeAmount: { classPropertyName: "autoChangeAmount", publicName: "autoChangeAmount", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { amount: "amountChange", newAmount: "newAmount" }, ngImport: i0, template: "<div class=\"numerical-range text-center\" [ngClass]=\"'numerical-range-' + type()\">\n\n @if (labelPosition() == labelPositionValue.outside && withLabelVisible()) {\n <div class=\"numerical-range-label\" aria-hidden=\"true\">\n @if (withIcon() && (type() == numericalRangeType.largeWhite || type() == numericalRangeType.largeGrey)) {\n <cw-icon [icon]=\"withIcon()\" [iconSize]=\"iconSize['lg']\"></cw-icon>\n }\n <span>{{ label() }}</span>\n </div>\n }\n\n <div class=\"numerical-range-container\">\n <cw-button [isDisabled]=\"isDisabled() || amount() <= floor()\" [label]=\"'Diminuer ' + amount() + ' ' + label()\"\n [withIcon]=\"spriteIcon.toolbarMinus\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\"\n [iconSize]=\"buttonIconSize.small\" (btnAction)=\"decreaseAmount()\">\n </cw-button>\n\n <div class=\"numerical-range-wrapper\">\n <div class=\"numerical-range-amount\" aria-live=\"polite\" aria-atomic=\"true\">\n {{ amount() }}\n @if (!withLabelVisible() && !withIcon()) {\n <span class=\"sr-only\">{{ label() }}</span>\n }\n </div>\n\n @if ((type() !== numericalRangeType.largeGrey && type() !== numericalRangeType.largeWhite) && (withIcon() ||\n withLabelVisible())) {\n <div class=\"numerical-range-label\">\n @if (withLabelVisible() && labelPosition() == labelPositionValue.inside) {\n @if (withIcon()) {\n <cw-icon [icon]=\"withIcon()\" [iconSize]=\"iconSize['lg']\" aria-hidden=\"true\"></cw-icon>\n }\n <span>{{ label() }}</span>\n }\n @else {\n @if (withIcon()) {\n <cw-icon [icon]=\"withIcon()\" [label]=\"label()\" [iconSize]=\"iconSize['lg']\"></cw-icon>\n }\n }\n </div>\n }\n </div>\n\n <cw-button [isDisabled]=\"isDisabled() || amount() >= ceil()\" [label]=\"'Augmenter ' + amount() + ' ' + label()\"\n [withIcon]=\"spriteIcon.toolbarPlus\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\"\n [iconSize]=\"buttonIconSize.small\" (btnAction)=\"increaseAmount()\">\n </cw-button>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom", "spritePath"] }, { kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "cssClass", "dataTest", "skeletonMode", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }] }); }
|
|
3007
3940
|
}
|
|
3008
3941
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: NumericalRangeComponent, decorators: [{
|
|
3009
3942
|
type: Component,
|
|
@@ -3108,6 +4041,65 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImpo
|
|
|
3108
4041
|
], template: "@if (items().length > 0) {\n <nav class=\"breadcrumb\" [attr.aria-label]=\"ariaLabel() | translate\">\n <ol class=\"breadcrumb-list list-unstyled d-flex-h mb-0\">\n @for (item of items(); track $index; let first = $first) {\n <li\n class=\"breadcrumb-item\"\n [class.breadcrumb-item-home]=\"first\"\n [class.active]=\"item.isCurrent === true\"\n >\n @if (isClickable(item)) {\n <a class=\"breadcrumb-link\" [routerLink]=\"item.link\">{{ item.label | translate }}</a>\n } @else {\n <span\n class=\"breadcrumb-text\"\n [attr.aria-current]=\"item.isCurrent === true ? 'page' : null\"\n >{{ item.label | translate }}</span>\n }\n </li>\n }\n </ol>\n </nav>\n}\n" }]
|
|
3109
4042
|
}], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
|
|
3110
4043
|
|
|
4044
|
+
/**
|
|
4045
|
+
* Sélecteur de langue présentational.
|
|
4046
|
+
*
|
|
4047
|
+
* Affiche un trigger `cw-button [isDropdown]` (globe + code de la langue active + caret)
|
|
4048
|
+
* qui ouvre un panneau listant les langues au format `CODE - Nom` avec une coche sur
|
|
4049
|
+
* la langue active.
|
|
4050
|
+
*
|
|
4051
|
+
* Le composant N'A AUCUN effet de bord : il n'appelle pas `TranslateService.use()`,
|
|
4052
|
+
* ne touche pas au `localStorage`, ne recharge pas la page et ne navigue pas.
|
|
4053
|
+
* Il se contente d'émettre `languageChange` ; le consommateur gère l'effet de bord.
|
|
4054
|
+
*/
|
|
4055
|
+
class LanguageSelectorComponent {
|
|
4056
|
+
constructor() {
|
|
4057
|
+
this.translate = inject(TranslateService);
|
|
4058
|
+
/** Codes de langue à proposer, ex. ['fr','en']. */
|
|
4059
|
+
this.languages = input([], ...(ngDevMode ? [{ debugName: "languages" }] : []));
|
|
4060
|
+
/** Code de la langue active, ex. 'fr'. Pilote le code affiché dans le trigger + la coche. */
|
|
4061
|
+
this.currentLang = input.required(...(ngDevMode ? [{ debugName: "currentLang" }] : []));
|
|
4062
|
+
/** Affiche/masque la ligne d'avertissement « recharge la page ». Défaut: true. */
|
|
4063
|
+
this.showReloadHint = input(true, ...(ngDevMode ? [{ debugName: "showReloadHint" }] : []));
|
|
4064
|
+
/** Émis au clic sur une langue différente de l'active. Émet le CODE (ex. 'en'). */
|
|
4065
|
+
this.languageChange = output();
|
|
4066
|
+
this.trigger = viewChild(ButtonComponent, ...(ngDevMode ? [{ debugName: "trigger" }] : []));
|
|
4067
|
+
this.spriteIcon = SpriteIconEnum;
|
|
4068
|
+
this.iconSizeEnum = IconSizeEnum;
|
|
4069
|
+
this.btnType = FoButtonTypeEnum;
|
|
4070
|
+
}
|
|
4071
|
+
/** Clé i18n du nom d'une langue, ex. 'fr' → '_COMMON._LANG.LBL_FR'. */
|
|
4072
|
+
langNameKey(code) {
|
|
4073
|
+
return `_COMMON._LANG.LBL_${code.toUpperCase()}`;
|
|
4074
|
+
}
|
|
4075
|
+
/**
|
|
4076
|
+
* Indique si une traduction existe pour le nom de la langue.
|
|
4077
|
+
* Le pipe `translate` renvoie la clé brute si absente : on évite ainsi
|
|
4078
|
+
* d'afficher `FR - _COMMON._LANG.LBL_FR`.
|
|
4079
|
+
*/
|
|
4080
|
+
hasName(code) {
|
|
4081
|
+
const key = this.langNameKey(code);
|
|
4082
|
+
return this.translate.instant(key) !== key;
|
|
4083
|
+
}
|
|
4084
|
+
onSelect(code) {
|
|
4085
|
+
if (code !== this.currentLang()) {
|
|
4086
|
+
this.languageChange.emit(code);
|
|
4087
|
+
}
|
|
4088
|
+
this.trigger()?.closeDropdown();
|
|
4089
|
+
}
|
|
4090
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: LanguageSelectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4091
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: LanguageSelectorComponent, isStandalone: true, selector: "cw-language-selector", inputs: { languages: { classPropertyName: "languages", publicName: "languages", isSignal: true, isRequired: false, transformFunction: null }, currentLang: { classPropertyName: "currentLang", publicName: "currentLang", isSignal: true, isRequired: true, transformFunction: null }, showReloadHint: { classPropertyName: "showReloadHint", publicName: "showReloadHint", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { languageChange: "languageChange" }, viewQueries: [{ propertyName: "trigger", first: true, predicate: ButtonComponent, descendants: true, isSignal: true }], ngImport: i0, template: "<cw-button\n [label]=\"currentLang() | uppercase\"\n [type]=\"btnType.ghost\"\n [withIcon]=\"spriteIcon.language\"\n [isDropdown]=\"true\">\n\n <div role=\"menu\" [attr.aria-label]=\"'_COMMON._LANG.LBL_LANG' | translate\">\n @if (showReloadHint()) {\n <p>{{ '_COMMON._LANG.RELOAD_HINT' | translate }}</p>\n }\n\n <div class=\"fw-bold\">{{ '_COMMON._LANG.LBL_LANG' | translate }}</div>\n\n @for (lang of languages(); track lang) {\n <button\n type=\"button\"\n role=\"menuitemradio\"\n class=\"\"\n [class.active]=\"lang === currentLang()\"\n [attr.aria-checked]=\"lang === currentLang()\"\n (click)=\"onSelect(lang)\">\n <span>@if (hasName(lang)) { {{ lang | uppercase }} - {{ langNameKey(lang) | translate }} } @else { {{ lang | uppercase }} }</span>\n @if (lang === currentLang()) {\n <cw-icon [icon]=\"spriteIcon.check\" [iconSize]=\"iconSizeEnum.xs\"></cw-icon>\n }\n </button>\n }\n </div>\n</cw-button>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "cssClass", "dataTest", "skeletonMode", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom", "spritePath"] }, { kind: "pipe", type: i1.UpperCasePipe, name: "uppercase" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
|
|
4092
|
+
}
|
|
4093
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: LanguageSelectorComponent, decorators: [{
|
|
4094
|
+
type: Component,
|
|
4095
|
+
args: [{ selector: 'cw-language-selector', standalone: true, imports: [
|
|
4096
|
+
CommonModule,
|
|
4097
|
+
TranslateModule,
|
|
4098
|
+
ButtonComponent,
|
|
4099
|
+
IconComponent
|
|
4100
|
+
], template: "<cw-button\n [label]=\"currentLang() | uppercase\"\n [type]=\"btnType.ghost\"\n [withIcon]=\"spriteIcon.language\"\n [isDropdown]=\"true\">\n\n <div role=\"menu\" [attr.aria-label]=\"'_COMMON._LANG.LBL_LANG' | translate\">\n @if (showReloadHint()) {\n <p>{{ '_COMMON._LANG.RELOAD_HINT' | translate }}</p>\n }\n\n <div class=\"fw-bold\">{{ '_COMMON._LANG.LBL_LANG' | translate }}</div>\n\n @for (lang of languages(); track lang) {\n <button\n type=\"button\"\n role=\"menuitemradio\"\n class=\"\"\n [class.active]=\"lang === currentLang()\"\n [attr.aria-checked]=\"lang === currentLang()\"\n (click)=\"onSelect(lang)\">\n <span>@if (hasName(lang)) { {{ lang | uppercase }} - {{ langNameKey(lang) | translate }} } @else { {{ lang | uppercase }} }</span>\n @if (lang === currentLang()) {\n <cw-icon [icon]=\"spriteIcon.check\" [iconSize]=\"iconSizeEnum.xs\"></cw-icon>\n }\n </button>\n }\n </div>\n</cw-button>\n" }]
|
|
4101
|
+
}], propDecorators: { languages: [{ type: i0.Input, args: [{ isSignal: true, alias: "languages", required: false }] }], currentLang: [{ type: i0.Input, args: [{ isSignal: true, alias: "currentLang", required: true }] }], showReloadHint: [{ type: i0.Input, args: [{ isSignal: true, alias: "showReloadHint", required: false }] }], languageChange: [{ type: i0.Output, args: ["languageChange"] }], trigger: [{ type: i0.ViewChild, args: [i0.forwardRef(() => ButtonComponent), { isSignal: true }] }] } });
|
|
4102
|
+
|
|
3111
4103
|
var PlacementEnum;
|
|
3112
4104
|
(function (PlacementEnum) {
|
|
3113
4105
|
PlacementEnum["Left"] = "left";
|
|
@@ -3125,5 +4117,5 @@ var PlacementEnum;
|
|
|
3125
4117
|
* Generated bundle index. Do not edit.
|
|
3126
4118
|
*/
|
|
3127
4119
|
|
|
3128
|
-
export { AccordionComponent, AlertComponent, AlertTypeEnum, BadgeComponent, BadgePositionEnum, BadgeTypeEnum, BoButtonTypeEnum, BoTabTypeEnum, BreadcrumbComponent, ButtonComponent, ButtonIconSizeEnum, ButtonPositionEnum, CardComponent, CardTitleRankEnum, CardTypeEnum, ClickOutsideDirective, CollapseDirective, DropdownComponent, DropdownItemDirective, DropdownPositionEnum, FileToDownloadComponent, FoButtonTypeEnum, FoTabTypeEnum, FocusTrackerService, FormFieldComponent, FormFieldTypeEnum, IconComponent, IconNotifSizeEnum, IconNotifTypeEnum, IconNotificationComponent, IconSizeEnum, IconTypeEnum, IconUiTypeEnum, ImageComponent, LegendComponent, LegendTypeEnum, LoaderComponent, ModalsComponent, ModalsService, ModalsSize, ModalsType, NumericalRangeComponent, NumericalRangeLabelPositionEnum, NumericalRangeTypeEnum, PlacementEnum, RequiredInfoComponent, ResponsiveService, SkipLinksComponent, SpriteIconEnum, StepperComponent, TOAST_AUTOHIDE_DELAY_MS, TabComponent, TabContentComponent, TitleComponent, TitleContextEnum, TitleTagEnum, ToastComponent, ToastItemComponent, ToastService, TriggerTooltipEnum, TypeTooltipEnum, WizardStepComponent, WizardStepperComponent, rangeValidator };
|
|
4120
|
+
export { AccordionComponent, AlertComponent, AlertTypeEnum, AutocompleteComponent, BadgeComponent, BadgePositionEnum, BadgeTypeEnum, BoButtonTypeEnum, BoTabTypeEnum, BreadcrumbComponent, ButtonComponent, ButtonIconSizeEnum, ButtonPositionEnum, CardComponent, CardTitleRankEnum, CardTypeEnum, ClickOutsideDirective, CollapseDirective, DropdownComponent, DropdownItemDirective, DropdownPositionEnum, FileToDownloadComponent, FoButtonTypeEnum, FoTabTypeEnum, FocusTrackerService, FormFieldComponent, FormFieldTypeEnum, IconComponent, IconNotifSizeEnum, IconNotifTypeEnum, IconNotificationComponent, IconSizeEnum, IconTypeEnum, IconUiTypeEnum, ImageComponent, LanguageSelectorComponent, LegendComponent, LegendTypeEnum, LoaderComponent, ModalsComponent, ModalsService, ModalsSize, ModalsType, NumericalRangeComponent, NumericalRangeLabelPositionEnum, NumericalRangeTypeEnum, PlacementEnum, RequiredInfoComponent, ResponsiveService, SkipLinksComponent, SpriteIconEnum, StepperComponent, TOAST_AUTOHIDE_DELAY_MS, TabComponent, TabContentComponent, TitleComponent, TitleContextEnum, TitleTagEnum, ToastComponent, ToastItemComponent, ToastService, TriggerTooltipEnum, TypeTooltipEnum, WizardStepComponent, WizardStepperComponent, rangeValidator };
|
|
3129
4121
|
//# sourceMappingURL=cityway-basic-ui.mjs.map
|