@sumaris-net/ngx-components 1.15.3 → 1.15.6
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 +99 -72
- 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/dates.js +15 -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/esm2015/src/app/shared/platforms.js +3 -11
- package/fesm2015/sumaris-net.ngx-components.js +99 -71
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/shared/dates.d.ts +7 -0
- 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/src/app/shared/platforms.d.ts +1 -6
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -2616,6 +2616,20 @@
|
|
|
2616
2616
|
.tz(timezone, keepLocalTime)
|
|
2617
2617
|
.startOf('day');
|
|
2618
2618
|
};
|
|
2619
|
+
/**
|
|
2620
|
+
* Test if a date is on the given day of week
|
|
2621
|
+
* @param date
|
|
2622
|
+
* @param weekday
|
|
2623
|
+
* @param timezone
|
|
2624
|
+
*/
|
|
2625
|
+
DateUtils.isAtDay = function (date, weekday, timezone) {
|
|
2626
|
+
date = date && fromDateISOString(date);
|
|
2627
|
+
if (!date)
|
|
2628
|
+
return null;
|
|
2629
|
+
if (timezone)
|
|
2630
|
+
date = date.clone().tz(timezone).startOf('day');
|
|
2631
|
+
return date.day() === weekday;
|
|
2632
|
+
};
|
|
2619
2633
|
return DateUtils;
|
|
2620
2634
|
}());
|
|
2621
2635
|
function toDateISOString(value) {
|
|
@@ -4673,17 +4687,9 @@
|
|
|
4673
4687
|
var userAgent = win.navigator.userAgent || win.navigator.vendor || window.opera;
|
|
4674
4688
|
return expr.test(userAgent);
|
|
4675
4689
|
};
|
|
4676
|
-
var
|
|
4677
|
-
var userAgent = win.navigator.userAgent || win.navigator.vendor || window.opera;
|
|
4678
|
-
return /windows/i.test(userAgent);
|
|
4679
|
-
};
|
|
4680
|
-
/**
|
|
4681
|
-
* Detect desktop, by fine cursor. See https://github.com/ionic-team/ionic-framework/issues/19942
|
|
4682
|
-
* @param win
|
|
4683
|
-
*/
|
|
4684
|
-
var isDesktop = function (win) { return matchMedia(win, '(any-pointer:fine)'); };
|
|
4690
|
+
var isWindows = function (win) { return testUserAgent(win, /windows/i); };
|
|
4685
4691
|
var isTouchUi = function (win) { return matchMedia(win, '(any-pointer:coarse)'); };
|
|
4686
|
-
var isMobile = function (win) { return isTouchUi(win) && !
|
|
4692
|
+
var isMobile = function (win) { return isTouchUi(win) && !isWindows(win); };
|
|
4687
4693
|
var isIpad = function (win) {
|
|
4688
4694
|
// iOS 12 and below
|
|
4689
4695
|
if (testUserAgent(win, /iPad/i)) {
|
|
@@ -5414,8 +5420,10 @@
|
|
|
5414
5420
|
this.formControl.setValidators(this.required ? [this.formControl.validator, i1.Validators.required, SharedValidators.validDate] :
|
|
5415
5421
|
[this.formControl.validator, SharedValidators.validDate]);
|
|
5416
5422
|
}
|
|
5423
|
+
// Create the day control
|
|
5417
5424
|
this.dayControl = this.formBuilder.control(null, function () { return _this.formControl.errors; });
|
|
5418
5425
|
// Get patterns to display date
|
|
5426
|
+
this.updatePattern(this.translate.instant('COMMON.DATE_PATTERN'));
|
|
5419
5427
|
this._subscription.add(this.translate.get('COMMON.DATE_PATTERN')
|
|
5420
5428
|
.subscribe(function (pattern) { return _this.updatePattern(pattern); }));
|
|
5421
5429
|
this._subscription.add(this.dayControl.valueChanges
|
|
@@ -5437,14 +5445,15 @@
|
|
|
5437
5445
|
MatDate.prototype.ngOnDestroy = function () {
|
|
5438
5446
|
this._subscription.unsubscribe();
|
|
5439
5447
|
};
|
|
5440
|
-
MatDate.prototype.writeValue = function (
|
|
5448
|
+
MatDate.prototype.writeValue = function (value) {
|
|
5441
5449
|
if (this._writing)
|
|
5442
5450
|
return; // Skip
|
|
5443
5451
|
this._writing = true;
|
|
5444
5452
|
// DEBUG
|
|
5445
|
-
//
|
|
5446
|
-
|
|
5447
|
-
|
|
5453
|
+
//console.debug("[mat-date] writeValue() with:", value);
|
|
5454
|
+
// Convert into date, and clone if necessary
|
|
5455
|
+
var date = momentImported.isMoment(value) ? value.clone() : fromDateISOString(value);
|
|
5456
|
+
if (!date || !date.isValid()) {
|
|
5448
5457
|
this.dayControl.patchValue(null, { emitEvent: false });
|
|
5449
5458
|
if (this.formControl.value) {
|
|
5450
5459
|
this.formControl.patchValue(null, { emitEvent: false });
|
|
@@ -5453,13 +5462,17 @@
|
|
|
5453
5462
|
}
|
|
5454
5463
|
else {
|
|
5455
5464
|
// Format day
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5465
|
+
var day = date && this.timezone
|
|
5466
|
+
// Move to the expected TZ (keeping local hour - e.g. midnight)
|
|
5467
|
+
? date.tz(this.timezone)
|
|
5468
|
+
// Not TZ: important: do a clone
|
|
5469
|
+
: date;
|
|
5459
5470
|
day = day.startOf('day');
|
|
5460
5471
|
var dayStr = this.dateAdapter.format(day, this.dayPattern);
|
|
5461
|
-
|
|
5462
|
-
|
|
5472
|
+
if (this.dayControl.value !== dayStr) {
|
|
5473
|
+
// Update control
|
|
5474
|
+
this.dayControl.patchValue(dayStr, { emitEvent: false });
|
|
5475
|
+
}
|
|
5463
5476
|
}
|
|
5464
5477
|
this._writing = false;
|
|
5465
5478
|
this.markForCheck();
|
|
@@ -5499,7 +5512,7 @@
|
|
|
5499
5512
|
}
|
|
5500
5513
|
if (this.dayControl.value !== dateStr) {
|
|
5501
5514
|
// DEBUG
|
|
5502
|
-
console.debug("[mat-date] onDatePickerChange() new value:", dateStr);
|
|
5515
|
+
//console.debug("[mat-date] onDatePickerChange() new value:", dateStr);
|
|
5503
5516
|
this.dayControl.setValue(dateStr, {
|
|
5504
5517
|
emitEvent: true // Will call onFormChange
|
|
5505
5518
|
});
|
|
@@ -5570,28 +5583,37 @@
|
|
|
5570
5583
|
this.markForCheck();
|
|
5571
5584
|
}
|
|
5572
5585
|
};
|
|
5573
|
-
MatDate.prototype.checkIfTouched = function () {
|
|
5586
|
+
MatDate.prototype.checkIfTouched = function (opts) {
|
|
5574
5587
|
if (this.dayControl.touched) {
|
|
5575
5588
|
this._onTouchedCallback();
|
|
5576
|
-
|
|
5589
|
+
if (!opts || opts.emitEvent !== false) {
|
|
5590
|
+
this.markForCheck();
|
|
5591
|
+
}
|
|
5577
5592
|
}
|
|
5578
5593
|
};
|
|
5579
5594
|
MatDate.prototype.onFormChange = function (dayStr) {
|
|
5580
5595
|
if (this._writing)
|
|
5581
5596
|
return; // Skip if call by self
|
|
5582
5597
|
this._writing = true;
|
|
5598
|
+
if (this.dayControl.invalid) {
|
|
5599
|
+
this.formControl.markAsPending({ onlySelf: true });
|
|
5600
|
+
this.formControl.setErrors(Object.assign(Object.assign({}, this.formControl.errors), this.dayControl.errors));
|
|
5601
|
+
this.formControl.markAsDirty();
|
|
5602
|
+
this._writing = false;
|
|
5603
|
+
return;
|
|
5604
|
+
}
|
|
5583
5605
|
// Make to remove placeholder chars
|
|
5584
5606
|
while (dayStr && dayStr.indexOf(this.placeholderChar) !== -1) {
|
|
5585
5607
|
dayStr = dayStr.replace(this.placeholderChar, '');
|
|
5586
5608
|
}
|
|
5587
5609
|
// Parse day
|
|
5588
|
-
var
|
|
5589
|
-
// Move to the expected TZ
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
.
|
|
5593
|
-
|
|
5594
|
-
this.emitChange(
|
|
5610
|
+
var dayDate = dayStr && this.dateAdapter.parse(dayStr, this.dayPattern);
|
|
5611
|
+
// Move to the expected TZ, and keep the local hour (= midnight) to have midnight at local time
|
|
5612
|
+
dayDate = dayDate && (this.timezone ? dayDate.tz(this.timezone, true) : dayDate);
|
|
5613
|
+
dayDate = dayDate && dayDate
|
|
5614
|
+
.startOf('day') // Reset hour
|
|
5615
|
+
.utc(); // Convert to UTC (avoid TZ offset in final string)
|
|
5616
|
+
this.emitChange(dayDate);
|
|
5595
5617
|
this._writing = false;
|
|
5596
5618
|
};
|
|
5597
5619
|
MatDate.prototype.waitKeyboardHide = function (waitKeyboardDelay) {
|
|
@@ -5623,7 +5645,10 @@
|
|
|
5623
5645
|
var dateStr = toDateISOString(value) || null;
|
|
5624
5646
|
if (this.formControl.value !== dateStr) {
|
|
5625
5647
|
// DEBUG
|
|
5626
|
-
//console.debug('[
|
|
5648
|
+
//console.debug('[mat-date] Emit new value: ' + dateStr);
|
|
5649
|
+
// Apply to form control. => Will call writeValue()
|
|
5650
|
+
// NOT NEED, because a formControl should NOT be used by multiple fields
|
|
5651
|
+
//this.formControl.setValue(dateStr, {emitEvent: false})
|
|
5627
5652
|
// Changes comes from inside function: use the callback
|
|
5628
5653
|
this._onChangeCallback(dateStr);
|
|
5629
5654
|
// Check if need to update controls
|
|
@@ -5658,7 +5683,7 @@
|
|
|
5658
5683
|
MatDate.decorators = [
|
|
5659
5684
|
{ type: i0.Component, args: [{
|
|
5660
5685
|
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",
|
|
5686
|
+
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
5687
|
providers: [
|
|
5663
5688
|
DEFAULT_VALUE_ACCESSOR$5,
|
|
5664
5689
|
],
|
|
@@ -5688,6 +5713,7 @@
|
|
|
5688
5713
|
startDate: [{ type: i0.Input }],
|
|
5689
5714
|
clearable: [{ type: i0.Input }],
|
|
5690
5715
|
timezone: [{ type: i0.Input }],
|
|
5716
|
+
datePickerFilter: [{ type: i0.Input }],
|
|
5691
5717
|
readonly: [{ type: i0.Input }],
|
|
5692
5718
|
tabindex: [{ type: i0.Input }],
|
|
5693
5719
|
datePicker: [{ type: i0.ViewChild, args: ['datePicker',] }],
|
|
@@ -5777,18 +5803,18 @@
|
|
|
5777
5803
|
this.formControl.setValidators(this.required ? [this.formControl.validator, i1.Validators.required, SharedValidators.validDate] :
|
|
5778
5804
|
[this.formControl.validator, SharedValidators.validDate]);
|
|
5779
5805
|
}
|
|
5780
|
-
// Create the
|
|
5781
|
-
this.
|
|
5782
|
-
// Create the
|
|
5806
|
+
// Create the day control
|
|
5807
|
+
this.dayControl = this.formBuilder.control(null, this.required ? i1.Validators.required : null);
|
|
5808
|
+
// Create the hour control
|
|
5783
5809
|
var timeValidator = this.required ?
|
|
5784
5810
|
(this.mobile ? i1.Validators.required : i1.Validators.compose([i1.Validators.required, i1.Validators.pattern(HOUR_REGEXP)])) :
|
|
5785
5811
|
(this.mobile ? null : i1.Validators.pattern(HOUR_REGEXP));
|
|
5786
|
-
this.
|
|
5812
|
+
this.hourControl = this.formBuilder.control(null, timeValidator);
|
|
5787
5813
|
// Get patterns to display date and date+time
|
|
5788
5814
|
this._subscription.add(this.translate.get(['COMMON.DATE_PATTERN', 'COMMON.DATE_TIME_PATTERN'])
|
|
5789
5815
|
.subscribe(function (patterns) { return _this.updatePattern(patterns); }));
|
|
5790
|
-
this._subscription.add(rxjs.merge(this.
|
|
5791
|
-
.subscribe(function (
|
|
5816
|
+
this._subscription.add(rxjs.merge(this.dayControl.valueChanges, this.hourControl.valueChanges)
|
|
5817
|
+
.subscribe(function (_) { return _this.onFormChange(); }));
|
|
5792
5818
|
// Listen status changes (when done outside the component - e.g. when setErrors() is calling on the formControl)
|
|
5793
5819
|
this._subscription.add(this.formControl.statusChanges
|
|
5794
5820
|
.pipe(operators.filter(function (_) { return !_this.readonly && !_this._writing && !_this._disabling; }) // Skip
|
|
@@ -5800,32 +5826,32 @@
|
|
|
5800
5826
|
MatDateTime.prototype.ngOnDestroy = function () {
|
|
5801
5827
|
this._subscription.unsubscribe();
|
|
5802
5828
|
};
|
|
5803
|
-
MatDateTime.prototype.writeValue = function (
|
|
5829
|
+
MatDateTime.prototype.writeValue = function (value) {
|
|
5804
5830
|
if (this._writing)
|
|
5805
5831
|
return; // Skip
|
|
5806
5832
|
this._writing = true;
|
|
5807
5833
|
// DEBUG
|
|
5808
|
-
// console.debug("[mat-date-time] writeValue() with:",
|
|
5809
|
-
var
|
|
5810
|
-
if (!
|
|
5811
|
-
this.
|
|
5812
|
-
this.
|
|
5834
|
+
// console.debug("[mat-date-time] writeValue() with:", value);
|
|
5835
|
+
var date = fromDateISOString(value);
|
|
5836
|
+
if (!date || !date.isValid()) {
|
|
5837
|
+
this.dayControl.patchValue(null, { emitEvent: false });
|
|
5838
|
+
this.hourControl.patchValue(null, { emitEvent: false });
|
|
5813
5839
|
}
|
|
5814
5840
|
else {
|
|
5815
5841
|
// Format day
|
|
5816
|
-
var day =
|
|
5842
|
+
var day = date.clone().startOf('day');
|
|
5817
5843
|
var dayStr = this.dateAdapter.format(day, this.dayPattern);
|
|
5818
5844
|
// Format time
|
|
5819
5845
|
// - Format hh
|
|
5820
|
-
var hour =
|
|
5846
|
+
var hour = date.hour();
|
|
5821
5847
|
hour = hour < 10 ? ('0' + hour) : hour;
|
|
5822
5848
|
// - Format mm
|
|
5823
|
-
var minutes =
|
|
5849
|
+
var minutes = date.minutes();
|
|
5824
5850
|
minutes = minutes < 10 ? ('0' + minutes) : minutes;
|
|
5825
5851
|
var timeStr = hour + ":" + minutes;
|
|
5826
5852
|
// Update controls
|
|
5827
|
-
this.
|
|
5828
|
-
this.
|
|
5853
|
+
this.dayControl.patchValue(dayStr, { emitEvent: false });
|
|
5854
|
+
this.hourControl.patchValue(timeStr, { emitEvent: false });
|
|
5829
5855
|
}
|
|
5830
5856
|
this._writing = false;
|
|
5831
5857
|
this.markForCheck();
|
|
@@ -5841,12 +5867,12 @@
|
|
|
5841
5867
|
return; // Skip
|
|
5842
5868
|
this._disabling = true;
|
|
5843
5869
|
if (isDisabled) {
|
|
5844
|
-
this.
|
|
5845
|
-
this.
|
|
5870
|
+
this.dayControl.disable({ emitEvent: false });
|
|
5871
|
+
this.hourControl.disable({ emitEvent: false });
|
|
5846
5872
|
}
|
|
5847
5873
|
else {
|
|
5848
|
-
this.
|
|
5849
|
-
this.
|
|
5874
|
+
this.dayControl.enable({ emitEvent: false });
|
|
5875
|
+
this.hourControl.enable({ emitEvent: false });
|
|
5850
5876
|
}
|
|
5851
5877
|
this._disabling = false;
|
|
5852
5878
|
this.markForCheck();
|
|
@@ -5859,25 +5885,25 @@
|
|
|
5859
5885
|
}
|
|
5860
5886
|
// Convert to usable date, then convert to day pattern (e.g DD/MM/YYYY)
|
|
5861
5887
|
var day = event.value && event.value
|
|
5862
|
-
.locale(this.locale) // set
|
|
5888
|
+
.locale(this.locale) // set locale
|
|
5863
5889
|
.hour(0).minute(0).seconds(0).millisecond(0) // Reset hour
|
|
5864
5890
|
.utc(true);
|
|
5865
5891
|
var dayStr = day && this.dateAdapter.format(day, this.dayPattern) || null;
|
|
5866
5892
|
// Update the day control
|
|
5867
|
-
if (this.
|
|
5893
|
+
if (this.dayControl.value !== dayStr) {
|
|
5868
5894
|
// DEBUG
|
|
5869
5895
|
// console.debug("[mat-date-time] onDatePickerChange() new value:", dayStr);
|
|
5870
|
-
this.
|
|
5896
|
+
this.dayControl.setValue(dayStr, {
|
|
5871
5897
|
emitEvent: true // Will call onFormChange
|
|
5872
5898
|
});
|
|
5873
5899
|
}
|
|
5874
5900
|
};
|
|
5875
5901
|
MatDateTime.prototype.onTimePickerChange = function (timeStr) {
|
|
5876
5902
|
// Update the time control, if need
|
|
5877
|
-
if (this.
|
|
5903
|
+
if (this.hourControl.value !== timeStr) {
|
|
5878
5904
|
// DEBUG
|
|
5879
5905
|
// console.debug("[mat-date-time] onTimePickerChange() new value:", timeStr);
|
|
5880
|
-
this.
|
|
5906
|
+
this.hourControl.setValue(timeStr, {
|
|
5881
5907
|
emitEvent: true // Will call onFormChange
|
|
5882
5908
|
});
|
|
5883
5909
|
}
|
|
@@ -5968,26 +5994,24 @@
|
|
|
5968
5994
|
this.dayPattern = (patterns['COMMON.DATE_PATTERN'] !== 'COMMON.DATE_PATTERN' ? patterns['COMMON.DATE_PATTERN'] : 'L');
|
|
5969
5995
|
};
|
|
5970
5996
|
MatDateTime.prototype.checkIfTouched = function () {
|
|
5971
|
-
if (this.
|
|
5997
|
+
if (this.dayControl.touched || this.hourControl.touched) {
|
|
5972
5998
|
this._onTouchedCallback();
|
|
5973
5999
|
this.markForCheck();
|
|
5974
6000
|
}
|
|
5975
6001
|
};
|
|
5976
|
-
MatDateTime.prototype.onFormChange = function (
|
|
6002
|
+
MatDateTime.prototype.onFormChange = function () {
|
|
5977
6003
|
if (this._writing)
|
|
5978
6004
|
return; // Skip if call by self
|
|
5979
6005
|
this._writing = true;
|
|
5980
|
-
var dayStr = this.
|
|
5981
|
-
var time = this.
|
|
6006
|
+
var dayStr = this.dayControl.value;
|
|
6007
|
+
var time = this.hourControl.value;
|
|
5982
6008
|
// DEBUG
|
|
5983
6009
|
//console.debug(`[mat-date-time] onFormChange() from event: ${event} - controls values: `, [dayStr, time]);
|
|
5984
6010
|
var incompleteValue = isNilOrBlank(time) !== isNilOrBlank(dayStr);
|
|
5985
|
-
if (incompleteValue || this.
|
|
6011
|
+
if (incompleteValue || this.dayControl.invalid || this.hourControl.invalid) {
|
|
5986
6012
|
this.formControl.markAsPending({ onlySelf: true });
|
|
5987
|
-
this.formControl.setErrors(Object.assign(Object.assign(Object.assign({ validDate: incompleteValue }, this.formControl.errors), this.
|
|
6013
|
+
this.formControl.setErrors(Object.assign(Object.assign(Object.assign({ validDate: incompleteValue }, this.formControl.errors), this.dayControl.errors), this.hourControl.errors));
|
|
5988
6014
|
this.formControl.markAsDirty();
|
|
5989
|
-
// Reset the value
|
|
5990
|
-
//this.emitChange(null);
|
|
5991
6015
|
this._writing = false;
|
|
5992
6016
|
return;
|
|
5993
6017
|
}
|
|
@@ -6039,7 +6063,10 @@
|
|
|
6039
6063
|
var dateStr = toDateISOString(value) || null;
|
|
6040
6064
|
if (this.formControl.value !== dateStr) {
|
|
6041
6065
|
// DEBUG
|
|
6042
|
-
//console.debug('[
|
|
6066
|
+
//console.debug('[mat-date-time] Emit new value: ' + dateStr);
|
|
6067
|
+
// Apply to form control. => Will call writeValue()
|
|
6068
|
+
// NOT NEED, because a formControl should NOT be used by multiple fields
|
|
6069
|
+
//this.formControl.setValue(dateStr, {emitEvent: false});
|
|
6043
6070
|
// Changes comes from inside function: use the callback
|
|
6044
6071
|
this._onChangeCallback(dateStr);
|
|
6045
6072
|
// Check if need to update controls
|
|
@@ -6059,8 +6086,8 @@
|
|
|
6059
6086
|
});
|
|
6060
6087
|
};
|
|
6061
6088
|
MatDateTime.prototype.markAsTouched = function (opts) {
|
|
6062
|
-
this.
|
|
6063
|
-
this.
|
|
6089
|
+
this.dayControl.markAsTouched(opts);
|
|
6090
|
+
this.hourControl.markAsTouched(opts);
|
|
6064
6091
|
this._onTouchedCallback();
|
|
6065
6092
|
this.markForCheck();
|
|
6066
6093
|
};
|
|
@@ -6075,7 +6102,7 @@
|
|
|
6075
6102
|
MatDateTime.decorators = [
|
|
6076
6103
|
{ type: i0.Component, args: [{
|
|
6077
6104
|
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]=\"
|
|
6105
|
+
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
6106
|
providers: [
|
|
6080
6107
|
DEFAULT_VALUE_ACCESSOR$4,
|
|
6081
6108
|
],
|
|
@@ -6104,6 +6131,7 @@
|
|
|
6104
6131
|
autofocus: [{ type: i0.Input }],
|
|
6105
6132
|
startDate: [{ type: i0.Input }],
|
|
6106
6133
|
clearable: [{ type: i0.Input }],
|
|
6134
|
+
datePickerFilter: [{ type: i0.Input }],
|
|
6107
6135
|
readonly: [{ type: i0.Input }],
|
|
6108
6136
|
tabindex: [{ type: i0.Input }],
|
|
6109
6137
|
datePicker: [{ type: i0.ViewChild, args: ['datePicker',] }],
|
|
@@ -30410,7 +30438,7 @@
|
|
|
30410
30438
|
DateTestPage.decorators = [
|
|
30411
30439
|
{ type: i0.Component, args: [{
|
|
30412
30440
|
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"
|
|
30441
|
+
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
30442
|
},] }
|
|
30415
30443
|
];
|
|
30416
30444
|
DateTestPage.ctorParameters = function () { return [
|
|
@@ -31490,7 +31518,6 @@
|
|
|
31490
31518
|
exports.isAndroid = isAndroid;
|
|
31491
31519
|
exports.isControlHasInput = isControlHasInput;
|
|
31492
31520
|
exports.isCordova = isCordova;
|
|
31493
|
-
exports.isDesktop = isDesktop;
|
|
31494
31521
|
exports.isEmptyArray = isEmptyArray;
|
|
31495
31522
|
exports.isIOS = isIOS;
|
|
31496
31523
|
exports.isInputElement = isInputElement;
|
|
@@ -31510,7 +31537,7 @@
|
|
|
31510
31537
|
exports.isProgressEvent = isProgressEvent;
|
|
31511
31538
|
exports.isResponseEvent = isResponseEvent;
|
|
31512
31539
|
exports.isTouchUi = isTouchUi;
|
|
31513
|
-
exports.
|
|
31540
|
+
exports.isWindows = isWindows;
|
|
31514
31541
|
exports.joinProperties = joinProperties;
|
|
31515
31542
|
exports.joinPropertiesPath = joinPropertiesPath;
|
|
31516
31543
|
exports.logFormErrors = logFormErrors;
|