@sumaris-net/ngx-components 2.3.5 → 2.3.7-rc1

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.
@@ -77,6 +77,7 @@ import * as i10 from '@angular/material/datepicker';
77
77
  import { MatDatepickerModule } from '@angular/material/datepicker';
78
78
  import * as i12 from 'ngx-material-timepicker';
79
79
  import { NgxMaterialTimepickerModule } from 'ngx-material-timepicker';
80
+ import { isMoment as isMoment$1 } from 'moment/moment';
80
81
  import { MatDividerModule } from '@angular/material/divider';
81
82
  import * as i6$3 from '@angular/material/tooltip';
82
83
  import { MatTooltipModule } from '@angular/material/tooltip';
@@ -2687,7 +2688,7 @@ function toDateISOString(value) {
2687
2688
  if (!date)
2688
2689
  return undefined;
2689
2690
  return DateUtils.isNoTime(date)
2690
- ? date.toISOString(true /* important ! */).substr(0, 10)
2691
+ ? date.toISOString(true /* important ! */).substring(0, 10)
2691
2692
  : date.toISOString();
2692
2693
  }
2693
2694
  function fromDateISOString(value) {
@@ -6061,8 +6062,7 @@ class MatDate {
6061
6062
  // DEBUG
6062
6063
  //console.debug("[mat-date] writeValue() with:", value);
6063
6064
  // Convert into date
6064
- // Important: do a clone()
6065
- let date = isMoment(value) ? value.clone() : fromDateISOString(value);
6065
+ let date = isMoment(value) ? value : fromDateISOString(value);
6066
6066
  if (!date || !date.isValid()) {
6067
6067
  this.textControl.patchValue(null, { emitEvent: false });
6068
6068
  if (this.formControl.value) {
@@ -6072,10 +6072,12 @@ class MatDate {
6072
6072
  }
6073
6073
  else {
6074
6074
  // Move to the expected TZ (keeping local hour - e.g. midnight)
6075
- date = (this.timezone && date.tz(this.timezone) || date)
6075
+ const day = (this.timezone && date.tz(this.timezone) || date)
6076
+ // Important: clone, because startOf will update the existing date
6077
+ .clone()
6076
6078
  // Reset hour
6077
6079
  .startOf('day');
6078
- const dayStr = this.dateAdapter.format(date, this.datePattern);
6080
+ const dayStr = this.dateAdapter.format(day, this.datePattern);
6079
6081
  if (this.textControl.value !== dayStr) {
6080
6082
  // Update day control
6081
6083
  this.textControl.patchValue(dayStr, { emitEvent: false });
@@ -6416,15 +6418,17 @@ class MatDateTime {
6416
6418
  // DEBUG
6417
6419
  // console.debug("[mat-date-time] writeValue() with:", value);
6418
6420
  // Convert into date
6419
- // Important: do a clone()
6420
- let date = isMoment(value) ? value.clone() : fromDateISOString(value);
6421
+ const date = isMoment(value) ? value : fromDateISOString(value);
6421
6422
  if (!date || !date.isValid()) {
6422
6423
  this.dayControl.patchValue(null, { emitEvent: false });
6423
6424
  this.hourControl.patchValue(null, { emitEvent: false });
6424
6425
  }
6425
6426
  else {
6426
- // Reset hour
6427
- const day = date.startOf('day');
6427
+ const day = date
6428
+ // Important: clone, because startOf() will update the existing date
6429
+ .clone()
6430
+ // Reset hour
6431
+ .startOf('day');
6428
6432
  const dayStr = this.dateAdapter.format(day, this.dayPattern);
6429
6433
  // Format time
6430
6434
  let timeStr;
@@ -6623,6 +6627,7 @@ class MatDateTime {
6623
6627
  // Set model value
6624
6628
  this.emitChange(dateTime);
6625
6629
  this._writing = false;
6630
+ this.markForCheck();
6626
6631
  }
6627
6632
  emitChange(value) {
6628
6633
  // Get the model value
@@ -6755,7 +6760,7 @@ class MatDateShort {
6755
6760
  return this._tabindex;
6756
6761
  }
6757
6762
  get value() {
6758
- return toDateISOString(this._value);
6763
+ return this.formControl.value;
6759
6764
  }
6760
6765
  ngOnInit() {
6761
6766
  this.formControl = this.formControl || this.formControlName && this.formGroupDir && this.formGroupDir.form.get(this.formControlName);
@@ -6767,7 +6772,7 @@ class MatDateShort {
6767
6772
  // Redirect errors from main control, into day sub control
6768
6773
  const $error = new BehaviorSubject(null);
6769
6774
  this.required = isNotNilBoolean(this.required) ? this.required : (this.formControl.validator === Validators.required || isBlankString(this.required));
6770
- this.dayControl = this.formBuilder.control(null, () => $error.getValue());
6775
+ this.dayControl = this.formBuilder.control(null, () => $error.value);
6771
6776
  // Add custom 'validDate' validator
6772
6777
  this.formControl.setValidators(this.required ? Validators.compose([Validators.required, SharedValidators.validDate]) : SharedValidators.validDate);
6773
6778
  // Get patterns to display date
@@ -6795,26 +6800,27 @@ class MatDateShort {
6795
6800
  writeValue(obj) {
6796
6801
  if (this.writing)
6797
6802
  return;
6798
- if (isNilOrBlank(obj)) {
6799
- this.writing = true;
6803
+ this.writing = true;
6804
+ const date = isNilOrBlank(obj) ? undefined : this.dateAdapter.parse(obj, DATE_ISO_PATTERN);
6805
+ if (!date || !date.isValid()) {
6800
6806
  this.dayControl.patchValue(null, { emitEvent: false });
6801
- this._value = undefined;
6802
6807
  if (this.formControl.value) {
6803
6808
  this.formControl.patchValue(null, { emitEvent: false });
6804
6809
  this._onChangeCallback(null);
6805
6810
  }
6806
- this.writing = false;
6807
- this.markForCheck();
6808
- return;
6809
6811
  }
6810
- this._value = this.dateAdapter.parse(obj, DATE_ISO_PATTERN);
6811
- if (!this._value) { // invalid date
6812
- return;
6812
+ else {
6813
+ const day = date
6814
+ // Important: clone, because startOf() will update the existing date
6815
+ .clone()
6816
+ // Reset hour
6817
+ .startOf('day');
6818
+ const dayStr = this.dateAdapter.format(day, this.dayPattern);
6819
+ // Set form value
6820
+ if (this.dayControl.value !== dayStr) {
6821
+ this.dayControl.patchValue(dayStr, { emitEvent: false });
6822
+ }
6813
6823
  }
6814
- this.writing = true;
6815
- //console.log("call writeValue()", this.date, this.formControl);
6816
- // Set form value
6817
- this.dayControl.patchValue(this._value.clone().startOf('day').format(this.dayPattern), { emitEvent: false });
6818
6824
  this.writing = false;
6819
6825
  this.markForCheck();
6820
6826
  }
@@ -6838,9 +6844,13 @@ class MatDateShort {
6838
6844
  this.disabling = false;
6839
6845
  this.markForCheck();
6840
6846
  }
6841
- onDatePickerChange(event) {
6842
- //console.debug("onDatePickerChange called !!")
6843
- if (this.writing || !(event && event.value))
6847
+ _onDatePickerChange(event) {
6848
+ // Make sure event is valid
6849
+ if (!event || (event.value !== null && !isMoment$1(event.value))) {
6850
+ console.warn('Invalid MatDatepicker event. Skipping', event);
6851
+ return; // Skip
6852
+ }
6853
+ if (this.writing)
6844
6854
  return; // Skip if call by self
6845
6855
  this.writing = true;
6846
6856
  let date = event.value;
@@ -6853,10 +6863,18 @@ class MatDateShort {
6853
6863
  this.dayControl.setValue(day && day.format(this.dayPattern), { emitEvent: false });
6854
6864
  // Get the model value
6855
6865
  const dateStr = date && date.format(DATE_ISO_PATTERN).replace('+00:00', 'Z');
6856
- this.formControl.patchValue(dateStr, { emitEvent: false });
6866
+ if (this.formControl.value !== dateStr) {
6867
+ // DEBUG
6868
+ //console.debug('[mat-date-time] Emit new value: ' + dateStr);
6869
+ // Apply to form control. => Will call writeValue()
6870
+ this.formControl.patchValue(dateStr, { emitEvent: false });
6871
+ // Changes comes from inside function: use the callback
6872
+ this._onChangeCallback(dateStr);
6873
+ // Mark as touched
6874
+ this._onTouchedCallback();
6875
+ }
6857
6876
  this.writing = false;
6858
6877
  this.markForCheck();
6859
- this._onChangeCallback(dateStr);
6860
6878
  }
6861
6879
  updatePattern(patterns) {
6862
6880
  this.displayPattern =
@@ -6871,6 +6889,7 @@ class MatDateShort {
6871
6889
  this.formControl.markAsPending();
6872
6890
  this.formControl.setErrors(Object.assign({}, this.dayControl.errors));
6873
6891
  this.writing = false;
6892
+ this.markForCheck();
6874
6893
  return;
6875
6894
  }
6876
6895
  // Make to remove placeholder chars
@@ -6882,23 +6901,29 @@ class MatDateShort {
6882
6901
  date = dayValue && this.dateAdapter.parse(dayValue, this.dayPattern) || null;
6883
6902
  // Reset time
6884
6903
  date = date && date.utc(true).hour(0).minute(0).seconds(0).millisecond(0);
6885
- // update date picker
6886
- this._value = date && this.dateAdapter.parse(date.clone(), DATE_ISO_PATTERN);
6887
6904
  // Get the model value
6888
6905
  const dateStr = date && date.isValid() && date.format(DATE_ISO_PATTERN).replace('+00:00', 'Z') || date;
6889
- //console.debug("[mat-date-time] Setting date: ", dateStr);
6890
- this.formControl.patchValue(dateStr, { emitEvent: false });
6891
- //this.formControl.updateValueAndValidity();
6906
+ // Set model value
6907
+ if (this.formControl.value !== dateStr) {
6908
+ // DEBUG
6909
+ //console.debug('[mat-date-time] Emit new value: ' + dateStr);
6910
+ // Apply to form control. => Will call writeValue()
6911
+ // NOT NEED, because a formControl should NOT be used by multiple fields
6912
+ //this.formControl.setValue(dateStr, {emitEvent: false});
6913
+ // Changes comes from inside function: use the callback
6914
+ this._onChangeCallback(dateStr);
6915
+ // Check if need to update controls
6916
+ this._checkIfTouched();
6917
+ }
6892
6918
  this.writing = false;
6893
6919
  this.markForCheck();
6894
- this._onChangeCallback(dateStr);
6895
6920
  }
6896
- checkIfTouched() {
6921
+ _checkIfTouched(opts) {
6897
6922
  if (this.dayControl.touched) {
6898
- this.markForCheck();
6899
6923
  this._onTouchedCallback();
6900
- // this.writeValue(this.dayControl.value);
6901
- this.onDatePickerChange(this.dayControl);
6924
+ if (!opts || opts.emitEvent !== false) {
6925
+ this.markForCheck();
6926
+ }
6902
6927
  }
6903
6928
  }
6904
6929
  openDatePickerIfMobile(event, datePicker) {
@@ -6937,12 +6962,12 @@ class MatDateShort {
6937
6962
  event.returnValue = false;
6938
6963
  }
6939
6964
  focus() {
6940
- if (!this.matInputs.length)
6965
+ const input = this.matInputs.first;
6966
+ if (!input)
6941
6967
  return;
6942
6968
  setTimeout(() => {
6943
- const elementRef = this.matInputs[0]; // get the first element
6944
- if (isFocusableElement(elementRef)) {
6945
- elementRef.focus();
6969
+ if (isFocusableElement(input.nativeElement)) {
6970
+ input.nativeElement.focus();
6946
6971
  }
6947
6972
  });
6948
6973
  }
@@ -6973,14 +6998,14 @@ class MatDateShort {
6973
6998
  }
6974
6999
  }
6975
7000
  MatDateShort.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: MatDateShort, deps: [{ token: i2$2.DateAdapter }, { token: i1$1.TranslateService }, { token: i1$2.UntypedFormBuilder }, { token: i0.ChangeDetectorRef }, { token: i1$2.FormGroupDirective, optional: true }], target: i0.ɵɵFactoryTarget.Component });
6976
- MatDateShort.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: MatDateShort, selector: "mat-date-short-field", inputs: { mobile: "mobile", disabled: "disabled", formControl: "formControl", formControlName: "formControlName", placeholder: "placeholder", floatLabel: "floatLabel", appearance: "appearance", readonly: "readonly", required: "required", compact: "compact", placeholderChar: "placeholderChar", tabindex: "tabindex", startDate: "startDate", clearable: "clearable" }, providers: [
7001
+ MatDateShort.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: MatDateShort, selector: "mat-date-short-field", inputs: { mobile: "mobile", disabled: "disabled", formControl: "formControl", formControlName: "formControlName", placeholder: "placeholder", floatLabel: "floatLabel", appearance: "appearance", readonly: "readonly", required: "required", compact: "compact", placeholderChar: "placeholderChar", startDate: "startDate", clearable: "clearable", tabindex: "tabindex" }, providers: [
6977
7002
  DEFAULT_VALUE_ACCESSOR$3,
6978
- ], viewQueries: [{ propertyName: "datePicker1", first: true, predicate: ["datePicker1"], descendants: true }, { propertyName: "datePicker2", first: true, predicate: ["datePicker2"], descendants: true }, { propertyName: "matInputs", predicate: ["matInput"], descendants: true }], ngImport: i0, template: "<!-- readonly -->\n<mat-form-field *ngIf=\"readonly else writable\"\n [floatLabel]=\"floatLabel\"\n [appearance]=\"appearance\"\n class=\"mat-form-field-disabled\">\n <div matPrefix>\n <ng-container *ngTemplateOutlet=\"matPrefixTemplate\"></ng-container>\n </div>\n\n <input matInput hidden type=\"text\" readonly=\"true\" [formControl]=\"formControl\">\n <ion-text>{{formControl.value|dateFormat: {pattern: displayPattern} }}</ion-text>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet=\"matSuffixTemplate\"></ng-container>\n </div>\n</mat-form-field>\n\n<ng-template #writable>\n <mat-form-field [floatLabel]=\"floatLabel\"\n [appearance]=\"appearance\">\n\n <mat-label>{{placeholder}}</mat-label>\n\n <div matPrefix><ng-content select=\"[matPrefix]\"></ng-content></div>\n\n <input matInput #matInput autocomplete=\"off\" type=\"text\"\n *ngIf=\"!mobile\"\n [formControl]=\"dayControl\"\n [textMask]=\"{mask: dayMask, keepCharPositions: true, placeholderChar: placeholderChar}\"\n [placeholder]=\"'COMMON.DATE_YEAR_PLACEHOLDER'|translate\"\n (blur)=\"checkIfTouched()\"\n (keyup.arrowDown)=\"openDatePicker($event, datePicker1)\"\n (keyup.escape)=\"preventEvent($event)\"\n (click)=\"matInput.select()\"\n [required]=\"required\"\n [tabindex]=\"tabindex\">\n <input #matInput autocomplete=\"off\" type=\"text\"\n *ngIf=\"mobile\"\n [formControl]=\"dayControl\"\n (click)=\"openDatePickerIfMobile($event, datePicker1)\"\n [required]=\"required\"\n [tabindex]=\"tabindex\"\n readonly>\n\n <!-- Hide the final (hidden) input -->\n <input matInput type=\"text\"\n [formControl]=\"formControl\"\n hidden\n [matDatepicker]=\"datePicker1\"\n (dateChange)=\"onDatePickerChange($event)\">\n\n\n <button matSuffix mat-icon-button tabindex=\"-1\"\n type=\"button\"\n (click)=\"openDatePicker($event, datePicker1)\"\n [disabled]=\"formControl.disabled\">\n <div *ngIf=\"mobile; then iconDate; else iconDesktop\"></div>\n </button>\n <button matSuffix mat-icon-button tabindex=\"-1\"\n type=\"button\"\n *ngIf=\"clearable\"\n (click)=\"writeValue(null)\"\n [hidden]=\"formControl.disabled || !formControl.value\">\n <mat-icon>close</mat-icon>\n </button>\n\n <mat-error *ngIf=\"formControl.touched && formControl.errors|mapKeys|arrayFirst; let errorKey\" [ngSwitch]=\"errorKey\">\n <span *ngSwitchCase=\"'required'\" translate>ERROR.FIELD_REQUIRED</span>\n <span *ngSwitchCase=\"'validDate'\" translate>ERROR.FIELD_NOT_VALID_DATE</span>\n <span *ngSwitchCase=\"'dateIsAfter'\">{{'ERROR.FIELD_NOT_VALID_DATE_AFTER' | translate: formControl.errors.dateIsAfter }}</span>\n <span *ngSwitchCase=\"'dateRange'\" translate>ERROR.FIELD_NOT_VALID_DATE_RANGE</span>\n <span *ngSwitchCase=\"'dateMaxDuration'\" translate>ERROR.FIELD_NOT_VALID_DATE_MAX_DURATION</span>\n <span *ngSwitchCase=\"'dateMinDuration'\" translate>ERROR.FIELD_NOT_VALID_DATE_MIN_DURATION</span>\n <span *ngSwitchCase=\"'msg'\">{{(formControl.errors.msg?.key || formControl.errors.msg) | translate: formControl.errors.msg?.params}}</span>\n </mat-error>\n <ng-content select=\"mat-error\"></ng-content>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet=\"matSuffixTemplate\"></ng-container>\n </div>\n </mat-form-field>\n\n <mat-datepicker #datePicker1\n startView=\"multi-year\"\n [touchUi]=\"mobile\"\n [disabled]=\"formControl.disabled\"\n (yearSelected)=\"closeDatePicker($event, datePicker1)\"\n [startAt]=\"startDate\"></mat-datepicker>\n\n <ng-template #iconDesktop>\n <mat-icon>keyboard_arrow_down</mat-icon>\n </ng-template>\n\n <ng-template #iconDate>\n <mat-icon>date_range</mat-icon>\n </ng-template>\n\n</ng-template>\n\n<ng-template #matPrefixTemplate>\n <ng-content select=\"[matPrefix]\"></ng-content>\n</ng-template>\n\n<ng-template #matSuffixTemplate>\n <ng-content select=\"[matSuffix]\"></ng-content>\n</ng-template>\n", styles: [":host{display:inline-block;width:100%;position:relative}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}mat-form-field .datetime-md{padding:0!important}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "component", type: i2.IonText, selector: "ion-text", inputs: ["color", "mode"] }, { 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.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i6$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i6$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i6$1.MatPrefix, selector: "[matPrefix]" }, { kind: "directive", type: i6$1.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i7.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: i8.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i9.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: i10.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i10.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "directive", type: i11.MaskedInputDirective, selector: "[textMask]", inputs: ["textMask"], exportAs: ["textMask"] }, { kind: "directive", type: i1$1.TranslateDirective, selector: "[translate],[ngx-translate]", inputs: ["translate", "translateParams"] }, { kind: "pipe", type: DateFormatPipe, name: "dateFormat" }, { kind: "pipe", type: ArrayFirstPipe, name: "arrayFirst" }, { kind: "pipe", type: MapKeysPipe, name: "mapKeys" }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
7003
+ ], viewQueries: [{ propertyName: "datePicker1", first: true, predicate: ["datePicker1"], descendants: true }, { propertyName: "datePicker2", first: true, predicate: ["datePicker2"], descendants: true }, { propertyName: "matInputs", predicate: ["matInput"], descendants: true }], ngImport: i0, template: "<!-- readonly -->\n<mat-form-field *ngIf=\"readonly else writable\"\n [floatLabel]=\"floatLabel\"\n [appearance]=\"appearance\"\n class=\"mat-form-field-disabled\">\n <div matPrefix>\n <ng-container *ngTemplateOutlet=\"matPrefixTemplate\"></ng-container>\n </div>\n\n <input matInput hidden type=\"text\" readonly=\"true\" [formControl]=\"formControl\">\n <ion-text>{{formControl.value|dateFormat: {pattern: displayPattern} }}</ion-text>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet=\"matSuffixTemplate\"></ng-container>\n </div>\n</mat-form-field>\n\n<ng-template #writable>\n <mat-form-field [floatLabel]=\"floatLabel\"\n [appearance]=\"appearance\">\n\n <mat-label>{{placeholder}}</mat-label>\n\n <div matPrefix><ng-content select=\"[matPrefix]\"></ng-content></div>\n\n <input matInput #matInput autocomplete=\"off\" type=\"text\"\n *ngIf=\"!mobile\"\n [formControl]=\"dayControl\"\n [textMask]=\"{mask: dayMask, keepCharPositions: true, placeholderChar: placeholderChar}\"\n [placeholder]=\"'COMMON.DATE_YEAR_PLACEHOLDER'|translate\"\n (blur)=\"_checkIfTouched()\"\n (keyup.arrowDown)=\"openDatePicker($event, datePicker1)\"\n (keyup.escape)=\"preventEvent($event)\"\n (click)=\"matInput.select()\"\n [required]=\"required\"\n [tabindex]=\"tabindex\">\n <input #matInput autocomplete=\"off\" type=\"text\"\n *ngIf=\"mobile\"\n [formControl]=\"dayControl\"\n (click)=\"openDatePickerIfMobile($event, datePicker1)\"\n [required]=\"required\"\n [tabindex]=\"tabindex\"\n readonly>\n\n <!-- Hide the final (hidden) input -->\n <input matInput type=\"text\"\n [formControl]=\"formControl\"\n hidden\n [matDatepicker]=\"datePicker1\"\n (dateChange)=\"_onDatePickerChange($event)\"\n readonly>\n\n\n <button matSuffix mat-icon-button tabindex=\"-1\"\n type=\"button\"\n (click)=\"openDatePicker($event, datePicker1)\"\n [disabled]=\"formControl.disabled\">\n <div *ngIf=\"mobile; then iconDate; else iconDesktop\"></div>\n </button>\n <button matSuffix mat-icon-button tabindex=\"-1\"\n type=\"button\"\n *ngIf=\"clearable\"\n (click)=\"writeValue(null)\"\n [hidden]=\"formControl.disabled || !formControl.value\">\n <mat-icon>close</mat-icon>\n </button>\n\n <mat-error *ngIf=\"formControl.touched && formControl.errors|mapKeys|arrayFirst; let errorKey\" [ngSwitch]=\"errorKey\">\n <span *ngSwitchCase=\"'required'\" translate>ERROR.FIELD_REQUIRED</span>\n <span *ngSwitchCase=\"'validDate'\" translate>ERROR.FIELD_NOT_VALID_DATE</span>\n <span *ngSwitchCase=\"'dateIsAfter'\">{{'ERROR.FIELD_NOT_VALID_DATE_AFTER' | translate: formControl.errors.dateIsAfter }}</span>\n <span *ngSwitchCase=\"'dateRange'\" translate>ERROR.FIELD_NOT_VALID_DATE_RANGE</span>\n <span *ngSwitchCase=\"'dateMaxDuration'\" translate>ERROR.FIELD_NOT_VALID_DATE_MAX_DURATION</span>\n <span *ngSwitchCase=\"'dateMinDuration'\" translate>ERROR.FIELD_NOT_VALID_DATE_MIN_DURATION</span>\n <span *ngSwitchCase=\"'msg'\">{{(formControl.errors.msg?.key || formControl.errors.msg) | translate: formControl.errors.msg?.params}}</span>\n </mat-error>\n <ng-content select=\"mat-error\"></ng-content>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet=\"matSuffixTemplate\"></ng-container>\n </div>\n </mat-form-field>\n\n <mat-datepicker #datePicker1\n startView=\"multi-year\"\n [touchUi]=\"mobile\"\n [disabled]=\"formControl.disabled\"\n (yearSelected)=\"closeDatePicker($event, datePicker1)\"\n [startAt]=\"startDate\"></mat-datepicker>\n\n <ng-template #iconDesktop>\n <mat-icon>keyboard_arrow_down</mat-icon>\n </ng-template>\n\n <ng-template #iconDate>\n <mat-icon>date_range</mat-icon>\n </ng-template>\n\n</ng-template>\n\n<ng-template #matPrefixTemplate>\n <ng-content select=\"[matPrefix]\"></ng-content>\n</ng-template>\n\n<ng-template #matSuffixTemplate>\n <ng-content select=\"[matSuffix]\"></ng-content>\n</ng-template>\n", styles: [":host{display:inline-block;width:100%;position:relative}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}mat-form-field .datetime-md{padding:0!important}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "component", type: i2.IonText, selector: "ion-text", inputs: ["color", "mode"] }, { 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.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i6$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i6$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i6$1.MatPrefix, selector: "[matPrefix]" }, { kind: "directive", type: i6$1.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i7.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: i8.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i9.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: i10.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i10.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "directive", type: i11.MaskedInputDirective, selector: "[textMask]", inputs: ["textMask"], exportAs: ["textMask"] }, { kind: "directive", type: i1$1.TranslateDirective, selector: "[translate],[ngx-translate]", inputs: ["translate", "translateParams"] }, { kind: "pipe", type: DateFormatPipe, name: "dateFormat" }, { kind: "pipe", type: ArrayFirstPipe, name: "arrayFirst" }, { kind: "pipe", type: MapKeysPipe, name: "mapKeys" }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
6979
7004
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: MatDateShort, decorators: [{
6980
7005
  type: Component,
6981
7006
  args: [{ selector: 'mat-date-short-field', providers: [
6982
7007
  DEFAULT_VALUE_ACCESSOR$3,
6983
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- readonly -->\n<mat-form-field *ngIf=\"readonly else writable\"\n [floatLabel]=\"floatLabel\"\n [appearance]=\"appearance\"\n class=\"mat-form-field-disabled\">\n <div matPrefix>\n <ng-container *ngTemplateOutlet=\"matPrefixTemplate\"></ng-container>\n </div>\n\n <input matInput hidden type=\"text\" readonly=\"true\" [formControl]=\"formControl\">\n <ion-text>{{formControl.value|dateFormat: {pattern: displayPattern} }}</ion-text>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet=\"matSuffixTemplate\"></ng-container>\n </div>\n</mat-form-field>\n\n<ng-template #writable>\n <mat-form-field [floatLabel]=\"floatLabel\"\n [appearance]=\"appearance\">\n\n <mat-label>{{placeholder}}</mat-label>\n\n <div matPrefix><ng-content select=\"[matPrefix]\"></ng-content></div>\n\n <input matInput #matInput autocomplete=\"off\" type=\"text\"\n *ngIf=\"!mobile\"\n [formControl]=\"dayControl\"\n [textMask]=\"{mask: dayMask, keepCharPositions: true, placeholderChar: placeholderChar}\"\n [placeholder]=\"'COMMON.DATE_YEAR_PLACEHOLDER'|translate\"\n (blur)=\"checkIfTouched()\"\n (keyup.arrowDown)=\"openDatePicker($event, datePicker1)\"\n (keyup.escape)=\"preventEvent($event)\"\n (click)=\"matInput.select()\"\n [required]=\"required\"\n [tabindex]=\"tabindex\">\n <input #matInput autocomplete=\"off\" type=\"text\"\n *ngIf=\"mobile\"\n [formControl]=\"dayControl\"\n (click)=\"openDatePickerIfMobile($event, datePicker1)\"\n [required]=\"required\"\n [tabindex]=\"tabindex\"\n readonly>\n\n <!-- Hide the final (hidden) input -->\n <input matInput type=\"text\"\n [formControl]=\"formControl\"\n hidden\n [matDatepicker]=\"datePicker1\"\n (dateChange)=\"onDatePickerChange($event)\">\n\n\n <button matSuffix mat-icon-button tabindex=\"-1\"\n type=\"button\"\n (click)=\"openDatePicker($event, datePicker1)\"\n [disabled]=\"formControl.disabled\">\n <div *ngIf=\"mobile; then iconDate; else iconDesktop\"></div>\n </button>\n <button matSuffix mat-icon-button tabindex=\"-1\"\n type=\"button\"\n *ngIf=\"clearable\"\n (click)=\"writeValue(null)\"\n [hidden]=\"formControl.disabled || !formControl.value\">\n <mat-icon>close</mat-icon>\n </button>\n\n <mat-error *ngIf=\"formControl.touched && formControl.errors|mapKeys|arrayFirst; let errorKey\" [ngSwitch]=\"errorKey\">\n <span *ngSwitchCase=\"'required'\" translate>ERROR.FIELD_REQUIRED</span>\n <span *ngSwitchCase=\"'validDate'\" translate>ERROR.FIELD_NOT_VALID_DATE</span>\n <span *ngSwitchCase=\"'dateIsAfter'\">{{'ERROR.FIELD_NOT_VALID_DATE_AFTER' | translate: formControl.errors.dateIsAfter }}</span>\n <span *ngSwitchCase=\"'dateRange'\" translate>ERROR.FIELD_NOT_VALID_DATE_RANGE</span>\n <span *ngSwitchCase=\"'dateMaxDuration'\" translate>ERROR.FIELD_NOT_VALID_DATE_MAX_DURATION</span>\n <span *ngSwitchCase=\"'dateMinDuration'\" translate>ERROR.FIELD_NOT_VALID_DATE_MIN_DURATION</span>\n <span *ngSwitchCase=\"'msg'\">{{(formControl.errors.msg?.key || formControl.errors.msg) | translate: formControl.errors.msg?.params}}</span>\n </mat-error>\n <ng-content select=\"mat-error\"></ng-content>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet=\"matSuffixTemplate\"></ng-container>\n </div>\n </mat-form-field>\n\n <mat-datepicker #datePicker1\n startView=\"multi-year\"\n [touchUi]=\"mobile\"\n [disabled]=\"formControl.disabled\"\n (yearSelected)=\"closeDatePicker($event, datePicker1)\"\n [startAt]=\"startDate\"></mat-datepicker>\n\n <ng-template #iconDesktop>\n <mat-icon>keyboard_arrow_down</mat-icon>\n </ng-template>\n\n <ng-template #iconDate>\n <mat-icon>date_range</mat-icon>\n </ng-template>\n\n</ng-template>\n\n<ng-template #matPrefixTemplate>\n <ng-content select=\"[matPrefix]\"></ng-content>\n</ng-template>\n\n<ng-template #matSuffixTemplate>\n <ng-content select=\"[matSuffix]\"></ng-content>\n</ng-template>\n", styles: [":host{display:inline-block;width:100%;position:relative}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}mat-form-field .datetime-md{padding:0!important}\n"] }]
7008
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- readonly -->\n<mat-form-field *ngIf=\"readonly else writable\"\n [floatLabel]=\"floatLabel\"\n [appearance]=\"appearance\"\n class=\"mat-form-field-disabled\">\n <div matPrefix>\n <ng-container *ngTemplateOutlet=\"matPrefixTemplate\"></ng-container>\n </div>\n\n <input matInput hidden type=\"text\" readonly=\"true\" [formControl]=\"formControl\">\n <ion-text>{{formControl.value|dateFormat: {pattern: displayPattern} }}</ion-text>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet=\"matSuffixTemplate\"></ng-container>\n </div>\n</mat-form-field>\n\n<ng-template #writable>\n <mat-form-field [floatLabel]=\"floatLabel\"\n [appearance]=\"appearance\">\n\n <mat-label>{{placeholder}}</mat-label>\n\n <div matPrefix><ng-content select=\"[matPrefix]\"></ng-content></div>\n\n <input matInput #matInput autocomplete=\"off\" type=\"text\"\n *ngIf=\"!mobile\"\n [formControl]=\"dayControl\"\n [textMask]=\"{mask: dayMask, keepCharPositions: true, placeholderChar: placeholderChar}\"\n [placeholder]=\"'COMMON.DATE_YEAR_PLACEHOLDER'|translate\"\n (blur)=\"_checkIfTouched()\"\n (keyup.arrowDown)=\"openDatePicker($event, datePicker1)\"\n (keyup.escape)=\"preventEvent($event)\"\n (click)=\"matInput.select()\"\n [required]=\"required\"\n [tabindex]=\"tabindex\">\n <input #matInput autocomplete=\"off\" type=\"text\"\n *ngIf=\"mobile\"\n [formControl]=\"dayControl\"\n (click)=\"openDatePickerIfMobile($event, datePicker1)\"\n [required]=\"required\"\n [tabindex]=\"tabindex\"\n readonly>\n\n <!-- Hide the final (hidden) input -->\n <input matInput type=\"text\"\n [formControl]=\"formControl\"\n hidden\n [matDatepicker]=\"datePicker1\"\n (dateChange)=\"_onDatePickerChange($event)\"\n readonly>\n\n\n <button matSuffix mat-icon-button tabindex=\"-1\"\n type=\"button\"\n (click)=\"openDatePicker($event, datePicker1)\"\n [disabled]=\"formControl.disabled\">\n <div *ngIf=\"mobile; then iconDate; else iconDesktop\"></div>\n </button>\n <button matSuffix mat-icon-button tabindex=\"-1\"\n type=\"button\"\n *ngIf=\"clearable\"\n (click)=\"writeValue(null)\"\n [hidden]=\"formControl.disabled || !formControl.value\">\n <mat-icon>close</mat-icon>\n </button>\n\n <mat-error *ngIf=\"formControl.touched && formControl.errors|mapKeys|arrayFirst; let errorKey\" [ngSwitch]=\"errorKey\">\n <span *ngSwitchCase=\"'required'\" translate>ERROR.FIELD_REQUIRED</span>\n <span *ngSwitchCase=\"'validDate'\" translate>ERROR.FIELD_NOT_VALID_DATE</span>\n <span *ngSwitchCase=\"'dateIsAfter'\">{{'ERROR.FIELD_NOT_VALID_DATE_AFTER' | translate: formControl.errors.dateIsAfter }}</span>\n <span *ngSwitchCase=\"'dateRange'\" translate>ERROR.FIELD_NOT_VALID_DATE_RANGE</span>\n <span *ngSwitchCase=\"'dateMaxDuration'\" translate>ERROR.FIELD_NOT_VALID_DATE_MAX_DURATION</span>\n <span *ngSwitchCase=\"'dateMinDuration'\" translate>ERROR.FIELD_NOT_VALID_DATE_MIN_DURATION</span>\n <span *ngSwitchCase=\"'msg'\">{{(formControl.errors.msg?.key || formControl.errors.msg) | translate: formControl.errors.msg?.params}}</span>\n </mat-error>\n <ng-content select=\"mat-error\"></ng-content>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet=\"matSuffixTemplate\"></ng-container>\n </div>\n </mat-form-field>\n\n <mat-datepicker #datePicker1\n startView=\"multi-year\"\n [touchUi]=\"mobile\"\n [disabled]=\"formControl.disabled\"\n (yearSelected)=\"closeDatePicker($event, datePicker1)\"\n [startAt]=\"startDate\"></mat-datepicker>\n\n <ng-template #iconDesktop>\n <mat-icon>keyboard_arrow_down</mat-icon>\n </ng-template>\n\n <ng-template #iconDate>\n <mat-icon>date_range</mat-icon>\n </ng-template>\n\n</ng-template>\n\n<ng-template #matPrefixTemplate>\n <ng-content select=\"[matPrefix]\"></ng-content>\n</ng-template>\n\n<ng-template #matSuffixTemplate>\n <ng-content select=\"[matSuffix]\"></ng-content>\n</ng-template>\n", styles: [":host{display:inline-block;width:100%;position:relative}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}mat-form-field .datetime-md{padding:0!important}\n"] }]
6984
7009
  }], ctorParameters: function () {
6985
7010
  return [{ type: i2$2.DateAdapter }, { type: i1$1.TranslateService }, { type: i1$2.UntypedFormBuilder }, { type: i0.ChangeDetectorRef }, { type: i1$2.FormGroupDirective, decorators: [{
6986
7011
  type: Optional
@@ -7007,12 +7032,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
7007
7032
  type: Input
7008
7033
  }], placeholderChar: [{
7009
7034
  type: Input
7010
- }], tabindex: [{
7011
- type: Input
7012
7035
  }], startDate: [{
7013
7036
  type: Input
7014
7037
  }], clearable: [{
7015
7038
  type: Input
7039
+ }], tabindex: [{
7040
+ type: Input
7016
7041
  }], datePicker1: [{
7017
7042
  type: ViewChild,
7018
7043
  args: ['datePicker1']
@@ -28526,9 +28551,10 @@ class AppEntityEditor extends AppTabEditor {
28526
28551
  this._listenChangesSubscription = this.listenChanges(this.data.id, {
28527
28552
  interval: this._listenIntervalInSeconds
28528
28553
  })
28529
- .pipe(filter(isNotNil),
28530
- // If saving, wait end, to avoid to detect self changes
28531
- mergeMap((data) => this.saving ? of(data) : firstFalse(this.savingSubject).pipe(mapTo(data))))
28554
+ .pipe(filter(isNotNil), mergeMap((data) => this.saving
28555
+ // If saving, wait end, to avoid to detect self changes
28556
+ ? firstFalse(this.savingSubject).pipe(mapTo(data), debounceTime(500))
28557
+ : of(data)))
28532
28558
  .subscribe((data) => {
28533
28559
  const isNewer = isMoment(data.updateDate) && data.updateDate.isAfter(this.data.updateDate);
28534
28560
  if (!isNewer)