@sumaris-net/ngx-components 1.14.3 → 1.15.0

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.
@@ -2092,7 +2092,7 @@
2092
2092
  { type: i1$2.TranslateService }
2093
2093
  ]; };
2094
2094
 
2095
- var moment$6 = momentImported__namespace;
2095
+ var moment$7 = momentImported__namespace;
2096
2096
  var DateDiffDurationPipe = /** @class */ (function () {
2097
2097
  function DateDiffDurationPipe(dateAdapter, translate) {
2098
2098
  var _this = this;
@@ -2109,10 +2109,10 @@
2109
2109
  return this.format(startDate, endDate);
2110
2110
  };
2111
2111
  DateDiffDurationPipe.prototype.format = function (startDate, endDate) {
2112
- var duration = moment$6.duration(endDate.diff(startDate));
2112
+ var duration = moment$7.duration(endDate.diff(startDate));
2113
2113
  if (duration.asMinutes() < 0)
2114
2114
  return '';
2115
- var timeDuration = moment$6(0)
2115
+ var timeDuration = moment$7(0)
2116
2116
  .hour(duration.hours())
2117
2117
  .minute(duration.minutes());
2118
2118
  var days = Math.floor(duration.asDays());
@@ -2572,7 +2572,7 @@
2572
2572
  { type: i0.Pipe, args: [{ name: 'fileSize' },] }
2573
2573
  ];
2574
2574
 
2575
- var moment$5 = momentImported__namespace;
2575
+ var moment$6 = momentImported__namespace;
2576
2576
  var tz = momentTZImported__namespace;
2577
2577
  var DATE_UNIX_TIMESTAMP = 'X';
2578
2578
  var DATE_UNIX_MS_TIMESTAMP = 'x';
@@ -2601,18 +2601,19 @@
2601
2601
  * Same implementation as the Java class Dates.resetTime() (see any SUMARiS like Pod)
2602
2602
  * @param value
2603
2603
  * @param timezone a timezone (see https://momentjs.com/timezone/)
2604
+ * @param keepLocalTime if true, only the timezone (and offset) is updated, keeping the local time same. Consequently, it will now point to a different point in time if the offset has changed.
2604
2605
  */
2605
- DateUtils.resetTime = function (value, timezone) {
2606
+ DateUtils.resetTime = function (value, timezone, keepLocalTime) {
2606
2607
  if (!value)
2607
2608
  return undefined;
2608
2609
  var date = fromDateISOString(value);
2609
2610
  // No timezone
2610
2611
  if (!timezone) {
2611
- return moment$5(date).startOf('day');
2612
+ return date.clone().startOf('day');
2612
2613
  }
2613
2614
  // Use timezone
2614
- moment$5(date)
2615
- .tz(timezone, true)
2615
+ return date.clone() // clone the original date
2616
+ .tz(timezone, keepLocalTime)
2616
2617
  .startOf('day');
2617
2618
  };
2618
2619
  return DateUtils;
@@ -2635,32 +2636,32 @@
2635
2636
  if (!value || momentImported.isMoment(value))
2636
2637
  return value;
2637
2638
  // Parse the input value, as a ISO date time
2638
- var date = moment$5(value, DATE_ISO_PATTERN);
2639
+ var date = moment$6(value, DATE_ISO_PATTERN);
2639
2640
  if (date.isValid())
2640
2641
  return date;
2641
2642
  // Not valid: trying to convert from unix timestamp
2642
2643
  if (typeof value === 'string') {
2643
2644
  console.warn('Wrong date format - Trying to convert from local time: ' + value);
2644
2645
  if (value.length === 10) {
2645
- return moment$5(value, DATE_UNIX_TIMESTAMP);
2646
+ return moment$6(value, DATE_UNIX_TIMESTAMP);
2646
2647
  }
2647
2648
  else if (value.length === 13) {
2648
- return moment$5(value, DATE_UNIX_MS_TIMESTAMP);
2649
+ return moment$6(value, DATE_UNIX_MS_TIMESTAMP);
2649
2650
  }
2650
2651
  }
2651
2652
  console.warn('Unable to parse date: ' + value);
2652
2653
  return undefined;
2653
2654
  }
2654
2655
  function fromUnixTimestamp(timeInSec) {
2655
- return moment$5(timeInSec, DATE_UNIX_TIMESTAMP);
2656
+ return moment$6(timeInSec, DATE_UNIX_TIMESTAMP);
2656
2657
  }
2657
2658
  function fromUnixMsTimestamp(timeInMs) {
2658
- return moment$5(timeInMs, DATE_UNIX_MS_TIMESTAMP);
2659
+ return moment$6(timeInMs, DATE_UNIX_MS_TIMESTAMP);
2659
2660
  }
2660
2661
  function toDuration(value, unit) {
2661
2662
  if (!value)
2662
2663
  return undefined;
2663
- var duration = moment$5.duration(value, unit);
2664
+ var duration = moment$6.duration(value, unit);
2664
2665
  // fix 990+ ms
2665
2666
  if (duration.milliseconds() >= 990) {
2666
2667
  duration.add(1000 - duration.milliseconds(), 'ms');
@@ -3160,7 +3161,7 @@
3160
3161
  ngInit: [{ type: i0.Output }]
3161
3162
  };
3162
3163
 
3163
- var moment$4 = momentImported__namespace;
3164
+ var moment$5 = momentImported__namespace;
3164
3165
  // @dynamic
3165
3166
  var SharedValidators = /** @class */ (function () {
3166
3167
  function SharedValidators() {
@@ -3177,14 +3178,6 @@
3177
3178
  this._REGEXP_CACHE.DOUBLE_BY_MAX_DECIMALS[maxDecimals] = new RegExp("^[-]?[0-9]+([.,][0-9]{1," + maxDecimals + "})?$");
3178
3179
  return this._REGEXP_CACHE.DOUBLE_BY_MAX_DECIMALS[maxDecimals];
3179
3180
  };
3180
- SharedValidators.validDate = function (control) {
3181
- var value = control.value;
3182
- var date = !value || moment$4.isMoment(value) ? value : moment$4(control.value, DATE_ISO_PATTERN);
3183
- if (date && (!date.isValid() || date.year() < 1970)) {
3184
- return { validDate: true };
3185
- }
3186
- return null;
3187
- };
3188
3181
  SharedValidators.latitude = function (control) {
3189
3182
  var value = control.value;
3190
3183
  if (isNotNil(value) && (value < -90 || value > 90)) {
@@ -3249,6 +3242,14 @@
3249
3242
  return null;
3250
3243
  };
3251
3244
  };
3245
+ SharedValidators.validDate = function (control) {
3246
+ var value = control.value;
3247
+ var date = !value || moment$5.isMoment(value) ? value : moment$5(control.value, DATE_ISO_PATTERN);
3248
+ if (date && (!date.isValid() || date.year() < 1970)) {
3249
+ return { validDate: true };
3250
+ }
3251
+ return null;
3252
+ };
3252
3253
  SharedValidators.dateIsAfter = function (previousValue, errorParam, granularity) {
3253
3254
  return function (control) {
3254
3255
  var value = fromDateISOString(control.value);
@@ -3259,6 +3260,16 @@
3259
3260
  return null;
3260
3261
  };
3261
3262
  };
3263
+ SharedValidators.dateIsBefore = function (maxValue, errorParam, granularity) {
3264
+ return function (control) {
3265
+ var value = fromDateISOString(control.value);
3266
+ if (isNotNil(value) && isNotNil(maxValue) && value.isSameOrAfter(maxValue, granularity)) {
3267
+ // Return the error
3268
+ return { dateIsBefore: { maxDate: errorParam } };
3269
+ }
3270
+ return null;
3271
+ };
3272
+ };
3262
3273
  SharedValidators.dateRangeEnd = function (startDateFieldName, msg) {
3263
3274
  var errorCode = msg ? 'msg' : 'dateRange';
3264
3275
  var error = msg ? { msg: msg } : { dateRange: true };
@@ -3354,6 +3365,7 @@
3354
3365
  pubkey: 'ERROR.FIELD_NOT_VALID_PUBKEY',
3355
3366
  validDate: 'ERROR.FIELD_NOT_VALID_DATE',
3356
3367
  dateIsAfter: 'ERROR.FIELD_NOT_VALID_DATE_AFTER',
3368
+ dateIsBefore: 'ERROR.FIELD_NOT_VALID_DATE_BEFORE',
3357
3369
  dateRange: 'ERROR.FIELD_NOT_VALID_DATE_RANGE',
3358
3370
  dateMinDuration: 'ERROR.FIELD_NOT_VALID_DATE_MIN_DURATION',
3359
3371
  dateMaxDuration: 'ERROR.FIELD_NOT_VALID_DATE_MAX_DURATION',
@@ -5331,6 +5343,7 @@
5331
5343
  var ɵ0$9 = noop$6;
5332
5344
  var MatDate = /** @class */ (function () {
5333
5345
  function MatDate(platform, dateAdapter, translate, formBuilder, cd, keyboard, formGroupDir) {
5346
+ this.platform = platform;
5334
5347
  this.dateAdapter = dateAdapter;
5335
5348
  this.translate = translate;
5336
5349
  this.formBuilder = formBuilder;
@@ -5340,21 +5353,29 @@
5340
5353
  this._onChangeCallback = noop$6;
5341
5354
  this._onTouchedCallback = noop$6;
5342
5355
  this._subscription = new rxjs.Subscription();
5343
- this.writing = true;
5344
- this.disabling = false;
5356
+ this._writing = true;
5357
+ this._disabling = false;
5358
+ this._readonly = false;
5345
5359
  this.dayMask = DAY_MASK$2;
5346
- this.disabled = false;
5347
5360
  this.floatLabel = 'auto';
5348
- this.readonly = false;
5349
5361
  this.compact = false;
5350
5362
  this.placeholderChar = DEFAULT_PLACEHOLDER_CHAR;
5351
5363
  this.autofocus = false;
5364
+ this.startDate = null;
5352
5365
  this.clearable = false;
5353
- // Workaround because ion-datetime has issue (do not returned a ISO date)
5354
- this.mobile = platform.is('mobile');
5355
- this.keyboardHideDelay = this.mobile && KEYBOARD_HIDE_DELAY_MS || 0;
5356
5366
  this.locale = (translate.currentLang || translate.defaultLang).substr(0, 2);
5357
5367
  }
5368
+ Object.defineProperty(MatDate.prototype, "readonly", {
5369
+ get: function () {
5370
+ return this._readonly;
5371
+ },
5372
+ set: function (value) {
5373
+ this._readonly = value;
5374
+ this.markForCheck();
5375
+ },
5376
+ enumerable: false,
5377
+ configurable: true
5378
+ });
5358
5379
  Object.defineProperty(MatDate.prototype, "tabindex", {
5359
5380
  get: function () {
5360
5381
  return this._tabindex;
@@ -5371,71 +5392,69 @@
5371
5392
  });
5372
5393
  Object.defineProperty(MatDate.prototype, "value", {
5373
5394
  get: function () {
5374
- return toDateISOString(this._value);
5395
+ return this.formControl.value;
5375
5396
  },
5376
5397
  enumerable: false,
5377
5398
  configurable: true
5378
5399
  });
5379
5400
  MatDate.prototype.ngOnInit = function () {
5380
5401
  var _this = this;
5402
+ this.mobile = isNil(this.mobile) ? this.platform.is('mobile') : this.mobile;
5403
+ this._keyboardHideDelay = this.mobile && KEYBOARD_HIDE_DELAY_MS || 0;
5381
5404
  this.formControl = this.formControl || this.formControlName && this.formGroupDir && this.formGroupDir.form.get(this.formControlName);
5382
5405
  if (!this.formControl)
5383
5406
  throw new Error('Missing mandatory attribute \'formControl\' or \'formControlName\' in <mat-date-field>.');
5384
5407
  this.required = toBoolean(this.required, this.formControl.validator === i1.Validators.required);
5385
- // Redirect errors from main control, into day sub control
5386
- var $error = new rxjs.BehaviorSubject(null);
5387
- this.dayControl = this.formBuilder.control(null, function () { return $error.getValue(); });
5388
- // Add custom 'validDate' validator
5389
- this.formControl.setValidators(this.required ? [i1.Validators.required, SharedValidators.validDate] : SharedValidators.validDate);
5408
+ // Add 'validDate' validator (when existing validator are null or required, to be sure to keep it)
5409
+ if (!this.formControl.validator || this.formControl.validator === i1.Validators.required) {
5410
+ this.formControl.setValidators(this.required ? [i1.Validators.required, SharedValidators.validDate] : SharedValidators.validDate);
5411
+ }
5412
+ else {
5413
+ this.formControl.setValidators(this.required ? [this.formControl.validator, i1.Validators.required, SharedValidators.validDate] :
5414
+ [this.formControl.validator, SharedValidators.validDate]);
5415
+ }
5416
+ this.dayControl = this.formBuilder.control(null, function () { return _this.formControl.errors; });
5390
5417
  // Get patterns to display date
5391
- this.updatePattern(this.translate.instant('COMMON.DATE_PATTERN'));
5392
5418
  this._subscription.add(this.translate.get('COMMON.DATE_PATTERN')
5393
5419
  .subscribe(function (pattern) { return _this.updatePattern(pattern); }));
5394
5420
  this._subscription.add(this.dayControl.valueChanges
5395
5421
  .subscribe(function (value) { return _this.onFormChange(value); }));
5396
- // Listen status changes outside the component (e.g. when setErrors() is calling on the formControl)
5422
+ // Listen status changes (when done outside the component - e.g. when setErrors() is calling on the formControl)
5397
5423
  this._subscription.add(this.formControl.statusChanges
5398
- .pipe(operators.filter(function () { return !_this.readonly && !_this.writing && !_this.disabling; })) // Skip
5399
- .subscribe(function (status) {
5400
- if (status === 'INVALID') {
5401
- $error.next(_this.formControl.errors);
5402
- }
5403
- else if (status === 'VALID') {
5404
- $error.next(null);
5405
- }
5406
- _this.dayControl.updateValueAndValidity({ onlySelf: true, emitEvent: false });
5424
+ .pipe(operators.filter(function (_) { return !_this.readonly && !_this._writing && !_this._disabling; }) // Skip
5425
+ )
5426
+ .subscribe(function () {
5427
+ _this.dayControl.updateValueAndValidity({ emitEvent: false });
5407
5428
  _this.markForCheck();
5408
5429
  }));
5409
5430
  this.updateTabIndex();
5410
- this.writing = false;
5431
+ this._writing = false;
5411
5432
  };
5412
5433
  MatDate.prototype.ngOnDestroy = function () {
5413
5434
  this._subscription.unsubscribe();
5414
5435
  };
5415
- MatDate.prototype.writeValue = function (obj) {
5416
- if (this.writing)
5417
- return;
5418
- // console.debug('[mat-date] writeValue:', obj);
5419
- if (isNilOrBlank(obj)) {
5420
- this.writing = true;
5436
+ MatDate.prototype.writeValue = function (valueStr) {
5437
+ if (this._writing)
5438
+ return; // Skip
5439
+ this._writing = true;
5440
+ // DEBUG
5441
+ // console.debug("[mat-date] writeValue() with:", valueStr);
5442
+ var value = fromDateISOString(valueStr);
5443
+ if (!value || !value.isValid()) {
5421
5444
  this.dayControl.patchValue(null, { emitEvent: false });
5422
- this._value = undefined;
5423
5445
  if (this.formControl.value) {
5424
5446
  this.formControl.patchValue(null, { emitEvent: false });
5425
5447
  this._onChangeCallback(null);
5426
5448
  }
5427
- this.writing = false;
5428
- this.markForCheck();
5429
- return;
5430
5449
  }
5431
- this._value = this.dateAdapter.parse(obj, DATE_ISO_PATTERN);
5432
- if (!this._value) { // invalid date
5433
- return;
5450
+ else {
5451
+ // Format day
5452
+ var day = value.clone().startOf('day');
5453
+ var dayStr = this.dateAdapter.format(day, this.dayPattern);
5454
+ // Update control
5455
+ this.dayControl.patchValue(dayStr, { emitEvent: false });
5434
5456
  }
5435
- this.writing = true;
5436
- // Set form value
5437
- this.dayControl.patchValue(this.dateAdapter.format(this._value.clone().startOf('day'), this.dayPattern), { emitEvent: false });
5438
- this.writing = false;
5457
+ this._writing = false;
5439
5458
  this.markForCheck();
5440
5459
  };
5441
5460
  MatDate.prototype.registerOnChange = function (fn) {
@@ -5445,37 +5464,36 @@
5445
5464
  this._onTouchedCallback = fn;
5446
5465
  };
5447
5466
  MatDate.prototype.setDisabledState = function (isDisabled) {
5448
- if (this.disabling)
5467
+ if (this._disabling)
5449
5468
  return;
5450
- this.disabling = true;
5451
- this.disabled = isDisabled;
5469
+ this._disabling = true;
5452
5470
  if (isDisabled) {
5453
- this.dayControl.disable({ onlySelf: true, emitEvent: false });
5471
+ this.dayControl.disable({ emitEvent: false });
5454
5472
  }
5455
5473
  else {
5456
- this.dayControl.enable({ onlySelf: true, emitEvent: false });
5474
+ this.dayControl.enable({ emitEvent: false });
5457
5475
  }
5458
- this.disabling = false;
5476
+ this._disabling = false;
5459
5477
  this.markForCheck();
5460
5478
  };
5461
5479
  MatDate.prototype.onDatePickerChange = function (event) {
5462
- if (this.writing || !(event && event.value))
5463
- return; // Skip if call by self
5464
- this.writing = true;
5465
- var date = event.value;
5466
- date = typeof date === 'string' && this.dateAdapter.parse(date, DATE_ISO_PATTERN) || date;
5467
- var day;
5468
- // avoid to have TZ offset
5469
- date = date && date.utc(true).hour(0).minute(0).seconds(0).millisecond(0);
5470
- day = date && date.clone().startOf('day');
5471
- // update day value
5472
- this.dayControl.setValue(date && this.dateAdapter.format(day, this.dayPattern), { emitEvent: false });
5473
- // Get the model value
5474
- var dateStr = date && this.dateAdapter.format(date, DATE_ISO_PATTERN).replace('+00:00', 'Z');
5475
- this.formControl.patchValue(dateStr, { emitEvent: false });
5476
- this.writing = false;
5477
- this.markForCheck();
5478
- this._onChangeCallback(dateStr);
5480
+ // Make sure event is valid
5481
+ if (!event || (event.value !== null && !momentImported.isMoment(event.value))) {
5482
+ console.warn('Invalid MatDatepicker event. Skipping', event);
5483
+ return; // Skip
5484
+ }
5485
+ var date = event.value && event.value
5486
+ .locale(this.locale) // set as time as locale time
5487
+ .minute(0).seconds(0).millisecond(0) // Reset hour
5488
+ .utc(true);
5489
+ var dateStr = date && this.dateAdapter.format(date, this.dayPattern) || null;
5490
+ if (this.dayControl.value !== dateStr) {
5491
+ // DEBUG
5492
+ console.debug("[mat-date] onDatePickerChange() new value:", dateStr);
5493
+ this.dayControl.setValue(dateStr, {
5494
+ emitEvent: true // Will call onFormChange
5495
+ });
5496
+ }
5479
5497
  };
5480
5498
  MatDate.prototype.openDatePickerIfMobile = function (event, datePicker) {
5481
5499
  return __awaiter(this, void 0, void 0, function () {
@@ -5526,6 +5544,13 @@
5526
5544
  }
5527
5545
  });
5528
5546
  };
5547
+ MatDate.prototype.clear = function () {
5548
+ this.dayControl.patchValue(null, { emitEvent: false });
5549
+ this.formControl.setValue(null, { emitEvent: false });
5550
+ this._onChangeCallback(null);
5551
+ this.markAsTouched();
5552
+ this.markAsDirty();
5553
+ };
5529
5554
  /* -- private method -- */
5530
5555
  MatDate.prototype.updatePattern = function (pattern) {
5531
5556
  pattern = pattern !== 'COMMON.DATE_PATTERN' ? pattern : 'L';
@@ -5535,35 +5560,28 @@
5535
5560
  this.markForCheck();
5536
5561
  }
5537
5562
  };
5538
- MatDate.prototype.onFormChange = function (dayValue) {
5539
- if (this.writing)
5540
- return; // Skip if call by self
5541
- this.writing = true;
5542
- // Make to remove placeholder chars
5543
- while (dayValue && dayValue.indexOf(this.placeholderChar) !== -1) {
5544
- dayValue = dayValue.replace(this.placeholderChar, '');
5545
- }
5546
- var date;
5547
- // Parse day string
5548
- date = dayValue && this.dateAdapter.parse(dayValue, this.dayPattern) || null;
5549
- // Reset time
5550
- date = date && date.utc(true).hour(0).minute(0).seconds(0).millisecond(0);
5551
- // update date picker
5552
- this._value = date && this.dateAdapter.parse(date.clone(), DATE_ISO_PATTERN);
5553
- // Get the model value
5554
- var dateStr = date && date.isValid() && this.dateAdapter.format(date, DATE_ISO_PATTERN).replace('+00:00', 'Z') || date;
5555
- //console.debug("[mat-date-time] Setting date: ", dateStr);
5556
- this.formControl.patchValue(dateStr, { emitEvent: false });
5557
- //this.formControl.updateValueAndValidity();
5558
- this.writing = false;
5559
- this.markForCheck();
5560
- this._onChangeCallback(dateStr);
5561
- };
5562
5563
  MatDate.prototype.checkIfTouched = function () {
5563
5564
  if (this.dayControl.touched) {
5564
- this.markForCheck();
5565
5565
  this._onTouchedCallback();
5566
+ this.markForCheck();
5567
+ }
5568
+ };
5569
+ MatDate.prototype.onFormChange = function (dayStr) {
5570
+ if (this._writing)
5571
+ return; // Skip if call by self
5572
+ this._writing = true;
5573
+ // Make to remove placeholder chars
5574
+ while (dayStr && dayStr.indexOf(this.placeholderChar) !== -1) {
5575
+ dayStr = dayStr.replace(this.placeholderChar, '');
5566
5576
  }
5577
+ // Parse day
5578
+ var date = dayStr && this.dateAdapter.parse(dayStr, this.dayPattern) || null;
5579
+ // Reset time
5580
+ date = date && date.minute(0).seconds(0).millisecond(0)
5581
+ .utc(); // Convert local date into utc (avoid TZ offset to be in the final string)
5582
+ // Set model value
5583
+ this.emitChange(date);
5584
+ this._writing = false;
5567
5585
  };
5568
5586
  MatDate.prototype.waitKeyboardHide = function (waitKeyboardDelay) {
5569
5587
  return __awaiter(this, void 0, void 0, function () {
@@ -5579,8 +5597,8 @@
5579
5597
  case 1:
5580
5598
  // Wait hide occur
5581
5599
  _a.sent();
5582
- if (!(this.keyboardHideDelay > 0 && waitKeyboardDelay)) return [3 /*break*/, 3];
5583
- return [4 /*yield*/, sleep(this.keyboardHideDelay)];
5600
+ if (!(this._keyboardHideDelay > 0 && waitKeyboardDelay)) return [3 /*break*/, 3];
5601
+ return [4 /*yield*/, sleep(this._keyboardHideDelay)];
5584
5602
  case 2:
5585
5603
  _a.sent();
5586
5604
  _a.label = 3;
@@ -5589,6 +5607,18 @@
5589
5607
  });
5590
5608
  });
5591
5609
  };
5610
+ MatDate.prototype.emitChange = function (value) {
5611
+ // Get the model value
5612
+ var dateStr = toDateISOString(value) || null;
5613
+ if (this.formControl.value !== dateStr) {
5614
+ // DEBUG
5615
+ //console.debug('[matèdate-time] Emit new value: ' + dateStr);
5616
+ // Changes comes from inside function: use the callback
5617
+ this._onChangeCallback(dateStr);
5618
+ // Check if need to update controls
5619
+ this.checkIfTouched();
5620
+ }
5621
+ };
5592
5622
  MatDate.prototype.updateTabIndex = function () {
5593
5623
  var _this = this;
5594
5624
  if (isNil(this._tabindex) || this._tabindex === -1)
@@ -5601,6 +5631,14 @@
5601
5631
  _this.markForCheck();
5602
5632
  });
5603
5633
  };
5634
+ MatDate.prototype.markAsTouched = function (opts) {
5635
+ this.dayControl.markAsTouched(opts);
5636
+ this._onTouchedCallback();
5637
+ this.markForCheck();
5638
+ };
5639
+ MatDate.prototype.markAsDirty = function (opts) {
5640
+ this.formControl.markAsDirty(opts);
5641
+ };
5604
5642
  MatDate.prototype.markForCheck = function () {
5605
5643
  this.cd.markForCheck();
5606
5644
  };
@@ -5609,7 +5647,7 @@
5609
5647
  MatDate.decorators = [
5610
5648
  { type: i0.Component, args: [{
5611
5649
  selector: 'mat-date-field',
5612
- template: "<!-- readonly -->\n<mat-form-field *ngIf=\"readonly else writable\">\n <input matInput hidden type=\"text\" readonly=\"true\" [formControl]=\"formControl\">\n <ion-text>{{formControl.value|dateFormat: {pattern: displayPattern} }}</ion-text>\n</mat-form-field>\n\n<ng-template #writable>\n <mat-form-field [floatLabel]=\"floatLabel\">\n\n <mat-label>{{placeholder}}</mat-label>\n\n <div matPrefix><ng-content select=\"[matPrefix]\"></ng-content></div>\n\n <input matInput #matInput autocomplete=\"off\" type=\"text\"\n *ngIf=\"!mobile\"\n [formControl]=\"dayControl\"\n [textMask]=\"{mask: dayMask, keepCharPositions: true, placeholderChar: placeholderChar}\"\n [placeholder]=\"'COMMON.DATE_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 control -->\n <input matInput type=\"text\"\n [formControl]=\"formControl\"\n hidden\n [matDatepicker]=\"datePicker\"\n (dateChange)=\"onDatePickerChange($event)\">\n\n <button matSuffix mat-icon-button tabindex=\"-1\"\n type=\"button\"\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)=\"writeValue(null)\"\n [hidden]=\"formControl.disabled || !formControl.value\">\n <mat-icon>close</mat-icon>\n </button>\n\n <mat-error *ngIf=\"formControl.hasError('required')\" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf=\"formControl.hasError('validDate')\" translate>ERROR.FIELD_NOT_VALID_DATE</mat-error>\n <mat-error *ngIf=\"formControl.hasError('dateIsAfter')\">{{'ERROR.FIELD_NOT_VALID_DATE_AFTER' | translate: formControl.errors.dateIsAfter }}</mat-error>\n <mat-error *ngIf=\"formControl.hasError('dateRange')\" translate>ERROR.FIELD_NOT_VALID_DATE_RANGE</mat-error>\n <mat-error *ngIf=\"!formControl.hasError('dateRange') && formControl.hasError('dateMaxDuration')\" translate>ERROR.FIELD_NOT_VALID_DATE_MAX_DURATION</mat-error>\n <mat-error *ngIf=\"!formControl.hasError('dateRange') && formControl.hasError('dateMinDuration')\" translate>ERROR.FIELD_NOT_VALID_DATE_MIN_DURATION</mat-error>\n <mat-error *ngIf=\"formControl.hasError('msg')\">{{formControl.errors.msg}}</mat-error>\n </mat-form-field>\n\n <mat-datepicker #datePicker\n [touchUi]=\"mobile\"\n [disabled]=\"formControl.disabled\"\n [startAt]=\"startDate\"></mat-datepicker>\n\n <ng-template #iconDesktop>\n <mat-icon>keyboard_arrow_down</mat-icon>\n </ng-template>\n\n <ng-template #iconDate>\n <mat-icon>date_range</mat-icon>\n </ng-template>\n\n</ng-template>\n\n",
5650
+ 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",
5613
5651
  providers: [
5614
5652
  DEFAULT_VALUE_ACCESSOR$5,
5615
5653
  ],
@@ -5627,19 +5665,19 @@
5627
5665
  { type: i1.FormGroupDirective, decorators: [{ type: i0.Optional }] }
5628
5666
  ]; };
5629
5667
  MatDate.propDecorators = {
5630
- disabled: [{ type: i0.Input }],
5631
5668
  formControl: [{ type: i0.Input }],
5632
5669
  formControlName: [{ type: i0.Input }],
5633
5670
  placeholder: [{ type: i0.Input }],
5634
5671
  floatLabel: [{ type: i0.Input }],
5635
- readonly: [{ type: i0.Input }],
5636
5672
  required: [{ type: i0.Input }],
5673
+ mobile: [{ type: i0.Input }],
5637
5674
  compact: [{ type: i0.Input }],
5638
5675
  placeholderChar: [{ type: i0.Input }],
5639
5676
  autofocus: [{ type: i0.Input }],
5640
- tabindex: [{ type: i0.Input }],
5641
5677
  startDate: [{ type: i0.Input }],
5642
5678
  clearable: [{ type: i0.Input }],
5679
+ readonly: [{ type: i0.Input }],
5680
+ tabindex: [{ type: i0.Input }],
5643
5681
  datePicker: [{ type: i0.ViewChild, args: ['datePicker',] }],
5644
5682
  matInputs: [{ type: i0.ViewChildren, args: ['matInput',] }]
5645
5683
  };
@@ -5652,8 +5690,7 @@
5652
5690
  var DAY_MASK$1 = [/\d/, /\d/, '/', /\d/, /\d/, '/', /\d/, /\d/, /\d/, /\d/];
5653
5691
  var HOUR_REGEXP = /^[012][0-9][:][012345][0-9]$/;
5654
5692
  var HOUR_MASK$1 = [/[012]/, /\d/, ':', /[012345]/, /\d/];
5655
- var noop$5 = function () {
5656
- };
5693
+ var noop$5 = function () { };
5657
5694
  var ɵ0$8 = noop$5;
5658
5695
  var MatDateTime = /** @class */ (function () {
5659
5696
  function MatDateTime(platform, dateAdapter, translate, formBuilder, cd, keyboard, formGroupDir) {
@@ -5667,8 +5704,8 @@
5667
5704
  this._onChangeCallback = noop$5;
5668
5705
  this._onTouchedCallback = noop$5;
5669
5706
  this._subscription = new rxjs.Subscription();
5670
- this.writing = true;
5671
- this.disabling = false;
5707
+ this._writing = true;
5708
+ this._disabling = false;
5672
5709
  this._readonly = false;
5673
5710
  this.dayMask = DAY_MASK$1;
5674
5711
  this.hourMask = HOUR_MASK$1;
@@ -5715,7 +5752,7 @@
5715
5752
  MatDateTime.prototype.ngOnInit = function () {
5716
5753
  var _this = this;
5717
5754
  this.mobile = isNil(this.mobile) ? this.platform.is('mobile') : this.mobile;
5718
- this.keyboardHideDelay = this.mobile && KEYBOARD_HIDE_DELAY_MS || 0;
5755
+ this._keyboardHideDelay = this.mobile && KEYBOARD_HIDE_DELAY_MS || 0;
5719
5756
  this.formControl = this.formControl || this.formControlName && this.formGroupDir && this.formGroupDir.form.get(this.formControlName);
5720
5757
  if (!this.formControl)
5721
5758
  throw new Error('Missing mandatory attribute \'formControl\' or \'formControlName\' in <mat-date-time-field>.');
@@ -5742,19 +5779,19 @@
5742
5779
  .subscribe(function (event) { return _this.onFormChange(event); }));
5743
5780
  // Listen status changes (when done outside the component - e.g. when setErrors() is calling on the formControl)
5744
5781
  this._subscription.add(this.formControl.statusChanges
5745
- .pipe(operators.filter(function (_) { return !_this.readonly && !_this.writing && !_this.disabling; }) // Skip
5782
+ .pipe(operators.filter(function (_) { return !_this.readonly && !_this._writing && !_this._disabling; }) // Skip
5746
5783
  )
5747
5784
  .subscribe(function () { return _this.markForCheck(); }));
5748
5785
  this.updateTabIndex();
5749
- this.writing = false;
5786
+ this._writing = false;
5750
5787
  };
5751
5788
  MatDateTime.prototype.ngOnDestroy = function () {
5752
5789
  this._subscription.unsubscribe();
5753
5790
  };
5754
5791
  MatDateTime.prototype.writeValue = function (valueStr) {
5755
- if (this.writing)
5792
+ if (this._writing)
5756
5793
  return; // Skip
5757
- this.writing = true;
5794
+ this._writing = true;
5758
5795
  // DEBUG
5759
5796
  // console.debug("[mat-date-time] writeValue() with:", valueStr);
5760
5797
  var value = fromDateISOString(valueStr);
@@ -5763,10 +5800,10 @@
5763
5800
  this.timeFormControl.patchValue(null, { emitEvent: false });
5764
5801
  }
5765
5802
  else {
5766
- // Parse day
5803
+ // Format day
5767
5804
  var day = value.clone().startOf('day');
5768
5805
  var dayStr = this.dateAdapter.format(day, this.dayPattern);
5769
- // Parse time
5806
+ // Format time
5770
5807
  // - Format hh
5771
5808
  var hour = value.hour();
5772
5809
  hour = hour < 10 ? ('0' + hour) : hour;
@@ -5778,46 +5815,9 @@
5778
5815
  this.dateFormControl.patchValue(dayStr, { emitEvent: false });
5779
5816
  this.timeFormControl.patchValue(timeStr, { emitEvent: false });
5780
5817
  }
5781
- this.writing = false;
5818
+ this._writing = false;
5782
5819
  this.markForCheck();
5783
5820
  };
5784
- MatDateTime.prototype.onFormChange = function (event) {
5785
- if (this.writing)
5786
- return; // Skip if call by self
5787
- this.writing = true;
5788
- var dayStr = this.dateFormControl.value;
5789
- var time = this.timeFormControl.value;
5790
- // DEBUG
5791
- //console.debug(`[mat-date-time] onFormChange() from event: ${event} - controls values: `, [dayStr, time]);
5792
- var incompleteValue = isNilOrBlank(time) !== isNilOrBlank(dayStr);
5793
- if (incompleteValue || this.dateFormControl.invalid || this.timeFormControl.invalid) {
5794
- this.formControl.markAsPending({ onlySelf: true });
5795
- this.formControl.setErrors(Object.assign(Object.assign(Object.assign({ validDate: incompleteValue }, this.formControl.errors), this.dateFormControl.errors), this.timeFormControl.errors));
5796
- this.formControl.markAsDirty();
5797
- // Reset the value
5798
- //this.emitChange(null);
5799
- this.writing = false;
5800
- return;
5801
- }
5802
- // Make to remove placeholder chars
5803
- while (dayStr && dayStr.indexOf(this.placeholderChar) !== -1) {
5804
- dayStr = dayStr.replace(this.placeholderChar, '');
5805
- }
5806
- // Parse day
5807
- var day = dayStr && this.dateAdapter.parse(dayStr, this.dayPattern) || null;
5808
- // Parse time
5809
- var hourParts = (time || '').split(':');
5810
- var hour = parseInt(hourParts[0] || 0);
5811
- var minutes = parseInt(hourParts[1] || 0);
5812
- var dateTime = day && day
5813
- .locale(this.locale) // set as time as locale time
5814
- .hour(hour).minute(minutes) // Set local hour
5815
- .seconds(0).millisecond(0) // Reset seconds/millisecond
5816
- .utc(); // Convert to UTC (avoid TZ offset in final string)
5817
- // Set model value
5818
- this.emitChange(dateTime);
5819
- this.writing = false;
5820
- };
5821
5821
  MatDateTime.prototype.registerOnChange = function (fn) {
5822
5822
  this._onChangeCallback = fn;
5823
5823
  };
@@ -5825,9 +5825,9 @@
5825
5825
  this._onTouchedCallback = fn;
5826
5826
  };
5827
5827
  MatDateTime.prototype.setDisabledState = function (isDisabled) {
5828
- if (this.disabling)
5828
+ if (this._disabling)
5829
5829
  return; // Skip
5830
- this.disabling = true;
5830
+ this._disabling = true;
5831
5831
  if (isDisabled) {
5832
5832
  this.dateFormControl.disable({ emitEvent: false });
5833
5833
  this.timeFormControl.disable({ emitEvent: false });
@@ -5836,7 +5836,7 @@
5836
5836
  this.dateFormControl.enable({ emitEvent: false });
5837
5837
  this.timeFormControl.enable({ emitEvent: false });
5838
5838
  }
5839
- this.disabling = false;
5839
+ this._disabling = false;
5840
5840
  this.markForCheck();
5841
5841
  };
5842
5842
  MatDateTime.prototype.onDatePickerChange = function (event) {
@@ -5961,6 +5961,43 @@
5961
5961
  this.markForCheck();
5962
5962
  }
5963
5963
  };
5964
+ MatDateTime.prototype.onFormChange = function (event) {
5965
+ if (this._writing)
5966
+ return; // Skip if call by self
5967
+ this._writing = true;
5968
+ var dayStr = this.dateFormControl.value;
5969
+ var time = this.timeFormControl.value;
5970
+ // DEBUG
5971
+ //console.debug(`[mat-date-time] onFormChange() from event: ${event} - controls values: `, [dayStr, time]);
5972
+ var incompleteValue = isNilOrBlank(time) !== isNilOrBlank(dayStr);
5973
+ if (incompleteValue || this.dateFormControl.invalid || this.timeFormControl.invalid) {
5974
+ this.formControl.markAsPending({ onlySelf: true });
5975
+ this.formControl.setErrors(Object.assign(Object.assign(Object.assign({ validDate: incompleteValue }, this.formControl.errors), this.dateFormControl.errors), this.timeFormControl.errors));
5976
+ this.formControl.markAsDirty();
5977
+ // Reset the value
5978
+ //this.emitChange(null);
5979
+ this._writing = false;
5980
+ return;
5981
+ }
5982
+ // Make to remove placeholder chars
5983
+ while (dayStr && dayStr.indexOf(this.placeholderChar) !== -1) {
5984
+ dayStr = dayStr.replace(this.placeholderChar, '');
5985
+ }
5986
+ // Parse day
5987
+ var day = dayStr && this.dateAdapter.parse(dayStr, this.dayPattern) || null;
5988
+ // Parse time
5989
+ var hourParts = (time || '').split(':');
5990
+ var hour = parseInt(hourParts[0] || 0);
5991
+ var minutes = parseInt(hourParts[1] || 0);
5992
+ var dateTime = day && day
5993
+ .locale(this.locale) // set as time as locale time
5994
+ .hour(hour).minute(minutes) // Set local hour
5995
+ .seconds(0).millisecond(0) // Reset seconds/millisecond
5996
+ .utc(); // Convert to UTC (avoid TZ offset in final string)
5997
+ // Set model value
5998
+ this.emitChange(dateTime);
5999
+ this._writing = false;
6000
+ };
5964
6001
  MatDateTime.prototype.waitKeyboardHide = function (waitKeyboardDelay) {
5965
6002
  return __awaiter(this, void 0, void 0, function () {
5966
6003
  return __generator(this, function (_a) {
@@ -5975,8 +6012,8 @@
5975
6012
  case 1:
5976
6013
  // Wait hide occur
5977
6014
  _a.sent();
5978
- if (!(this.keyboardHideDelay > 0 && waitKeyboardDelay)) return [3 /*break*/, 3];
5979
- return [4 /*yield*/, sleep(this.keyboardHideDelay)];
6015
+ if (!(this._keyboardHideDelay > 0 && waitKeyboardDelay)) return [3 /*break*/, 3];
6016
+ return [4 /*yield*/, sleep(this._keyboardHideDelay)];
5980
6017
  case 2:
5981
6018
  _a.sent();
5982
6019
  _a.label = 3;
@@ -6009,9 +6046,9 @@
6009
6046
  _this.markForCheck();
6010
6047
  });
6011
6048
  };
6012
- MatDateTime.prototype.markAsTouched = function () {
6013
- this.dateFormControl.markAsTouched();
6014
- this.timeFormControl.markAsTouched();
6049
+ MatDateTime.prototype.markAsTouched = function (opts) {
6050
+ this.dateFormControl.markAsTouched(opts);
6051
+ this.timeFormControl.markAsTouched(opts);
6015
6052
  this._onTouchedCallback();
6016
6053
  this.markForCheck();
6017
6054
  };
@@ -6026,7 +6063,7 @@
6026
6063
  MatDateTime.decorators = [
6027
6064
  { type: i0.Component, args: [{
6028
6065
  selector: 'mat-date-time-field',
6029
- 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]=\"dateFormControl\"\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]=\"dateFormControl\"\n (click)=\"openDatePickerIfMobile($event, datePicker)\"\n [required]=\"required\"\n [tabindex]=\"tabindex\"\n readonly>\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 #datePickerButton2 (click)=\"openDatePicker($event, datePicker)\" [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=\"'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 && (timeFormControl.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]=\"timeFormControl\"\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]=\"timeFormControl\"\n (click)=\"openTimePickerIfMobile($event)\"\n readonly>\n\n <input matInput type=\"text\"\n [formControl]=\"timeFormControl\"\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",
6066
+ 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]=\"dateFormControl\"\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]=\"dateFormControl\"\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 </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 && (timeFormControl.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]=\"timeFormControl\"\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]=\"timeFormControl\"\n (click)=\"openTimePickerIfMobile($event)\"\n readonly>\n\n <input matInput type=\"text\"\n [formControl]=\"timeFormControl\"\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",
6030
6067
  providers: [
6031
6068
  DEFAULT_VALUE_ACCESSOR$4,
6032
6069
  ],
@@ -11529,7 +11566,7 @@
11529
11566
  onRefresh: [{ type: i0.Input }]
11530
11567
  };
11531
11568
 
11532
- var moment$3 = momentImported__namespace;
11569
+ var moment$4 = momentImported__namespace;
11533
11570
  var SETTINGS_STORAGE_KEY = 'settings';
11534
11571
  var SETTINGS_TRANSIENT_PROPERTIES = ['mobile', 'touchUi' /*deprecated*/];
11535
11572
  // fixme: this constant points to static environment
@@ -11831,11 +11868,11 @@
11831
11868
  if (!feature) {
11832
11869
  feature = {
11833
11870
  name: featureName.toLowerCase(),
11834
- lastSyncDate: moment$3().toISOString()
11871
+ lastSyncDate: moment$4().toISOString()
11835
11872
  };
11836
11873
  }
11837
11874
  else {
11838
- feature.lastSyncDate = moment$3().toISOString();
11875
+ feature.lastSyncDate = moment$4().toISOString();
11839
11876
  }
11840
11877
  this.saveOfflineFeature(feature);
11841
11878
  };
@@ -12029,7 +12066,7 @@
12029
12066
  if (!page || !page.title || !page.path)
12030
12067
  throw Error('Missing required argument \'page\', \'page.path\' or \'page.title\'');
12031
12068
  // Set time
12032
- page.time = page.time || moment$3();
12069
+ page.time = page.time || moment$4();
12033
12070
  // Clean the title (remove <small> tags)
12034
12071
  if (!opts || opts.removeTitleSmallTag !== false) {
12035
12072
  var tagIndex = page.title.indexOf('</small>');
@@ -17673,7 +17710,7 @@
17673
17710
  ]; };
17674
17711
  var templateObject_1$3, templateObject_2$3, templateObject_3$2, templateObject_4$2, templateObject_5$1;
17675
17712
 
17676
- var moment$2 = momentImported__namespace;
17713
+ var moment$3 = momentImported__namespace;
17677
17714
  var PlatformService = /** @class */ (function (_super) {
17678
17715
  __extends(PlatformService, _super);
17679
17716
  function PlatformService(platform, cdkPlatform, toastController, translate, dateAdapter, entitiesStorage, settings, networkService, accountService, configService, cache, storage, audioProvider, environment, statusBar, keyboard, splashScreen, browser, downloader) {
@@ -17933,16 +17970,16 @@
17933
17970
  }
17934
17971
  // config moment lib
17935
17972
  try {
17936
- moment$2.locale(event.lang);
17973
+ moment$3.locale(event.lang);
17937
17974
  console.debug('[platform] Use locale {' + event.lang + '}');
17938
17975
  }
17939
17976
  // If error, fallback to en
17940
17977
  catch (err) {
17941
- moment$2.locale('en');
17978
+ moment$3.locale('en');
17942
17979
  console.warn('[platform] Unknown local for moment lib. Using default [en]');
17943
17980
  }
17944
17981
  // Config date adapter
17945
- _this.dateAdapter.setLocale(moment$2.locale());
17982
+ _this.dateAdapter.setLocale(moment$3.locale());
17946
17983
  }
17947
17984
  });
17948
17985
  this.settings.onChange.subscribe(function (data) {
@@ -29883,13 +29920,13 @@
29883
29920
  { type: i1.FormBuilder }
29884
29921
  ]; };
29885
29922
 
29886
- var moment$1 = momentImported__namespace;
29923
+ var moment$2 = momentImported__namespace;
29887
29924
  var SwipeTestPage = /** @class */ (function () {
29888
29925
  function SwipeTestPage(formBuilder, dateFormatPipe) {
29889
29926
  this.formBuilder = formBuilder;
29890
29927
  this.dateFormatPipe = dateFormatPipe;
29891
29928
  this.$dates = new rxjs.BehaviorSubject(undefined);
29892
- this._today = moment$1().startOf('day');
29929
+ this._today = moment$2().startOf('day');
29893
29930
  this.form = formBuilder.group({
29894
29931
  empty: [null, i1.Validators.required],
29895
29932
  date: [null, i1.Validators.compose([i1.Validators.required, SharedValidators.validDate])],
@@ -29903,7 +29940,7 @@
29903
29940
  var _this = this;
29904
29941
  var dates = [];
29905
29942
  for (var d = 0; d < 7; d++) {
29906
- dates[d] = moment$1(this._today).add(d - 3, 'day');
29943
+ dates[d] = moment$2(this._today).add(d - 3, 'day');
29907
29944
  }
29908
29945
  this.$dates.next(dates);
29909
29946
  this.loadData();
@@ -29950,7 +29987,7 @@
29950
29987
  { type: DateFormatPipe }
29951
29988
  ]; };
29952
29989
 
29953
- var moment = momentImported__namespace;
29990
+ var moment$1 = momentImported__namespace;
29954
29991
  var DateTimeTestPage = /** @class */ (function () {
29955
29992
  function DateTimeTestPage(platform, formBuilder, cd) {
29956
29993
  this.platform = platform;
@@ -29986,7 +30023,7 @@
29986
30023
  var now, data;
29987
30024
  var _this = this;
29988
30025
  return __generator(this, function (_a) {
29989
- now = moment();
30026
+ now = moment$1();
29990
30027
  data = {
29991
30028
  empty: toDateISOString(now.clone().add(2, 'hours')),
29992
30029
  enable: toDateISOString(now),
@@ -30262,9 +30299,111 @@
30262
30299
  { type: i1.FormBuilder }
30263
30300
  ]; };
30264
30301
 
30302
+ var moment = momentImported__namespace;
30303
+ var DateTestPage = /** @class */ (function () {
30304
+ function DateTestPage(platform, formBuilder, cd) {
30305
+ this.platform = platform;
30306
+ this.formBuilder = formBuilder;
30307
+ this.cd = cd;
30308
+ this.showLogPanel = true;
30309
+ this.logContent = '';
30310
+ this.memoryHide = false;
30311
+ this.memoryMobile = true;
30312
+ this.stringify = JSON.stringify;
30313
+ this.form = formBuilder.group({
30314
+ empty: [null, i1.Validators.required],
30315
+ enable: [null, i1.Validators.required],
30316
+ disable: [null, i1.Validators.required],
30317
+ readonly: [null]
30318
+ }, {
30319
+ validators: SharedFormGroupValidators.dateRange('empty', 'enable')
30320
+ });
30321
+ var disableControl = this.form.get('disable');
30322
+ disableControl.disable();
30323
+ // Copy the 'enable' value, into the disable control
30324
+ this.form.get('enable').valueChanges.subscribe(function (value) { return disableControl.setValue(value); });
30325
+ var mobile = platform.is('mobile');
30326
+ this.showLogPanel = this.showLogPanel || mobile;
30327
+ }
30328
+ DateTestPage.prototype.ngOnInit = function () {
30329
+ var _this = this;
30330
+ setTimeout(function () { return _this.loadData(); }, 250);
30331
+ };
30332
+ // Load the form with data
30333
+ DateTestPage.prototype.loadData = function () {
30334
+ return __awaiter(this, void 0, void 0, function () {
30335
+ var now, data;
30336
+ var _this = this;
30337
+ return __generator(this, function (_a) {
30338
+ now = moment();
30339
+ data = {
30340
+ empty: toDateISOString(now.clone().add(2, 'hours')),
30341
+ enable: toDateISOString(now),
30342
+ disable: now,
30343
+ readonly: now
30344
+ };
30345
+ this.form.setValue(data);
30346
+ this.log('[test-page] Data loaded: ' + JSON.stringify(data));
30347
+ this.form.get('empty').valueChanges
30348
+ .pipe(operators.debounceTime(300))
30349
+ .subscribe(function (value) { return _this.log('[test-page] Value n°1: ' + JSON.stringify(value)); });
30350
+ this.form.get('enable').valueChanges
30351
+ .pipe(operators.debounceTime(300))
30352
+ .subscribe(function (value) { return _this.log('[test-page] Value n°2: ' + JSON.stringify(value)); });
30353
+ return [2 /*return*/];
30354
+ });
30355
+ });
30356
+ };
30357
+ DateTestPage.prototype.doSubmit = function (event) {
30358
+ this.form.markAllAsTouched();
30359
+ this.log('[test-page] Form content: ' + JSON.stringify(this.form.value));
30360
+ this.log('[test-page] Form status: ' + this.form.status);
30361
+ if (this.form.invalid) {
30362
+ this.log('[test-page] Form errors: ' + JSON.stringify(this.form.errors));
30363
+ // DEBUG
30364
+ AppFormUtils.logFormErrors(this.form);
30365
+ }
30366
+ };
30367
+ DateTestPage.prototype.log = function (message) {
30368
+ console.debug(message);
30369
+ if (this.showLogPanel) {
30370
+ this.logContent += message + '<br/>';
30371
+ this.cd.markForCheck();
30372
+ }
30373
+ };
30374
+ DateTestPage.prototype.clearLogPanel = function () {
30375
+ this.logContent = '';
30376
+ this.cd.markForCheck();
30377
+ };
30378
+ DateTestPage.prototype.startMemoryTimer = function () {
30379
+ var _this = this;
30380
+ this.memoryTimer = setInterval(function () {
30381
+ _this.memoryHide = !_this.memoryHide;
30382
+ }, 50);
30383
+ };
30384
+ DateTestPage.prototype.stopMemoryTimer = function () {
30385
+ clearInterval(this.memoryTimer);
30386
+ this.memoryTimer = null;
30387
+ this.memoryHide = false;
30388
+ };
30389
+ return DateTestPage;
30390
+ }());
30391
+ DateTestPage.decorators = [
30392
+ { type: i0.Component, args: [{
30393
+ selector: 'app-data-test',
30394
+ 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 <!-- 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 </ion-row>\n </ion-grid>\n </form>\n\n</ion-content>\n"
30395
+ },] }
30396
+ ];
30397
+ DateTestPage.ctorParameters = function () { return [
30398
+ { type: i1$5.Platform },
30399
+ { type: i1.FormBuilder },
30400
+ { type: i0.ChangeDetectorRef }
30401
+ ]; };
30402
+
30265
30403
  var SHARED_MATERIAL_TESTING_PAGES = [
30266
30404
  { label: 'Shared Material components', divider: true },
30267
30405
  { label: 'Date/Time field', page: '/testing/shared/datetime' },
30406
+ { label: 'Date field', page: '/testing/shared/date' },
30268
30407
  { label: 'Autocomplete field', page: '/testing/shared/autocomplete' },
30269
30408
  { label: 'Lat/Long field', page: '/testing/shared/latlong' },
30270
30409
  { label: 'Numeric pad component', page: '/testing/shared/numpad' },
@@ -30289,6 +30428,11 @@
30289
30428
  pathMatch: 'full',
30290
30429
  component: DateTimeTestPage
30291
30430
  },
30431
+ {
30432
+ path: 'date',
30433
+ pathMatch: 'full',
30434
+ component: DateTestPage
30435
+ },
30292
30436
  {
30293
30437
  path: 'latlong',
30294
30438
  pathMatch: 'full',
@@ -30332,6 +30476,7 @@
30332
30476
  ],
30333
30477
  declarations: [
30334
30478
  DateTimeTestPage,
30479
+ DateTestPage,
30335
30480
  AutocompleteTestPage,
30336
30481
  LatLongTestPage,
30337
30482
  NumpadTestPage,
@@ -30343,6 +30488,7 @@
30343
30488
  SharedMaterialModule,
30344
30489
  i3.RouterModule,
30345
30490
  DateTimeTestPage,
30491
+ DateTestPage,
30346
30492
  AutocompleteTestPage,
30347
30493
  LatLongTestPage,
30348
30494
  NumpadTestPage,
@@ -31419,10 +31565,11 @@
31419
31565
  exports["ɵg"] = UserSettingsValidatorService;
31420
31566
  exports["ɵh"] = LocalSettingsValidatorService;
31421
31567
  exports["ɵi"] = AppIconComponent;
31422
- exports["ɵj"] = NumpadTestPage;
31423
- exports["ɵk"] = MatBadgeIconTestPage;
31424
- exports["ɵl"] = ToastTestingModule;
31425
- exports["ɵm"] = ToastTestingPage;
31568
+ exports["ɵj"] = DateTestPage;
31569
+ exports["ɵk"] = NumpadTestPage;
31570
+ exports["ɵl"] = MatBadgeIconTestPage;
31571
+ exports["ɵm"] = ToastTestingModule;
31572
+ exports["ɵn"] = ToastTestingPage;
31426
31573
 
31427
31574
  Object.defineProperty(exports, '__esModule', { value: true });
31428
31575