novo-elements 5.11.0 → 5.13.1
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 +72 -10
- 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/data-table/cell-headers/data-table-checkbox-header-cell.component.d.ts +2 -0
- package/elements/data-table/data-table.component.d.ts +5 -0
- package/elements/date-picker/DatePicker.scss +7 -1
- package/elements/date-picker/DatePickerInput.d.ts +5 -0
- package/elements/form/Form.scss +2 -1
- package/esm2015/elements/data-table/cell-headers/data-table-checkbox-header-cell.component.js +27 -2
- package/esm2015/elements/data-table/data-table.component.js +10 -2
- package/esm2015/elements/date-picker/DatePickerInput.js +27 -3
- package/esm2015/services/date-format/DateFormat.js +4 -2
- package/esm2015/services/novo-label-service.js +5 -1
- package/fesm2015/novo-elements.js +68 -5
- 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
- package/services/novo-label-service.d.ts +2 -0
|
@@ -3011,6 +3011,7 @@ class NovoLabelService {
|
|
|
3011
3011
|
this.noItems = 'There are no items';
|
|
3012
3012
|
this.dateFormat = 'MM/dd/yyyy';
|
|
3013
3013
|
this.dateFormatPlaceholder = 'MM/DD/YYYY';
|
|
3014
|
+
this.localDatePlaceholder = 'mm/dd/yyyy';
|
|
3014
3015
|
this.timeFormatPlaceholderAM = 'hh:mm AM';
|
|
3015
3016
|
this.timeFormatPlaceholder24Hour = 'HH:mm';
|
|
3016
3017
|
this.timeFormatAM = 'AM';
|
|
@@ -3058,6 +3059,9 @@ class NovoLabelService {
|
|
|
3058
3059
|
dateFormatString() {
|
|
3059
3060
|
return this.dateFormat;
|
|
3060
3061
|
}
|
|
3062
|
+
localizedDatePlaceholder() {
|
|
3063
|
+
return this.localDatePlaceholder;
|
|
3064
|
+
}
|
|
3061
3065
|
tabbedGroupClearSuggestion(tabLabelPlural) {
|
|
3062
3066
|
return `Clear your search to see all ${tabLabelPlural}.`;
|
|
3063
3067
|
}
|
|
@@ -8327,8 +8331,10 @@ class NovoDataTable {
|
|
|
8327
8331
|
this.templates = {};
|
|
8328
8332
|
this.fixedHeader = false;
|
|
8329
8333
|
this.maxSelected = undefined;
|
|
8334
|
+
this.canSelectAll = false;
|
|
8330
8335
|
this._hideGlobalSearch = true;
|
|
8331
8336
|
this.preferencesChanged = new EventEmitter();
|
|
8337
|
+
this.allSelected = new EventEmitter();
|
|
8332
8338
|
this.loading = true;
|
|
8333
8339
|
this.columnToTemplate = {};
|
|
8334
8340
|
this.columnsLoaded = false;
|
|
@@ -8614,6 +8620,10 @@ class NovoDataTable {
|
|
|
8614
8620
|
this.state.onSelectionChange();
|
|
8615
8621
|
}
|
|
8616
8622
|
allCurrentRowsSelected() {
|
|
8623
|
+
var _a, _b;
|
|
8624
|
+
if (!((_b = (_a = this.dataSource) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
8625
|
+
return false;
|
|
8626
|
+
}
|
|
8617
8627
|
for (let i = 0; i < (this.dataSource.data || []).length; i++) {
|
|
8618
8628
|
if (!this.isSelected((this.dataSource.data || [])[i])) {
|
|
8619
8629
|
return false;
|
|
@@ -8773,7 +8783,7 @@ NovoDataTable.decorators = [
|
|
|
8773
8783
|
[hidden]="dataSource?.totallyEmpty && !state.userFiltered"
|
|
8774
8784
|
>
|
|
8775
8785
|
<ng-container cdkColumnDef="selection">
|
|
8776
|
-
<novo-data-table-checkbox-header-cell *cdkHeaderCellDef [maxSelected]="maxSelected"></novo-data-table-checkbox-header-cell>
|
|
8786
|
+
<novo-data-table-checkbox-header-cell *cdkHeaderCellDef [maxSelected]="maxSelected" [canSelectAll]="canSelectAll"></novo-data-table-checkbox-header-cell>
|
|
8777
8787
|
<novo-data-table-checkbox-cell *cdkCellDef="let row; let i = index" [row]="row" [maxSelected]="maxSelected"></novo-data-table-checkbox-cell>
|
|
8778
8788
|
</ng-container>
|
|
8779
8789
|
<ng-container cdkColumnDef="expand">
|
|
@@ -8956,6 +8966,7 @@ NovoDataTable.propDecorators = {
|
|
|
8956
8966
|
fixedHeader: [{ type: Input }],
|
|
8957
8967
|
paginatorDataFeatureId: [{ type: Input }],
|
|
8958
8968
|
maxSelected: [{ type: Input }],
|
|
8969
|
+
canSelectAll: [{ type: Input }],
|
|
8959
8970
|
dataTableService: [{ type: Input }],
|
|
8960
8971
|
rows: [{ type: Input }],
|
|
8961
8972
|
outsideFilter: [{ type: Input }],
|
|
@@ -8966,6 +8977,7 @@ NovoDataTable.propDecorators = {
|
|
|
8966
8977
|
forceShowHeader: [{ type: Input }],
|
|
8967
8978
|
hideGlobalSearch: [{ type: Input }],
|
|
8968
8979
|
preferencesChanged: [{ type: Output }],
|
|
8980
|
+
allSelected: [{ type: Output }],
|
|
8969
8981
|
empty: [{ type: HostBinding, args: ['class.empty',] }],
|
|
8970
8982
|
loadingClass: [{ type: HostBinding, args: ['class.loading',] }],
|
|
8971
8983
|
listInteractions: [{ type: Input }]
|
|
@@ -29032,6 +29044,7 @@ class DateFormatService {
|
|
|
29032
29044
|
let month;
|
|
29033
29045
|
let day;
|
|
29034
29046
|
let date = new Date();
|
|
29047
|
+
let isInvalidDate = true;
|
|
29035
29048
|
if (Helpers.isEmpty(dateFormat)) {
|
|
29036
29049
|
// Default to MM/dd/yyyy
|
|
29037
29050
|
dateFormat = 'mm/dd/yyyy';
|
|
@@ -29055,6 +29068,7 @@ class DateFormatService {
|
|
|
29055
29068
|
}
|
|
29056
29069
|
if (month >= 0 && month <= 11 && year > 1900 && day > 0 && day <= 31) {
|
|
29057
29070
|
date = new Date(year, month, day);
|
|
29071
|
+
isInvalidDate = false;
|
|
29058
29072
|
}
|
|
29059
29073
|
}
|
|
29060
29074
|
else if (dateFormatTokens && dateFormatTokens.length === 4 && dateString.length >= 1) {
|
|
@@ -29069,7 +29083,7 @@ class DateFormatService {
|
|
|
29069
29083
|
dateString = `${dateString}${delimiter[1]}`;
|
|
29070
29084
|
}
|
|
29071
29085
|
}
|
|
29072
|
-
return [date, dateString];
|
|
29086
|
+
return [date, dateString, isInvalidDate];
|
|
29073
29087
|
}
|
|
29074
29088
|
parseTimeString(timeString, militaryTime) {
|
|
29075
29089
|
const value = new Date();
|
|
@@ -29179,6 +29193,7 @@ class NovoDatePickerInputElement {
|
|
|
29179
29193
|
this._changeDetectorRef = _changeDetectorRef;
|
|
29180
29194
|
this.dateFormatService = dateFormatService;
|
|
29181
29195
|
this.formattedValue = '';
|
|
29196
|
+
this.invalidDateErrorMessage = '';
|
|
29182
29197
|
/** View -> model callback called when value changes */
|
|
29183
29198
|
this._onChange = () => { };
|
|
29184
29199
|
/** View -> model callback called when autocomplete has been touched */
|
|
@@ -29190,7 +29205,7 @@ class NovoDatePickerInputElement {
|
|
|
29190
29205
|
this.blurEvent = new EventEmitter();
|
|
29191
29206
|
this.focusEvent = new EventEmitter();
|
|
29192
29207
|
this.changeEvent = new EventEmitter();
|
|
29193
|
-
this.placeholder = this.labels.
|
|
29208
|
+
this.placeholder = this.labels.localizedDatePlaceholder();
|
|
29194
29209
|
}
|
|
29195
29210
|
ngOnInit() {
|
|
29196
29211
|
this.userDefinedFormat = this.format ? !this.format.match(/^(DD\/MM\/YYYY|MM\/DD\/YYYY)$/g) : false;
|
|
@@ -29205,6 +29220,7 @@ class NovoDatePickerInputElement {
|
|
|
29205
29220
|
else {
|
|
29206
29221
|
this.maskOptions = { mask: false };
|
|
29207
29222
|
}
|
|
29223
|
+
this.setupInvalidDateErrorMessage();
|
|
29208
29224
|
}
|
|
29209
29225
|
/** BEGIN: Convenient Panel Methods. */
|
|
29210
29226
|
openPanel() {
|
|
@@ -29232,9 +29248,11 @@ class NovoDatePickerInputElement {
|
|
|
29232
29248
|
}
|
|
29233
29249
|
}
|
|
29234
29250
|
_handleBlur(event) {
|
|
29251
|
+
this.handleInvalidDate();
|
|
29235
29252
|
this.blurEvent.emit(event);
|
|
29236
29253
|
}
|
|
29237
29254
|
_handleFocus(event) {
|
|
29255
|
+
this.showInvalidDateError = false;
|
|
29238
29256
|
this.openPanel();
|
|
29239
29257
|
this.focusEvent.emit(event);
|
|
29240
29258
|
}
|
|
@@ -29251,7 +29269,8 @@ class NovoDatePickerInputElement {
|
|
|
29251
29269
|
}
|
|
29252
29270
|
formatDate(value, blur) {
|
|
29253
29271
|
try {
|
|
29254
|
-
const [dateTimeValue, formatted] = this.dateFormatService.parseString(value, false, 'date');
|
|
29272
|
+
const [dateTimeValue, formatted, isInvalidDate] = this.dateFormatService.parseString(value, false, 'date');
|
|
29273
|
+
this.isInvalidDate = isInvalidDate;
|
|
29255
29274
|
if (!isNaN(dateTimeValue.getUTCDate())) {
|
|
29256
29275
|
const dt = new Date(dateTimeValue);
|
|
29257
29276
|
this.dispatchOnChange(dt, blur);
|
|
@@ -29274,6 +29293,24 @@ class NovoDatePickerInputElement {
|
|
|
29274
29293
|
setDisabledState(disabled) {
|
|
29275
29294
|
this.disabled = disabled;
|
|
29276
29295
|
}
|
|
29296
|
+
handleInvalidDate() {
|
|
29297
|
+
if (this.isInvalidDate && this.value) {
|
|
29298
|
+
this.showInvalidDateError = true;
|
|
29299
|
+
this.clearValue();
|
|
29300
|
+
this.closePanel();
|
|
29301
|
+
}
|
|
29302
|
+
}
|
|
29303
|
+
setupInvalidDateErrorMessage() {
|
|
29304
|
+
let dateFormat = this.labels.dateFormatString();
|
|
29305
|
+
if (Helpers.isEmpty(dateFormat)) {
|
|
29306
|
+
// Default to mm/dd/yyyy
|
|
29307
|
+
dateFormat = 'mm/dd/yyyy';
|
|
29308
|
+
}
|
|
29309
|
+
else {
|
|
29310
|
+
dateFormat = dateFormat.toLowerCase();
|
|
29311
|
+
}
|
|
29312
|
+
this.invalidDateErrorMessage = `Invalid date field entered. Date format of ${dateFormat} is required.`;
|
|
29313
|
+
}
|
|
29277
29314
|
dispatchOnChange(newValue, blur = false, skip = false) {
|
|
29278
29315
|
if (newValue !== this.value) {
|
|
29279
29316
|
this._onChange(newValue);
|
|
@@ -29374,6 +29411,7 @@ NovoDatePickerInputElement.decorators = [
|
|
|
29374
29411
|
data-automation-id="date-input"
|
|
29375
29412
|
[disabled]="disabled"
|
|
29376
29413
|
/>
|
|
29414
|
+
<span class="error-text" *ngIf="showInvalidDateError">{{invalidDateErrorMessage}}</span>
|
|
29377
29415
|
<i *ngIf="!hasValue" (click)="openPanel()" class="bhi-calendar"></i>
|
|
29378
29416
|
<i *ngIf="hasValue" (click)="clearValue()" class="bhi-times"></i>
|
|
29379
29417
|
<novo-overlay-template [parent]="element" position="above-below">
|
|
@@ -29898,28 +29936,41 @@ class NovoDataTableCheckboxHeaderCell extends CdkHeaderCell {
|
|
|
29898
29936
|
this.toaster = toaster;
|
|
29899
29937
|
this.role = 'columnheader';
|
|
29900
29938
|
this.maxSelected = undefined;
|
|
29939
|
+
this.canSelectAll = false;
|
|
29901
29940
|
this.checked = false;
|
|
29902
29941
|
renderer.setAttribute(elementRef.nativeElement, 'data-automation-id', `novo-checkbox-column-header-${columnDef.cssClassFriendlyName}`);
|
|
29903
29942
|
renderer.addClass(elementRef.nativeElement, `novo-checkbox-column-${columnDef.cssClassFriendlyName}`);
|
|
29904
29943
|
renderer.addClass(elementRef.nativeElement, 'novo-data-table-checkbox-header-cell');
|
|
29905
29944
|
this.selectionSubscription = this.dataTable.state.selectionSource.subscribe(() => {
|
|
29906
29945
|
this.checked = this.dataTable.allCurrentRowsSelected();
|
|
29946
|
+
if (this.canSelectAll) {
|
|
29947
|
+
this.selectAllChanged();
|
|
29948
|
+
}
|
|
29907
29949
|
this.ref.markForCheck();
|
|
29908
29950
|
});
|
|
29909
29951
|
this.paginationSubscription = this.dataTable.state.paginationSource.subscribe((event) => {
|
|
29910
29952
|
if (event.isPageSizeChange) {
|
|
29911
29953
|
this.checked = false;
|
|
29954
|
+
if (this.canSelectAll) {
|
|
29955
|
+
this.selectAllChanged();
|
|
29956
|
+
}
|
|
29912
29957
|
this.dataTable.selectRows(false);
|
|
29913
29958
|
this.dataTable.state.checkRetainment('pageSize');
|
|
29914
29959
|
this.dataTable.state.reset(false, true);
|
|
29915
29960
|
}
|
|
29916
29961
|
else {
|
|
29917
29962
|
this.checked = this.dataTable.allCurrentRowsSelected();
|
|
29963
|
+
if (this.canSelectAll) {
|
|
29964
|
+
this.selectAllChanged();
|
|
29965
|
+
}
|
|
29918
29966
|
}
|
|
29919
29967
|
this.ref.markForCheck();
|
|
29920
29968
|
});
|
|
29921
29969
|
this.resetSubscription = this.dataTable.state.resetSource.subscribe(() => {
|
|
29922
29970
|
this.checked = false;
|
|
29971
|
+
if (this.canSelectAll) {
|
|
29972
|
+
this.selectAllChanged();
|
|
29973
|
+
}
|
|
29923
29974
|
this.ref.markForCheck();
|
|
29924
29975
|
});
|
|
29925
29976
|
}
|
|
@@ -29949,6 +30000,17 @@ class NovoDataTableCheckboxHeaderCell extends CdkHeaderCell {
|
|
|
29949
30000
|
else {
|
|
29950
30001
|
this.dataTable.selectRows(!this.checked);
|
|
29951
30002
|
}
|
|
30003
|
+
if (this.canSelectAll) {
|
|
30004
|
+
this.selectAllChanged();
|
|
30005
|
+
}
|
|
30006
|
+
}
|
|
30007
|
+
selectAllChanged() {
|
|
30008
|
+
var _a, _b, _c;
|
|
30009
|
+
const allSelectedEvent = {
|
|
30010
|
+
allSelected: this.checked,
|
|
30011
|
+
selectedCount: (_c = (_b = (_a = this.dataTable) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.selected) === null || _c === void 0 ? void 0 : _c.length,
|
|
30012
|
+
};
|
|
30013
|
+
this.dataTable.allSelected.emit(allSelectedEvent);
|
|
29952
30014
|
}
|
|
29953
30015
|
}
|
|
29954
30016
|
NovoDataTableCheckboxHeaderCell.decorators = [
|
|
@@ -29976,7 +30038,8 @@ NovoDataTableCheckboxHeaderCell.ctorParameters = () => [
|
|
|
29976
30038
|
];
|
|
29977
30039
|
NovoDataTableCheckboxHeaderCell.propDecorators = {
|
|
29978
30040
|
role: [{ type: HostBinding, args: ['attr.role',] }],
|
|
29979
|
-
maxSelected: [{ type: Input }]
|
|
30041
|
+
maxSelected: [{ type: Input }],
|
|
30042
|
+
canSelectAll: [{ type: Input }]
|
|
29980
30043
|
};
|
|
29981
30044
|
|
|
29982
30045
|
class NovoDataTableHeaderCell extends CdkHeaderCell {
|