@gloww/gloww 20.0.0-beta.23 → 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,6 +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 i1$5 from '@angular/material/button';
13
14
  import { MatButton, MatButtonModule } from '@angular/material/button';
14
15
  import * as i1$1 from '@angular/platform-browser';
15
16
  import * as i5 from '@kolkov/angular-editor';
@@ -3599,7 +3600,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
3599
3600
  }] } });
3600
3601
 
3601
3602
  class DatetimeComponent {
3602
- constructor() {
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
+ ]; }
3617
+ constructor(locale) {
3618
+ this.locale = locale;
3603
3619
  this._value = null;
3604
3620
  this.display = null;
3605
3621
  this.placeHolder = null;
@@ -3615,9 +3631,7 @@ class DatetimeComponent {
3615
3631
  return this._value;
3616
3632
  }
3617
3633
  set value(val) {
3618
- this._value = this.normalizeDateValue(val);
3619
- this.onChange(this._value);
3620
- this.onTouched();
3634
+ this.updateValue(val);
3621
3635
  }
3622
3636
  writeValue(obj) {
3623
3637
  this._value = this.normalizeDateValue(obj);
@@ -3631,6 +3645,24 @@ class DatetimeComponent {
3631
3645
  setDisabledState(isDisabled) {
3632
3646
  //throw new Error('Method not implemented.');
3633
3647
  }
3648
+ get resolvedCancelLabel() {
3649
+ if (this.cancelLabel) {
3650
+ return this.cancelLabel;
3651
+ }
3652
+ return this.isFrenchLocale ? 'Annuler' : 'Cancel';
3653
+ }
3654
+ get resolvedApplyLabel() {
3655
+ if (this.applyLabel) {
3656
+ return this.applyLabel;
3657
+ }
3658
+ return 'OK';
3659
+ }
3660
+ onDateInput(value) {
3661
+ this.updateValue(value);
3662
+ }
3663
+ onDateChange(value) {
3664
+ this.updateValue(value);
3665
+ }
3634
3666
  normalizeDateValue(value) {
3635
3667
  if (value === undefined || value === null || value === '') {
3636
3668
  return null;
@@ -3643,23 +3675,35 @@ class DatetimeComponent {
3643
3675
  return Number.isNaN(date.getTime()) ? null : date;
3644
3676
  }
3645
3677
  if (typeof value === 'string' || typeof value === 'number') {
3646
- const strictMoment = moment(value, moment.ISO_8601, true);
3678
+ const strictMoment = moment(value, DatetimeComponent.DATE_FORMATS, this.locale ?? undefined, true);
3647
3679
  if (strictMoment.isValid()) {
3648
3680
  return strictMoment.toDate();
3649
3681
  }
3682
+ const lenientMoment = moment(value, DatetimeComponent.DATE_FORMATS, this.locale ?? undefined, false);
3683
+ if (lenientMoment.isValid()) {
3684
+ return lenientMoment.toDate();
3685
+ }
3650
3686
  const date = new Date(value);
3651
3687
  return Number.isNaN(date.getTime()) ? null : date;
3652
3688
  }
3653
3689
  return null;
3654
3690
  }
3655
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DatetimeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3656
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: DatetimeComponent, isStandalone: true, selector: "gloww-datetime", inputs: { _value: ["value", "_value"], display: "display", placeHolder: "placeHolder", mode: "mode", showSpinners: "showSpinners", showSeconds: "showSeconds", disableMinute: "disableMinute", touchUi: "touchUi" }, providers: [
3691
+ updateValue(value) {
3692
+ this._value = this.normalizeDateValue(value);
3693
+ this.onChange(this._value);
3694
+ this.onTouched();
3695
+ }
3696
+ get isFrenchLocale() {
3697
+ return (this.locale ?? '').toLowerCase().startsWith('fr');
3698
+ }
3699
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DatetimeComponent, deps: [{ token: MAT_DATE_LOCALE, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
3700
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: DatetimeComponent, isStandalone: true, selector: "gloww-datetime", inputs: { _value: ["value", "_value"], display: "display", placeHolder: "placeHolder", mode: "mode", showSpinners: "showSpinners", showSeconds: "showSeconds", disableMinute: "disableMinute", touchUi: "touchUi", cancelLabel: "cancelLabel", applyLabel: "applyLabel" }, providers: [
3657
3701
  {
3658
3702
  provide: NG_VALUE_ACCESSOR,
3659
3703
  multi: true,
3660
3704
  useExisting: DatetimeComponent
3661
3705
  }
3662
- ], 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-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: 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: "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 }] }); }
3663
3707
  }
3664
3708
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DatetimeComponent, decorators: [{
3665
3709
  type: Component,
@@ -3669,8 +3713,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
3669
3713
  multi: true,
3670
3714
  useExisting: DatetimeComponent
3671
3715
  }
3672
- ], imports: [MatFormField, MatLabel, MatInput, MatDatepickerInput, FormsModule, MatDatepickerToggle, MatSuffix, MatDatepicker, 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-datetime-picker>\n </mat-form-field>\n }\n</div>\n" }]
3673
- }], ctorParameters: () => [], propDecorators: { _value: [{
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" }]
3717
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
3718
+ type: Optional
3719
+ }, {
3720
+ type: Inject,
3721
+ args: [MAT_DATE_LOCALE]
3722
+ }] }], propDecorators: { _value: [{
3674
3723
  type: Input,
3675
3724
  args: ['value']
3676
3725
  }], display: [{
@@ -3690,6 +3739,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
3690
3739
  type: Input
3691
3740
  }], touchUi: [{
3692
3741
  type: Input
3742
+ }], cancelLabel: [{
3743
+ type: Input
3744
+ }], applyLabel: [{
3745
+ type: Input
3693
3746
  }] } });
3694
3747
 
3695
3748
  class CallbackDirective {