novo-elements 5.12.1 → 5.13.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.
- package/bundles/novo-elements.umd.js +28 -3
- package/bundles/novo-elements.umd.js.map +1 -1
- package/bundles/novo-elements.umd.min.js +1 -1
- package/bundles/novo-elements.umd.min.js.map +1 -1
- package/elements/date-picker/DatePicker.scss +7 -1
- package/elements/date-picker/DatePickerInput.d.ts +5 -0
- package/esm2015/elements/date-picker/DatePickerInput.js +26 -2
- package/esm2015/services/date-format/DateFormat.js +4 -2
- package/fesm2015/novo-elements.js +28 -2
- package/fesm2015/novo-elements.js.map +1 -1
- package/novo-elements.metadata.json +1 -1
- package/package.json +1 -1
- package/services/date-format/DateFormat.d.ts +2 -2
|
@@ -28260,6 +28260,7 @@
|
|
|
28260
28260
|
var month;
|
|
28261
28261
|
var day;
|
|
28262
28262
|
var date = new Date();
|
|
28263
|
+
var isInvalidDate = true;
|
|
28263
28264
|
if (Helpers.isEmpty(dateFormat)) {
|
|
28264
28265
|
// Default to MM/dd/yyyy
|
|
28265
28266
|
dateFormat = 'mm/dd/yyyy';
|
|
@@ -28283,6 +28284,7 @@
|
|
|
28283
28284
|
}
|
|
28284
28285
|
if (month >= 0 && month <= 11 && year > 1900 && day > 0 && day <= 31) {
|
|
28285
28286
|
date = new Date(year, month, day);
|
|
28287
|
+
isInvalidDate = false;
|
|
28286
28288
|
}
|
|
28287
28289
|
}
|
|
28288
28290
|
else if (dateFormatTokens && dateFormatTokens.length === 4 && dateString.length >= 1) {
|
|
@@ -28297,7 +28299,7 @@
|
|
|
28297
28299
|
dateString = "" + dateString + delimiter[1];
|
|
28298
28300
|
}
|
|
28299
28301
|
}
|
|
28300
|
-
return [date, dateString];
|
|
28302
|
+
return [date, dateString, isInvalidDate];
|
|
28301
28303
|
};
|
|
28302
28304
|
DateFormatService.prototype.parseTimeString = function (timeString, militaryTime) {
|
|
28303
28305
|
var e_2, _a;
|
|
@@ -28418,6 +28420,7 @@
|
|
|
28418
28420
|
this._changeDetectorRef = _changeDetectorRef;
|
|
28419
28421
|
this.dateFormatService = dateFormatService;
|
|
28420
28422
|
this.formattedValue = '';
|
|
28423
|
+
this.invalidDateErrorMessage = '';
|
|
28421
28424
|
/** View -> model callback called when value changes */
|
|
28422
28425
|
this._onChange = function () { };
|
|
28423
28426
|
/** View -> model callback called when autocomplete has been touched */
|
|
@@ -28444,6 +28447,7 @@
|
|
|
28444
28447
|
else {
|
|
28445
28448
|
this.maskOptions = { mask: false };
|
|
28446
28449
|
}
|
|
28450
|
+
this.setupInvalidDateErrorMessage();
|
|
28447
28451
|
};
|
|
28448
28452
|
/** BEGIN: Convenient Panel Methods. */
|
|
28449
28453
|
NovoDatePickerInputElement.prototype.openPanel = function () {
|
|
@@ -28475,9 +28479,11 @@
|
|
|
28475
28479
|
}
|
|
28476
28480
|
};
|
|
28477
28481
|
NovoDatePickerInputElement.prototype._handleBlur = function (event) {
|
|
28482
|
+
this.handleInvalidDate();
|
|
28478
28483
|
this.blurEvent.emit(event);
|
|
28479
28484
|
};
|
|
28480
28485
|
NovoDatePickerInputElement.prototype._handleFocus = function (event) {
|
|
28486
|
+
this.showInvalidDateError = false;
|
|
28481
28487
|
this.openPanel();
|
|
28482
28488
|
this.focusEvent.emit(event);
|
|
28483
28489
|
};
|
|
@@ -28494,7 +28500,8 @@
|
|
|
28494
28500
|
};
|
|
28495
28501
|
NovoDatePickerInputElement.prototype.formatDate = function (value, blur) {
|
|
28496
28502
|
try {
|
|
28497
|
-
var _a = __read(this.dateFormatService.parseString(value, false, 'date'),
|
|
28503
|
+
var _a = __read(this.dateFormatService.parseString(value, false, 'date'), 3), dateTimeValue = _a[0], formatted = _a[1], isInvalidDate = _a[2];
|
|
28504
|
+
this.isInvalidDate = isInvalidDate;
|
|
28498
28505
|
if (!isNaN(dateTimeValue.getUTCDate())) {
|
|
28499
28506
|
var dt = new Date(dateTimeValue);
|
|
28500
28507
|
this.dispatchOnChange(dt, blur);
|
|
@@ -28518,6 +28525,24 @@
|
|
|
28518
28525
|
NovoDatePickerInputElement.prototype.setDisabledState = function (disabled) {
|
|
28519
28526
|
this.disabled = disabled;
|
|
28520
28527
|
};
|
|
28528
|
+
NovoDatePickerInputElement.prototype.handleInvalidDate = function () {
|
|
28529
|
+
if (this.isInvalidDate && this.value) {
|
|
28530
|
+
this.showInvalidDateError = true;
|
|
28531
|
+
this.clearValue();
|
|
28532
|
+
this.closePanel();
|
|
28533
|
+
}
|
|
28534
|
+
};
|
|
28535
|
+
NovoDatePickerInputElement.prototype.setupInvalidDateErrorMessage = function () {
|
|
28536
|
+
var dateFormat = this.labels.dateFormatString();
|
|
28537
|
+
if (Helpers.isEmpty(dateFormat)) {
|
|
28538
|
+
// Default to mm/dd/yyyy
|
|
28539
|
+
dateFormat = 'mm/dd/yyyy';
|
|
28540
|
+
}
|
|
28541
|
+
else {
|
|
28542
|
+
dateFormat = dateFormat.toLowerCase();
|
|
28543
|
+
}
|
|
28544
|
+
this.invalidDateErrorMessage = "Invalid date field entered. Date format of " + dateFormat + " is required.";
|
|
28545
|
+
};
|
|
28521
28546
|
NovoDatePickerInputElement.prototype.dispatchOnChange = function (newValue, blur, skip) {
|
|
28522
28547
|
if (blur === void 0) { blur = false; }
|
|
28523
28548
|
if (skip === void 0) { skip = false; }
|
|
@@ -28610,7 +28635,7 @@
|
|
|
28610
28635
|
{ type: core.Component, args: [{
|
|
28611
28636
|
selector: 'novo-date-picker-input',
|
|
28612
28637
|
providers: [DATE_VALUE_ACCESSOR],
|
|
28613
|
-
template: "\n <input\n type=\"text\"\n [name]=\"name\"\n [(ngModel)]=\"formattedValue\"\n [textMask]=\"maskOptions\"\n [placeholder]=\"placeholder\"\n (focus)=\"_handleFocus($event)\"\n (keydown)=\"_handleKeydown($event)\"\n (input)=\"_handleInput($event)\"\n (blur)=\"_handleBlur($event)\"\n #input\n data-automation-id=\"date-input\"\n [disabled]=\"disabled\"\n />\n <i *ngIf=\"!hasValue\" (click)=\"openPanel()\" class=\"bhi-calendar\"></i>\n <i *ngIf=\"hasValue\" (click)=\"clearValue()\" class=\"bhi-times\"></i>\n <novo-overlay-template [parent]=\"element\" position=\"above-below\">\n <novo-date-picker\n [start]=\"start\"\n [end]=\"end\"\n inline=\"true\"\n (onSelect)=\"setValueAndClose($event)\"\n [disabledDateMessage]=\"disabledDateMessage\"\n [ngModel]=\"value\"\n [weekStart]=\"weekStart\"\n ></novo-date-picker>\n </novo-overlay-template>\n "
|
|
28638
|
+
template: "\n <input\n type=\"text\"\n [name]=\"name\"\n [(ngModel)]=\"formattedValue\"\n [textMask]=\"maskOptions\"\n [placeholder]=\"placeholder\"\n (focus)=\"_handleFocus($event)\"\n (keydown)=\"_handleKeydown($event)\"\n (input)=\"_handleInput($event)\"\n (blur)=\"_handleBlur($event)\"\n #input\n data-automation-id=\"date-input\"\n [disabled]=\"disabled\"\n />\n <span class=\"error-text\" *ngIf=\"showInvalidDateError\">{{invalidDateErrorMessage}}</span>\n <i *ngIf=\"!hasValue\" (click)=\"openPanel()\" class=\"bhi-calendar\"></i>\n <i *ngIf=\"hasValue\" (click)=\"clearValue()\" class=\"bhi-times\"></i>\n <novo-overlay-template [parent]=\"element\" position=\"above-below\">\n <novo-date-picker\n [start]=\"start\"\n [end]=\"end\"\n inline=\"true\"\n (onSelect)=\"setValueAndClose($event)\"\n [disabledDateMessage]=\"disabledDateMessage\"\n [ngModel]=\"value\"\n [weekStart]=\"weekStart\"\n ></novo-date-picker>\n </novo-overlay-template>\n "
|
|
28614
28639
|
},] }
|
|
28615
28640
|
];
|
|
28616
28641
|
NovoDatePickerInputElement.ctorParameters = function () { return [
|