@cityway/basic-ui 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -0
- package/cityway-basic-ui-1.0.1.tgz +0 -0
- package/fesm2022/cityway-basic-ui.mjs +2092 -0
- package/fesm2022/cityway-basic-ui.mjs.map +1 -0
- package/index.d.ts +766 -0
- package/lib/assets/fonts/bo/_variables.scss +43 -0
- package/lib/assets/fonts/bo/bo.scss +61 -0
- package/lib/assets/fonts/bo/bo.woff +0 -0
- package/lib/assets/fonts/bo/bo.woff2 +0 -0
- package/lib/assets/fonts/nunito/_nunito.scss +39 -0
- package/lib/assets/fonts/nunito/nunito-bold.woff +0 -0
- package/lib/assets/fonts/nunito/nunito-bold.woff2 +0 -0
- package/lib/assets/fonts/nunito/nunito-extrabold.woff +0 -0
- package/lib/assets/fonts/nunito/nunito-extrabold.woff2 +0 -0
- package/lib/assets/fonts/nunito/nunito-light.woff +0 -0
- package/lib/assets/fonts/nunito/nunito-light.woff2 +0 -0
- package/lib/assets/fonts/nunito/nunito-regular.woff +0 -0
- package/lib/assets/fonts/nunito/nunito-regular.woff2 +0 -0
- package/lib/assets/fonts/nunito/nunito-semi-bold.woff +0 -0
- package/lib/assets/fonts/nunito/nunito-semi-bold.woff2 +0 -0
- package/lib/assets/fonts/optyweb/_variables.scss +405 -0
- package/lib/assets/fonts/optyweb/optyweb.scss +1571 -0
- package/lib/assets/fonts/optyweb/optyweb.woff +0 -0
- package/lib/assets/fonts/optyweb/optyweb.woff2 +0 -0
- package/lib/assets/i18n/common.en.json +248 -0
- package/lib/assets/i18n/common.fr.json +242 -0
- package/lib/assets/i18n/label.en.json +29 -0
- package/lib/assets/i18n/label.fr.json +29 -0
- package/lib/assets/images/common/check-mark.svg +3 -0
- package/lib/assets/images/favicon/android-chrome-192x192.png +0 -0
- package/lib/assets/images/favicon/android-chrome-512x512.png +0 -0
- package/lib/assets/images/favicon/apple-touch-icon.png +0 -0
- package/lib/assets/images/favicon/favicon-16x16.png +0 -0
- package/lib/assets/images/favicon/favicon-32x32.png +0 -0
- package/lib/assets/images/favicon/favicon-96x96.png +0 -0
- package/lib/assets/images/favicon/favicon.ico +0 -0
- package/lib/assets/images/favicon/site.webmanifest +19 -0
- package/lib/assets/images/icon/referential-icon.svg +1 -0
- package/lib/assets/images/login/login-bg.jpg +0 -0
- package/lib/assets/images/login/logo-cityway-baseline.svg +16 -0
- package/lib/assets/images/toast/warning.svg +3 -0
- package/lib/assets/styles/scss/_components.scss +14 -0
- package/lib/assets/styles/scss/_custom-bootstrap.scss +22 -0
- package/lib/assets/styles/scss/bootstrap/_accordion.scss +1 -0
- package/lib/assets/styles/scss/bootstrap/_alert.scss +32 -0
- package/lib/assets/styles/scss/bootstrap/_badge.scss +36 -0
- package/lib/assets/styles/scss/bootstrap/_breadcrumb.scss +46 -0
- package/lib/assets/styles/scss/bootstrap/_button-group.scss +107 -0
- package/lib/assets/styles/scss/bootstrap/_buttons.scss +324 -0
- package/lib/assets/styles/scss/bootstrap/_card.scss +107 -0
- package/lib/assets/styles/scss/bootstrap/_close.scss +8 -0
- package/lib/assets/styles/scss/bootstrap/_dropdown.scss +53 -0
- package/lib/assets/styles/scss/bootstrap/_forms.scss +259 -0
- package/lib/assets/styles/scss/bootstrap/_input-group.scss +61 -0
- package/lib/assets/styles/scss/bootstrap/_lists.scss +30 -0
- package/lib/assets/styles/scss/bootstrap/_modal.scss +152 -0
- package/lib/assets/styles/scss/bootstrap/_pagination.scss +21 -0
- package/lib/assets/styles/scss/bootstrap/_popover.scss +5 -0
- package/lib/assets/styles/scss/bootstrap/_progress.scss +6 -0
- package/lib/assets/styles/scss/bootstrap/_reboot.scss +5 -0
- package/lib/assets/styles/scss/bootstrap/_tables.scss +155 -0
- package/lib/assets/styles/scss/bootstrap/_tabs.scss +71 -0
- package/lib/assets/styles/scss/bootstrap/_tooltip.scss +3 -0
- package/lib/assets/styles/scss/bootstrap/_type.scss +55 -0
- package/lib/assets/styles/scss/components/_forms-firefox.scss +17 -0
- package/lib/assets/styles/scss/components/_leaflet.scss +41 -0
- package/lib/assets/styles/scss/components/_legend.scss +36 -0
- package/lib/assets/styles/scss/components/_ng-select.scss +148 -0
- package/lib/assets/styles/scss/components/_ng2-dragula.scss +36 -0
- package/lib/assets/styles/scss/components/_ng2-validation.scss +39 -0
- package/lib/assets/styles/scss/components/_ng5-slider.scss +28 -0
- package/lib/assets/styles/scss/components/_ngb-datepicker.scss +165 -0
- package/lib/assets/styles/scss/components/_ngb-timepicker.scss +19 -0
- package/lib/assets/styles/scss/components/_ngx-chips.scss +102 -0
- package/lib/assets/styles/scss/components/_ngx-editor.scss +10 -0
- package/lib/assets/styles/scss/components/_ngx-file-drop.scss +15 -0
- package/lib/assets/styles/scss/components/_ngx-intl-tel-input.scss +21 -0
- package/lib/assets/styles/scss/components/_ngx-slider.scss +34 -0
- package/lib/assets/styles/scss/components/_ngx-toast.scss +74 -0
- package/lib/assets/styles/scss/components/_pwd-policy.scss +18 -0
- package/lib/assets/styles/scss/components/_table.scss +8 -0
- package/lib/assets/styles/scss/components/_vis.scss +50 -0
- package/lib/assets/styles/scss/components/_wizard-stepper.scss +82 -0
- package/lib/assets/styles/scss/components/table/_table-action.scss +77 -0
- package/lib/assets/styles/scss/components/table/_table-bg-cell.scss +6 -0
- package/lib/assets/styles/scss/components/table/_table-double-scroll.scss +38 -0
- package/lib/assets/styles/scss/components/table/_table-filter.scss +128 -0
- package/lib/assets/styles/scss/components/table/_table-pagination.scss +34 -0
- package/lib/assets/styles/scss/components/table/_table-popover.scss +39 -0
- package/lib/assets/styles/scss/components/table/_table-sorting.scss +64 -0
- package/lib/assets/styles/scss/cw-ds/_reboot.scss +551 -0
- package/lib/assets/styles/scss/cw-ds/_root-bo.scss +9 -0
- package/lib/assets/styles/scss/cw-ds/_root-fo.scss +9 -0
- package/lib/assets/styles/scss/cw-ds/components/_alert.scss +76 -0
- package/lib/assets/styles/scss/cw-ds/components/_badge.scss +107 -0
- package/lib/assets/styles/scss/cw-ds/components/_btn-collapse.scss +15 -0
- package/lib/assets/styles/scss/cw-ds/components/_card.scss +66 -0
- package/lib/assets/styles/scss/cw-ds/components/_close.scss +6 -0
- package/lib/assets/styles/scss/cw-ds/components/_file-to-download.scss +46 -0
- package/lib/assets/styles/scss/cw-ds/components/_icon-notification.scss +30 -0
- package/lib/assets/styles/scss/cw-ds/components/_icon.scss +112 -0
- package/lib/assets/styles/scss/cw-ds/components/_numerical-range.scss +60 -0
- package/lib/assets/styles/scss/cw-ds/components/_stepper.scss +78 -0
- package/lib/assets/styles/scss/cw-ds/components/_tab.scss +81 -0
- package/lib/assets/styles/scss/cw-ds/components/_toast.scss +27 -0
- package/lib/assets/styles/scss/cw-ds/components/button/_button-bo-variant.scss +46 -0
- package/lib/assets/styles/scss/cw-ds/components/button/_button-fo-variant.scss +112 -0
- package/lib/assets/styles/scss/cw-ds/components/button/_button.scss +95 -0
- package/lib/assets/styles/scss/cw-ds/helpers/_spinner.scss +30 -0
- package/lib/assets/styles/scss/cw-ds/helpers/_stretched-link.scss +9 -0
- package/lib/assets/styles/scss/cw-ds/helpers/_visually-hidden.scss +18 -0
- package/lib/assets/styles/scss/cw-ds/mixins/_color.scss +16 -0
- package/lib/assets/styles/scss/cw-ds/mixins/_flex.scss +11 -0
- package/lib/assets/styles/scss/cw-ds/mixins/_root.scss +26 -0
- package/lib/assets/styles/scss/cw-ds/mixins/_spacing.scss +84 -0
- package/lib/assets/styles/scss/cw-ds/mixins/_type.scss +27 -0
- package/lib/assets/styles/scss/cw-ds/utilities/_alignment.scss +23 -0
- package/lib/assets/styles/scss/cw-ds/utilities/_flex.scss +96 -0
- package/lib/assets/styles/scss/cw-ds/utilities/_spacing.scss +3 -0
- package/lib/assets/styles/scss/cw-ds/utilities/_type.scss +3 -0
- package/lib/assets/styles/scss/styles-bo.scss +115 -0
- package/lib/assets/styles/scss/styles-fo.scss +115 -0
- package/lib/assets/styles/scss/variables/_colors.scss +43 -0
- package/lib/assets/styles/scss/variables/_custom.scss +451 -0
- package/lib/assets/styles/scss/variables/_site.scss +68 -0
- package/package.json +33 -0
- package/styles-bo.min.css +5 -0
- package/styles-bo.min.css.map +1 -0
- package/styles-fo.min.css +5 -0
- package/styles-fo.min.css.map +1 -0
|
@@ -0,0 +1,2092 @@
|
|
|
1
|
+
import * as i1 from '@angular/common';
|
|
2
|
+
import { CommonModule, NgTemplateOutlet, NgClass } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, ElementRef, signal, EventEmitter, effect, Output, Input, Directive, HostBinding, Component, ViewChild, ContentChildren, Injectable, HostListener, Renderer2, output, TemplateRef, ContentChild, ViewChildren, Pipe } from '@angular/core';
|
|
5
|
+
import * as i2 from '@ngx-translate/core';
|
|
6
|
+
import { TranslateModule, TranslateService, TranslatePipe } from '@ngx-translate/core';
|
|
7
|
+
import { BehaviorSubject, fromEvent } from 'rxjs';
|
|
8
|
+
import * as i4 from '@angular-slider/ngx-slider';
|
|
9
|
+
import { NgxSliderModule } from '@angular-slider/ngx-slider';
|
|
10
|
+
import * as i2$1 from '@angular/forms';
|
|
11
|
+
import { FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
12
|
+
import * as i1$1 from '@ng-bootstrap/ng-bootstrap';
|
|
13
|
+
import { NgbDropdownModule, NgbPopover } from '@ng-bootstrap/ng-bootstrap';
|
|
14
|
+
import * as i3 from '@ng-select/ng-select';
|
|
15
|
+
import { NgSelectModule } from '@ng-select/ng-select';
|
|
16
|
+
import * as i1$2 from '@angular/router';
|
|
17
|
+
|
|
18
|
+
class CollapseDirective {
|
|
19
|
+
set cwCollapse(value) {
|
|
20
|
+
this.collapsedSignal.set(value);
|
|
21
|
+
}
|
|
22
|
+
get cwCollapse() {
|
|
23
|
+
return this.collapsedSignal();
|
|
24
|
+
}
|
|
25
|
+
constructor() {
|
|
26
|
+
this.elementRef = inject(ElementRef);
|
|
27
|
+
// Utilisation de signals pour la réactivité
|
|
28
|
+
this.collapsedSignal = signal(false, ...(ngDevMode ? [{ debugName: "collapsedSignal" }] : []));
|
|
29
|
+
this.shown = new EventEmitter();
|
|
30
|
+
this.hidden = new EventEmitter();
|
|
31
|
+
// Effect pour réagir aux changements de collapsed
|
|
32
|
+
effect(() => {
|
|
33
|
+
const isCollapsed = this.collapsedSignal();
|
|
34
|
+
this.updateClasses(isCollapsed);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
ngOnInit() {
|
|
38
|
+
this.elementRef.nativeElement.classList.add('collapse');
|
|
39
|
+
this.updateClasses(this.collapsedSignal());
|
|
40
|
+
}
|
|
41
|
+
updateClasses(isCollapsed) {
|
|
42
|
+
const element = this.elementRef.nativeElement;
|
|
43
|
+
if (isCollapsed) {
|
|
44
|
+
element.classList.remove('show');
|
|
45
|
+
this.hidden.emit();
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
element.classList.add('show');
|
|
49
|
+
this.shown.emit();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
toggle() {
|
|
53
|
+
this.collapsedSignal.update(value => !value);
|
|
54
|
+
}
|
|
55
|
+
show() {
|
|
56
|
+
this.collapsedSignal.set(false);
|
|
57
|
+
}
|
|
58
|
+
hide() {
|
|
59
|
+
this.collapsedSignal.set(true);
|
|
60
|
+
}
|
|
61
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CollapseDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
62
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.16", type: CollapseDirective, isStandalone: true, selector: "[cwCollapse]", inputs: { cwCollapse: "cwCollapse" }, outputs: { shown: "shown", hidden: "hidden" }, exportAs: ["cwCollapse"], ngImport: i0 }); }
|
|
63
|
+
}
|
|
64
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CollapseDirective, decorators: [{
|
|
65
|
+
type: Directive,
|
|
66
|
+
args: [{
|
|
67
|
+
selector: '[cwCollapse]',
|
|
68
|
+
exportAs: 'cwCollapse',
|
|
69
|
+
standalone: true
|
|
70
|
+
}]
|
|
71
|
+
}], ctorParameters: () => [], propDecorators: { cwCollapse: [{
|
|
72
|
+
type: Input,
|
|
73
|
+
args: [{ required: false }]
|
|
74
|
+
}], shown: [{
|
|
75
|
+
type: Output
|
|
76
|
+
}], hidden: [{
|
|
77
|
+
type: Output
|
|
78
|
+
}] } });
|
|
79
|
+
|
|
80
|
+
var IconSizeEnum;
|
|
81
|
+
(function (IconSizeEnum) {
|
|
82
|
+
IconSizeEnum["5xl"] = "5xl";
|
|
83
|
+
IconSizeEnum["4xl"] = "4xl";
|
|
84
|
+
IconSizeEnum["3xl"] = "3xl";
|
|
85
|
+
IconSizeEnum["2xl"] = "2xl";
|
|
86
|
+
IconSizeEnum["xl"] = "xl";
|
|
87
|
+
IconSizeEnum["lg"] = "lg";
|
|
88
|
+
IconSizeEnum["md"] = "md";
|
|
89
|
+
IconSizeEnum["sm"] = "sm";
|
|
90
|
+
IconSizeEnum["xs"] = "xs";
|
|
91
|
+
IconSizeEnum["2xs"] = "2xs";
|
|
92
|
+
IconSizeEnum["3xs"] = "3xs";
|
|
93
|
+
})(IconSizeEnum || (IconSizeEnum = {}));
|
|
94
|
+
var IconTypeEnum;
|
|
95
|
+
(function (IconTypeEnum) {
|
|
96
|
+
IconTypeEnum["default"] = "default";
|
|
97
|
+
IconTypeEnum["rounded"] = "rounded";
|
|
98
|
+
})(IconTypeEnum || (IconTypeEnum = {}));
|
|
99
|
+
var IconUiTypeEnum;
|
|
100
|
+
(function (IconUiTypeEnum) {
|
|
101
|
+
IconUiTypeEnum["default"] = "default";
|
|
102
|
+
IconUiTypeEnum["light"] = "light";
|
|
103
|
+
IconUiTypeEnum["primary"] = "primary";
|
|
104
|
+
IconUiTypeEnum["invert"] = "invert";
|
|
105
|
+
})(IconUiTypeEnum || (IconUiTypeEnum = {}));
|
|
106
|
+
|
|
107
|
+
class IconComponent {
|
|
108
|
+
constructor() {
|
|
109
|
+
this.icon = 'cw-alert-help';
|
|
110
|
+
this.font = 'optyweb';
|
|
111
|
+
this.type = IconTypeEnum.default;
|
|
112
|
+
this.iconSize = IconSizeEnum['sm'];
|
|
113
|
+
this.iconCssClass = '';
|
|
114
|
+
this.iconUiType = IconUiTypeEnum.default;
|
|
115
|
+
this.iconTypeEnum = IconTypeEnum;
|
|
116
|
+
}
|
|
117
|
+
get hostClasses() {
|
|
118
|
+
if (this.type == IconTypeEnum.rounded) {
|
|
119
|
+
return 'icon-rounded icon-rounded-' + this.iconSize + ' icon-rounded-' + this.iconUiType;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
return 'icon icon-' + this.iconSize;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
ngOnInit() {
|
|
126
|
+
this.iconClass = this.font + ' ' + this.icon;
|
|
127
|
+
}
|
|
128
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: IconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
129
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: IconComponent, isStandalone: true, selector: "cw-icon", inputs: { icon: "icon", font: "font", label: "label", type: "type", iconSize: "iconSize", iconCssClass: "iconCssClass", iconUiType: "iconUiType", iconColorCustom: "iconColorCustom" }, host: { properties: { "class": "this.hostClasses" } }, ngImport: i0, template: "@if (type == iconTypeEnum.rounded) {\r\n <span class=\"icon\">\r\n <ng-container *ngTemplateOutlet=\"icon\"></ng-container>\r\n </span>\r\n } @else {\r\n <ng-container *ngTemplateOutlet=\"icon\"></ng-container>\r\n }\r\n\r\n<ng-template #icon>\r\n <span [class]=\"iconClass + ' icon-span'\" [ngClass]=\"iconCssClass\" aria-hidden=\"true\" [attr.style]=\"iconColorCustom ? 'color: ' + iconColorCustom : null\"></span>\r\n @if (label) {\r\n <span class=\"visually-hidden\">{{ label }}</span>\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"] }] }); }
|
|
130
|
+
}
|
|
131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: IconComponent, decorators: [{
|
|
132
|
+
type: Component,
|
|
133
|
+
args: [{ selector: 'cw-icon', standalone: true, imports: [
|
|
134
|
+
CommonModule
|
|
135
|
+
], template: "@if (type == iconTypeEnum.rounded) {\r\n <span class=\"icon\">\r\n <ng-container *ngTemplateOutlet=\"icon\"></ng-container>\r\n </span>\r\n } @else {\r\n <ng-container *ngTemplateOutlet=\"icon\"></ng-container>\r\n }\r\n\r\n<ng-template #icon>\r\n <span [class]=\"iconClass + ' icon-span'\" [ngClass]=\"iconCssClass\" aria-hidden=\"true\" [attr.style]=\"iconColorCustom ? 'color: ' + iconColorCustom : null\"></span>\r\n @if (label) {\r\n <span class=\"visually-hidden\">{{ label }}</span>\r\n }\r\n</ng-template>\r\n" }]
|
|
136
|
+
}], ctorParameters: () => [], propDecorators: { icon: [{
|
|
137
|
+
type: Input
|
|
138
|
+
}], font: [{
|
|
139
|
+
type: Input
|
|
140
|
+
}], label: [{
|
|
141
|
+
type: Input
|
|
142
|
+
}], type: [{
|
|
143
|
+
type: Input
|
|
144
|
+
}], iconSize: [{
|
|
145
|
+
type: Input
|
|
146
|
+
}], iconCssClass: [{
|
|
147
|
+
type: Input
|
|
148
|
+
}], iconUiType: [{
|
|
149
|
+
type: Input
|
|
150
|
+
}], iconColorCustom: [{
|
|
151
|
+
type: Input
|
|
152
|
+
}], hostClasses: [{
|
|
153
|
+
type: HostBinding,
|
|
154
|
+
args: ['class']
|
|
155
|
+
}] } });
|
|
156
|
+
|
|
157
|
+
var CardTypeEnum;
|
|
158
|
+
(function (CardTypeEnum) {
|
|
159
|
+
CardTypeEnum["default"] = "default";
|
|
160
|
+
CardTypeEnum["light"] = "light";
|
|
161
|
+
})(CardTypeEnum || (CardTypeEnum = {}));
|
|
162
|
+
var CardTitleRankEnum;
|
|
163
|
+
(function (CardTitleRankEnum) {
|
|
164
|
+
CardTitleRankEnum["h2"] = "h2";
|
|
165
|
+
CardTitleRankEnum["h3"] = "h3";
|
|
166
|
+
})(CardTitleRankEnum || (CardTitleRankEnum = {}));
|
|
167
|
+
|
|
168
|
+
class CardComponent {
|
|
169
|
+
constructor(cdRef) {
|
|
170
|
+
this.cdRef = cdRef;
|
|
171
|
+
this.type = CardTypeEnum.default;
|
|
172
|
+
this.titleRank = CardTitleRankEnum.h2;
|
|
173
|
+
this.collapsible = false;
|
|
174
|
+
this.collapsed = false;
|
|
175
|
+
this.collapseId = `collapse-${Math.random().toString(36).substring(2, 11)}`;
|
|
176
|
+
this.destroyOnHide = true;
|
|
177
|
+
this.collapseClicked = new EventEmitter();
|
|
178
|
+
this.showFooter = true;
|
|
179
|
+
this.titleRankEnum = CardTitleRankEnum;
|
|
180
|
+
this.typeEnum = CardTypeEnum;
|
|
181
|
+
this.isCollapsed = signal(false, ...(ngDevMode ? [{ debugName: "isCollapsed" }] : []));
|
|
182
|
+
this.shouldRenderBody = signal(true, ...(ngDevMode ? [{ debugName: "shouldRenderBody" }] : []));
|
|
183
|
+
this.iconSize = IconSizeEnum;
|
|
184
|
+
}
|
|
185
|
+
ngOnInit() {
|
|
186
|
+
this.isCollapsed.set(this.collapsed);
|
|
187
|
+
if (this.destroyOnHide && this.collapsed) {
|
|
188
|
+
this.shouldRenderBody.set(false);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
ngAfterViewInit() {
|
|
192
|
+
this.showFooter = this.cardFooter.nativeElement && this.cardFooter.nativeElement.children.length > 0;
|
|
193
|
+
this.cdRef.detectChanges();
|
|
194
|
+
}
|
|
195
|
+
toggleCollapse() {
|
|
196
|
+
if (this.collapsible) {
|
|
197
|
+
const newCollapsedState = !this.isCollapsed();
|
|
198
|
+
this.updateCollapseState(newCollapsedState);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
collapse() {
|
|
202
|
+
this.updateCollapseState(true);
|
|
203
|
+
}
|
|
204
|
+
expand() {
|
|
205
|
+
this.updateCollapseState(false);
|
|
206
|
+
}
|
|
207
|
+
updateCollapseState(collapsed) {
|
|
208
|
+
if (!collapsed && this.destroyOnHide && !this.shouldRenderBody()) {
|
|
209
|
+
this.shouldRenderBody.set(true);
|
|
210
|
+
this.cdRef.detectChanges();
|
|
211
|
+
}
|
|
212
|
+
this.isCollapsed.set(collapsed);
|
|
213
|
+
this.collapseClicked.emit(collapsed);
|
|
214
|
+
if (collapsed && this.destroyOnHide) {
|
|
215
|
+
setTimeout(() => {
|
|
216
|
+
if (this.isCollapsed()) {
|
|
217
|
+
this.shouldRenderBody.set(false);
|
|
218
|
+
this.cdRef.detectChanges();
|
|
219
|
+
}
|
|
220
|
+
}, 120);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
get collapsed_state() {
|
|
224
|
+
return this.isCollapsed();
|
|
225
|
+
}
|
|
226
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CardComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
227
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: CardComponent, isStandalone: true, selector: "cw-card", inputs: { title: "title", type: "type", titleRank: "titleRank", collapsible: "collapsible", collapsed: "collapsed", collapseId: "collapseId", destroyOnHide: "destroyOnHide" }, outputs: { collapseClicked: "collapseClicked" }, viewQueries: [{ propertyName: "collapseDirective", first: true, predicate: ["collapse"], descendants: true }, { propertyName: "cardFooter", first: true, predicate: ["cardFooter"], descendants: true }], ngImport: i0, template: "<div class=\"card\" [class.card-collapse]=\"collapsible\" [class.card-light]=\"type == typeEnum.light\">\n @if (title) {\n <div class=\"card-header\" [class.card-header-collapse]=\"collapsible\"\n [class.card-header-collapsed]=\"collapsible && isCollapsed()\">\n <ng-container *ngTemplateOutlet=\"header\"></ng-container>\n </div>\n }\n\n @if (shouldRenderBody()) {\n <div class=\"card-body\" [cwCollapse]=\"isCollapsed()\" [id]=\"collapseId\" #collapse=\"cwCollapse\">\n <ng-content></ng-content>\n </div>\n }\n\n @if (showFooter) {\n <div class=\"card-footer\" #cardFooter>\n <ng-content select=\"[card-footer]\"></ng-content>\n </div>\n }\n</div>\n\n<ng-template #header>\n @if (titleRank == titleRankEnum.h2) {\n <h2>{{title}}</h2>\n }\n @else if (titleRank == titleRankEnum.h3) {\n <h3>{{title}}</h3>\n }\n\n <div class=\"card-header-custom-area\">\n <ng-content select=\"[header-custom-area]\"></ng-content>\n </div>\n\n @if (collapsible) {\n <button type=\"button\" class=\"btn btn-collapse stretched-link\" (click)=\"toggleCollapse()\"\n [attr.aria-expanded]=\"!isCollapsed()\" [class.collapsed]=\"isCollapsed()\" [attr.aria-controls]=\"collapseId\">\n <cw-icon icon=\"cw-nav-expand2\" label=\"D\u00E9plier/Plier\" [iconSize]=\"iconSize['xs']\"></cw-icon>\n <!-- // TODO trad -->\n </button>\n }\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: CollapseDirective, selector: "[cwCollapse]", inputs: ["cwCollapse"], outputs: ["shown", "hidden"], exportAs: ["cwCollapse"] }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "font", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom"] }] }); }
|
|
228
|
+
}
|
|
229
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CardComponent, decorators: [{
|
|
230
|
+
type: Component,
|
|
231
|
+
args: [{ selector: 'cw-card', standalone: true, imports: [
|
|
232
|
+
CommonModule,
|
|
233
|
+
CollapseDirective,
|
|
234
|
+
IconComponent
|
|
235
|
+
], template: "<div class=\"card\" [class.card-collapse]=\"collapsible\" [class.card-light]=\"type == typeEnum.light\">\n @if (title) {\n <div class=\"card-header\" [class.card-header-collapse]=\"collapsible\"\n [class.card-header-collapsed]=\"collapsible && isCollapsed()\">\n <ng-container *ngTemplateOutlet=\"header\"></ng-container>\n </div>\n }\n\n @if (shouldRenderBody()) {\n <div class=\"card-body\" [cwCollapse]=\"isCollapsed()\" [id]=\"collapseId\" #collapse=\"cwCollapse\">\n <ng-content></ng-content>\n </div>\n }\n\n @if (showFooter) {\n <div class=\"card-footer\" #cardFooter>\n <ng-content select=\"[card-footer]\"></ng-content>\n </div>\n }\n</div>\n\n<ng-template #header>\n @if (titleRank == titleRankEnum.h2) {\n <h2>{{title}}</h2>\n }\n @else if (titleRank == titleRankEnum.h3) {\n <h3>{{title}}</h3>\n }\n\n <div class=\"card-header-custom-area\">\n <ng-content select=\"[header-custom-area]\"></ng-content>\n </div>\n\n @if (collapsible) {\n <button type=\"button\" class=\"btn btn-collapse stretched-link\" (click)=\"toggleCollapse()\"\n [attr.aria-expanded]=\"!isCollapsed()\" [class.collapsed]=\"isCollapsed()\" [attr.aria-controls]=\"collapseId\">\n <cw-icon icon=\"cw-nav-expand2\" label=\"D\u00E9plier/Plier\" [iconSize]=\"iconSize['xs']\"></cw-icon>\n <!-- // TODO trad -->\n </button>\n }\n</ng-template>\n" }]
|
|
236
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { title: [{
|
|
237
|
+
type: Input
|
|
238
|
+
}], type: [{
|
|
239
|
+
type: Input
|
|
240
|
+
}], titleRank: [{
|
|
241
|
+
type: Input
|
|
242
|
+
}], collapsible: [{
|
|
243
|
+
type: Input
|
|
244
|
+
}], collapsed: [{
|
|
245
|
+
type: Input
|
|
246
|
+
}], collapseId: [{
|
|
247
|
+
type: Input
|
|
248
|
+
}], destroyOnHide: [{
|
|
249
|
+
type: Input
|
|
250
|
+
}], collapseClicked: [{
|
|
251
|
+
type: Output
|
|
252
|
+
}], collapseDirective: [{
|
|
253
|
+
type: ViewChild,
|
|
254
|
+
args: ['collapse']
|
|
255
|
+
}], cardFooter: [{
|
|
256
|
+
type: ViewChild,
|
|
257
|
+
args: ['cardFooter']
|
|
258
|
+
}] } });
|
|
259
|
+
|
|
260
|
+
class AccordionComponent {
|
|
261
|
+
constructor() {
|
|
262
|
+
this.closeOthers = true;
|
|
263
|
+
this.allowMultiple = false;
|
|
264
|
+
this.destroyOnHide = true; // Nouvelle option pour l'accordéon
|
|
265
|
+
this.panelOpened = new EventEmitter();
|
|
266
|
+
this.panelClosed = new EventEmitter();
|
|
267
|
+
this.cardMap = new Map();
|
|
268
|
+
}
|
|
269
|
+
ngAfterContentInit() {
|
|
270
|
+
this.cards.forEach(card => {
|
|
271
|
+
if (!card.collapsible) {
|
|
272
|
+
card.collapsible = true;
|
|
273
|
+
}
|
|
274
|
+
if (card.destroyOnHide === true) {
|
|
275
|
+
card.destroyOnHide = this.destroyOnHide;
|
|
276
|
+
}
|
|
277
|
+
this.cardMap.set(card.collapseId, card);
|
|
278
|
+
card.collapseClicked.subscribe((isCollapsed) => {
|
|
279
|
+
this.onCardToggle(card.collapseId, isCollapsed);
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
openPanel(panelId) {
|
|
284
|
+
const card = this.cardMap.get(panelId);
|
|
285
|
+
if (card) {
|
|
286
|
+
if (this.shouldCloseOthers()) {
|
|
287
|
+
this.closeAllExcept(panelId);
|
|
288
|
+
}
|
|
289
|
+
card.expand();
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
closePanel(panelId) {
|
|
293
|
+
const card = this.cardMap.get(panelId);
|
|
294
|
+
if (card) {
|
|
295
|
+
card.collapse();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
togglePanel(panelId) {
|
|
299
|
+
const card = this.cardMap.get(panelId);
|
|
300
|
+
if (card) {
|
|
301
|
+
if (card.collapsed_state) {
|
|
302
|
+
this.openPanel(panelId);
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
this.closePanel(panelId);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
closeAll() {
|
|
310
|
+
this.cards.forEach(card => card.collapse());
|
|
311
|
+
}
|
|
312
|
+
openAll() {
|
|
313
|
+
if (!this.shouldCloseOthers()) {
|
|
314
|
+
this.cards.forEach(card => card.expand());
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
onCardToggle(panelId, isCollapsed) {
|
|
318
|
+
if (!isCollapsed) {
|
|
319
|
+
if (this.shouldCloseOthers()) {
|
|
320
|
+
this.closeAllExcept(panelId);
|
|
321
|
+
}
|
|
322
|
+
this.panelOpened.emit(panelId);
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
this.panelClosed.emit(panelId);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
closeAllExcept(exceptId) {
|
|
329
|
+
this.cards.forEach(card => {
|
|
330
|
+
if (card.collapseId !== exceptId) {
|
|
331
|
+
card.collapse();
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
shouldCloseOthers() {
|
|
336
|
+
return this.closeOthers && !this.allowMultiple;
|
|
337
|
+
}
|
|
338
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AccordionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
339
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: AccordionComponent, isStandalone: true, selector: "cw-accordion", inputs: { closeOthers: "closeOthers", allowMultiple: "allowMultiple", destroyOnHide: "destroyOnHide" }, outputs: { panelOpened: "panelOpened", panelClosed: "panelClosed" }, queries: [{ propertyName: "cards", predicate: CardComponent }], ngImport: i0, template: "<div class=\"accordion\">\r\n <ng-content></ng-content>\r\n</div>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }] }); }
|
|
340
|
+
}
|
|
341
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AccordionComponent, decorators: [{
|
|
342
|
+
type: Component,
|
|
343
|
+
args: [{ selector: 'cw-accordion', standalone: true, imports: [CommonModule], template: "<div class=\"accordion\">\r\n <ng-content></ng-content>\r\n</div>\r\n" }]
|
|
344
|
+
}], propDecorators: { closeOthers: [{
|
|
345
|
+
type: Input
|
|
346
|
+
}], allowMultiple: [{
|
|
347
|
+
type: Input
|
|
348
|
+
}], destroyOnHide: [{
|
|
349
|
+
type: Input
|
|
350
|
+
}], panelOpened: [{
|
|
351
|
+
type: Output
|
|
352
|
+
}], panelClosed: [{
|
|
353
|
+
type: Output
|
|
354
|
+
}], cards: [{
|
|
355
|
+
type: ContentChildren,
|
|
356
|
+
args: [CardComponent]
|
|
357
|
+
}] } });
|
|
358
|
+
|
|
359
|
+
var AlertTypeEnum;
|
|
360
|
+
(function (AlertTypeEnum) {
|
|
361
|
+
AlertTypeEnum["info"] = "info";
|
|
362
|
+
AlertTypeEnum["success"] = "success";
|
|
363
|
+
AlertTypeEnum["warning"] = "warning";
|
|
364
|
+
AlertTypeEnum["danger"] = "danger";
|
|
365
|
+
})(AlertTypeEnum || (AlertTypeEnum = {}));
|
|
366
|
+
|
|
367
|
+
var IconNotifSizeEnum;
|
|
368
|
+
(function (IconNotifSizeEnum) {
|
|
369
|
+
IconNotifSizeEnum["5xl"] = "5xl";
|
|
370
|
+
IconNotifSizeEnum["md"] = "md";
|
|
371
|
+
})(IconNotifSizeEnum || (IconNotifSizeEnum = {}));
|
|
372
|
+
var IconNotifTypeEnum;
|
|
373
|
+
(function (IconNotifTypeEnum) {
|
|
374
|
+
IconNotifTypeEnum["info"] = "info";
|
|
375
|
+
IconNotifTypeEnum["success"] = "success";
|
|
376
|
+
IconNotifTypeEnum["warning"] = "warning";
|
|
377
|
+
IconNotifTypeEnum["danger"] = "danger";
|
|
378
|
+
IconNotifTypeEnum["careful"] = "careful";
|
|
379
|
+
})(IconNotifTypeEnum || (IconNotifTypeEnum = {}));
|
|
380
|
+
|
|
381
|
+
class IconNotificationComponent {
|
|
382
|
+
constructor() {
|
|
383
|
+
this.type = IconNotifTypeEnum.info;
|
|
384
|
+
this.iconSize = IconNotifSizeEnum['md'];
|
|
385
|
+
}
|
|
386
|
+
get hostClasses() {
|
|
387
|
+
return 'icon-rounded icon-rounded-' + this.iconSize + ' icon-notification-' + this.type;
|
|
388
|
+
}
|
|
389
|
+
ngOnInit() {
|
|
390
|
+
switch (this.type) {
|
|
391
|
+
case IconNotifTypeEnum.info:
|
|
392
|
+
this.icon = 'cw-alert-info2';
|
|
393
|
+
this.label = 'Informatiion';
|
|
394
|
+
break;
|
|
395
|
+
case IconNotifTypeEnum.success:
|
|
396
|
+
this.icon = 'cw-alert-success2';
|
|
397
|
+
this.label = 'Succès';
|
|
398
|
+
break;
|
|
399
|
+
case IconNotifTypeEnum.warning:
|
|
400
|
+
this.icon = 'cw-event-warning';
|
|
401
|
+
this.label = 'Avertisement';
|
|
402
|
+
break;
|
|
403
|
+
case IconNotifTypeEnum.danger:
|
|
404
|
+
this.icon = 'cw-toolbar-close1';
|
|
405
|
+
this.label = 'Erreur';
|
|
406
|
+
break;
|
|
407
|
+
case IconNotifTypeEnum.careful:
|
|
408
|
+
this.icon = 'cw-alert-warning';
|
|
409
|
+
this.label = 'Attention';
|
|
410
|
+
break;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: IconNotificationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
414
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: IconNotificationComponent, isStandalone: true, selector: "cw-icon-notification", inputs: { type: "type", iconSize: "iconSize" }, host: { properties: { "class": "this.hostClasses" } }, ngImport: i0, template: "\r\n<span class=\"icon\">\r\n <span class=\"icon-span optyweb\" [ngClass]=\"icon\" aria-hidden=\"true\" [title]=\"label\"></span>\r\n <span class=\"visually-hidden\">{{ label }}</span>\r\n</span>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
|
|
415
|
+
}
|
|
416
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: IconNotificationComponent, decorators: [{
|
|
417
|
+
type: Component,
|
|
418
|
+
args: [{ selector: 'cw-icon-notification', standalone: true, imports: [
|
|
419
|
+
CommonModule
|
|
420
|
+
], template: "\r\n<span class=\"icon\">\r\n <span class=\"icon-span optyweb\" [ngClass]=\"icon\" aria-hidden=\"true\" [title]=\"label\"></span>\r\n <span class=\"visually-hidden\">{{ label }}</span>\r\n</span>\r\n" }]
|
|
421
|
+
}], ctorParameters: () => [], propDecorators: { type: [{
|
|
422
|
+
type: Input
|
|
423
|
+
}], iconSize: [{
|
|
424
|
+
type: Input
|
|
425
|
+
}], hostClasses: [{
|
|
426
|
+
type: HostBinding,
|
|
427
|
+
args: ['class']
|
|
428
|
+
}] } });
|
|
429
|
+
|
|
430
|
+
class AlertComponent {
|
|
431
|
+
constructor(cdRef) {
|
|
432
|
+
this.cdRef = cdRef;
|
|
433
|
+
this.type = AlertTypeEnum.info;
|
|
434
|
+
this.isDismissible = false;
|
|
435
|
+
this.cssClass = '';
|
|
436
|
+
this.close = new EventEmitter();
|
|
437
|
+
this.isVisible = true;
|
|
438
|
+
this.showContent = true;
|
|
439
|
+
this.iconSize = IconSizeEnum;
|
|
440
|
+
}
|
|
441
|
+
ngOnInit() {
|
|
442
|
+
this.dataTest = this.dataTest ? this.dataTest : 'alert' + this.type;
|
|
443
|
+
switch (this.type) {
|
|
444
|
+
case AlertTypeEnum.info:
|
|
445
|
+
this.icon = "cw-alert-info2";
|
|
446
|
+
this.iconNotifType = IconNotifTypeEnum.info;
|
|
447
|
+
break;
|
|
448
|
+
case AlertTypeEnum.danger:
|
|
449
|
+
this.icon = "cw-toolbar-close1";
|
|
450
|
+
this.iconNotifType = IconNotifTypeEnum.danger;
|
|
451
|
+
break;
|
|
452
|
+
case AlertTypeEnum.warning:
|
|
453
|
+
this.icon = "cw-event-warning";
|
|
454
|
+
this.iconNotifType = IconNotifTypeEnum.warning;
|
|
455
|
+
break;
|
|
456
|
+
case AlertTypeEnum.success:
|
|
457
|
+
this.icon = "cw-alert-success2";
|
|
458
|
+
this.iconNotifType = IconNotifTypeEnum.success;
|
|
459
|
+
break;
|
|
460
|
+
default:
|
|
461
|
+
this.icon = "cw-alert-info2";
|
|
462
|
+
this.iconNotifType = IconNotifTypeEnum.info;
|
|
463
|
+
break;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
ngAfterViewInit() {
|
|
467
|
+
this.showContent = this.alertContent.nativeElement && this.alertContent.nativeElement.children.length > 0;
|
|
468
|
+
this.cdRef.detectChanges();
|
|
469
|
+
}
|
|
470
|
+
closeAlert() {
|
|
471
|
+
this.isVisible = false;
|
|
472
|
+
this.close.emit();
|
|
473
|
+
}
|
|
474
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AlertComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
475
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: AlertComponent, isStandalone: true, selector: "cw-alert", inputs: { type: "type", title: "title", isDismissible: "isDismissible", cssClass: "cssClass", dataTest: "dataTest" }, outputs: { close: "close" }, viewQueries: [{ propertyName: "alertContent", first: true, predicate: ["alertContent"], descendants: true }], ngImport: i0, template: "@if (isVisible) {\r\n <div [class]=\"'alert alert-' + type + ' '+ cssClass\" [ngClass]=\"{ 'alert-dismissible fade show': isDismissible }\"\r\n [attr.data-test-ctw]=\"dataTest\">\r\n <cw-icon-notification [type]=\"iconNotifType\"></cw-icon-notification>\r\n <div class=\"alert-content\">\r\n @if (title) {\r\n <div class=\"fw-bold\">{{ title }}</div>\r\n }\r\n\r\n @if (showContent) {\r\n <p class=\"mb-none\" #alertContent>\r\n <ng-content></ng-content>\r\n </p>\r\n }\r\n </div>\r\n @if (isDismissible) {\r\n <button type=\"button\" class=\"btn-close\" (click)=\"closeAlert()\"\r\n [attr.aria-label]=\"'_COMMON._ACTION.CLOSE' | translate\"\r\n [attr.data-test-ctw]=\"'close-' + dataTest\">\r\n <cw-icon [label]=\"'_COMMON._ACTION.CLOSE' | translate\" [iconSize]=\"iconSize['2xs']\" icon=\"cw-toolbar-close1\"></cw-icon>\r\n </button>\r\n }\r\n </div>\r\n}\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: IconNotificationComponent, selector: "cw-icon-notification", inputs: ["type", "iconSize"] }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "font", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
|
|
476
|
+
}
|
|
477
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AlertComponent, decorators: [{
|
|
478
|
+
type: Component,
|
|
479
|
+
args: [{ selector: 'cw-alert', standalone: true, imports: [
|
|
480
|
+
CommonModule,
|
|
481
|
+
TranslateModule,
|
|
482
|
+
IconNotificationComponent,
|
|
483
|
+
IconComponent
|
|
484
|
+
], template: "@if (isVisible) {\r\n <div [class]=\"'alert alert-' + type + ' '+ cssClass\" [ngClass]=\"{ 'alert-dismissible fade show': isDismissible }\"\r\n [attr.data-test-ctw]=\"dataTest\">\r\n <cw-icon-notification [type]=\"iconNotifType\"></cw-icon-notification>\r\n <div class=\"alert-content\">\r\n @if (title) {\r\n <div class=\"fw-bold\">{{ title }}</div>\r\n }\r\n\r\n @if (showContent) {\r\n <p class=\"mb-none\" #alertContent>\r\n <ng-content></ng-content>\r\n </p>\r\n }\r\n </div>\r\n @if (isDismissible) {\r\n <button type=\"button\" class=\"btn-close\" (click)=\"closeAlert()\"\r\n [attr.aria-label]=\"'_COMMON._ACTION.CLOSE' | translate\"\r\n [attr.data-test-ctw]=\"'close-' + dataTest\">\r\n <cw-icon [label]=\"'_COMMON._ACTION.CLOSE' | translate\" [iconSize]=\"iconSize['2xs']\" icon=\"cw-toolbar-close1\"></cw-icon>\r\n </button>\r\n }\r\n </div>\r\n}\r\n" }]
|
|
485
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { type: [{
|
|
486
|
+
type: Input
|
|
487
|
+
}], title: [{
|
|
488
|
+
type: Input
|
|
489
|
+
}], isDismissible: [{
|
|
490
|
+
type: Input
|
|
491
|
+
}], cssClass: [{
|
|
492
|
+
type: Input
|
|
493
|
+
}], dataTest: [{
|
|
494
|
+
type: Input
|
|
495
|
+
}], close: [{
|
|
496
|
+
type: Output
|
|
497
|
+
}], alertContent: [{
|
|
498
|
+
type: ViewChild,
|
|
499
|
+
args: ['alertContent']
|
|
500
|
+
}] } });
|
|
501
|
+
|
|
502
|
+
class FocusTrackerService {
|
|
503
|
+
constructor() {
|
|
504
|
+
this.lastFocusedElement = null;
|
|
505
|
+
this.focusListener = this.onFocus.bind(this);
|
|
506
|
+
document.addEventListener('focus', this.focusListener, true);
|
|
507
|
+
}
|
|
508
|
+
onFocus(event) {
|
|
509
|
+
const target = event.target;
|
|
510
|
+
if (target) {
|
|
511
|
+
this.lastFocusedElement = target;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
getFocusedElement() {
|
|
515
|
+
return this.lastFocusedElement;
|
|
516
|
+
}
|
|
517
|
+
ngOnDestroy() {
|
|
518
|
+
document.removeEventListener('focus', this.focusListener, true);
|
|
519
|
+
}
|
|
520
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: FocusTrackerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
521
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: FocusTrackerService, providedIn: 'root' }); }
|
|
522
|
+
}
|
|
523
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: FocusTrackerService, decorators: [{
|
|
524
|
+
type: Injectable,
|
|
525
|
+
args: [{
|
|
526
|
+
providedIn: 'root',
|
|
527
|
+
}]
|
|
528
|
+
}], ctorParameters: () => [] });
|
|
529
|
+
|
|
530
|
+
class ToastService {
|
|
531
|
+
constructor() {
|
|
532
|
+
this.focusService = inject(FocusTrackerService);
|
|
533
|
+
this.toasts = [];
|
|
534
|
+
this.autohideTimers = new Map();
|
|
535
|
+
}
|
|
536
|
+
show(options) {
|
|
537
|
+
if (!this.canShowMessage(options.message)) {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
const toast = {
|
|
541
|
+
id: crypto.randomUUID(),
|
|
542
|
+
type: options.type,
|
|
543
|
+
title: options.title,
|
|
544
|
+
message: options.message,
|
|
545
|
+
autohide: options.autohide ?? false,
|
|
546
|
+
action: options.action,
|
|
547
|
+
};
|
|
548
|
+
this.toasts.push(toast);
|
|
549
|
+
this.triggeringElement = this.focusService.getFocusedElement();
|
|
550
|
+
// Gestion du autohide
|
|
551
|
+
if (toast.autohide) {
|
|
552
|
+
const toastId = toast.id; // Capturer l'ID
|
|
553
|
+
const timer = setTimeout(() => {
|
|
554
|
+
this.removeById(toastId);
|
|
555
|
+
}, 5000);
|
|
556
|
+
this.autohideTimers.set(toastId, timer);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
remove(toast) {
|
|
560
|
+
this.removeById(toast.id);
|
|
561
|
+
}
|
|
562
|
+
removeById(toastId) {
|
|
563
|
+
// Nettoyer le timer s'il existe
|
|
564
|
+
const timer = this.autohideTimers.get(toastId);
|
|
565
|
+
if (timer) {
|
|
566
|
+
clearTimeout(timer);
|
|
567
|
+
this.autohideTimers.delete(toastId);
|
|
568
|
+
}
|
|
569
|
+
this.toasts = this.toasts.filter(t => t.id !== toastId);
|
|
570
|
+
// Ne restaurer le focus que si c'était une action manuelle
|
|
571
|
+
if (timer === undefined || this.autohideTimers.has(toastId) === false) {
|
|
572
|
+
this.triggeringElement?.focus();
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
clear() {
|
|
576
|
+
// Nettoyer tous les timers
|
|
577
|
+
this.autohideTimers.forEach(timer => clearTimeout(timer));
|
|
578
|
+
this.autohideTimers.clear();
|
|
579
|
+
this.toasts = [];
|
|
580
|
+
}
|
|
581
|
+
canShowMessage(message) {
|
|
582
|
+
if (!this.lastToast) {
|
|
583
|
+
this.setLastToast(message);
|
|
584
|
+
return true;
|
|
585
|
+
}
|
|
586
|
+
const limit = new Date(this.lastToast.date);
|
|
587
|
+
limit.setSeconds(limit.getSeconds() + 1);
|
|
588
|
+
if (new Date() > limit || message !== this.lastToast.message) {
|
|
589
|
+
this.setLastToast(message);
|
|
590
|
+
return true;
|
|
591
|
+
}
|
|
592
|
+
return false;
|
|
593
|
+
}
|
|
594
|
+
setLastToast(message) {
|
|
595
|
+
this.lastToast = { message, date: new Date() };
|
|
596
|
+
}
|
|
597
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ToastService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
598
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ToastService, providedIn: 'root' }); }
|
|
599
|
+
}
|
|
600
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ToastService, decorators: [{
|
|
601
|
+
type: Injectable,
|
|
602
|
+
args: [{ providedIn: 'root' }]
|
|
603
|
+
}] });
|
|
604
|
+
|
|
605
|
+
class ToastComponent {
|
|
606
|
+
constructor() {
|
|
607
|
+
this.toastService = inject(ToastService);
|
|
608
|
+
this.elRef = inject(ElementRef);
|
|
609
|
+
this.action = new EventEmitter();
|
|
610
|
+
this.closed = new EventEmitter();
|
|
611
|
+
}
|
|
612
|
+
ngAfterViewInit() {
|
|
613
|
+
const elemPosition = this.elRef.nativeElement.getBoundingClientRect();
|
|
614
|
+
document.addEventListener("scroll", (event) => {
|
|
615
|
+
if (window.scrollY >= elemPosition.top * 2) {
|
|
616
|
+
this.elRef.nativeElement.classList.remove('is-absolute');
|
|
617
|
+
}
|
|
618
|
+
else {
|
|
619
|
+
this.elRef.nativeElement.classList.add('is-absolute');
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
onAction(toast) {
|
|
624
|
+
if (!toast?.action) {
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
this.action.emit(toast.action);
|
|
628
|
+
}
|
|
629
|
+
close() {
|
|
630
|
+
this.closed.emit();
|
|
631
|
+
}
|
|
632
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ToastComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
633
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: ToastComponent, isStandalone: true, selector: "cw-toast", outputs: { action: "action", closed: "closed" }, host: { attributes: { "role": "alert" }, properties: { "class.toast": "true" } }, ngImport: i0, template: "@for (toast of toastService.toasts; track toast.id) {\r\n <cw-alert [type]=\"toast.type\" [isDismissible]=\"true\" [title]=\"toast.title\" (close)=\"toastService.remove(toast)\" [dataTest]=\"'toast-'+ toast.type\">\r\n <span [innerHTML]=\"toast.message\"></span> \r\n @if (toast.action) {\r\n <a href=\"javascript:void(0);\" (click)=\"onAction(toast)\" class=\"alert-link\">{{ toast.action.label }}</a>\r\n }\r\n </cw-alert>\r\n}\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: AlertComponent, selector: "cw-alert", inputs: ["type", "title", "isDismissible", "cssClass", "dataTest"], outputs: ["close"] }] }); }
|
|
634
|
+
}
|
|
635
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ToastComponent, decorators: [{
|
|
636
|
+
type: Component,
|
|
637
|
+
args: [{ selector: 'cw-toast', standalone: true, imports: [
|
|
638
|
+
CommonModule,
|
|
639
|
+
AlertComponent
|
|
640
|
+
], host: { '[class.toast]': 'true', role: 'alert' }, template: "@for (toast of toastService.toasts; track toast.id) {\r\n <cw-alert [type]=\"toast.type\" [isDismissible]=\"true\" [title]=\"toast.title\" (close)=\"toastService.remove(toast)\" [dataTest]=\"'toast-'+ toast.type\">\r\n <span [innerHTML]=\"toast.message\"></span> \r\n @if (toast.action) {\r\n <a href=\"javascript:void(0);\" (click)=\"onAction(toast)\" class=\"alert-link\">{{ toast.action.label }}</a>\r\n }\r\n </cw-alert>\r\n}\r\n" }]
|
|
641
|
+
}], propDecorators: { action: [{
|
|
642
|
+
type: Output
|
|
643
|
+
}], closed: [{
|
|
644
|
+
type: Output
|
|
645
|
+
}] } });
|
|
646
|
+
|
|
647
|
+
var BadgeTypeEnum;
|
|
648
|
+
(function (BadgeTypeEnum) {
|
|
649
|
+
// Light variants
|
|
650
|
+
BadgeTypeEnum["lightInfo"] = "light-info";
|
|
651
|
+
BadgeTypeEnum["lightSuccess"] = "light-success";
|
|
652
|
+
BadgeTypeEnum["lightWarning"] = "light-warning";
|
|
653
|
+
BadgeTypeEnum["lightDanger"] = "light-danger";
|
|
654
|
+
BadgeTypeEnum["lightLight"] = "light-light";
|
|
655
|
+
// Heavy variants
|
|
656
|
+
BadgeTypeEnum["heavyPrimary"] = "heavy-primary";
|
|
657
|
+
BadgeTypeEnum["heavyInfo"] = "heavy-info";
|
|
658
|
+
BadgeTypeEnum["heavySuccess"] = "heavy-success";
|
|
659
|
+
BadgeTypeEnum["heavyWarning"] = "heavy-warning";
|
|
660
|
+
BadgeTypeEnum["heavyDanger"] = "heavy-danger";
|
|
661
|
+
BadgeTypeEnum["heavyDark"] = "heavy-dark";
|
|
662
|
+
BadgeTypeEnum["heavyLight"] = "heavy-light";
|
|
663
|
+
BadgeTypeEnum["heavyDisabled"] = "heavy-disabled";
|
|
664
|
+
})(BadgeTypeEnum || (BadgeTypeEnum = {}));
|
|
665
|
+
var BadgePositionEnum;
|
|
666
|
+
(function (BadgePositionEnum) {
|
|
667
|
+
BadgePositionEnum["left"] = "left";
|
|
668
|
+
BadgePositionEnum["right"] = "right";
|
|
669
|
+
})(BadgePositionEnum || (BadgePositionEnum = {}));
|
|
670
|
+
|
|
671
|
+
class BadgeComponent {
|
|
672
|
+
constructor() {
|
|
673
|
+
this.badgePositionEnum = BadgePositionEnum;
|
|
674
|
+
this.iconPosition = this.badgePositionEnum.left;
|
|
675
|
+
this.cssClass = '';
|
|
676
|
+
this.iconSizeEnum = IconSizeEnum;
|
|
677
|
+
}
|
|
678
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: BadgeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
679
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: BadgeComponent, isStandalone: true, selector: "cw-badge", inputs: { type: "type", label: "label", withIcon: "withIcon", iconPosition: "iconPosition", cssClass: "cssClass", dataTest: "dataTest" }, ngImport: i0, template: "<div [class]=\"'badge badge-' + type + ' '+ cssClass\" [attr.data-test-ctw]=\"dataTest ? dataTest : null\">\r\n\r\n @if (withIcon && iconPosition === badgePositionEnum.left) {\r\n <cw-icon [icon]=\"withIcon\" [iconSize]=\"iconSizeEnum['2xs']\"></cw-icon>\r\n }\r\n\r\n @if (label) {\r\n {{ label }}\r\n }\r\n\r\n @if (withIcon && iconPosition === badgePositionEnum.right) {\r\n <cw-icon [icon]=\"withIcon\" [iconSize]=\"iconSizeEnum['2xs']\"></cw-icon>\r\n }\r\n</div>\r\n", dependencies: [{ kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "font", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom"] }] }); }
|
|
680
|
+
}
|
|
681
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: BadgeComponent, decorators: [{
|
|
682
|
+
type: Component,
|
|
683
|
+
args: [{ selector: 'cw-badge', standalone: true, imports: [IconComponent], template: "<div [class]=\"'badge badge-' + type + ' '+ cssClass\" [attr.data-test-ctw]=\"dataTest ? dataTest : null\">\r\n\r\n @if (withIcon && iconPosition === badgePositionEnum.left) {\r\n <cw-icon [icon]=\"withIcon\" [iconSize]=\"iconSizeEnum['2xs']\"></cw-icon>\r\n }\r\n\r\n @if (label) {\r\n {{ label }}\r\n }\r\n\r\n @if (withIcon && iconPosition === badgePositionEnum.right) {\r\n <cw-icon [icon]=\"withIcon\" [iconSize]=\"iconSizeEnum['2xs']\"></cw-icon>\r\n }\r\n</div>\r\n" }]
|
|
684
|
+
}], ctorParameters: () => [], propDecorators: { type: [{
|
|
685
|
+
type: Input
|
|
686
|
+
}], label: [{
|
|
687
|
+
type: Input
|
|
688
|
+
}], withIcon: [{
|
|
689
|
+
type: Input
|
|
690
|
+
}], iconPosition: [{
|
|
691
|
+
type: Input
|
|
692
|
+
}], cssClass: [{
|
|
693
|
+
type: Input
|
|
694
|
+
}], dataTest: [{
|
|
695
|
+
type: Input
|
|
696
|
+
}] } });
|
|
697
|
+
|
|
698
|
+
class ClickOutsideDirective {
|
|
699
|
+
onClick(event) {
|
|
700
|
+
const target = event.target;
|
|
701
|
+
const clickedInside = this.elementRef.nativeElement.contains(target);
|
|
702
|
+
if (!clickedInside) {
|
|
703
|
+
this.clickOutside.emit();
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
constructor(elementRef) {
|
|
707
|
+
this.elementRef = elementRef;
|
|
708
|
+
this.clickOutside = new EventEmitter();
|
|
709
|
+
}
|
|
710
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ClickOutsideDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
711
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.16", type: ClickOutsideDirective, isStandalone: true, selector: "[clickOutside]", outputs: { clickOutside: "clickOutside" }, host: { listeners: { "document:click": "onClick($event)" } }, ngImport: i0 }); }
|
|
712
|
+
}
|
|
713
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ClickOutsideDirective, decorators: [{
|
|
714
|
+
type: Directive,
|
|
715
|
+
args: [{
|
|
716
|
+
selector: '[clickOutside]',
|
|
717
|
+
standalone: true
|
|
718
|
+
}]
|
|
719
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { clickOutside: [{
|
|
720
|
+
type: Output
|
|
721
|
+
}], onClick: [{
|
|
722
|
+
type: HostListener,
|
|
723
|
+
args: ['document:click', ['$event']]
|
|
724
|
+
}] } });
|
|
725
|
+
|
|
726
|
+
var FoButtonTypeEnum;
|
|
727
|
+
(function (FoButtonTypeEnum) {
|
|
728
|
+
FoButtonTypeEnum["primary"] = "primary";
|
|
729
|
+
FoButtonTypeEnum["secondary"] = "secondary";
|
|
730
|
+
FoButtonTypeEnum["link"] = "link";
|
|
731
|
+
})(FoButtonTypeEnum || (FoButtonTypeEnum = {}));
|
|
732
|
+
var BoButtonTypeEnum;
|
|
733
|
+
(function (BoButtonTypeEnum) {
|
|
734
|
+
BoButtonTypeEnum["primary"] = "primary";
|
|
735
|
+
BoButtonTypeEnum["secondary"] = "secondary";
|
|
736
|
+
BoButtonTypeEnum["link"] = "link";
|
|
737
|
+
BoButtonTypeEnum["info"] = "info";
|
|
738
|
+
BoButtonTypeEnum["warning"] = "warning";
|
|
739
|
+
BoButtonTypeEnum["success"] = "success";
|
|
740
|
+
BoButtonTypeEnum["danger"] = "danger";
|
|
741
|
+
BoButtonTypeEnum["dangerOutline"] = "danger-outline";
|
|
742
|
+
BoButtonTypeEnum["light"] = "light";
|
|
743
|
+
})(BoButtonTypeEnum || (BoButtonTypeEnum = {}));
|
|
744
|
+
var ButtonIconSizeEnum;
|
|
745
|
+
(function (ButtonIconSizeEnum) {
|
|
746
|
+
ButtonIconSizeEnum["default"] = "default";
|
|
747
|
+
ButtonIconSizeEnum["small"] = "small";
|
|
748
|
+
ButtonIconSizeEnum["xsmall"] = "xsmall";
|
|
749
|
+
})(ButtonIconSizeEnum || (ButtonIconSizeEnum = {}));
|
|
750
|
+
var ButtonPositionEnum;
|
|
751
|
+
(function (ButtonPositionEnum) {
|
|
752
|
+
ButtonPositionEnum["left"] = "left";
|
|
753
|
+
ButtonPositionEnum["right"] = "right";
|
|
754
|
+
})(ButtonPositionEnum || (ButtonPositionEnum = {}));
|
|
755
|
+
var TypeTooltipEnum;
|
|
756
|
+
(function (TypeTooltipEnum) {
|
|
757
|
+
TypeTooltipEnum["tooltip"] = "tooltip";
|
|
758
|
+
TypeTooltipEnum["popover"] = "popover";
|
|
759
|
+
})(TypeTooltipEnum || (TypeTooltipEnum = {}));
|
|
760
|
+
var TriggerTooltipEnum;
|
|
761
|
+
(function (TriggerTooltipEnum) {
|
|
762
|
+
TriggerTooltipEnum["click"] = "click";
|
|
763
|
+
TriggerTooltipEnum["hover"] = "hover";
|
|
764
|
+
})(TriggerTooltipEnum || (TriggerTooltipEnum = {}));
|
|
765
|
+
|
|
766
|
+
class ResponsiveService {
|
|
767
|
+
constructor() {
|
|
768
|
+
this.checkIsMobileResolution$ = new BehaviorSubject(this.checkIsMobileResolution());
|
|
769
|
+
fromEvent(window, 'resize').subscribe(e => {
|
|
770
|
+
this.checkIsMobileResolution$.next(this.checkIsMobileResolution());
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
checkIsMobileResolution() {
|
|
774
|
+
return window.innerWidth < 768;
|
|
775
|
+
}
|
|
776
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ResponsiveService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
777
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ResponsiveService, providedIn: 'root' }); }
|
|
778
|
+
}
|
|
779
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ResponsiveService, decorators: [{
|
|
780
|
+
type: Injectable,
|
|
781
|
+
args: [{
|
|
782
|
+
providedIn: 'root'
|
|
783
|
+
}]
|
|
784
|
+
}], ctorParameters: () => [] });
|
|
785
|
+
|
|
786
|
+
class UtilsHelper {
|
|
787
|
+
static slugify(text) {
|
|
788
|
+
if (!text)
|
|
789
|
+
return '';
|
|
790
|
+
return text
|
|
791
|
+
.normalize('NFD')
|
|
792
|
+
.toLowerCase()
|
|
793
|
+
.trim()
|
|
794
|
+
.replace(/[\u0300-\u036f]/g, '')
|
|
795
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
796
|
+
.replace(/^-+|-+$/g, '');
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
class DropdownItemDirective {
|
|
801
|
+
constructor() {
|
|
802
|
+
this.elementRef = inject(ElementRef);
|
|
803
|
+
}
|
|
804
|
+
ngOnInit() {
|
|
805
|
+
this.elementRef.nativeElement.classList.add('dropdown-item');
|
|
806
|
+
this.elementRef.nativeElement.setAttribute('tabindex', '0');
|
|
807
|
+
}
|
|
808
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DropdownItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
809
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.16", type: DropdownItemDirective, isStandalone: true, selector: "[cwDropdownItem]", ngImport: i0 }); }
|
|
810
|
+
}
|
|
811
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DropdownItemDirective, decorators: [{
|
|
812
|
+
type: Directive,
|
|
813
|
+
args: [{ selector: '[cwDropdownItem]' }]
|
|
814
|
+
}] });
|
|
815
|
+
class ButtonComponent {
|
|
816
|
+
constructor() {
|
|
817
|
+
this.renderer = inject(Renderer2);
|
|
818
|
+
this.responsiveService = inject(ResponsiveService);
|
|
819
|
+
this.buttonPositionEnum = ButtonPositionEnum;
|
|
820
|
+
this.id = '';
|
|
821
|
+
this.isDropdown = false;
|
|
822
|
+
this.withIcon = '';
|
|
823
|
+
this.withOnlyIcon = false;
|
|
824
|
+
this.iconSize = ButtonIconSizeEnum.default;
|
|
825
|
+
this.iconPosition = this.buttonPositionEnum.left;
|
|
826
|
+
this.dropdownPosition = this.buttonPositionEnum.right;
|
|
827
|
+
this.isMinWidth = false;
|
|
828
|
+
this.isDisabled = false;
|
|
829
|
+
this.withSpinner = false;
|
|
830
|
+
this.cssClass = '';
|
|
831
|
+
this.withTooltip = false;
|
|
832
|
+
this.tooltipText = '';
|
|
833
|
+
this.tooltipTitle = '';
|
|
834
|
+
this.tooltipTrigger = TriggerTooltipEnum.hover;
|
|
835
|
+
this.tooltipPosition = this.buttonPositionEnum.right;
|
|
836
|
+
this.tooltipType = TypeTooltipEnum.tooltip;
|
|
837
|
+
this.btnAction = new EventEmitter();
|
|
838
|
+
this.dropDownClicked = new EventEmitter();
|
|
839
|
+
this.isLoading = false;
|
|
840
|
+
this.iconSizeEnum = IconSizeEnum;
|
|
841
|
+
this.iconType = IconTypeEnum;
|
|
842
|
+
this.iconUiType = IconUiTypeEnum;
|
|
843
|
+
this.buttonIconSizeEnum = ButtonIconSizeEnum;
|
|
844
|
+
this.placementCss = '';
|
|
845
|
+
this.isOpen = false;
|
|
846
|
+
this.isTooltipOpened = false;
|
|
847
|
+
this.typeTooltipEnum = TypeTooltipEnum;
|
|
848
|
+
this.focusOutInitialized = false;
|
|
849
|
+
this.renderer.listen('window', 'click', (e) => {
|
|
850
|
+
const target = e.target;
|
|
851
|
+
if (target.classList.contains('dropdown-item')) {
|
|
852
|
+
this.onClickOutside();
|
|
853
|
+
}
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
ngOnInit() {
|
|
857
|
+
this.responsiveService.checkIsMobileResolution$.subscribe({
|
|
858
|
+
next: () => {
|
|
859
|
+
this.getPlacement(this.dropdownPosition);
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
if (this.withTooltip) {
|
|
863
|
+
this.tooltipRandomId = this.getRandomId(1, 10000);
|
|
864
|
+
}
|
|
865
|
+
this.dataTest ??= `btn-${UtilsHelper.slugify(this.label)}`;
|
|
866
|
+
}
|
|
867
|
+
getButtonClasses() {
|
|
868
|
+
return {
|
|
869
|
+
'btn-min-width': this.isMinWidth,
|
|
870
|
+
'btn-icon': this.withOnlyIcon,
|
|
871
|
+
[`btn-icon-${this.iconSize}`]: !!this.iconSize && this.withOnlyIcon
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
onBtnAction() {
|
|
875
|
+
this.btnAction.emit();
|
|
876
|
+
if (this.withSpinner) {
|
|
877
|
+
this.isLoading = !this.isLoading;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
toggleDropdown() {
|
|
881
|
+
this.getPlacement(this.dropdownPosition);
|
|
882
|
+
this.setAriaExpanded();
|
|
883
|
+
this.dropdown?.nativeElement.classList.toggle("show");
|
|
884
|
+
this.dropdownMenu.nativeElement.classList.toggle("show");
|
|
885
|
+
this.isOpen = !this.isOpen;
|
|
886
|
+
this.dropDownClicked.emit(this.isOpen);
|
|
887
|
+
if (this.isOpen && !this.focusOutInitialized) {
|
|
888
|
+
this.focusOut(this.dropdownMenu.nativeElement);
|
|
889
|
+
this.focusOutInitialized = true;
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
onClickOutside() {
|
|
893
|
+
this.dropdownToggle?.nativeElement.setAttribute('aria-expanded', 'false');
|
|
894
|
+
this.dropdown?.nativeElement.classList.remove("show");
|
|
895
|
+
this.dropdownMenu.nativeElement.classList.remove("show");
|
|
896
|
+
this.isOpen = false;
|
|
897
|
+
this.dropDownClicked.emit(this.isOpen);
|
|
898
|
+
}
|
|
899
|
+
setAriaExpanded() {
|
|
900
|
+
const button = this.dropdownToggle.nativeElement;
|
|
901
|
+
const currentAriaExpanded = button.getAttribute('aria-expanded') === 'true';
|
|
902
|
+
button.setAttribute('aria-expanded', (!currentAriaExpanded).toString());
|
|
903
|
+
}
|
|
904
|
+
getPlacement(placement) {
|
|
905
|
+
switch (placement) {
|
|
906
|
+
case ButtonPositionEnum.right:
|
|
907
|
+
return this.placementCss = 'dropdown-menu-right';
|
|
908
|
+
case ButtonPositionEnum.left:
|
|
909
|
+
return this.placementCss = 'dropdown-menu-left';
|
|
910
|
+
default:
|
|
911
|
+
return null;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
// Fermer la dropdown si on focus out en tab ou shift tab
|
|
915
|
+
focusOut(element) {
|
|
916
|
+
const focusableEls1 = element.querySelectorAll('a[href], button, textarea, input[type="text"],' +
|
|
917
|
+
'input[type="radio"]:checked, input[type="checkbox"], select');
|
|
918
|
+
const focusableEls = Array.from(focusableEls1)
|
|
919
|
+
.filter((el) => !el.disabled);
|
|
920
|
+
const firstFocusableEl = focusableEls[0];
|
|
921
|
+
const lastFocusableEl = focusableEls[focusableEls.length - 1];
|
|
922
|
+
element.addEventListener('keydown', (e) => {
|
|
923
|
+
const isTabPressed = e.key === 'Tab'; // isTabPressed
|
|
924
|
+
if (!isTabPressed)
|
|
925
|
+
return;
|
|
926
|
+
if (e.shiftKey) /* shift + tab */ {
|
|
927
|
+
if (document.activeElement === firstFocusableEl) {
|
|
928
|
+
this.toggleDropdown();
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
else /* tab */ {
|
|
932
|
+
if (document.activeElement === lastFocusableEl) {
|
|
933
|
+
this.toggleDropdown();
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
showTooltip() {
|
|
939
|
+
if (this.tooltipTrigger === 'click') {
|
|
940
|
+
this.isTooltipOpened = !this.isTooltipOpened;
|
|
941
|
+
}
|
|
942
|
+
else {
|
|
943
|
+
this.isTooltipOpened = true;
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
hideTooltip() {
|
|
947
|
+
if (this.tooltipTrigger === 'hover') {
|
|
948
|
+
this.isTooltipOpened = false;
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
onTooltipClickOutside() {
|
|
952
|
+
if (this.tooltipTrigger === 'click') {
|
|
953
|
+
this.isTooltipOpened = false;
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
getRandomId(min, max) {
|
|
957
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
958
|
+
}
|
|
959
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
960
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", 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", withSpinner: "withSpinner", cssClass: "cssClass", dataTest: "dataTest", withTooltip: "withTooltip", tooltipText: "tooltipText", tooltipTitle: "tooltipTitle", tooltipTrigger: "tooltipTrigger", tooltipPosition: "tooltipPosition", tooltipType: "tooltipType" }, outputs: { btnAction: "btnAction", dropDownClicked: "dropDownClicked" }, 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 position-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\"></div>\r\n }\r\n <div [ngClass]=\"tooltipType === typeTooltipEnum.tooltip ? 'tooltip-inner' : 'popover-body'\"\r\n [innerHTML]=\"tooltipText\"></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 [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 @else {\r\n <div (clickOutside)=\"onClickOutside()\" ctwClickOutside #dropdown class=\"d-inline-block\">\r\n <button class=\"btn\" [class]=\"'btn-' + type + ' '\" 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 </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['sm']\"></cw-icon>\r\n }\r\n @default {\r\n <cw-icon [icon]=\"withIcon\" [iconSize]=\"iconSizeEnum['md']\"></cw-icon>\r\n }\r\n }\r\n }\r\n @else {\r\n <cw-icon [icon]=\"withIcon\" [iconSize]=\"iconSizeEnum['md']\"></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", "font", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom"] }, { kind: "directive", type: ClickOutsideDirective, selector: "[clickOutside]", outputs: ["clickOutside"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
|
|
961
|
+
}
|
|
962
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ButtonComponent, decorators: [{
|
|
963
|
+
type: Component,
|
|
964
|
+
args: [{ selector: 'cw-button', standalone: true, imports: [
|
|
965
|
+
CommonModule,
|
|
966
|
+
TranslateModule,
|
|
967
|
+
IconComponent,
|
|
968
|
+
ClickOutsideDirective
|
|
969
|
+
], template: "<!-- Wrapper pour le tooltip -->\r\n@if (withTooltip) {\r\n <div class=\"d-inline-block position-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\"></div>\r\n }\r\n <div [ngClass]=\"tooltipType === typeTooltipEnum.tooltip ? 'tooltip-inner' : 'popover-body'\"\r\n [innerHTML]=\"tooltipText\"></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 [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 @else {\r\n <div (clickOutside)=\"onClickOutside()\" ctwClickOutside #dropdown class=\"d-inline-block\">\r\n <button class=\"btn\" [class]=\"'btn-' + type + ' '\" 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 </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['sm']\"></cw-icon>\r\n }\r\n @default {\r\n <cw-icon [icon]=\"withIcon\" [iconSize]=\"iconSizeEnum['md']\"></cw-icon>\r\n }\r\n }\r\n }\r\n @else {\r\n <cw-icon [icon]=\"withIcon\" [iconSize]=\"iconSizeEnum['md']\"></cw-icon>\r\n }\r\n</ng-template>\r\n" }]
|
|
970
|
+
}], ctorParameters: () => [], propDecorators: { type: [{
|
|
971
|
+
type: Input
|
|
972
|
+
}], label: [{
|
|
973
|
+
type: Input
|
|
974
|
+
}], id: [{
|
|
975
|
+
type: Input
|
|
976
|
+
}], isDropdown: [{
|
|
977
|
+
type: Input
|
|
978
|
+
}], withIcon: [{
|
|
979
|
+
type: Input
|
|
980
|
+
}], withOnlyIcon: [{
|
|
981
|
+
type: Input
|
|
982
|
+
}], iconSize: [{
|
|
983
|
+
type: Input
|
|
984
|
+
}], iconPosition: [{
|
|
985
|
+
type: Input
|
|
986
|
+
}], dropdownPosition: [{
|
|
987
|
+
type: Input
|
|
988
|
+
}], isMinWidth: [{
|
|
989
|
+
type: Input
|
|
990
|
+
}], isDisabled: [{
|
|
991
|
+
type: Input
|
|
992
|
+
}], withSpinner: [{
|
|
993
|
+
type: Input
|
|
994
|
+
}], cssClass: [{
|
|
995
|
+
type: Input
|
|
996
|
+
}], dataTest: [{
|
|
997
|
+
type: Input
|
|
998
|
+
}], withTooltip: [{
|
|
999
|
+
type: Input
|
|
1000
|
+
}], tooltipText: [{
|
|
1001
|
+
type: Input
|
|
1002
|
+
}], tooltipTitle: [{
|
|
1003
|
+
type: Input
|
|
1004
|
+
}], tooltipTrigger: [{
|
|
1005
|
+
type: Input
|
|
1006
|
+
}], tooltipPosition: [{
|
|
1007
|
+
type: Input
|
|
1008
|
+
}], tooltipType: [{
|
|
1009
|
+
type: Input
|
|
1010
|
+
}], btnAction: [{
|
|
1011
|
+
type: Output
|
|
1012
|
+
}], dropDownClicked: [{
|
|
1013
|
+
type: Output
|
|
1014
|
+
}], dropdown: [{
|
|
1015
|
+
type: ViewChild,
|
|
1016
|
+
args: ['dropdown']
|
|
1017
|
+
}], dropdownMenu: [{
|
|
1018
|
+
type: ViewChild,
|
|
1019
|
+
args: ['dropdownMenu']
|
|
1020
|
+
}], dropdownToggle: [{
|
|
1021
|
+
type: ViewChild,
|
|
1022
|
+
args: ['dropdownToggle']
|
|
1023
|
+
}] } });
|
|
1024
|
+
|
|
1025
|
+
class DropdownComponent {
|
|
1026
|
+
constructor() {
|
|
1027
|
+
this.title = 'Dropdown';
|
|
1028
|
+
this.icon = 'cw-nav-small-menu';
|
|
1029
|
+
this.btnCustom = false;
|
|
1030
|
+
this.btnCssClass = 'btn-secondary';
|
|
1031
|
+
this.menuClass = '';
|
|
1032
|
+
this.placement = 'bottom-start';
|
|
1033
|
+
this.autoClose = true;
|
|
1034
|
+
this.opened = output();
|
|
1035
|
+
this.closed = output();
|
|
1036
|
+
this.isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
1037
|
+
}
|
|
1038
|
+
get dropdownId() {
|
|
1039
|
+
return this.id || `dropdown-${Math.random().toString(36).substring(2, 11)}`;
|
|
1040
|
+
}
|
|
1041
|
+
get placementCss() {
|
|
1042
|
+
return this.placement;
|
|
1043
|
+
}
|
|
1044
|
+
ngAfterViewInit() {
|
|
1045
|
+
// Fermer au clic sur un item du menu
|
|
1046
|
+
if (this.autoClose && this.dropdownMenu) {
|
|
1047
|
+
this.dropdownMenu.nativeElement.addEventListener('click', (event) => {
|
|
1048
|
+
const target = event.target;
|
|
1049
|
+
if (target.classList.contains('dropdown-item')) {
|
|
1050
|
+
this.closeDropdown();
|
|
1051
|
+
}
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
toggleDropdown() {
|
|
1056
|
+
if (this.isOpen()) {
|
|
1057
|
+
this.closeDropdown();
|
|
1058
|
+
}
|
|
1059
|
+
else {
|
|
1060
|
+
this.openDropdown();
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
openDropdown() {
|
|
1064
|
+
this.isOpen.set(true);
|
|
1065
|
+
this.opened.emit();
|
|
1066
|
+
}
|
|
1067
|
+
closeDropdown() {
|
|
1068
|
+
this.isOpen.set(false);
|
|
1069
|
+
this.closed.emit();
|
|
1070
|
+
}
|
|
1071
|
+
onClickOutside() {
|
|
1072
|
+
if (this.isOpen()) {
|
|
1073
|
+
this.closeDropdown();
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1077
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: DropdownComponent, isStandalone: true, selector: "cw-dropdown", inputs: { id: "id", title: "title", icon: "icon", btnCustom: "btnCustom", btnCssClass: "btnCssClass", menuClass: "menuClass", placement: "placement", autoClose: "autoClose" }, outputs: { opened: "opened", closed: "closed" }, viewQueries: [{ propertyName: "dropdownElement", 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: "<div class=\"dropdown\" [class.show]=\"isOpen()\" (clickOutside)=\"onClickOutside()\" clickOutside #dropdown>\r\n\r\n <button type=\"button\" class=\"dropdown-toggle btn\" [id]=\"dropdownId\" [attr.aria-expanded]=\"isOpen()\"\r\n [attr.aria-haspopup]=\"true\" (click)=\"toggleDropdown()\" [ngClass]=\"btnCssClass\" #dropdownToggle>\r\n\r\n <!-- Custom button content -->\r\n <ng-content select=\"[button]\"></ng-content>\r\n\r\n <!-- Classic button with icon -->\r\n @if (!btnCustom) {\r\n <cw-icon label=\"Menu\"></cw-icon>\r\n }\r\n </button>\r\n\r\n <div [attr.aria-labelledby]=\"dropdownId\" class=\"dropdown-menu\" [class.show]=\"isOpen()\"\r\n [ngClass]=\"placementCss + ' ' + menuClass\" #dropdownMenu>\r\n <ng-content></ng-content>\r\n </div>\r\n</div>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: ClickOutsideDirective, selector: "[clickOutside]", outputs: ["clickOutside"] }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "font", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom"] }] }); }
|
|
1078
|
+
}
|
|
1079
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DropdownComponent, decorators: [{
|
|
1080
|
+
type: Component,
|
|
1081
|
+
args: [{ selector: 'cw-dropdown', standalone: true, imports: [
|
|
1082
|
+
CommonModule,
|
|
1083
|
+
ClickOutsideDirective,
|
|
1084
|
+
IconComponent
|
|
1085
|
+
], template: "<div class=\"dropdown\" [class.show]=\"isOpen()\" (clickOutside)=\"onClickOutside()\" clickOutside #dropdown>\r\n\r\n <button type=\"button\" class=\"dropdown-toggle btn\" [id]=\"dropdownId\" [attr.aria-expanded]=\"isOpen()\"\r\n [attr.aria-haspopup]=\"true\" (click)=\"toggleDropdown()\" [ngClass]=\"btnCssClass\" #dropdownToggle>\r\n\r\n <!-- Custom button content -->\r\n <ng-content select=\"[button]\"></ng-content>\r\n\r\n <!-- Classic button with icon -->\r\n @if (!btnCustom) {\r\n <cw-icon label=\"Menu\"></cw-icon>\r\n }\r\n </button>\r\n\r\n <div [attr.aria-labelledby]=\"dropdownId\" class=\"dropdown-menu\" [class.show]=\"isOpen()\"\r\n [ngClass]=\"placementCss + ' ' + menuClass\" #dropdownMenu>\r\n <ng-content></ng-content>\r\n </div>\r\n</div>\r\n" }]
|
|
1086
|
+
}], propDecorators: { id: [{
|
|
1087
|
+
type: Input
|
|
1088
|
+
}], title: [{
|
|
1089
|
+
type: Input
|
|
1090
|
+
}], icon: [{
|
|
1091
|
+
type: Input
|
|
1092
|
+
}], btnCustom: [{
|
|
1093
|
+
type: Input
|
|
1094
|
+
}], btnCssClass: [{
|
|
1095
|
+
type: Input
|
|
1096
|
+
}], menuClass: [{
|
|
1097
|
+
type: Input
|
|
1098
|
+
}], placement: [{
|
|
1099
|
+
type: Input
|
|
1100
|
+
}], autoClose: [{
|
|
1101
|
+
type: Input
|
|
1102
|
+
}], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }], dropdownElement: [{
|
|
1103
|
+
type: ViewChild,
|
|
1104
|
+
args: ['dropdown']
|
|
1105
|
+
}], dropdownMenu: [{
|
|
1106
|
+
type: ViewChild,
|
|
1107
|
+
args: ['dropdownMenu']
|
|
1108
|
+
}], dropdownToggle: [{
|
|
1109
|
+
type: ViewChild,
|
|
1110
|
+
args: ['dropdownToggle']
|
|
1111
|
+
}] } });
|
|
1112
|
+
|
|
1113
|
+
class ShowHidePasswordDirective {
|
|
1114
|
+
constructor(el, renderer, translateService) {
|
|
1115
|
+
this.el = el;
|
|
1116
|
+
this.renderer = renderer;
|
|
1117
|
+
this.translateService = translateService;
|
|
1118
|
+
this.isShown = false;
|
|
1119
|
+
}
|
|
1120
|
+
ngOnInit() {
|
|
1121
|
+
this.setup();
|
|
1122
|
+
}
|
|
1123
|
+
setup() {
|
|
1124
|
+
const div = this.renderer.createElement('div');
|
|
1125
|
+
this.renderer.insertBefore(this.el.nativeElement.parentNode, div, this.el.nativeElement);
|
|
1126
|
+
this.renderer.appendChild(div, this.el.nativeElement);
|
|
1127
|
+
this.renderer.addClass(div, 'see-password-container');
|
|
1128
|
+
const button = this.renderer.createElement('button');
|
|
1129
|
+
this.renderer.appendChild(this.el.nativeElement.parentNode, button);
|
|
1130
|
+
this.renderer.addClass(button, 'btn');
|
|
1131
|
+
this.renderer.setAttribute(button, 'type', 'button');
|
|
1132
|
+
this.renderer.addClass(button, 'optyweb');
|
|
1133
|
+
this.renderer.addClass(button, 'cw-hide-map');
|
|
1134
|
+
this.renderer.addClass(button, 'py-2');
|
|
1135
|
+
this.renderer.addClass(button, 'see-password');
|
|
1136
|
+
const srOnly = this.renderer.createElement('span');
|
|
1137
|
+
this.renderer.appendChild(button, srOnly);
|
|
1138
|
+
this.renderer.addClass(srOnly, 'visually-hidden');
|
|
1139
|
+
this.renderer.setProperty(srOnly, 'innerHTML', this.translateService.instant('_COMMON._FORM._SHOW_HIDE_PWD.SHOW'));
|
|
1140
|
+
this.renderer.listen(button, 'click', (event) => {
|
|
1141
|
+
this.isShown = !this.isShown;
|
|
1142
|
+
if (this.isShown) {
|
|
1143
|
+
this.el.nativeElement.setAttribute('type', 'text');
|
|
1144
|
+
this.renderer.removeClass(button, 'cw-hide-map');
|
|
1145
|
+
this.renderer.addClass(button, 'cw-show-map');
|
|
1146
|
+
this.renderer.setProperty(srOnly, 'innerHTML', this.translateService.instant('_COMMON._FORM._SHOW_HIDE_PWD.HIDE'));
|
|
1147
|
+
}
|
|
1148
|
+
else {
|
|
1149
|
+
this.el.nativeElement.setAttribute('type', 'password');
|
|
1150
|
+
this.renderer.addClass(button, 'cw-hide-map');
|
|
1151
|
+
this.renderer.removeClass(button, 'cw-show-map');
|
|
1152
|
+
this.renderer.setProperty(srOnly, 'innerHTML', this.translateService.instant('_COMMON._FORM._SHOW_HIDE_PWD.SHOW'));
|
|
1153
|
+
}
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ShowHidePasswordDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i2.TranslateService }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1157
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.16", type: ShowHidePasswordDirective, isStandalone: true, selector: "[showHidePassword]", ngImport: i0 }); }
|
|
1158
|
+
}
|
|
1159
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ShowHidePasswordDirective, decorators: [{
|
|
1160
|
+
type: Directive,
|
|
1161
|
+
args: [{
|
|
1162
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
1163
|
+
selector: '[showHidePassword]',
|
|
1164
|
+
standalone: true
|
|
1165
|
+
}]
|
|
1166
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i2.TranslateService }] });
|
|
1167
|
+
|
|
1168
|
+
var FormFieldTypeEnum;
|
|
1169
|
+
(function (FormFieldTypeEnum) {
|
|
1170
|
+
FormFieldTypeEnum["text"] = "text";
|
|
1171
|
+
FormFieldTypeEnum["date"] = "date";
|
|
1172
|
+
FormFieldTypeEnum["time"] = "time";
|
|
1173
|
+
FormFieldTypeEnum["dateTime"] = "datetime-local";
|
|
1174
|
+
FormFieldTypeEnum["textarea"] = "textarea";
|
|
1175
|
+
FormFieldTypeEnum["select"] = "select";
|
|
1176
|
+
FormFieldTypeEnum["range"] = "range";
|
|
1177
|
+
FormFieldTypeEnum["radio"] = "radio";
|
|
1178
|
+
FormFieldTypeEnum["radioInline"] = "radioInline";
|
|
1179
|
+
FormFieldTypeEnum["radioButton"] = "radioButton";
|
|
1180
|
+
FormFieldTypeEnum["checkbox"] = "checkbox";
|
|
1181
|
+
FormFieldTypeEnum["checkboxInline"] = "checkboxInline";
|
|
1182
|
+
FormFieldTypeEnum["checkboxButton"] = "checkboxButton";
|
|
1183
|
+
FormFieldTypeEnum["switch"] = "switch";
|
|
1184
|
+
FormFieldTypeEnum["switchSmall"] = "switchSmall";
|
|
1185
|
+
FormFieldTypeEnum["ngSelect"] = "ngSelect";
|
|
1186
|
+
FormFieldTypeEnum["ngSelectMultiple"] = "ngSelectMultiple";
|
|
1187
|
+
FormFieldTypeEnum["number"] = "number";
|
|
1188
|
+
FormFieldTypeEnum["color"] = "color";
|
|
1189
|
+
FormFieldTypeEnum["file"] = "file";
|
|
1190
|
+
FormFieldTypeEnum["password"] = "password";
|
|
1191
|
+
FormFieldTypeEnum["email"] = "email";
|
|
1192
|
+
FormFieldTypeEnum["slider"] = "slider";
|
|
1193
|
+
FormFieldTypeEnum["dateToDate"] = "dateToDate";
|
|
1194
|
+
FormFieldTypeEnum["datePlusOne"] = "datePlusOne";
|
|
1195
|
+
FormFieldTypeEnum["datePlusTwo"] = "datePlusTwo";
|
|
1196
|
+
FormFieldTypeEnum["datePlusSeven"] = "datePlusSeven";
|
|
1197
|
+
FormFieldTypeEnum["dateComplexe"] = "dateComplexe";
|
|
1198
|
+
FormFieldTypeEnum["dateTimeToDateTime"] = "dateTimeToDateTime";
|
|
1199
|
+
FormFieldTypeEnum["timeToTime"] = "timeToTime";
|
|
1200
|
+
})(FormFieldTypeEnum || (FormFieldTypeEnum = {}));
|
|
1201
|
+
|
|
1202
|
+
function rangeValidator(group, type) {
|
|
1203
|
+
const startControl = group.get('start');
|
|
1204
|
+
const endControl = group.get('end');
|
|
1205
|
+
const start = startControl?.value;
|
|
1206
|
+
const end = endControl?.value;
|
|
1207
|
+
if (!start || !end)
|
|
1208
|
+
return null;
|
|
1209
|
+
let startValue;
|
|
1210
|
+
let endValue;
|
|
1211
|
+
switch (type) {
|
|
1212
|
+
case 'time':
|
|
1213
|
+
startValue = parseTime(start);
|
|
1214
|
+
endValue = parseTime(end);
|
|
1215
|
+
break;
|
|
1216
|
+
case 'datetime':
|
|
1217
|
+
startValue = new Date(start).getTime();
|
|
1218
|
+
endValue = new Date(end).getTime();
|
|
1219
|
+
break;
|
|
1220
|
+
default: // date
|
|
1221
|
+
startValue = new Date(start).setHours(0, 0, 0, 0);
|
|
1222
|
+
endValue = new Date(end).setHours(0, 0, 0, 0);
|
|
1223
|
+
}
|
|
1224
|
+
if (startValue > endValue) {
|
|
1225
|
+
// Marquer les enfants comme invalid
|
|
1226
|
+
startControl?.setErrors({ ...startControl.errors, rangeInvalid: true });
|
|
1227
|
+
endControl?.setErrors({ ...endControl.errors, rangeInvalid: true });
|
|
1228
|
+
return { rangeInvalid: true };
|
|
1229
|
+
}
|
|
1230
|
+
else {
|
|
1231
|
+
// Supprimer l’erreur rangeInvalid si présente
|
|
1232
|
+
if (startControl?.errors?.['rangeInvalid']) {
|
|
1233
|
+
const { rangeInvalid, ...rest } = startControl.errors;
|
|
1234
|
+
startControl.setErrors(Object.keys(rest).length ? rest : null);
|
|
1235
|
+
}
|
|
1236
|
+
if (endControl?.errors?.['rangeInvalid']) {
|
|
1237
|
+
const { rangeInvalid, ...rest } = endControl.errors;
|
|
1238
|
+
endControl.setErrors(Object.keys(rest).length ? rest : null);
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
return null;
|
|
1242
|
+
}
|
|
1243
|
+
function parseTime(time) {
|
|
1244
|
+
const [h, m] = time.split(':').map(Number);
|
|
1245
|
+
return h * 60 + m;
|
|
1246
|
+
}
|
|
1247
|
+
class FormFieldComponent {
|
|
1248
|
+
get hostClasses() {
|
|
1249
|
+
return 'position-relative';
|
|
1250
|
+
}
|
|
1251
|
+
constructor() {
|
|
1252
|
+
this.displayLabel = true;
|
|
1253
|
+
this.options = [];
|
|
1254
|
+
this.isRequired = false;
|
|
1255
|
+
this.isInAddon = false;
|
|
1256
|
+
this.isReadonly = false;
|
|
1257
|
+
this.isDisabled = false;
|
|
1258
|
+
this.refreshEvent = new EventEmitter();
|
|
1259
|
+
this.textChanged = new EventEmitter();
|
|
1260
|
+
this.typeField = FormFieldTypeEnum;
|
|
1261
|
+
}
|
|
1262
|
+
get isRange() {
|
|
1263
|
+
if (!this.control)
|
|
1264
|
+
return false;
|
|
1265
|
+
return this.control instanceof FormGroup &&
|
|
1266
|
+
'start' in this.control.controls &&
|
|
1267
|
+
'end' in this.control.controls;
|
|
1268
|
+
}
|
|
1269
|
+
get formControl() {
|
|
1270
|
+
return this.control;
|
|
1271
|
+
}
|
|
1272
|
+
get controlOrGroup() {
|
|
1273
|
+
return this.control ?? this.formGroup?.get(this.name);
|
|
1274
|
+
}
|
|
1275
|
+
ngOnInit() {
|
|
1276
|
+
if (this.formGroup && this.name) {
|
|
1277
|
+
const group = this.formGroup.get(this.name);
|
|
1278
|
+
if (group instanceof FormGroup) {
|
|
1279
|
+
switch (this.type) {
|
|
1280
|
+
case this.typeField.dateToDate:
|
|
1281
|
+
group.setValidators(g => rangeValidator(g, 'date'));
|
|
1282
|
+
break;
|
|
1283
|
+
case this.typeField.timeToTime:
|
|
1284
|
+
group.setValidators(g => rangeValidator(g, 'time'));
|
|
1285
|
+
break;
|
|
1286
|
+
case this.typeField.dateTimeToDateTime:
|
|
1287
|
+
group.setValidators(g => rangeValidator(g, 'datetime'));
|
|
1288
|
+
break;
|
|
1289
|
+
}
|
|
1290
|
+
group.updateValueAndValidity();
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
onCheckboxChange(event) {
|
|
1295
|
+
const checkbox = event.target;
|
|
1296
|
+
const valueArray = this.control.value || [];
|
|
1297
|
+
if (checkbox.checked) {
|
|
1298
|
+
this.control.setValue([...valueArray, checkbox.value]);
|
|
1299
|
+
}
|
|
1300
|
+
else {
|
|
1301
|
+
this.control.setValue(valueArray.filter((v) => v !== checkbox.value));
|
|
1302
|
+
}
|
|
1303
|
+
this.control.markAsTouched();
|
|
1304
|
+
}
|
|
1305
|
+
onBlur() {
|
|
1306
|
+
if (this.control && !this.control.touched) {
|
|
1307
|
+
this.control.markAsTouched();
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
isInInputGroup() {
|
|
1311
|
+
const inInputGroup = [
|
|
1312
|
+
this.typeField.text,
|
|
1313
|
+
this.typeField.date,
|
|
1314
|
+
this.typeField.time,
|
|
1315
|
+
this.typeField.dateTime,
|
|
1316
|
+
this.typeField.number,
|
|
1317
|
+
this.typeField.email,
|
|
1318
|
+
this.typeField.textarea,
|
|
1319
|
+
this.typeField.password,
|
|
1320
|
+
].includes(this.type);
|
|
1321
|
+
return inInputGroup;
|
|
1322
|
+
}
|
|
1323
|
+
getControl(path) {
|
|
1324
|
+
if (!this.isRange)
|
|
1325
|
+
return null;
|
|
1326
|
+
const group = this.control;
|
|
1327
|
+
return group.get(path);
|
|
1328
|
+
}
|
|
1329
|
+
getInputType() {
|
|
1330
|
+
switch (this.type) {
|
|
1331
|
+
case this.typeField.dateToDate:
|
|
1332
|
+
return 'date';
|
|
1333
|
+
case this.typeField.timeToTime:
|
|
1334
|
+
return 'time';
|
|
1335
|
+
case this.typeField.dateTimeToDateTime:
|
|
1336
|
+
return 'datetime-local';
|
|
1337
|
+
default:
|
|
1338
|
+
return 'text';
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
onClearFieldPeriod(path) {
|
|
1342
|
+
const ctrl = this.getControl(path);
|
|
1343
|
+
if (ctrl) {
|
|
1344
|
+
ctrl.setValue(null);
|
|
1345
|
+
ctrl.markAsPristine();
|
|
1346
|
+
ctrl.markAsUntouched();
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
onClearField(control) {
|
|
1350
|
+
control?.setValue(null);
|
|
1351
|
+
control?.markAsPristine();
|
|
1352
|
+
control?.markAsUntouched();
|
|
1353
|
+
}
|
|
1354
|
+
onDateAddDay(direction) {
|
|
1355
|
+
const current = this.getDateValue();
|
|
1356
|
+
if (current) {
|
|
1357
|
+
const delta = direction === 'prev' ? -1 : 1;
|
|
1358
|
+
current.setDate(current.getDate() + delta);
|
|
1359
|
+
this.formControl.setValue(this.formatDate(current));
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
onTodayAddDay(days) {
|
|
1363
|
+
const today = new Date();
|
|
1364
|
+
today.setDate(today.getDate() + days);
|
|
1365
|
+
this.formControl.setValue(this.formatDate(today));
|
|
1366
|
+
}
|
|
1367
|
+
onRefresh() {
|
|
1368
|
+
this.refreshEvent.emit();
|
|
1369
|
+
}
|
|
1370
|
+
getDateValue() {
|
|
1371
|
+
const value = this.formControl.value;
|
|
1372
|
+
if (!value)
|
|
1373
|
+
return null;
|
|
1374
|
+
const date = new Date(value);
|
|
1375
|
+
return isNaN(date.getTime()) ? null : date;
|
|
1376
|
+
}
|
|
1377
|
+
formatDate(date) {
|
|
1378
|
+
const year = date.getFullYear();
|
|
1379
|
+
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
1380
|
+
const day = date.getDate().toString().padStart(2, '0');
|
|
1381
|
+
return `${year}-${month}-${day}`;
|
|
1382
|
+
}
|
|
1383
|
+
getRangePercent() {
|
|
1384
|
+
const value = this.formControl.value || this.rangeOptions.floor;
|
|
1385
|
+
const range = this.rangeOptions.ceil - this.rangeOptions.floor;
|
|
1386
|
+
return ((value - this.rangeOptions.floor) / range) * 100;
|
|
1387
|
+
}
|
|
1388
|
+
onRangeStep(direction) {
|
|
1389
|
+
const step = this.rangeOptions.step || 1;
|
|
1390
|
+
const currentValue = this.formControl.value || this.rangeOptions.floor;
|
|
1391
|
+
if (direction === 'increase' && currentValue < this.rangeOptions.ceil) {
|
|
1392
|
+
this.formControl.setValue(Math.min(currentValue + step, this.rangeOptions.ceil));
|
|
1393
|
+
}
|
|
1394
|
+
else if (direction === 'decrease' && currentValue > this.rangeOptions.floor) {
|
|
1395
|
+
this.formControl.setValue(Math.max(currentValue - step, this.rangeOptions.floor));
|
|
1396
|
+
}
|
|
1397
|
+
this.formControl.markAsTouched();
|
|
1398
|
+
}
|
|
1399
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: FormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1400
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: FormFieldComponent, isStandalone: true, selector: "cw-form-field", inputs: { control: "control", formGroup: "formGroup", type: "type", label: "label", displayLabel: "displayLabel", name: "name", placeholder: "placeholder", options: "options", rangeOptions: "rangeOptions", isRequired: "isRequired", help: "help", tooltip: "tooltip", addonLeft: "addonLeft", addonRight: "addonRight", isInAddon: "isInAddon", isReadonly: "isReadonly", isDisabled: "isDisabled", sliderValue: "sliderValue", sliderOptions: "sliderOptions", cssClass: "cssClass" }, outputs: { refreshEvent: "refreshEvent", textChanged: "textChanged" }, 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 }], 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 ) {\r\n <label [for]=\"name\" class=\"form-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{ label }}\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=\"input-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=\"input-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=\"invalid-feedback d-block\" [id]=\"'error-' + name\">\r\n @if ((controlOrGroup?.errors?.['required']) || (getControl('start')?.errors?.['required'] || getControl('end')?.errors?.['required'])) {\r\n <span [innerHtml]=\"'_COMMON._FORM.ERROR_IS_MANDATORY' | translate: {label: label}\"></span>\r\n }\r\n @if(controlOrGroup?.errors?.['rangeInvalid']) {\r\n <span>{{'_COMMON._DATES.ERROR_START_END_PERIOD' | translate}}</span>\r\n }\r\n </div>\r\n }\r\n\r\n @if (help) {\r\n <small [id]=\"name + '-help'\" class=\"form-text text-muted\">{{help}}</small>\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, typeField.file,\r\n typeField.email,\r\n typeField.color].includes(type)) {\r\n <input [type]=\"type\" class=\"form-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]=\"isDisabled\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"control.invalid && control.touched ? 'error-' + name : null\" />\r\n }\r\n\r\n @if (type === typeField.password) {\r\n <input showHidePassword [type]=\"type\" class=\"form-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]=\"isDisabled ? 'disabled' : null\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"control.invalid && control.touched ? 'error-' + name : null\" />\r\n }\r\n\r\n <!-- Textarea -->\r\n @if (type === typeField.textarea) {\r\n <textarea class=\"form-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.disabled]=\"isDisabled ? 'disabled' : null\"\r\n [attr.aria-required]=\"isRequired\" [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"control.invalid && control.touched ? 'error-' + name : null\"></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\" bindValue=\"value\"\r\n [ngClass]=\"cssClass\" [searchable]=\"false\" [placeholder]=\"placeholder ? placeholder : null\" [readonly]=\"isReadonly\"\r\n [attr.disabled]=\"isDisabled ? '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]=\"control.invalid && control.touched ? 'error-' + name : null\" [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, index: index, searchTerm: search }\"></ng-container>\r\n }\r\n @else {\r\n <div>{{ item.label }}</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 }\"></ng-container>\r\n }\r\n @else {\r\n {{ item.label }}\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\" bindValue=\"value\"\r\n [multiple]=\"type === typeField.ngSelectMultiple\" [ngClass]=\"cssClass\"\r\n [placeholder]=\"placeholder ? placeholder : null\" [readonly]=\"isReadonly\"\r\n [notFoundText]=\"'_COMMON.NO_RESULT' | translate\" [attr.disabled]=\"isDisabled ? '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]=\"control.invalid && control.touched ? 'error-' + name : null\" [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 }}</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 }\"></ng-container>\r\n }\r\n @else {\r\n {{ item.label }}\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 [ngClass]=\"{ 'flex-column': type === typeField.radio }\">\r\n <legend [class.visually-hidden]=\"!displayLabel\">{{label}}</legend>\r\n <ul class=\" mb-none\" [ngClass]=\"type === typeField.radioInline ? 'list-inline' : 'list-unstyled'\">\r\n <li *ngFor=\"let opt of options\" class=\"form-check\"\r\n [ngClass]=\"{ 'form-check-inline': type === typeField.radioInline }\">\r\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" [formControl]=\"formControl\"\r\n class=\"form-check-input\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"form-check-label\">{{ opt.label }}</label>\r\n </li>\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 <legend [class.visually-hidden]=\"!displayLabel\">{{label}}</legend>\r\n <div class=\"btn-group btn-group-secondary\">\r\n <ng-container *ngFor=\"let opt of options\">\r\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" [formControl]=\"formControl\"\r\n class=\"visually-hidden\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-form\">{{ opt.label }}</label>\r\n </ng-container>\r\n </div>\r\n </fieldset>\r\n }\r\n\r\n <!-- Checkbox Switch -->\r\n @if (\r\n (type === typeField.checkbox ||\r\n type === typeField.switch ||\r\n type === typeField.switchSmall)\r\n && options.length === 0\r\n ) {\r\n <div class=\"form-check form-switch\" [ngClass]=\"{'form-switch-small': type === typeField.switchSmall}\">\r\n <input type=\"checkbox\" [id]=\"name\" [formControl]=\"formControl\" class=\"form-check-input\" />\r\n <label [for]=\"name\" class=\"form-check-label\">{{ label }}</label>\r\n </div>\r\n }\r\n\r\n <!-- Checkbox -->\r\n @if ((type === typeField.checkboxInline || type === typeField.checkbox) && options.length > 0) {\r\n <fieldset [ngClass]=\"{ 'flex-column': type === typeField.checkbox }\">\r\n <legend [class.visually-hidden]=\"!displayLabel\">{{label}}</legend>\r\n <ul class=\"mb-none\" [ngClass]=\"type === typeField.checkboxInline ? 'list-inline' : 'list-unstyled'\">\r\n <li *ngFor=\"let opt of options\" class=\"form-check\"\r\n [ngClass]=\"{ 'form-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=\"form-check-input\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"form-check-label\">{{ opt.label }}</label>\r\n </li>\r\n </ul>\r\n </fieldset>\r\n }\r\n\r\n <!-- Checkbox button -->\r\n @if (type === typeField.checkboxButton) {\r\n <fieldset>\r\n <legend [class.visually-hidden]=\"!displayLabel\">{{label}}</legend>\r\n <div class=\"btn-group btn-group-secondary\">\r\n <ng-container *ngFor=\"let opt of options\">\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 <label [for]=\"name + '_' + opt.value\" class=\"btn btn-form\">{{ opt.label }}</label>\r\n </ng-container>\r\n </div>\r\n </fieldset>\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=\"input-group\">\r\n\r\n <input [type]=\"getInputType()\" class=\"form-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]=\"isDisabled ? 'disabled' : null\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"getControl('start')?.invalid && getControl('start')?.touched\"\r\n [attr.aria-describedby]=\"getControl('start')?.invalid && getControl('start')?.touched ? 'error-' + name : null\" />\r\n\r\n @if(getControl('start')?.value) {\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=\"form-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]=\"isDisabled ? 'disabled' : null\"\r\n [attr.aria-invalid]=\"getControl('end')?.invalid && getControl('end')?.touched\"\r\n [attr.aria-describedby]=\"getControl('end')?.invalid && getControl('end')?.touched ? 'error-' + name : null\" />\r\n\r\n <button *ngIf=\"getControl('end')?.value\" type=\"button\" class=\"btn btn-secondary btn-clear-field\"\r\n (click)=\"onClearFieldPeriod('end')\">\r\n ×\r\n </button>\r\n </div>\r\n }\r\n\r\n @if ([typeField.datePlusOne, typeField.datePlusTwo, typeField.datePlusSeven, typeField.dateComplexe].includes(type)) {\r\n <div class=\"input-group\">\r\n\r\n @if (type === typeField.dateComplexe) {\r\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\" (click)=\"onDateAddDay('prev')\"\r\n [attr.disabled]=\"isDisabled ? 'disabled' : null\">\r\n <cw-icon font=\"optyweb\" icon=\"cw-nav-next-left\" [label]=\"'Jour pr\u00E9c\u00E9dent'\"></cw-icon>\r\n </button>\r\n }\r\n\r\n <input type=\"date\" class=\"form-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]=\"isDisabled\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"control.invalid && control.touched ? 'error-' + name : null\" />\r\n <button *ngIf=\"formControl?.value\" class=\"btn btn-secondary btn-clear-field\" type=\"button\"\r\n (click)=\"onClearField(formControl)\">×</button>\r\n\r\n @if (type === typeField.dateComplexe) {\r\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\" (click)=\"onDateAddDay('next')\"\r\n [attr.disabled]=\"isDisabled ? 'disabled' : null\">\r\n <cw-icon font=\"optyweb\" icon=\"cw-nav-next-right\" [label]=\"'Jour suivant'\"></cw-icon>\r\n </button>\r\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\" (click)=\"onRefresh()\"\r\n [attr.disabled]=\"isDisabled ? 'disabled' : null\">\r\n <cw-icon font=\"optyweb\" icon=\"cw-toolbar-reload\" [label]=\"'Rafra\u00EEchir'\"></cw-icon>\r\n </button>\r\n }\r\n\r\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\" (click)=\"onTodayAddDay(0)\"\r\n [attr.disabled]=\"isDisabled ? 'disabled' : null\">\r\n J\r\n <span class=\"visually-hidden\">Aujourd'hui</span>\r\n </button>\r\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\" (click)=\"onTodayAddDay(1)\"\r\n [attr.disabled]=\"isDisabled ? '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 btn-clear-field\" type=\"button\" (click)=\"onTodayAddDay(2)\"\r\n [attr.disabled]=\"isDisabled ? '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 btn-clear-field\" type=\"button\" (click)=\"onTodayAddDay(7)\"\r\n [attr.disabled]=\"isDisabled ? '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=\"d-flex align-items-center gap-2\">\r\n <button type=\"button\" class=\"btn slider-btn slider-btn-less\" (click)=\"onRangeStep('decrease')\"\r\n [disabled]=\"formControl.value <= rangeOptions.floor\">\r\n <span class=\"slider-btn-less-icon\" aria-hidden=\"true\"></span>\r\n <span class=\"visually-hidden\">Diminuer</span>\r\n </button>\r\n\r\n <div class=\"slider-input flex-grow-1 position-relative\">\r\n <label [for]=\"name\" class=\"slider-tooltip\" [style.left]=\"getRangePercent() + '%'\" aria-live=\"polite\"\r\n aria-atomic=\"true\">\r\n {{ label }} {{ 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=\"form-control-range\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\" [disabled]=\"isDisabled\">\r\n </div>\r\n\r\n <button type=\"button\" class=\"btn slider-btn slider-btn-more\" (click)=\"onRangeStep('increase')\"\r\n [disabled]=\"formControl.value >= rangeOptions.ceil\">\r\n <span class=\"slider-btn-more-icon optyweb cw-toolbar-add\" aria-hidden=\"true\"></span>\r\n <span class=\"visually-hidden\">Augmenter</span>\r\n </button>\r\n </div>\r\n }\r\n\r\n @if (isInInputGroup()) {\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.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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: NgbDropdownModule }, { 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: NgbPopover, selector: "[ngbPopover]", inputs: ["animation", "autoClose", "ngbPopover", "popoverTitle", "placement", "popperOptions", "triggers", "positionTarget", "container", "disablePopover", "popoverClass", "popoverContext", "openDelay", "closeDelay"], outputs: ["shown", "hidden"], exportAs: ["ngbPopover"] }, { kind: "directive", type: ShowHidePasswordDirective, selector: "[showHidePassword]" }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "font", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
|
|
1401
|
+
}
|
|
1402
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: FormFieldComponent, decorators: [{
|
|
1403
|
+
type: Component,
|
|
1404
|
+
args: [{ selector: 'cw-form-field', standalone: true, imports: [
|
|
1405
|
+
CommonModule,
|
|
1406
|
+
TranslateModule,
|
|
1407
|
+
FormsModule,
|
|
1408
|
+
ReactiveFormsModule,
|
|
1409
|
+
NgSelectModule,
|
|
1410
|
+
NgbDropdownModule,
|
|
1411
|
+
NgxSliderModule,
|
|
1412
|
+
NgbPopover,
|
|
1413
|
+
ShowHidePasswordDirective,
|
|
1414
|
+
IconComponent
|
|
1415
|
+
], 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 ) {\r\n <label [for]=\"name\" class=\"form-label\" [class.visually-hidden]=\"!displayLabel\">\r\n {{ label }}\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=\"input-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=\"input-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=\"invalid-feedback d-block\" [id]=\"'error-' + name\">\r\n @if ((controlOrGroup?.errors?.['required']) || (getControl('start')?.errors?.['required'] || getControl('end')?.errors?.['required'])) {\r\n <span [innerHtml]=\"'_COMMON._FORM.ERROR_IS_MANDATORY' | translate: {label: label}\"></span>\r\n }\r\n @if(controlOrGroup?.errors?.['rangeInvalid']) {\r\n <span>{{'_COMMON._DATES.ERROR_START_END_PERIOD' | translate}}</span>\r\n }\r\n </div>\r\n }\r\n\r\n @if (help) {\r\n <small [id]=\"name + '-help'\" class=\"form-text text-muted\">{{help}}</small>\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, typeField.file,\r\n typeField.email,\r\n typeField.color].includes(type)) {\r\n <input [type]=\"type\" class=\"form-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]=\"isDisabled\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"control.invalid && control.touched ? 'error-' + name : null\" />\r\n }\r\n\r\n @if (type === typeField.password) {\r\n <input showHidePassword [type]=\"type\" class=\"form-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]=\"isDisabled ? 'disabled' : null\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"control.invalid && control.touched ? 'error-' + name : null\" />\r\n }\r\n\r\n <!-- Textarea -->\r\n @if (type === typeField.textarea) {\r\n <textarea class=\"form-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.disabled]=\"isDisabled ? 'disabled' : null\"\r\n [attr.aria-required]=\"isRequired\" [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"control.invalid && control.touched ? 'error-' + name : null\"></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\" bindValue=\"value\"\r\n [ngClass]=\"cssClass\" [searchable]=\"false\" [placeholder]=\"placeholder ? placeholder : null\" [readonly]=\"isReadonly\"\r\n [attr.disabled]=\"isDisabled ? '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]=\"control.invalid && control.touched ? 'error-' + name : null\" [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, index: index, searchTerm: search }\"></ng-container>\r\n }\r\n @else {\r\n <div>{{ item.label }}</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 }\"></ng-container>\r\n }\r\n @else {\r\n {{ item.label }}\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\" bindValue=\"value\"\r\n [multiple]=\"type === typeField.ngSelectMultiple\" [ngClass]=\"cssClass\"\r\n [placeholder]=\"placeholder ? placeholder : null\" [readonly]=\"isReadonly\"\r\n [notFoundText]=\"'_COMMON.NO_RESULT' | translate\" [attr.disabled]=\"isDisabled ? '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]=\"control.invalid && control.touched ? 'error-' + name : null\" [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 }}</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 }\"></ng-container>\r\n }\r\n @else {\r\n {{ item.label }}\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 [ngClass]=\"{ 'flex-column': type === typeField.radio }\">\r\n <legend [class.visually-hidden]=\"!displayLabel\">{{label}}</legend>\r\n <ul class=\" mb-none\" [ngClass]=\"type === typeField.radioInline ? 'list-inline' : 'list-unstyled'\">\r\n <li *ngFor=\"let opt of options\" class=\"form-check\"\r\n [ngClass]=\"{ 'form-check-inline': type === typeField.radioInline }\">\r\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" [formControl]=\"formControl\"\r\n class=\"form-check-input\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"form-check-label\">{{ opt.label }}</label>\r\n </li>\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 <legend [class.visually-hidden]=\"!displayLabel\">{{label}}</legend>\r\n <div class=\"btn-group btn-group-secondary\">\r\n <ng-container *ngFor=\"let opt of options\">\r\n <input type=\"radio\" [id]=\"name + '_' + opt.value\" [value]=\"opt.value\" [formControl]=\"formControl\"\r\n class=\"visually-hidden\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"btn btn-form\">{{ opt.label }}</label>\r\n </ng-container>\r\n </div>\r\n </fieldset>\r\n }\r\n\r\n <!-- Checkbox Switch -->\r\n @if (\r\n (type === typeField.checkbox ||\r\n type === typeField.switch ||\r\n type === typeField.switchSmall)\r\n && options.length === 0\r\n ) {\r\n <div class=\"form-check form-switch\" [ngClass]=\"{'form-switch-small': type === typeField.switchSmall}\">\r\n <input type=\"checkbox\" [id]=\"name\" [formControl]=\"formControl\" class=\"form-check-input\" />\r\n <label [for]=\"name\" class=\"form-check-label\">{{ label }}</label>\r\n </div>\r\n }\r\n\r\n <!-- Checkbox -->\r\n @if ((type === typeField.checkboxInline || type === typeField.checkbox) && options.length > 0) {\r\n <fieldset [ngClass]=\"{ 'flex-column': type === typeField.checkbox }\">\r\n <legend [class.visually-hidden]=\"!displayLabel\">{{label}}</legend>\r\n <ul class=\"mb-none\" [ngClass]=\"type === typeField.checkboxInline ? 'list-inline' : 'list-unstyled'\">\r\n <li *ngFor=\"let opt of options\" class=\"form-check\"\r\n [ngClass]=\"{ 'form-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=\"form-check-input\" />\r\n <label [for]=\"name + '_' + opt.value\" class=\"form-check-label\">{{ opt.label }}</label>\r\n </li>\r\n </ul>\r\n </fieldset>\r\n }\r\n\r\n <!-- Checkbox button -->\r\n @if (type === typeField.checkboxButton) {\r\n <fieldset>\r\n <legend [class.visually-hidden]=\"!displayLabel\">{{label}}</legend>\r\n <div class=\"btn-group btn-group-secondary\">\r\n <ng-container *ngFor=\"let opt of options\">\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 <label [for]=\"name + '_' + opt.value\" class=\"btn btn-form\">{{ opt.label }}</label>\r\n </ng-container>\r\n </div>\r\n </fieldset>\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=\"input-group\">\r\n\r\n <input [type]=\"getInputType()\" class=\"form-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]=\"isDisabled ? 'disabled' : null\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"getControl('start')?.invalid && getControl('start')?.touched\"\r\n [attr.aria-describedby]=\"getControl('start')?.invalid && getControl('start')?.touched ? 'error-' + name : null\" />\r\n\r\n @if(getControl('start')?.value) {\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=\"form-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]=\"isDisabled ? 'disabled' : null\"\r\n [attr.aria-invalid]=\"getControl('end')?.invalid && getControl('end')?.touched\"\r\n [attr.aria-describedby]=\"getControl('end')?.invalid && getControl('end')?.touched ? 'error-' + name : null\" />\r\n\r\n <button *ngIf=\"getControl('end')?.value\" type=\"button\" class=\"btn btn-secondary btn-clear-field\"\r\n (click)=\"onClearFieldPeriod('end')\">\r\n ×\r\n </button>\r\n </div>\r\n }\r\n\r\n @if ([typeField.datePlusOne, typeField.datePlusTwo, typeField.datePlusSeven, typeField.dateComplexe].includes(type)) {\r\n <div class=\"input-group\">\r\n\r\n @if (type === typeField.dateComplexe) {\r\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\" (click)=\"onDateAddDay('prev')\"\r\n [attr.disabled]=\"isDisabled ? 'disabled' : null\">\r\n <cw-icon font=\"optyweb\" icon=\"cw-nav-next-left\" [label]=\"'Jour pr\u00E9c\u00E9dent'\"></cw-icon>\r\n </button>\r\n }\r\n\r\n <input type=\"date\" class=\"form-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]=\"isDisabled\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\"\r\n [attr.aria-describedby]=\"control.invalid && control.touched ? 'error-' + name : null\" />\r\n <button *ngIf=\"formControl?.value\" class=\"btn btn-secondary btn-clear-field\" type=\"button\"\r\n (click)=\"onClearField(formControl)\">×</button>\r\n\r\n @if (type === typeField.dateComplexe) {\r\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\" (click)=\"onDateAddDay('next')\"\r\n [attr.disabled]=\"isDisabled ? 'disabled' : null\">\r\n <cw-icon font=\"optyweb\" icon=\"cw-nav-next-right\" [label]=\"'Jour suivant'\"></cw-icon>\r\n </button>\r\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\" (click)=\"onRefresh()\"\r\n [attr.disabled]=\"isDisabled ? 'disabled' : null\">\r\n <cw-icon font=\"optyweb\" icon=\"cw-toolbar-reload\" [label]=\"'Rafra\u00EEchir'\"></cw-icon>\r\n </button>\r\n }\r\n\r\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\" (click)=\"onTodayAddDay(0)\"\r\n [attr.disabled]=\"isDisabled ? 'disabled' : null\">\r\n J\r\n <span class=\"visually-hidden\">Aujourd'hui</span>\r\n </button>\r\n <button class=\"btn btn-secondary btn-clear-field\" type=\"button\" (click)=\"onTodayAddDay(1)\"\r\n [attr.disabled]=\"isDisabled ? '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 btn-clear-field\" type=\"button\" (click)=\"onTodayAddDay(2)\"\r\n [attr.disabled]=\"isDisabled ? '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 btn-clear-field\" type=\"button\" (click)=\"onTodayAddDay(7)\"\r\n [attr.disabled]=\"isDisabled ? '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=\"d-flex align-items-center gap-2\">\r\n <button type=\"button\" class=\"btn slider-btn slider-btn-less\" (click)=\"onRangeStep('decrease')\"\r\n [disabled]=\"formControl.value <= rangeOptions.floor\">\r\n <span class=\"slider-btn-less-icon\" aria-hidden=\"true\"></span>\r\n <span class=\"visually-hidden\">Diminuer</span>\r\n </button>\r\n\r\n <div class=\"slider-input flex-grow-1 position-relative\">\r\n <label [for]=\"name\" class=\"slider-tooltip\" [style.left]=\"getRangePercent() + '%'\" aria-live=\"polite\"\r\n aria-atomic=\"true\">\r\n {{ label }} {{ 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=\"form-control-range\" [attr.aria-required]=\"isRequired\"\r\n [attr.aria-invalid]=\"control.invalid && control.touched\" [disabled]=\"isDisabled\">\r\n </div>\r\n\r\n <button type=\"button\" class=\"btn slider-btn slider-btn-more\" (click)=\"onRangeStep('increase')\"\r\n [disabled]=\"formControl.value >= rangeOptions.ceil\">\r\n <span class=\"slider-btn-more-icon optyweb cw-toolbar-add\" aria-hidden=\"true\"></span>\r\n <span class=\"visually-hidden\">Augmenter</span>\r\n </button>\r\n </div>\r\n }\r\n\r\n @if (isInInputGroup()) {\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" }]
|
|
1416
|
+
}], ctorParameters: () => [], propDecorators: { control: [{
|
|
1417
|
+
type: Input
|
|
1418
|
+
}], formGroup: [{
|
|
1419
|
+
type: Input
|
|
1420
|
+
}], type: [{
|
|
1421
|
+
type: Input
|
|
1422
|
+
}], label: [{
|
|
1423
|
+
type: Input
|
|
1424
|
+
}], displayLabel: [{
|
|
1425
|
+
type: Input
|
|
1426
|
+
}], name: [{
|
|
1427
|
+
type: Input
|
|
1428
|
+
}], placeholder: [{
|
|
1429
|
+
type: Input
|
|
1430
|
+
}], options: [{
|
|
1431
|
+
type: Input
|
|
1432
|
+
}], rangeOptions: [{
|
|
1433
|
+
type: Input
|
|
1434
|
+
}], isRequired: [{
|
|
1435
|
+
type: Input
|
|
1436
|
+
}], help: [{
|
|
1437
|
+
type: Input
|
|
1438
|
+
}], tooltip: [{
|
|
1439
|
+
type: Input
|
|
1440
|
+
}], addonLeft: [{
|
|
1441
|
+
type: Input
|
|
1442
|
+
}], addonRight: [{
|
|
1443
|
+
type: Input
|
|
1444
|
+
}], isInAddon: [{
|
|
1445
|
+
type: Input
|
|
1446
|
+
}], isReadonly: [{
|
|
1447
|
+
type: Input
|
|
1448
|
+
}], isDisabled: [{
|
|
1449
|
+
type: Input
|
|
1450
|
+
}], sliderValue: [{
|
|
1451
|
+
type: Input
|
|
1452
|
+
}], sliderOptions: [{
|
|
1453
|
+
type: Input
|
|
1454
|
+
}], cssClass: [{
|
|
1455
|
+
type: Input
|
|
1456
|
+
}], refreshEvent: [{
|
|
1457
|
+
type: Output
|
|
1458
|
+
}], textChanged: [{
|
|
1459
|
+
type: Output
|
|
1460
|
+
}], optionTemplate: [{
|
|
1461
|
+
type: ContentChild,
|
|
1462
|
+
args: ['ngOptionTpl', { read: TemplateRef }]
|
|
1463
|
+
}], labelTemplate: [{
|
|
1464
|
+
type: ContentChild,
|
|
1465
|
+
args: ['ngLabelTpl', { read: TemplateRef }]
|
|
1466
|
+
}], hostClasses: [{
|
|
1467
|
+
type: HostBinding,
|
|
1468
|
+
args: ['class']
|
|
1469
|
+
}] } });
|
|
1470
|
+
|
|
1471
|
+
var LegendTypeEnum;
|
|
1472
|
+
(function (LegendTypeEnum) {
|
|
1473
|
+
LegendTypeEnum["icon"] = "icon";
|
|
1474
|
+
LegendTypeEnum["badge"] = "badge";
|
|
1475
|
+
LegendTypeEnum["color"] = "color";
|
|
1476
|
+
})(LegendTypeEnum || (LegendTypeEnum = {}));
|
|
1477
|
+
|
|
1478
|
+
class LegendComponent {
|
|
1479
|
+
constructor() {
|
|
1480
|
+
this.displayInline = false;
|
|
1481
|
+
this.legendTypeEnum = LegendTypeEnum;
|
|
1482
|
+
}
|
|
1483
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: LegendComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1484
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: LegendComponent, isStandalone: true, selector: "cw-legend", inputs: { legend: "legend", displayInline: "displayInline" }, ngImport: i0, template: "@if (legend.title) {\r\n <div class=\"legend-title\">\r\n {{ '_COMMON._TABLE.LEGEND' | translate }}\r\n </div>\r\n}\r\n\r\n<ul class=\"legend-items\" [class.list-inline]=\"displayInline\">\r\n @for (item of legend.data; track $index) {\r\n <li class=\"legend-item\" [class.list-inline-item]=\"displayInline\">\r\n @switch (item.type) {\r\n @case (legendTypeEnum.icon) {\r\n <cw-icon [icon]=\"item.icon\" [label]=\"item.label\" [iconCssClass]=\"'text-' + item.colorUi\" [iconColorCustom]=\"item.colorCustom\"></cw-icon>\r\n }\r\n @case (legendTypeEnum.badge) {\r\n <cw-badge [type]=\"item.colorBadge\" [label]=\"item.labelBadge\"></cw-badge>\r\n {{item.label}}\r\n }\r\n @case (legendTypeEnum.color) {\r\n <span class=\"legend-item-color\" [ngClass]=\"item.colorUi ?'legend-' + item.colorUi : ''\" [style.background-color]=\"item.colorCustom\"></span>\r\n {{item.label}}\r\n }\r\n }\r\n </li>\r\n }\r\n</ul>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "font", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom"] }, { kind: "component", type: BadgeComponent, selector: "cw-badge", inputs: ["type", "label", "withIcon", "iconPosition", "cssClass", "dataTest"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
|
|
1485
|
+
}
|
|
1486
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: LegendComponent, decorators: [{
|
|
1487
|
+
type: Component,
|
|
1488
|
+
args: [{ selector: 'cw-legend', standalone: true, imports: [
|
|
1489
|
+
CommonModule,
|
|
1490
|
+
IconComponent,
|
|
1491
|
+
BadgeComponent,
|
|
1492
|
+
TranslateModule
|
|
1493
|
+
], template: "@if (legend.title) {\r\n <div class=\"legend-title\">\r\n {{ '_COMMON._TABLE.LEGEND' | translate }}\r\n </div>\r\n}\r\n\r\n<ul class=\"legend-items\" [class.list-inline]=\"displayInline\">\r\n @for (item of legend.data; track $index) {\r\n <li class=\"legend-item\" [class.list-inline-item]=\"displayInline\">\r\n @switch (item.type) {\r\n @case (legendTypeEnum.icon) {\r\n <cw-icon [icon]=\"item.icon\" [label]=\"item.label\" [iconCssClass]=\"'text-' + item.colorUi\" [iconColorCustom]=\"item.colorCustom\"></cw-icon>\r\n }\r\n @case (legendTypeEnum.badge) {\r\n <cw-badge [type]=\"item.colorBadge\" [label]=\"item.labelBadge\"></cw-badge>\r\n {{item.label}}\r\n }\r\n @case (legendTypeEnum.color) {\r\n <span class=\"legend-item-color\" [ngClass]=\"item.colorUi ?'legend-' + item.colorUi : ''\" [style.background-color]=\"item.colorCustom\"></span>\r\n {{item.label}}\r\n }\r\n }\r\n </li>\r\n }\r\n</ul>\r\n" }]
|
|
1494
|
+
}], ctorParameters: () => [], propDecorators: { legend: [{
|
|
1495
|
+
type: Input
|
|
1496
|
+
}], displayInline: [{
|
|
1497
|
+
type: Input
|
|
1498
|
+
}] } });
|
|
1499
|
+
|
|
1500
|
+
class LoaderComponent {
|
|
1501
|
+
constructor() { }
|
|
1502
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: LoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1503
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: LoaderComponent, isStandalone: true, selector: "cw-loader", ngImport: i0, template: "<div class=\"loader text-center\">\r\n <span class=\"spinner-border spinner-border-sm\" aria-hidden=\"true\"></span>\r\n <span role=\"status\">{{ '_COMMON._HTTP.TXT_LOADING' | translate }}</span>\r\n</div>\r\n", dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
|
|
1504
|
+
}
|
|
1505
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: LoaderComponent, decorators: [{
|
|
1506
|
+
type: Component,
|
|
1507
|
+
args: [{ selector: 'cw-loader', standalone: true, imports: [
|
|
1508
|
+
TranslateModule
|
|
1509
|
+
], template: "<div class=\"loader text-center\">\r\n <span class=\"spinner-border spinner-border-sm\" aria-hidden=\"true\"></span>\r\n <span role=\"status\">{{ '_COMMON._HTTP.TXT_LOADING' | translate }}</span>\r\n</div>\r\n" }]
|
|
1510
|
+
}], ctorParameters: () => [] });
|
|
1511
|
+
|
|
1512
|
+
var ModalsType;
|
|
1513
|
+
(function (ModalsType) {
|
|
1514
|
+
ModalsType["delete"] = "delete";
|
|
1515
|
+
ModalsType["loader"] = "loader";
|
|
1516
|
+
ModalsType["quickSideView"] = "quicksideview";
|
|
1517
|
+
ModalsType["custom"] = "custom";
|
|
1518
|
+
})(ModalsType || (ModalsType = {}));
|
|
1519
|
+
|
|
1520
|
+
class ModalsComponent {
|
|
1521
|
+
constructor(activeModal, translateService) {
|
|
1522
|
+
this.activeModal = activeModal;
|
|
1523
|
+
this.translateService = translateService;
|
|
1524
|
+
this.itemsToDelete = [];
|
|
1525
|
+
this.itemsToDeleteTitle = this.translateService.instant('_COMMON._MODAL_DELETE.DEFAULT_TYPE');
|
|
1526
|
+
this.btnAction = new EventEmitter();
|
|
1527
|
+
this.modalsType = ModalsType;
|
|
1528
|
+
this.buttonTypeEnum = FoButtonTypeEnum && BoButtonTypeEnum;
|
|
1529
|
+
}
|
|
1530
|
+
ngOnInit() {
|
|
1531
|
+
if (this.type === this.modalsType.quickSideView && !this.labelBtnAction) {
|
|
1532
|
+
this.labelBtnAction = this.translateService.instant('_COMMON._ACTION.EDIT');
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
actionClick() {
|
|
1536
|
+
this.activeModal.close();
|
|
1537
|
+
}
|
|
1538
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ModalsComponent, deps: [{ token: i1$1.NgbActiveModal }, { token: i2.TranslateService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1539
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: ModalsComponent, isStandalone: true, selector: "cw-modals", inputs: { type: "type", modalTitle: "modalTitle", itemsToDelete: "itemsToDelete", itemsToDeleteTitle: "itemsToDeleteTitle", labelBtnAction: "labelBtnAction", customBodyTemplate: "customBodyTemplate", customBodyContext: "customBodyContext" }, outputs: { btnAction: "btnAction" }, ngImport: i0, template: "@if (type !== modalsType.loader) {\r\n <div class=\"modal-header\">\r\n @if (type === modalsType.delete) {\r\n <h1 class=\"modal-title\" id=\"modal-basic-title\">\r\n {{ '_COMMON._MODAL_DELETE.TITLE' | translate: { number: itemsToDelete.length, name: itemsToDeleteTitle } }}\r\n </h1>\r\n }\r\n @else {\r\n <h1 class=\"modal-title\" id=\"modal-basic-title\">\r\n {{ modalTitle | translate }}\r\n </h1>\r\n }\r\n\r\n <button type=\"button\" class=\"btn-close\" [attr.aria-label]=\"'_COMMON._ACTION.CLOSE' | translate\"\r\n (click)=\"activeModal.dismiss()\" data-test-ctw=\"btn-close-modal\">\r\n </button>\r\n </div>\r\n\r\n <div class=\"modal-body\">\r\n @if (type === modalsType.delete) {\r\n @if (itemsToDelete.length === 1) {\r\n <div [innerHTML]=\"'_COMMON._MODAL_DELETE.SIMPLE_TEXT' | translate\"></div>\r\n }\r\n @if (itemsToDelete.length > 1) {\r\n <div [innerHTML]=\"'_COMMON._MODAL_DELETE.MULTIPLE_TEXT' | translate\"></div>\r\n }\r\n @if (itemsToDelete.length > 0) {\r\n <ul class=\"mb-none\">\r\n @for (item of itemsToDelete; track item) {\r\n <li>{{ item }}</li>\r\n }\r\n </ul>\r\n }\r\n }\r\n @else if (type === modalsType.custom || type === modalsType.quickSideView) {\r\n @if (customBodyTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"customBodyTemplate\" [ngTemplateOutletContext]=\"customBodyContext\">\r\n </ng-container>\r\n }\r\n }\r\n </div>\r\n\r\n <div class=\"modal-footer\">\r\n @if (type === modalsType.delete) {\r\n <cw-button label=\"_COMMON._ACTION.DELETE\" [type]=\"buttonTypeEnum.primary\" [isMinWidth]=\"true\"\r\n (btnAction)=\"actionClick()\" dataTest=\"btn-action-modal\">\r\n </cw-button>\r\n\r\n <cw-button label=\"_COMMON._ACTION.CANCEL\" [type]=\"buttonTypeEnum.secondary\" [isMinWidth]=\"true\"\r\n (btnAction)=\"activeModal.dismiss()\" dataTest=\"btn-close-modal\">\r\n </cw-button>\r\n }\r\n @else {\r\n @if(labelBtnAction) {\r\n <cw-button [label]=\"labelBtnAction | translate\" [type]=\"buttonTypeEnum.primary\" [isMinWidth]=\"true\"\r\n (btnAction)=\"actionClick()\" dataTest=\"btn-close-modal\">\r\n </cw-button>\r\n }\r\n\r\n <cw-button label=\"_COMMON._ACTION.CLOSE\" [type]=\"buttonTypeEnum.secondary\" [isMinWidth]=\"true\"\r\n (btnAction)=\"activeModal.dismiss()\" dataTest=\"btn-close-modal\">\r\n </cw-button>\r\n }\r\n </div>\r\n}\r\n\r\n@if (type === modalsType.loader) {\r\n <div class=\"modal-body\">\r\n <cw-loader></cw-loader>\r\n </div>\r\n}\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { 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", "isDropdown", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "withSpinner", "cssClass", "dataTest", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { kind: "component", type: LoaderComponent, selector: "cw-loader" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
|
|
1540
|
+
}
|
|
1541
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ModalsComponent, decorators: [{
|
|
1542
|
+
type: Component,
|
|
1543
|
+
args: [{ selector: 'cw-modals', standalone: true, imports: [
|
|
1544
|
+
CommonModule,
|
|
1545
|
+
TranslateModule,
|
|
1546
|
+
ButtonComponent,
|
|
1547
|
+
LoaderComponent
|
|
1548
|
+
], template: "@if (type !== modalsType.loader) {\r\n <div class=\"modal-header\">\r\n @if (type === modalsType.delete) {\r\n <h1 class=\"modal-title\" id=\"modal-basic-title\">\r\n {{ '_COMMON._MODAL_DELETE.TITLE' | translate: { number: itemsToDelete.length, name: itemsToDeleteTitle } }}\r\n </h1>\r\n }\r\n @else {\r\n <h1 class=\"modal-title\" id=\"modal-basic-title\">\r\n {{ modalTitle | translate }}\r\n </h1>\r\n }\r\n\r\n <button type=\"button\" class=\"btn-close\" [attr.aria-label]=\"'_COMMON._ACTION.CLOSE' | translate\"\r\n (click)=\"activeModal.dismiss()\" data-test-ctw=\"btn-close-modal\">\r\n </button>\r\n </div>\r\n\r\n <div class=\"modal-body\">\r\n @if (type === modalsType.delete) {\r\n @if (itemsToDelete.length === 1) {\r\n <div [innerHTML]=\"'_COMMON._MODAL_DELETE.SIMPLE_TEXT' | translate\"></div>\r\n }\r\n @if (itemsToDelete.length > 1) {\r\n <div [innerHTML]=\"'_COMMON._MODAL_DELETE.MULTIPLE_TEXT' | translate\"></div>\r\n }\r\n @if (itemsToDelete.length > 0) {\r\n <ul class=\"mb-none\">\r\n @for (item of itemsToDelete; track item) {\r\n <li>{{ item }}</li>\r\n }\r\n </ul>\r\n }\r\n }\r\n @else if (type === modalsType.custom || type === modalsType.quickSideView) {\r\n @if (customBodyTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"customBodyTemplate\" [ngTemplateOutletContext]=\"customBodyContext\">\r\n </ng-container>\r\n }\r\n }\r\n </div>\r\n\r\n <div class=\"modal-footer\">\r\n @if (type === modalsType.delete) {\r\n <cw-button label=\"_COMMON._ACTION.DELETE\" [type]=\"buttonTypeEnum.primary\" [isMinWidth]=\"true\"\r\n (btnAction)=\"actionClick()\" dataTest=\"btn-action-modal\">\r\n </cw-button>\r\n\r\n <cw-button label=\"_COMMON._ACTION.CANCEL\" [type]=\"buttonTypeEnum.secondary\" [isMinWidth]=\"true\"\r\n (btnAction)=\"activeModal.dismiss()\" dataTest=\"btn-close-modal\">\r\n </cw-button>\r\n }\r\n @else {\r\n @if(labelBtnAction) {\r\n <cw-button [label]=\"labelBtnAction | translate\" [type]=\"buttonTypeEnum.primary\" [isMinWidth]=\"true\"\r\n (btnAction)=\"actionClick()\" dataTest=\"btn-close-modal\">\r\n </cw-button>\r\n }\r\n\r\n <cw-button label=\"_COMMON._ACTION.CLOSE\" [type]=\"buttonTypeEnum.secondary\" [isMinWidth]=\"true\"\r\n (btnAction)=\"activeModal.dismiss()\" dataTest=\"btn-close-modal\">\r\n </cw-button>\r\n }\r\n </div>\r\n}\r\n\r\n@if (type === modalsType.loader) {\r\n <div class=\"modal-body\">\r\n <cw-loader></cw-loader>\r\n </div>\r\n}\r\n" }]
|
|
1549
|
+
}], ctorParameters: () => [{ type: i1$1.NgbActiveModal }, { type: i2.TranslateService }], propDecorators: { type: [{
|
|
1550
|
+
type: Input
|
|
1551
|
+
}], modalTitle: [{
|
|
1552
|
+
type: Input
|
|
1553
|
+
}], itemsToDelete: [{
|
|
1554
|
+
type: Input
|
|
1555
|
+
}], itemsToDeleteTitle: [{
|
|
1556
|
+
type: Input
|
|
1557
|
+
}], labelBtnAction: [{
|
|
1558
|
+
type: Input
|
|
1559
|
+
}], customBodyTemplate: [{
|
|
1560
|
+
type: Input
|
|
1561
|
+
}], customBodyContext: [{
|
|
1562
|
+
type: Input
|
|
1563
|
+
}], btnAction: [{
|
|
1564
|
+
type: Output
|
|
1565
|
+
}] } });
|
|
1566
|
+
|
|
1567
|
+
class TabContentComponent {
|
|
1568
|
+
constructor() {
|
|
1569
|
+
this.disabled = false;
|
|
1570
|
+
this.id = 0;
|
|
1571
|
+
this.active = false;
|
|
1572
|
+
}
|
|
1573
|
+
get fragment() {
|
|
1574
|
+
return UtilsHelper.slugify(this.title);
|
|
1575
|
+
}
|
|
1576
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TabContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1577
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: TabContentComponent, isStandalone: true, selector: "cw-tab-content", inputs: { title: "title", disabled: "disabled", withIcon: "withIcon" }, ngImport: i0, template: `
|
|
1578
|
+
<div class="tab-pane"
|
|
1579
|
+
[class.fade]="!active"
|
|
1580
|
+
[class.active]="active"
|
|
1581
|
+
[class.show]="active"
|
|
1582
|
+
[class.d-none]="!active"
|
|
1583
|
+
[id]="'cw-nav-' + id + '-panel'"
|
|
1584
|
+
role="tabpanel"
|
|
1585
|
+
[attr.aria-labelledby]="'cw-nav-' + id">
|
|
1586
|
+
<ng-content></ng-content>
|
|
1587
|
+
</div>
|
|
1588
|
+
`, isInline: true }); }
|
|
1589
|
+
}
|
|
1590
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TabContentComponent, decorators: [{
|
|
1591
|
+
type: Component,
|
|
1592
|
+
args: [{
|
|
1593
|
+
selector: 'cw-tab-content',
|
|
1594
|
+
template: `
|
|
1595
|
+
<div class="tab-pane"
|
|
1596
|
+
[class.fade]="!active"
|
|
1597
|
+
[class.active]="active"
|
|
1598
|
+
[class.show]="active"
|
|
1599
|
+
[class.d-none]="!active"
|
|
1600
|
+
[id]="'cw-nav-' + id + '-panel'"
|
|
1601
|
+
role="tabpanel"
|
|
1602
|
+
[attr.aria-labelledby]="'cw-nav-' + id">
|
|
1603
|
+
<ng-content></ng-content>
|
|
1604
|
+
</div>
|
|
1605
|
+
`,
|
|
1606
|
+
standalone: true
|
|
1607
|
+
}]
|
|
1608
|
+
}], propDecorators: { title: [{
|
|
1609
|
+
type: Input
|
|
1610
|
+
}], disabled: [{
|
|
1611
|
+
type: Input
|
|
1612
|
+
}], withIcon: [{
|
|
1613
|
+
type: Input
|
|
1614
|
+
}] } });
|
|
1615
|
+
|
|
1616
|
+
var FoTabTypeEnum;
|
|
1617
|
+
(function (FoTabTypeEnum) {
|
|
1618
|
+
FoTabTypeEnum["defaultMd"] = "default-md";
|
|
1619
|
+
FoTabTypeEnum["defaultXl"] = "default-xl";
|
|
1620
|
+
})(FoTabTypeEnum || (FoTabTypeEnum = {}));
|
|
1621
|
+
var BoTabTypeEnum;
|
|
1622
|
+
(function (BoTabTypeEnum) {
|
|
1623
|
+
BoTabTypeEnum["basic"] = "basic";
|
|
1624
|
+
BoTabTypeEnum["card"] = "card";
|
|
1625
|
+
})(BoTabTypeEnum || (BoTabTypeEnum = {}));
|
|
1626
|
+
|
|
1627
|
+
class TabComponent {
|
|
1628
|
+
constructor(router, route) {
|
|
1629
|
+
this.router = router;
|
|
1630
|
+
this.route = route;
|
|
1631
|
+
this.type = FoTabTypeEnum.defaultMd;
|
|
1632
|
+
this.useFragment = true;
|
|
1633
|
+
this.tabContentCssClass = '';
|
|
1634
|
+
this.activeTabIndex = 0;
|
|
1635
|
+
this.tabChanged = new EventEmitter();
|
|
1636
|
+
this.activeId = 0;
|
|
1637
|
+
this.iconSize = IconSizeEnum['md'];
|
|
1638
|
+
this.tabTypeEnum = FoTabTypeEnum && BoTabTypeEnum;
|
|
1639
|
+
}
|
|
1640
|
+
ngAfterContentInit() {
|
|
1641
|
+
const tabsArray = this.tabs.toArray();
|
|
1642
|
+
tabsArray.forEach((tab, index) => {
|
|
1643
|
+
tab.id = index;
|
|
1644
|
+
tab.active = false;
|
|
1645
|
+
});
|
|
1646
|
+
const firstActiveIndex = tabsArray.findIndex(t => !t.disabled);
|
|
1647
|
+
this.activeId = this.activeTabIndex ?? (firstActiveIndex !== -1 ? firstActiveIndex : 0);
|
|
1648
|
+
if (this.useFragment) {
|
|
1649
|
+
this.route.fragment.subscribe(fragment => {
|
|
1650
|
+
if (fragment) {
|
|
1651
|
+
const foundIndex = tabsArray.findIndex(tab => tab.fragment === fragment && !tab.disabled);
|
|
1652
|
+
if (foundIndex !== -1) {
|
|
1653
|
+
this.activeId = foundIndex;
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
this.activateTabByIndex(this.activeId);
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1659
|
+
else {
|
|
1660
|
+
this.activateTabByIndex(this.activeId);
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
selectTab(tab) {
|
|
1664
|
+
if (tab.disabled)
|
|
1665
|
+
return;
|
|
1666
|
+
this.tabs.forEach(t => t.active = false);
|
|
1667
|
+
tab.active = true;
|
|
1668
|
+
this.activeId = tab.id;
|
|
1669
|
+
if (this.useFragment) {
|
|
1670
|
+
this.router.navigate([], {
|
|
1671
|
+
relativeTo: this.route,
|
|
1672
|
+
fragment: tab.fragment,
|
|
1673
|
+
queryParamsHandling: 'preserve',
|
|
1674
|
+
replaceUrl: true
|
|
1675
|
+
});
|
|
1676
|
+
}
|
|
1677
|
+
this.tabChanged.emit(this.activeId);
|
|
1678
|
+
}
|
|
1679
|
+
activateTabByIndex(index) {
|
|
1680
|
+
const tab = this.tabs.toArray()[index];
|
|
1681
|
+
if (tab && !tab.disabled) {
|
|
1682
|
+
this.selectTab(tab);
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
onKeydown(event) {
|
|
1686
|
+
switch (event.key) {
|
|
1687
|
+
case 'ArrowLeft':
|
|
1688
|
+
event.preventDefault();
|
|
1689
|
+
this.selectPreviousTab();
|
|
1690
|
+
break;
|
|
1691
|
+
case 'ArrowRight':
|
|
1692
|
+
event.preventDefault();
|
|
1693
|
+
this.selectNextTab();
|
|
1694
|
+
break;
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
moveFocus() {
|
|
1698
|
+
this.tabLinks?.forEach((link) => {
|
|
1699
|
+
if (link.nativeElement.getAttribute('aria-selected') === 'true') {
|
|
1700
|
+
link.nativeElement.focus();
|
|
1701
|
+
}
|
|
1702
|
+
});
|
|
1703
|
+
}
|
|
1704
|
+
selectPreviousTab() {
|
|
1705
|
+
const tabsArray = this.tabs.toArray();
|
|
1706
|
+
const activeIndex = tabsArray.findIndex(tab => tab.active);
|
|
1707
|
+
if (activeIndex !== -1) {
|
|
1708
|
+
let newIndex = (activeIndex - 1 + tabsArray.length) % tabsArray.length;
|
|
1709
|
+
while (tabsArray[newIndex].disabled && newIndex !== activeIndex) {
|
|
1710
|
+
newIndex = (newIndex - 1 + tabsArray.length) % tabsArray.length;
|
|
1711
|
+
}
|
|
1712
|
+
if (!tabsArray[newIndex].disabled) {
|
|
1713
|
+
this.selectTab(tabsArray[newIndex]);
|
|
1714
|
+
setTimeout(() => this.moveFocus());
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
selectNextTab() {
|
|
1719
|
+
const tabsArray = this.tabs.toArray();
|
|
1720
|
+
const activeIndex = tabsArray.findIndex(tab => tab.active);
|
|
1721
|
+
if (activeIndex !== -1) {
|
|
1722
|
+
let newIndex = (activeIndex + 1) % tabsArray.length;
|
|
1723
|
+
while (tabsArray[newIndex].disabled && newIndex !== activeIndex) {
|
|
1724
|
+
newIndex = (newIndex + 1) % tabsArray.length;
|
|
1725
|
+
}
|
|
1726
|
+
if (!tabsArray[newIndex].disabled) {
|
|
1727
|
+
this.selectTab(tabsArray[newIndex]);
|
|
1728
|
+
setTimeout(() => this.moveFocus());
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TabComponent, deps: [{ token: i1$2.Router }, { token: i1$2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1733
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: TabComponent, isStandalone: true, selector: "cw-tab", inputs: { type: "type", id: "id", useFragment: "useFragment", title: "title", tabContentCssClass: "tabContentCssClass", activeTabIndex: "activeTabIndex" }, outputs: { tabChanged: "tabChanged" }, queries: [{ propertyName: "tabs", predicate: TabContentComponent }], viewQueries: [{ propertyName: "tabLinks", predicate: ["tabLink"], descendants: true }], ngImport: i0, template: "<div class=\"tab\" [ngClass]=\"'tab-' + type\">\r\n @if (title) {\r\n <h2>{{ title | translate }}</h2>\r\n }\r\n <ul class=\"tab-items d-flex-h\" [ngClass]=\"'tab-items-' + type\" role=\"tablist\" appRwdTabs>\r\n @for (tab of tabs.toArray(); track tab; let i = $index) {\r\n <li class=\"tab-item\" role=\"presentation\">\r\n <button #tabLink type=\"button\" class=\"tab-link btn\" [class.active]=\"tab.active\" [class.disabled]=\"tab.disabled\"\r\n [disabled]=\"tab.disabled\" [attr.id]=\"'cw-nav-' + i\" [attr.data-test-ctw]=\"'link-tab-' + id + '-' + i\"\r\n [attr.aria-selected]=\"tab.active\" [attr.aria-controls]=\"'cw-nav-' + i + '-panel'\"\r\n [attr.tabindex]=\"tab.active ? '0' : '-1'\" (click)=\"selectTab(tab)\" (keydown)=\"onKeydown($event)\" role=\"tab\">\r\n @if (tab.withIcon) {\r\n <cw-icon [icon]=\"tab.withIcon\" [iconSize]=\"iconSize\"></cw-icon>\r\n }\r\n {{ tab.title | translate }}\r\n </button>\r\n </li>\r\n }\r\n </ul>\r\n</div>\r\n\r\n<div [class]=\"'tab-content ' + tabContentCssClass\" [ngClass]=\"'tab-content-' + type\">\r\n <ng-content></ng-content>\r\n</div>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "font", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
|
|
1734
|
+
}
|
|
1735
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TabComponent, decorators: [{
|
|
1736
|
+
type: Component,
|
|
1737
|
+
args: [{ selector: 'cw-tab', standalone: true, imports: [
|
|
1738
|
+
CommonModule,
|
|
1739
|
+
IconComponent,
|
|
1740
|
+
TranslateModule
|
|
1741
|
+
], template: "<div class=\"tab\" [ngClass]=\"'tab-' + type\">\r\n @if (title) {\r\n <h2>{{ title | translate }}</h2>\r\n }\r\n <ul class=\"tab-items d-flex-h\" [ngClass]=\"'tab-items-' + type\" role=\"tablist\" appRwdTabs>\r\n @for (tab of tabs.toArray(); track tab; let i = $index) {\r\n <li class=\"tab-item\" role=\"presentation\">\r\n <button #tabLink type=\"button\" class=\"tab-link btn\" [class.active]=\"tab.active\" [class.disabled]=\"tab.disabled\"\r\n [disabled]=\"tab.disabled\" [attr.id]=\"'cw-nav-' + i\" [attr.data-test-ctw]=\"'link-tab-' + id + '-' + i\"\r\n [attr.aria-selected]=\"tab.active\" [attr.aria-controls]=\"'cw-nav-' + i + '-panel'\"\r\n [attr.tabindex]=\"tab.active ? '0' : '-1'\" (click)=\"selectTab(tab)\" (keydown)=\"onKeydown($event)\" role=\"tab\">\r\n @if (tab.withIcon) {\r\n <cw-icon [icon]=\"tab.withIcon\" [iconSize]=\"iconSize\"></cw-icon>\r\n }\r\n {{ tab.title | translate }}\r\n </button>\r\n </li>\r\n }\r\n </ul>\r\n</div>\r\n\r\n<div [class]=\"'tab-content ' + tabContentCssClass\" [ngClass]=\"'tab-content-' + type\">\r\n <ng-content></ng-content>\r\n</div>\r\n" }]
|
|
1742
|
+
}], ctorParameters: () => [{ type: i1$2.Router }, { type: i1$2.ActivatedRoute }], propDecorators: { type: [{
|
|
1743
|
+
type: Input
|
|
1744
|
+
}], id: [{
|
|
1745
|
+
type: Input
|
|
1746
|
+
}], useFragment: [{
|
|
1747
|
+
type: Input
|
|
1748
|
+
}], title: [{
|
|
1749
|
+
type: Input
|
|
1750
|
+
}], tabContentCssClass: [{
|
|
1751
|
+
type: Input
|
|
1752
|
+
}], activeTabIndex: [{
|
|
1753
|
+
type: Input
|
|
1754
|
+
}], tabs: [{
|
|
1755
|
+
type: ContentChildren,
|
|
1756
|
+
args: [TabContentComponent]
|
|
1757
|
+
}], tabLinks: [{
|
|
1758
|
+
type: ViewChildren,
|
|
1759
|
+
args: ['tabLink']
|
|
1760
|
+
}], tabChanged: [{
|
|
1761
|
+
type: Output
|
|
1762
|
+
}] } });
|
|
1763
|
+
|
|
1764
|
+
class WizardStepComponent {
|
|
1765
|
+
constructor() {
|
|
1766
|
+
this.completed = false;
|
|
1767
|
+
}
|
|
1768
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: WizardStepComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1769
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: WizardStepComponent, isStandalone: true, selector: "cw-wizard-step", inputs: { title: "title", completed: "completed" }, viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["content"], descendants: true, static: true }], ngImport: i0, template: '<ng-template #content><ng-content></ng-content></ng-template>', isInline: true }); }
|
|
1770
|
+
}
|
|
1771
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: WizardStepComponent, decorators: [{
|
|
1772
|
+
type: Component,
|
|
1773
|
+
args: [{
|
|
1774
|
+
selector: 'cw-wizard-step',
|
|
1775
|
+
template: '<ng-template #content><ng-content></ng-content></ng-template>',
|
|
1776
|
+
standalone: true
|
|
1777
|
+
}]
|
|
1778
|
+
}], propDecorators: { title: [{
|
|
1779
|
+
type: Input
|
|
1780
|
+
}], completed: [{
|
|
1781
|
+
type: Input
|
|
1782
|
+
}], templateRef: [{
|
|
1783
|
+
type: ViewChild,
|
|
1784
|
+
args: ['content', { static: true }]
|
|
1785
|
+
}] } });
|
|
1786
|
+
|
|
1787
|
+
class WizardStepperComponent {
|
|
1788
|
+
constructor() {
|
|
1789
|
+
this.stepChange = new EventEmitter();
|
|
1790
|
+
this.stepNext = new EventEmitter();
|
|
1791
|
+
this.stepPrevious = new EventEmitter();
|
|
1792
|
+
this.stepEnd = new EventEmitter();
|
|
1793
|
+
this.selectedIndex = 0;
|
|
1794
|
+
}
|
|
1795
|
+
get stepList() {
|
|
1796
|
+
return this.steps.toArray();
|
|
1797
|
+
}
|
|
1798
|
+
goToStep(index) {
|
|
1799
|
+
if (index < 0 || index >= this.steps.length)
|
|
1800
|
+
return;
|
|
1801
|
+
// Vérifier que toutes les étapes précédentes sont complétées
|
|
1802
|
+
for (let i = 0; i < index; i++) {
|
|
1803
|
+
if (!this.steps.toArray()[i].completed) {
|
|
1804
|
+
return; // Empêche d'aller à cette étape si une étape précédente n'est pas validée
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
this.selectedIndex = index;
|
|
1808
|
+
this.stepChange.emit(this.selectedIndex);
|
|
1809
|
+
}
|
|
1810
|
+
nextStep() {
|
|
1811
|
+
if (this.selectedIndex < this.steps.length - 1) {
|
|
1812
|
+
const currentStep = this.steps.toArray()[this.selectedIndex];
|
|
1813
|
+
if (!currentStep.completed) {
|
|
1814
|
+
// Si l'étape courante n'est pas validée, on bloque
|
|
1815
|
+
return;
|
|
1816
|
+
}
|
|
1817
|
+
this.selectedIndex++;
|
|
1818
|
+
this.stepNext.emit(this.selectedIndex);
|
|
1819
|
+
this.stepChange.emit(this.selectedIndex);
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
previousStep() {
|
|
1823
|
+
if (this.selectedIndex > 0) {
|
|
1824
|
+
this.selectedIndex--;
|
|
1825
|
+
this.stepPrevious.emit(this.selectedIndex);
|
|
1826
|
+
this.stepChange.emit(this.selectedIndex);
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
endWizard() {
|
|
1830
|
+
if (this.selectedIndex > 0) {
|
|
1831
|
+
this.stepEnd.emit(this.selectedIndex);
|
|
1832
|
+
this.stepChange.emit(this.selectedIndex);
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: WizardStepperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1836
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: WizardStepperComponent, isStandalone: true, selector: "cw-wizard-stepper", outputs: { stepChange: "stepChange", stepNext: "stepNext", stepPrevious: "stepPrevious", stepEnd: "stepEnd" }, queries: [{ propertyName: "steps", predicate: WizardStepComponent }], ngImport: i0, template: "<nav>\r\n <ul class=\"list-inline step-list\">\r\n @for (step of steps.toArray(); track step; let i = $index) {\r\n <li class=\"list-inline-item step-item\">\r\n <button class=\"btn step-button\" [ngClass]=\"{\r\n 'step-active': selectedIndex === i,\r\n 'step-completed': step.completed,\r\n 'step-current': selectedIndex === i && step.completed === false\r\n }\" [disabled]=\"(i > 0 && !steps.toArray()[i - 1]?.completed)\" (click)=\"goToStep(i)\" type=\"button\">\r\n <span class=\"step-indicator bo-icons bo-alert-success\" aria-hidden=\"true\"></span>\r\n <span class=\"step-label\">\r\n {{ step.title || ('_COMMON._STEPPER.STEP' | translate) + (i + 1) }}\r\n </span>\r\n </button>\r\n </li>\r\n }\r\n </ul>\r\n</nav>\r\n\r\n@for (step of steps.toArray(); track step; let i = $index) {\r\n <section class=\"tab-pane\" [class.active]=\"selectedIndex === i\" [hidden]=\"selectedIndex !== i\" role=\"tabpanel\">\r\n <ng-container *ngTemplateOutlet=\"step.templateRef\"></ng-container>\r\n </section>\r\n}\r\n\r\n<div class=\"text-center mt-5\">\r\n <div class=\"btn-group\">\r\n <button class=\"btn btn-secondary btn-min-width\" (click)=\"previousStep()\" [disabled]=\"selectedIndex === 0\"\r\n type=\"button\">\r\n {{ '_COMMON._STEPPER.PREVIOUS_STEP' | translate }}\r\n </button>\r\n\r\n @if (selectedIndex !== steps.length - 1) {\r\n <button class=\"btn btn-primary btn-min-width\" (click)=\"nextStep()\"\r\n [disabled]=\"!steps.toArray()[selectedIndex]?.completed\" type=\"button\">\r\n {{ '_COMMON._STEPPER.NEXT_STEP' | translate }}\r\n </button>\r\n }\r\n @else {\r\n <button class=\"btn btn-primary btn-min-width\" (click)=\"endWizard()\" type=\"button\">\r\n {{ '_COMMON._ACTION.END' | translate }}\r\n </button>\r\n }\r\n </div>\r\n</div>\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: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
|
|
1837
|
+
}
|
|
1838
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: WizardStepperComponent, decorators: [{
|
|
1839
|
+
type: Component,
|
|
1840
|
+
args: [{ selector: 'cw-wizard-stepper', standalone: true, imports: [
|
|
1841
|
+
CommonModule,
|
|
1842
|
+
TranslateModule
|
|
1843
|
+
], template: "<nav>\r\n <ul class=\"list-inline step-list\">\r\n @for (step of steps.toArray(); track step; let i = $index) {\r\n <li class=\"list-inline-item step-item\">\r\n <button class=\"btn step-button\" [ngClass]=\"{\r\n 'step-active': selectedIndex === i,\r\n 'step-completed': step.completed,\r\n 'step-current': selectedIndex === i && step.completed === false\r\n }\" [disabled]=\"(i > 0 && !steps.toArray()[i - 1]?.completed)\" (click)=\"goToStep(i)\" type=\"button\">\r\n <span class=\"step-indicator bo-icons bo-alert-success\" aria-hidden=\"true\"></span>\r\n <span class=\"step-label\">\r\n {{ step.title || ('_COMMON._STEPPER.STEP' | translate) + (i + 1) }}\r\n </span>\r\n </button>\r\n </li>\r\n }\r\n </ul>\r\n</nav>\r\n\r\n@for (step of steps.toArray(); track step; let i = $index) {\r\n <section class=\"tab-pane\" [class.active]=\"selectedIndex === i\" [hidden]=\"selectedIndex !== i\" role=\"tabpanel\">\r\n <ng-container *ngTemplateOutlet=\"step.templateRef\"></ng-container>\r\n </section>\r\n}\r\n\r\n<div class=\"text-center mt-5\">\r\n <div class=\"btn-group\">\r\n <button class=\"btn btn-secondary btn-min-width\" (click)=\"previousStep()\" [disabled]=\"selectedIndex === 0\"\r\n type=\"button\">\r\n {{ '_COMMON._STEPPER.PREVIOUS_STEP' | translate }}\r\n </button>\r\n\r\n @if (selectedIndex !== steps.length - 1) {\r\n <button class=\"btn btn-primary btn-min-width\" (click)=\"nextStep()\"\r\n [disabled]=\"!steps.toArray()[selectedIndex]?.completed\" type=\"button\">\r\n {{ '_COMMON._STEPPER.NEXT_STEP' | translate }}\r\n </button>\r\n }\r\n @else {\r\n <button class=\"btn btn-primary btn-min-width\" (click)=\"endWizard()\" type=\"button\">\r\n {{ '_COMMON._ACTION.END' | translate }}\r\n </button>\r\n }\r\n </div>\r\n</div>\r\n" }]
|
|
1844
|
+
}], propDecorators: { steps: [{
|
|
1845
|
+
type: ContentChildren,
|
|
1846
|
+
args: [WizardStepComponent]
|
|
1847
|
+
}], stepChange: [{
|
|
1848
|
+
type: Output
|
|
1849
|
+
}], stepNext: [{
|
|
1850
|
+
type: Output
|
|
1851
|
+
}], stepPrevious: [{
|
|
1852
|
+
type: Output
|
|
1853
|
+
}], stepEnd: [{
|
|
1854
|
+
type: Output
|
|
1855
|
+
}] } });
|
|
1856
|
+
|
|
1857
|
+
class StepperComponent {
|
|
1858
|
+
constructor() {
|
|
1859
|
+
this.activeStep = 0;
|
|
1860
|
+
this.steps = [];
|
|
1861
|
+
this.label = 'Étapes de progression'; // todo trad
|
|
1862
|
+
}
|
|
1863
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: StepperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1864
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: StepperComponent, isStandalone: true, selector: "cw-stepper", inputs: { activeStep: "activeStep", steps: "steps", label: "label" }, ngImport: i0, template: "<ul class=\"stepper\" role=\"list\" [attr.aria-label]=\"label\">\r\n @for (step of steps; track step; let i = $index) {\r\n <li id=\"step-{{i}}\" class=\"stepper-item\" [ngClass]=\"{\r\n 'stepper-item-current': i === activeStep,\r\n 'stepper-item-completed': i < activeStep}\"\r\n [attr.aria-current]=\"i === activeStep ? 'step' : null\">\r\n <span class=\"stepper-label\">\r\n <span class=\"visually-hidden\">{{i + 1}}</span>\r\n {{step | translate}}\r\n </span>\r\n </li>\r\n }\r\n</ul>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
|
|
1865
|
+
}
|
|
1866
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: StepperComponent, decorators: [{
|
|
1867
|
+
type: Component,
|
|
1868
|
+
args: [{ selector: 'cw-stepper', standalone: true, imports: [
|
|
1869
|
+
CommonModule,
|
|
1870
|
+
TranslateModule
|
|
1871
|
+
], template: "<ul class=\"stepper\" role=\"list\" [attr.aria-label]=\"label\">\r\n @for (step of steps; track step; let i = $index) {\r\n <li id=\"step-{{i}}\" class=\"stepper-item\" [ngClass]=\"{\r\n 'stepper-item-current': i === activeStep,\r\n 'stepper-item-completed': i < activeStep}\"\r\n [attr.aria-current]=\"i === activeStep ? 'step' : null\">\r\n <span class=\"stepper-label\">\r\n <span class=\"visually-hidden\">{{i + 1}}</span>\r\n {{step | translate}}\r\n </span>\r\n </li>\r\n }\r\n</ul>\r\n" }]
|
|
1872
|
+
}], propDecorators: { activeStep: [{
|
|
1873
|
+
type: Input
|
|
1874
|
+
}], steps: [{
|
|
1875
|
+
type: Input
|
|
1876
|
+
}], label: [{
|
|
1877
|
+
type: Input
|
|
1878
|
+
}] } });
|
|
1879
|
+
|
|
1880
|
+
const FILE_SIZE_UNITS_FR = ['o', 'Ko', 'Mo', 'Go', 'To', 'Po', 'Eo', 'Zo', 'Yo'];
|
|
1881
|
+
const FILE_SIZE_UNITS_DEFAULT = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
1882
|
+
class FormatFileSizePipe {
|
|
1883
|
+
constructor() {
|
|
1884
|
+
this.translate = inject(TranslateService);
|
|
1885
|
+
}
|
|
1886
|
+
transform(sizeInBytes) {
|
|
1887
|
+
const units = this.translate.currentLang === 'fr' ? FILE_SIZE_UNITS_FR : FILE_SIZE_UNITS_DEFAULT;
|
|
1888
|
+
let power = Math.round(Math.log(sizeInBytes) / Math.log(1024));
|
|
1889
|
+
power = Math.min(power, units.length - 1);
|
|
1890
|
+
const size = sizeInBytes / Math.pow(1024, power); // size in new units
|
|
1891
|
+
const formattedSize = Math.round(size * 10) / 10; // keep up to 1 decimal
|
|
1892
|
+
const unit = units[power];
|
|
1893
|
+
return `${formattedSize} ${unit}`;
|
|
1894
|
+
}
|
|
1895
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: FormatFileSizePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1896
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: FormatFileSizePipe, isStandalone: true, name: "formatFileSize" }); }
|
|
1897
|
+
}
|
|
1898
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: FormatFileSizePipe, decorators: [{
|
|
1899
|
+
type: Pipe,
|
|
1900
|
+
args: [{ name: 'formatFileSize' }]
|
|
1901
|
+
}] });
|
|
1902
|
+
|
|
1903
|
+
class FileToDownloadComponent {
|
|
1904
|
+
constructor() {
|
|
1905
|
+
this.translate = inject(TranslateService);
|
|
1906
|
+
this.iconType = IconTypeEnum;
|
|
1907
|
+
this.iconSize = IconSizeEnum;
|
|
1908
|
+
}
|
|
1909
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: FileToDownloadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1910
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: FileToDownloadComponent, isStandalone: true, selector: "cw-file-to-download", inputs: { attachments: "attachments" }, ngImport: i0, template: "<!-- If one file -->\r\n@if (attachments.length === 1 ) {\r\n<ng-container *ngTemplateOutlet=\"file;context:{attachment:attachments[0]}\"></ng-container>\r\n}\r\n\r\n<!-- If two files or more, li loop -->\r\n@if (attachments.length > 1) {\r\n<ul class=\"list-unstyled file-to-download-items\">\r\n @for (attachment of attachments; track attachment) {\r\n <li class=\"file-to-download-list-item\">\r\n <ng-container *ngTemplateOutlet=\"file;context:{attachment:attachment}\"></ng-container>\r\n </li>\r\n }\r\n</ul>\r\n}\r\n\r\n<ng-template #file let-attachment=\"attachment\">\r\n <a [href]=\"attachment.url\" class=\"file-to-download-link\" target=\"_blank\">\r\n <span class=\"file-to-download-name\">\r\n {{ attachment.label ? attachment.label : ('_SHARED.ATTACHMENT_DEFAULT_LABEL' | translate ) }}\r\n </span>\r\n <span class=\"file-to-download-info\">\r\n @if (attachment.extension && attachment.size) {\r\n {{attachment.extension.toUpperCase()}} {{attachment.size * 1024 | formatFileSize}}\r\n }\r\n <cw-icon icon=\"cw-toolbar-download\" font=\"optyweb\" [label]=\"'_COMMON.NEW_WINDOW' |translate\" [type]=\"iconType.default\"\r\n [iconSize]=\"iconSize['md']\" iconCssClass=\"file-to-download-download\"></cw-icon>\r\n </span>\r\n </a>\r\n</ng-template>\r\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "font", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }, { kind: "pipe", type: FormatFileSizePipe, name: "formatFileSize" }] }); }
|
|
1911
|
+
}
|
|
1912
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: FileToDownloadComponent, decorators: [{
|
|
1913
|
+
type: Component,
|
|
1914
|
+
args: [{ selector: 'cw-file-to-download', imports: [NgTemplateOutlet, TranslatePipe, FormatFileSizePipe, IconComponent], template: "<!-- If one file -->\r\n@if (attachments.length === 1 ) {\r\n<ng-container *ngTemplateOutlet=\"file;context:{attachment:attachments[0]}\"></ng-container>\r\n}\r\n\r\n<!-- If two files or more, li loop -->\r\n@if (attachments.length > 1) {\r\n<ul class=\"list-unstyled file-to-download-items\">\r\n @for (attachment of attachments; track attachment) {\r\n <li class=\"file-to-download-list-item\">\r\n <ng-container *ngTemplateOutlet=\"file;context:{attachment:attachment}\"></ng-container>\r\n </li>\r\n }\r\n</ul>\r\n}\r\n\r\n<ng-template #file let-attachment=\"attachment\">\r\n <a [href]=\"attachment.url\" class=\"file-to-download-link\" target=\"_blank\">\r\n <span class=\"file-to-download-name\">\r\n {{ attachment.label ? attachment.label : ('_SHARED.ATTACHMENT_DEFAULT_LABEL' | translate ) }}\r\n </span>\r\n <span class=\"file-to-download-info\">\r\n @if (attachment.extension && attachment.size) {\r\n {{attachment.extension.toUpperCase()}} {{attachment.size * 1024 | formatFileSize}}\r\n }\r\n <cw-icon icon=\"cw-toolbar-download\" font=\"optyweb\" [label]=\"'_COMMON.NEW_WINDOW' |translate\" [type]=\"iconType.default\"\r\n [iconSize]=\"iconSize['md']\" iconCssClass=\"file-to-download-download\"></cw-icon>\r\n </span>\r\n </a>\r\n</ng-template>\r\n" }]
|
|
1915
|
+
}], propDecorators: { attachments: [{
|
|
1916
|
+
type: Input
|
|
1917
|
+
}] } });
|
|
1918
|
+
|
|
1919
|
+
var NumericalRangeTypeEnum;
|
|
1920
|
+
(function (NumericalRangeTypeEnum) {
|
|
1921
|
+
NumericalRangeTypeEnum["defaultWhite"] = "default-white";
|
|
1922
|
+
NumericalRangeTypeEnum["defaultGrey"] = "default-grey";
|
|
1923
|
+
NumericalRangeTypeEnum["smallWhite"] = "small-white";
|
|
1924
|
+
NumericalRangeTypeEnum["smalltGrey"] = "small-grey";
|
|
1925
|
+
NumericalRangeTypeEnum["largeWhite"] = "large-white";
|
|
1926
|
+
NumericalRangeTypeEnum["largeGrey"] = "large-grey";
|
|
1927
|
+
})(NumericalRangeTypeEnum || (NumericalRangeTypeEnum = {}));
|
|
1928
|
+
var NumericalRangeLabelPositionEnum;
|
|
1929
|
+
(function (NumericalRangeLabelPositionEnum) {
|
|
1930
|
+
NumericalRangeLabelPositionEnum["inside"] = "inside";
|
|
1931
|
+
NumericalRangeLabelPositionEnum["outside"] = "outside";
|
|
1932
|
+
})(NumericalRangeLabelPositionEnum || (NumericalRangeLabelPositionEnum = {}));
|
|
1933
|
+
|
|
1934
|
+
class NumericalRangeComponent {
|
|
1935
|
+
constructor() {
|
|
1936
|
+
this.type = NumericalRangeTypeEnum.defaultGrey;
|
|
1937
|
+
this.label = '';
|
|
1938
|
+
this.amount = 0;
|
|
1939
|
+
this.withLabelVisible = true;
|
|
1940
|
+
this.labelPosition = NumericalRangeLabelPositionEnum.inside;
|
|
1941
|
+
this.ceil = 9;
|
|
1942
|
+
this.floor = 0;
|
|
1943
|
+
this.isDisabled = false;
|
|
1944
|
+
this.autoChangeAmount = true;
|
|
1945
|
+
this.newAmount = new EventEmitter();
|
|
1946
|
+
this.numericalRangeType = NumericalRangeTypeEnum;
|
|
1947
|
+
this.iconTypeEnum = IconTypeEnum;
|
|
1948
|
+
this.iconSize = IconSizeEnum;
|
|
1949
|
+
this.labelPositionValue = NumericalRangeLabelPositionEnum;
|
|
1950
|
+
this.buttonType = FoButtonTypeEnum && BoButtonTypeEnum;
|
|
1951
|
+
this.buttonIconSize = ButtonIconSizeEnum;
|
|
1952
|
+
}
|
|
1953
|
+
ngOnInit() {
|
|
1954
|
+
// this.elementRef.nativeElement.classList.add('dropdown-item');
|
|
1955
|
+
// this.elementRef.nativeElement.setAttribute('tabindex', '0');
|
|
1956
|
+
}
|
|
1957
|
+
increaseAmount() {
|
|
1958
|
+
const amount = this.amount + 1;
|
|
1959
|
+
if (this.autoChangeAmount) {
|
|
1960
|
+
this.amount = amount;
|
|
1961
|
+
}
|
|
1962
|
+
this.newAmount.emit(amount);
|
|
1963
|
+
}
|
|
1964
|
+
decreaseAmount() {
|
|
1965
|
+
const amount = this.amount - 1;
|
|
1966
|
+
if (this.autoChangeAmount) {
|
|
1967
|
+
this.amount = amount;
|
|
1968
|
+
if (this.amount < this.floor) {
|
|
1969
|
+
this.amount = this.floor;
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
this.newAmount.emit(amount);
|
|
1973
|
+
}
|
|
1974
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: NumericalRangeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1975
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: NumericalRangeComponent, isStandalone: true, selector: "cw-numerical-range", inputs: { type: "type", label: "label", amount: "amount", withIcon: "withIcon", withLabelVisible: "withLabelVisible", labelPosition: "labelPosition", ceil: "ceil", floor: "floor", isDisabled: "isDisabled", autoChangeAmount: "autoChangeAmount" }, outputs: { newAmount: "newAmount" }, ngImport: i0, template: "<div class=\"numerical-range text-center\" [ngClass]=\"'numerical-range-' + type\">\r\n @if (labelPosition == labelPositionValue.outside) {\r\n @if (withLabelVisible) {\r\n <div class=\"numerical-range-label\">\r\n @if (withIcon && (type == numericalRangeType.largeWhite || type == numericalRangeType.largeGrey)) {\r\n <cw-icon [icon]=\"withIcon\" [iconSize]=\"iconSize['lg']\"></cw-icon>\r\n }\r\n <span>{{ label }}</span>\r\n </div>\r\n }\r\n }\r\n <div class=\"numerical-range-container\">\r\n\r\n <cw-button [isDisabled]=\"isDisabled || amount <= floor\" label=\"Augmenter la valeur de 1\"\r\n withIcon=\"optyweb cw-toolbar-add\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\" [iconSize]=\"buttonIconSize.small\"\r\n (btnAction)=\"decreaseAmount()\"></cw-button>\r\n\r\n <div class=\"numerical-range-wrapper\">\r\n <div class=\"numerical-range-amount\">\r\n {{ amount }}\r\n </div>\r\n\r\n @if ((type !== numericalRangeType.largeGrey && type !== numericalRangeType.largeWhite) && (withIcon || withLabelVisible)) {\r\n <div class=\"numerical-range-label\">\r\n @if (withLabelVisible && labelPosition == labelPositionValue.inside) {\r\n @if (withIcon) {\r\n <cw-icon [icon]=\"withIcon\" [iconSize]=\"iconSize['lg']\"></cw-icon>\r\n }\r\n <span>{{ label }}</span>\r\n }\r\n @else {\r\n @if (withIcon) {\r\n <cw-icon [icon]=\"withIcon\" [label]=\"label\" [iconSize]=\"iconSize['lg']\"></cw-icon>\r\n }\r\n }\r\n </div>\r\n }\r\n </div>\r\n <cw-button [isDisabled]=\"isDisabled || amount >= ceil\" label=\"Dimiuer la valeur de 1\"\r\n withIcon=\"optyweb cw-toolbar-add\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\" [iconSize]=\"buttonIconSize.small\"\r\n (btnAction)=\"increaseAmount()\"></cw-button>\r\n </div>\r\n\r\n</div>\r\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "font", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom"] }, { kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "id", "isDropdown", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "withSpinner", "cssClass", "dataTest", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }] }); }
|
|
1976
|
+
}
|
|
1977
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: NumericalRangeComponent, decorators: [{
|
|
1978
|
+
type: Component,
|
|
1979
|
+
args: [{ selector: 'cw-numerical-range', imports: [NgClass, IconComponent, ButtonComponent], standalone: true, template: "<div class=\"numerical-range text-center\" [ngClass]=\"'numerical-range-' + type\">\r\n @if (labelPosition == labelPositionValue.outside) {\r\n @if (withLabelVisible) {\r\n <div class=\"numerical-range-label\">\r\n @if (withIcon && (type == numericalRangeType.largeWhite || type == numericalRangeType.largeGrey)) {\r\n <cw-icon [icon]=\"withIcon\" [iconSize]=\"iconSize['lg']\"></cw-icon>\r\n }\r\n <span>{{ label }}</span>\r\n </div>\r\n }\r\n }\r\n <div class=\"numerical-range-container\">\r\n\r\n <cw-button [isDisabled]=\"isDisabled || amount <= floor\" label=\"Augmenter la valeur de 1\"\r\n withIcon=\"optyweb cw-toolbar-add\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\" [iconSize]=\"buttonIconSize.small\"\r\n (btnAction)=\"decreaseAmount()\"></cw-button>\r\n\r\n <div class=\"numerical-range-wrapper\">\r\n <div class=\"numerical-range-amount\">\r\n {{ amount }}\r\n </div>\r\n\r\n @if ((type !== numericalRangeType.largeGrey && type !== numericalRangeType.largeWhite) && (withIcon || withLabelVisible)) {\r\n <div class=\"numerical-range-label\">\r\n @if (withLabelVisible && labelPosition == labelPositionValue.inside) {\r\n @if (withIcon) {\r\n <cw-icon [icon]=\"withIcon\" [iconSize]=\"iconSize['lg']\"></cw-icon>\r\n }\r\n <span>{{ label }}</span>\r\n }\r\n @else {\r\n @if (withIcon) {\r\n <cw-icon [icon]=\"withIcon\" [label]=\"label\" [iconSize]=\"iconSize['lg']\"></cw-icon>\r\n }\r\n }\r\n </div>\r\n }\r\n </div>\r\n <cw-button [isDisabled]=\"isDisabled || amount >= ceil\" label=\"Dimiuer la valeur de 1\"\r\n withIcon=\"optyweb cw-toolbar-add\" [withOnlyIcon]=\"true\" [type]=\"buttonType.primary\" [iconSize]=\"buttonIconSize.small\"\r\n (btnAction)=\"increaseAmount()\"></cw-button>\r\n </div>\r\n\r\n</div>\r\n" }]
|
|
1980
|
+
}], propDecorators: { type: [{
|
|
1981
|
+
type: Input
|
|
1982
|
+
}], label: [{
|
|
1983
|
+
type: Input
|
|
1984
|
+
}], amount: [{
|
|
1985
|
+
type: Input
|
|
1986
|
+
}], withIcon: [{
|
|
1987
|
+
type: Input
|
|
1988
|
+
}], withLabelVisible: [{
|
|
1989
|
+
type: Input
|
|
1990
|
+
}], labelPosition: [{
|
|
1991
|
+
type: Input
|
|
1992
|
+
}], ceil: [{
|
|
1993
|
+
type: Input
|
|
1994
|
+
}], floor: [{
|
|
1995
|
+
type: Input
|
|
1996
|
+
}], isDisabled: [{
|
|
1997
|
+
type: Input
|
|
1998
|
+
}], autoChangeAmount: [{
|
|
1999
|
+
type: Input
|
|
2000
|
+
}], newAmount: [{
|
|
2001
|
+
type: Output
|
|
2002
|
+
}] } });
|
|
2003
|
+
|
|
2004
|
+
class ImageComponent {
|
|
2005
|
+
constructor() {
|
|
2006
|
+
this.source = '';
|
|
2007
|
+
this.alt = '';
|
|
2008
|
+
this.isAriaHidden = false;
|
|
2009
|
+
this.cssClass = '';
|
|
2010
|
+
this.width = '';
|
|
2011
|
+
this.height = '';
|
|
2012
|
+
}
|
|
2013
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ImageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2014
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: ImageComponent, isStandalone: true, selector: "cw-image", inputs: { source: "source", alt: "alt", isAriaHidden: "isAriaHidden", cssClass: "cssClass", width: "width", height: "height" }, ngImport: i0, template: "<img [src]=\"source\" [attr.aria-hidden]=\"isAriaHidden ? 'true' : null\" [class]=\"cssClass\" [alt]=\"alt\"\r\n [attr.width]=\"width ? width : null\" [attr.height]=\"height ? height : null\">\r\n" }); }
|
|
2015
|
+
}
|
|
2016
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ImageComponent, decorators: [{
|
|
2017
|
+
type: Component,
|
|
2018
|
+
args: [{ selector: 'cw-image', standalone: true, template: "<img [src]=\"source\" [attr.aria-hidden]=\"isAriaHidden ? 'true' : null\" [class]=\"cssClass\" [alt]=\"alt\"\r\n [attr.width]=\"width ? width : null\" [attr.height]=\"height ? height : null\">\r\n" }]
|
|
2019
|
+
}], propDecorators: { source: [{
|
|
2020
|
+
type: Input
|
|
2021
|
+
}], alt: [{
|
|
2022
|
+
type: Input
|
|
2023
|
+
}], isAriaHidden: [{
|
|
2024
|
+
type: Input
|
|
2025
|
+
}], cssClass: [{
|
|
2026
|
+
type: Input
|
|
2027
|
+
}], width: [{
|
|
2028
|
+
type: Input
|
|
2029
|
+
}], height: [{
|
|
2030
|
+
type: Input
|
|
2031
|
+
}] } });
|
|
2032
|
+
|
|
2033
|
+
var PlacementEnum;
|
|
2034
|
+
(function (PlacementEnum) {
|
|
2035
|
+
PlacementEnum["Left"] = "left";
|
|
2036
|
+
PlacementEnum["Right"] = "right";
|
|
2037
|
+
})(PlacementEnum || (PlacementEnum = {}));
|
|
2038
|
+
|
|
2039
|
+
class ModalsService {
|
|
2040
|
+
constructor(modalService) {
|
|
2041
|
+
this.modalService = modalService;
|
|
2042
|
+
}
|
|
2043
|
+
openModal(type, config, sizeOverride) {
|
|
2044
|
+
const size = sizeOverride ?? this.getModalSizeByType(type);
|
|
2045
|
+
const modalRef = this.modalService.open(ModalsComponent, {
|
|
2046
|
+
centered: true,
|
|
2047
|
+
size,
|
|
2048
|
+
backdrop: type === ModalsType.loader ? 'static' : true,
|
|
2049
|
+
ariaLabelledBy: 'modal-basic-title',
|
|
2050
|
+
keyboard: type !== ModalsType.loader,
|
|
2051
|
+
windowClass: type === ModalsType.quickSideView ? 'quick-view-modal' : null,
|
|
2052
|
+
scrollable: type === ModalsType.quickSideView
|
|
2053
|
+
});
|
|
2054
|
+
modalRef.componentInstance.type = type;
|
|
2055
|
+
if (config) {
|
|
2056
|
+
Object.assign(modalRef.componentInstance, config);
|
|
2057
|
+
}
|
|
2058
|
+
return modalRef;
|
|
2059
|
+
}
|
|
2060
|
+
getModalSizeByType(type) {
|
|
2061
|
+
switch (type) {
|
|
2062
|
+
case ModalsType.loader:
|
|
2063
|
+
return 'sm';
|
|
2064
|
+
case ModalsType.delete:
|
|
2065
|
+
return 'md';
|
|
2066
|
+
case ModalsType.quickSideView:
|
|
2067
|
+
return 'lg';
|
|
2068
|
+
default:
|
|
2069
|
+
return 'md';
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ModalsService, deps: [{ token: i1$1.NgbModal }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2073
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ModalsService, providedIn: 'root' }); }
|
|
2074
|
+
}
|
|
2075
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ModalsService, decorators: [{
|
|
2076
|
+
type: Injectable,
|
|
2077
|
+
args: [{ providedIn: 'root' }]
|
|
2078
|
+
}], ctorParameters: () => [{ type: i1$1.NgbModal }] });
|
|
2079
|
+
|
|
2080
|
+
/*
|
|
2081
|
+
* Public API Surface of basic-ui
|
|
2082
|
+
*/
|
|
2083
|
+
// LIB UI
|
|
2084
|
+
//---------------------------------------------------------
|
|
2085
|
+
// Lib ui components
|
|
2086
|
+
|
|
2087
|
+
/**
|
|
2088
|
+
* Generated bundle index. Do not edit.
|
|
2089
|
+
*/
|
|
2090
|
+
|
|
2091
|
+
export { AccordionComponent, AlertComponent, AlertTypeEnum, BadgeComponent, BadgePositionEnum, BadgeTypeEnum, BoButtonTypeEnum, BoTabTypeEnum, ButtonComponent, ButtonIconSizeEnum, ButtonPositionEnum, CardComponent, CardTitleRankEnum, CardTypeEnum, ClickOutsideDirective, CollapseDirective, DropdownComponent, DropdownItemDirective, FileToDownloadComponent, FoButtonTypeEnum, FoTabTypeEnum, FocusTrackerService, FormFieldComponent, FormFieldTypeEnum, IconComponent, IconNotifSizeEnum, IconNotifTypeEnum, IconNotificationComponent, IconSizeEnum, IconTypeEnum, IconUiTypeEnum, ImageComponent, LegendComponent, LegendTypeEnum, LoaderComponent, ModalsComponent, ModalsService, ModalsType, NumericalRangeComponent, NumericalRangeLabelPositionEnum, NumericalRangeTypeEnum, PlacementEnum, ResponsiveService, StepperComponent, TabComponent, TabContentComponent, ToastComponent, ToastService, TriggerTooltipEnum, TypeTooltipEnum, WizardStepComponent, WizardStepperComponent, rangeValidator };
|
|
2092
|
+
//# sourceMappingURL=cityway-basic-ui.mjs.map
|