@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.
- package/esm2020/src/app/core/form/entity/entity-editor.class.mjs +6 -5
- package/esm2020/src/app/shared/dates.mjs +2 -2
- package/esm2020/src/app/shared/material/datetime/material.date.mjs +6 -5
- package/esm2020/src/app/shared/material/datetime/material.dateshort.mjs +61 -41
- package/esm2020/src/app/shared/material/datetime/material.datetime.mjs +8 -5
- package/fesm2015/sumaris-net.ngx-components.mjs +77 -51
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +77 -51
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/shared/material/datetime/material.dateshort.d.ts +8 -6
|
@@ -76,6 +76,7 @@ import * as i10 from '@angular/material/datepicker';
|
|
|
76
76
|
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
77
77
|
import * as i12 from 'ngx-material-timepicker';
|
|
78
78
|
import { NgxMaterialTimepickerModule } from 'ngx-material-timepicker';
|
|
79
|
+
import { isMoment as isMoment$1 } from 'moment/moment';
|
|
79
80
|
import { MatDividerModule } from '@angular/material/divider';
|
|
80
81
|
import * as i6$3 from '@angular/material/tooltip';
|
|
81
82
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
@@ -2675,7 +2676,7 @@ function toDateISOString(value) {
|
|
|
2675
2676
|
if (!date)
|
|
2676
2677
|
return undefined;
|
|
2677
2678
|
return DateUtils.isNoTime(date)
|
|
2678
|
-
? date.toISOString(true /* important ! */).
|
|
2679
|
+
? date.toISOString(true /* important ! */).substring(0, 10)
|
|
2679
2680
|
: date.toISOString();
|
|
2680
2681
|
}
|
|
2681
2682
|
function fromDateISOString(value) {
|
|
@@ -6077,8 +6078,7 @@ class MatDate {
|
|
|
6077
6078
|
// DEBUG
|
|
6078
6079
|
//console.debug("[mat-date] writeValue() with:", value);
|
|
6079
6080
|
// Convert into date
|
|
6080
|
-
|
|
6081
|
-
let date = isMoment(value) ? value.clone() : fromDateISOString(value);
|
|
6081
|
+
let date = isMoment(value) ? value : fromDateISOString(value);
|
|
6082
6082
|
if (!date || !date.isValid()) {
|
|
6083
6083
|
this.textControl.patchValue(null, { emitEvent: false });
|
|
6084
6084
|
if (this.formControl.value) {
|
|
@@ -6088,10 +6088,12 @@ class MatDate {
|
|
|
6088
6088
|
}
|
|
6089
6089
|
else {
|
|
6090
6090
|
// Move to the expected TZ (keeping local hour - e.g. midnight)
|
|
6091
|
-
|
|
6091
|
+
const day = (this.timezone && date.tz(this.timezone) || date)
|
|
6092
|
+
// Important: clone, because startOf will update the existing date
|
|
6093
|
+
.clone()
|
|
6092
6094
|
// Reset hour
|
|
6093
6095
|
.startOf('day');
|
|
6094
|
-
const dayStr = this.dateAdapter.format(
|
|
6096
|
+
const dayStr = this.dateAdapter.format(day, this.datePattern);
|
|
6095
6097
|
if (this.textControl.value !== dayStr) {
|
|
6096
6098
|
// Update day control
|
|
6097
6099
|
this.textControl.patchValue(dayStr, { emitEvent: false });
|
|
@@ -6431,15 +6433,17 @@ class MatDateTime {
|
|
|
6431
6433
|
// DEBUG
|
|
6432
6434
|
// console.debug("[mat-date-time] writeValue() with:", value);
|
|
6433
6435
|
// Convert into date
|
|
6434
|
-
|
|
6435
|
-
let date = isMoment(value) ? value.clone() : fromDateISOString(value);
|
|
6436
|
+
const date = isMoment(value) ? value : fromDateISOString(value);
|
|
6436
6437
|
if (!date || !date.isValid()) {
|
|
6437
6438
|
this.dayControl.patchValue(null, { emitEvent: false });
|
|
6438
6439
|
this.hourControl.patchValue(null, { emitEvent: false });
|
|
6439
6440
|
}
|
|
6440
6441
|
else {
|
|
6441
|
-
|
|
6442
|
-
|
|
6442
|
+
const day = date
|
|
6443
|
+
// Important: clone, because startOf() will update the existing date
|
|
6444
|
+
.clone()
|
|
6445
|
+
// Reset hour
|
|
6446
|
+
.startOf('day');
|
|
6443
6447
|
const dayStr = this.dateAdapter.format(day, this.dayPattern);
|
|
6444
6448
|
// Format time
|
|
6445
6449
|
let timeStr;
|
|
@@ -6645,6 +6649,7 @@ class MatDateTime {
|
|
|
6645
6649
|
// Set model value
|
|
6646
6650
|
this.emitChange(dateTime);
|
|
6647
6651
|
this._writing = false;
|
|
6652
|
+
this.markForCheck();
|
|
6648
6653
|
}
|
|
6649
6654
|
emitChange(value) {
|
|
6650
6655
|
// Get the model value
|
|
@@ -6775,7 +6780,7 @@ class MatDateShort {
|
|
|
6775
6780
|
return this._tabindex;
|
|
6776
6781
|
}
|
|
6777
6782
|
get value() {
|
|
6778
|
-
return
|
|
6783
|
+
return this.formControl.value;
|
|
6779
6784
|
}
|
|
6780
6785
|
ngOnInit() {
|
|
6781
6786
|
this.formControl = this.formControl || this.formControlName && this.formGroupDir && this.formGroupDir.form.get(this.formControlName);
|
|
@@ -6787,7 +6792,7 @@ class MatDateShort {
|
|
|
6787
6792
|
// Redirect errors from main control, into day sub control
|
|
6788
6793
|
const $error = new BehaviorSubject(null);
|
|
6789
6794
|
this.required = isNotNilBoolean(this.required) ? this.required : (this.formControl.validator === Validators.required || isBlankString(this.required));
|
|
6790
|
-
this.dayControl = this.formBuilder.control(null, () => $error.
|
|
6795
|
+
this.dayControl = this.formBuilder.control(null, () => $error.value);
|
|
6791
6796
|
// Add custom 'validDate' validator
|
|
6792
6797
|
this.formControl.setValidators(this.required ? Validators.compose([Validators.required, SharedValidators.validDate]) : SharedValidators.validDate);
|
|
6793
6798
|
// Get patterns to display date
|
|
@@ -6815,26 +6820,27 @@ class MatDateShort {
|
|
|
6815
6820
|
writeValue(obj) {
|
|
6816
6821
|
if (this.writing)
|
|
6817
6822
|
return;
|
|
6818
|
-
|
|
6819
|
-
|
|
6823
|
+
this.writing = true;
|
|
6824
|
+
const date = isNilOrBlank(obj) ? undefined : this.dateAdapter.parse(obj, DATE_ISO_PATTERN);
|
|
6825
|
+
if (!date || !date.isValid()) {
|
|
6820
6826
|
this.dayControl.patchValue(null, { emitEvent: false });
|
|
6821
|
-
this._value = undefined;
|
|
6822
6827
|
if (this.formControl.value) {
|
|
6823
6828
|
this.formControl.patchValue(null, { emitEvent: false });
|
|
6824
6829
|
this._onChangeCallback(null);
|
|
6825
6830
|
}
|
|
6826
|
-
this.writing = false;
|
|
6827
|
-
this.markForCheck();
|
|
6828
|
-
return;
|
|
6829
6831
|
}
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
|
|
6832
|
+
else {
|
|
6833
|
+
const day = date
|
|
6834
|
+
// Important: clone, because startOf() will update the existing date
|
|
6835
|
+
.clone()
|
|
6836
|
+
// Reset hour
|
|
6837
|
+
.startOf('day');
|
|
6838
|
+
const dayStr = this.dateAdapter.format(day, this.dayPattern);
|
|
6839
|
+
// Set form value
|
|
6840
|
+
if (this.dayControl.value !== dayStr) {
|
|
6841
|
+
this.dayControl.patchValue(dayStr, { emitEvent: false });
|
|
6842
|
+
}
|
|
6833
6843
|
}
|
|
6834
|
-
this.writing = true;
|
|
6835
|
-
//console.log("call writeValue()", this.date, this.formControl);
|
|
6836
|
-
// Set form value
|
|
6837
|
-
this.dayControl.patchValue(this._value.clone().startOf('day').format(this.dayPattern), { emitEvent: false });
|
|
6838
6844
|
this.writing = false;
|
|
6839
6845
|
this.markForCheck();
|
|
6840
6846
|
}
|
|
@@ -6858,9 +6864,13 @@ class MatDateShort {
|
|
|
6858
6864
|
this.disabling = false;
|
|
6859
6865
|
this.markForCheck();
|
|
6860
6866
|
}
|
|
6861
|
-
|
|
6862
|
-
//
|
|
6863
|
-
if (
|
|
6867
|
+
_onDatePickerChange(event) {
|
|
6868
|
+
// Make sure event is valid
|
|
6869
|
+
if (!event || (event.value !== null && !isMoment$1(event.value))) {
|
|
6870
|
+
console.warn('Invalid MatDatepicker event. Skipping', event);
|
|
6871
|
+
return; // Skip
|
|
6872
|
+
}
|
|
6873
|
+
if (this.writing)
|
|
6864
6874
|
return; // Skip if call by self
|
|
6865
6875
|
this.writing = true;
|
|
6866
6876
|
let date = event.value;
|
|
@@ -6873,10 +6883,18 @@ class MatDateShort {
|
|
|
6873
6883
|
this.dayControl.setValue(day && day.format(this.dayPattern), { emitEvent: false });
|
|
6874
6884
|
// Get the model value
|
|
6875
6885
|
const dateStr = date && date.format(DATE_ISO_PATTERN).replace('+00:00', 'Z');
|
|
6876
|
-
this.formControl.
|
|
6886
|
+
if (this.formControl.value !== dateStr) {
|
|
6887
|
+
// DEBUG
|
|
6888
|
+
//console.debug('[mat-date-time] Emit new value: ' + dateStr);
|
|
6889
|
+
// Apply to form control. => Will call writeValue()
|
|
6890
|
+
this.formControl.patchValue(dateStr, { emitEvent: false });
|
|
6891
|
+
// Changes comes from inside function: use the callback
|
|
6892
|
+
this._onChangeCallback(dateStr);
|
|
6893
|
+
// Mark as touched
|
|
6894
|
+
this._onTouchedCallback();
|
|
6895
|
+
}
|
|
6877
6896
|
this.writing = false;
|
|
6878
6897
|
this.markForCheck();
|
|
6879
|
-
this._onChangeCallback(dateStr);
|
|
6880
6898
|
}
|
|
6881
6899
|
updatePattern(patterns) {
|
|
6882
6900
|
this.displayPattern =
|
|
@@ -6891,6 +6909,7 @@ class MatDateShort {
|
|
|
6891
6909
|
this.formControl.markAsPending();
|
|
6892
6910
|
this.formControl.setErrors(Object.assign({}, this.dayControl.errors));
|
|
6893
6911
|
this.writing = false;
|
|
6912
|
+
this.markForCheck();
|
|
6894
6913
|
return;
|
|
6895
6914
|
}
|
|
6896
6915
|
// Make to remove placeholder chars
|
|
@@ -6902,23 +6921,29 @@ class MatDateShort {
|
|
|
6902
6921
|
date = dayValue && this.dateAdapter.parse(dayValue, this.dayPattern) || null;
|
|
6903
6922
|
// Reset time
|
|
6904
6923
|
date = date && date.utc(true).hour(0).minute(0).seconds(0).millisecond(0);
|
|
6905
|
-
// update date picker
|
|
6906
|
-
this._value = date && this.dateAdapter.parse(date.clone(), DATE_ISO_PATTERN);
|
|
6907
6924
|
// Get the model value
|
|
6908
6925
|
const dateStr = date && date.isValid() && date.format(DATE_ISO_PATTERN).replace('+00:00', 'Z') || date;
|
|
6909
|
-
//
|
|
6910
|
-
this.formControl.
|
|
6911
|
-
|
|
6926
|
+
// Set model value
|
|
6927
|
+
if (this.formControl.value !== dateStr) {
|
|
6928
|
+
// DEBUG
|
|
6929
|
+
//console.debug('[mat-date-time] Emit new value: ' + dateStr);
|
|
6930
|
+
// Apply to form control. => Will call writeValue()
|
|
6931
|
+
// NOT NEED, because a formControl should NOT be used by multiple fields
|
|
6932
|
+
//this.formControl.setValue(dateStr, {emitEvent: false});
|
|
6933
|
+
// Changes comes from inside function: use the callback
|
|
6934
|
+
this._onChangeCallback(dateStr);
|
|
6935
|
+
// Check if need to update controls
|
|
6936
|
+
this._checkIfTouched();
|
|
6937
|
+
}
|
|
6912
6938
|
this.writing = false;
|
|
6913
6939
|
this.markForCheck();
|
|
6914
|
-
this._onChangeCallback(dateStr);
|
|
6915
6940
|
}
|
|
6916
|
-
|
|
6941
|
+
_checkIfTouched(opts) {
|
|
6917
6942
|
if (this.dayControl.touched) {
|
|
6918
|
-
this.markForCheck();
|
|
6919
6943
|
this._onTouchedCallback();
|
|
6920
|
-
|
|
6921
|
-
|
|
6944
|
+
if (!opts || opts.emitEvent !== false) {
|
|
6945
|
+
this.markForCheck();
|
|
6946
|
+
}
|
|
6922
6947
|
}
|
|
6923
6948
|
}
|
|
6924
6949
|
async openDatePickerIfMobile(event, datePicker) {
|
|
@@ -6955,12 +6980,12 @@ class MatDateShort {
|
|
|
6955
6980
|
event.returnValue = false;
|
|
6956
6981
|
}
|
|
6957
6982
|
focus() {
|
|
6958
|
-
|
|
6983
|
+
const input = this.matInputs.first;
|
|
6984
|
+
if (!input)
|
|
6959
6985
|
return;
|
|
6960
6986
|
setTimeout(() => {
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
elementRef.focus();
|
|
6987
|
+
if (isFocusableElement(input.nativeElement)) {
|
|
6988
|
+
input.nativeElement.focus();
|
|
6964
6989
|
}
|
|
6965
6990
|
});
|
|
6966
6991
|
}
|
|
@@ -6989,14 +7014,14 @@ class MatDateShort {
|
|
|
6989
7014
|
}
|
|
6990
7015
|
}
|
|
6991
7016
|
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 });
|
|
6992
|
-
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",
|
|
7017
|
+
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: [
|
|
6993
7018
|
DEFAULT_VALUE_ACCESSOR$3,
|
|
6994
|
-
], 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)=\"
|
|
7019
|
+
], 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 });
|
|
6995
7020
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: MatDateShort, decorators: [{
|
|
6996
7021
|
type: Component,
|
|
6997
7022
|
args: [{ selector: 'mat-date-short-field', providers: [
|
|
6998
7023
|
DEFAULT_VALUE_ACCESSOR$3,
|
|
6999
|
-
], 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)=\"
|
|
7024
|
+
], 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"] }]
|
|
7000
7025
|
}], ctorParameters: function () { return [{ type: i2$2.DateAdapter }, { type: i1$1.TranslateService }, { type: i1$2.UntypedFormBuilder }, { type: i0.ChangeDetectorRef }, { type: i1$2.FormGroupDirective, decorators: [{
|
|
7001
7026
|
type: Optional
|
|
7002
7027
|
}] }]; }, propDecorators: { mobile: [{
|
|
@@ -7021,12 +7046,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
7021
7046
|
type: Input
|
|
7022
7047
|
}], placeholderChar: [{
|
|
7023
7048
|
type: Input
|
|
7024
|
-
}], tabindex: [{
|
|
7025
|
-
type: Input
|
|
7026
7049
|
}], startDate: [{
|
|
7027
7050
|
type: Input
|
|
7028
7051
|
}], clearable: [{
|
|
7029
7052
|
type: Input
|
|
7053
|
+
}], tabindex: [{
|
|
7054
|
+
type: Input
|
|
7030
7055
|
}], datePicker1: [{
|
|
7031
7056
|
type: ViewChild,
|
|
7032
7057
|
args: ['datePicker1']
|
|
@@ -27982,9 +28007,10 @@ class AppEntityEditor extends AppTabEditor {
|
|
|
27982
28007
|
this._listenChangesSubscription = this.listenChanges(this.data.id, {
|
|
27983
28008
|
interval: this._listenIntervalInSeconds
|
|
27984
28009
|
})
|
|
27985
|
-
.pipe(filter(isNotNil),
|
|
27986
|
-
|
|
27987
|
-
|
|
28010
|
+
.pipe(filter(isNotNil), mergeMap((data) => this.saving
|
|
28011
|
+
// If saving, wait end, to avoid to detect self changes
|
|
28012
|
+
? firstFalse(this.savingSubject).pipe(mapTo(data), debounceTime(500))
|
|
28013
|
+
: of(data)))
|
|
27988
28014
|
.subscribe((data) => {
|
|
27989
28015
|
const isNewer = isMoment(data.updateDate) && data.updateDate.isAfter(this.data.updateDate);
|
|
27990
28016
|
if (!isNewer)
|