cocori-ng
Version:
Cocori-ng is an Angular full of great components & utilites based on Material
3,615 lines • 311 kB
JavaScript
import * as i0 from '@angular/core';
import { EventEmitter, Component, Output, Input, ChangeDetectionStrategy, Pipe, Inject, Injectable, ViewContainerRef, ViewChild, HostListener, Directive, NgModule, HostBinding, LOCALE_ID, ChangeDetectorRef, ViewEncapsulation } from '@angular/core';
import * as i1$2 from '@angular/forms';
import { UntypedFormControl, UntypedFormArray, ReactiveFormsModule, FormsModule } from '@angular/forms';
import * as i1 from 'cocori-ng/src/feature-core';
import { TypeButtonEnum, HttpService, DatasourceService, ValidatorsService, HelperService, FormInputComponents, ButtonIconPositon, QueryBuilder, WysiwygService, MappingBuilderService, HelperUploaderService, OdataClass, DataSourceType } from 'cocori-ng/src/feature-core';
import * as i2 from '@angular/router';
import { NavigationStart, RouterModule } from '@angular/router';
import { Subject, takeUntil, merge, BehaviorSubject, of, Observable, filter as filter$1, fromEvent } from 'rxjs';
import * as i1$1 from '@angular/common';
import { CommonModule, formatDate } from '@angular/common';
import * as i3 from '@angular/material/icon';
import { MatIconModule } from '@angular/material/icon';
import * as i5 from '@angular/material/button';
import { MatButtonModule } from '@angular/material/button';
import * as i3$2 from '@angular/material/checkbox';
import { MatCheckboxModule } from '@angular/material/checkbox';
import * as i3$1 from '@angular/material/form-field';
import { MatFormFieldModule } from '@angular/material/form-field';
import { filter, map, takeUntil as takeUntil$1, tap, last, catchError, take, debounceTime, switchMap } from 'rxjs/operators';
import * as i1$3 from '@angular/platform-browser';
import * as i5$2 from '@angular/material/core';
import { MAT_DATE_LOCALE } from '@angular/material/core';
import { DateTime } from 'luxon';
import * as i4 from '@angular/material/input';
import { MatInputModule } from '@angular/material/input';
import * as i5$1 from '@angular/material/datepicker';
import { MatDatepickerModule } from '@angular/material/datepicker';
import * as i8 from 'ngx-mask';
import { NgxMaskModule } from 'ngx-mask';
import * as i4$1 from '@angular/material/select';
import { MatSelectModule } from '@angular/material/select';
import * as i3$3 from '@angular/material/slide-toggle';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { HttpEventType } from '@angular/common/http';
import SparkMD5 from 'spark-md5';
import * as i1$4 from '@angular/material/snack-bar';
import { MAT_SNACK_BAR_DATA } from '@angular/material/snack-bar';
import * as i2$1 from '@angular/material/dialog';
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
import * as i6 from '@tinymce/tinymce-angular';
import { EditorModule } from '@tinymce/tinymce-angular';
import * as i4$2 from '@angular/cdk/drag-drop';
import { DragDropModule, moveItemInArray } from '@angular/cdk/drag-drop';
import * as i2$2 from '@angular/material/bottom-sheet';
import { MAT_BOTTOM_SHEET_DATA, MatBottomSheetModule } from '@angular/material/bottom-sheet';
import * as i1$5 from '@angular/material/list';
import { MatListModule } from '@angular/material/list';
import { MatMenuModule } from '@angular/material/menu';
import * as i7 from '@angular/material/progress-bar';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import * as i6$1 from '@angular/material/sidenav';
import { MatSidenavModule } from '@angular/material/sidenav';
const DefaultConfigComponent = {
form: {
keyId: "formId",
appearance: 'outline',
styleCompact: false
},
button: {
text: "Valider"
},
date: {
dateTimeSeparator: ' à '
},
upload: {
chunkSize: 2 * 1048576
},
wysiwyg: {
plugins: [
'quickbars',
'advlist',
'autolink',
'lists',
'link',
'image',
'media',
'imagetools',
'emoticons',
'preview',
'searchreplace',
'media',
'table',
'paste',
'code',
'help',
],
toolbar: 'undo redo | bullist | imageoptions | quicklink | outdent | indent | emoticons',
quickbarsInsert: 'bullist numlist | imageoptions media | quicklink | quicktable | emoticons'
}
};
const ConfigEvents = {
FORM_SUBMITTED: "FORM_SUBMITTED",
CMS_RESPONSIVE_ORIENTATION_CHANGED: "CMS_RESPONSIVE_ORIENTATION_CHANGED",
};
class CocoringButtonComponent {
constructor(loadingService, cdr) {
this.loadingService = loadingService;
this.cdr = cdr;
this.callback = new EventEmitter();
this.click = new EventEmitter();
this.disabled = false;
this.type = TypeButtonEnum.SUBMIT;
this.class = 'primary';
this.isLoading = false;
this.destroy$ = new Subject();
}
set config(config) {
if (!config)
return;
this.text = config.text;
this.icon = config.icon;
this.class = config.className || this.class;
this.iconPosition = config.iconPosition;
this.type = config.type;
this.onClickSubmit = config.onClickSubmit;
}
ngOnInit() {
this.loadingService.subject.pipe(takeUntil(this.destroy$)).subscribe((isLoading) => {
this.isLoading = isLoading;
this.cdr.detectChanges();
});
this.callback.emit(this.text);
}
ngOnDestroy() {
this.destroy$.next(undefined);
this.destroy$.complete();
}
onClick() {
if (this.type === TypeButtonEnum.SUBMIT && this.onClickSubmit) {
this.onClickSubmit();
}
else if (this.type === TypeButtonEnum.BUTTON && this.onClickSubmit) {
this.click.emit();
}
}
}
CocoringButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringButtonComponent, deps: [{ token: i1.LoadingService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
CocoringButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringButtonComponent, selector: "cocoring-button", inputs: { disabled: "disabled", text: "text", type: "type", class: "class", config: "config" }, outputs: { callback: "callback", click: "click" }, ngImport: i0, template: "<button class=\"btn\" mat-raised-button [ngClass]=\"class\" [class.spinner]=\"isLoading\" type=\"{{type}}\"\r\n [disabled]=\"isLoading || disabled\" (click)=\"onClick()\">\r\n <mat-icon *ngIf=\"icon && iconPosition === 'start' \">{{icon}}</mat-icon>\r\n {{text}}\r\n <ng-content></ng-content>\r\n <mat-icon *ngIf=\"icon && iconPosition === 'end'\">{{icon}}</mat-icon>\r\n</button>", styles: [""], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringButtonComponent, decorators: [{
type: Component,
args: [{ selector: 'cocoring-button', template: "<button class=\"btn\" mat-raised-button [ngClass]=\"class\" [class.spinner]=\"isLoading\" type=\"{{type}}\"\r\n [disabled]=\"isLoading || disabled\" (click)=\"onClick()\">\r\n <mat-icon *ngIf=\"icon && iconPosition === 'start' \">{{icon}}</mat-icon>\r\n {{text}}\r\n <ng-content></ng-content>\r\n <mat-icon *ngIf=\"icon && iconPosition === 'end'\">{{icon}}</mat-icon>\r\n</button>" }]
}], ctorParameters: function () { return [{ type: i1.LoadingService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { callback: [{
type: Output
}], click: [{
type: Output
}], disabled: [{
type: Input
}], text: [{
type: Input
}], type: [{
type: Input
}], class: [{
type: Input
}], config: [{
type: Input
}] } });
class CocoringButtonLinkComponent {
/** Mettre les bons Inputs de base comme ceux utilisé dans le projet atlantX */
constructor() {
this.url = '/bo/home';
this.openNewTab = false;
}
set config(config) {
if (!config)
return;
config.type = TypeButtonEnum.BUTTON;
this.url = config.url;
this.openNewTab = config.openNewTab || false;
this.btnConfig = config;
}
ngOnInit() { }
ngOnDestroy() { }
}
CocoringButtonLinkComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringButtonLinkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
CocoringButtonLinkComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringButtonLinkComponent, selector: "cocoring-button-link", inputs: { config: "config" }, ngImport: i0, template: "<a [routerLink]=\"url ? url : null\" target=\"{{openNewTab ? '_blank' : '_self'}}\">\r\n <cocoring-button [config]=\"btnConfig\"></cocoring-button>\r\n</a>", styles: [""], dependencies: [{ kind: "directive", type: i2.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { kind: "component", type: CocoringButtonComponent, selector: "cocoring-button", inputs: ["disabled", "text", "type", "class", "config"], outputs: ["callback", "click"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringButtonLinkComponent, decorators: [{
type: Component,
args: [{ selector: 'cocoring-button-link', template: "<a [routerLink]=\"url ? url : null\" target=\"{{openNewTab ? '_blank' : '_self'}}\">\r\n <cocoring-button [config]=\"btnConfig\"></cocoring-button>\r\n</a>" }]
}], ctorParameters: function () { return []; }, propDecorators: { config: [{
type: Input
}] } });
class ExtendInputsComponent {
constructor(injector) {
this.color = 'primary'; /** à factoriser dans le helper pour la construction de form */
/** méthode appelée lorsque que le contrôle a été ajouté au formulaire avec en paramètre le nom du contrôle créé */
this.callback = new EventEmitter();
this.destroy$ = new Subject();
this.httpService = injector.get(HttpService);
this.datasourceService = injector.get(DatasourceService);
}
ngOnDestroy() {
this.destroy$.next(undefined);
this.destroy$.complete();
}
configInput(config) {
this.nameLabel = config.nameLabel;
this.nameControl = config.nameControl;
this.formGroup = config.formGroup;
this.styleCompact = config.styleCompact;
this.maxlength = config.maxlength;
this.icon = config.icon;
this.appearance = config.appearance;
this.dataSource$ = this.loadDataSource(config.dataSource);
this.inRelationWith = config.inRelationWith;
this.validators = config.validators;
this.callbackComponent = config.callbackComponent;
this.nameLabel += this.isControlRequired() ? ' *' : '';
}
emitEvent() {
if (!this.formGroup || !this.nameControl) {
throw new Error(`Données formulaire manquantes, formGroup : ${this.formGroup} - nameControl : ${this.nameControl}`);
}
this.inRelatioNWith();
if (this.callbackComponent) {
this.callbackComponent.callback(this.nameControl);
}
else {
this.callback.emit(this.nameControl);
}
}
clearValue(event) {
this.formGroup.get(this.nameControl).reset();
this.formGroup.get(this.nameControl).markAsUntouched();
if (event)
event.stopPropagation();
}
addControlForm() {
if (this.controlAlreadyAdded())
return;
this.formGroup.addControl(this.nameControl, new UntypedFormControl(null, this.validators));
this.emitEvent();
}
addArrayForm() {
if (this.controlAlreadyAdded())
return;
this.formGroup.addControl(this.nameControl, new UntypedFormArray([], this.validators));
this.emitEvent();
}
controlAlreadyAdded() {
return this.formGroup.contains(this.nameControl);
}
loadDataSource(configDataSource) {
if (!configDataSource)
return;
this.dataSourceNameProperty = configDataSource.dataSourceNameProperty || 'name';
return this.datasourceService.loadDataSource(configDataSource);
}
inRelatioNWith() {
if (this.inRelationWith && typeof this.inRelationWith !== 'undefined') {
console.log("inRelationWith>>", this.inRelationWith, this.formGroup);
this.formGroup.get(this.inRelationWith).valueChanges.pipe(takeUntil(this.destroy$)).subscribe((parentValue) => {
console.log("Parent Value ", parentValue);
});
}
}
isControlRequired() {
if (!this.validators)
return;
const d = this.validators.find((validatorFn) => validatorFn.name === ValidatorsService.require.name);
return typeof d === 'undefined' ? false : true;
}
}
ExtendInputsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: ExtendInputsComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
ExtendInputsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: ExtendInputsComponent, selector: "extend-inputs", inputs: { formGroup: "formGroup", nameControl: "nameControl", nameLabel: "nameLabel", color: "color" }, outputs: { callback: "callback" }, host: { classAttribute: "input-form" }, ngImport: i0, template: '', isInline: true });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: ExtendInputsComponent, decorators: [{
type: Component,
args: [{
selector: 'extend-inputs',
template: '',
host: { 'class': 'input-form' }
}]
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { formGroup: [{
type: Input
}], nameControl: [{
type: Input
}], nameLabel: [{
type: Input
}], color: [{
type: Input
}], callback: [{
type: Output
}] } });
class CocoringInputErrorComponent {
constructor(broadcastEventService, validatorsService) {
this.broadcastEventService = broadcastEventService;
this.validatorsService = validatorsService;
}
ngOnInit() {
if (!this.form.get(DefaultConfigComponent.form.keyId))
return;
this.formId = this.form.get(DefaultConfigComponent.form.keyId).value;
const onSubmitObs = this.broadcastEventService.listen([ConfigEvents.FORM_SUBMITTED, this.formId]);
const valueChangesObs = this.form.get(this.controlName).valueChanges;
this.mergeObservables(onSubmitObs, valueChangesObs);
}
ngOnDestroy() { }
mergeObservables(onSubmitObs, valueChangesObs) {
this.errorMessage$ = merge(onSubmitObs, valueChangesObs)
.pipe(filter((value) => this.form.get(this.controlName).errors !== null), map((value) => this.form.get(this.controlName).errors), map((formError) => {
const errorKey = Object.keys(formError)[0];
/** pour déclencher l'erreur angular material */
this.form.get(this.controlName).markAsTouched();
return this.validatorsService.getValidationErrorMessage({ key: errorKey, value: formError[errorKey] });
}));
}
}
CocoringInputErrorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringInputErrorComponent, deps: [{ token: i1.BroadcastEventService }, { token: i1.ValidatorsService }], target: i0.ɵɵFactoryTarget.Component });
CocoringInputErrorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringInputErrorComponent, selector: "[error-handler]", inputs: { form: "form", controlName: "controlName" }, ngImport: i0, template: `
<ng-container *ngIf="(errorMessage$ | async) as errorMessage">
<mat-error>{{errorMessage}}</mat-error>
</ng-container>
`, isInline: true, styles: [".error{position:absolute;margin-left:8px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringInputErrorComponent, decorators: [{
type: Component,
args: [{ selector: '[error-handler]', template: `
<ng-container *ngIf="(errorMessage$ | async) as errorMessage">
<mat-error>{{errorMessage}}</mat-error>
</ng-container>
`, styles: [".error{position:absolute;margin-left:8px}\n"] }]
}], ctorParameters: function () { return [{ type: i1.BroadcastEventService }, { type: i1.ValidatorsService }]; }, propDecorators: { form: [{
type: Input
}], controlName: [{
type: Input
}] } });
class CocoringCheckboxIndeterminateComponent extends ExtendInputsComponent {
constructor(fb, cdr, injector) {
super(injector);
this.fb = fb;
this.cdr = cdr;
this.nestedNameForm = 'nestedValues';
this.someComplete = false;
}
set config(config) {
this.configInput(config);
this.addControlForm();
this.dataSource$.pipe(takeUntil(this.destroy$)).subscribe((datasource) => {
this.addNestedForm(datasource);
});
}
addNestedForm(datasource) {
if (!datasource.length)
return;
const nestedFrom = this.fb.group({});
datasource.forEach((datas) => {
nestedFrom.addControl(datas.id, new UntypedFormControl(false));
});
this.formGroup.addControl(this.nestedNameForm, nestedFrom);
this.formChangeEvent();
this.nestedFormChangeEvent();
}
formChangeEvent() {
this.formGroup.get(this.nameControl).valueChanges.pipe(takeUntil(this.destroy$)).subscribe((value) => {
this.setValueControls(value);
});
}
setValueControls(value) {
Object.keys(this.nestedForm['controls']).forEach(key => {
this.nestedForm['controls'][key].setValue(value, { emitEvent: false });
});
}
nestedFormChangeEvent() {
// const nestedFormPropertiesLength: number = this.formHelperService.countControlsForm(this.nestedForm)
const nestedFormPropertiesLength = 3;
this.nestedForm.valueChanges.pipe(takeUntil(this.destroy$)).subscribe((values) => {
const completed = Object.entries(values).filter(([key, value]) => value === true);
if (completed.length === nestedFormPropertiesLength) {
this.formGroup.get(this.nameControl).setValue(true, { emitEvent: false });
setTimeout(() => {
this.someComplete = false;
this.cdr.detectChanges();
});
}
else if (completed.length > 0 && completed.length < nestedFormPropertiesLength) {
this.formGroup.get(this.nameControl).setValue(false, { emitEvent: false });
setTimeout(() => {
this.someComplete = true;
this.cdr.detectChanges();
});
}
else {
this.someComplete = false;
this.formGroup.get(this.nameControl).setValue(false, { emitEvent: false });
}
});
}
get nestedForm() {
return this.formGroup.get(this.nestedNameForm);
}
}
CocoringCheckboxIndeterminateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringCheckboxIndeterminateComponent, deps: [{ token: i1$2.UntypedFormBuilder }, { token: i0.ChangeDetectorRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
CocoringCheckboxIndeterminateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringCheckboxIndeterminateComponent, selector: "cocoring-checkbox-indeterminate", inputs: { config: "config" }, usesInheritance: true, ngImport: i0, template: "<ng-container [formGroup]=\"formGroup\">\r\n <mat-checkbox\r\n class=\"optionSelectAll\"\r\n [formControlName]=\"nameControl\" \r\n [indeterminate]=\"someComplete\"\r\n color=\"primary\"\r\n (click)=\"$event.stopPropagation()\">\r\n {{nameLabel}}\r\n </mat-checkbox>\r\n\r\n <ng-container [formGroupName]=\"nestedNameForm\">\r\n <mat-checkbox *ngFor=\"let item of (dataSource$ | async)\" \r\n [formControlName]=\"item.id\"\r\n color=\"primary\">\r\n {{item[dataSourceNameProperty]}}\r\n </mat-checkbox>\r\n </ng-container>\r\n\r\n <mat-error error-handler [form]=\"formGroup\" [controlName]=\"nameControl\"></mat-error>\r\n</ng-container>", styles: [".align-center{text-align:center}.align-left{text-align:left}.align-right{text-align:right}.noselect{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}.stickyPosition{-webkit-position:sticky;-moz-position:sticky;-ms-position:sticky;-o-position:sticky;position:sticky;z-index:1001;top:0px}@media (min-width: 601px){.hide-scroll{scrollbar-color:white white}.hide-scroll::-webkit-scrollbar{background-color:transparent;height:13px}.hide-scroll::-webkit-scrollbar-thumb{background-color:transparent}.hide-scroll:hover{scrollbar-color:#d9d9d9 white}.hide-scroll:hover::-webkit-scrollbar-thumb{border-radius:3px;background-color:#d9d9d9}}.m-t-0{margin-top:0}.m-t-5{margin-top:5px}.m-t-10{margin-top:10px}.m-t-15{margin-top:15px}.m-t-20{margin-top:20px}.m-t-25{margin-top:25px}.m-t-30{margin-top:30px}.m-t-35{margin-top:35px}.m-t-40{margin-top:40px}.m-t-45{margin-top:45px}.m-t-50{margin-top:50px}.m-r-0{margin-right:0}.m-r-5{margin-right:5px}.m-r-10{margin-right:10px}.m-r-15{margin-right:15px}.m-r-20{margin-right:20px}.m-r-25{margin-right:25px}.m-r-30{margin-right:30px}.m-r-35{margin-right:35px}.m-r-40{margin-right:40px}.m-r-45{margin-right:45px}.m-r-50{margin-right:50px}.m-b-0{margin-bottom:0}.m-b-5{margin-bottom:5px}.m-b-10{margin-bottom:10px}.m-b-15{margin-bottom:15px}.m-b-20{margin-bottom:20px}.m-b-25{margin-bottom:25px}.m-b-30{margin-bottom:30px}.m-b-35{margin-bottom:35px}.m-b-40{margin-bottom:40px}.m-b-45{margin-bottom:45px}.m-b-50{margin-bottom:50px}.m-l-0{margin-left:0}.m-l-5{margin-left:5px}.m-l-10{margin-left:10px}.m-l-15{margin-left:15px}.m-l-20{margin-left:20px}.m-l-25{margin-left:25px}.m-l-30{margin-left:30px}.m-l-35{margin-left:35px}.m-l-40{margin-left:40px}.m-l-45{margin-left:45px}.m-l-50{margin-left:50px}.m-x-0{margin:0}.m-x-5{margin:5px}.m-x-10{margin:10px}.m-x-15{margin:15px}.m-x-20{margin:20px}.m-x-25{margin:25px}.m-x-30{margin:30px}.m-x-35{margin:35px}.m-x-40{margin:40px}.m-x-45{margin:45px}.m-x-50{margin:50px}.p-t-0{padding-top:0}.p-t-5{padding-top:5px}.p-t-10{padding-top:10px}.p-t-15{padding-top:15px}.p-t-20{padding-top:20px}.p-t-25{padding-top:25px}.p-t-30{padding-top:30px}.p-t-35{padding-top:35px}.p-t-40{padding-top:40px}.p-t-45{padding-top:45px}.p-t-50{padding-top:50px}.p-r-0{padding-right:0}.p-r-5{padding-right:5px}.p-r-10{padding-right:10px}.p-r-15{padding-right:15px}.p-r-20{padding-right:20px}.p-r-25{padding-right:25px}.p-r-30{padding-right:30px}.p-r-35{padding-right:35px}.p-r-40{padding-right:40px}.p-r-45{padding-right:45px}.p-r-50{padding-right:50px}.p-b-0{padding-bottom:0}.p-b-5{padding-bottom:5px}.p-b-10{padding-bottom:10px}.p-b-15{padding-bottom:15px}.p-b-20{padding-bottom:20px}.p-b-25{padding-bottom:25px}.p-b-30{padding-bottom:30px}.p-b-35{padding-bottom:35px}.p-b-40{padding-bottom:40px}.p-b-45{padding-bottom:45px}.p-b-50{padding-bottom:50px}.p-l-0{padding-left:0}.p-l-5{padding-left:5px}.p-l-10{padding-left:10px}.p-l-15{padding-left:15px}.p-l-20{padding-left:20px}.p-l-25{padding-left:25px}.p-l-30{padding-left:30px}.p-l-35{padding-left:35px}.p-l-40{padding-left:40px}.p-l-45{padding-left:45px}.p-l-50{padding-left:50px}.p-x-0{padding:0}.p-x-5{padding:5px}.p-x-10{padding:10px}.p-x-15{padding:15px}.p-x-20{padding:20px}.p-x-25{padding:25px}.p-x-30{padding:30px}.p-x-35{padding:35px}.p-x-40{padding:40px}.p-x-45{padding:45px}.p-x-50{padding:50px}.mat-form-field{width:100%}.mat-calendar-body-selected{color:#fff!important}.mat-form-field-appearance-standard.mat-form-field-has-label .mat-select:not(.mat-select-empty) .mat-select-arrow-wrapper{transform:translateY(-17%)!important}.mat-checkbox-label{margin-left:5px}:host{display:block;flex-direction:column;display:flex}.optionSelectAll{position:relative;margin-bottom:10px}.optionSelectAll:before{content:\"\";position:absolute;left:0;bottom:0;height:1px;width:50%;border-bottom:1px solid yellow}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1$2.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "component", type: i3$2.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "directive", type: i3$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: CocoringInputErrorComponent, selector: "[error-handler]", inputs: ["form", "controlName"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringCheckboxIndeterminateComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cocoring-checkbox-indeterminate', template: "<ng-container [formGroup]=\"formGroup\">\r\n <mat-checkbox\r\n class=\"optionSelectAll\"\r\n [formControlName]=\"nameControl\" \r\n [indeterminate]=\"someComplete\"\r\n color=\"primary\"\r\n (click)=\"$event.stopPropagation()\">\r\n {{nameLabel}}\r\n </mat-checkbox>\r\n\r\n <ng-container [formGroupName]=\"nestedNameForm\">\r\n <mat-checkbox *ngFor=\"let item of (dataSource$ | async)\" \r\n [formControlName]=\"item.id\"\r\n color=\"primary\">\r\n {{item[dataSourceNameProperty]}}\r\n </mat-checkbox>\r\n </ng-container>\r\n\r\n <mat-error error-handler [form]=\"formGroup\" [controlName]=\"nameControl\"></mat-error>\r\n</ng-container>", styles: [".align-center{text-align:center}.align-left{text-align:left}.align-right{text-align:right}.noselect{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}.stickyPosition{-webkit-position:sticky;-moz-position:sticky;-ms-position:sticky;-o-position:sticky;position:sticky;z-index:1001;top:0px}@media (min-width: 601px){.hide-scroll{scrollbar-color:white white}.hide-scroll::-webkit-scrollbar{background-color:transparent;height:13px}.hide-scroll::-webkit-scrollbar-thumb{background-color:transparent}.hide-scroll:hover{scrollbar-color:#d9d9d9 white}.hide-scroll:hover::-webkit-scrollbar-thumb{border-radius:3px;background-color:#d9d9d9}}.m-t-0{margin-top:0}.m-t-5{margin-top:5px}.m-t-10{margin-top:10px}.m-t-15{margin-top:15px}.m-t-20{margin-top:20px}.m-t-25{margin-top:25px}.m-t-30{margin-top:30px}.m-t-35{margin-top:35px}.m-t-40{margin-top:40px}.m-t-45{margin-top:45px}.m-t-50{margin-top:50px}.m-r-0{margin-right:0}.m-r-5{margin-right:5px}.m-r-10{margin-right:10px}.m-r-15{margin-right:15px}.m-r-20{margin-right:20px}.m-r-25{margin-right:25px}.m-r-30{margin-right:30px}.m-r-35{margin-right:35px}.m-r-40{margin-right:40px}.m-r-45{margin-right:45px}.m-r-50{margin-right:50px}.m-b-0{margin-bottom:0}.m-b-5{margin-bottom:5px}.m-b-10{margin-bottom:10px}.m-b-15{margin-bottom:15px}.m-b-20{margin-bottom:20px}.m-b-25{margin-bottom:25px}.m-b-30{margin-bottom:30px}.m-b-35{margin-bottom:35px}.m-b-40{margin-bottom:40px}.m-b-45{margin-bottom:45px}.m-b-50{margin-bottom:50px}.m-l-0{margin-left:0}.m-l-5{margin-left:5px}.m-l-10{margin-left:10px}.m-l-15{margin-left:15px}.m-l-20{margin-left:20px}.m-l-25{margin-left:25px}.m-l-30{margin-left:30px}.m-l-35{margin-left:35px}.m-l-40{margin-left:40px}.m-l-45{margin-left:45px}.m-l-50{margin-left:50px}.m-x-0{margin:0}.m-x-5{margin:5px}.m-x-10{margin:10px}.m-x-15{margin:15px}.m-x-20{margin:20px}.m-x-25{margin:25px}.m-x-30{margin:30px}.m-x-35{margin:35px}.m-x-40{margin:40px}.m-x-45{margin:45px}.m-x-50{margin:50px}.p-t-0{padding-top:0}.p-t-5{padding-top:5px}.p-t-10{padding-top:10px}.p-t-15{padding-top:15px}.p-t-20{padding-top:20px}.p-t-25{padding-top:25px}.p-t-30{padding-top:30px}.p-t-35{padding-top:35px}.p-t-40{padding-top:40px}.p-t-45{padding-top:45px}.p-t-50{padding-top:50px}.p-r-0{padding-right:0}.p-r-5{padding-right:5px}.p-r-10{padding-right:10px}.p-r-15{padding-right:15px}.p-r-20{padding-right:20px}.p-r-25{padding-right:25px}.p-r-30{padding-right:30px}.p-r-35{padding-right:35px}.p-r-40{padding-right:40px}.p-r-45{padding-right:45px}.p-r-50{padding-right:50px}.p-b-0{padding-bottom:0}.p-b-5{padding-bottom:5px}.p-b-10{padding-bottom:10px}.p-b-15{padding-bottom:15px}.p-b-20{padding-bottom:20px}.p-b-25{padding-bottom:25px}.p-b-30{padding-bottom:30px}.p-b-35{padding-bottom:35px}.p-b-40{padding-bottom:40px}.p-b-45{padding-bottom:45px}.p-b-50{padding-bottom:50px}.p-l-0{padding-left:0}.p-l-5{padding-left:5px}.p-l-10{padding-left:10px}.p-l-15{padding-left:15px}.p-l-20{padding-left:20px}.p-l-25{padding-left:25px}.p-l-30{padding-left:30px}.p-l-35{padding-left:35px}.p-l-40{padding-left:40px}.p-l-45{padding-left:45px}.p-l-50{padding-left:50px}.p-x-0{padding:0}.p-x-5{padding:5px}.p-x-10{padding:10px}.p-x-15{padding:15px}.p-x-20{padding:20px}.p-x-25{padding:25px}.p-x-30{padding:30px}.p-x-35{padding:35px}.p-x-40{padding:40px}.p-x-45{padding:45px}.p-x-50{padding:50px}.mat-form-field{width:100%}.mat-calendar-body-selected{color:#fff!important}.mat-form-field-appearance-standard.mat-form-field-has-label .mat-select:not(.mat-select-empty) .mat-select-arrow-wrapper{transform:translateY(-17%)!important}.mat-checkbox-label{margin-left:5px}:host{display:block;flex-direction:column;display:flex}.optionSelectAll{position:relative;margin-bottom:10px}.optionSelectAll:before{content:\"\";position:absolute;left:0;bottom:0;height:1px;width:50%;border-bottom:1px solid yellow}\n"] }]
}], ctorParameters: function () { return [{ type: i1$2.UntypedFormBuilder }, { type: i0.ChangeDetectorRef }, { type: i0.Injector }]; }, propDecorators: { config: [{
type: Input
}] } });
class CocoringVariableHtmlPipe {
constructor(sanitizer) {
this.sanitizer = sanitizer;
}
transform(texteHtml) {
if (!texteHtml)
return '';
return this.sanitizer.bypassSecurityTrustHtml(texteHtml);
}
}
CocoringVariableHtmlPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringVariableHtmlPipe, deps: [{ token: i1$3.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
CocoringVariableHtmlPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringVariableHtmlPipe, name: "variableHtml", pure: false });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringVariableHtmlPipe, decorators: [{
type: Pipe,
args: [{
name: 'variableHtml',
pure: false
}]
}], ctorParameters: function () { return [{ type: i1$3.DomSanitizer }]; } });
class CocoringCheckboxComponent extends ExtendInputsComponent {
constructor(injector) {
super(injector);
}
set config(config) {
this.configInput(config);
this.addControlForm();
}
ngOnInit() { }
}
CocoringCheckboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringCheckboxComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
CocoringCheckboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringCheckboxComponent, selector: "cocoring-checkbox", inputs: { config: "config" }, usesInheritance: true, ngImport: i0, template: "<ng-container [formGroup]=\"formGroup\">\r\n <mat-checkbox (click)=\"$event.stopPropagation()\" [formControlName]=\"nameControl\" [color]=\"color\">\r\n <div [innerHtml]=\"nameLabel | variableHtml\"></div>\r\n </mat-checkbox>\r\n <mat-error error-handler [form]=\"formGroup\" [controlName]=\"nameControl\"></mat-error>\r\n</ng-container>", dependencies: [{ kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i3$2.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "directive", type: i3$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: CocoringInputErrorComponent, selector: "[error-handler]", inputs: ["form", "controlName"] }, { kind: "pipe", type: CocoringVariableHtmlPipe, name: "variableHtml" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringCheckboxComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cocoring-checkbox', template: "<ng-container [formGroup]=\"formGroup\">\r\n <mat-checkbox (click)=\"$event.stopPropagation()\" [formControlName]=\"nameControl\" [color]=\"color\">\r\n <div [innerHtml]=\"nameLabel | variableHtml\"></div>\r\n </mat-checkbox>\r\n <mat-error error-handler [form]=\"formGroup\" [controlName]=\"nameControl\"></mat-error>\r\n</ng-container>" }]
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { config: [{
type: Input
}] } });
class InputIconComponent {
constructor() {
this.clickEvent = new EventEmitter();
}
ngOnInit() {
}
emitClickEvent() {
this.clickEvent.emit(true);
}
}
InputIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: InputIconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
InputIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: InputIconComponent, selector: "input-icon", inputs: { icon: "icon" }, outputs: { clickEvent: "clickEvent" }, ngImport: i0, template: "<button type=\"button\" tabindex=\"-1\" *ngIf=\"icon\" (click)=\"emitClickEvent()\" mat-icon-button aria-label=\"Icone dans le champ de saisi\">\r\n <mat-icon>\r\n {{icon}}\r\n </mat-icon>\r\n</button>", styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: InputIconComponent, decorators: [{
type: Component,
args: [{ selector: 'input-icon', template: "<button type=\"button\" tabindex=\"-1\" *ngIf=\"icon\" (click)=\"emitClickEvent()\" mat-icon-button aria-label=\"Icone dans le champ de saisi\">\r\n <mat-icon>\r\n {{icon}}\r\n </mat-icon>\r\n</button>", styles: [":host{display:block}\n"] }]
}], ctorParameters: function () { return []; }, propDecorators: { icon: [{
type: Input
}], clickEvent: [{
type: Output
}] } });
class CocoringDateComponent extends ExtendInputsComponent {
constructor(locale, cdr, injector) {
super(injector);
this.locale = locale;
this.cdr = cdr;
// dateMask: any = { guide: false, showMask : false, mask: [/\d/, /\d/, '/', /\d/, /\d/, '/', /\d/, /\d/, /\d/, /\d/], placeholderChar: '\u2000' };
this.maskInputControlName = null;
}
set config(config) {
config.validators.push(ValidatorsService.dateValidator);
this.configInput(config);
this.addControlForm();
this.maskInputControlName = `m${this.nameControl}`;
/** le masque de saisie ne fonctionne pas avec le composant de material datepicker */
this.addDateMaskControl();
this.valueChangeEvent();
}
ngOnInit() { }
/** Value from datepicker changed event */
valueChangeEvent() {
this.formGroup.get(this.nameControl).valueChanges.pipe(takeUntil(this.destroy$)).subscribe((val) => {
let d = null;
if (!val)
return;
if (typeof val.getMonth === 'function' || typeof val === 'string') {
d = DateTime.fromJSDate(new Date(val)).setLocale(this.locale).toLocaleString(); // sous la forme de 21/12/2021
}
else if (val.hasOwnProperty("isLuxonDateTime")) {
d = DateTime.fromISO(val).setLocale(this.locale).toLocaleString(); // sous la forme de 21/12/2021
}
if (d) {
this.formGroup.get(this.maskInputControlName).setValue(HelperService.replaceAll(d, '/', ''));
setTimeout(() => {
this.cdr.detectChanges();
});
}
});
}
maskInputChangeEvent() {
this.formGroup.get(this.maskInputControlName).valueChanges.pipe(takeUntil(this.destroy$)).subscribe((dateInput) => {
this.dispatchValueInput(dateInput);
});
}
dispatchValueInput(dateInput) {
if (dateInput && dateInput.length === 8) {
const day = dateInput.substring(0, 2);
const month = dateInput.substring(2, 4);
const year = dateInput.substring(4);
const dateFormated = DateTime.fromISO(year + month + day);
if (dateFormated.isValid) {
this.formGroup.get(this.nameControl).setValue(DateTime.fromISO(year + month + day), { emitEvent: false });
}
else
this.clearDateMaskValue();
}
else {
this.clearValue();
}
}
onBlur() {
const dateInput = this.formGroup.get(this.maskInputControlName).value;
if (!dateInput || dateInput.length !== 8) {
this.clearDateMaskValue();
}
}
addDateMaskControl() {
this.formGroup.addControl(this.maskInputControlName, new UntypedFormControl(null, this.validators));
this.maskInputChangeEvent();
this.emitEvent();
}
clearDateMaskValue(event) {
this.formGroup.get(this.maskInputControlName).reset();
this.formGroup.get(this.maskInputControlName).markAsUntouched();
this.clearValue(event);
if (event)
event.stopPropagation();
}
}
CocoringDateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDateComponent, deps: [{ token: MAT_DATE_LOCALE }, { token: i0.ChangeDetectorRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
CocoringDateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringDateComponent, selector: "cocoring-date", inputs: { config: "config" }, usesInheritance: true, ngImport: i0, template: "<ng-container [formGroup]=\"formGroup\">\r\n <mat-form-field [appearance]=\"appearance\" [ngClass]=\"{'mat-form-compact': styleCompact}\">\r\n <mat-label>{{nameLabel}}</mat-label>\r\n <!-- <input matInput [matDatepicker]=\"picker\" [formControlName]=\"nameControl\"> -->\r\n <input [attr.data-cy]=\"nameControl\" matInput type=\"text\" mask=\"d0/M0/0000\" [leadZeroDateTime]=\"true\" [formControlName]=\"maskInputControlName\" (blur)=\"onBlur()\"/>\r\n <input [matDatepicker]=\"picker\" [formControlName]=\"nameControl\">\r\n <div matSuffix style=\"display:flex\">\r\n <mat-datepicker-toggle tabindex=\"-1\" matSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n <input-icon icon=\"close\" *ngIf=\"formGroup.get(maskInputControlName).value\" (click)=\"clearDateMaskValue($event)\"></input-icon>\r\n </div>\r\n <mat-datepicker #picker></mat-datepicker>\r\n <mat-error error-handler [form]=\"formGroup\" [controlName]=\"maskInputControlName\"></mat-error>\r\n </mat-form-field>\r\n</ng-container>", styles: [":host{display:block}.mat-datepicker-input{display:none}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3$1.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i5$1.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i5$1.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i5$1.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: CocoringInputErrorComponent, selector: "[error-handler]", inputs: ["form", "controlName"] }, { kind: "component", type: InputIconComponent, selector: "input-icon", inputs: ["icon"], outputs: ["clickEvent"] }, { kind: "directive", type: i8.MaskDirective, selector: "input[mask], textarea[mask]", inputs: ["mask", "specialCharacters", "patterns", "prefix", "suffix", "thousandSeparator", "decimalMarker", "dropSpecialCharacters", "hiddenInput", "showMaskTyped", "placeHolderCharacter", "shownMaskExpression", "showTemplate", "clearIfNotMatch", "validation", "separatorLimit", "allowNegativeNumbers", "leadZeroDateTime", "triggerOnMaskChange"], outputs: ["maskFilled"], exportAs: ["mask", "ngxMask"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDateComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cocoring-date', template: "<ng-container [formGroup]=\"formGroup\">\r\n <mat-form-field [appearance]=\"appearance\" [ngClass]=\"{'mat-form-compact': styleCompact}\">\r\n <mat-label>{{nameLabel}}</mat-label>\r\n <!-- <input matInput [matDatepicker]=\"picker\" [formControlName]=\"nameControl\"> -->\r\n <input [attr.data-cy]=\"nameControl\" matInput type=\"text\" mask=\"d0/M0/0000\" [leadZeroDateTime]=\"true\" [formControlName]=\"maskInputControlName\" (blur)=\"onBlur()\"/>\r\n <input [matDatepicker]=\"picker\" [formControlName]=\"nameControl\">\r\n <div matSuffix style=\"display:flex\">\r\n <mat-datepicker-toggle tabindex=\"-1\" matSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n <input-icon icon=\"close\" *ngIf=\"formGroup.get(maskInputControlName).value\" (click)=\"clearDateMaskValue($event)\"></input-icon>\r\n </div>\r\n <mat-datepicker #picker></mat-datepicker>\r\n <mat-error error-handler [form]=\"formGroup\" [controlName]=\"maskInputControlName\"></mat-error>\r\n </mat-form-field>\r\n</ng-container>", styles: [":host{display:block}.mat-datepicker-input{display:none}\n"] }]
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
type: Inject,
args: [MAT_DATE_LOCALE]
}] }, { type: i0.ChangeDetectorRef }, { type: i0.Injector }]; }, propDecorators: { config: [{
type: Input
}] } });
class CocoringEmailComponent extends ExtendInputsComponent {
constructor(injector) {
super(injector);
}
set config(config) {
config.validators.push(ValidatorsService.emailValidator);
this.configInput(config);
this.addControlForm();
}
ngOnInit() { }
}
CocoringEmailComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringEmailComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
CocoringEmailComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringEmailComponent, selector: "cocoring-email", inputs: { config: "config" }, usesInheritance: true, ngImport: i0, template: "<ng-container [formGroup]=\"formGroup\">\r\n <mat-form-field [appearance]=\"appearance\" [ngClass]=\"{'mat-form-compact': styleCompact}\">\r\n <mat-label>{{nameLabel}}</mat-label>\r\n <div matPrefix>\r\n <input-icon [icon]=\"icon\"></input-icon>\r\n </div>\r\n <input [attr.data-cy]=\"nameControl\" type=\"email\" matInput [formControlName]=\"nameControl\" />\r\n <div matSuffix style=\"display:flex\">\r\n <input-icon icon=\"close\" *ngIf=\"formGroup.get(nameControl).value\" (click)=\"clearValue($event)\"></input-icon>\r\n </div>\r\n <mat-error error-handler [form]=\"formGroup\" [controlName]=\"nameControl\"></mat-error>\r\n </mat-form-field>\r\n</ng-container>", dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3$1.MatPrefix, selector: "[matPrefix]" }, { kind: "directive", type: i3$1.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: CocoringInputErrorComponent, selector: "[error-handler]", inputs: ["form", "controlName"] }, { kind: "component", type: InputIconComponent, selector: "input-icon", inputs: ["icon"], outputs: ["clickEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringEmailComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cocoring-email', template: "<ng-container [formGroup]=\"formGroup\">\r\n <mat-form-field [appearance]=\"appearance\" [ngClass]=\"{'mat-form-compact': styleCompact}\">\r\n <mat-label>{{nameLabel}}</mat-label>\r\n <div matPrefix>\r\n <input-icon [icon]=\"icon\"></input-icon>\r\n </div>\r\n <input [attr.data-cy]=\"nameControl\" type=\"email\" matInput [formControlName]=\"nameControl\" />\r\n <div matSuffix style=\"display:flex\">\r\n <input-icon icon=\"close\" *ngIf=\"formGroup.get(nameControl).value\" (click)=\"clearValue($event)\"></input-icon>\r\n </div>\r\n <mat-error error-handler [form]=\"formGroup\" [controlName]=\"nameControl\"></mat-error>\r\n </mat-form-field>\r\n</ng-container>" }]
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { config: [{
type: Input
}] } });
class CocoringNumberComponent extends ExtendInputsComponent {
constructor(injector) {
super(injector);
}
set config(config) {
this.configInput(config);
this.addControlForm();
}
ngOnInit() {
this.formGroup.get(this.nameControl).valueChanges.pipe(takeUntil$1(this.destroy$), filter(value => this.maxlength && String(value).length > this.maxlength && value > 0)).subscribe((value) => {
this.formGroup.get(this.nameControl).setValue(String(value).slice(0, this.maxlength), { emitEvent: false });
});
}
}
CocoringNumberComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringNumberComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
CocoringNumberComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringNumberComponent, selector: "cocoring-number", inputs: { config: "config" }, usesInheritance: true, ngImport: i0, template: "<ng-container [formGroup]=\"formGroup\">\r\n <mat-form-field [appearance]=\"appearance\" [ngClass]=\"{'mat-form-compact': styleCompact}\">\r\n <mat-label>{{nameLabel}}</mat-label>\r\n <div matPrefix>\r\n <input-icon [icon]=\"icon\"></input-icon>\r\n </div>\r\n <input [attr.data-cy]=\"nameControl\" type=\"number\" matInput [formControlName]=\"nameControl\" [maxlength]=\"maxlength\" />\r\n <div matSuffix style=\"display:flex\">\r\n <input-icon icon=\"close\" *ngIf=\"formGroup.get(nameControl).value\" (click)=\"clearValue($event)\"></input-icon>\r\n </div>\r\n <mat-error error-handler [form]=\"formGroup\" [controlName]=\"nameControl\"></mat-error>\r\n </mat-form-field>\r\n</ng-container>", dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.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: i1$2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3$1.MatPrefix, selector: "[matPrefix]" }, { kind: "directive", type: i3$1.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: CocoringInputErrorComponent, selector: "[error-handler]", inputs: ["form", "controlName"] }, { kind: "component", type: InputIconComponent, selector: "input-icon", inputs: ["icon"], outputs: ["clickEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringNumberComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cocoring-number', template: "<ng-container [formGroup]=\"formGroup\">\r\n <mat-form-field [appearance]=\"appearance\" [ngClass]=\"{'mat-form-compact': styleCompact}\">\r\n <mat-label>{{nameLabel}}</mat-label>\r\n <div matPrefix>\r\n <input-icon [icon]=\"icon\"></input-icon>\r\n </div>\r\n <input [attr.data-cy]=\"nameControl\" type=\"number\" matInput [formControlName]=\"nameControl\" [maxlength]=\"maxlength\" />\r\n <div matSuffix style=\"display:flex\">\r\n <input-icon icon=\"close\" *ngIf=\"formGroup.get(nameControl).value\" (click)=\"clearValue($event)\"></input-icon>\r\n </div>\r\n <mat-error error-handler [form]=\"formGroup\" [controlName]=\"nameControl\"></mat-error>\r\n </mat-form-field>\r\n</ng-container>" }]
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { config: [{
type: Input
}] } });
class CocoringPasswordComponent extends ExtendInputsComponent {
constructor(injector) {
super(injector);
this.type = "password";
this.revealPasswordStatus = false;
}
set config(config) {
this.configInput(config);
this.addControlForm();
}
ngOnInit() { }
toggleRevealPassword() {
this.revealPasswordStatus = !this.revealPasswordStatus;
this.type = this.revealPasswordStatus ? 'text' : 'password';
}
}
CocoringPasswordComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringPasswordComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
CocoringPasswordComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringPasswordComponent, selector: "cocoring-password", inputs: { config: "config" }, usesInheritance: true, ngImport: i0, template: "<ng-container [formGroup]=\"formGroup\">\r\n <mat-form-field [appearance]=\"appearance\" [ngClass]=\"{'mat-form-compact': styleCompact}\">\r\n <mat-label>{{nameLabel}}</mat-label>\r\n \r\n <div matPrefix>\r\n <input-icon [icon]=\"icon\"></input-icon>\r\n </div>\r\n\r\n <input [attr.data-cy]=\"nameControl\" matInput [type]=\"type\" [formControlName]=\"nameControl\" />\r\n\r\n <div matSuffix style=\"display:flex\">\r\n <button type=\"button\" tabindex=\"-1\" class=\"suffix-icon\" (click)=\"toggleRevealPassword()\" mat-icon-button\r\n aria-label=\"R\u00E9v\u00E9ler / cacher le mot de passe\">\r\n <mat-icon>\r\n <ng-container *ngIf=\"!revealPasswordStatus\">visibility</ng-container>\r\n <ng-container *ngIf=\"revealPasswordStatus\">visibility_off</ng-container>\r\n </mat-icon>\r\n </button>\r\n\r\n <input-icon icon=\"close\" *ngIf=\"formGroup.get(nameControl).value\" (click)=\"clearValue($event)\">\r\n </input-icon>\r\n </div>\r\n\r\n <mat-error error-handler [form]=\"formGroup\" [controlName]=\"nameControl\"></mat-error>\r\n </mat-form-field>\r\n</ng-container>", dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: InputIconComponent, selector: "input-icon", inputs: ["icon"], outputs: ["clickEvent"] }, { kind: "directive", type: i3$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3$1.MatPrefix, selector: "[matPrefix]" }, { kind: "directive", type: i3$1.MatSuffix, selector: "[matSuffix]" }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: CocoringInputErrorComponent, selector: "[error-handler]", inputs: ["form", "controlName"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringPasswordComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cocoring-password', template: "<ng-container [formGroup]=\"formGroup\">\r\n <mat-form-field [appearance]=\"appearance\" [ngClass]=\"{'mat-form-compact': styleCompact}\">\r\n <mat-label>{{nameLabel}}</mat-label>\r\n \r\n <div matPrefix>\r\n <input-icon [icon]=\"icon\"></input-icon>\r\n </div>\r\n\r\n <input [attr.data-cy]=\"nameControl\" matInput [type]=\"type\" [formControlName]=\"nameControl\" />\r\n\r\n <div matSuffix style=\"display:flex\">\r\n <button type=\"button\" tabindex=\"-1\" class=\"suffix-icon\" (click)=\"toggleRevealPassword()\" mat-icon-button\r\n aria-label=\"R\u00E9v\u00E9ler / cacher le mot de passe\">\r\n <mat-icon>\r\n <ng-container *ngIf=\"!revealPasswordStatus\">visibility</ng-container>\r\n <ng-container *ngIf=\"revealPasswordStatus\">visibility_off</ng-container>\r\n </mat-icon>\r\n </button>\r\n\r\n <input-icon icon=\"close\" *ngIf=\"formGroup.get(nameControl).value\" (click)=\"clearValue($event)\">\r\n </input-icon>\r\n </div>\r\n\r\n <mat-error error-handler [form]=\"formGroup\" [controlName]=\"nameControl\"></mat-error>\r\n </mat-form-field>\r\n</ng-container>" }]
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { config: [{
type: Input
}] } });
class CocoringSelectComponent extends ExtendInputsComponent {
constructor(injector) {
super(injector);
}
set config(config) {
this.configInput(config);
this.addControlForm();
}
ngOnInit() { }
}
CocoringSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringSelectComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
CocoringSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringSelectComponent, selector: "cocoring-select", inputs: { config: "config" }, usesInheritance: true, ngImport: i0, template: "<ng-container [formGroup]=\"formGroup\">\r\n <mat-form-field [appearance]=\"appearance\" [ngClass]=\"{'mat-form-compact': styleCompact}\">\r\n <div matPrefix>\r\n <input-icon [icon]=\"icon\"></input-icon>\r\n </div>\r\n <mat-label>{{nameLabel}}</mat-label>\r\n <mat-select [attr.data-cy]=\"nameControl\" [formControlName]=\"nameControl\">\r\n <mat-option *ngFor=\"let item of (dataSource$ | async)\" [value]=\"item.id\">\r\n {{item[dataSourceNameProperty]}}\r\n </mat-option>\r\n </mat-select>\r\n <div matSuffix style=\"display:flex\">\r\n <input-icon icon=\"close\" *ngIf=\"formGroup.get(nameControl).value\" (click)=\"clearValue($event)\"></input-icon>\r\n </div>\r\n <mat-error error-handler [form]=\"formGroup\" [controlName]=\"nameControl\"></mat-error>\r\n </mat-form-field>\r\n</ng-container>", styles: [""], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3$1.MatPrefix, selector: "[matPrefix]" }, { kind: "directive", type: i3$1.MatSuffix, selector: "[matSuffix]" }, { kind: "component", type: i4$1.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i5$2.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: CocoringInputErrorComponent, selector: "[error-handler]", inputs: ["form", "controlName"] }, { kind: "component", type: InputIconComponent, selector: "input-icon", inputs: ["icon"], outputs: ["clickEvent"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringSelectComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cocoring-select', template: "<ng-container [formGroup]=\"formGroup\">\r\n <mat-form-field [appearance]=\"appearance\" [ngClass]=\"{'mat-form-compact': styleCompact}\">\r\n <div matPrefix>\r\n <input-icon [icon]=\"icon\"></input-icon>\r\n </div>\r\n <mat-label>{{nameLabel}}</mat-label>\r\n <mat-select [attr.data-cy]=\"nameControl\" [formControlName]=\"nameControl\">\r\n <mat-option *ngFor=\"let item of (dataSource$ | async)\" [value]=\"item.id\">\r\n {{item[dataSourceNameProperty]}}\r\n </mat-option>\r\n </mat-select>\r\n <div matSuffix style=\"display:flex\">\r\n <input-icon icon=\"close\" *ngIf=\"formGroup.get(nameControl).value\" (click)=\"clearValue($event)\"></input-icon>\r\n </div>\r\n <mat-error error-handler [form]=\"formGroup\" [controlName]=\"nameControl\"></mat-error>\r\n </mat-form-field>\r\n</ng-container>" }]
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { config: [{
type: Input
}] } });
class CocoringSlideToggleComponent extends ExtendInputsComponent {
constructor(injector) {
super(injector);
}
set config(config) {
this.configInput(config);
this.addControlForm();
}
ngOnInit() { }
}
CocoringSlideToggleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringSlideToggleComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
CocoringSlideToggleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringSlideToggleComponent, selector: "cocoring-slide-toggle", inputs: { config: "config" }, usesInheritance: true, ngImport: i0, template: "<ng-container [formGroup]=\"formGroup\">\r\n <div class=\"slide-toggle-frm\">\r\n <mat-label>{{nameLabel}}</mat-label>\r\n <mat-slide-toggle [attr.data-cy]=\"nameControl\" [formControlName]=\"nameControl\"></mat-slide-toggle>\r\n </div>\r\n <mat-error error-handler [form]=\"formGroup\" [controlName]=\"nameControl\"></mat-error>\r\n</ng-container>", styles: [".slide-toggle-frm{display:flex;justify-content:space-between;padding:.5em 0 1.625em;border-top:1.125em solid transparent}.slide-toggle-frm mat-label{font-weight:500}\n"], dependencies: [{ kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "directive", type: i3$1.MatLabel, selector: "mat-label" }, { kind: "component", type: i3$3.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["disabled", "disableRipple", "color", "tabIndex"], exportAs: ["matSlideToggle"] }, { kind: "component", type: CocoringInputErrorComponent, selector: "[error-handler]", inputs: ["form", "controlName"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringSlideToggleComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cocoring-slide-toggle', template: "<ng-container [formGroup]=\"formGroup\">\r\n <div class=\"slide-toggle-frm\">\r\n <mat-label>{{nameLabel}}</mat-label>\r\n <mat-slide-toggle [attr.data-cy]=\"nameControl\" [formControlName]=\"nameControl\"></mat-slide-toggle>\r\n </div>\r\n <mat-error error-handler [form]=\"formGroup\" [controlName]=\"nameControl\"></mat-error>\r\n</ng-container>", styles: [".slide-toggle-frm{display:flex;justify-content:space-between;padding:.5em 0 1.625em;border-top:1.125em solid transparent}.slide-toggle-frm mat-label{font-weight:500}\n"] }]
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { config: [{
type: Input
}] } });
class CocoringTextComponent extends ExtendInputsComponent {
constructor(injector) {
super(injector);
}
set config(config) {
this.configInput(config);
this.addControlForm();
}
ngOnInit() { }
}
CocoringTextComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringTextComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
CocoringTextComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringTextComponent, selector: "cocoring-text", inputs: { config: "config" }, usesInheritance: true, ngImport: i0, template: "<!-- utilier ngTemplateOutlet ex: https://blog.bitsrc.io/component-reusability-techniques-with-angular-727a6c603ad2 -->\r\n\r\n<!-- <input-container-ng [form]=\"formGroup\" [controlName]=\"nameControl\">\r\n <ng-container [formGroup]=\"formGroup\">\r\n <mat-form-field>\r\n <mat-label>{{nameLabel}}</mat-label>\r\n <input type=\"text\" matInput [formControlName]=\"nameControl\" />\r\n </mat-form-field>\r\n </ng-container>\r\n</input-container-ng> -->\r\n\r\n<!-- <input-container-ng [templateRef]=\"nestedComponentRef\" [form]=\"formGroup\" [controlName]=\"nameControl\">\r\n</input-container-ng>\r\n\r\n<ng-template #nestedComponentRef>\r\n <ng-container [formGroup]=\"formGroup\">\r\n <mat-form-field>\r\n <mat-label>{{nameLabel}}</mat-label>\r\n <input type=\"text\" matInput [formControlName]=\"nameControl\" />\r\n </mat-form-field>\r\n </ng-container>\r\n</ng-template> -->\r\n\r\n<ng-container [formGroup]=\"formGroup\">\r\n <mat-form-field [appearance]=\"appearance\" [ngClass]=\"{'mat-form-compact': styleCompact}\">\r\n <mat-label>{{nameLabel}}</mat-label>\r\n <div matPrefix>\r\n <input-icon [icon]=\"icon\"></input-icon>\r\n </div>\r\n <input type=\"text\" [attr.data-cy]=\"nameControl\" matInput [formControlName]=\"nameControl\" [maxlength]=\"maxlength\" />\r\n <div matSuffix style=\"display:flex\">\r\n <input-icon icon=\"close\" *ngIf=\"formGroup.get(nameControl).value\" (click)=\"clearValue($event)\">\r\n </input-icon>\r\n </div>\r\n <mat-error error-handler [form]=\"formGroup\" [controlName]=\"nameControl\"></mat-error>\r\n </mat-form-field>\r\n</ng-container>", dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3$1.MatPrefix, selector: "[matPrefix]" }, { kind: "directive", type: i3$1.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: CocoringInputErrorComponent, selector: "[error-handler]", inputs: ["form", "controlName"] }, { kind: "component", type: InputIconComponent, selector: "input-icon", inputs: ["icon"], outputs: ["clickEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringTextComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cocoring-text', template: "<!-- utilier ngTemplateOutlet ex: https://blog.bitsrc.io/component-reusability-techniques-with-angular-727a6c603ad2 -->\r\n\r\n<!-- <input-container-ng [form]=\"formGroup\" [controlName]=\"nameControl\">\r\n <ng-container [formGroup]=\"formGroup\">\r\n <mat-form-field>\r\n <mat-label>{{nameLabel}}</mat-label>\r\n <input type=\"text\" matInput [formControlName]=\"nameControl\" />\r\n </mat-form-field>\r\n </ng-container>\r\n</input-container-ng> -->\r\n\r\n<!-- <input-container-ng [templateRef]=\"nestedComponentRef\" [form]=\"formGroup\" [controlName]=\"nameControl\">\r\n</input-container-ng>\r\n\r\n<ng-template #nestedComponentRef>\r\n <ng-container [formGroup]=\"formGroup\">\r\n <mat-form-field>\r\n <mat-label>{{nameLabel}}</mat-label>\r\n <input type=\"text\" matInput [formControlName]=\"nameControl\" />\r\n </mat-form-field>\r\n </ng-container>\r\n</ng-template> -->\r\n\r\n<ng-container [formGroup]=\"formGroup\">\r\n <mat-form-field [appearance]=\"appearance\" [ngClass]=\"{'mat-form-compact': styleCompact}\">\r\n <mat-label>{{nameLabel}}</mat-label>\r\n <div matPrefix>\r\n <input-icon [icon]=\"icon\"></input-icon>\r\n </div>\r\n <input type=\"text\" [attr.data-cy]=\"nameControl\" matInput [formControlName]=\"nameControl\" [maxlength]=\"maxlength\" />\r\n <div matSuffix style=\"display:flex\">\r\n <input-icon icon=\"close\" *ngIf=\"formGroup.get(nameControl).value\" (click)=\"clearValue($event)\">\r\n </input-icon>\r\n </div>\r\n <mat-error error-handler [form]=\"formGroup\" [controlName]=\"nameControl\"></mat-error>\r\n </mat-form-field>\r\n</ng-container>" }]
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { config: [{
type: Input
}] } });
class CocoringTextareaComponent extends ExtendInputsComponent {
constructor(injector) {
super(injector);
}
set config(config) {
this.configInput(config);
this.addControlForm();
}
ngOnInit() { }
}
CocoringTextareaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringTextareaComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
CocoringTextareaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringTextareaComponent, selector: "cocoring-textarea", inputs: { config: "config" }, usesInheritance: true, ngImport: i0, template: "<ng-container [formGroup]=\"formGroup\">\r\n <mat-form-field [appearance]=\"appearance\">\r\n <mat-label>{{nameLabel}}</mat-label>\r\n <textarea [attr.data-cy]=\"nameControl\" matInput [formControlName]=\"nameControl\" rows=\"10\"></textarea>\r\n <div matSuffix style=\"display:flex\">\r\n <input-icon icon=\"close\" *ngIf=\"formGroup.get(nameControl).value\" (click)=\"clearValue($event)\"></input-icon>\r\n </div>\r\n <mat-error error-handler [form]=\"formGroup\" [controlName]=\"nameControl\"></mat-error>\r\n </mat-form-field>\r\n</ng-container>", styles: [":host{display:block}:host ::ng-deep .mat-form-field-flex{align-items:flex-start!important}:host ::ng-deep .mat-form-field-flex [matSuffix] .mat-icon-button{margin-top:15px!important}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3$1.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: CocoringInputErrorComponent, selector: "[error-handler]", inputs: ["form", "controlName"] }, { kind: "component", type: InputIconComponent, selector: "input-icon", inputs: ["icon"], outputs: ["clickEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringTextareaComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cocoring-textarea', template: "<ng-container [formGroup]=\"formGroup\">\r\n <mat-form-field [appearance]=\"appearance\">\r\n <mat-label>{{nameLabel}}</mat-label>\r\n <textarea [attr.data-cy]=\"nameControl\" matInput [formControlName]=\"nameControl\" rows=\"10\"></textarea>\r\n <div matSuffix style=\"display:flex\">\r\n <input-icon icon=\"close\" *ngIf=\"formGroup.get(nameControl).value\" (click)=\"clearValue($event)\"></input-icon>\r\n </div>\r\n <mat-error error-handler [form]=\"formGroup\" [controlName]=\"nameControl\"></mat-error>\r\n </mat-form-field>\r\n</ng-container>", styles: [":host{display:block}:host ::ng-deep .mat-form-field-flex{align-items:flex-start!important}:host ::ng-deep .mat-form-field-flex [matSuffix] .mat-icon-button{margin-top:15px!important}\n"] }]
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { config: [{
type: Input
}] } });
class CocoringViewerComponent extends ExtendInputsComponent {
constructor(fb, injector) {
super(injector);
this.fb = fb;
this.callback = new EventEmitter();
}
set config(config) {
this.configInput(config);
this.addForm();
}
ngOnInit() {
}
addForm() {
const nestedFrom = this.fb.group({
windowingMin: null,
windowingMax: null,
rangeMin: null,
rangeMax: null,
lut: null
});
this.formGroup.addControl(this.nameControl, nestedFrom);
this.emitEvent();
}
}
CocoringViewerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringViewerComponent, deps: [{ token: i1$2.UntypedFormBuilder }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
CocoringViewerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringViewerComponent, selector: "cocoring-viewer-ng", inputs: { config: "config" }, outputs: { callback: "callback" }, usesInheritance: true, ngImport: i0, template: "<ng-container [formGroup]=\"formGroup\">\r\n <mat-form-field>\r\n <mat-label>{{nameLabel}}</mat-label>\r\n <ng-container [formGroupName]=\"nameControl\">\r\n <input type=\"text\" matInput formControlName=\"windowingMin\" />\r\n </ng-container>\r\n <!-- <mat-error error-handler [form]=\"formGroup\" [controlName]=\"nameControl\"></mat-error> -->\r\n </mat-form-field>\r\n</ng-container>", dependencies: [{ kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1$2.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringViewerComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cocoring-viewer-ng', template: "<ng-container [formGroup]=\"formGroup\">\r\n <mat-form-field>\r\n <mat-label>{{nameLabel}}</mat-label>\r\n <ng-container [formGroupName]=\"nameControl\">\r\n <input type=\"text\" matInput formControlName=\"windowingMin\" />\r\n </ng-container>\r\n <!-- <mat-error error-handler [form]=\"formGroup\" [controlName]=\"nameControl\"></mat-error> -->\r\n </mat-form-field>\r\n</ng-container>" }]
}], ctorParameters: function () { return [{ type: i1$2.UntypedFormBuilder }, { type: i0.Injector }]; }, propDecorators: { callback: [{
type: Output
}], config: [{
type: Input
}] } });
const ClasseComponents = {
[FormInputComponents.INPUT_TEXT]: CocoringTextComponent,
[FormInputComponents.INPUT_EMAIL]: CocoringEmailComponent,
[FormInputComponents.INPUT_CHECKBOX]: CocoringCheckboxComponent,
[FormInputComponents.INPUT_CHECKBOX_INDETERMINATE]: CocoringCheckboxIndeterminateComponent,
[FormInputComponents.INPUT_NUMBER]: CocoringNumberComponent,
[FormInputComponents.INPUT_PASSWORD]: CocoringPasswordComponent,
[FormInputComponents.INPUT_DATE]: CocoringDateComponent,
[FormInputComponents.INPUT_SLIDE_TOGGLE]: CocoringSlideToggleComponent,
[FormInputComponents.INPUT_TEXTAREA]: CocoringTextareaComponent,
[FormInputComponents.INPUT_VIEWER]: CocoringViewerComponent,
[FormInputComponents.INPUT_SELECT]: CocoringSelectComponent,
[FormInputComponents.BUTTON]: CocoringButtonComponent,
[FormInputComponents.LINK]: CocoringButtonLinkComponent,
};
class InputConfigBuilder {
isRequired() {
this._isRequired = true;
return this;
}
styleCompact() {
this._styleCompact = true;
return this;
}
appearance(appearance) {
this._appearance = appearance;
return this;
}
nameLabel(nameLabel) {
this._nameLabel = nameLabel;
return this;
}
inRelationWith(inputName) {
this._inRelationWith = inputName;
return this;
}
dataSource(dataSource) {
this._dataSource = dataSource;
return this;
}
maxlength(value) {
this._maxlength = value;
return this;
}
icon(materialIconName) {
this._icon = materialIconName;
return this;
}
typeInput(type) {
this._type = type;
return this;
}
outputCallback(outputCallback) {
this._callbackComponent = outputCallback;
return this;
}
}
class ButtonConfigBuilder {
isTypeSubmit(is = true) {
this._type = is ? TypeButtonEnum.SUBMIT : TypeButtonEnum.BUTTON;
return this;
}
type(typeOfTheBtn = TypeButtonEnum.BUTTON) {
this._type = typeOfTheBtn;
return this;
}
icon(materialIconName, buttonIconPosition = ButtonIconPositon.START) {
this._icon = materialIconName;
this._iconPosition = buttonIconPosition;
return this;
}
url(url) {
this._url = url;
return this;
}
openNewTab(openNewTab) {
this._openNewTab = openNewTab;
return this;
}
class(className) {
this._className = className;
return this;
}
outputCallback(outputCallback) {
this._callbackComponent = outputCallback;
return this;
}
}
class FormBuilderService {
constructor(fb, helperService, broadcastEventService, generateComponentViewService) {
this.fb = fb;
this.helperService = helperService;
this.broadcastEventService = broadcastEventService;
this.generateComponentViewService = generateComponentViewService;
this._configInputsForm = [];
this._appearance = DefaultConfigComponent.form.appearance;
this._styleCompact = DefaultConfigComponent.form.styleCompact;
this.newForm();
}
set form(form) {
this.currentForm = form;
}
get form() {
return this.currentForm;
}
get styleCompact() {
return this._styleCompact;
}
getAppearance() {
return this._appearance;
}
get configInputsForm() {
return this._configInputsForm;
}
newForm() {
this.currentForm = this.fb.group({});
this._configInputsForm.splice(0, this._configInputsForm.length);
this.identityForm(this.helperService.generateGuid());
return this;
}
appearance(value) {
this._appearance = value;
return this;
}
identityForm(id, name) {
this.formId = id;
this.formName = name;
this.currentForm.addControl(DefaultConfigComponent.form.keyId, new UntypedFormControl(id));
return this;
}
setViewContainerRef(containerRef) {
this.generateComponentViewService.setViewContainerRef(containerRef);
return this;
}
addInput(inputName, configBuilder) {
const builder = configBuilder(new InputConfigBuilder);
/** on formalise la configuration du champ input */
const configInputComponent = {
type: builder._type,
formGroup: this.currentForm,
nameControl: inputName,
nameLabel: builder._nameLabel,
dataSource: builder._dataSource,
inRelationWith: builder._inRelationWith,
styleCompact: builder._styleCompact ? builder._styleCompact : this.styleCompact,
icon: builder._icon,
maxlength: builder._maxlength,
appearance: builder._appearance ? builder._appearance : this._appearance,
callbackComponent: builder._callbackComponent,
validators: []
};
/** on traite la validation du champ input */
if (builder._isRequired) {
configInputComponent.validators.push(ValidatorsService.require);
}
this._configInputsForm.push(configInputComponent);
this.generateComponentViewService.addComponentToView(configInputComponent.type, configInputComponent, builder._callbackComponent);
return this;
}
/** Déclenche manuellement la création des champs dans la vue */
generateFormInView() {
if (this.generateComponentViewService.getViewContainerRef()) {
this._configInputsForm.forEach((conf) => {
this.generateComponentViewService.addComponentToView(conf.type, conf, conf.callbackComponent);
});
}
return this;
}
addButton(buttonName, configBuilder) {
const builder = configBuilder(new ButtonConfigBuilder);
const configInputComponent = {
text: buttonName,
type: builder._type,
icon: builder._icon,
url: builder._url,
openNewTab: builder._openNewTab,
className: builder._className,
iconPosition: builder._iconPosition,
onClickSubmit: this.onClickSubmit.bind(this)
};
if (builder._type === TypeButtonEnum.LINK) {
this.generateComponentViewService.addComponentToView(FormInputComponents.LINK, configInputComponent, builder._callbackComponent);
}
else {
this.generateComponentViewService.addComponentToView(FormInputComponents.BUTTON, configInputComponent, builder._callbackComponent);
}
return this;
}
onClickSubmit() {
this.broadcastEventService.broadcast({ eventKeys: [ConfigEvents.FORM_SUBMITTED, this.formId], eventData: this.form });
}
}
FormBuilderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: FormBuilderService, deps: [{ token: i1$2.UntypedFormBuilder }, { token: i1.HelperService }, { token: i1.BroadcastEventService }, { token: GenerateComponentViewService }], target: i0.ɵɵFactoryTarget.Injectable });
FormBuilderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: FormBuilderService, providedIn: 'root' });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: FormBuilderService, decorators: [{
type: Injectable,
args: [{
providedIn: 'root',
}]
}], ctorParameters: function () { return [{ type: i1$2.UntypedFormBuilder }, { type: i1.HelperService }, { type: i1.BroadcastEventService }, { type: GenerateComponentViewService }]; } });
class GenerateComponentViewService {
constructor(injectComponentService) {
this.injectComponentService = injectComponentService;
}
setViewContainerRef(containerRef) {
this.formContainerRef = containerRef;
return this;
}
getViewContainerRef() {
return this.formContainerRef;
}
addComponentToView(componentType, configComponent, callback) {
if (!this.getViewContainerRef())
return;
const componentToAdd = this.returnComponentClassFromType(componentType);
this.injectComponentService.loadAndAddComponentToContainer(componentToAdd, this.formContainerRef, { config: configComponent }, callback);
}
returnComponentClassFromType(typeOfComponent) {
if (!ClasseComponents.hasOwnProperty(typeOfComponent)) {
const error = `This type of component : '${typeOfComponent}' doesn't exist`;
throw new Error(error);
}
else {
return ClasseComponents[typeOfComponent];
}
}
}
GenerateComponentViewService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: GenerateComponentViewService, deps: [{ token: i1.InjectComponentService }], target: i0.ɵɵFactoryTarget.Injectable });
GenerateComponentViewService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: GenerateComponentViewService, providedIn: 'root' });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: GenerateComponentViewService, decorators: [{
type: Injectable,
args: [{
providedIn: 'root',
}]
}], ctorParameters: function () { return [{ type: i1.InjectComponentService }]; } });
class UploaderService {
constructor(httpService) {
this.httpService = httpService;
this.progressSource = new BehaviorSubject(0);
this.fileUploaded$ = new Subject();
this.fileOnError$ = new Subject();
this.chunkSize = DefaultConfigComponent.upload.chunkSize;
}
uploadFile(file) {
this.file = file;
const numberParts = this.getNumberPart(file);
this.convertFileToArrayBuffer(file).subscribe((fileArrayBuffer) => {
if (numberParts === 1) {
this.handleFullFile(fileArrayBuffer, numberParts);
}
else {
this.handlePartsFile(fileArrayBuffer, numberParts);
}
});
}
handleFullFile(fileArrayBuffer, numberParts) {
this.sendFull(fileArrayBuffer, numberParts).pipe(tap((fileId) => {
this.fileUploaded$.next(fileId);
})).subscribe();
}
handlePartsFile(fileArrayBuffer, numberParts) {
/** send first part then the others */
this.sendFull(this.getPart(fileArrayBuffer, 0), numberParts).subscribe((datas) => {
const fileId = datas.value;
this.loopParts(numberParts, fileId, fileArrayBuffer).then(() => {
this.endCommand(fileId, fileArrayBuffer).subscribe(_ => {
this.fileUploaded$.next(fileId);
});
});
});
}
async loopParts(numberParts, fileId, fileArrayBuffer) {
for (var iPart = 1; iPart < numberParts; iPart++) {
await this.sendPart(fileId, iPart, this.getPart(fileArrayBuffer, iPart), numberParts);
}
}
sendFull(buffer, numberParts) {
const command = {
fileName: this.file.name,
mimeType: this.file.type,
numberParts: numberParts,
base64Content: this.convertToBase64(buffer)
};
return this.sendFile(command, 1, numberParts);
}
sendPart(fileId, partIndex, buffer, numberParts) {
const command = {
fileId: fileId,
partIndex: partIndex,
mimeType: this.file.type,
base64Content: this.convertToBase64(buffer)
};
return this.sendFile(command, partIndex + 1, numberParts).toPromise();
}
sendFile(command, partIndex, numberParts) {
return this.UploadFileAPI(command, partIndex, numberParts).pipe(map(event => this.getEventMessage(event, partIndex, numberParts)), last(), catchError(error => {
this.fileOnError$.next(undefined);
return of(null);
}));
}
endCommand(fileId, buffer) {
const command = {
fileId: fileId,
checksum: this.getChecksum(buffer)
};
return this.EndUploadPartsFileAPI(command).pipe(catchError(error => {
this.fileOnError$.next(undefined);
return of(null);
}));
}
getNumberPart(file) {
return this.chunkSize <= 0
? 1
: Math.ceil(file.size / this.chunkSize);
}
convertFileToArrayBuffer(file) {
return new Observable((observer) => {
const reader = new FileReader();
reader.readAsArrayBuffer(file);
reader.onload = function () {
const arraybuffer = reader.result;
observer.next(arraybuffer);
observer.complete();
};
});
}
convertToBase64(buffer) {
let binary = "";
let bytes = new Uint8Array(buffer);
let len = bytes.byteLength;
for (let i = 0; i < len; i++) {
binary += String.fromCharCode(bytes[i]);
}
return window.btoa(binary);
}
getPart(data, partIndex) {
const start = partIndex * this.chunkSize;
const end = start + this.chunkSize;
return data.slice(start, Math.min(end, data.byteLength));
}
getChecksum(data) {
const spark = new SparkMD5.ArrayBuffer();
spark.append(data);
return btoa(spark.end(true));
}
getEventMessage(event, partIndex, numberParts) {
switch (event.type) {
case HttpEventType.Sent:
return this.progressSource.next(Math.round((partIndex / numberParts) * 100));
case HttpEventType.UploadProgress:
return `progress...`;
case HttpEventType.Response:
return event.body;
default:
return `default...`;
}
}
/** APIs */
UploadFileAPI(datas, partIndex, numberParts) {
let apiFile = this.apisFile.apiFile();
if (numberParts > 1 && partIndex > 1)
apiFile = `${apiFile}/${datas.fileId}/parts`;
return this.httpService.upload(apiFile, datas);
}
EndUploadPartsFileAPI(datas) {
const apiFile = this.apisFile.apiFile();
return this.httpService.patch(`${apiFile}/${datas.fileId}/parts`, datas);
}
}
UploaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: UploaderService, deps: [{ token: i1.HttpService }], target: i0.ɵɵFactoryTarget.Injectable });
UploaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: UploaderService, providedIn: "root" });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: UploaderService, decorators: [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], ctorParameters: function () { return [{ type: i1.HttpService }]; } });
// import {
// ToastErrorStacktraceComponent,
// } from '../../shared/component/toast-error-stacktrace/toast-error-stacktrace.component';
class ToastMessageService {
constructor(toast, router) {
this.toast = toast;
this.router = router;
this.classCss = ["succesToast", "errorToast", "infoToast"];
this.buttonAction = 'Fermer';
this.defaultDuration = 5000;
this.defaultErrorDuration = 0;
this.onChangeUrl();
}
onChangeUrl() {
this.router.events
.pipe(filter$1((event) => event instanceof NavigationStart), filter$1(() => !!this.toastRef))
.subscribe(() => this.dismiss());
}
success(message, callback, duration = this.defaultDuration) {
this.messageHandler(callback, message, 0, duration, null);
}
error(message, callback, duration = this.defaultErrorDuration) {
this.messageHandler(callback, message, 1, duration, this.buttonAction);
}
// https://stackblitz.com/edit/snackbar-with-html-so?file=app%2Fhome-page%2Fhome-page.component.ts
errorStacktrace(message, stacktrace, callback, duration = this.defaultErrorDuration) {
const errorStacktrace = { message: message, stacktrace: stacktrace };
// const options = {
// 'panelClass': this.classCss[messageStyle],
// 'duration': !duration ? 0 : duration,
// 'verticalPosition': position
// }
// this.toastRef = this.toast.openFromComponent(ToastErrorStacktraceComponent, { data: errorStacktrace, 'panelClass': this.classCss[1] });
this.onDismiss();
}
info(message, callback, duration = this.defaultDuration) {
this.messageHandler(callback, message, 2, duration, null);
}
messageHandler(callback, message, messageStyle, duration, buttonActionText, position = 'bottom') {
this.callback = callback;
const options = {
'panelClass': this.classCss[messageStyle],
'duration': !duration ? 0 : duration,
'verticalPosition': position
};
this.toastRef = this.toast.open(message, buttonActionText, options);
this.onDismiss();
}
onDismiss() {
if (this.subscription)
this.subscription.unsubscribe();
this.subscription = this.toastRef.afterDismissed().subscribe(() => {
if (this.callback)
this.callback();
});
}
dismiss() {
this.toast.dismiss();
}
}
ToastMessageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: ToastMessageService, deps: [{ token: i1$4.MatSnackBar }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Injectable });
ToastMessageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: ToastMessageService, providedIn: 'root' });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: ToastMessageService, decorators: [{
type: Injectable,
args: [{
providedIn: 'root'
}]
}], ctorParameters: function () { return [{ type: i1$4.MatSnackBar }, { type: i2.Router }]; } });
class DatagridService {
constructor(datasourceService, helperService, fb) {
this.datasourceService = datasourceService;
this.helperService = helperService;
this.fb = fb;
this._nextPage$ = new Subject();
this._previousPage$ = new Subject();
this._resetColumnExcept$ = new Subject();
this._updateColumn$ = new Subject();
this._reOrderColumns$ = new Subject();
this._lengthDataSource$ = new BehaviorSubject(0);
this.rowSelectedByClickEvent$ = new Subject();
this.rowCheckedEvent$ = new Subject();
this.rowsDeletedEvent$ = new Subject();
this.rowsRestoredEvent$ = new Subject();
this.allRowsChecked$ = new Subject();
this.refreshNeeded$ = new Subject();
this.rowsSelectedDatagrid = []; /** array avec tous les ids des lignes sélectionnées dans la grille */
this.itemsPerPage = 10;
this.currentPage = 1;
this.totalRows = 0;
this.onPaginatePage();
}
onPaginatePage() {
this.onNextPage();
this.onPreviousPage();
}
onNextPage() {
this.nextPage$.pipe(tap(_ => this.currentPage = this.currentPage + 1), tap(_ => this.refreshNeeded$.next())).subscribe();
}
onPreviousPage() {
this.previousPage$.pipe(tap(_ => this.currentPage = this.currentPage - 1), tap(_ => this.refreshNeeded$.next())).subscribe();
}
get resetColumnExcept$() {
return this._resetColumnExcept$;
}
get updateColumn$() {
return this._updateColumn$;
}
get reOrderColumns$() {
return this._reOrderColumns$;
}
get nextPage$() {
return this._nextPage$;
}
get previousPage$() {
return this._previousPage$;
}
get lengthDataSource$() {
return this._lengthDataSource$;
}
lengthDataSource(rowsLength) {
this.totalRows = rowsLength;
this.calculPaginationDatas();
this.lengthDataSource$.next(rowsLength);
}
initCheckboxesDatagridForm() {
this.checkboxesDatagridForm = this.fb.group({});
this.checkboxesDatagridForm.addControl("selectAllRowsCheckbox", new UntypedFormControl(false));
this.checkboxesDatagridForm.addControl("rowsCheckbox", new UntypedFormArray([]));
}
checkUncheckAllRows(value) {
this.allRowsChecked$.next(value);
}
getAllDatas() {
if (!this.config.dataSource)
return of(null);
const queryString = this.buildQueryStringOData();
// return this.httpService.get(api, {$filter: filter, $top: 20})
return this.datasourceService.loadDataSource(this.config.dataSource, queryString);
// switch (this.config.dataSource.type) {
// case DataSourceType.BRUTE:
// return <Observable<DatasourceOdata>>of(<DatasourceOdata>this.config.dataSource.value).pipe(delay(1000))
// break;
// case DataSourceType.API:
// // return this.httpService.get(api, {$filter: filter, $top: 20})
// return this.httpService.get(<string>this.config.dataSource.value)
// break;
// default:
// return <Observable<DatasourceOdata>>of(null)
// break;
// }
}
storeIdsRowsSelected(rowValues, checkValue) {
const rowId = rowValues.id;
const indexIdFound = this.rowsSelectedDatagrid.findIndex((id) => id === rowId);
if (checkValue && indexIdFound === -1) {
this.rowsSelectedDatagrid.push(rowId);
this.rowCheckedEvent$.next(rowValues);
}
else if (!checkValue && indexIdFound !== -1) {
this.rowsSelectedDatagrid = this.helperService.removeValueFromArrayByIndex(this.rowsSelectedDatagrid, indexIdFound);
this.rowCheckedEvent$.next(rowValues);
}
}
buildQueryStringOData() {
const orderByQuery = this.generateSortQuery();
this.calculPaginationDatas();
let queryBuider = new QueryBuilder()
.top(this.itemsPerPage)
.skip(this.indicatorPage.from);
if (orderByQuery)
queryBuider = queryBuider.orderBy(orderByQuery);
queryBuider = this.generateFilterQuery(queryBuider);
const queryString = queryBuider.toQuery();
console.log("queryString : ", queryString);
return queryString;
}
calculPaginationDatas() {
let valueTo = this.currentPage * this.itemsPerPage;
if (this.currentPage === 1 && this.totalRows < this.itemsPerPage) {
valueTo = this.totalRows;
}
this.indicatorPage = { from: (this.currentPage - 1) * this.itemsPerPage, to: valueTo };
}
generateSortQuery() {
const sortQuery = this.config.columns
.filter((column) => column.sort === 'ASC' || column.sort === 'DESC')
.map(function (elem) {
return `${elem.dataField.toLowerCase()} ${elem.sort.toLowerCase()}`;
}).join(",");
return sortQuery;
}
generateFilterQuery(qb) {
/** OR */
// qb
// .filter(
// f => {
// // for (let index = 0; index < 3; index++) {
// f.filterPhrase(`contains('ferrari1') or contains('ferrari2')`)
// // }
// return f
// }
// )
/** AND */
// qb
// .filter(
// f => {
// for (let index = 0; index < 3; index++) {
// f.filterPhrase(`contains('ferrari1')`)
// }
// return f
// }
// )
let filterQuery = '';
let tabFilters = [];
let cpt = 0;
this.config.columns.forEach((column) => {
let tabFiltersLength = tabFilters.length;
if (column.filters) {
if (cpt === 1) {
tabFilters[0] = `(${tabFilters[0]})`;
}
tabFilters = this.setBooleanColumnFilters(tabFilters, column, cpt);
}
if (tabFilters.length === tabFiltersLength + 1)
cpt++;
});
filterQuery = this.joinFiltersQuery(filterQuery, this.setBlocFilters(tabFilters));
if (this.searchGlobal) {
let filterSearchGlobal = this.config.columns
.filter((column) => column.dataType === 'string')
.map((elem) => {
return `(contains(${elem.dataField}, '${this.searchGlobal}'))`;
}).join(" or ");
filterSearchGlobal = filterSearchGlobal ? `(${filterSearchGlobal})` : '';
filterQuery = this.joinFiltersQuery(filterQuery, filterSearchGlobal);
}
if (filterQuery) {
qb
.filter(f => f.filterPhrase(filterQuery));
}
return qb;
}
joinFiltersQuery(filterQuery, newFilters) {
if (filterQuery === '' || newFilters === '')
return filterQuery || newFilters;
return `${[filterQuery, newFilters].join(" and ")}`;
}
setBlocFilters(tabFilters) {
if (!tabFilters.length)
return '';
const filtersToString = tabFilters.join(" and ");
return `(${filtersToString})`;
}
setBooleanColumnFilters(tabFilters, column, cpt) {
if (column.dataType === 'boolean') {
if (!column.filters.selectAll) {
if (column.filters.nestedValues.allSelected) {
tabFilters.push(`${column.dataField} eq true`);
}
else if (column.filters.nestedValues.noSelected) {
tabFilters.push(`${column.dataField} eq false`);
}
if (cpt >= 1) {
tabFilters[cpt] = `(${tabFilters[cpt]})`;
}
}
}
return tabFilters;
}
}
DatagridService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: DatagridService, deps: [{ token: i1.DatasourceService }, { token: i1.HelperService }, { token: i1$2.UntypedFormBuilder }], target: i0.ɵɵFactoryTarget.Injectable });
DatagridService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: DatagridService, providedIn: 'root' });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: DatagridService, decorators: [{
type: Injectable,
args: [{
providedIn: 'root',
}]
}], ctorParameters: function () { return [{ type: i1.DatasourceService }, { type: i1.HelperService }, { type: i1$2.UntypedFormBuilder }]; } });
class CocoringConfirmModalComponent {
constructor(data, fb, mdDialogRef, formBuilderService) {
this.data = data;
this.fb = fb;
this.mdDialogRef = mdDialogRef;
this.formBuilderService = formBuilderService;
this.formulaire = this.fb.group({});
}
ngOnInit() {
if (this.data.withForm) {
this.buildForm();
}
}
buildForm() {
this.formulaire = this.formBuilderService
.setViewContainerRef(this.formContainerRef)
.generateFormInView()
.form;
}
cancel() {
this.close(false);
}
close(value) {
this.mdDialogRef.close(value);
}
confirm() {
this.close(true);
}
onEsc() {
this.close(false);
}
validateFrom({ value, valid }) {
this.formBuilderService.onClickSubmit();
if (!valid)
return;
console.log("values", value);
this.close(value);
}
}
CocoringConfirmModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringConfirmModalComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1$2.UntypedFormBuilder }, { token: i2$1.MatDialogRef }, { token: FormBuilderService }], target: i0.ɵɵFactoryTarget.Component });
CocoringConfirmModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringConfirmModalComponent, selector: "cocoring-confirm-modal", host: { listeners: { "keydown.esc": "onEsc()" } }, viewQueries: [{ propertyName: "formContainerRef", first: true, predicate: ["FormContainerRef"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<div class=\"header\">\r\n <h1 mat-dialog-title>{{ data.title }}</h1>\r\n</div>\r\n<form [formGroup]=\"formulaire\" (ngSubmit)=\"validateFrom(formulaire)\">\r\n <div mat-dialog-content>\r\n <p class=\"dialog-message\" [innerHtml]=\"data.message | variableHtml\"></p>\r\n <ng-template #FormContainerRef></ng-template>\r\n </div>\r\n <div mat-dialog-actions>\r\n <button mat-button type=\"button\" (click)=\"cancel()\">{{ data.cancelText }}</button>\r\n <button *ngIf=\"data.withForm === false\" mat-button type=\"button\" (click)=\"confirm()\" cdkFocusInitial>{{\r\n data.confirmText }}</button>\r\n <button *ngIf=\"data.withForm\" mat-button type=\"submit\" cdkFocusInitial>{{ data.confirmText }}</button>\r\n </div>\r\n</form>", styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i2$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i2$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: CocoringVariableHtmlPipe, name: "variableHtml" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringConfirmModalComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cocoring-confirm-modal', template: "<div class=\"header\">\r\n <h1 mat-dialog-title>{{ data.title }}</h1>\r\n</div>\r\n<form [formGroup]=\"formulaire\" (ngSubmit)=\"validateFrom(formulaire)\">\r\n <div mat-dialog-content>\r\n <p class=\"dialog-message\" [innerHtml]=\"data.message | variableHtml\"></p>\r\n <ng-template #FormContainerRef></ng-template>\r\n </div>\r\n <div mat-dialog-actions>\r\n <button mat-button type=\"button\" (click)=\"cancel()\">{{ data.cancelText }}</button>\r\n <button *ngIf=\"data.withForm === false\" mat-button type=\"button\" (click)=\"confirm()\" cdkFocusInitial>{{\r\n data.confirmText }}</button>\r\n <button *ngIf=\"data.withForm\" mat-button type=\"submit\" cdkFocusInitial>{{ data.confirmText }}</button>\r\n </div>\r\n</form>", styles: [":host{display:block}\n"] }]
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
type: Inject,
args: [MAT_DIALOG_DATA]
}] }, { type: i1$2.UntypedFormBuilder }, { type: i2$1.MatDialogRef }, { type: FormBuilderService }]; }, propDecorators: { formContainerRef: [{
type: ViewChild,
args: ['FormContainerRef', { static: true, read: ViewContainerRef }]
}], onEsc: [{
type: HostListener,
args: ["keydown.esc"]
}] } });
class ConfirmModalService {
constructor(dialog) {
this.dialog = dialog;
}
open(options) {
this.dialogRef = this.dialog.open(CocoringConfirmModalComponent, {
data: {
withForm: options.withForm,
title: options.title,
message: options.message,
cancelText: options.cancelText,
confirmText: options.confirmText
}
});
}
confirmed() {
return this.dialogRef.afterClosed().pipe(take(1), map((res) => {
return res;
}));
}
}
ConfirmModalService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: ConfirmModalService, deps: [{ token: i2$1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
ConfirmModalService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: ConfirmModalService, providedIn: 'root' });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: ConfirmModalService, decorators: [{
type: Injectable,
args: [{
providedIn: 'root',
}]
}], ctorParameters: function () { return [{ type: i2$1.MatDialog }]; } });
class FlexLayoutService {
constructor() {
this.getAlias = (MediaChange) => {
return MediaChange[0].mqAlias;
};
}
}
FlexLayoutService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: FlexLayoutService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
FlexLayoutService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: FlexLayoutService, providedIn: 'root' });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: FlexLayoutService, decorators: [{
type: Injectable,
args: [{
providedIn: 'root'
}]
}] });
/** doc du plugin Js : https://www.cssscript.com/chrome-devtools-color-picker/ */
class CocoringColorpickerDirective {
/**
* The directive's constructor
*/
constructor(elementRef, renderer) {
this.elementRef = elementRef;
this.renderer = renderer;
this.colorChangeEmitter = new EventEmitter();
this.defaultColor = '#1ddaf7';
}
ngAfterViewInit() {
const elem = this.elementRef.nativeElement;
let picker = new ColorPicker(elem, this.color ? this.color : this.defaultColor);
fromEvent(elem, 'colorChange').pipe(debounceTime(400), map((event) => event.detail.color)).subscribe((color) => {
this.colorChangeEmitter.emit(color);
});
// elem.addEventListener('colorChange', (event: any) => {
// this.colorChangeEmitter.emit(event.detail.color);
// });
}
onClick(event) {
event.stopPropagation();
}
}
CocoringColorpickerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringColorpickerDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
CocoringColorpickerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.1", type: CocoringColorpickerDirective, selector: "[cocoring-colorpicker]", inputs: { color: ["cocoring-colorpicker", "color"] }, outputs: { colorChangeEmitter: "onColorChange" }, host: { listeners: { "click": "onClick($event)" } }, ngImport: i0 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringColorpickerDirective, decorators: [{
type: Directive,
args: [{
selector: '[cocoring-colorpicker]',
}]
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { color: [{
type: Input,
args: ['cocoring-colorpicker']
}], colorChangeEmitter: [{
type: Output,
args: ['onColorChange']
}], onClick: [{
type: HostListener,
args: ["click", ["$event"]]
}] } });
class CocoringColorpickerModule {
}
CocoringColorpickerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringColorpickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringColorpickerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringColorpickerModule, declarations: [CocoringColorpickerDirective], exports: [CocoringColorpickerDirective] });
CocoringColorpickerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringColorpickerModule });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringColorpickerModule, decorators: [{
type: NgModule,
args: [{
declarations: [CocoringColorpickerDirective],
imports: [],
exports: [CocoringColorpickerDirective]
}]
}] });
class CocoringDefaultImageDirective {
onError() {
this.src = this.default || "https://www.fortunehotels.in/images/404img.jpg";
}
}
CocoringDefaultImageDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDefaultImageDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
CocoringDefaultImageDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.1", type: CocoringDefaultImageDirective, selector: "img[default]", inputs: { default: "default", src: "src" }, host: { listeners: { "error": "onError()" }, properties: { "src": "this.src" } }, ngImport: i0 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDefaultImageDirective, decorators: [{
type: Directive,
args: [{
selector: 'img[default]',
}]
}], propDecorators: { default: [{
type: Input
}], onError: [{
type: HostListener,
args: ['error']
}], src: [{
type: HostBinding,
args: ['src']
}, {
type: Input
}] } });
class CocoringDefaultImageModule {
}
CocoringDefaultImageModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDefaultImageModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringDefaultImageModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringDefaultImageModule, declarations: [CocoringDefaultImageDirective], exports: [CocoringDefaultImageDirective] });
CocoringDefaultImageModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDefaultImageModule });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDefaultImageModule, decorators: [{
type: NgModule,
args: [{
declarations: [CocoringDefaultImageDirective],
imports: [],
exports: [CocoringDefaultImageDirective]
}]
}] });
class CocoringPreviousPageDirective {
constructor(location) {
this.location = location;
}
onClick() {
this.location.back();
}
}
CocoringPreviousPageDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringPreviousPageDirective, deps: [{ token: i1$1.Location }], target: i0.ɵɵFactoryTarget.Directive });
CocoringPreviousPageDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.1", type: CocoringPreviousPageDirective, selector: "[cocoring-previousPage]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringPreviousPageDirective, decorators: [{
type: Directive,
args: [{
selector: '[cocoring-previousPage]'
}]
}], ctorParameters: function () { return [{ type: i1$1.Location }]; }, propDecorators: { onClick: [{
type: HostListener,
args: ['click']
}] } });
class CocoringPreviousPageModule {
}
CocoringPreviousPageModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringPreviousPageModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringPreviousPageModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringPreviousPageModule, declarations: [CocoringPreviousPageDirective], exports: [CocoringPreviousPageDirective] });
CocoringPreviousPageModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringPreviousPageModule });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringPreviousPageModule, decorators: [{
type: NgModule,
args: [{
declarations: [CocoringPreviousPageDirective],
imports: [],
exports: [CocoringPreviousPageDirective]
}]
}] });
class CocoringDatagridGroupDirective {
}
CocoringDatagridGroupDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridGroupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
CocoringDatagridGroupDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.1", type: CocoringDatagridGroupDirective, selector: "[cocoring-datagrid-group]", providers: [DatagridService], ngImport: i0 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridGroupDirective, decorators: [{
type: Directive,
args: [{
selector: '[cocoring-datagrid-group]',
providers: [DatagridService]
}]
}] });
class CocoringVariableHtmlModule {
}
CocoringVariableHtmlModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringVariableHtmlModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringVariableHtmlModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringVariableHtmlModule, declarations: [CocoringVariableHtmlPipe], exports: [CocoringVariableHtmlPipe] });
CocoringVariableHtmlModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringVariableHtmlModule });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringVariableHtmlModule, decorators: [{
type: NgModule,
args: [{
declarations: [CocoringVariableHtmlPipe],
imports: [],
exports: [CocoringVariableHtmlPipe]
}]
}] });
const defaultPrecisionMap = {
octets: 0,
Ko: 0,
Mo: 1,
Go: 1,
To: 2,
Po: 2
};
/*
* Convert bytes into largest possible unit.
* Takes an precision argument that can be a number or a map for each unit.
* Usage:
* bytes | fileSize:precision
* @example
* // returns 1 KB
* {{ 1500 | fileSize }}
* @example
* // returns 2.1 GB
* {{ 2100000000 | fileSize }}
* @example
* // returns 1.46 KB
* {{ 1500 | fileSize:2 }}
*/
class CocoringFileSizePipe {
constructor() {
this.units = ['octets', 'Ko', 'Mo', 'Go', 'To', 'Po'];
}
transform(bytes = 0, precision = defaultPrecisionMap) {
if (isNaN(parseFloat(String(bytes))) || !isFinite(bytes))
return '?';
let unitIndex = 0;
while (bytes >= 1024) {
bytes /= 1024;
unitIndex++;
}
const unit = this.units[unitIndex];
if (typeof precision === 'number') {
return `${bytes.toFixed(+precision)} ${unit}`;
}
return `${bytes.toFixed(precision[unit])} ${unit}`;
}
}
CocoringFileSizePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringFileSizePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
CocoringFileSizePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringFileSizePipe, name: "fileSize" });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringFileSizePipe, decorators: [{
type: Pipe,
args: [{ name: 'fileSize' }]
}] });
class CocoringFileSizeModule {
}
CocoringFileSizeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringFileSizeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringFileSizeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringFileSizeModule, declarations: [CocoringFileSizePipe], exports: [CocoringFileSizePipe] });
CocoringFileSizeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringFileSizeModule });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringFileSizeModule, decorators: [{
type: NgModule,
args: [{
declarations: [CocoringFileSizePipe],
imports: [],
exports: [CocoringFileSizePipe]
}]
}] });
class CocoringPrettyPrintPipe {
transform(val) {
return JSON.stringify(val, undefined, 4)
.replace(/ /g, ' ')
.replace(/\n/g, '<br/>');
}
}
CocoringPrettyPrintPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringPrettyPrintPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
CocoringPrettyPrintPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringPrettyPrintPipe, name: "prettyprint" });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringPrettyPrintPipe, decorators: [{
type: Pipe,
args: [{
name: 'prettyprint'
}]
}] });
class CocoringPrettyPrintModule {
}
CocoringPrettyPrintModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringPrettyPrintModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringPrettyPrintModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringPrettyPrintModule, declarations: [CocoringPrettyPrintPipe], exports: [CocoringPrettyPrintPipe] });
CocoringPrettyPrintModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringPrettyPrintModule });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringPrettyPrintModule, decorators: [{
type: NgModule,
args: [{
declarations: [CocoringPrettyPrintPipe],
imports: [],
exports: [CocoringPrettyPrintPipe]
}]
}] });
class CocoringSanitizeUrlPipe {
constructor(sanitizer) {
this.sanitizer = sanitizer;
}
transform(url) {
return this.sanitizer.bypassSecurityTrustResourceUrl(url);
}
}
CocoringSanitizeUrlPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringSanitizeUrlPipe, deps: [{ token: i1$3.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
CocoringSanitizeUrlPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringSanitizeUrlPipe, name: "sanitizeUrl", pure: false });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringSanitizeUrlPipe, decorators: [{
type: Pipe,
args: [{
name: 'sanitizeUrl',
pure: false
}]
}], ctorParameters: function () { return [{ type: i1$3.DomSanitizer }]; } });
class CocoringSanitizeUrlModule {
}
CocoringSanitizeUrlModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringSanitizeUrlModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringSanitizeUrlModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringSanitizeUrlModule, declarations: [CocoringSanitizeUrlPipe], exports: [CocoringSanitizeUrlPipe] });
CocoringSanitizeUrlModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringSanitizeUrlModule });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringSanitizeUrlModule, decorators: [{
type: NgModule,
args: [{
declarations: [CocoringSanitizeUrlPipe],
imports: [],
exports: [CocoringSanitizeUrlPipe]
}]
}] });
class CocoringTruncatePipe {
transform(value, args) {
const limit = args.length > 0 ? parseInt(args[0], 10) : 20;
const trail = args.length > 1 ? args[1] : '...';
return value.length > limit ? value.substring(0, limit) + trail : value;
}
}
CocoringTruncatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringTruncatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
CocoringTruncatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringTruncatePipe, name: "truncate" });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringTruncatePipe, decorators: [{
type: Pipe,
args: [{
name: 'truncate'
}]
}] });
class CocoringTruncateModule {
}
CocoringTruncateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringTruncateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringTruncateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringTruncateModule, declarations: [CocoringTruncatePipe], exports: [CocoringTruncatePipe] });
CocoringTruncateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringTruncateModule });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringTruncateModule, decorators: [{
type: NgModule,
args: [{
declarations: [CocoringTruncatePipe],
imports: [],
exports: [CocoringTruncatePipe]
}]
}] });
class CocoringInputErrorModule {
}
CocoringInputErrorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringInputErrorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringInputErrorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringInputErrorModule, declarations: [CocoringInputErrorComponent], imports: [CommonModule,
MatFormFieldModule], exports: [CocoringInputErrorComponent] });
CocoringInputErrorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringInputErrorModule, imports: [CommonModule,
MatFormFieldModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringInputErrorModule, decorators: [{
type: NgModule,
args: [{
declarations: [CocoringInputErrorComponent],
imports: [
CommonModule,
MatFormFieldModule
],
exports: [CocoringInputErrorComponent]
}]
}] });
// Doc composant TinyMCE - Angular
// https://www.tiny.cloud/docs/integrations/angular/#supportedangularversions
// file : https://www.tiny.cloud/docs/demo/file-picker/
class CocoringWysiwygComponent extends ExtendInputsComponent {
constructor(injector, wysiwygService, uploaderService, cdr) {
super(injector);
this.wysiwygService = wysiwygService;
this.uploaderService = uploaderService;
this.cdr = cdr;
this.fileModel = { fileName: null, description: null };
this.height = 500;
this.inline = false;
this.menubar = true;
this.plugins = DefaultConfigComponent.wysiwyg.plugins;
this.toolbar = DefaultConfigComponent.wysiwyg.toolbar;
this.quickbarsInsert = DefaultConfigComponent.wysiwyg.quickbarsInsert;
}
set config(config) {
if (!config) {
throw new Error(`La config du composant uploader n'est pas correcte... config: ${config}`);
}
this.apiKey = config.apiKey;
this.apisFile = { apiFile: config.apiFile, apiFileDownload: config.apiFileDownload };
this.configInput(config);
this.handleParamsWysiwyg(config.params);
this.addControlForm();
}
handleParamsWysiwyg(params) {
if (!params)
return;
const height = params.height || this.height;
const inline = params.inline || this.inline;
const menubar = params.menubar || this.menubar;
const plugins = params.plugins || this.plugins;
const quickbars = params.quickbars || this.quickbarsInsert;
const toolbar = params.toolbar ? this.wysiwygService.toolbarOptionsToString(params.toolbar) : this.toolbar;
this.initParams = {
placeholder: 'Ecrivez quelque chose',
toolbar_mode: 'scrolling',
language: 'fr_FR',
resize: false,
height: height,
inline: inline,
image_advtab: true,
menubar: 'file edit insert format table tools',
// menubar: false,
toolbar: toolbar,
// toolbar: false,
contextmenu: false,
plugins: plugins,
quickbars_selection_toolbar: 'bold italic underline forecolor backcolor | fontsizeselect | alignleft | aligncenter | alignright | quicklink | removeformat',
quickbars_insert_toolbar: quickbars,
image_title: true,
automatic_uploads: true,
paste_data_images: true,
setup: editor => {
this.editor = editor;
editor.on('OpenWindow', (eventDetails) => {
this.uploadImageDialogInstance = eventDetails.dialog;
});
editor.on('init', () => { });
editor.on('change', () => { });
},
file_picker_types: 'image',
// https://www.tiny.cloud/docs/configure/file-image-upload/
file_picker_callback: (cb, value, meta) => this.filePickerCallback(cb, value, meta)
};
}
ngOnInit() {
this.uploaderService.apisFile = this.apisFile;
this.onFileUploaded();
this.onError();
this.onValueEditorChanged();
}
filePickerCallback(cb, value, meta) {
this.callbackFileUplad = cb;
var input = document.createElement('input');
input.setAttribute('type', 'file');
input.setAttribute('accept', 'image/*');
input.onchange = () => {
this.uploadImageDialogInstance.block('Uploading file...');
this.fileUploaded = input.files[0];
this.fileModel.fileName = this.fileUploaded.name;
this.cdr.detectChanges();
this.uploaderService.uploadFile(this.fileUploaded);
};
input.click();
}
onFileUploaded() {
this.uploaderService.fileUploaded$.pipe(takeUntil$1(this.destroy$), tap((id) => this.validateFileValue(id)), tap(_ => this.uploadImageDialogInstance.unblock())).subscribe();
}
onError() {
this.uploaderService.fileOnError$.pipe(takeUntil$1(this.destroy$), tap(_ => this.uploadImageDialogInstance.unblock()), tap(_ => this.uploadImageDialogInstance.close()), tap(_ => {
this.editor.notificationManager.open({
text: 'Une erreur est survenue, veuillez réessayer',
type: 'error'
});
})).subscribe();
}
onValueEditorChanged() {
this.formGroup.get(this.nameControl).valueChanges.pipe(takeUntil$1(this.destroy$), debounceTime(400), tap(_ => this.cdr.detectChanges())).subscribe();
}
validateFileValue(id) {
this.fileModel.id = id;
this.callbackFileUplad(this.apisFile.apiFile(id), { title: this.fileModel.fileName });
}
}
CocoringWysiwygComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringWysiwygComponent, deps: [{ token: i0.Injector }, { token: i1.WysiwygService }, { token: UploaderService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
CocoringWysiwygComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringWysiwygComponent, selector: "cocoring-wysiwyg", inputs: { apiKey: "apiKey", height: "height", inline: "inline", menubar: "menubar", plugins: "plugins", toolbar: "toolbar", quickbarsInsert: "quickbarsInsert", config: "config" }, providers: [WysiwygService, UploaderService], usesInheritance: true, ngImport: i0, template: "<div [formGroup]=\"formGroup\">\r\n <editor #tinymce [formControlName]=\"nameControl\" [apiKey]=\"apiKey\" [init]=\"initParams\"></editor>\r\n <mat-error *ngIf=\"formGroup.get(nameControl).errors\" error-handler [form]=\"formGroup\" [controlName]=\"nameControl\">\r\n </mat-error>\r\n</div>", styles: [":host{display:block;width:100%}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: CocoringInputErrorComponent, selector: "[error-handler]", inputs: ["form", "controlName"] }, { kind: "component", type: i6.EditorComponent, selector: "editor", inputs: ["cloudChannel", "apiKey", "init", "id", "initialValue", "outputFormat", "inline", "tagName", "plugins", "toolbar", "modelEvents", "allowedEvents", "ignoreEvents", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringWysiwygComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cocoring-wysiwyg', providers: [WysiwygService, UploaderService], template: "<div [formGroup]=\"formGroup\">\r\n <editor #tinymce [formControlName]=\"nameControl\" [apiKey]=\"apiKey\" [init]=\"initParams\"></editor>\r\n <mat-error *ngIf=\"formGroup.get(nameControl).errors\" error-handler [form]=\"formGroup\" [controlName]=\"nameControl\">\r\n </mat-error>\r\n</div>", styles: [":host{display:block;width:100%}\n"] }]
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1.WysiwygService }, { type: UploaderService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { apiKey: [{
type: Input
}], height: [{
type: Input
}], inline: [{
type: Input
}], menubar: [{
type: Input
}], plugins: [{
type: Input
}], toolbar: [{
type: Input
}], quickbarsInsert: [{
type: Input
}], config: [{
type: Input
}] } });
class CocoringWysiwygModule {
}
CocoringWysiwygModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringWysiwygModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringWysiwygModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringWysiwygModule, declarations: [CocoringWysiwygComponent], imports: [CommonModule,
ReactiveFormsModule,
CocoringInputErrorModule,
EditorModule], exports: [CocoringWysiwygComponent] });
CocoringWysiwygModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringWysiwygModule, imports: [CommonModule,
ReactiveFormsModule,
CocoringInputErrorModule,
EditorModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringWysiwygModule, decorators: [{
type: NgModule,
args: [{
declarations: [
CocoringWysiwygComponent
],
imports: [
CommonModule,
ReactiveFormsModule,
CocoringInputErrorModule,
EditorModule,
],
exports: [
CocoringWysiwygComponent
],
}]
}] });
// https://medium.com/@abshakekumar/snackbar-angular-material-component-with-multiple-actions-88ea3a9d3ddd
class ToastErrorStacktraceComponent {
constructor(matSnackBar, data) {
this.matSnackBar = matSnackBar;
this.data = data;
this.toggleVisibility = true;
this.errorDebugMessages = [];
}
ngOnInit() {
this.errorDebugMessages = this.data.stacktrace?.httpError?.error?.debug?.messages;
}
afficheCache() {
this.toggleVisibility = !this.toggleVisibility;
}
close(event) {
this.matSnackBar.dismiss();
event.preventDefault();
}
trackBy(index) {
return index;
}
}
ToastErrorStacktraceComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: ToastErrorStacktraceComponent, deps: [{ token: i1$4.MatSnackBar }, { token: MAT_SNACK_BAR_DATA }], target: i0.ɵɵFactoryTarget.Component });
ToastErrorStacktraceComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: ToastErrorStacktraceComponent, selector: "toast-error-stacktrace", ngImport: i0, template: "<div class=\"notification-containeur\">\r\n <div class=\"container-messages\">\r\n <div>{{data.message}}</div>\r\n <div *ngIf=\"data.stacktrace\" class=\"link-plus\" (click)=\"afficheCache()\" title=\"Afficher / masquer les d\u00E9tails techniques de l'erreur\">\r\n\r\n <div class=\"__link-plus\" *ngIf=\"toggleVisibility; else templateMoins\">\r\n <div>afficher plus de d\u00E9tails</div>\r\n <mat-icon>expand_more</mat-icon>\r\n </div>\r\n <ng-template #templateMoins>\r\n <div class=\"__link-plus\">\r\n <div>masquer les d\u00E9tails</div>\r\n <mat-icon>expand_less</mat-icon>\r\n </div>\r\n </ng-template>\r\n </div>\r\n <div *ngIf=\"!toggleVisibility\" class=\"stacktrace\">\r\n <div>Date : {{data.stacktrace.dateError}}</div>\r\n <div>Status : {{data.stacktrace.httpError?.status}} - Id : {{data.stacktrace.httpError?.error.id}}</div>\r\n <div *ngIf=\"errorDebugMessages.length\">\r\n <div *ngFor=\"let message of errorDebugMessages; let i = index; trackBy: trackBy\">{{message}}</div>\r\n </div>\r\n <div>\r\n {{data.stacktrace.httpError?.message}}\r\n </div>\r\n </div>\r\n </div>\r\n <button mat-button type=\"button\" class=\"mat-button\" (click)=\"close($event)\">\r\n <span class=\"mat-button-wrapper\">Fermer</span>\r\n <div class=\"mat-button-ripple mat-ripple\"></div>\r\n <div class=\"mat-button-focus-overlay\"></div>\r\n </button>\r\n</div>", styles: [".notification-containeur{display:flex;justify-content:space-between;align-items:center}.notification-containeur .container-messages{width:80%}.link-plus{font-size:12px;text-align:center;margin-top:3px;color:#fff}.link-plus .__link-plus{cursor:pointer;display:flex;align-items:center;justify-content:center}.link-plus .__link-plus .mat-icon{font-size:12px;height:12px}.stacktrace{color:#fff;font-size:12px;word-break:break-all;margin-top:10px;line-height:13px;padding:5px;max-height:70px;overflow-y:auto}.mat-button,.mat-flat-button,.mat-icon-button,.mat-stroked-button{box-sizing:border-box;position:relative;-webkit-user-select:none;user-select:none;cursor:pointer;outline:0;border:none;-webkit-tap-highlight-color:transparent;display:inline-block;white-space:nowrap;text-decoration:none;vertical-align:baseline;text-align:center;margin:0 0 0 8px;min-width:64px;line-height:36px;padding:0 16px;border-radius:4px;overflow:visible}.mat-ripple{overflow:hidden;position:relative}.mat-button .mat-button-focus-overlay{opacity:.1}.mat-button:hover .mat-button-focus-overlay{opacity:.2}.mat-button-focus-overlay{transition:opacity .2s cubic-bezier(.35,0,.25,1),background-color .2s cubic-bezier(.35,0,.25,1)}.mat-button-focus-overlay,.mat-button-ripple.mat-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none;border-radius:inherit}.mat-button-focus-overlay{background:#000}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: ToastErrorStacktraceComponent, decorators: [{
type: Component,
args: [{ selector: 'toast-error-stacktrace', template: "<div class=\"notification-containeur\">\r\n <div class=\"container-messages\">\r\n <div>{{data.message}}</div>\r\n <div *ngIf=\"data.stacktrace\" class=\"link-plus\" (click)=\"afficheCache()\" title=\"Afficher / masquer les d\u00E9tails techniques de l'erreur\">\r\n\r\n <div class=\"__link-plus\" *ngIf=\"toggleVisibility; else templateMoins\">\r\n <div>afficher plus de d\u00E9tails</div>\r\n <mat-icon>expand_more</mat-icon>\r\n </div>\r\n <ng-template #templateMoins>\r\n <div class=\"__link-plus\">\r\n <div>masquer les d\u00E9tails</div>\r\n <mat-icon>expand_less</mat-icon>\r\n </div>\r\n </ng-template>\r\n </div>\r\n <div *ngIf=\"!toggleVisibility\" class=\"stacktrace\">\r\n <div>Date : {{data.stacktrace.dateError}}</div>\r\n <div>Status : {{data.stacktrace.httpError?.status}} - Id : {{data.stacktrace.httpError?.error.id}}</div>\r\n <div *ngIf=\"errorDebugMessages.length\">\r\n <div *ngFor=\"let message of errorDebugMessages; let i = index; trackBy: trackBy\">{{message}}</div>\r\n </div>\r\n <div>\r\n {{data.stacktrace.httpError?.message}}\r\n </div>\r\n </div>\r\n </div>\r\n <button mat-button type=\"button\" class=\"mat-button\" (click)=\"close($event)\">\r\n <span class=\"mat-button-wrapper\">Fermer</span>\r\n <div class=\"mat-button-ripple mat-ripple\"></div>\r\n <div class=\"mat-button-focus-overlay\"></div>\r\n </button>\r\n</div>", styles: [".notification-containeur{display:flex;justify-content:space-between;align-items:center}.notification-containeur .container-messages{width:80%}.link-plus{font-size:12px;text-align:center;margin-top:3px;color:#fff}.link-plus .__link-plus{cursor:pointer;display:flex;align-items:center;justify-content:center}.link-plus .__link-plus .mat-icon{font-size:12px;height:12px}.stacktrace{color:#fff;font-size:12px;word-break:break-all;margin-top:10px;line-height:13px;padding:5px;max-height:70px;overflow-y:auto}.mat-button,.mat-flat-button,.mat-icon-button,.mat-stroked-button{box-sizing:border-box;position:relative;-webkit-user-select:none;user-select:none;cursor:pointer;outline:0;border:none;-webkit-tap-highlight-color:transparent;display:inline-block;white-space:nowrap;text-decoration:none;vertical-align:baseline;text-align:center;margin:0 0 0 8px;min-width:64px;line-height:36px;padding:0 16px;border-radius:4px;overflow:visible}.mat-ripple{overflow:hidden;position:relative}.mat-button .mat-button-focus-overlay{opacity:.1}.mat-button:hover .mat-button-focus-overlay{opacity:.2}.mat-button-focus-overlay{transition:opacity .2s cubic-bezier(.35,0,.25,1),background-color .2s cubic-bezier(.35,0,.25,1)}.mat-button-focus-overlay,.mat-button-ripple.mat-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none;border-radius:inherit}.mat-button-focus-overlay{background:#000}\n"] }]
}], ctorParameters: function () { return [{ type: i1$4.MatSnackBar }, { type: undefined, decorators: [{
type: Inject,
args: [MAT_SNACK_BAR_DATA]
}] }]; } });
class ToastErrorStacktraceModule {
}
ToastErrorStacktraceModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: ToastErrorStacktraceModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
ToastErrorStacktraceModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: ToastErrorStacktraceModule, declarations: [ToastErrorStacktraceComponent], imports: [CommonModule,
MatIconModule], exports: [ToastErrorStacktraceComponent] });
ToastErrorStacktraceModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: ToastErrorStacktraceModule, imports: [CommonModule,
MatIconModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: ToastErrorStacktraceModule, decorators: [{
type: NgModule,
args: [{
declarations: [ToastErrorStacktraceComponent],
imports: [
CommonModule,
MatIconModule,
],
exports: [ToastErrorStacktraceComponent]
}]
}] });
class CocoringConfirmModalModule {
}
CocoringConfirmModalModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringConfirmModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringConfirmModalModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringConfirmModalModule, declarations: [CocoringConfirmModalComponent], imports: [CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatDialogModule,
MatButtonModule,
CocoringVariableHtmlModule,
CocoringInputErrorModule], exports: [CocoringConfirmModalComponent] });
CocoringConfirmModalModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringConfirmModalModule, imports: [CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatDialogModule,
MatButtonModule,
CocoringVariableHtmlModule,
CocoringInputErrorModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringConfirmModalModule, decorators: [{
type: NgModule,
args: [{
declarations: [
CocoringConfirmModalComponent,
],
imports: [
CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatDialogModule,
MatButtonModule,
CocoringVariableHtmlModule,
CocoringInputErrorModule,
],
exports: [
CocoringConfirmModalComponent,
]
}]
}] });
class CocoringButtonsGroupComponent {
constructor(formBuilderService) {
this.formBuilderService = formBuilderService;
}
set config(buttonsSchema) {
this.buttonsContainerRef.clear();
if (!buttonsSchema)
return;
console.log("current form", this.formBuilderService.form);
console.log("schemaDatasButtons", buttonsSchema);
if (buttonsSchema && buttonsSchema.length) {
this.buildView(buttonsSchema);
}
}
ngOnInit() {
}
buildView(buttons) {
const formBuilder = this.formBuilderService
.setViewContainerRef(this.buttonsContainerRef);
buttons.forEach((configSchema) => {
formBuilder
.addButton(configSchema.text, config => config
.isTypeSubmit(configSchema.submit)
.outputCallback(this.buttonAddCallback.bind(this)));
});
}
buttonAddCallback(nameControl) {
console.log("Bouton ajouté avec succès : ", nameControl);
}
}
CocoringButtonsGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringButtonsGroupComponent, deps: [{ token: FormBuilderService }], target: i0.ɵɵFactoryTarget.Component });
CocoringButtonsGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringButtonsGroupComponent, selector: "cocoring-buttons-group", inputs: { config: "config" }, viewQueries: [{ propertyName: "buttonsContainerRef", first: true, predicate: ["ButtonsContainerRef"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<ng-template #ButtonsContainerRef></ng-template>\r\n" });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringButtonsGroupComponent, decorators: [{
type: Component,
args: [{ selector: 'cocoring-buttons-group', template: "<ng-template #ButtonsContainerRef></ng-template>\r\n" }]
}], ctorParameters: function () { return [{ type: FormBuilderService }]; }, propDecorators: { buttonsContainerRef: [{
type: ViewChild,
args: ['ButtonsContainerRef', { static: true, read: ViewContainerRef }]
}], config: [{
type: Input
}] } });
class CocoringButtonsGroupModule {
}
CocoringButtonsGroupModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringButtonsGroupModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringButtonsGroupModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringButtonsGroupModule, declarations: [CocoringButtonsGroupComponent], exports: [CocoringButtonsGroupComponent] });
CocoringButtonsGroupModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringButtonsGroupModule });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringButtonsGroupModule, decorators: [{
type: NgModule,
args: [{
declarations: [CocoringButtonsGroupComponent],
imports: [],
exports: [CocoringButtonsGroupComponent]
}]
}] });
class InputIconModule {
}
InputIconModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: InputIconModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
InputIconModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: InputIconModule, declarations: [InputIconComponent], imports: [CommonModule,
MatButtonModule,
MatIconModule], exports: [InputIconComponent] });
InputIconModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: InputIconModule, imports: [CommonModule,
MatButtonModule,
MatIconModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: InputIconModule, decorators: [{
type: NgModule,
args: [{
declarations: [
InputIconComponent
],
imports: [
CommonModule,
MatButtonModule,
MatIconModule,
],
exports: [
InputIconComponent
]
}]
}] });
class CocoringCheckboxModule {
}
CocoringCheckboxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringCheckboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringCheckboxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringCheckboxModule, declarations: [CocoringCheckboxComponent], imports: [CommonModule,
ReactiveFormsModule,
MatCheckboxModule,
MatFormFieldModule,
CocoringInputErrorModule,
CocoringVariableHtmlModule], exports: [CocoringCheckboxComponent] });
CocoringCheckboxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringCheckboxModule, imports: [CommonModule,
ReactiveFormsModule,
MatCheckboxModule,
MatFormFieldModule,
CocoringInputErrorModule,
CocoringVariableHtmlModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringCheckboxModule, decorators: [{
type: NgModule,
args: [{
declarations: [
CocoringCheckboxComponent,
],
imports: [
CommonModule,
ReactiveFormsModule,
MatCheckboxModule,
MatFormFieldModule,
CocoringInputErrorModule,
CocoringVariableHtmlModule,
],
exports: [
CocoringCheckboxComponent,
]
}]
}] });
class CocoringCheckboxIndeterminateModule {
}
CocoringCheckboxIndeterminateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringCheckboxIndeterminateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringCheckboxIndeterminateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringCheckboxIndeterminateModule, declarations: [CocoringCheckboxIndeterminateComponent], imports: [CommonModule,
FormsModule,
ReactiveFormsModule,
MatCheckboxModule,
MatFormFieldModule,
CocoringInputErrorModule], exports: [CocoringCheckboxIndeterminateComponent] });
CocoringCheckboxIndeterminateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringCheckboxIndeterminateModule, imports: [CommonModule,
FormsModule,
ReactiveFormsModule,
MatCheckboxModule,
MatFormFieldModule,
CocoringInputErrorModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringCheckboxIndeterminateModule, decorators: [{
type: NgModule,
args: [{
declarations: [
CocoringCheckboxIndeterminateComponent,
],
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
MatCheckboxModule,
MatFormFieldModule,
CocoringInputErrorModule,
],
exports: [
CocoringCheckboxIndeterminateComponent,
]
}]
}] });
class CocoringDateModule {
}
CocoringDateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringDateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringDateModule, declarations: [CocoringDateComponent], imports: [CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
MatDatepickerModule,
CocoringInputErrorModule,
InputIconModule, i8.NgxMaskModule], exports: [CocoringDateComponent] });
CocoringDateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDateModule, imports: [CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
MatDatepickerModule,
CocoringInputErrorModule,
InputIconModule,
NgxMaskModule.forRoot()] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDateModule, decorators: [{
type: NgModule,
args: [{
declarations: [
CocoringDateComponent,
],
imports: [
CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
MatDatepickerModule,
CocoringInputErrorModule,
InputIconModule,
NgxMaskModule.forRoot(),
],
exports: [
CocoringDateComponent,
]
}]
}] });
class CocoringSlideToggleModule {
}
CocoringSlideToggleModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringSlideToggleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringSlideToggleModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringSlideToggleModule, declarations: [CocoringSlideToggleComponent], imports: [CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
MatSlideToggleModule,
CocoringInputErrorModule], exports: [CocoringSlideToggleComponent] });
CocoringSlideToggleModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringSlideToggleModule, imports: [CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
MatSlideToggleModule,
CocoringInputErrorModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringSlideToggleModule, decorators: [{
type: NgModule,
args: [{
declarations: [
CocoringSlideToggleComponent,
],
imports: [
CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
MatSlideToggleModule,
CocoringInputErrorModule,
],
exports: [
CocoringSlideToggleComponent,
]
}]
}] });
class CocoringEmailModule {
}
CocoringEmailModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringEmailModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringEmailModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringEmailModule, declarations: [CocoringEmailComponent], imports: [CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
CocoringInputErrorModule,
InputIconModule], exports: [CocoringEmailComponent] });
CocoringEmailModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringEmailModule, imports: [CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
CocoringInputErrorModule,
InputIconModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringEmailModule, decorators: [{
type: NgModule,
args: [{
declarations: [
CocoringEmailComponent,
],
imports: [
CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
CocoringInputErrorModule,
InputIconModule,
],
exports: [
CocoringEmailComponent,
]
}]
}] });
class CocoringNumberModule {
}
CocoringNumberModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringNumberModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringNumberModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringNumberModule, declarations: [CocoringNumberComponent], imports: [CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
CocoringInputErrorModule,
InputIconModule], exports: [CocoringNumberComponent] });
CocoringNumberModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringNumberModule, imports: [CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
CocoringInputErrorModule,
InputIconModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringNumberModule, decorators: [{
type: NgModule,
args: [{
declarations: [
CocoringNumberComponent,
],
imports: [
CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
CocoringInputErrorModule,
InputIconModule,
],
exports: [
CocoringNumberComponent,
]
}]
}] });
class CocoringPasswordModule {
}
CocoringPasswordModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringPasswordModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringPasswordModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringPasswordModule, declarations: [CocoringPasswordComponent], imports: [CommonModule,
ReactiveFormsModule,
InputIconModule,
MatFormFieldModule,
MatButtonModule,
MatIconModule,
MatInputModule,
CocoringInputErrorModule], exports: [CocoringPasswordComponent] });
CocoringPasswordModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringPasswordModule, imports: [CommonModule,
ReactiveFormsModule,
InputIconModule,
MatFormFieldModule,
MatButtonModule,
MatIconModule,
MatInputModule,
CocoringInputErrorModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringPasswordModule, decorators: [{
type: NgModule,
args: [{
declarations: [
CocoringPasswordComponent,
],
imports: [
CommonModule,
ReactiveFormsModule,
InputIconModule,
MatFormFieldModule,
MatButtonModule,
MatIconModule,
MatInputModule,
CocoringInputErrorModule,
],
exports: [
CocoringPasswordComponent
]
}]
}] });
class CocoringSelectModule {
}
CocoringSelectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringSelectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringSelectModule, declarations: [CocoringSelectComponent], imports: [CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatSelectModule,
CocoringInputErrorModule,
InputIconModule], exports: [CocoringSelectComponent] });
CocoringSelectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringSelectModule, imports: [CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatSelectModule,
CocoringInputErrorModule,
InputIconModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringSelectModule, decorators: [{
type: NgModule,
args: [{
declarations: [CocoringSelectComponent],
imports: [
CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatSelectModule,
CocoringInputErrorModule,
InputIconModule,
],
exports: [CocoringSelectComponent]
}]
}] });
class CocoringTextModule {
}
CocoringTextModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringTextModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringTextModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringTextModule, declarations: [CocoringTextComponent], imports: [CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
CocoringInputErrorModule,
InputIconModule], exports: [CocoringTextComponent] });
CocoringTextModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringTextModule, imports: [CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
CocoringInputErrorModule,
InputIconModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringTextModule, decorators: [{
type: NgModule,
args: [{
declarations: [
CocoringTextComponent,
],
imports: [
CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
CocoringInputErrorModule,
InputIconModule
],
exports: [CocoringTextComponent]
}]
}] });
class CocoringTextareaModule {
}
CocoringTextareaModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringTextareaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringTextareaModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringTextareaModule, declarations: [CocoringTextareaComponent], imports: [CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
CocoringInputErrorModule,
InputIconModule], exports: [CocoringTextareaComponent] });
CocoringTextareaModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringTextareaModule, imports: [CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
CocoringInputErrorModule,
InputIconModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringTextareaModule, decorators: [{
type: NgModule,
args: [{
declarations: [CocoringTextareaComponent],
imports: [
CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
CocoringInputErrorModule,
InputIconModule
],
exports: [CocoringTextareaComponent]
}]
}] });
class CocoringViewerModule {
}
CocoringViewerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringViewerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringViewerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringViewerModule, declarations: [CocoringViewerComponent], imports: [CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
CocoringInputErrorModule], exports: [CocoringViewerComponent] });
CocoringViewerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringViewerModule, imports: [CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
CocoringInputErrorModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringViewerModule, decorators: [{
type: NgModule,
args: [{
declarations: [CocoringViewerComponent],
imports: [
CommonModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
CocoringInputErrorModule,
],
exports: [CocoringViewerComponent]
}]
}] });
class CocoringFormContainerComponent {
constructor(fb, formBuilderService, mappingBuilderService) {
this.fb = fb;
this.formBuilderService = formBuilderService;
this.mappingBuilderService = mappingBuilderService;
this.objectCommand = {};
this.destroy$ = new Subject();
this.onComponentReady = new EventEmitter();
this.onSubmit = new EventEmitter();
this.formBuilderService.newForm();
}
set config(formSchema) {
if (!formSchema)
return;
this.schemaDatasForm = formSchema.form;
/** todo: filtrer les boutons associés au formulaire en entrée */
const schemaDatasButtons = formSchema.buttons || [];
this.schemaDatasButtons = this.filterButtonsAssociatedToForm(this.schemaDatasForm, "name", schemaDatasButtons, "formName");
this.formBuilderService.newForm();
this.formContainerRef.clear();
this.initEventFormBuilded();
this.buildCurrentForm();
}
ngOnDestroy() {
this.destroy$.next(undefined);
this.destroy$.complete();
}
buildCurrentForm() {
const formBuilder = this.formBuilderService
.identityForm(this.schemaDatasForm.id, this.schemaDatasForm.name)
.setViewContainerRef(this.formContainerRef);
this.schemaDatasForm.fields.forEach((field) => {
formBuilder.addInput(field.name, config => config
.nameLabel(field.label)
.inRelationWith(field.inRelationWith)
.dataSource(field.dataSource)
.typeInput(field.type));
});
/** todo: Utiliser une variable ou direct l'objet */
this.currentForm = this.formBuilderService.form;
}
/** lorsque tous les composants ont été initialisés avec succès */
initEventFormBuilded() {
this.formBuildedSubject = new Subject();
let formFieldsAdded = 0;
this.formBuildedSubject.pipe(takeUntil(this.destroy$)).subscribe((isBuilded) => {
formFieldsAdded++;
if (formFieldsAdded === this.schemaDatasForm.fields.length) {
this.onComponentReady.emit(true);
}
});
}
/** composant aijouté au formulaire angular */
childAdded(nameControl) {
console.log("input ajouté avec succès : ", nameControl);
this.formBuildedSubject.next(true);
}
validateForm({ value, valid }) {
if (valid) {
const mappedValues = this.mapFormValues(value);
this.onSubmit.emit({ rawValues: value, mappedValues: mappedValues });
}
}
filterButtonsAssociatedToForm(objA, keyA, objB, keyB) {
const tabOfB = [];
objB.forEach((B) => {
if (B[keyB] === objA[keyA]) {
tabOfB.push(B);
}
});
return tabOfB;
}
mapFormValues(valueForm) {
const commandMappings = this.schemaDatasButtons
.find((button) => button.submit === true)
?.commandMappings;
this.mappingBuilderService.init();
this.mappingBuilderService.setNameForm = this.schemaDatasForm.name;
this.mappingBuilderService.valuesForm = valueForm;
commandMappings.forEach((mapping) => {
this.mappingBuilderService.map(mapping);
});
console.log("mapping result", this.mappingBuilderService.getMapping());
return this.mappingBuilderService.getMapping();
}
}
CocoringFormContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringFormContainerComponent, deps: [{ token: i1$2.UntypedFormBuilder }, { token: FormBuilderService }, { token: i1.MappingBuilderService }], target: i0.ɵɵFactoryTarget.Component });
CocoringFormContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringFormContainerComponent, selector: "cocoring-form-container", inputs: { config: "config" }, outputs: { onComponentReady: "onComponentReady", onSubmit: "onSubmit" }, providers: [FormBuilderService, MappingBuilderService], viewQueries: [{ propertyName: "formContainerRef", first: true, predicate: ["FormContainerRef"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<!-- utilier ngTemplateOutlet ex: https://blog.bitsrc.io/component-reusability-techniques-with-angular-727a6c603ad2 -->\r\n\r\n<form [formGroup]=\"currentForm\" (ngSubmit)=\"validateForm(currentForm)\">\r\n <h1>{{formBuilderService.formName}}</h1>\r\n <ng-template #FormContainerRef></ng-template>\r\n <cocoring-buttons-group *ngIf=\"schemaDatasButtons.length\" [config]=\"schemaDatasButtons\"></cocoring-buttons-group>\r\n</form>", dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: CocoringButtonsGroupComponent, selector: "cocoring-buttons-group", inputs: ["config"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringFormContainerComponent, decorators: [{
type: Component,
args: [{ selector: 'cocoring-form-container', providers: [FormBuilderService, MappingBuilderService], template: "<!-- utilier ngTemplateOutlet ex: https://blog.bitsrc.io/component-reusability-techniques-with-angular-727a6c603ad2 -->\r\n\r\n<form [formGroup]=\"currentForm\" (ngSubmit)=\"validateForm(currentForm)\">\r\n <h1>{{formBuilderService.formName}}</h1>\r\n <ng-template #FormContainerRef></ng-template>\r\n <cocoring-buttons-group *ngIf=\"schemaDatasButtons.length\" [config]=\"schemaDatasButtons\"></cocoring-buttons-group>\r\n</form>" }]
}], ctorParameters: function () { return [{ type: i1$2.UntypedFormBuilder }, { type: FormBuilderService }, { type: i1.MappingBuilderService }]; }, propDecorators: { formContainerRef: [{
type: ViewChild,
args: ['FormContainerRef', { static: true, read: ViewContainerRef }]
}], config: [{
type: Input
}], onComponentReady: [{
type: Output
}], onSubmit: [{
type: Output
}] } });
class CocoringFormContainerModule {
}
CocoringFormContainerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringFormContainerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringFormContainerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringFormContainerModule, declarations: [CocoringFormContainerComponent], imports: [CommonModule,
ReactiveFormsModule,
CocoringButtonsGroupModule], exports: [CocoringFormContainerComponent] });
CocoringFormContainerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringFormContainerModule, imports: [CommonModule,
ReactiveFormsModule,
CocoringButtonsGroupModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringFormContainerModule, decorators: [{
type: NgModule,
args: [{
declarations: [CocoringFormContainerComponent],
imports: [
CommonModule,
ReactiveFormsModule,
CocoringButtonsGroupModule
],
exports: [CocoringFormContainerComponent]
}]
}] });
class CocoringButtonModule {
}
CocoringButtonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringButtonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringButtonModule, declarations: [CocoringButtonComponent], imports: [CommonModule,
MatIconModule,
MatButtonModule], exports: [CocoringButtonComponent] });
CocoringButtonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringButtonModule, imports: [CommonModule,
MatIconModule,
MatButtonModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringButtonModule, decorators: [{
type: NgModule,
args: [{
declarations: [CocoringButtonComponent],
imports: [
CommonModule,
MatIconModule,
MatButtonModule
],
exports: [CocoringButtonComponent]
}]
}] });
class CocoringButtonLinkModule {
}
CocoringButtonLinkModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringButtonLinkModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringButtonLinkModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringButtonLinkModule, declarations: [CocoringButtonLinkComponent], imports: [CommonModule,
RouterModule,
MatIconModule,
MatButtonModule,
CocoringButtonModule], exports: [CocoringButtonLinkComponent] });
CocoringButtonLinkModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringButtonLinkModule, imports: [CommonModule,
RouterModule,
MatIconModule,
MatButtonModule,
CocoringButtonModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringButtonLinkModule, decorators: [{
type: NgModule,
args: [{
declarations: [CocoringButtonLinkComponent],
imports: [
CommonModule,
RouterModule,
MatIconModule,
MatButtonModule,
CocoringButtonModule,
],
exports: [CocoringButtonLinkComponent]
}]
}] });
class CocoringUploaderBottomSheetComponent {
constructor(injectComponentService, _bottomSheetRef, data) {
this.injectComponentService = injectComponentService;
this._bottomSheetRef = _bottomSheetRef;
this.data = data;
}
ngOnInit() {
this.addContent();
}
addContent() {
if (!this.data.component)
return;
this.injectComponentService.loadAndAddComponentToContainer(this.data.component, this.containerRef, { file: this.data.file, apisFile: this.data.apisFile }, { callback: (action) => this.callback(action) });
}
callback(action) {
this._bottomSheetRef.dismiss(action);
}
close() {
this._bottomSheetRef.dismiss();
}
}
CocoringUploaderBottomSheetComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringUploaderBottomSheetComponent, deps: [{ token: i1.InjectComponentService }, { token: i2$2.MatBottomSheetRef }, { token: MAT_BOTTOM_SHEET_DATA }], target: i0.ɵɵFactoryTarget.Component });
CocoringUploaderBottomSheetComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringUploaderBottomSheetComponent, selector: "cocoring-uploader-bottom-sheet", viewQueries: [{ propertyName: "containerRef", first: true, predicate: ["ContainerRef"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<!-- <div class=\"button-container\">\r\n <button mat-fab color=\"accent\" aria-label=\"Ouvrir le fichier\" (click)=\"close()\">\r\n <mat-icon>attach_file</mat-icon>\r\n </button>\r\n</div> -->\r\n<div class=\"bottom-sheet-header\">\r\n <button class=\"actions-header-modal\" mat-icon-button aria-label=\"Fermer le menu\" (click)=\"close()\">\r\n <mat-icon>keyboard_arrow_down</mat-icon>\r\n </button>\r\n <div class=\"header-part-right\">\r\n <div class=\"description-file\">{{data.file.description}}</div>\r\n <div class=\"date-upload\" *ngIf=\"data.file.dateUpload\">\r\n <span>{{data.file.dateUpload | date: 'dd/MM/yyyy, HH:mm':'':'fr-FR'}}</span>\r\n </div>\r\n <div class=\"description\"> \r\n <div class=\"filename\">{{data.file.fileName}}</div>\r\n <div class=\"description-size\">{{data.file.size | fileSize:2}}</div>\r\n </div>\r\n </div>\r\n</div>\r\n<ng-template #ContainerRef></ng-template>", styles: [":host{display:block}.description{font-size:12px;margin-top:3px;display:flex;align-items:center;justify-content:space-between}.description .description-size{margin-left:15px}.date-upload{display:flex;align-items:center;font-size:12px;margin-top:3px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: i1$1.DatePipe, name: "date" }, { kind: "pipe", type: CocoringFileSizePipe, name: "fileSize" }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringUploaderBottomSheetComponent, decorators: [{
type: Component,
args: [{ selector: 'cocoring-uploader-bottom-sheet', template: "<!-- <div class=\"button-container\">\r\n <button mat-fab color=\"accent\" aria-label=\"Ouvrir le fichier\" (click)=\"close()\">\r\n <mat-icon>attach_file</mat-icon>\r\n </button>\r\n</div> -->\r\n<div class=\"bottom-sheet-header\">\r\n <button class=\"actions-header-modal\" mat-icon-button aria-label=\"Fermer le menu\" (click)=\"close()\">\r\n <mat-icon>keyboard_arrow_down</mat-icon>\r\n </button>\r\n <div class=\"header-part-right\">\r\n <div class=\"description-file\">{{data.file.description}}</div>\r\n <div class=\"date-upload\" *ngIf=\"data.file.dateUpload\">\r\n <span>{{data.file.dateUpload | date: 'dd/MM/yyyy, HH:mm':'':'fr-FR'}}</span>\r\n </div>\r\n <div class=\"description\"> \r\n <div class=\"filename\">{{data.file.fileName}}</div>\r\n <div class=\"description-size\">{{data.file.size | fileSize:2}}</div>\r\n </div>\r\n </div>\r\n</div>\r\n<ng-template #ContainerRef></ng-template>", styles: [":host{display:block}.description{font-size:12px;margin-top:3px;display:flex;align-items:center;justify-content:space-between}.description .description-size{margin-left:15px}.date-upload{display:flex;align-items:center;font-size:12px;margin-top:3px}\n"] }]
}], ctorParameters: function () { return [{ type: i1.InjectComponentService }, { type: i2$2.MatBottomSheetRef }, { type: undefined, decorators: [{
type: Inject,
args: [MAT_BOTTOM_SHEET_DATA]
}] }]; }, propDecorators: { containerRef: [{
type: ViewChild,
args: ['ContainerRef', { static: true, read: ViewContainerRef }]
}] } });
class CocoringUploaderFileActionsComponent {
constructor() {
this.callback = new EventEmitter();
}
ngOnInit() {
this.setFileApi();
this.setFileDownloadApi();
}
setFileApi() {
this.apiFile = this.apisFile.apiFile(this.file.id);
}
setFileDownloadApi() {
this.apiFileDownload = this.apisFile.apiFileDownload(this.file.id);
}
actionFile(event, action) {
this.close(action);
event.preventDefault();
}
close(action) {
this.callback.emit(action);
}
}
CocoringUploaderFileActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringUploaderFileActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
CocoringUploaderFileActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringUploaderFileActionsComponent, selector: "cocoring-uploader-file-actions", inputs: { file: "file", apisFile: "apisFile" }, outputs: { callback: "callback" }, ngImport: i0, template: "<mat-nav-list class=\"list\">\r\n <a [href]=\"apiFile\" target=\"_blank\" mat-list-item (click)=\"close()\">\r\n <mat-icon mat-list-icon>visibility</mat-icon>\r\n <span mat-line>Ouvrir le fichier</span>\r\n </a>\r\n\r\n <a [href]=\"apiFileDownload\" mat-list-item (click)=\"close()\">\r\n <mat-icon mat-list-icon>get_app</mat-icon>\r\n <span mat-line>T\u00E9l\u00E9charger le fichier</span>\r\n </a>\r\n\r\n <a href=\"#\" mat-list-item (click)=\"actionFile($event, 'browse')\">\r\n <mat-icon mat-list-icon>upload_file</mat-icon>\r\n <span mat-line>S\u00E9lectionner un nouveau fichier</span>\r\n </a>\r\n\r\n <a href=\"#\" mat-list-item (click)=\"actionFile($event, 'remove')\">\r\n <mat-icon mat-list-icon>delete_outline</mat-icon>\r\n <span mat-line>Supprimer le fichier</span>\r\n </a>\r\n</mat-nav-list>", styles: [":host{display:block}.list{padding:8px 16px}\n"], dependencies: [{ kind: "component", type: i1$5.MatNavList, selector: "mat-nav-list", inputs: ["disableRipple", "disabled"], exportAs: ["matNavList"] }, { kind: "component", type: i1$5.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["disableRipple", "disabled"], exportAs: ["matListItem"] }, { kind: "directive", type: i5$2.MatLine, selector: "[mat-line], [matLine]" }, { kind: "directive", type: i1$5.MatListIconCssMatStyler, selector: "[mat-list-icon], [matListIcon]" }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringUploaderFileActionsComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cocoring-uploader-file-actions', template: "<mat-nav-list class=\"list\">\r\n <a [href]=\"apiFile\" target=\"_blank\" mat-list-item (click)=\"close()\">\r\n <mat-icon mat-list-icon>visibility</mat-icon>\r\n <span mat-line>Ouvrir le fichier</span>\r\n </a>\r\n\r\n <a [href]=\"apiFileDownload\" mat-list-item (click)=\"close()\">\r\n <mat-icon mat-list-icon>get_app</mat-icon>\r\n <span mat-line>T\u00E9l\u00E9charger le fichier</span>\r\n </a>\r\n\r\n <a href=\"#\" mat-list-item (click)=\"actionFile($event, 'browse')\">\r\n <mat-icon mat-list-icon>upload_file</mat-icon>\r\n <span mat-line>S\u00E9lectionner un nouveau fichier</span>\r\n </a>\r\n\r\n <a href=\"#\" mat-list-item (click)=\"actionFile($event, 'remove')\">\r\n <mat-icon mat-list-icon>delete_outline</mat-icon>\r\n <span mat-line>Supprimer le fichier</span>\r\n </a>\r\n</mat-nav-list>", styles: [":host{display:block}.list{padding:8px 16px}\n"] }]
}], ctorParameters: function () { return []; }, propDecorators: { file: [{
type: Input
}], apisFile: [{
type: Input
}], callback: [{
type: Output
}] } });
class CocoringUploaderListFileComponent {
constructor(dialog, uploaderService, _bottomSheet, cdr) {
this.dialog = dialog;
this.uploaderService = uploaderService;
this._bottomSheet = _bottomSheet;
this.cdr = cdr;
this.isUploading = false;
this.onError = false;
this.destroy$ = new Subject();
}
ngOnInit() {
this.addFileControl();
this.uploaderService.fileUploaded$.pipe(takeUntil$1(this.destroy$), tap((id) => this.validateFileValue(id)), tap(_ => this.cdr.detectChanges()), debounceTime(500), tap(_ => this.isUploading = false), tap(_ => this.setFileApi()), tap(_ => this.cdr.detectChanges())).subscribe();
this.uploaderService.fileOnError$.pipe(takeUntil$1(this.destroy$), tap(_ => this.errorFile())).subscribe();
this.uploaderService.progressSource.pipe(takeUntil$1(this.destroy$), filter(_ => !!this.fileUploaded), tap((progress) => {
this.progress = progress;
const circumference = this.progressCircleRef.nativeElement.getTotalLength();
this.progressCircleRef.nativeElement.style.strokeDashoffset = circumference - (progress / 100) * circumference;
this.cdr.detectChanges();
})).subscribe();
}
ngOnDestroy() {
this.destroy$.next(undefined);
this.destroy$.complete();
}
setFileApi() {
this.apiFile = this.apisFile.apiFile(this.fileModel.id);
}
emitFiles(event) {
const file = event && event.item(0);
if (!file)
return;
this.isUploading = true;
this.onError = false;
this.fileUploaded = file;
this.fileModel.fileName = this.fileUploaded.name;
this.fileModel.size = this.fileUploaded.size;
this.fileModel.mimeType = this.fileUploaded.type;
this.fileType = HelperUploaderService.checkTypeImage(this.fileUploaded.type) ? 'image' : 'doc';
this.cdr.detectChanges();
this.uploaderService.uploadFile(this.fileUploaded);
}
errorFile() {
this.isUploading = false;
this.removeFile();
this.onError = true;
this.cdr.detectChanges();
}
openMenuOrBrowse() {
if (this.fileModel.id) {
this.openBottomSheet();
}
else {
this.browseFile();
}
}
openBottomSheet() {
const bottomSheet = this._bottomSheet.open(CocoringUploaderBottomSheetComponent, {
panelClass: 'bottom-sheet-container',
data: {
file: this.fileModel,
apisFile: this.apisFile,
component: CocoringUploaderFileActionsComponent
}
});
bottomSheet.afterDismissed().pipe(takeUntil$1(this.destroy$)).subscribe((action) => {
switch (action) {
case 'browse':
this.browseFile();
break;
case 'remove':
this.removeFile();
break;
default:
break;
}
});
}
browseFile() {
let el = this.uploaderInputRef.nativeElement;
el.click();
}
removeFile() {
this.removeFromFormArray();
this.fileUploaded = null;
this.fileModel.id = null;
this.fileModel.fileName = null;
this.fileType = null;
this.uploaderInputRef.nativeElement.value = '';
}
removeFromFormArray() {
/** supprime le formControl et donc sa valeur du tableau de fichier du formulaure */
if (this.fileModel.id) {
this.upoaderFormArray.removeAt(this.upoaderFormArray.value.findIndex(fileId => fileId === this.fileModel.id));
}
}
/** create control and add it to the formGroup. Will store id of the file */
addFileControl() {
this.uploaderService.apisFile = this.apisFile;
this.upoaderFormArray = this.formGroup.get(this.nameControl);
this.fileFormControl = new UntypedFormControl(null);
if (this.fileModel.id) {
// this.fileType = HelperUploaderService.checkTypeImage(this.fileModel.mimeType) ? 'image' : 'doc'
this.fileFormControl.setValue(this.fileModel.id);
this.upoaderFormArray.push(this.fileFormControl);
this.setFileApi();
}
}
/** store the file id */
validateFileValue(id) {
this.removeFromFormArray();
this.fileModel.id = id;
this.fileModel.dateUpload = new Date();
this.fileFormControl.setValue(id);
this.upoaderFormArray.push(this.fileFormControl);
}
}
CocoringUploaderListFileComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringUploaderListFileComponent, deps: [{ token: i2$1.MatDialog }, { token: UploaderService }, { token: i2$2.MatBottomSheet }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
CocoringUploaderListFileComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringUploaderListFileComponent, selector: "cocoring-uploader-list-file", inputs: { formGroup: "formGroup", nameControl: "nameControl", fileModel: "fileModel", apisFile: "apisFile" }, host: { listeners: { "change": "emitFiles($event.target.files)" } }, providers: [UploaderService], viewQueries: [{ propertyName: "uploaderInputRef", first: true, predicate: ["uploader"], descendants: true }, { propertyName: "progressCircleRef", first: true, predicate: ["progressCircle"], descendants: true }], ngImport: i0, template: "<mat-list-option id=\"optionList\" [value]=\"fileModel.id\" (click)=\"openMenuOrBrowse()\">\r\n <ng-container *ngIf=\"!isUploading\">\r\n <div *ngIf=\"!fileModel.id\">\r\n <button class=\"file-doc\" mat-fab disableRipple=\"true\" aria-label=\"Joindre un fichier\">\r\n <mat-icon [ngClass]=\"{'fileOnError error': onError}\">upload_file</mat-icon>\r\n </button>\r\n </div>\r\n\r\n <div *ngIf=\"fileType === 'doc'\">\r\n <button class=\"file-doc\" mat-fab disableRipple=\"true\" aria-label=\"\">\r\n <mat-icon>attach_file</mat-icon>\r\n </button>\r\n </div>\r\n\r\n <div *ngIf=\"fileType === 'image'\" class=\"file-image\"\r\n [ngStyle]=\"{'background-image': 'url(' + apiFile}\">\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"isUploading\">\r\n <div class=\"loading-container\">\r\n <svg class=\"progress\" width=\"65\" height=\"60\">\r\n <circle #progressCircle class=\"progress-circle\" cx=\"26\" cy=\"33\" r=\"25\" fill=\"transparent\" />\r\n <text class=\"loading\" fill=\"blue\" x=\"50\" y=\"50\" alignment-baseline=\"middle\" text-anchor=\"middle\"></text>\r\n </svg>\r\n </div>\r\n </ng-container>\r\n\r\n <div class=\"mat-list-text\">\r\n <div mat-line [ngClass]=\"{'fileOnError error': onError}\">\r\n <span *ngIf=\"fileModel.id\" title=\"{{fileModel.fileName}}\">{{fileModel.fileName}}</span>\r\n <span *ngIf=\"!fileModel.id\" title=\"{{fileModel.description}}\">{{fileModel.description}}</span>\r\n </div>\r\n\r\n <ng-template [ngIf]=\"!isUploading\" [ngIfElse]=\"uploadTpl\">\r\n <div class=\"subtext\" mat-line>\r\n <span *ngIf=\"fileModel?.id\">{{fileModel.size | fileSize:2}}</span>\r\n <span *ngIf=\"!fileModel?.id && !onError\" title=\"Cliquez pour d\u00E9poser votre fichier ici\"> Cliquez pour d\u00E9poser votre fichier ici</span>\r\n <span *ngIf=\"!fileModel?.id && onError\" class=\"fileOnError error\" title=\"Une erreur est survenue, veuillez\r\n r\u00E9essayer\">Une erreur est survenue, veuillez\r\n r\u00E9essayer</span>\r\n </div>\r\n </ng-template>\r\n\r\n <ng-template #uploadTpl>\r\n <div mat-line class=\"progress-bar\">\r\n <mat-progress-bar [value]=\"progress\"></mat-progress-bar>\r\n </div>\r\n </ng-template>\r\n </div>\r\n\r\n</mat-list-option>\r\n\r\n<input #uploader hidden class=\"browse-file\" type=\"file\" name=\"fileUpload\" accept=\"*\" />", styles: [":host{display:block}::ng-deep .mat-list-item-content>.mat-list-text{flex-direction:row!important;align-items:center}.subtext{font-size:13px!important;opacity:.5}.fileOnError{font-weight:500}.progress-bar{height:20px;display:flex!important;align-items:center}.progress-circle{stroke-width:2;stroke:#000;stroke-dasharray:157;stroke-dashoffset:157}.file-image{flex:none;width:50px;height:50px;margin-right:16px!important;border-radius:50%;box-sizing:content-box;background-repeat:no-repeat;background-size:cover;background-position:center;position:relative}.file-doc{box-shadow:none;margin-right:16px;width:50px;height:50px}.file-doc ::ng-deep .mat-button-wrapper{padding:0}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i5$2.MatLine, selector: "[mat-line], [matLine]" }, { kind: "component", type: i1$5.MatListOption, selector: "mat-list-option", inputs: ["disableRipple", "checkboxPosition", "color", "value", "disabled", "selected"], outputs: ["selectedChange"], exportAs: ["matListOption"] }, { kind: "component", type: i7.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: CocoringFileSizePipe, name: "fileSize" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringUploaderListFileComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cocoring-uploader-list-file', providers: [UploaderService], template: "<mat-list-option id=\"optionList\" [value]=\"fileModel.id\" (click)=\"openMenuOrBrowse()\">\r\n <ng-container *ngIf=\"!isUploading\">\r\n <div *ngIf=\"!fileModel.id\">\r\n <button class=\"file-doc\" mat-fab disableRipple=\"true\" aria-label=\"Joindre un fichier\">\r\n <mat-icon [ngClass]=\"{'fileOnError error': onError}\">upload_file</mat-icon>\r\n </button>\r\n </div>\r\n\r\n <div *ngIf=\"fileType === 'doc'\">\r\n <button class=\"file-doc\" mat-fab disableRipple=\"true\" aria-label=\"\">\r\n <mat-icon>attach_file</mat-icon>\r\n </button>\r\n </div>\r\n\r\n <div *ngIf=\"fileType === 'image'\" class=\"file-image\"\r\n [ngStyle]=\"{'background-image': 'url(' + apiFile}\">\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"isUploading\">\r\n <div class=\"loading-container\">\r\n <svg class=\"progress\" width=\"65\" height=\"60\">\r\n <circle #progressCircle class=\"progress-circle\" cx=\"26\" cy=\"33\" r=\"25\" fill=\"transparent\" />\r\n <text class=\"loading\" fill=\"blue\" x=\"50\" y=\"50\" alignment-baseline=\"middle\" text-anchor=\"middle\"></text>\r\n </svg>\r\n </div>\r\n </ng-container>\r\n\r\n <div class=\"mat-list-text\">\r\n <div mat-line [ngClass]=\"{'fileOnError error': onError}\">\r\n <span *ngIf=\"fileModel.id\" title=\"{{fileModel.fileName}}\">{{fileModel.fileName}}</span>\r\n <span *ngIf=\"!fileModel.id\" title=\"{{fileModel.description}}\">{{fileModel.description}}</span>\r\n </div>\r\n\r\n <ng-template [ngIf]=\"!isUploading\" [ngIfElse]=\"uploadTpl\">\r\n <div class=\"subtext\" mat-line>\r\n <span *ngIf=\"fileModel?.id\">{{fileModel.size | fileSize:2}}</span>\r\n <span *ngIf=\"!fileModel?.id && !onError\" title=\"Cliquez pour d\u00E9poser votre fichier ici\"> Cliquez pour d\u00E9poser votre fichier ici</span>\r\n <span *ngIf=\"!fileModel?.id && onError\" class=\"fileOnError error\" title=\"Une erreur est survenue, veuillez\r\n r\u00E9essayer\">Une erreur est survenue, veuillez\r\n r\u00E9essayer</span>\r\n </div>\r\n </ng-template>\r\n\r\n <ng-template #uploadTpl>\r\n <div mat-line class=\"progress-bar\">\r\n <mat-progress-bar [value]=\"progress\"></mat-progress-bar>\r\n </div>\r\n </ng-template>\r\n </div>\r\n\r\n</mat-list-option>\r\n\r\n<input #uploader hidden class=\"browse-file\" type=\"file\" name=\"fileUpload\" accept=\"*\" />", styles: [":host{display:block}::ng-deep .mat-list-item-content>.mat-list-text{flex-direction:row!important;align-items:center}.subtext{font-size:13px!important;opacity:.5}.fileOnError{font-weight:500}.progress-bar{height:20px;display:flex!important;align-items:center}.progress-circle{stroke-width:2;stroke:#000;stroke-dasharray:157;stroke-dashoffset:157}.file-image{flex:none;width:50px;height:50px;margin-right:16px!important;border-radius:50%;box-sizing:content-box;background-repeat:no-repeat;background-size:cover;background-position:center;position:relative}.file-doc{box-shadow:none;margin-right:16px;width:50px;height:50px}.file-doc ::ng-deep .mat-button-wrapper{padding:0}\n"] }]
}], ctorParameters: function () { return [{ type: i2$1.MatDialog }, { type: UploaderService }, { type: i2$2.MatBottomSheet }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { uploaderInputRef: [{
type: ViewChild,
args: ['uploader']
}], progressCircleRef: [{
type: ViewChild,
args: ['progressCircle']
}], formGroup: [{
type: Input
}], nameControl: [{
type: Input
}], fileModel: [{
type: Input
}], apisFile: [{
type: Input
}], emitFiles: [{
type: HostListener,
args: ['change', ['$event.target.files']]
}] } });
class CocoringUploaderComponent extends ExtendInputsComponent {
constructor(injector) {
super(injector);
}
set config(config) {
if (!config) {
throw new Error(`La config du composant uploader n'est pas correcte... config: ${config}`);
}
this.configInput(config);
this.addArrayForm();
this.apisFile = { apiFile: config.apiFile, apiFileDownload: config.apiFileDownload };
}
ngOnInit() { }
ngOnDestroy() { }
}
CocoringUploaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringUploaderComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
CocoringUploaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringUploaderComponent, selector: "cocoring-uploader", inputs: { config: "config" }, usesInheritance: true, ngImport: i0, template: "<div class=\"upload-drop\">\r\n <mat-selection-list [multiple]=\"false\">\r\n <div mat-subheader>{{nameLabel}}</div>\r\n <ng-container *ngIf=\"dataSource$ | async as files; else loadingTpl\">\r\n <cocoring-uploader-list-file *ngFor=\"let file of files\" [formGroup]=\"formGroup\" [nameControl]=\"nameControl\"\r\n [apisFile]=\"apisFile\" [fileModel]=\"file\">\r\n </cocoring-uploader-list-file>\r\n </ng-container>\r\n <ng-template #loadingTpl>\r\n <div class=\"fake-list-file\" *ngFor=\"let i of [].constructor(2)\">\r\n <div class=\"fake-icon loading-animation\"></div>\r\n <div class=\"fake-file-infos\">\r\n <div class=\"fake-info info-name loading-animation\"></div>\r\n <div class=\"fake-info loading-animation\"></div>\r\n </div>\r\n </div>\r\n </ng-template>\r\n <!-- #todo: normalement pas n\u00E9cessaire ce ngIf, mais l\u00E0 le message ne dispara\u00EEt pas... -->\r\n <mat-error *ngIf=\"formGroup.get(nameControl).errors\" error-handler [form]=\"formGroup\" [controlName]=\"nameControl\">\r\n </mat-error>\r\n </mat-selection-list>\r\n <!-- {{formGroup.get(nameControl).value | json}} -->\r\n</div>", styles: [":host{display:block}.upload-drop{width:100%}.fake-list-file{max-width:300px;padding:16px;display:flex;align-items:center}.fake-list-file .fake-icon{height:27px;width:27px;margin-left:5px;border-radius:50%}.fake-list-file .fake-file-infos{display:flex;flex-direction:column;margin:0 20px;flex:1}.fake-list-file .fake-file-infos .fake-info{height:16px}.fake-list-file .fake-file-infos .fake-info.info-name{margin-bottom:5px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$5.MatListSubheaderCssMatStyler, selector: "[mat-subheader], [matSubheader]" }, { kind: "component", type: i1$5.MatSelectionList, selector: "mat-selection-list", inputs: ["disableRipple", "color", "compareWith", "disabled", "multiple"], outputs: ["selectionChange"], exportAs: ["matSelectionList"] }, { kind: "directive", type: i3$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: CocoringInputErrorComponent, selector: "[error-handler]", inputs: ["form", "controlName"] }, { kind: "component", type: CocoringUploaderListFileComponent, selector: "cocoring-uploader-list-file", inputs: ["formGroup", "nameControl", "fileModel", "apisFile"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringUploaderComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cocoring-uploader', template: "<div class=\"upload-drop\">\r\n <mat-selection-list [multiple]=\"false\">\r\n <div mat-subheader>{{nameLabel}}</div>\r\n <ng-container *ngIf=\"dataSource$ | async as files; else loadingTpl\">\r\n <cocoring-uploader-list-file *ngFor=\"let file of files\" [formGroup]=\"formGroup\" [nameControl]=\"nameControl\"\r\n [apisFile]=\"apisFile\" [fileModel]=\"file\">\r\n </cocoring-uploader-list-file>\r\n </ng-container>\r\n <ng-template #loadingTpl>\r\n <div class=\"fake-list-file\" *ngFor=\"let i of [].constructor(2)\">\r\n <div class=\"fake-icon loading-animation\"></div>\r\n <div class=\"fake-file-infos\">\r\n <div class=\"fake-info info-name loading-animation\"></div>\r\n <div class=\"fake-info loading-animation\"></div>\r\n </div>\r\n </div>\r\n </ng-template>\r\n <!-- #todo: normalement pas n\u00E9cessaire ce ngIf, mais l\u00E0 le message ne dispara\u00EEt pas... -->\r\n <mat-error *ngIf=\"formGroup.get(nameControl).errors\" error-handler [form]=\"formGroup\" [controlName]=\"nameControl\">\r\n </mat-error>\r\n </mat-selection-list>\r\n <!-- {{formGroup.get(nameControl).value | json}} -->\r\n</div>", styles: [":host{display:block}.upload-drop{width:100%}.fake-list-file{max-width:300px;padding:16px;display:flex;align-items:center}.fake-list-file .fake-icon{height:27px;width:27px;margin-left:5px;border-radius:50%}.fake-list-file .fake-file-infos{display:flex;flex-direction:column;margin:0 20px;flex:1}.fake-list-file .fake-file-infos .fake-info{height:16px}.fake-list-file .fake-file-infos .fake-info.info-name{margin-bottom:5px}\n"] }]
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { config: [{
type: Input
}] } });
class CocoringUploaderModule {
}
CocoringUploaderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringUploaderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringUploaderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringUploaderModule, declarations: [CocoringUploaderComponent,
CocoringUploaderListFileComponent,
CocoringUploaderFileActionsComponent,
CocoringUploaderBottomSheetComponent], imports: [CommonModule,
DragDropModule,
CocoringFileSizeModule,
ReactiveFormsModule,
MatListModule,
MatFormFieldModule,
MatMenuModule,
MatProgressBarModule,
MatDialogModule,
MatBottomSheetModule,
MatInputModule,
MatIconModule,
MatButtonModule,
CocoringInputErrorModule,
CocoringButtonModule], exports: [CocoringUploaderComponent] });
CocoringUploaderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringUploaderModule, imports: [CommonModule,
DragDropModule,
CocoringFileSizeModule,
ReactiveFormsModule,
MatListModule,
MatFormFieldModule,
MatMenuModule,
MatProgressBarModule,
MatDialogModule,
MatBottomSheetModule,
MatInputModule,
MatIconModule,
MatButtonModule,
CocoringInputErrorModule,
CocoringButtonModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringUploaderModule, decorators: [{
type: NgModule,
args: [{
declarations: [
CocoringUploaderComponent,
CocoringUploaderListFileComponent,
CocoringUploaderFileActionsComponent,
CocoringUploaderBottomSheetComponent,
],
imports: [
CommonModule,
DragDropModule,
CocoringFileSizeModule,
ReactiveFormsModule,
MatListModule,
MatFormFieldModule,
MatMenuModule,
MatProgressBarModule,
MatDialogModule,
MatBottomSheetModule,
MatInputModule,
MatIconModule,
MatButtonModule,
CocoringInputErrorModule,
CocoringButtonModule,
],
exports: [
CocoringUploaderComponent
],
}]
}] });
class CocoringDatagridCellComponent {
constructor(locale, datagridService) {
this.locale = locale;
this.datagridService = datagridService;
this.cellIsArchived = false;
}
set cell(value) {
this._cell = value;
this.formatCellValue();
this.checkIfCellIsArchived();
}
ngOnInit() { }
formatCellValue() {
this.cellValue = this._cell.dataType === 'date' ? formatDate(this._cell.value, 'dd/MM/yyyy', this.locale) : this._cell.value;
}
checkIfCellIsArchived() {
this.cellIsArchived = this._cell.dataField === this.datagridService.config.propIsArchived;
}
}
CocoringDatagridCellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridCellComponent, deps: [{ token: LOCALE_ID }, { token: DatagridService }], target: i0.ɵɵFactoryTarget.Component });
CocoringDatagridCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringDatagridCellComponent, selector: "cocoring-datagrid-cell", inputs: { cell: "cell" }, ngImport: i0, template: "<ng-container *ngIf=\"_cell && _cell.visible\">\r\n <td [attr.data-label]=\"_cell.caption\" [title]=\"cellValue\" [ngSwitch]=\"_cell.dataType\">\r\n <div *ngSwitchCase=\"'boolean'\" class=\"valTrue\">\r\n <mat-icon *ngIf=\"cellValue\">check</mat-icon>\r\n </div>\r\n <div *ngSwitchDefault>{{cellValue}}</div>\r\n </td>\r\n</ng-container>", styles: [":host{display:contents}.valTrue{height:22px}.valTrue .mat-icon{font-size:19px;height:19px;width:19px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i1$1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridCellComponent, decorators: [{
type: Component,
args: [{ selector: 'cocoring-datagrid-cell', template: "<ng-container *ngIf=\"_cell && _cell.visible\">\r\n <td [attr.data-label]=\"_cell.caption\" [title]=\"cellValue\" [ngSwitch]=\"_cell.dataType\">\r\n <div *ngSwitchCase=\"'boolean'\" class=\"valTrue\">\r\n <mat-icon *ngIf=\"cellValue\">check</mat-icon>\r\n </div>\r\n <div *ngSwitchDefault>{{cellValue}}</div>\r\n </td>\r\n</ng-container>", styles: [":host{display:contents}.valTrue{height:22px}.valTrue .mat-icon{font-size:19px;height:19px;width:19px}\n"] }]
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
type: Inject,
args: [LOCALE_ID]
}] }, { type: DatagridService }]; }, propDecorators: { cell: [{
type: Input
}] } });
class CocoringDatagridRowComponent {
constructor(fb, cdr) {
this.fb = fb;
this.cdr = cdr;
this.columns = [];
this.cellValues = [];
this.destroy$ = new Subject();
}
set datas(datas) {
this._datas = datas;
this.addCheckboxRow();
this.initCellsValues();
}
ngOnInit() {
this.eventAllCheckboxesChecked();
this.onUpdateColumn();
this.onReOrderColumns();
}
ngOnDestroy() {
this.destroy$.next(undefined);
this.destroy$.complete();
}
/** ajouter le contrôle checkbox de la ligne dans le formulaire */
addCheckboxRow() {
const checkboxesFormControlArray = this.datagridService.checkboxesDatagridForm.get("rowsCheckbox");
this.checkboxRowFormGroup = this.fb.group({});
this.checkboxRowFormGroup.addControl(this._datas.id, this.fb.control(false));
checkboxesFormControlArray.push(this.checkboxRowFormGroup);
this.checkboxRowFormGroup.get(this._datas.id).valueChanges.pipe(takeUntil$1(this.destroy$)).subscribe((checkValue) => {
this.datagridService.storeIdsRowsSelected(this._datas, checkValue);
});
}
initCellsValues() {
this.columns.forEach((column) => {
this.cellValues.push({
dataField: column.dataField,
caption: column.caption,
visible: column.visible,
dataType: column.dataType,
value: this.getDatasourceValue(column.dataField)
});
});
}
onUpdateColumn() {
this.datagridService.updateColumn$.pipe(takeUntil$1(this.destroy$), tap((columnUpdated) => {
this.cellValues
.find((cell) => cell.dataField === columnUpdated.dataField)
.visible = columnUpdated.visible;
}), tap(_ => this.cdr.detectChanges())).subscribe();
}
onReOrderColumns() {
this.datagridService.reOrderColumns$.pipe(takeUntil$1(this.destroy$), tap((columnUpdated) => {
this.cellValues.splice(columnUpdated.currentIndex, 0, this.cellValues.splice(columnUpdated.previousIndex, 1)[0]);
}), tap(_ => this.cdr.detectChanges())).subscribe();
}
eventAllCheckboxesChecked() {
this.datagridService.allRowsChecked$.pipe(takeUntil$1(this.destroy$)).subscribe((value) => {
this.checkboxRowFormGroup.get(this._datas.id).setValue(value);
});
}
getDatasourceValue(column) {
return this._datas.hasOwnProperty(column) ? this._datas[column] : null;
}
selectRow() {
this.datagridService.rowSelectedByClickEvent$.next(this._datas);
}
trackBy(index) {
return index;
}
}
CocoringDatagridRowComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridRowComponent, deps: [{ token: i1$2.UntypedFormBuilder }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
CocoringDatagridRowComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringDatagridRowComponent, selector: "cocoring-datagrid-row", inputs: { columns: "columns", datas: "datas", datagridService: "datagridService" }, ngImport: i0, template: "<tr (click)=\"selectRow()\">\r\n <ng-container *ngFor=\"let cell of cellValues; let i = index; trackBy: trackBy\">\r\n <!-- <ng-container *ngIf=\"datagridService.config.withBatchProcessing\"> -->\r\n <ng-container>\r\n <td class=\"column-select\" *ngIf=\"i===0\">\r\n <cocoring-checkbox [formGroup]=\"checkboxRowFormGroup\" [nameControl]=\"_datas.id\" color=\"warn\">\r\n </cocoring-checkbox>\r\n </td>\r\n </ng-container>\r\n <cocoring-datagrid-cell [cell]=\"cell\"></cocoring-datagrid-cell>\r\n </ng-container>\r\n</tr>", styles: [":host{display:contents;cursor:pointer}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: CocoringCheckboxComponent, selector: "cocoring-checkbox", inputs: ["config"] }, { kind: "component", type: CocoringDatagridCellComponent, selector: "cocoring-datagrid-cell", inputs: ["cell"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridRowComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cocoring-datagrid-row', template: "<tr (click)=\"selectRow()\">\r\n <ng-container *ngFor=\"let cell of cellValues; let i = index; trackBy: trackBy\">\r\n <!-- <ng-container *ngIf=\"datagridService.config.withBatchProcessing\"> -->\r\n <ng-container>\r\n <td class=\"column-select\" *ngIf=\"i===0\">\r\n <cocoring-checkbox [formGroup]=\"checkboxRowFormGroup\" [nameControl]=\"_datas.id\" color=\"warn\">\r\n </cocoring-checkbox>\r\n </td>\r\n </ng-container>\r\n <cocoring-datagrid-cell [cell]=\"cell\"></cocoring-datagrid-cell>\r\n </ng-container>\r\n</tr>", styles: [":host{display:contents;cursor:pointer}\n"] }]
}], ctorParameters: function () { return [{ type: i1$2.UntypedFormBuilder }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { columns: [{
type: Input
}], datas: [{
type: Input
}], datagridService: [{
type: Input
}] } });
class SortColumnExtendComponent {
constructor(injector) {
this.shiftKey = false;
this.colFiltered = false;
this.destroy$ = new Subject();
this.cdr = injector.get(ChangeDetectorRef);
}
ngOnDestroy() {
this.destroy$.next(undefined);
this.destroy$.complete();
}
onInitColumn() {
this.isFiltered();
this.datagridService.resetColumnExcept$.pipe(takeUntil$1(this.destroy$), filter((datafieldException) => datafieldException !== this.column.dataField), tap(_ => this.column.sort = 'NONE'), tap(_ => this.cdr.detectChanges())).subscribe();
this.datagridService.updateColumn$.pipe(takeUntil$1(this.destroy$), filter((columnUpdated) => columnUpdated.dataField === this.column.dataField), tap((columnUpdated) => this.column = columnUpdated), tap(_ => this.isFiltered()), tap(_ => this.cdr.detectChanges())).subscribe();
}
isFiltered() {
this.colFiltered = false;
if (this.column.dataType === 'boolean') {
let filters = this.column.filters;
if (!filters.selectAll && (filters.nestedValues.allSelected || filters.nestedValues.noSelected)) {
this.colFiltered = true;
}
}
}
onShiftPressed($event) {
if ($event.shiftKey) {
this.shiftKey = true;
}
}
onShiftReleased($event) {
if ($event.code === "ShiftLeft") {
this.shiftKey = false;
}
}
sort() {
if (!this.shiftKey)
this.datagridService.resetColumnExcept$.next(this.column.dataField);
let newSortValue = 'NONE';
if (!this.column.sort || this.column.sort === 'NONE')
newSortValue = 'ASC';
else if (this.column.sort === 'ASC')
newSortValue = 'DESC';
else
newSortValue = 'NONE';
this.column.sort = newSortValue;
this.datagridService.updateColumn$.next(this.column);
this.datagridService.refreshNeeded$.next();
}
}
SortColumnExtendComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: SortColumnExtendComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
SortColumnExtendComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: SortColumnExtendComponent, selector: "ng-component", inputs: { datagridService: "datagridService", column: "column" }, host: { listeners: { "window:keydown": "onShiftPressed($event)", "window:keyup": "onShiftReleased($event)" } }, ngImport: i0, template: '', isInline: true });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: SortColumnExtendComponent, decorators: [{
type: Component,
args: [{
selector: '',
template: ''
}]
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { datagridService: [{
type: Input
}], column: [{
type: Input
}], onShiftPressed: [{
type: HostListener,
args: ['window:keydown', ['$event']]
}], onShiftReleased: [{
type: HostListener,
args: ['window:keyup', ['$event']]
}] } });
class CocoringDatagridHeadComponent extends SortColumnExtendComponent {
constructor(injector) {
super(injector);
}
ngOnInit() {
this.onInitColumn();
}
}
CocoringDatagridHeadComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridHeadComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
CocoringDatagridHeadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringDatagridHeadComponent, selector: "cocoring-datagrid-head", inputs: { column: "column", datagridService: "datagridService" }, usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"column.visible\">\r\n <th scope=\"col\" [title]=\"column.caption\" (click)=\"sort()\">\r\n <div class=\"column-table-header\">\r\n <mat-icon *ngIf=\"colFiltered\" class=\"isFiltered\">filter_alt</mat-icon>\r\n <div class=\"column-caption\">{{column.caption}}</div>\r\n <!-- <div *ngIf=\"column.sort && column.sort !== 'NONE'\"> -->\r\n <!-- <button mat-icon-button title=\"Inverser le tri\" aria-label=\"Inverser le tri\"> -->\r\n <ng-container *ngIf=\"column.sort && column.sort !== 'NONE'\">\r\n <mat-icon *ngIf=\"column.sort === 'ASC'\">arrow_upward</mat-icon>\r\n <mat-icon *ngIf=\"column.sort === 'DESC'\">arrow_downward</mat-icon>\r\n </ng-container>\r\n <!-- </button> -->\r\n <!-- </div> -->\r\n </div>\r\n </th>\r\n</ng-container>", styles: [":host{display:contents}.column-caption{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridHeadComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cocoring-datagrid-head', template: "<ng-container *ngIf=\"column.visible\">\r\n <th scope=\"col\" [title]=\"column.caption\" (click)=\"sort()\">\r\n <div class=\"column-table-header\">\r\n <mat-icon *ngIf=\"colFiltered\" class=\"isFiltered\">filter_alt</mat-icon>\r\n <div class=\"column-caption\">{{column.caption}}</div>\r\n <!-- <div *ngIf=\"column.sort && column.sort !== 'NONE'\"> -->\r\n <!-- <button mat-icon-button title=\"Inverser le tri\" aria-label=\"Inverser le tri\"> -->\r\n <ng-container *ngIf=\"column.sort && column.sort !== 'NONE'\">\r\n <mat-icon *ngIf=\"column.sort === 'ASC'\">arrow_upward</mat-icon>\r\n <mat-icon *ngIf=\"column.sort === 'DESC'\">arrow_downward</mat-icon>\r\n </ng-container>\r\n <!-- </button> -->\r\n <!-- </div> -->\r\n </div>\r\n </th>\r\n</ng-container>", styles: [":host{display:contents}.column-caption{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}\n"] }]
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { column: [{
type: Input
}], datagridService: [{
type: Input
}] } });
class CocoringDatagridComponent {
constructor(fb, cdr, odata, datagridService) {
this.fb = fb;
this.cdr = cdr;
this.odata = odata;
this.datagridService = datagridService;
this.forceFullWidth = true;
this.totalRowsSaved = 5;
this.destroy$ = new Subject();
this.eventClickRow = new EventEmitter();
this.eventRowsDeleted = new EventEmitter();
this.eventRowsRestored = new EventEmitter();
}
ngOnDestroy() {
this.destroy$.next(undefined);
this.destroy$.complete();
}
set config(config) {
if (!config) {
throw new Error(`La config du datgrid n'est pas correcte... config: ${config}`);
}
this.datagridService.config = config;
this.loadDataSource();
this.onReOrderColumns();
this.onRowSelected();
this.onRowsDeletedRestored();
}
refreshDatagrid() {
this.datagridService.refreshNeeded$.next();
}
loadDataSource() {
const emptySearch$ = this.datagridService.refreshNeeded$.pipe(debounceTime(400), tap(_ => this.datagridDataSource = null), tap(_ => {
/** on désactive la case à cocher qui permet de sélectionner / désélectionner toutes les lignes du tableau */
this.datagridService.checkboxesDatagridForm.get("selectAllRowsCheckbox").setValue(false, { emitEvent: false });
}), tap(_ => this.datagridService.checkUncheckAllRows(false)), tap(_ => this.cdr.detectChanges()), switchMap(() => this.datagridService.getAllDatas()));
merge(this.datagridService.getAllDatas(), emptySearch$).pipe(takeUntil$1(this.destroy$), map((results) => {
this.odata.setDatasource(results);
this.datagridDataSource = this.odata;
this.cdr.detectChanges();
}),
// tap(_ => this.totalRowsSaved = this.datagridDataSource.getResults().length),
tap(_ => this.totalRowsSaved = this.datagridDataSource.getCount()), tap(_ => this.datagridService.lengthDataSource(this.totalRowsSaved))).subscribe();
}
/** re order cellValues array */
onReOrderColumns() {
this.datagridService.reOrderColumns$.pipe(takeUntil$1(this.destroy$), tap(_ => this.cdr.detectChanges())).subscribe();
}
onRowSelected() {
this.datagridService.rowSelectedByClickEvent$.pipe(takeUntil$1(this.destroy$), tap((rowDatas) => this.eventClickRow.emit(rowDatas))).subscribe();
}
onRowsDeletedRestored() {
this.datagridService.rowsDeletedEvent$.pipe(takeUntil$1(this.destroy$), tap(_ => this.eventRowsDeleted.emit(this.datagridService.rowsSelectedDatagrid))).subscribe();
this.datagridService.rowsRestoredEvent$.pipe(takeUntil$1(this.destroy$), tap(_ => this.eventRowsRestored.emit(this.datagridService.rowsSelectedDatagrid))).subscribe();
}
trackBy(item, index) {
return `${item.id}-${index}`;
}
}
CocoringDatagridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridComponent, deps: [{ token: i1$2.UntypedFormBuilder }, { token: i0.ChangeDetectorRef }, { token: i1.OdataClass }, { token: DatagridService }], target: i0.ɵɵFactoryTarget.Component });
CocoringDatagridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringDatagridComponent, selector: "cocoring-datagrid", inputs: { config: "config" }, outputs: { eventClickRow: "eventClickRow", eventRowsDeleted: "eventRowsDeleted", eventRowsRestored: "eventRowsRestored" }, host: { properties: { "class.table-full-width": "this.forceFullWidth" } }, providers: [OdataClass], ngImport: i0, template: "<ng-container *ngIf=\"datagridService.config\">\r\n <!-- <cocoring-datagrid-toolbar></cocoring-datagrid-toolbar> -->\r\n <div class=\"datagrid-container\">\r\n <table [formGroup]=\"datagridService.checkboxesDatagridForm\">\r\n <thead>\r\n <tr>\r\n <!-- <ng-container *ngIf=\"datagridService.config.withBatchProcessing\"> -->\r\n <ng-container>\r\n <th class=\"column-select\" scope=\"col\"></th>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of datagridService.config.columns; let i = index; trackBy: trackBy\">\r\n <cocoring-datagrid-head [column]=\"column\" [datagridService]=\"datagridService\"></cocoring-datagrid-head>\r\n </ng-container>\r\n </tr>\r\n </thead>\r\n <tbody *ngIf=\"datagridDataSource as data; else loadingTpl\">\r\n <ng-container *ngFor=\"let rowDatas of data.getResults(); let i = index; trackBy: trackBy\">\r\n <cocoring-datagrid-row class=\"table-line\" [datagridService]=\"datagridService\"\r\n [columns]=\"datagridService.config.columns\" [datas]=\"rowDatas\"></cocoring-datagrid-row>\r\n </ng-container>\r\n </tbody>\r\n <ng-template #loadingTpl>\r\n <tr *ngFor=\"let i of [].constructor(totalRowsSaved)\">\r\n <ng-container *ngFor=\"let column of datagridService.config.columns; let j = index; trackBy: trackBy\">\r\n <td *ngIf=\"j === 0\" class=\"column-select table-cell-loader\">\r\n <div class=\"row-loader loading-animation\"></div>\r\n </td>\r\n <td class=\"table-cell-loader\">\r\n <div class=\"row-loader loading-animation\"></div>\r\n </td>\r\n </ng-container>\r\n </tr>\r\n </ng-template>\r\n </table>\r\n <!-- {{datagridService.checkboxesDatagridForm.get('rowsCheckbox').value | json}} -->\r\n </div>\r\n</ng-container>", styles: [".table-full-width{width:100%}.datagrid-container{overflow-x:auto}table{position:relative;border-collapse:collapse;margin:0;padding:0;overflow-x:auto;width:100%}table caption{font-size:1em;margin:.5em 0 .75em .75em;text-align:left;font-weight:500}table tr{background-color:#f8f8f8;border:1px solid #ddd;padding:.35em}table tbody tr:hover{background-color:#2c2c2c0a}table th,table td{font-size:1em;padding:.625em;text-align:left;min-width:100px;max-width:100px;vertical-align:middle}table th.column-select,table td.column-select{text-align:center;width:50px;min-width:50px;max-width:50px}table th{max-width:none;cursor:pointer;font-size:.85em;letter-spacing:.1em}table th.column-select{font-size:1em}table th .column-table-header{display:flex;align-items:center}table th .column-table-header .column-caption{margin:0 3px}table th .column-table-header .mat-icon{font-size:15px;height:15px;width:15px;padding-top:3px}table td>div{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.table-cell-loader{padding:.625em}.row-loader{padding:10px}@media screen and (max-width: 600px){table{border:0}table thead{border:none;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}table tr{border-bottom:3px solid #ddd;display:block;margin-bottom:.625em}table th,table td{border-left:0;border-right:0;width:auto;min-width:unset;max-width:unset;white-space:unset}table th.column-select,table td.column-select{width:auto;max-width:unset;min-width:unset;text-align:right}table td{display:block;font-size:.8em;text-align:right}table td:before{content:attr(data-label);float:left;font-weight:700;text-transform:uppercase;padding-right:10px}table cocoring-datagrid-cell:last-child td{border-bottom:0}}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: CocoringDatagridRowComponent, selector: "cocoring-datagrid-row", inputs: ["columns", "datas", "datagridService"] }, { kind: "component", type: CocoringDatagridHeadComponent, selector: "cocoring-datagrid-head", inputs: ["column", "datagridService"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, selector: 'cocoring-datagrid', providers: [OdataClass], template: "<ng-container *ngIf=\"datagridService.config\">\r\n <!-- <cocoring-datagrid-toolbar></cocoring-datagrid-toolbar> -->\r\n <div class=\"datagrid-container\">\r\n <table [formGroup]=\"datagridService.checkboxesDatagridForm\">\r\n <thead>\r\n <tr>\r\n <!-- <ng-container *ngIf=\"datagridService.config.withBatchProcessing\"> -->\r\n <ng-container>\r\n <th class=\"column-select\" scope=\"col\"></th>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of datagridService.config.columns; let i = index; trackBy: trackBy\">\r\n <cocoring-datagrid-head [column]=\"column\" [datagridService]=\"datagridService\"></cocoring-datagrid-head>\r\n </ng-container>\r\n </tr>\r\n </thead>\r\n <tbody *ngIf=\"datagridDataSource as data; else loadingTpl\">\r\n <ng-container *ngFor=\"let rowDatas of data.getResults(); let i = index; trackBy: trackBy\">\r\n <cocoring-datagrid-row class=\"table-line\" [datagridService]=\"datagridService\"\r\n [columns]=\"datagridService.config.columns\" [datas]=\"rowDatas\"></cocoring-datagrid-row>\r\n </ng-container>\r\n </tbody>\r\n <ng-template #loadingTpl>\r\n <tr *ngFor=\"let i of [].constructor(totalRowsSaved)\">\r\n <ng-container *ngFor=\"let column of datagridService.config.columns; let j = index; trackBy: trackBy\">\r\n <td *ngIf=\"j === 0\" class=\"column-select table-cell-loader\">\r\n <div class=\"row-loader loading-animation\"></div>\r\n </td>\r\n <td class=\"table-cell-loader\">\r\n <div class=\"row-loader loading-animation\"></div>\r\n </td>\r\n </ng-container>\r\n </tr>\r\n </ng-template>\r\n </table>\r\n <!-- {{datagridService.checkboxesDatagridForm.get('rowsCheckbox').value | json}} -->\r\n </div>\r\n</ng-container>", styles: [".table-full-width{width:100%}.datagrid-container{overflow-x:auto}table{position:relative;border-collapse:collapse;margin:0;padding:0;overflow-x:auto;width:100%}table caption{font-size:1em;margin:.5em 0 .75em .75em;text-align:left;font-weight:500}table tr{background-color:#f8f8f8;border:1px solid #ddd;padding:.35em}table tbody tr:hover{background-color:#2c2c2c0a}table th,table td{font-size:1em;padding:.625em;text-align:left;min-width:100px;max-width:100px;vertical-align:middle}table th.column-select,table td.column-select{text-align:center;width:50px;min-width:50px;max-width:50px}table th{max-width:none;cursor:pointer;font-size:.85em;letter-spacing:.1em}table th.column-select{font-size:1em}table th .column-table-header{display:flex;align-items:center}table th .column-table-header .column-caption{margin:0 3px}table th .column-table-header .mat-icon{font-size:15px;height:15px;width:15px;padding-top:3px}table td>div{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.table-cell-loader{padding:.625em}.row-loader{padding:10px}@media screen and (max-width: 600px){table{border:0}table thead{border:none;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}table tr{border-bottom:3px solid #ddd;display:block;margin-bottom:.625em}table th,table td{border-left:0;border-right:0;width:auto;min-width:unset;max-width:unset;white-space:unset}table th.column-select,table td.column-select{width:auto;max-width:unset;min-width:unset;text-align:right}table td{display:block;font-size:.8em;text-align:right}table td:before{content:attr(data-label);float:left;font-weight:700;text-transform:uppercase;padding-right:10px}table cocoring-datagrid-cell:last-child td{border-bottom:0}}\n"] }]
}], ctorParameters: function () { return [{ type: i1$2.UntypedFormBuilder }, { type: i0.ChangeDetectorRef }, { type: i1.OdataClass }, { type: DatagridService }]; }, propDecorators: { forceFullWidth: [{
type: HostBinding,
args: ['class.table-full-width']
}], config: [{
type: Input
}], eventClickRow: [{
type: Output
}], eventRowsDeleted: [{
type: Output
}], eventRowsRestored: [{
type: Output
}] } });
class CocoringDatagridFilterColumnComponent extends SortColumnExtendComponent {
constructor(injector) {
super(injector);
this.columnSelected = new EventEmitter();
}
ngOnInit() {
this.onInitColumn();
}
ngOnDestroy() {
this.destroy$.next(undefined);
this.destroy$.complete();
}
selectColumn() {
this.columnSelected.emit(this.column);
}
visible() {
this.column.visible = !this.column.visible;
this.datagridService.updateColumn$.next(this.column);
}
}
CocoringDatagridFilterColumnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridFilterColumnComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
CocoringDatagridFilterColumnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringDatagridFilterColumnComponent, selector: "cocoring-datagrid-filter-column", outputs: { columnSelected: "columnSelected" }, usesInheritance: true, ngImport: i0, template: "<a class=\"list-item\" mat-list-item cdkDrag cdkDragLockAxis=\"y\" cdkDragBoundary=\".sidenav\">\r\n <div class=\"list-item-part-left\" (click)=\"sort()\">\r\n <button mat-icon-button type=\"button\" aria-label=\"R\u00E9ordonner les colonnes\">\r\n <mat-icon>drag_indicator</mat-icon>\r\n </button>\r\n <div class=\"column-caption\" [ngClass]=\"{'column-no-visible': !column.visible}\">\r\n {{column.caption}}\r\n <mat-icon *ngIf=\"colFiltered\" class=\"isFiltered\">filter_alt</mat-icon>\r\n </div>\r\n <button class=\"action-sort-column\" mat-icon-button type=\"button\" aria-label=\"Inverser le tri\">\r\n <mat-icon *ngIf=\"column.sort === 'ASC'\">arrow_upward</mat-icon>\r\n <mat-icon *ngIf=\"column.sort === 'DESC'\">arrow_downward</mat-icon>\r\n </button>\r\n </div>\r\n <div class=\"list-item-part-right\">\r\n <button (click)=\"visible()\" class=\"button-visibility\" mat-icon-button type=\"button\" aria-label=\"R\u00E9ordonner les colonnes\">\r\n <mat-icon *ngIf=\"column.visible\">visibility</mat-icon>\r\n <mat-icon *ngIf=\"!column.visible\">visibility_off</mat-icon>\r\n </button>\r\n <button (click)=\"selectColumn()\" mat-icon-button type=\"button\" aria-label=\"S\u00E9lectionner cette colonne\">\r\n <mat-icon>keyboard_arrow_right</mat-icon>\r\n </button>\r\n </div>\r\n</a>", styles: [":host{display:contents}.mat-list-item{border-bottom:1px solid #edf1f7}.mat-list-item ::ng-deep .mat-list-item-content{justify-content:space-between}.mat-list-item .list-item-part-left{display:flex;flex:1;align-items:center}.mat-list-item .button-visibility{margin-right:10px}.mat-icon-button{width:30px;height:30px;line-height:12px}.mat-icon-button .mat-icon{font-size:17px}.column-caption{display:flex;align-items:center;padding-left:5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}.column-caption.column-no-visible{text-decoration:line-through}.column-caption .isFiltered{font-size:15px;height:15px;width:15px;padding-left:5px}.cdk-drag-preview{display:flex;flex-direction:row;align-items:center;padding:0 16px;position:relative;height:inherit;background-color:#fff;box-sizing:border-box;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-preview .list-item-part-left .column-caption{font-size:16px}.cdk-drag-preview .list-item-part-left .mat-icon-button,.cdk-drag-preview .list-item-part-right{display:none}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4$2.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: i1$5.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["disableRipple", "disabled"], exportAs: ["matListItem"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridFilterColumnComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cocoring-datagrid-filter-column', template: "<a class=\"list-item\" mat-list-item cdkDrag cdkDragLockAxis=\"y\" cdkDragBoundary=\".sidenav\">\r\n <div class=\"list-item-part-left\" (click)=\"sort()\">\r\n <button mat-icon-button type=\"button\" aria-label=\"R\u00E9ordonner les colonnes\">\r\n <mat-icon>drag_indicator</mat-icon>\r\n </button>\r\n <div class=\"column-caption\" [ngClass]=\"{'column-no-visible': !column.visible}\">\r\n {{column.caption}}\r\n <mat-icon *ngIf=\"colFiltered\" class=\"isFiltered\">filter_alt</mat-icon>\r\n </div>\r\n <button class=\"action-sort-column\" mat-icon-button type=\"button\" aria-label=\"Inverser le tri\">\r\n <mat-icon *ngIf=\"column.sort === 'ASC'\">arrow_upward</mat-icon>\r\n <mat-icon *ngIf=\"column.sort === 'DESC'\">arrow_downward</mat-icon>\r\n </button>\r\n </div>\r\n <div class=\"list-item-part-right\">\r\n <button (click)=\"visible()\" class=\"button-visibility\" mat-icon-button type=\"button\" aria-label=\"R\u00E9ordonner les colonnes\">\r\n <mat-icon *ngIf=\"column.visible\">visibility</mat-icon>\r\n <mat-icon *ngIf=\"!column.visible\">visibility_off</mat-icon>\r\n </button>\r\n <button (click)=\"selectColumn()\" mat-icon-button type=\"button\" aria-label=\"S\u00E9lectionner cette colonne\">\r\n <mat-icon>keyboard_arrow_right</mat-icon>\r\n </button>\r\n </div>\r\n</a>", styles: [":host{display:contents}.mat-list-item{border-bottom:1px solid #edf1f7}.mat-list-item ::ng-deep .mat-list-item-content{justify-content:space-between}.mat-list-item .list-item-part-left{display:flex;flex:1;align-items:center}.mat-list-item .button-visibility{margin-right:10px}.mat-icon-button{width:30px;height:30px;line-height:12px}.mat-icon-button .mat-icon{font-size:17px}.column-caption{display:flex;align-items:center;padding-left:5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}.column-caption.column-no-visible{text-decoration:line-through}.column-caption .isFiltered{font-size:15px;height:15px;width:15px;padding-left:5px}.cdk-drag-preview{display:flex;flex-direction:row;align-items:center;padding:0 16px;position:relative;height:inherit;background-color:#fff;box-sizing:border-box;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-preview .list-item-part-left .column-caption{font-size:16px}.cdk-drag-preview .list-item-part-left .mat-icon-button,.cdk-drag-preview .list-item-part-right{display:none}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}\n"] }]
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { columnSelected: [{
type: Output
}] } });
class CocoringDatagridFilterModalComponent {
constructor(data, cdr, formBuilderService, mdDialogRef) {
this.data = data;
this.cdr = cdr;
this.formBuilderService = formBuilderService;
this.mdDialogRef = mdDialogRef;
this.disabled = true;
this.isSidenavOpen = false;
this.datagridService = data.datagridService;
this.formulaire = this.formBuilderService.newForm().form;
}
ngOnInit() {
}
close(value) {
this.mdDialogRef.close(value);
}
/** Reset le form des filtres selon le mode */
toggleFiltersOrClose() {
if (this.currentColumn) {
// back to the list of columns
this.currentColumn = null;
this.formulaire.reset();
this.sidenav.toggle();
}
else {
this.close(null);
}
}
columnSelected(column) {
this.currentColumn = column;
/** on fait apparaître le paneau détail de la colonne */
this.sidenav.toggle();
/** on mets à jour la vue comme ça les var booleanFilterFormContainerRef et buttonFormContainerRef sont définies */
this.cdr.detectChanges();
/** on init le form et on ajoute les éléments dans la vue dynamiquement 🖕 */
if (this.currentColumn.dataType == 'boolean') {
this.buildFormFiltersBoolean();
}
}
trackBy(item, index) {
return `${item.id}-${index}`;
}
dropColumn(event) {
moveItemInArray(this.datagridService.config.columns, event.previousIndex, event.currentIndex);
this.datagridService.reOrderColumns$.next({ previousIndex: event.previousIndex, currentIndex: event.currentIndex });
}
buildFormFiltersBoolean() {
let formBuilderService = this.formBuilderService
.appearance('fill') // par défaut c'est outline
.setViewContainerRef(this.booleanFilterFormContainerRef)
.addInput('selectAll', config => config
.nameLabel('Tout sélectionner')
.typeInput(FormInputComponents.INPUT_CHECKBOX_INDETERMINATE)
.dataSource({
type: DataSourceType.BRUTE,
dataSourceNameProperty: 'name',
value: [{ id: "noSelected", name: "non" }, { id: "allSelected", name: "oui" }]
}));
formBuilderService = this.buildFormAddButtonsAction(formBuilderService, this.buttonFormContainerRef);
this.formulaire = formBuilderService.form;
if (this.currentColumn.filters) {
this.formulaire.patchValue(this.currentColumn.filters);
}
}
buildFormAddButtonsAction(formBuilderService, viewContainerRef) {
return formBuilderService
.setViewContainerRef(viewContainerRef)
.addButton('Annuler', config => config
.isTypeSubmit(false)
.outputCallback({
click: () => this.toggleFiltersOrClose()
}))
.addButton('Appliquer', config => config
.isTypeSubmit()
.icon('check')
.outputCallback({
callback: () => { }
}));
}
validateFilters({ value, valid }) {
if (!valid)
return;
this.currentColumn.filters = value;
this.datagridService.updateColumn$.next(this.currentColumn);
this.datagridService.refreshNeeded$.next();
this.toggleFiltersOrClose();
}
}
CocoringDatagridFilterModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridFilterModalComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i0.ChangeDetectorRef }, { token: FormBuilderService }, { token: i2$1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
CocoringDatagridFilterModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringDatagridFilterModalComponent, selector: "cocoring-datagrid-filter-modal", viewQueries: [{ propertyName: "booleanFilterFormContainerRef", first: true, predicate: ["BooleanFilterFormContainerRef"], descendants: true, read: ViewContainerRef }, { propertyName: "buttonFormContainerRef", first: true, predicate: ["ButtonFormContainerRef"], descendants: true, read: ViewContainerRef }, { propertyName: "sidenav", first: true, predicate: ["sidenav"], descendants: true }], ngImport: i0, template: "<div class=\"modal-header\">\r\n <button class=\"actions-header-modal\" (click)=\"toggleFiltersOrClose()\" mat-icon-button\r\n aria-label=\"Afficher / cacher les colonnes\">\r\n <mat-icon *ngIf=\"!currentColumn\">clear</mat-icon>\r\n <mat-icon *ngIf=\"currentColumn\">keyboard_arrow_left</mat-icon>\r\n </button>\r\n <h1 class=\"header-title\" cdkDrag cdkDragRootElement=\".cdk-overlay-pane\" cdkDragHandle mat-dialog-title>\r\n <span *ngIf=\"!currentColumn\">Options</span>\r\n <span *ngIf=\"currentColumn\">{{currentColumn.caption}}</span>\r\n </h1>\r\n</div>\r\n<form [formGroup]=\"formulaire\" (ngSubmit)=\"validateFilters(formulaire)\">\r\n <div mat-dialog-content class=\"test\">\r\n <mat-sidenav-container class=\"layout-container\" [hasBackdrop]=\"false\">\r\n <mat-sidenav class=\"sidenav\" #sidenav mode=\"over\" position=\"end\" [opened]=\"isSidenavOpen\">\r\n <ng-container *ngIf=\"currentColumn\">\r\n <div class=\"filters\">\r\n <ng-template #BooleanFilterFormContainerRef></ng-template>\r\n </div>\r\n <div class=\"filtersButton\">\r\n <ng-template #ButtonFormContainerRef></ng-template>\r\n </div>\r\n </ng-container>\r\n </mat-sidenav>\r\n <mat-sidenav-content #sidenavContent>\r\n <mat-nav-list cdkDropList (cdkDropListDropped)=\"dropColumn($event)\">\r\n <ng-container\r\n *ngFor=\"let column of datagridService.config.columns; let i = index; trackBy: trackBy\">\r\n <cocoring-datagrid-filter-column [column]=\"column\" [datagridService]=\"datagridService\"\r\n (columnSelected)=\"columnSelected($event)\"></cocoring-datagrid-filter-column>\r\n </ng-container>\r\n </mat-nav-list>\r\n </mat-sidenav-content>\r\n </mat-sidenav-container>\r\n </div>\r\n</form>", styles: [".stickyPosition{-webkit-position:sticky;-moz-position:sticky;-ms-position:sticky;-o-position:sticky;position:sticky;z-index:1001;top:0px}@media (min-width: 601px){.hide-scroll{scrollbar-color:white white}.hide-scroll::-webkit-scrollbar{background-color:transparent;height:13px}.hide-scroll::-webkit-scrollbar-thumb{background-color:transparent}.hide-scroll:hover{scrollbar-color:#d9d9d9 white}.hide-scroll:hover::-webkit-scrollbar-thumb{border-radius:3px;background-color:#d9d9d9}}:host{display:block}.mat-drawer{width:100%}.modal-header{display:flex;align-items:center;margin-bottom:15px}.modal-header .actions-header-modal{margin-left:-11px}.modal-header .header-title{cursor:grabbing;margin:0 0 0 10px}.mat-dialog-content{height:100vh;max-height:400px;overflow:hidden;padding:0}.layout-container{height:100%}.layout-container .mat-drawer-content{display:flex;flex-direction:column;align-items:stretch}.layout-container ::ng-deep .mat-drawer-inner-container{display:flex;flex-direction:column}.layout-container ::ng-deep .mat-drawer-inner-container .filters{flex:1;padding:10px 24px}.layout-container ::ng-deep .mat-drawer-inner-container .filters .mat-checkbox-inner-container{width:22px;height:22px}.layout-container ::ng-deep .mat-drawer-inner-container .filters .mat-checkbox-label{padding:0 10px;font-size:17px}.layout-container ::ng-deep .mat-drawer-inner-container .filters .mat-checkbox{padding-bottom:10px}.layout-container ::ng-deep .mat-drawer-inner-container .filtersButton{padding:5px;text-align:right}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4$2.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i4$2.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i4$2.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "directive", type: i1$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i6$1.MatSidenav, selector: "mat-sidenav", inputs: ["fixedInViewport", "fixedTopGap", "fixedBottomGap"], exportAs: ["matSidenav"] }, { kind: "component", type: i6$1.MatSidenavContainer, selector: "mat-sidenav-container", exportAs: ["matSidenavContainer"] }, { kind: "component", type: i6$1.MatSidenavContent, selector: "mat-sidenav-content" }, { kind: "component", type: i1$5.MatNavList, selector: "mat-nav-list", inputs: ["disableRipple", "disabled"], exportAs: ["matNavList"] }, { kind: "directive", type: i2$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i2$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: CocoringDatagridFilterColumnComponent, selector: "cocoring-datagrid-filter-column", outputs: ["columnSelected"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridFilterModalComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cocoring-datagrid-filter-modal', template: "<div class=\"modal-header\">\r\n <button class=\"actions-header-modal\" (click)=\"toggleFiltersOrClose()\" mat-icon-button\r\n aria-label=\"Afficher / cacher les colonnes\">\r\n <mat-icon *ngIf=\"!currentColumn\">clear</mat-icon>\r\n <mat-icon *ngIf=\"currentColumn\">keyboard_arrow_left</mat-icon>\r\n </button>\r\n <h1 class=\"header-title\" cdkDrag cdkDragRootElement=\".cdk-overlay-pane\" cdkDragHandle mat-dialog-title>\r\n <span *ngIf=\"!currentColumn\">Options</span>\r\n <span *ngIf=\"currentColumn\">{{currentColumn.caption}}</span>\r\n </h1>\r\n</div>\r\n<form [formGroup]=\"formulaire\" (ngSubmit)=\"validateFilters(formulaire)\">\r\n <div mat-dialog-content class=\"test\">\r\n <mat-sidenav-container class=\"layout-container\" [hasBackdrop]=\"false\">\r\n <mat-sidenav class=\"sidenav\" #sidenav mode=\"over\" position=\"end\" [opened]=\"isSidenavOpen\">\r\n <ng-container *ngIf=\"currentColumn\">\r\n <div class=\"filters\">\r\n <ng-template #BooleanFilterFormContainerRef></ng-template>\r\n </div>\r\n <div class=\"filtersButton\">\r\n <ng-template #ButtonFormContainerRef></ng-template>\r\n </div>\r\n </ng-container>\r\n </mat-sidenav>\r\n <mat-sidenav-content #sidenavContent>\r\n <mat-nav-list cdkDropList (cdkDropListDropped)=\"dropColumn($event)\">\r\n <ng-container\r\n *ngFor=\"let column of datagridService.config.columns; let i = index; trackBy: trackBy\">\r\n <cocoring-datagrid-filter-column [column]=\"column\" [datagridService]=\"datagridService\"\r\n (columnSelected)=\"columnSelected($event)\"></cocoring-datagrid-filter-column>\r\n </ng-container>\r\n </mat-nav-list>\r\n </mat-sidenav-content>\r\n </mat-sidenav-container>\r\n </div>\r\n</form>", styles: [".stickyPosition{-webkit-position:sticky;-moz-position:sticky;-ms-position:sticky;-o-position:sticky;position:sticky;z-index:1001;top:0px}@media (min-width: 601px){.hide-scroll{scrollbar-color:white white}.hide-scroll::-webkit-scrollbar{background-color:transparent;height:13px}.hide-scroll::-webkit-scrollbar-thumb{background-color:transparent}.hide-scroll:hover{scrollbar-color:#d9d9d9 white}.hide-scroll:hover::-webkit-scrollbar-thumb{border-radius:3px;background-color:#d9d9d9}}:host{display:block}.mat-drawer{width:100%}.modal-header{display:flex;align-items:center;margin-bottom:15px}.modal-header .actions-header-modal{margin-left:-11px}.modal-header .header-title{cursor:grabbing;margin:0 0 0 10px}.mat-dialog-content{height:100vh;max-height:400px;overflow:hidden;padding:0}.layout-container{height:100%}.layout-container .mat-drawer-content{display:flex;flex-direction:column;align-items:stretch}.layout-container ::ng-deep .mat-drawer-inner-container{display:flex;flex-direction:column}.layout-container ::ng-deep .mat-drawer-inner-container .filters{flex:1;padding:10px 24px}.layout-container ::ng-deep .mat-drawer-inner-container .filters .mat-checkbox-inner-container{width:22px;height:22px}.layout-container ::ng-deep .mat-drawer-inner-container .filters .mat-checkbox-label{padding:0 10px;font-size:17px}.layout-container ::ng-deep .mat-drawer-inner-container .filters .mat-checkbox{padding-bottom:10px}.layout-container ::ng-deep .mat-drawer-inner-container .filtersButton{padding:5px;text-align:right}\n"] }]
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
type: Inject,
args: [MAT_DIALOG_DATA]
}] }, { type: i0.ChangeDetectorRef }, { type: FormBuilderService }, { type: i2$1.MatDialogRef }]; }, propDecorators: { booleanFilterFormContainerRef: [{
type: ViewChild,
args: ['BooleanFilterFormContainerRef', { static: false, read: ViewContainerRef }]
}], buttonFormContainerRef: [{
type: ViewChild,
args: ['ButtonFormContainerRef', { static: false, read: ViewContainerRef }]
}], sidenav: [{
type: ViewChild,
args: ['sidenav']
}] } });
class CocoringDatagridSearchbarComponent {
constructor(fb) {
this.fb = fb;
this.searchValue = new EventEmitter();
this.destroy$ = new Subject();
}
ngOnInit() {
this.buildSearchForm();
}
ngOnDestroy() {
this.destroy$.next(undefined);
this.destroy$.complete();
}
buildSearchForm() {
this.searchForm = this.fb.group({
'inputSearch': null
});
this.searchForm.get('inputSearch').valueChanges.pipe(takeUntil$1(this.destroy$), debounceTime(400), tap((data) => this.searchValue.emit(data))).subscribe();
}
clearValue() {
this.searchForm.reset();
}
}
CocoringDatagridSearchbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridSearchbarComponent, deps: [{ token: i1$2.UntypedFormBuilder }], target: i0.ɵɵFactoryTarget.Component });
CocoringDatagridSearchbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringDatagridSearchbarComponent, selector: "cocoring-datagrid-searchbar", outputs: { searchValue: "searchValue" }, ngImport: i0, template: "<div class=\"datagrid-searchbar\" [formGroup]=\"searchForm\">\r\n <mat-form-field>\r\n <mat-label>Filtrer</mat-label>\r\n <button class=\"iconSearch\" mat-button matPrefix mat-icon-button aria-label=\"Clear\">\r\n <mat-icon>search</mat-icon>\r\n </button>\r\n <input class=\"input-filter\" matInput formControlName=\"inputSearch\">\r\n <button class=\"button-reset\" mat-button *ngIf=\"searchForm.get('inputSearch').value\" matSuffix mat-icon-button aria-label=\"Clear\"\r\n (click)=\"clearValue()\">\r\n <mat-icon>close</mat-icon>\r\n </button>\r\n </mat-form-field>\r\n</div>", styles: [":host{display:block}.mat-form-field{width:100%}.iconSearch{font-size:21px!important;margin-right:5px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3$1.MatPrefix, selector: "[matPrefix]" }, { kind: "directive", type: i3$1.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridSearchbarComponent, decorators: [{
type: Component,
args: [{ selector: 'cocoring-datagrid-searchbar', template: "<div class=\"datagrid-searchbar\" [formGroup]=\"searchForm\">\r\n <mat-form-field>\r\n <mat-label>Filtrer</mat-label>\r\n <button class=\"iconSearch\" mat-button matPrefix mat-icon-button aria-label=\"Clear\">\r\n <mat-icon>search</mat-icon>\r\n </button>\r\n <input class=\"input-filter\" matInput formControlName=\"inputSearch\">\r\n <button class=\"button-reset\" mat-button *ngIf=\"searchForm.get('inputSearch').value\" matSuffix mat-icon-button aria-label=\"Clear\"\r\n (click)=\"clearValue()\">\r\n <mat-icon>close</mat-icon>\r\n </button>\r\n </mat-form-field>\r\n</div>", styles: [":host{display:block}.mat-form-field{width:100%}.iconSearch{font-size:21px!important;margin-right:5px}\n"] }]
}], ctorParameters: function () { return [{ type: i1$2.UntypedFormBuilder }]; }, propDecorators: { searchValue: [{
type: Output
}] } });
class CocoringDatagridToolbarComponent {
// list: { id: number; name: string; }[];
// checkboxesFormControlArray: FormArray;
constructor(dialog, cdr, datagridService) {
this.dialog = dialog;
this.cdr = cdr;
this.datagridService = datagridService;
this.nbRowsChecked = 0;
this.rowRemoved = false;
this.destroy$ = new Subject();
}
ngOnInit() {
this.setCheckboxHeaderColumn();
this.onLengthDataSourceChange();
this.onRowsChecked();
}
ngOnDestroy() {
this.destroy$.next(undefined);
this.destroy$.complete();
}
onLengthDataSourceChange() {
this.datagridService.lengthDataSource$.pipe(takeUntil$1(this.destroy$), tap((nombre) => {
this.totalRows = nombre;
this.cdr.detectChanges();
})).subscribe();
}
refreshList() {
this.datagridService.refreshNeeded$.next();
}
deleteSelectedRows() {
this.datagridService.rowsDeletedEvent$.next(undefined);
}
restoreSelectedRows() {
this.datagridService.rowsRestoredEvent$.next(undefined);
}
onRowsChecked() {
this.datagridService.rowCheckedEvent$.pipe(takeUntil$1(this.destroy$)).subscribe((rowValues) => {
this.rowRemoved = rowValues[this.datagridService.config.propIsArchived];
this.nbRowsChecked = this.datagridService.rowsSelectedDatagrid.length;
this.cdr.detectChanges();
});
}
filterModal() {
const dialogRef = this.dialog.open(CocoringDatagridFilterModalComponent, {
data: { datagridService: this.datagridService },
autoFocus: false,
width: '400px'
});
dialogRef.afterClosed().pipe(takeUntil$1(this.destroy$)).subscribe((datas) => {
// console.log("modal fermée", datas)
});
}
setCheckboxHeaderColumn() {
this.datagridService.initCheckboxesDatagridForm();
this.datagridService.checkboxesDatagridForm.get("selectAllRowsCheckbox").valueChanges.pipe(takeUntil$1(this.destroy$)).subscribe((value) => {
this.datagridService.checkUncheckAllRows(value);
});
}
nextPage() {
this.datagridService.nextPage$.next();
}
previousPage() {
this.datagridService.previousPage$.next();
}
searchValue(searchValue) {
this.datagridService.searchGlobal = searchValue;
this.datagridService.refreshNeeded$.next();
}
}
CocoringDatagridToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridToolbarComponent, deps: [{ token: i2$1.MatDialog }, { token: i0.ChangeDetectorRef }, { token: DatagridService }], target: i0.ɵɵFactoryTarget.Component });
CocoringDatagridToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: CocoringDatagridToolbarComponent, selector: "cocoring-datagrid-toolbar", ngImport: i0, template: "<cocoring-datagrid-searchbar (searchValue)=\"searchValue($event)\"></cocoring-datagrid-searchbar>\r\n<div class=\"datagrid-toolbar\">\r\n <div class=\"datagrid-toolbar-part\">\r\n <ng-container *ngIf=\"datagridService.config?.withBatchProcessing\">\r\n <div class=\"toolbar-option select-all\">\r\n <cocoring-checkbox [formGroup]=\"datagridService.checkboxesDatagridForm\"\r\n nameControl=\"selectAllRowsCheckbox\">\r\n </cocoring-checkbox>\r\n </div>\r\n </ng-container>\r\n <div class=\"toolbar-option\">\r\n <button class=\"button-refresh\" mat-icon-button title=\"Rafraichir\" aria-label=\"Rafraichir les donn\u00E9es du tableau\"\r\n (click)=\"refreshList()\">\r\n <mat-icon>refresh</mat-icon>\r\n </button>\r\n </div>\r\n <div class=\"toolbar-option\">\r\n <button class=\"button-filter\" mat-icon-button title=\"Rechercher / Filter / Trier\" aria-label=\"Rechercher / Filter / Trier\"\r\n (click)=\"filterModal()\">\r\n <mat-icon>filter_list</mat-icon>\r\n </button>\r\n </div>\r\n <!-- <ng-container *ngIf=\"datagridService.config?.withBatchProcessing\"> -->\r\n <ng-container>\r\n <div class=\"toolbar-option\">\r\n <!-- [disabled]=\"!nbRowsChecked || (!datagridService.config?.withBatchProcessing && nbRowsChecked > 1)\" -->\r\n <ng-container *ngIf=\"!(!nbRowsChecked || (!datagridService.config?.withBatchProcessing && nbRowsChecked > 1))\" >\r\n <button mat-icon-button aria-label=\"supprimer les lignes s\u00E9lectionn\u00E9es\" (click)=\"deleteSelectedRows()\">\r\n <mat-icon title=\"supprimer les lignes s\u00E9lectionn\u00E9es\">delete_outline</mat-icon>\r\n </button>\r\n <button mat-icon-button aria-label=\"restaurer les lignes supprim\u00E9es\" (click)=\"restoreSelectedRows()\">\r\n <mat-icon title=\"restaurer les lignes supprim\u00E9es\">restore_from_trash</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <div class=\"datagrid-toolbar-part right-part\">\r\n <div class=\"currentPaginationText\">{{datagridService.indicatorPage?.from + 1}} - {{datagridService.indicatorPage?.to}} sur {{totalRows}}</div>\r\n <div class=\"toolbar-option\">\r\n <button class=\"button-previous\" mat-icon-button title=\"Pr\u00E9c\u00E9dent\" (click)=\"previousPage()\"\r\n [disabled]=\"datagridService.currentPage === 1\" aria-label=\"Afficher la page pr\u00E9c\u00E9dente\">\r\n <mat-icon>keyboard_arrow_left</mat-icon>\r\n </button>\r\n </div>\r\n <div class=\"toolbar-option\">\r\n <button class=\"button-next\" mat-icon-button title=\"Suivant\" (click)=\"nextPage()\"\r\n [disabled]=\"datagridService.indicatorPage?.to === totalRows\" aria-label=\"Afficher la page suivante\">\r\n <mat-icon>keyboard_arrow_right</mat-icon>\r\n </button>\r\n </div>\r\n </div>\r\n</div>", styles: [":host{display:block}.datagrid-toolbar{background-color:#e6e6e6;height:50px;line-height:50px;display:flex;flex-direction:row;justify-content:space-between;padding:0 10px;overflow:hidden;flex:0 0 auto}.datagrid-toolbar .datagrid-toolbar-part{display:flex;align-items:center;justify-content:center;line-height:50px;flex-wrap:wrap}.datagrid-toolbar .datagrid-toolbar-part .toolbar-option{display:flex;align-items:center;justify-items:center;height:100%;padding:0 5px 0 0}.datagrid-toolbar .datagrid-toolbar-part .toolbar-option.select-all{padding:0 10px 0 17px}.datagrid-toolbar .datagrid-toolbar-part .toolbar-option .mat-icon-button{cursor:pointer}.datagrid-toolbar .datagrid-toolbar-part .toolbar-option:last-child{padding-right:0}.datagrid-toolbar .datagrid-toolbar-part .currentPaginationText{font-weight:500;font-size:12px}.datagrid-toolbar .datagrid-toolbar-part.right-part .toolbar-option{padding-right:0}@media screen and (max-width: 600px){.datagrid-toolbar{padding:0 0 0 13px}}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: CocoringCheckboxComponent, selector: "cocoring-checkbox", inputs: ["config"] }, { kind: "component", type: CocoringDatagridSearchbarComponent, selector: "cocoring-datagrid-searchbar", outputs: ["searchValue"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridToolbarComponent, decorators: [{
type: Component,
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cocoring-datagrid-toolbar', template: "<cocoring-datagrid-searchbar (searchValue)=\"searchValue($event)\"></cocoring-datagrid-searchbar>\r\n<div class=\"datagrid-toolbar\">\r\n <div class=\"datagrid-toolbar-part\">\r\n <ng-container *ngIf=\"datagridService.config?.withBatchProcessing\">\r\n <div class=\"toolbar-option select-all\">\r\n <cocoring-checkbox [formGroup]=\"datagridService.checkboxesDatagridForm\"\r\n nameControl=\"selectAllRowsCheckbox\">\r\n </cocoring-checkbox>\r\n </div>\r\n </ng-container>\r\n <div class=\"toolbar-option\">\r\n <button class=\"button-refresh\" mat-icon-button title=\"Rafraichir\" aria-label=\"Rafraichir les donn\u00E9es du tableau\"\r\n (click)=\"refreshList()\">\r\n <mat-icon>refresh</mat-icon>\r\n </button>\r\n </div>\r\n <div class=\"toolbar-option\">\r\n <button class=\"button-filter\" mat-icon-button title=\"Rechercher / Filter / Trier\" aria-label=\"Rechercher / Filter / Trier\"\r\n (click)=\"filterModal()\">\r\n <mat-icon>filter_list</mat-icon>\r\n </button>\r\n </div>\r\n <!-- <ng-container *ngIf=\"datagridService.config?.withBatchProcessing\"> -->\r\n <ng-container>\r\n <div class=\"toolbar-option\">\r\n <!-- [disabled]=\"!nbRowsChecked || (!datagridService.config?.withBatchProcessing && nbRowsChecked > 1)\" -->\r\n <ng-container *ngIf=\"!(!nbRowsChecked || (!datagridService.config?.withBatchProcessing && nbRowsChecked > 1))\" >\r\n <button mat-icon-button aria-label=\"supprimer les lignes s\u00E9lectionn\u00E9es\" (click)=\"deleteSelectedRows()\">\r\n <mat-icon title=\"supprimer les lignes s\u00E9lectionn\u00E9es\">delete_outline</mat-icon>\r\n </button>\r\n <button mat-icon-button aria-label=\"restaurer les lignes supprim\u00E9es\" (click)=\"restoreSelectedRows()\">\r\n <mat-icon title=\"restaurer les lignes supprim\u00E9es\">restore_from_trash</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <div class=\"datagrid-toolbar-part right-part\">\r\n <div class=\"currentPaginationText\">{{datagridService.indicatorPage?.from + 1}} - {{datagridService.indicatorPage?.to}} sur {{totalRows}}</div>\r\n <div class=\"toolbar-option\">\r\n <button class=\"button-previous\" mat-icon-button title=\"Pr\u00E9c\u00E9dent\" (click)=\"previousPage()\"\r\n [disabled]=\"datagridService.currentPage === 1\" aria-label=\"Afficher la page pr\u00E9c\u00E9dente\">\r\n <mat-icon>keyboard_arrow_left</mat-icon>\r\n </button>\r\n </div>\r\n <div class=\"toolbar-option\">\r\n <button class=\"button-next\" mat-icon-button title=\"Suivant\" (click)=\"nextPage()\"\r\n [disabled]=\"datagridService.indicatorPage?.to === totalRows\" aria-label=\"Afficher la page suivante\">\r\n <mat-icon>keyboard_arrow_right</mat-icon>\r\n </button>\r\n </div>\r\n </div>\r\n</div>", styles: [":host{display:block}.datagrid-toolbar{background-color:#e6e6e6;height:50px;line-height:50px;display:flex;flex-direction:row;justify-content:space-between;padding:0 10px;overflow:hidden;flex:0 0 auto}.datagrid-toolbar .datagrid-toolbar-part{display:flex;align-items:center;justify-content:center;line-height:50px;flex-wrap:wrap}.datagrid-toolbar .datagrid-toolbar-part .toolbar-option{display:flex;align-items:center;justify-items:center;height:100%;padding:0 5px 0 0}.datagrid-toolbar .datagrid-toolbar-part .toolbar-option.select-all{padding:0 10px 0 17px}.datagrid-toolbar .datagrid-toolbar-part .toolbar-option .mat-icon-button{cursor:pointer}.datagrid-toolbar .datagrid-toolbar-part .toolbar-option:last-child{padding-right:0}.datagrid-toolbar .datagrid-toolbar-part .currentPaginationText{font-weight:500;font-size:12px}.datagrid-toolbar .datagrid-toolbar-part.right-part .toolbar-option{padding-right:0}@media screen and (max-width: 600px){.datagrid-toolbar{padding:0 0 0 13px}}\n"] }]
}], ctorParameters: function () { return [{ type: i2$1.MatDialog }, { type: i0.ChangeDetectorRef }, { type: DatagridService }]; } });
class CocoringDatagridModule {
}
CocoringDatagridModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CocoringDatagridModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridModule, declarations: [CocoringDatagridComponent,
CocoringDatagridRowComponent,
CocoringDatagridCellComponent,
CocoringDatagridHeadComponent,
CocoringDatagridFilterModalComponent,
CocoringDatagridFilterColumnComponent,
CocoringDatagridToolbarComponent,
CocoringDatagridSearchbarComponent,
CocoringDatagridGroupDirective], imports: [CommonModule,
DragDropModule,
ReactiveFormsModule,
MatFormFieldModule,
MatSidenavModule,
MatListModule,
MatDialogModule,
MatInputModule,
MatIconModule,
MatButtonModule,
CocoringButtonModule,
CocoringCheckboxModule], exports: [CocoringDatagridComponent,
CocoringDatagridToolbarComponent,
CocoringDatagridGroupDirective] });
CocoringDatagridModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridModule, imports: [CommonModule,
DragDropModule,
ReactiveFormsModule,
MatFormFieldModule,
MatSidenavModule,
MatListModule,
MatDialogModule,
MatInputModule,
MatIconModule,
MatButtonModule,
CocoringButtonModule,
CocoringCheckboxModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: CocoringDatagridModule, decorators: [{
type: NgModule,
args: [{
declarations: [
CocoringDatagridComponent,
CocoringDatagridRowComponent,
CocoringDatagridCellComponent,
CocoringDatagridHeadComponent,
CocoringDatagridFilterModalComponent,
CocoringDatagridFilterColumnComponent,
CocoringDatagridToolbarComponent,
CocoringDatagridSearchbarComponent,
CocoringDatagridGroupDirective
],
imports: [
CommonModule,
DragDropModule,
ReactiveFormsModule,
MatFormFieldModule,
MatSidenavModule,
MatListModule,
MatDialogModule,
MatInputModule,
MatIconModule,
MatButtonModule,
CocoringButtonModule,
CocoringCheckboxModule
],
exports: [
CocoringDatagridComponent,
CocoringDatagridToolbarComponent,
CocoringDatagridGroupDirective
],
}]
}] });
/** DIRECTIVES */
/**
* Generated bundle index. Do not edit.
*/
export { ClasseComponents, CocoringButtonComponent, CocoringButtonLinkComponent, CocoringButtonLinkModule, CocoringButtonModule, CocoringButtonsGroupComponent, CocoringButtonsGroupModule, CocoringCheckboxComponent, CocoringCheckboxIndeterminateComponent, CocoringCheckboxIndeterminateModule, CocoringCheckboxModule, CocoringColorpickerDirective, CocoringColorpickerModule, CocoringConfirmModalComponent, CocoringConfirmModalModule, CocoringDatagridComponent, CocoringDatagridGroupDirective, CocoringDatagridModule, CocoringDatagridToolbarComponent, CocoringDateComponent, CocoringDateModule, CocoringDefaultImageDirective, CocoringDefaultImageModule, CocoringEmailComponent, CocoringEmailModule, CocoringFileSizeModule, CocoringFileSizePipe, CocoringFormContainerComponent, CocoringFormContainerModule, CocoringInputErrorComponent, CocoringInputErrorModule, CocoringNumberComponent, CocoringNumberModule, CocoringPasswordComponent, CocoringPasswordModule, CocoringPrettyPrintModule, CocoringPrettyPrintPipe, CocoringPreviousPageDirective, CocoringPreviousPageModule, CocoringSanitizeUrlModule, CocoringSanitizeUrlPipe, CocoringSelectComponent, CocoringSelectModule, CocoringSlideToggleComponent, CocoringSlideToggleModule, CocoringTextComponent, CocoringTextModule, CocoringTextareaComponent, CocoringTextareaModule, CocoringTruncateModule, CocoringTruncatePipe, CocoringUploaderComponent, CocoringUploaderModule, CocoringVariableHtmlModule, CocoringVariableHtmlPipe, CocoringViewerComponent, CocoringViewerModule, CocoringWysiwygComponent, CocoringWysiwygModule, ConfigEvents, ConfirmModalService, DatagridService, DefaultConfigComponent, FlexLayoutService, FormBuilderService, GenerateComponentViewService, InputIconComponent, InputIconModule, ToastErrorStacktraceComponent, ToastErrorStacktraceModule, ToastMessageService, UploaderService };
//# sourceMappingURL=cocori-ng-src-feature-form.mjs.map