@gloww/gloww 20.0.0-beta.24 → 20.0.0-beta.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,7 +10,7 @@ import { MAT_DIALOG_DATA, MatDialogTitle, MatDialogContent, MatDialogActions, Ma
10
10
  import { CdkScrollable } from '@angular/cdk/scrolling';
11
11
  import * as i2 from '@angular/router';
12
12
  import { NavigationEnd, RouterLink, RouterModule } from '@angular/router';
13
- import * as i2$1 from '@angular/material/button';
13
+ import * as i1$5 from '@angular/material/button';
14
14
  import { MatButton, MatButtonModule } from '@angular/material/button';
15
15
  import * as i1$1 from '@angular/platform-browser';
16
16
  import * as i5 from '@kolkov/angular-editor';
@@ -29,7 +29,7 @@ import * as i1$3 from '@angular/forms';
29
29
  import { NG_VALUE_ACCESSOR, FormsModule, UntypedFormControl, ReactiveFormsModule, Validators } from '@angular/forms';
30
30
  import { MatProgressBar, MatProgressBarModule } from '@angular/material/progress-bar';
31
31
  import { MatDatepickerInput, MatDatepickerToggle, MatDatepicker, MatDatepickerModule } from '@angular/material/datepicker';
32
- import * as i3$1 from 'ngx-mat-datetime-picker-v2';
32
+ import * as i2$1 from 'ngx-mat-datetime-picker-v2';
33
33
  import { NgxMatDatetimePickerModule, NgxMatNativeDateModule, NgxMatTimepickerComponent } from 'ngx-mat-datetime-picker-v2';
34
34
  import * as i1$4 from '@ngx-translate/core';
35
35
  import { TranslateDefaultParser } from '@ngx-translate/core';
@@ -3600,6 +3600,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
3600
3600
  }] } });
3601
3601
 
3602
3602
  class DatetimeComponent {
3603
+ static { this.DATE_FORMATS = [
3604
+ moment.ISO_8601,
3605
+ 'DD/MM/YYYY HH:mm:ss',
3606
+ 'DD/MM/YYYY HH:mm',
3607
+ 'DD/MM/YYYY',
3608
+ 'MM/DD/YYYY HH:mm:ss',
3609
+ 'MM/DD/YYYY HH:mm',
3610
+ 'MM/DD/YYYY',
3611
+ 'YYYY-MM-DD HH:mm:ss',
3612
+ 'YYYY-MM-DD HH:mm',
3613
+ 'YYYY-MM-DD',
3614
+ 'YYYY-MM-DDTHH:mm:ss',
3615
+ 'YYYY-MM-DDTHH:mm'
3616
+ ]; }
3603
3617
  constructor(locale) {
3604
3618
  this.locale = locale;
3605
3619
  this._value = null;
@@ -3617,9 +3631,7 @@ class DatetimeComponent {
3617
3631
  return this._value;
3618
3632
  }
3619
3633
  set value(val) {
3620
- this._value = this.normalizeDateValue(val);
3621
- this.onChange(this._value);
3622
- this.onTouched();
3634
+ this.updateValue(val);
3623
3635
  }
3624
3636
  writeValue(obj) {
3625
3637
  this._value = this.normalizeDateValue(obj);
@@ -3645,6 +3657,12 @@ class DatetimeComponent {
3645
3657
  }
3646
3658
  return 'OK';
3647
3659
  }
3660
+ onDateInput(value) {
3661
+ this.updateValue(value);
3662
+ }
3663
+ onDateChange(value) {
3664
+ this.updateValue(value);
3665
+ }
3648
3666
  normalizeDateValue(value) {
3649
3667
  if (value === undefined || value === null || value === '') {
3650
3668
  return null;
@@ -3657,15 +3675,24 @@ class DatetimeComponent {
3657
3675
  return Number.isNaN(date.getTime()) ? null : date;
3658
3676
  }
3659
3677
  if (typeof value === 'string' || typeof value === 'number') {
3660
- const strictMoment = moment(value, moment.ISO_8601, true);
3678
+ const strictMoment = moment(value, DatetimeComponent.DATE_FORMATS, this.locale ?? undefined, true);
3661
3679
  if (strictMoment.isValid()) {
3662
3680
  return strictMoment.toDate();
3663
3681
  }
3682
+ const lenientMoment = moment(value, DatetimeComponent.DATE_FORMATS, this.locale ?? undefined, false);
3683
+ if (lenientMoment.isValid()) {
3684
+ return lenientMoment.toDate();
3685
+ }
3664
3686
  const date = new Date(value);
3665
3687
  return Number.isNaN(date.getTime()) ? null : date;
3666
3688
  }
3667
3689
  return null;
3668
3690
  }
3691
+ updateValue(value) {
3692
+ this._value = this.normalizeDateValue(value);
3693
+ this.onChange(this._value);
3694
+ this.onTouched();
3695
+ }
3669
3696
  get isFrenchLocale() {
3670
3697
  return (this.locale ?? '').toLowerCase().startsWith('fr');
3671
3698
  }
@@ -3676,7 +3703,7 @@ class DatetimeComponent {
3676
3703
  multi: true,
3677
3704
  useExisting: DatetimeComponent
3678
3705
  }
3679
- ], ngImport: i0, template: "<div style=\"width:100%\">\n @if (mode==='date') {\n <mat-form-field>\n <mat-label>{{display}}</mat-label>\n <input matInput [matDatepicker]=\"picker\" [placeholder]=\"placeHolder\" [(ngModel)]=\"value\">\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n }\n\n @if (mode==='datetime') {\n <mat-form-field>\n <mat-label>{{display}}</mat-label>\n <input matInput [ngxMatDatetimePicker]=\"pickerDT\" [placeholder]=\"placeHolder\" [(ngModel)]=\"value\">\n <mat-datepicker-toggle matSuffix [for]=\"$any(pickerDT)\"></mat-datepicker-toggle>\n <ngx-mat-datetime-picker #pickerDT [showSpinners]=\"showSpinners\" [showSeconds]=\"showSeconds\" [touchUi]=\"touchUi\" [disableMinute]=\"disableMinute\">\n <ngx-mat-datepicker-actions>\n <button mat-button ngxMatDatepickerCancel>{{ resolvedCancelLabel }}</button>\n <button mat-raised-button color=\"primary\" ngxMatDatepickerApply>{{ resolvedApplyLabel }}</button>\n </ngx-mat-datepicker-actions>\n </ngx-mat-datetime-picker>\n </mat-form-field>\n }\n</div>\n", styles: [""], dependencies: [{ kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$3.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$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "directive", type: MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2$1.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: NgxMatDatetimePickerModule }, { kind: "component", type: i3$1.NgxMatDatetimepicker, selector: "ngx-mat-datetime-picker", exportAs: ["ngxMatDatetimePicker"] }, { kind: "directive", type: i3$1.NgxMatDatepickerInput, selector: "input[ngxMatDatetimePicker]", inputs: ["ngxMatDatetimePicker", "min", "max", "matDatepickerFilter"], exportAs: ["ngxMatDatepickerInput"] }, { kind: "component", type: i3$1.NgxMatDatepickerActions, selector: "ngx-mat-datepicker-actions, ngx-mat-date-range-picker-actions" }, { kind: "directive", type: i3$1.NgxMatDatepickerCancel, selector: "[ngxMatDatepickerCancel], [ngxMatDateRangePickerCancel]" }, { kind: "directive", type: i3$1.NgxMatDatepickerApply, selector: "[ngxMatDatepickerApply], [ngxMatDateRangePickerApply]" }, { kind: "ngmodule", type: NgxMatNativeDateModule }] }); }
3706
+ ], ngImport: i0, template: "<div style=\"width:100%\">\n @if (mode==='date') {\n <mat-form-field>\n <mat-label>{{display}}</mat-label>\n <input matInput [matDatepicker]=\"picker\" [placeholder]=\"placeHolder\" [value]=\"value\" (dateInput)=\"onDateInput($event.value)\" (dateChange)=\"onDateChange($event.value)\">\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n }\n\n @if (mode==='datetime') {\n <mat-form-field>\n <mat-label>{{display}}</mat-label>\n <input matInput [ngxMatDatetimePicker]=\"pickerDT\" [placeholder]=\"placeHolder\" [value]=\"value\" (dateInput)=\"onDateInput($event.value)\" (dateChange)=\"onDateChange($event.value)\" readonly>\n <mat-datepicker-toggle matSuffix [for]=\"$any(pickerDT)\"></mat-datepicker-toggle>\n <ngx-mat-datetime-picker #pickerDT [showSpinners]=\"showSpinners\" [showSeconds]=\"showSeconds\" [touchUi]=\"touchUi\" [disableMinute]=\"disableMinute\">\n <ngx-mat-datepicker-actions>\n <button mat-button ngxMatDatepickerCancel>{{ resolvedCancelLabel }}</button>\n <button mat-raised-button color=\"primary\" ngxMatDatepickerApply>{{ resolvedApplyLabel }}</button>\n </ngx-mat-datepicker-actions>\n </ngx-mat-datetime-picker>\n </mat-form-field>\n }\n</div>\n", styles: [""], dependencies: [{ kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "directive", type: MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1$5.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: NgxMatDatetimePickerModule }, { kind: "component", type: i2$1.NgxMatDatetimepicker, selector: "ngx-mat-datetime-picker", exportAs: ["ngxMatDatetimePicker"] }, { kind: "directive", type: i2$1.NgxMatDatepickerInput, selector: "input[ngxMatDatetimePicker]", inputs: ["ngxMatDatetimePicker", "min", "max", "matDatepickerFilter"], exportAs: ["ngxMatDatepickerInput"] }, { kind: "component", type: i2$1.NgxMatDatepickerActions, selector: "ngx-mat-datepicker-actions, ngx-mat-date-range-picker-actions" }, { kind: "directive", type: i2$1.NgxMatDatepickerCancel, selector: "[ngxMatDatepickerCancel], [ngxMatDateRangePickerCancel]" }, { kind: "directive", type: i2$1.NgxMatDatepickerApply, selector: "[ngxMatDatepickerApply], [ngxMatDateRangePickerApply]" }, { kind: "ngmodule", type: NgxMatNativeDateModule }] }); }
3680
3707
  }
3681
3708
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DatetimeComponent, decorators: [{
3682
3709
  type: Component,
@@ -3686,7 +3713,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
3686
3713
  multi: true,
3687
3714
  useExisting: DatetimeComponent
3688
3715
  }
3689
- ], imports: [MatFormField, MatLabel, MatInput, MatDatepickerInput, FormsModule, MatDatepickerToggle, MatSuffix, MatDatepicker, MatButtonModule, NgxMatDatetimePickerModule, NgxMatNativeDateModule], template: "<div style=\"width:100%\">\n @if (mode==='date') {\n <mat-form-field>\n <mat-label>{{display}}</mat-label>\n <input matInput [matDatepicker]=\"picker\" [placeholder]=\"placeHolder\" [(ngModel)]=\"value\">\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n }\n\n @if (mode==='datetime') {\n <mat-form-field>\n <mat-label>{{display}}</mat-label>\n <input matInput [ngxMatDatetimePicker]=\"pickerDT\" [placeholder]=\"placeHolder\" [(ngModel)]=\"value\">\n <mat-datepicker-toggle matSuffix [for]=\"$any(pickerDT)\"></mat-datepicker-toggle>\n <ngx-mat-datetime-picker #pickerDT [showSpinners]=\"showSpinners\" [showSeconds]=\"showSeconds\" [touchUi]=\"touchUi\" [disableMinute]=\"disableMinute\">\n <ngx-mat-datepicker-actions>\n <button mat-button ngxMatDatepickerCancel>{{ resolvedCancelLabel }}</button>\n <button mat-raised-button color=\"primary\" ngxMatDatepickerApply>{{ resolvedApplyLabel }}</button>\n </ngx-mat-datepicker-actions>\n </ngx-mat-datetime-picker>\n </mat-form-field>\n }\n</div>\n" }]
3716
+ ], imports: [MatFormField, MatLabel, MatInput, MatDatepickerInput, FormsModule, MatDatepickerToggle, MatSuffix, MatDatepicker, MatButtonModule, NgxMatDatetimePickerModule, NgxMatNativeDateModule], template: "<div style=\"width:100%\">\n @if (mode==='date') {\n <mat-form-field>\n <mat-label>{{display}}</mat-label>\n <input matInput [matDatepicker]=\"picker\" [placeholder]=\"placeHolder\" [value]=\"value\" (dateInput)=\"onDateInput($event.value)\" (dateChange)=\"onDateChange($event.value)\">\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n }\n\n @if (mode==='datetime') {\n <mat-form-field>\n <mat-label>{{display}}</mat-label>\n <input matInput [ngxMatDatetimePicker]=\"pickerDT\" [placeholder]=\"placeHolder\" [value]=\"value\" (dateInput)=\"onDateInput($event.value)\" (dateChange)=\"onDateChange($event.value)\" readonly>\n <mat-datepicker-toggle matSuffix [for]=\"$any(pickerDT)\"></mat-datepicker-toggle>\n <ngx-mat-datetime-picker #pickerDT [showSpinners]=\"showSpinners\" [showSeconds]=\"showSeconds\" [touchUi]=\"touchUi\" [disableMinute]=\"disableMinute\">\n <ngx-mat-datepicker-actions>\n <button mat-button ngxMatDatepickerCancel>{{ resolvedCancelLabel }}</button>\n <button mat-raised-button color=\"primary\" ngxMatDatepickerApply>{{ resolvedApplyLabel }}</button>\n </ngx-mat-datepicker-actions>\n </ngx-mat-datetime-picker>\n </mat-form-field>\n }\n</div>\n" }]
3690
3717
  }], ctorParameters: () => [{ type: undefined, decorators: [{
3691
3718
  type: Optional
3692
3719
  }, {