@sumaris-net/ngx-components 1.15.1 → 1.15.4
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/bundles/sumaris-net.ngx-components.umd.js +85 -59
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/doc/changelog.md +4 -0
- package/esm2015/src/app/core/services/platform.service.js +1 -1
- package/esm2015/src/app/shared/material/datetime/material.date.js +45 -21
- package/esm2015/src/app/shared/material/datetime/material.datetime.js +41 -39
- package/esm2015/src/app/shared/material/datetime/testing/mat-date.test.js +2 -2
- package/fesm2015/sumaris-net.ngx-components.js +85 -59
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/shared/material/datetime/material.date.d.ts +6 -3
- package/src/app/shared/material/datetime/material.datetime.d.ts +5 -4
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -4806,8 +4806,10 @@ class MatDate {
|
|
|
4806
4806
|
this.formControl.setValidators(this.required ? [this.formControl.validator, Validators.required, SharedValidators.validDate] :
|
|
4807
4807
|
[this.formControl.validator, SharedValidators.validDate]);
|
|
4808
4808
|
}
|
|
4809
|
+
// Create the day control
|
|
4809
4810
|
this.dayControl = this.formBuilder.control(null, () => this.formControl.errors);
|
|
4810
4811
|
// Get patterns to display date
|
|
4812
|
+
this.updatePattern(this.translate.instant('COMMON.DATE_PATTERN'));
|
|
4811
4813
|
this._subscription.add(this.translate.get('COMMON.DATE_PATTERN')
|
|
4812
4814
|
.subscribe((pattern) => this.updatePattern(pattern)));
|
|
4813
4815
|
this._subscription.add(this.dayControl.valueChanges
|
|
@@ -4818,6 +4820,9 @@ class MatDate {
|
|
|
4818
4820
|
)
|
|
4819
4821
|
.subscribe(() => {
|
|
4820
4822
|
this.dayControl.updateValueAndValidity({ emitEvent: false });
|
|
4823
|
+
if (this.formControl.touched && !this.dayControl.touched) {
|
|
4824
|
+
this.dayControl.markAsTouched();
|
|
4825
|
+
}
|
|
4821
4826
|
this.markForCheck();
|
|
4822
4827
|
}));
|
|
4823
4828
|
this.updateTabIndex();
|
|
@@ -4826,14 +4831,15 @@ class MatDate {
|
|
|
4826
4831
|
ngOnDestroy() {
|
|
4827
4832
|
this._subscription.unsubscribe();
|
|
4828
4833
|
}
|
|
4829
|
-
writeValue(
|
|
4834
|
+
writeValue(value) {
|
|
4830
4835
|
if (this._writing)
|
|
4831
4836
|
return; // Skip
|
|
4832
4837
|
this._writing = true;
|
|
4833
4838
|
// DEBUG
|
|
4834
|
-
//
|
|
4835
|
-
|
|
4836
|
-
|
|
4839
|
+
//console.debug("[mat-date] writeValue() with:", value);
|
|
4840
|
+
// Convert into date, and clone if necessary
|
|
4841
|
+
const date = isMoment(value) ? value.clone() : fromDateISOString(value);
|
|
4842
|
+
if (!date || !date.isValid()) {
|
|
4837
4843
|
this.dayControl.patchValue(null, { emitEvent: false });
|
|
4838
4844
|
if (this.formControl.value) {
|
|
4839
4845
|
this.formControl.patchValue(null, { emitEvent: false });
|
|
@@ -4842,13 +4848,17 @@ class MatDate {
|
|
|
4842
4848
|
}
|
|
4843
4849
|
else {
|
|
4844
4850
|
// Format day
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4851
|
+
let day = date && this.timezone
|
|
4852
|
+
// Move to the expected TZ (keeping local hour - e.g. midnight)
|
|
4853
|
+
? date.tz(this.timezone)
|
|
4854
|
+
// Not TZ: important: do a clone
|
|
4855
|
+
: date;
|
|
4848
4856
|
day = day.startOf('day');
|
|
4849
4857
|
const dayStr = this.dateAdapter.format(day, this.dayPattern);
|
|
4850
|
-
|
|
4851
|
-
|
|
4858
|
+
if (this.dayControl.value !== dayStr) {
|
|
4859
|
+
// Update control
|
|
4860
|
+
this.dayControl.patchValue(dayStr, { emitEvent: false });
|
|
4861
|
+
}
|
|
4852
4862
|
}
|
|
4853
4863
|
this._writing = false;
|
|
4854
4864
|
this.markForCheck();
|
|
@@ -4888,7 +4898,7 @@ class MatDate {
|
|
|
4888
4898
|
}
|
|
4889
4899
|
if (this.dayControl.value !== dateStr) {
|
|
4890
4900
|
// DEBUG
|
|
4891
|
-
console.debug("[mat-date] onDatePickerChange() new value:", dateStr);
|
|
4901
|
+
//console.debug("[mat-date] onDatePickerChange() new value:", dateStr);
|
|
4892
4902
|
this.dayControl.setValue(dateStr, {
|
|
4893
4903
|
emitEvent: true // Will call onFormChange
|
|
4894
4904
|
});
|
|
@@ -4949,27 +4959,37 @@ class MatDate {
|
|
|
4949
4959
|
this.markForCheck();
|
|
4950
4960
|
}
|
|
4951
4961
|
}
|
|
4952
|
-
checkIfTouched() {
|
|
4962
|
+
checkIfTouched(opts) {
|
|
4953
4963
|
if (this.dayControl.touched) {
|
|
4954
4964
|
this._onTouchedCallback();
|
|
4955
|
-
|
|
4965
|
+
if (!opts || opts.emitEvent !== false) {
|
|
4966
|
+
this.markForCheck();
|
|
4967
|
+
}
|
|
4956
4968
|
}
|
|
4957
4969
|
}
|
|
4958
4970
|
onFormChange(dayStr) {
|
|
4959
4971
|
if (this._writing)
|
|
4960
4972
|
return; // Skip if call by self
|
|
4961
4973
|
this._writing = true;
|
|
4974
|
+
if (this.dayControl.invalid) {
|
|
4975
|
+
this.formControl.markAsPending({ onlySelf: true });
|
|
4976
|
+
this.formControl.setErrors(Object.assign(Object.assign({}, this.formControl.errors), this.dayControl.errors));
|
|
4977
|
+
this.formControl.markAsDirty();
|
|
4978
|
+
this._writing = false;
|
|
4979
|
+
return;
|
|
4980
|
+
}
|
|
4962
4981
|
// Make to remove placeholder chars
|
|
4963
4982
|
while (dayStr && dayStr.indexOf(this.placeholderChar) !== -1) {
|
|
4964
4983
|
dayStr = dayStr.replace(this.placeholderChar, '');
|
|
4965
4984
|
}
|
|
4966
4985
|
// Parse day
|
|
4967
|
-
let
|
|
4968
|
-
// Move to the expected TZ
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4986
|
+
let dayDate = dayStr && this.dateAdapter.parse(dayStr, this.dayPattern);
|
|
4987
|
+
// Move to the expected TZ, and keep the local hour (= midnight) to have midnight at local time
|
|
4988
|
+
dayDate = dayDate && (this.timezone ? dayDate.tz(this.timezone, true) : dayDate);
|
|
4989
|
+
dayDate = dayDate && dayDate
|
|
4990
|
+
.startOf('day') // Reset hour
|
|
4991
|
+
.utc(); // Convert to UTC (avoid TZ offset in final string)
|
|
4992
|
+
this.emitChange(dayDate);
|
|
4973
4993
|
this._writing = false;
|
|
4974
4994
|
}
|
|
4975
4995
|
waitKeyboardHide(waitKeyboardDelay) {
|
|
@@ -4991,7 +5011,10 @@ class MatDate {
|
|
|
4991
5011
|
const dateStr = toDateISOString(value) || null;
|
|
4992
5012
|
if (this.formControl.value !== dateStr) {
|
|
4993
5013
|
// DEBUG
|
|
4994
|
-
//console.debug('[
|
|
5014
|
+
//console.debug('[mat-date] Emit new value: ' + dateStr);
|
|
5015
|
+
// Apply to form control. => Will call writeValue()
|
|
5016
|
+
// NOT NEED, because a formControl should NOT be used by multiple fields
|
|
5017
|
+
//this.formControl.setValue(dateStr, {emitEvent: false})
|
|
4995
5018
|
// Changes comes from inside function: use the callback
|
|
4996
5019
|
this._onChangeCallback(dateStr);
|
|
4997
5020
|
// Check if need to update controls
|
|
@@ -5024,7 +5047,7 @@ class MatDate {
|
|
|
5024
5047
|
MatDate.decorators = [
|
|
5025
5048
|
{ type: Component, args: [{
|
|
5026
5049
|
selector: 'mat-date-field',
|
|
5027
|
-
template: "<!-- readonly -->\n<mat-form-field *ngIf=\"readonly; else writable\"\n [floatLabel]=\"floatLabel\"\n class=\"mat-form-field-disabled\">\n\n <div matPrefix>\n <ng-container *ngTemplateOutlet=\"matPrefixTemplate\"></ng-container>\n </div>\n\n <input matInput hidden type=\"text\"\n readonly\n [placeholder]=\"placeholder\"\n [formControl]=\"formControl\">\n <ion-text>{{formControl.value|dateFormat: {pattern: displayPattern} }}</ion-text>\n</mat-form-field>\n\n<!-- writable -->\n<ng-template #writable>\n <mat-form-field [floatLabel]=\"floatLabel\">\n\n <mat-label>{{placeholder}}</mat-label>\n\n <div matPrefix>\n <ng-container *ngTemplateOutlet=\"matPrefixTemplate\"></ng-container>\n </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_PLACEHOLDER'|translate\"\n (blur)=\"checkIfTouched()\"\n (keyup.arrowdown)=\"openDatePicker($event, datePicker)\"\n (keyup.escape)=\"preventEvent($event)\"\n [required]=\"required\"\n [tabindex]=\"tabindex\"\n [appAutofocus]=\"autofocus\">\n <input matInput #matInput autocomplete=\"off\" type=\"text\"\n *ngIf=\"mobile\"\n [formControl]=\"dayControl\"\n (click)=\"openDatePickerIfMobile($event, datePicker)\"\n [required]=\"required\"\n [tabindex]=\"tabindex\"\n readonly>\n\n <!-- Hide the final input -->\n <input matInput type=\"text\" [formControl]=\"formControl\"\n hidden\n [matDatepicker]=\"datePicker\"\n (dateChange)=\"onDatePickerChange($event)\">\n\n <button type=\"button\" mat-icon-button tabindex=\"-1\" matSuffix\n (click)=\"openDatePicker($event, datePicker)\"\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)=\"clear()\"\n [hidden]=\"formControl.disabled || !formControl.value\">\n <mat-icon>close</mat-icon>\n </button>\n\n <!-- errors -->\n <mat-error *ngIf=\"formControl.touched && formControl.errors|mapKeys|arrayFirst; let errorKey\">\n <ng-container [ngSwitch]=\"errorKey\">\n <span *ngSwitchCase=\"'required'\" translate>ERROR.FIELD_REQUIRED</span>\n <span *ngSwitchCase=\"'validDate'\" translate>ERROR.FIELD_NOT_VALID_DATE_TIME</span>\n <span *ngSwitchCase=\"'dateIsAfter'\">{{'ERROR.FIELD_NOT_VALID_DATE_AFTER' | translate: formControl.errors.dateIsAfter }}</span>\n <span *ngSwitchCase=\"'dateIsBefore'\">{{'ERROR.FIELD_NOT_VALID_DATE_BEFORE' | translate: formControl.errors.dateIsBefore }}</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 </ng-container>\n </mat-error>\n <ng-content select=\"mat-error\"></ng-content>\n\n <!-- mat hint -->\n <div class=\"mat-form-field-hint-wrapper\" [class.cdk-visually-hidden]=\"formControl.invalid\">\n <div class=\"mat-form-field-hint-spacer\"></div>\n <ng-content select=\"mat-hint\"></ng-content>\n </div>\n </mat-form-field>\n\n <mat-datepicker #datePicker\n [touchUi]=\"mobile\"\n [disabled]=\"formControl.disabled\"\n [startAt]=\"startDate\"></mat-datepicker>\n\n\n\n</ng-template>\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 #matPrefixTemplate>\n <ng-content select=\"[matPrefix]\"></ng-content>\n</ng-template>\n",
|
|
5050
|
+
template: "<!-- readonly -->\n<mat-form-field *ngIf=\"readonly; else writable\"\n [floatLabel]=\"floatLabel\"\n class=\"mat-form-field-disabled\">\n\n <div matPrefix>\n <ng-container *ngTemplateOutlet=\"matPrefixTemplate\"></ng-container>\n </div>\n\n <input matInput hidden type=\"text\"\n readonly\n [placeholder]=\"placeholder\"\n [formControl]=\"formControl\">\n <ion-text>{{formControl.value|dateFormat: {pattern: displayPattern} }}</ion-text>\n</mat-form-field>\n\n<!-- writable -->\n<ng-template #writable>\n <mat-form-field [floatLabel]=\"floatLabel\">\n\n <mat-label>{{placeholder}}</mat-label>\n\n <div matPrefix>\n <ng-container *ngTemplateOutlet=\"matPrefixTemplate\"></ng-container>\n </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_PLACEHOLDER'|translate\"\n (blur)=\"checkIfTouched()\"\n (keyup.arrowdown)=\"openDatePicker($event, datePicker)\"\n (keyup.escape)=\"preventEvent($event)\"\n [required]=\"required\"\n [tabindex]=\"tabindex\"\n [appAutofocus]=\"autofocus\">\n <input matInput #matInput autocomplete=\"off\" type=\"text\"\n *ngIf=\"mobile\"\n [formControl]=\"dayControl\"\n (click)=\"openDatePickerIfMobile($event, datePicker)\"\n [required]=\"required\"\n [tabindex]=\"tabindex\"\n readonly>\n\n <!-- Hide the final input -->\n <input matInput type=\"text\" [formControl]=\"formControl\"\n hidden\n [matDatepicker]=\"datePicker\"\n [matDatepickerFilter]=\"datePickerFilter\"\n (dateChange)=\"onDatePickerChange($event)\">\n\n <button type=\"button\" mat-icon-button tabindex=\"-1\" matSuffix\n (click)=\"openDatePicker($event, datePicker)\"\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)=\"clear()\"\n [hidden]=\"formControl.disabled || !formControl.value\">\n <mat-icon>close</mat-icon>\n </button>\n\n <!-- errors -->\n <mat-error *ngIf=\"formControl.touched && formControl.errors|mapKeys|arrayFirst; let errorKey\">\n <ng-container [ngSwitch]=\"errorKey\">\n <span *ngSwitchCase=\"'required'\" translate>ERROR.FIELD_REQUIRED</span>\n <span *ngSwitchCase=\"'validDate'\" translate>ERROR.FIELD_NOT_VALID_DATE_TIME</span>\n <span *ngSwitchCase=\"'dateIsAfter'\">{{'ERROR.FIELD_NOT_VALID_DATE_AFTER' | translate: formControl.errors.dateIsAfter }}</span>\n <span *ngSwitchCase=\"'dateIsBefore'\">{{'ERROR.FIELD_NOT_VALID_DATE_BEFORE' | translate: formControl.errors.dateIsBefore }}</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 </ng-container>\n </mat-error>\n <ng-content select=\"mat-error\"></ng-content>\n\n <!-- mat hint -->\n <div class=\"mat-form-field-hint-wrapper\" [class.cdk-visually-hidden]=\"formControl.invalid\">\n <div class=\"mat-form-field-hint-spacer\"></div>\n <ng-content select=\"mat-hint\"></ng-content>\n </div>\n </mat-form-field>\n\n <mat-datepicker #datePicker\n [touchUi]=\"mobile\"\n [disabled]=\"formControl.disabled\"\n [startAt]=\"startDate\"\n ></mat-datepicker>\n\n\n\n</ng-template>\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 #matPrefixTemplate>\n <ng-content select=\"[matPrefix]\"></ng-content>\n</ng-template>\n",
|
|
5028
5051
|
providers: [
|
|
5029
5052
|
DEFAULT_VALUE_ACCESSOR$5,
|
|
5030
5053
|
],
|
|
@@ -5054,6 +5077,7 @@ MatDate.propDecorators = {
|
|
|
5054
5077
|
startDate: [{ type: Input }],
|
|
5055
5078
|
clearable: [{ type: Input }],
|
|
5056
5079
|
timezone: [{ type: Input }],
|
|
5080
|
+
datePickerFilter: [{ type: Input }],
|
|
5057
5081
|
readonly: [{ type: Input }],
|
|
5058
5082
|
tabindex: [{ type: Input }],
|
|
5059
5083
|
datePicker: [{ type: ViewChild, args: ['datePicker',] }],
|
|
@@ -5129,18 +5153,18 @@ class MatDateTime {
|
|
|
5129
5153
|
this.formControl.setValidators(this.required ? [this.formControl.validator, Validators.required, SharedValidators.validDate] :
|
|
5130
5154
|
[this.formControl.validator, SharedValidators.validDate]);
|
|
5131
5155
|
}
|
|
5132
|
-
// Create the
|
|
5133
|
-
this.
|
|
5134
|
-
// Create the
|
|
5156
|
+
// Create the day control
|
|
5157
|
+
this.dayControl = this.formBuilder.control(null, this.required ? Validators.required : null);
|
|
5158
|
+
// Create the hour control
|
|
5135
5159
|
const timeValidator = this.required ?
|
|
5136
5160
|
(this.mobile ? Validators.required : Validators.compose([Validators.required, Validators.pattern(HOUR_REGEXP)])) :
|
|
5137
5161
|
(this.mobile ? null : Validators.pattern(HOUR_REGEXP));
|
|
5138
|
-
this.
|
|
5162
|
+
this.hourControl = this.formBuilder.control(null, timeValidator);
|
|
5139
5163
|
// Get patterns to display date and date+time
|
|
5140
5164
|
this._subscription.add(this.translate.get(['COMMON.DATE_PATTERN', 'COMMON.DATE_TIME_PATTERN'])
|
|
5141
5165
|
.subscribe((patterns) => this.updatePattern(patterns)));
|
|
5142
|
-
this._subscription.add(merge(this.
|
|
5143
|
-
.subscribe((
|
|
5166
|
+
this._subscription.add(merge(this.dayControl.valueChanges, this.hourControl.valueChanges)
|
|
5167
|
+
.subscribe((_) => this.onFormChange()));
|
|
5144
5168
|
// Listen status changes (when done outside the component - e.g. when setErrors() is calling on the formControl)
|
|
5145
5169
|
this._subscription.add(this.formControl.statusChanges
|
|
5146
5170
|
.pipe(filter((_) => !this.readonly && !this._writing && !this._disabling) // Skip
|
|
@@ -5152,32 +5176,32 @@ class MatDateTime {
|
|
|
5152
5176
|
ngOnDestroy() {
|
|
5153
5177
|
this._subscription.unsubscribe();
|
|
5154
5178
|
}
|
|
5155
|
-
writeValue(
|
|
5179
|
+
writeValue(value) {
|
|
5156
5180
|
if (this._writing)
|
|
5157
5181
|
return; // Skip
|
|
5158
5182
|
this._writing = true;
|
|
5159
5183
|
// DEBUG
|
|
5160
|
-
// console.debug("[mat-date-time] writeValue() with:",
|
|
5161
|
-
const
|
|
5162
|
-
if (!
|
|
5163
|
-
this.
|
|
5164
|
-
this.
|
|
5184
|
+
// console.debug("[mat-date-time] writeValue() with:", value);
|
|
5185
|
+
const date = fromDateISOString(value);
|
|
5186
|
+
if (!date || !date.isValid()) {
|
|
5187
|
+
this.dayControl.patchValue(null, { emitEvent: false });
|
|
5188
|
+
this.hourControl.patchValue(null, { emitEvent: false });
|
|
5165
5189
|
}
|
|
5166
5190
|
else {
|
|
5167
5191
|
// Format day
|
|
5168
|
-
const day =
|
|
5192
|
+
const day = date.clone().startOf('day');
|
|
5169
5193
|
const dayStr = this.dateAdapter.format(day, this.dayPattern);
|
|
5170
5194
|
// Format time
|
|
5171
5195
|
// - Format hh
|
|
5172
|
-
let hour =
|
|
5196
|
+
let hour = date.hour();
|
|
5173
5197
|
hour = hour < 10 ? ('0' + hour) : hour;
|
|
5174
5198
|
// - Format mm
|
|
5175
|
-
let minutes =
|
|
5199
|
+
let minutes = date.minutes();
|
|
5176
5200
|
minutes = minutes < 10 ? ('0' + minutes) : minutes;
|
|
5177
5201
|
const timeStr = `${hour}:${minutes}`;
|
|
5178
5202
|
// Update controls
|
|
5179
|
-
this.
|
|
5180
|
-
this.
|
|
5203
|
+
this.dayControl.patchValue(dayStr, { emitEvent: false });
|
|
5204
|
+
this.hourControl.patchValue(timeStr, { emitEvent: false });
|
|
5181
5205
|
}
|
|
5182
5206
|
this._writing = false;
|
|
5183
5207
|
this.markForCheck();
|
|
@@ -5193,12 +5217,12 @@ class MatDateTime {
|
|
|
5193
5217
|
return; // Skip
|
|
5194
5218
|
this._disabling = true;
|
|
5195
5219
|
if (isDisabled) {
|
|
5196
|
-
this.
|
|
5197
|
-
this.
|
|
5220
|
+
this.dayControl.disable({ emitEvent: false });
|
|
5221
|
+
this.hourControl.disable({ emitEvent: false });
|
|
5198
5222
|
}
|
|
5199
5223
|
else {
|
|
5200
|
-
this.
|
|
5201
|
-
this.
|
|
5224
|
+
this.dayControl.enable({ emitEvent: false });
|
|
5225
|
+
this.hourControl.enable({ emitEvent: false });
|
|
5202
5226
|
}
|
|
5203
5227
|
this._disabling = false;
|
|
5204
5228
|
this.markForCheck();
|
|
@@ -5211,25 +5235,25 @@ class MatDateTime {
|
|
|
5211
5235
|
}
|
|
5212
5236
|
// Convert to usable date, then convert to day pattern (e.g DD/MM/YYYY)
|
|
5213
5237
|
const day = event.value && event.value
|
|
5214
|
-
.locale(this.locale) // set
|
|
5238
|
+
.locale(this.locale) // set locale
|
|
5215
5239
|
.hour(0).minute(0).seconds(0).millisecond(0) // Reset hour
|
|
5216
5240
|
.utc(true);
|
|
5217
5241
|
const dayStr = day && this.dateAdapter.format(day, this.dayPattern) || null;
|
|
5218
5242
|
// Update the day control
|
|
5219
|
-
if (this.
|
|
5243
|
+
if (this.dayControl.value !== dayStr) {
|
|
5220
5244
|
// DEBUG
|
|
5221
5245
|
// console.debug("[mat-date-time] onDatePickerChange() new value:", dayStr);
|
|
5222
|
-
this.
|
|
5246
|
+
this.dayControl.setValue(dayStr, {
|
|
5223
5247
|
emitEvent: true // Will call onFormChange
|
|
5224
5248
|
});
|
|
5225
5249
|
}
|
|
5226
5250
|
}
|
|
5227
5251
|
onTimePickerChange(timeStr) {
|
|
5228
5252
|
// Update the time control, if need
|
|
5229
|
-
if (this.
|
|
5253
|
+
if (this.hourControl.value !== timeStr) {
|
|
5230
5254
|
// DEBUG
|
|
5231
5255
|
// console.debug("[mat-date-time] onTimePickerChange() new value:", timeStr);
|
|
5232
|
-
this.
|
|
5256
|
+
this.hourControl.setValue(timeStr, {
|
|
5233
5257
|
emitEvent: true // Will call onFormChange
|
|
5234
5258
|
});
|
|
5235
5259
|
}
|
|
@@ -5301,26 +5325,24 @@ class MatDateTime {
|
|
|
5301
5325
|
this.dayPattern = (patterns['COMMON.DATE_PATTERN'] !== 'COMMON.DATE_PATTERN' ? patterns['COMMON.DATE_PATTERN'] : 'L');
|
|
5302
5326
|
}
|
|
5303
5327
|
checkIfTouched() {
|
|
5304
|
-
if (this.
|
|
5328
|
+
if (this.dayControl.touched || this.hourControl.touched) {
|
|
5305
5329
|
this._onTouchedCallback();
|
|
5306
5330
|
this.markForCheck();
|
|
5307
5331
|
}
|
|
5308
5332
|
}
|
|
5309
|
-
onFormChange(
|
|
5333
|
+
onFormChange() {
|
|
5310
5334
|
if (this._writing)
|
|
5311
5335
|
return; // Skip if call by self
|
|
5312
5336
|
this._writing = true;
|
|
5313
|
-
let dayStr = this.
|
|
5314
|
-
const time = this.
|
|
5337
|
+
let dayStr = this.dayControl.value;
|
|
5338
|
+
const time = this.hourControl.value;
|
|
5315
5339
|
// DEBUG
|
|
5316
5340
|
//console.debug(`[mat-date-time] onFormChange() from event: ${event} - controls values: `, [dayStr, time]);
|
|
5317
5341
|
const incompleteValue = isNilOrBlank(time) !== isNilOrBlank(dayStr);
|
|
5318
|
-
if (incompleteValue || this.
|
|
5342
|
+
if (incompleteValue || this.dayControl.invalid || this.hourControl.invalid) {
|
|
5319
5343
|
this.formControl.markAsPending({ onlySelf: true });
|
|
5320
|
-
this.formControl.setErrors(Object.assign(Object.assign(Object.assign({ validDate: incompleteValue }, this.formControl.errors), this.
|
|
5344
|
+
this.formControl.setErrors(Object.assign(Object.assign(Object.assign({ validDate: incompleteValue }, this.formControl.errors), this.dayControl.errors), this.hourControl.errors));
|
|
5321
5345
|
this.formControl.markAsDirty();
|
|
5322
|
-
// Reset the value
|
|
5323
|
-
//this.emitChange(null);
|
|
5324
5346
|
this._writing = false;
|
|
5325
5347
|
return;
|
|
5326
5348
|
}
|
|
@@ -5362,7 +5384,10 @@ class MatDateTime {
|
|
|
5362
5384
|
const dateStr = toDateISOString(value) || null;
|
|
5363
5385
|
if (this.formControl.value !== dateStr) {
|
|
5364
5386
|
// DEBUG
|
|
5365
|
-
//console.debug('[
|
|
5387
|
+
//console.debug('[mat-date-time] Emit new value: ' + dateStr);
|
|
5388
|
+
// Apply to form control. => Will call writeValue()
|
|
5389
|
+
// NOT NEED, because a formControl should NOT be used by multiple fields
|
|
5390
|
+
//this.formControl.setValue(dateStr, {emitEvent: false});
|
|
5366
5391
|
// Changes comes from inside function: use the callback
|
|
5367
5392
|
this._onChangeCallback(dateStr);
|
|
5368
5393
|
// Check if need to update controls
|
|
@@ -5381,8 +5406,8 @@ class MatDateTime {
|
|
|
5381
5406
|
});
|
|
5382
5407
|
}
|
|
5383
5408
|
markAsTouched(opts) {
|
|
5384
|
-
this.
|
|
5385
|
-
this.
|
|
5409
|
+
this.dayControl.markAsTouched(opts);
|
|
5410
|
+
this.hourControl.markAsTouched(opts);
|
|
5386
5411
|
this._onTouchedCallback();
|
|
5387
5412
|
this.markForCheck();
|
|
5388
5413
|
}
|
|
@@ -5396,7 +5421,7 @@ class MatDateTime {
|
|
|
5396
5421
|
MatDateTime.decorators = [
|
|
5397
5422
|
{ type: Component, args: [{
|
|
5398
5423
|
selector: 'mat-date-time-field',
|
|
5399
|
-
template: "<!-- readonly -->\n<mat-form-field *ngIf=\"readonly; else writable\"\n [floatLabel]=\"floatLabel\"\n class=\"mat-form-field-disabled\">\n\n <div matPrefix>\n <ng-container *ngTemplateOutlet=\"matPrefixTemplate\"></ng-container>\n </div>\n\n <input matInput hidden type=\"text\"\n readonly\n [placeholder]=\"placeholder\"\n [formControl]=\"formControl\">\n <ion-text>{{formControl.value|dateFormat: {pattern: displayPattern} }}</ion-text>\n</mat-form-field>\n\n<!-- writable + time -->\n<ng-template #writable >\n <ion-grid class=\"ion-no-padding\">\n <ion-row class=\"ion-no-padding no-wrap\" nowrap>\n\n <!-- day -->\n <ion-col class=\"day ion-no-padding\">\n <mat-form-field [floatLabel]=\"floatLabel\"\n [class.mat-form-field-invalid]=\"formControl.touched && formControl.invalid\">\n\n <mat-label>{{placeholder}}</mat-label>\n\n <div matPrefix>\n <ng-container *ngTemplateOutlet=\"matPrefixTemplate\"></ng-container>\n </div>\n\n <input matInput #matInput autocomplete=\"off\" type=\"text\"\n *ngIf=\"!mobile\"\n [formControl]=\"
|
|
5424
|
+
template: "<!-- readonly -->\n<mat-form-field *ngIf=\"readonly; else writable\"\n [floatLabel]=\"floatLabel\"\n class=\"mat-form-field-disabled\">\n\n <div matPrefix>\n <ng-container *ngTemplateOutlet=\"matPrefixTemplate\"></ng-container>\n </div>\n\n <input matInput hidden type=\"text\"\n readonly\n [placeholder]=\"placeholder\"\n [formControl]=\"formControl\">\n <ion-text>{{formControl.value|dateFormat: {pattern: displayPattern} }}</ion-text>\n</mat-form-field>\n\n<!-- writable + time -->\n<ng-template #writable >\n <ion-grid class=\"ion-no-padding\">\n <ion-row class=\"ion-no-padding no-wrap\" nowrap>\n\n <!-- day -->\n <ion-col class=\"day ion-no-padding\">\n <mat-form-field [floatLabel]=\"floatLabel\"\n [class.mat-form-field-invalid]=\"formControl.touched && formControl.invalid\">\n\n <mat-label>{{placeholder}}</mat-label>\n\n <div matPrefix>\n <ng-container *ngTemplateOutlet=\"matPrefixTemplate\"></ng-container>\n </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_PLACEHOLDER'|translate\"\n (blur)=\"checkIfTouched()\"\n (keyup.arrowdown)=\"openDatePicker($event, datePicker)\"\n (keyup.escape)=\"preventEvent($event)\"\n [required]=\"required\"\n [tabindex]=\"tabindex\"\n [appAutofocus]=\"autofocus\">\n <input matInput #matInput autocomplete=\"off\" type=\"text\"\n *ngIf=\"mobile\"\n [formControl]=\"dayControl\"\n (click)=\"openDatePickerIfMobile($event, datePicker)\"\n [required]=\"required\"\n [tabindex]=\"tabindex\"\n readonly>\n\n <!-- Hide the final input -->\n <input matInput type=\"text\" [formControl]=\"formControl\"\n hidden\n [matDatepicker]=\"datePicker\"\n [matDatepickerFilter]=\"datePickerFilter\"\n (dateChange)=\"onDatePickerChange($event)\">\n\n <button type=\"button\" mat-icon-button tabindex=\"-1\" matSuffix\n (click)=\"openDatePicker($event, datePicker)\"\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)=\"clear()\"\n [hidden]=\"formControl.disabled || !formControl.value\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n <mat-datepicker #datePicker\n [touchUi]=\"mobile\"\n [disabled]=\"formControl.disabled\"\n [startAt]=\"startDate\"></mat-datepicker>\n <div class=\"mat-form-field-subscript mat-form-field-subscript-wrapper\" >\n <!-- errors -->\n <ng-container [ngSwitch]=\"formControl.touched && formControl.errors|mapKeys|arrayFirst\">\n <mat-error *ngSwitchCase=\"'required'\" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngSwitchCase=\"'validDate'\" translate>ERROR.FIELD_NOT_VALID_DATE_TIME</mat-error>\n <mat-error *ngSwitchCase=\"'dateIsAfter'\">{{'ERROR.FIELD_NOT_VALID_DATE_AFTER' | translate: formControl.errors.dateIsAfter }}</mat-error>\n <mat-error *ngSwitchCase=\"'dateIsBefore'\">{{'ERROR.FIELD_NOT_VALID_DATE_BEFORE' | translate: formControl.errors.dateIsBefore }}</mat-error>\n <mat-error *ngSwitchCase=\"'dateRange'\" translate>ERROR.FIELD_NOT_VALID_DATE_RANGE</mat-error>\n <mat-error *ngSwitchCase=\"'dateMaxDuration'\" translate>ERROR.FIELD_NOT_VALID_DATE_MAX_DURATION</mat-error>\n <mat-error *ngSwitchCase=\"'dateMinDuration'\" translate>ERROR.FIELD_NOT_VALID_DATE_MIN_DURATION</mat-error>\n <mat-error *ngSwitchCase=\"'msg'\">{{(formControl.errors.msg?.key || formControl.errors.msg) | translate: formControl.errors.msg?.params}}</mat-error>\n </ng-container>\n <ng-content select=\"mat-error\"></ng-content>\n\n <!-- mat hint -->\n <div class=\"mat-form-field-hint-wrapper\" [class.cdk-visually-hidden]=\"formControl.invalid\">\n <div class=\"mat-form-field-hint-spacer\"></div>\n <ng-content select=\"mat-hint\"></ng-content>\n </div>\n </div>\n\n </ion-col>\n\n <!-- hour -->\n <ion-col class=\"hour ion-no-padding\">\n <mat-form-field [floatLabel]=\"floatLabel\"\n [class.mat-form-field-invalid]=\"formControl.touched && (hourControl.invalid || formControl.invalid)\">\n <mat-label *ngIf=\"placeholder && floatLabel != 'never'\" translate>COMMON.TIME</mat-label>\n <input matInput #matInput type=\"text\"\n *ngIf=\"!mobile\"\n [formControl]=\"hourControl\"\n autocomplete=\"off\"\n min=\"0\" max=\"23\"\n [textMask]=\"{mask: hourMask, keepCharPositions: true, placeholderChar: placeholderChar, guide: true}\"\n [placeholder]=\"'COMMON.TIME_PLACEHOLDER'|translate\"\n [required]=\"required\"\n (keyup.arrowdown)=\"openTimePicker($event)\"\n (keyup.escape)=\"preventEvent($event)\"\n (blur)=\"checkIfTouched()\"\n [tabindex]=\"tabindex !== undefined ? tabindex+1 : undefined\">\n\n <input matInput #matInput type=\"text\"\n *ngIf=\"mobile\"\n [formControl]=\"hourControl\"\n (click)=\"openTimePickerIfMobile($event)\"\n readonly>\n\n <input matInput type=\"text\"\n [formControl]=\"hourControl\"\n hidden\n [ngxTimepicker]=\"timePicker\"\n [format]=\"24\">\n\n <button matSuffix type=\"button\" mat-icon-button\n tabindex=\"-1\"\n *ngIf=\"!compact && !mobile\"\n [disabled]=\"formControl.disabled\"\n (click)=\"openTimePicker($event)\" >\n <mat-icon>keyboard_arrow_down</mat-icon>\n </button>\n <button matSuffix type=\"button\" mat-icon-button\n tabindex=\"-1\"\n *ngIf=\"!compact && mobile\"\n [disabled]=\"formControl.disabled\"\n (click)=\"openTimePickerIfMobile($event)\">\n <mat-icon>access_time</mat-icon>\n </button>\n\n <ngx-material-timepicker #timePicker [@.disabled]=\"true\"\n (timeSet)=\"onTimePickerChange($event)\"\n [ESC]=\"!mobile\"\n [defaultTime]=\"'00:00'\"\n [cancelBtnTmpl]=\"timePickerCancelButton\"\n [confirmBtnTmpl]=\"timePickerOkButton\"\n [preventOverlayClick]=\"mobile\"\n [enableKeyboardInput]=\"false\"\n [disableAnimation]=\"true\">\n <!-- cancel button -->\n <ng-template #timePickerCancelButton>\n <ion-button fill=\"clear\" color=\"dark\">\n <ion-label translate>COMMON.BTN_CANCEL</ion-label>\n </ion-button>\n </ng-template>\n\n <!-- confirm button -->\n <ng-template #timePickerOkButton>\n <ion-button fill=\"solid\" color=\"tertiary\">\n <ion-label translate>COMMON.BTN_VALIDATE</ion-label>\n </ion-button>\n </ng-template>\n\n </ngx-material-timepicker>\n </mat-form-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n\n</ng-template>\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 #matPrefixTemplate>\n <ng-content select=\"[matPrefix]\"></ng-content>\n</ng-template>\n",
|
|
5400
5425
|
providers: [
|
|
5401
5426
|
DEFAULT_VALUE_ACCESSOR$4,
|
|
5402
5427
|
],
|
|
@@ -5425,6 +5450,7 @@ MatDateTime.propDecorators = {
|
|
|
5425
5450
|
autofocus: [{ type: Input }],
|
|
5426
5451
|
startDate: [{ type: Input }],
|
|
5427
5452
|
clearable: [{ type: Input }],
|
|
5453
|
+
datePickerFilter: [{ type: Input }],
|
|
5428
5454
|
readonly: [{ type: Input }],
|
|
5429
5455
|
tabindex: [{ type: Input }],
|
|
5430
5456
|
datePicker: [{ type: ViewChild, args: ['datePicker',] }],
|
|
@@ -26274,7 +26300,7 @@ class DateTestPage {
|
|
|
26274
26300
|
DateTestPage.decorators = [
|
|
26275
26301
|
{ type: Component, args: [{
|
|
26276
26302
|
selector: 'app-data-test',
|
|
26277
|
-
template: "<ion-header>\n <ion-toolbar color=\"primary\">\n\n <ion-buttons slot=\"start\">\n <ion-back-button></ion-back-button>\n </ion-buttons>\n\n <ion-title>Date/Time field test page</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class=\"ion-padding\">\n\n <form class=\"form-container\" [formGroup]=\"form\" (ngSubmit)=\"doSubmit($event)\">\n\n <ion-grid>\n\n <!-- debugging memory leak -->\n <ion-row><ion-col><ion-text><h4>Debug memory leak</h4></ion-text></ion-col></ion-row>\n <ion-row>\n <ion-col size=\"2\">\n <ion-button *ngIf=\"!memoryTimer\" (click)=\"startMemoryTimer()\">Start timer</ion-button>\n <ion-button *ngIf=\"memoryTimer\" (click)=\"stopMemoryTimer()\">Stop timer</ion-button>\n </ion-col>\n <ion-col size=\"2\">\n <mat-form-field floatLabel=\"never\">\n <input matInput type=\"text\" hidden>\n <mat-checkbox (change)=\"memoryMobile=$event.checked\" [value]=\"memoryMobile\">\n Mobile ?\n </mat-checkbox>\n </mat-form-field>\n </ion-col>\n <ion-col>\n <mat-date-field formControlName=\"empty\"\n *ngIf=\"!memoryHide\"\n placeholder=\"Date/Time\"\n [required]=\"true\"\n [mobile]=\"memoryMobile\"\n [clearable]=\"true\">\n <ion-icon matPrefix name=\"calendar-outline\"></ion-icon>\n </mat-date-field>\n </ion-col>\n </ion-row>\n\n <!-- Mobile mode -->\n <ion-row><ion-col><ion-text><h4>Mobile mode</h4></ion-text></ion-col></ion-row>\n <ion-row>\n <ion-col>\n\n <!-- Empty value -->\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color=\"primary\">\n Empty value\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color=\"medium\">\n <small><pre>{{stringify(form.controls.empty.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field formControlName=\"empty\"\n placeholder=\"Date/Time\"\n [required]=\"true\"\n [mobile]=\"true\"\n [clearable]=\"true\">\n <ion-icon matPrefix name=\"calendar-outline\"></ion-icon>\n </mat-date-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <!-- Enable -->\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color=\"primary\">\n With value\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color=\"medium\">\n <small><pre>{{stringify(form.controls.enable.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field formControlName=\"enable\"\n placeholder=\"Date/Time\"\n [required]=\"true\"\n [mobile]=\"true\"\n [clearable]=\"true\">\n <ion-icon matPrefix name=\"calendar-outline\"></ion-icon>\n </mat-date-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <!-- Disable -->\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color=\"primary\">\n Disable\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color=\"medium\">\n <small><pre>{{stringify(form.controls.disable.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field formControlName=\"disable\"\n placeholder=\"Date/Time\"\n [required]=\"true\"\n [mobile]=\"true\">\n <ion-icon matPrefix name=\"calendar-outline\"></ion-icon>\n </mat-date-field>\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n <!-- debug console -->\n <ion-row>\n <!-- buttons -->\n <ion-col size=\"2\">\n <!-- submit form -->\n <ion-button (click)=\"doSubmit($event)\"\n fill=\"outline\">\n <ion-icon name=\"checkmark\" slot=\"icon-only\"></ion-icon>\n </ion-button>\n\n <!-- clear log -->\n <ion-button (click)=\"clearLogPanel()\"\n fill=\"outline\">\n <ion-icon name=\"trash\" slot=\"icon-only\"></ion-icon>\n </ion-button>\n </ion-col>\n <ion-col size=\"10\" *ngIf=\"showLogPanel\">\n <ion-text color=\"primary\">Log:<br/></ion-text>\n <div class=\"ion-padding-start\">\n <ion-text color=\"medium\">\n <small [innerHTML]=\"logContent\"></small>\n </ion-text>\n </div>\n </ion-col>\n </ion-row>\n\n <!-- Desktop mode -->\n <ion-row><ion-col><ion-text><h4>Desktop mode</h4></ion-text></ion-col></ion-row>\n <ion-row>\n <ion-col>\n\n <!-- Empty value -->\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color=\"primary\">\n Empty value\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color=\"medium\">\n <small><pre>{{stringify(form.controls.empty.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field formControlName=\"empty\"\n placeholder=\"Date/Time\"\n [required]=\"true\"\n [mobile]=\"false\"\n [clearable]=\"true\">\n <ion-icon matPrefix name=\"calendar-outline\"></ion-icon>\n </mat-date-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <!-- Enable -->\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color=\"primary\">\n With value\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color=\"medium\">\n <small><pre>{{stringify(form.controls.enable.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field formControlName=\"enable\"\n placeholder=\"Date/Time\"\n [required]=\"true\"\n [mobile]=\"false\"\n [clearable]=\"true\">\n <ion-icon matPrefix name=\"calendar-outline\"></ion-icon>\n </mat-date-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <!-- Disable -->\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color=\"primary\">\n Disable\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color=\"medium\">\n <small><pre>{{stringify(form.controls.disable.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field formControlName=\"disable\"\n placeholder=\"Date/Time\"\n [required]=\"true\"\n [mobile]=\"false\">\n <ion-icon matPrefix name=\"calendar-outline\"></ion-icon>\n </mat-date-field>\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <!-- TimeZone -->\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color=\"primary\">\n TimeZone\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color=\"medium\">\n <small><pre>timezone=\"{{timezone}}\" value=\"{{stringify(form.controls.timezone.value)}}\"</pre></small>\n <pre>Should display using the browser TZ,<br/>but serialize/deserialize for the given TZ</pre>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field #readonlyField formControlName=\"timezone\"\n placeholder=\"Date\"\n [mobile]=\"false\"\n [clearable]=\"true\"\n timezone=\"Indian/Mahe\">\n <ion-icon matPrefix name=\"calendar-outline\"></ion-icon>\n </mat-date-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <!-- Readonly -->\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color=\"primary\">\n Readonly toggle\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color=\"medium\">\n <small><pre>{{stringify(form.controls.readonly.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-checkbox (change)=\"readonlyField.readonly=$event.checked\" [checked]=\"readonlyField.readonly\">\n </mat-checkbox>\n\n <mat-date-field #readonlyField formControlName=\"readonly\"\n placeholder=\"Date/Time\"\n [readonly]=\"true\"\n [mobile]=\"false\"\n [clearable]=\"true\">\n <ion-icon matPrefix name=\"calendar-outline\"></ion-icon>\n </mat-date-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n </ion-row>\n </ion-grid>\n </form>\n\n</ion-content>\n"
|
|
26303
|
+
template: "<ion-header>\n <ion-toolbar color=\"primary\">\n\n <ion-buttons slot=\"start\">\n <ion-back-button></ion-back-button>\n </ion-buttons>\n\n <ion-title>Date field test page</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class=\"ion-padding\">\n\n <form class=\"form-container\" [formGroup]=\"form\" (ngSubmit)=\"doSubmit($event)\">\n\n <ion-grid>\n\n <!-- debugging memory leak -->\n <ion-row><ion-col><ion-text><h4>Debug memory leak</h4></ion-text></ion-col></ion-row>\n <ion-row>\n <ion-col size=\"2\">\n <ion-button *ngIf=\"!memoryTimer\" (click)=\"startMemoryTimer()\">Start timer</ion-button>\n <ion-button *ngIf=\"memoryTimer\" (click)=\"stopMemoryTimer()\">Stop timer</ion-button>\n </ion-col>\n <ion-col size=\"2\">\n <mat-form-field floatLabel=\"never\">\n <input matInput type=\"text\" hidden>\n <mat-checkbox (change)=\"memoryMobile=$event.checked\" [value]=\"memoryMobile\">\n Mobile ?\n </mat-checkbox>\n </mat-form-field>\n </ion-col>\n <ion-col>\n <mat-date-field formControlName=\"empty\"\n *ngIf=\"!memoryHide\"\n placeholder=\"Date\"\n [required]=\"true\"\n [mobile]=\"memoryMobile\"\n [clearable]=\"true\">\n <ion-icon matPrefix name=\"calendar-outline\"></ion-icon>\n </mat-date-field>\n </ion-col>\n </ion-row>\n\n <!-- Mobile mode -->\n <ion-row><ion-col><ion-text><h4>Mobile mode</h4></ion-text></ion-col></ion-row>\n <ion-row>\n <ion-col>\n\n <!-- Empty value -->\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color=\"primary\">\n Empty value\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color=\"medium\">\n <small><pre>{{stringify(form.controls.empty.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field formControlName=\"empty\"\n placeholder=\"Date\"\n [required]=\"true\"\n [mobile]=\"true\"\n [clearable]=\"true\">\n <ion-icon matPrefix name=\"calendar-outline\"></ion-icon>\n </mat-date-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <!-- Enable -->\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color=\"primary\">\n With value\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color=\"medium\">\n <small><pre>{{stringify(form.controls.enable.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field formControlName=\"enable\"\n placeholder=\"Date\"\n [required]=\"true\"\n [mobile]=\"true\"\n [clearable]=\"true\">\n <ion-icon matPrefix name=\"calendar-outline\"></ion-icon>\n </mat-date-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <!-- Disable -->\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color=\"primary\">\n Disable\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color=\"medium\">\n <small><pre>{{stringify(form.controls.disable.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field formControlName=\"disable\"\n placeholder=\"Date\"\n [required]=\"true\"\n [mobile]=\"true\">\n <ion-icon matPrefix name=\"calendar-outline\"></ion-icon>\n </mat-date-field>\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <!-- TimeZone -->\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color=\"primary\">\n TimeZone\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color=\"medium\">\n <small><pre>timezone=\"{{timezone}}\" value=\"{{stringify(form.controls.timezone.value)}}\"</pre></small>\n <pre>Should display using the browser TZ,<br/>but serialize/deserialize for the given TZ</pre>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field #readonlyField formControlName=\"timezone\"\n placeholder=\"Date\"\n [mobile]=\"true\"\n [clearable]=\"true\"\n [timezone]=\"timezone\">\n <ion-icon matPrefix name=\"calendar-outline\"></ion-icon>\n </mat-date-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n <!-- debug console -->\n <ion-row>\n <!-- buttons -->\n <ion-col size=\"2\">\n <!-- submit form -->\n <ion-button (click)=\"doSubmit($event)\"\n fill=\"outline\">\n <ion-icon name=\"checkmark\" slot=\"icon-only\"></ion-icon>\n </ion-button>\n\n <!-- clear log -->\n <ion-button (click)=\"clearLogPanel()\"\n fill=\"outline\">\n <ion-icon name=\"trash\" slot=\"icon-only\"></ion-icon>\n </ion-button>\n </ion-col>\n <ion-col size=\"10\" *ngIf=\"showLogPanel\">\n <ion-text color=\"primary\">Log:<br/></ion-text>\n <div class=\"ion-padding-start\">\n <ion-text color=\"medium\">\n <small [innerHTML]=\"logContent\"></small>\n </ion-text>\n </div>\n </ion-col>\n </ion-row>\n\n <hr/>\n\n <!-- Desktop mode -->\n <ion-row><ion-col><ion-text><h4>Desktop mode</h4></ion-text></ion-col></ion-row>\n <ion-row>\n <ion-col>\n\n <!-- Empty value -->\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color=\"primary\">\n Empty value\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color=\"medium\">\n <small><pre>{{stringify(form.controls.empty.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field formControlName=\"empty\"\n placeholder=\"Date\"\n [required]=\"true\"\n [mobile]=\"false\"\n [clearable]=\"true\">\n <ion-icon matPrefix name=\"calendar-outline\"></ion-icon>\n </mat-date-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <!-- Enable -->\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color=\"primary\">\n With value\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color=\"medium\">\n <small><pre>{{stringify(form.controls.enable.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field formControlName=\"enable\"\n placeholder=\"Date\"\n [required]=\"true\"\n [mobile]=\"false\"\n [clearable]=\"true\">\n <ion-icon matPrefix name=\"calendar-outline\"></ion-icon>\n </mat-date-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <!-- Disable -->\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color=\"primary\">\n Disable\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color=\"medium\">\n <small><pre>{{stringify(form.controls.disable.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field formControlName=\"disable\"\n placeholder=\"Date\"\n [required]=\"true\"\n [mobile]=\"false\">\n <ion-icon matPrefix name=\"calendar-outline\"></ion-icon>\n </mat-date-field>\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <!-- TimeZone -->\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color=\"primary\">\n TimeZone\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color=\"medium\">\n <small><pre>timezone=\"{{timezone}}\" value={{stringify(form.controls.timezone.value)}}</pre></small>\n <pre>Should display using the browser TZ,<br/>but serialize/deserialize for the given TZ</pre>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field #readonlyField formControlName=\"timezone\"\n placeholder=\"Date\"\n [mobile]=\"false\"\n [clearable]=\"true\"\n [timezone]=\"timezone\">\n <ion-icon matPrefix name=\"calendar-outline\"></ion-icon>\n </mat-date-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <!-- Readonly -->\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color=\"primary\">\n Readonly toggle\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color=\"medium\">\n <small><pre>{{stringify(form.controls.readonly.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-checkbox (change)=\"readonlyField.readonly=$event.checked\" [checked]=\"readonlyField.readonly\">\n </mat-checkbox>\n\n <mat-date-field #readonlyField formControlName=\"readonly\"\n placeholder=\"Date\"\n [readonly]=\"true\"\n [mobile]=\"false\"\n [clearable]=\"true\">\n <ion-icon matPrefix name=\"calendar-outline\"></ion-icon>\n </mat-date-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n </ion-row>\n </ion-grid>\n </form>\n\n</ion-content>\n"
|
|
26278
26304
|
},] }
|
|
26279
26305
|
];
|
|
26280
26306
|
DateTestPage.ctorParameters = () => [
|