@sumaris-net/ngx-components 1.15.3 → 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 +82 -60
- 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 +42 -22
- 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 +82 -60
- 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
|
@@ -5414,8 +5414,10 @@
|
|
|
5414
5414
|
this.formControl.setValidators(this.required ? [this.formControl.validator, i1.Validators.required, SharedValidators.validDate] :
|
|
5415
5415
|
[this.formControl.validator, SharedValidators.validDate]);
|
|
5416
5416
|
}
|
|
5417
|
+
// Create the day control
|
|
5417
5418
|
this.dayControl = this.formBuilder.control(null, function () { return _this.formControl.errors; });
|
|
5418
5419
|
// Get patterns to display date
|
|
5420
|
+
this.updatePattern(this.translate.instant('COMMON.DATE_PATTERN'));
|
|
5419
5421
|
this._subscription.add(this.translate.get('COMMON.DATE_PATTERN')
|
|
5420
5422
|
.subscribe(function (pattern) { return _this.updatePattern(pattern); }));
|
|
5421
5423
|
this._subscription.add(this.dayControl.valueChanges
|
|
@@ -5437,14 +5439,15 @@
|
|
|
5437
5439
|
MatDate.prototype.ngOnDestroy = function () {
|
|
5438
5440
|
this._subscription.unsubscribe();
|
|
5439
5441
|
};
|
|
5440
|
-
MatDate.prototype.writeValue = function (
|
|
5442
|
+
MatDate.prototype.writeValue = function (value) {
|
|
5441
5443
|
if (this._writing)
|
|
5442
5444
|
return; // Skip
|
|
5443
5445
|
this._writing = true;
|
|
5444
5446
|
// DEBUG
|
|
5445
|
-
//
|
|
5446
|
-
|
|
5447
|
-
|
|
5447
|
+
//console.debug("[mat-date] writeValue() with:", value);
|
|
5448
|
+
// Convert into date, and clone if necessary
|
|
5449
|
+
var date = momentImported.isMoment(value) ? value.clone() : fromDateISOString(value);
|
|
5450
|
+
if (!date || !date.isValid()) {
|
|
5448
5451
|
this.dayControl.patchValue(null, { emitEvent: false });
|
|
5449
5452
|
if (this.formControl.value) {
|
|
5450
5453
|
this.formControl.patchValue(null, { emitEvent: false });
|
|
@@ -5453,13 +5456,17 @@
|
|
|
5453
5456
|
}
|
|
5454
5457
|
else {
|
|
5455
5458
|
// Format day
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
+
var day = date && this.timezone
|
|
5460
|
+
// Move to the expected TZ (keeping local hour - e.g. midnight)
|
|
5461
|
+
? date.tz(this.timezone)
|
|
5462
|
+
// Not TZ: important: do a clone
|
|
5463
|
+
: date;
|
|
5459
5464
|
day = day.startOf('day');
|
|
5460
5465
|
var dayStr = this.dateAdapter.format(day, this.dayPattern);
|
|
5461
|
-
|
|
5462
|
-
|
|
5466
|
+
if (this.dayControl.value !== dayStr) {
|
|
5467
|
+
// Update control
|
|
5468
|
+
this.dayControl.patchValue(dayStr, { emitEvent: false });
|
|
5469
|
+
}
|
|
5463
5470
|
}
|
|
5464
5471
|
this._writing = false;
|
|
5465
5472
|
this.markForCheck();
|
|
@@ -5499,7 +5506,7 @@
|
|
|
5499
5506
|
}
|
|
5500
5507
|
if (this.dayControl.value !== dateStr) {
|
|
5501
5508
|
// DEBUG
|
|
5502
|
-
console.debug("[mat-date] onDatePickerChange() new value:", dateStr);
|
|
5509
|
+
//console.debug("[mat-date] onDatePickerChange() new value:", dateStr);
|
|
5503
5510
|
this.dayControl.setValue(dateStr, {
|
|
5504
5511
|
emitEvent: true // Will call onFormChange
|
|
5505
5512
|
});
|
|
@@ -5570,28 +5577,37 @@
|
|
|
5570
5577
|
this.markForCheck();
|
|
5571
5578
|
}
|
|
5572
5579
|
};
|
|
5573
|
-
MatDate.prototype.checkIfTouched = function () {
|
|
5580
|
+
MatDate.prototype.checkIfTouched = function (opts) {
|
|
5574
5581
|
if (this.dayControl.touched) {
|
|
5575
5582
|
this._onTouchedCallback();
|
|
5576
|
-
|
|
5583
|
+
if (!opts || opts.emitEvent !== false) {
|
|
5584
|
+
this.markForCheck();
|
|
5585
|
+
}
|
|
5577
5586
|
}
|
|
5578
5587
|
};
|
|
5579
5588
|
MatDate.prototype.onFormChange = function (dayStr) {
|
|
5580
5589
|
if (this._writing)
|
|
5581
5590
|
return; // Skip if call by self
|
|
5582
5591
|
this._writing = true;
|
|
5592
|
+
if (this.dayControl.invalid) {
|
|
5593
|
+
this.formControl.markAsPending({ onlySelf: true });
|
|
5594
|
+
this.formControl.setErrors(Object.assign(Object.assign({}, this.formControl.errors), this.dayControl.errors));
|
|
5595
|
+
this.formControl.markAsDirty();
|
|
5596
|
+
this._writing = false;
|
|
5597
|
+
return;
|
|
5598
|
+
}
|
|
5583
5599
|
// Make to remove placeholder chars
|
|
5584
5600
|
while (dayStr && dayStr.indexOf(this.placeholderChar) !== -1) {
|
|
5585
5601
|
dayStr = dayStr.replace(this.placeholderChar, '');
|
|
5586
5602
|
}
|
|
5587
5603
|
// Parse day
|
|
5588
|
-
var
|
|
5589
|
-
// Move to the expected TZ
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
.
|
|
5593
|
-
|
|
5594
|
-
this.emitChange(
|
|
5604
|
+
var dayDate = dayStr && this.dateAdapter.parse(dayStr, this.dayPattern);
|
|
5605
|
+
// Move to the expected TZ, and keep the local hour (= midnight) to have midnight at local time
|
|
5606
|
+
dayDate = dayDate && (this.timezone ? dayDate.tz(this.timezone, true) : dayDate);
|
|
5607
|
+
dayDate = dayDate && dayDate
|
|
5608
|
+
.startOf('day') // Reset hour
|
|
5609
|
+
.utc(); // Convert to UTC (avoid TZ offset in final string)
|
|
5610
|
+
this.emitChange(dayDate);
|
|
5595
5611
|
this._writing = false;
|
|
5596
5612
|
};
|
|
5597
5613
|
MatDate.prototype.waitKeyboardHide = function (waitKeyboardDelay) {
|
|
@@ -5623,7 +5639,10 @@
|
|
|
5623
5639
|
var dateStr = toDateISOString(value) || null;
|
|
5624
5640
|
if (this.formControl.value !== dateStr) {
|
|
5625
5641
|
// DEBUG
|
|
5626
|
-
//console.debug('[
|
|
5642
|
+
//console.debug('[mat-date] Emit new value: ' + dateStr);
|
|
5643
|
+
// Apply to form control. => Will call writeValue()
|
|
5644
|
+
// NOT NEED, because a formControl should NOT be used by multiple fields
|
|
5645
|
+
//this.formControl.setValue(dateStr, {emitEvent: false})
|
|
5627
5646
|
// Changes comes from inside function: use the callback
|
|
5628
5647
|
this._onChangeCallback(dateStr);
|
|
5629
5648
|
// Check if need to update controls
|
|
@@ -5658,7 +5677,7 @@
|
|
|
5658
5677
|
MatDate.decorators = [
|
|
5659
5678
|
{ type: i0.Component, args: [{
|
|
5660
5679
|
selector: 'mat-date-field',
|
|
5661
|
-
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",
|
|
5680
|
+
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",
|
|
5662
5681
|
providers: [
|
|
5663
5682
|
DEFAULT_VALUE_ACCESSOR$5,
|
|
5664
5683
|
],
|
|
@@ -5688,6 +5707,7 @@
|
|
|
5688
5707
|
startDate: [{ type: i0.Input }],
|
|
5689
5708
|
clearable: [{ type: i0.Input }],
|
|
5690
5709
|
timezone: [{ type: i0.Input }],
|
|
5710
|
+
datePickerFilter: [{ type: i0.Input }],
|
|
5691
5711
|
readonly: [{ type: i0.Input }],
|
|
5692
5712
|
tabindex: [{ type: i0.Input }],
|
|
5693
5713
|
datePicker: [{ type: i0.ViewChild, args: ['datePicker',] }],
|
|
@@ -5777,18 +5797,18 @@
|
|
|
5777
5797
|
this.formControl.setValidators(this.required ? [this.formControl.validator, i1.Validators.required, SharedValidators.validDate] :
|
|
5778
5798
|
[this.formControl.validator, SharedValidators.validDate]);
|
|
5779
5799
|
}
|
|
5780
|
-
// Create the
|
|
5781
|
-
this.
|
|
5782
|
-
// Create the
|
|
5800
|
+
// Create the day control
|
|
5801
|
+
this.dayControl = this.formBuilder.control(null, this.required ? i1.Validators.required : null);
|
|
5802
|
+
// Create the hour control
|
|
5783
5803
|
var timeValidator = this.required ?
|
|
5784
5804
|
(this.mobile ? i1.Validators.required : i1.Validators.compose([i1.Validators.required, i1.Validators.pattern(HOUR_REGEXP)])) :
|
|
5785
5805
|
(this.mobile ? null : i1.Validators.pattern(HOUR_REGEXP));
|
|
5786
|
-
this.
|
|
5806
|
+
this.hourControl = this.formBuilder.control(null, timeValidator);
|
|
5787
5807
|
// Get patterns to display date and date+time
|
|
5788
5808
|
this._subscription.add(this.translate.get(['COMMON.DATE_PATTERN', 'COMMON.DATE_TIME_PATTERN'])
|
|
5789
5809
|
.subscribe(function (patterns) { return _this.updatePattern(patterns); }));
|
|
5790
|
-
this._subscription.add(rxjs.merge(this.
|
|
5791
|
-
.subscribe(function (
|
|
5810
|
+
this._subscription.add(rxjs.merge(this.dayControl.valueChanges, this.hourControl.valueChanges)
|
|
5811
|
+
.subscribe(function (_) { return _this.onFormChange(); }));
|
|
5792
5812
|
// Listen status changes (when done outside the component - e.g. when setErrors() is calling on the formControl)
|
|
5793
5813
|
this._subscription.add(this.formControl.statusChanges
|
|
5794
5814
|
.pipe(operators.filter(function (_) { return !_this.readonly && !_this._writing && !_this._disabling; }) // Skip
|
|
@@ -5800,32 +5820,32 @@
|
|
|
5800
5820
|
MatDateTime.prototype.ngOnDestroy = function () {
|
|
5801
5821
|
this._subscription.unsubscribe();
|
|
5802
5822
|
};
|
|
5803
|
-
MatDateTime.prototype.writeValue = function (
|
|
5823
|
+
MatDateTime.prototype.writeValue = function (value) {
|
|
5804
5824
|
if (this._writing)
|
|
5805
5825
|
return; // Skip
|
|
5806
5826
|
this._writing = true;
|
|
5807
5827
|
// DEBUG
|
|
5808
|
-
// console.debug("[mat-date-time] writeValue() with:",
|
|
5809
|
-
var
|
|
5810
|
-
if (!
|
|
5811
|
-
this.
|
|
5812
|
-
this.
|
|
5828
|
+
// console.debug("[mat-date-time] writeValue() with:", value);
|
|
5829
|
+
var date = fromDateISOString(value);
|
|
5830
|
+
if (!date || !date.isValid()) {
|
|
5831
|
+
this.dayControl.patchValue(null, { emitEvent: false });
|
|
5832
|
+
this.hourControl.patchValue(null, { emitEvent: false });
|
|
5813
5833
|
}
|
|
5814
5834
|
else {
|
|
5815
5835
|
// Format day
|
|
5816
|
-
var day =
|
|
5836
|
+
var day = date.clone().startOf('day');
|
|
5817
5837
|
var dayStr = this.dateAdapter.format(day, this.dayPattern);
|
|
5818
5838
|
// Format time
|
|
5819
5839
|
// - Format hh
|
|
5820
|
-
var hour =
|
|
5840
|
+
var hour = date.hour();
|
|
5821
5841
|
hour = hour < 10 ? ('0' + hour) : hour;
|
|
5822
5842
|
// - Format mm
|
|
5823
|
-
var minutes =
|
|
5843
|
+
var minutes = date.minutes();
|
|
5824
5844
|
minutes = minutes < 10 ? ('0' + minutes) : minutes;
|
|
5825
5845
|
var timeStr = hour + ":" + minutes;
|
|
5826
5846
|
// Update controls
|
|
5827
|
-
this.
|
|
5828
|
-
this.
|
|
5847
|
+
this.dayControl.patchValue(dayStr, { emitEvent: false });
|
|
5848
|
+
this.hourControl.patchValue(timeStr, { emitEvent: false });
|
|
5829
5849
|
}
|
|
5830
5850
|
this._writing = false;
|
|
5831
5851
|
this.markForCheck();
|
|
@@ -5841,12 +5861,12 @@
|
|
|
5841
5861
|
return; // Skip
|
|
5842
5862
|
this._disabling = true;
|
|
5843
5863
|
if (isDisabled) {
|
|
5844
|
-
this.
|
|
5845
|
-
this.
|
|
5864
|
+
this.dayControl.disable({ emitEvent: false });
|
|
5865
|
+
this.hourControl.disable({ emitEvent: false });
|
|
5846
5866
|
}
|
|
5847
5867
|
else {
|
|
5848
|
-
this.
|
|
5849
|
-
this.
|
|
5868
|
+
this.dayControl.enable({ emitEvent: false });
|
|
5869
|
+
this.hourControl.enable({ emitEvent: false });
|
|
5850
5870
|
}
|
|
5851
5871
|
this._disabling = false;
|
|
5852
5872
|
this.markForCheck();
|
|
@@ -5859,25 +5879,25 @@
|
|
|
5859
5879
|
}
|
|
5860
5880
|
// Convert to usable date, then convert to day pattern (e.g DD/MM/YYYY)
|
|
5861
5881
|
var day = event.value && event.value
|
|
5862
|
-
.locale(this.locale) // set
|
|
5882
|
+
.locale(this.locale) // set locale
|
|
5863
5883
|
.hour(0).minute(0).seconds(0).millisecond(0) // Reset hour
|
|
5864
5884
|
.utc(true);
|
|
5865
5885
|
var dayStr = day && this.dateAdapter.format(day, this.dayPattern) || null;
|
|
5866
5886
|
// Update the day control
|
|
5867
|
-
if (this.
|
|
5887
|
+
if (this.dayControl.value !== dayStr) {
|
|
5868
5888
|
// DEBUG
|
|
5869
5889
|
// console.debug("[mat-date-time] onDatePickerChange() new value:", dayStr);
|
|
5870
|
-
this.
|
|
5890
|
+
this.dayControl.setValue(dayStr, {
|
|
5871
5891
|
emitEvent: true // Will call onFormChange
|
|
5872
5892
|
});
|
|
5873
5893
|
}
|
|
5874
5894
|
};
|
|
5875
5895
|
MatDateTime.prototype.onTimePickerChange = function (timeStr) {
|
|
5876
5896
|
// Update the time control, if need
|
|
5877
|
-
if (this.
|
|
5897
|
+
if (this.hourControl.value !== timeStr) {
|
|
5878
5898
|
// DEBUG
|
|
5879
5899
|
// console.debug("[mat-date-time] onTimePickerChange() new value:", timeStr);
|
|
5880
|
-
this.
|
|
5900
|
+
this.hourControl.setValue(timeStr, {
|
|
5881
5901
|
emitEvent: true // Will call onFormChange
|
|
5882
5902
|
});
|
|
5883
5903
|
}
|
|
@@ -5968,26 +5988,24 @@
|
|
|
5968
5988
|
this.dayPattern = (patterns['COMMON.DATE_PATTERN'] !== 'COMMON.DATE_PATTERN' ? patterns['COMMON.DATE_PATTERN'] : 'L');
|
|
5969
5989
|
};
|
|
5970
5990
|
MatDateTime.prototype.checkIfTouched = function () {
|
|
5971
|
-
if (this.
|
|
5991
|
+
if (this.dayControl.touched || this.hourControl.touched) {
|
|
5972
5992
|
this._onTouchedCallback();
|
|
5973
5993
|
this.markForCheck();
|
|
5974
5994
|
}
|
|
5975
5995
|
};
|
|
5976
|
-
MatDateTime.prototype.onFormChange = function (
|
|
5996
|
+
MatDateTime.prototype.onFormChange = function () {
|
|
5977
5997
|
if (this._writing)
|
|
5978
5998
|
return; // Skip if call by self
|
|
5979
5999
|
this._writing = true;
|
|
5980
|
-
var dayStr = this.
|
|
5981
|
-
var time = this.
|
|
6000
|
+
var dayStr = this.dayControl.value;
|
|
6001
|
+
var time = this.hourControl.value;
|
|
5982
6002
|
// DEBUG
|
|
5983
6003
|
//console.debug(`[mat-date-time] onFormChange() from event: ${event} - controls values: `, [dayStr, time]);
|
|
5984
6004
|
var incompleteValue = isNilOrBlank(time) !== isNilOrBlank(dayStr);
|
|
5985
|
-
if (incompleteValue || this.
|
|
6005
|
+
if (incompleteValue || this.dayControl.invalid || this.hourControl.invalid) {
|
|
5986
6006
|
this.formControl.markAsPending({ onlySelf: true });
|
|
5987
|
-
this.formControl.setErrors(Object.assign(Object.assign(Object.assign({ validDate: incompleteValue }, this.formControl.errors), this.
|
|
6007
|
+
this.formControl.setErrors(Object.assign(Object.assign(Object.assign({ validDate: incompleteValue }, this.formControl.errors), this.dayControl.errors), this.hourControl.errors));
|
|
5988
6008
|
this.formControl.markAsDirty();
|
|
5989
|
-
// Reset the value
|
|
5990
|
-
//this.emitChange(null);
|
|
5991
6009
|
this._writing = false;
|
|
5992
6010
|
return;
|
|
5993
6011
|
}
|
|
@@ -6039,7 +6057,10 @@
|
|
|
6039
6057
|
var dateStr = toDateISOString(value) || null;
|
|
6040
6058
|
if (this.formControl.value !== dateStr) {
|
|
6041
6059
|
// DEBUG
|
|
6042
|
-
//console.debug('[
|
|
6060
|
+
//console.debug('[mat-date-time] Emit new value: ' + dateStr);
|
|
6061
|
+
// Apply to form control. => Will call writeValue()
|
|
6062
|
+
// NOT NEED, because a formControl should NOT be used by multiple fields
|
|
6063
|
+
//this.formControl.setValue(dateStr, {emitEvent: false});
|
|
6043
6064
|
// Changes comes from inside function: use the callback
|
|
6044
6065
|
this._onChangeCallback(dateStr);
|
|
6045
6066
|
// Check if need to update controls
|
|
@@ -6059,8 +6080,8 @@
|
|
|
6059
6080
|
});
|
|
6060
6081
|
};
|
|
6061
6082
|
MatDateTime.prototype.markAsTouched = function (opts) {
|
|
6062
|
-
this.
|
|
6063
|
-
this.
|
|
6083
|
+
this.dayControl.markAsTouched(opts);
|
|
6084
|
+
this.hourControl.markAsTouched(opts);
|
|
6064
6085
|
this._onTouchedCallback();
|
|
6065
6086
|
this.markForCheck();
|
|
6066
6087
|
};
|
|
@@ -6075,7 +6096,7 @@
|
|
|
6075
6096
|
MatDateTime.decorators = [
|
|
6076
6097
|
{ type: i0.Component, args: [{
|
|
6077
6098
|
selector: 'mat-date-time-field',
|
|
6078
|
-
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]=\"
|
|
6099
|
+
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",
|
|
6079
6100
|
providers: [
|
|
6080
6101
|
DEFAULT_VALUE_ACCESSOR$4,
|
|
6081
6102
|
],
|
|
@@ -6104,6 +6125,7 @@
|
|
|
6104
6125
|
autofocus: [{ type: i0.Input }],
|
|
6105
6126
|
startDate: [{ type: i0.Input }],
|
|
6106
6127
|
clearable: [{ type: i0.Input }],
|
|
6128
|
+
datePickerFilter: [{ type: i0.Input }],
|
|
6107
6129
|
readonly: [{ type: i0.Input }],
|
|
6108
6130
|
tabindex: [{ type: i0.Input }],
|
|
6109
6131
|
datePicker: [{ type: i0.ViewChild, args: ['datePicker',] }],
|
|
@@ -30410,7 +30432,7 @@
|
|
|
30410
30432
|
DateTestPage.decorators = [
|
|
30411
30433
|
{ type: i0.Component, args: [{
|
|
30412
30434
|
selector: 'app-data-test',
|
|
30413
|
-
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"
|
|
30435
|
+
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"
|
|
30414
30436
|
},] }
|
|
30415
30437
|
];
|
|
30416
30438
|
DateTestPage.ctorParameters = function () { return [
|