novo-elements 5.9.0 → 5.12.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.
Files changed (30) hide show
  1. package/bundles/novo-elements.umd.js +73 -34
  2. package/bundles/novo-elements.umd.js.map +1 -1
  3. package/bundles/novo-elements.umd.min.js +1 -1
  4. package/bundles/novo-elements.umd.min.js.map +1 -1
  5. package/elements/data-table/cell-headers/data-table-checkbox-header-cell.component.d.ts +2 -0
  6. package/elements/data-table/data-table.component.d.ts +5 -0
  7. package/elements/data-table/data-table.component.scss +2 -1
  8. package/elements/date-picker/DatePicker.d.ts +1 -0
  9. package/elements/date-picker/DatePickerInput.d.ts +1 -0
  10. package/elements/date-time-picker/DateTimePicker.d.ts +1 -0
  11. package/elements/date-time-picker/DateTimePickerInput.d.ts +1 -0
  12. package/elements/form/Form.scss +2 -1
  13. package/elements/form/NovoFormControl.d.ts +1 -0
  14. package/elements/form/controls/BaseControl.d.ts +1 -0
  15. package/esm2015/elements/data-table/cell-headers/data-table-checkbox-header-cell.component.js +27 -2
  16. package/esm2015/elements/data-table/data-table.component.js +10 -2
  17. package/esm2015/elements/date-picker/DatePicker.js +3 -2
  18. package/esm2015/elements/date-picker/DatePickerInput.js +3 -1
  19. package/esm2015/elements/date-time-picker/DateTimePicker.js +3 -1
  20. package/esm2015/elements/date-time-picker/DateTimePickerInput.js +3 -1
  21. package/esm2015/elements/form/ControlTemplates.js +2 -2
  22. package/esm2015/elements/form/NovoFormControl.js +2 -1
  23. package/esm2015/elements/form/controls/BaseControl.js +2 -1
  24. package/esm2015/elements/form/extras/address/Address.js +5 -1
  25. package/esm2015/utils/form-utils/FormUtils.js +17 -17
  26. package/fesm2015/novo-elements.js +66 -20
  27. package/fesm2015/novo-elements.js.map +1 -1
  28. package/novo-elements.metadata.json +1 -1
  29. package/package.json +1 -1
  30. package/utils/form-utils/FormUtils.d.ts +3 -3
@@ -8327,8 +8327,10 @@ class NovoDataTable {
8327
8327
  this.templates = {};
8328
8328
  this.fixedHeader = false;
8329
8329
  this.maxSelected = undefined;
8330
+ this.canSelectAll = false;
8330
8331
  this._hideGlobalSearch = true;
8331
8332
  this.preferencesChanged = new EventEmitter();
8333
+ this.allSelected = new EventEmitter();
8332
8334
  this.loading = true;
8333
8335
  this.columnToTemplate = {};
8334
8336
  this.columnsLoaded = false;
@@ -8614,6 +8616,10 @@ class NovoDataTable {
8614
8616
  this.state.onSelectionChange();
8615
8617
  }
8616
8618
  allCurrentRowsSelected() {
8619
+ var _a, _b;
8620
+ if (!((_b = (_a = this.dataSource) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.length)) {
8621
+ return false;
8622
+ }
8617
8623
  for (let i = 0; i < (this.dataSource.data || []).length; i++) {
8618
8624
  if (!this.isSelected((this.dataSource.data || [])[i])) {
8619
8625
  return false;
@@ -8773,7 +8779,7 @@ NovoDataTable.decorators = [
8773
8779
  [hidden]="dataSource?.totallyEmpty && !state.userFiltered"
8774
8780
  >
8775
8781
  <ng-container cdkColumnDef="selection">
8776
- <novo-data-table-checkbox-header-cell *cdkHeaderCellDef [maxSelected]="maxSelected"></novo-data-table-checkbox-header-cell>
8782
+ <novo-data-table-checkbox-header-cell *cdkHeaderCellDef [maxSelected]="maxSelected" [canSelectAll]="canSelectAll"></novo-data-table-checkbox-header-cell>
8777
8783
  <novo-data-table-checkbox-cell *cdkCellDef="let row; let i = index" [row]="row" [maxSelected]="maxSelected"></novo-data-table-checkbox-cell>
8778
8784
  </ng-container>
8779
8785
  <ng-container cdkColumnDef="expand">
@@ -8956,6 +8962,7 @@ NovoDataTable.propDecorators = {
8956
8962
  fixedHeader: [{ type: Input }],
8957
8963
  paginatorDataFeatureId: [{ type: Input }],
8958
8964
  maxSelected: [{ type: Input }],
8965
+ canSelectAll: [{ type: Input }],
8959
8966
  dataTableService: [{ type: Input }],
8960
8967
  rows: [{ type: Input }],
8961
8968
  outsideFilter: [{ type: Input }],
@@ -8966,6 +8973,7 @@ NovoDataTable.propDecorators = {
8966
8973
  forceShowHeader: [{ type: Input }],
8967
8974
  hideGlobalSearch: [{ type: Input }],
8968
8975
  preferencesChanged: [{ type: Output }],
8976
+ allSelected: [{ type: Output }],
8969
8977
  empty: [{ type: HostBinding, args: ['class.empty',] }],
8970
8978
  loadingClass: [{ type: HostBinding, args: ['class.loading',] }],
8971
8979
  listInteractions: [{ type: Input }]
@@ -27446,6 +27454,7 @@ NovoAddressElement.decorators = [
27446
27454
  (focus)="isFocused($event, 'address1')"
27447
27455
  (blur)="isBlurred($event, 'address1')"
27448
27456
  (input)="onInput($event, 'address1')"
27457
+ [disabled]="disabled.address1"
27449
27458
  />
27450
27459
  </span>
27451
27460
  <span
@@ -27474,6 +27483,7 @@ NovoAddressElement.decorators = [
27474
27483
  (focus)="isFocused($event, 'address2')"
27475
27484
  (blur)="isBlurred($event, 'address2')"
27476
27485
  (input)="onInput($event, 'address2')"
27486
+ [disabled]="disabled.address2"
27477
27487
  />
27478
27488
  </span>
27479
27489
  <span
@@ -27497,6 +27507,7 @@ NovoAddressElement.decorators = [
27497
27507
  (focus)="isFocused($event, 'city')"
27498
27508
  (blur)="isBlurred($event, 'city')"
27499
27509
  (input)="onInput($event, 'city')"
27510
+ [disabled]="disabled.city"
27500
27511
  />
27501
27512
  </span>
27502
27513
  <span
@@ -27538,6 +27549,7 @@ NovoAddressElement.decorators = [
27538
27549
  (focus)="isFocused($event, 'zip')"
27539
27550
  (blur)="isBlurred($event, 'zip')"
27540
27551
  (input)="onInput($event, 'zip')"
27552
+ [disabled]="disabled.zip"
27541
27553
  />
27542
27554
  </span>
27543
27555
  <span
@@ -28937,7 +28949,7 @@ NovoDatePickerElement.decorators = [
28937
28949
  endfill: isEndFill(range, day.date, selected, selected2),
28938
28950
  'selecting-range': isSelectingRange(range, day.date, selected, selected2, hoverDay, rangeSelectMode, weekRangeSelect)
28939
28951
  }" (mouseover)="rangeHover($event, day)" [attr.data-automation-id]="day.number">
28940
- <button class="day" [attr.data-automation-id]="day.number" [disabled]="isDisabled(day.date, start, end)" (click)="select($event, day, true)">{{day.number}}</button>
28952
+ <button [title]="isDisabled(day.date, start, end) ? disabledDateMessage : ''" class="day" [attr.data-automation-id]="day.number" [disabled]="isDisabled(day.date, start, end)" (click)="select($event, day, true)">{{day.number}}</button>
28941
28953
  </td>
28942
28954
  </tr>
28943
28955
  </tbody>
@@ -28972,6 +28984,7 @@ NovoDatePickerElement.propDecorators = {
28972
28984
  range: [{ type: Input }],
28973
28985
  weekRangeSelect: [{ type: Input }],
28974
28986
  weekStart: [{ type: Input }],
28987
+ disabledDateMessage: [{ type: Input }],
28975
28988
  onSelect: [{ type: Output }]
28976
28989
  };
28977
28990
 
@@ -29377,6 +29390,7 @@ NovoDatePickerInputElement.decorators = [
29377
29390
  [end]="end"
29378
29391
  inline="true"
29379
29392
  (onSelect)="setValueAndClose($event)"
29393
+ [disabledDateMessage]="disabledDateMessage"
29380
29394
  [ngModel]="value"
29381
29395
  [weekStart]="weekStart"
29382
29396
  ></novo-date-picker>
@@ -29399,6 +29413,7 @@ NovoDatePickerInputElement.propDecorators = {
29399
29413
  format: [{ type: Input }],
29400
29414
  textMaskEnabled: [{ type: Input }],
29401
29415
  allowInvalidDate: [{ type: Input }],
29416
+ disabledDateMessage: [{ type: Input }],
29402
29417
  disabled: [{ type: HostBinding, args: ['class.disabled',] }, { type: Input }],
29403
29418
  weekStart: [{ type: Input }],
29404
29419
  blurEvent: [{ type: Output }],
@@ -29891,28 +29906,41 @@ class NovoDataTableCheckboxHeaderCell extends CdkHeaderCell {
29891
29906
  this.toaster = toaster;
29892
29907
  this.role = 'columnheader';
29893
29908
  this.maxSelected = undefined;
29909
+ this.canSelectAll = false;
29894
29910
  this.checked = false;
29895
29911
  renderer.setAttribute(elementRef.nativeElement, 'data-automation-id', `novo-checkbox-column-header-${columnDef.cssClassFriendlyName}`);
29896
29912
  renderer.addClass(elementRef.nativeElement, `novo-checkbox-column-${columnDef.cssClassFriendlyName}`);
29897
29913
  renderer.addClass(elementRef.nativeElement, 'novo-data-table-checkbox-header-cell');
29898
29914
  this.selectionSubscription = this.dataTable.state.selectionSource.subscribe(() => {
29899
29915
  this.checked = this.dataTable.allCurrentRowsSelected();
29916
+ if (this.canSelectAll) {
29917
+ this.selectAllChanged();
29918
+ }
29900
29919
  this.ref.markForCheck();
29901
29920
  });
29902
29921
  this.paginationSubscription = this.dataTable.state.paginationSource.subscribe((event) => {
29903
29922
  if (event.isPageSizeChange) {
29904
29923
  this.checked = false;
29924
+ if (this.canSelectAll) {
29925
+ this.selectAllChanged();
29926
+ }
29905
29927
  this.dataTable.selectRows(false);
29906
29928
  this.dataTable.state.checkRetainment('pageSize');
29907
29929
  this.dataTable.state.reset(false, true);
29908
29930
  }
29909
29931
  else {
29910
29932
  this.checked = this.dataTable.allCurrentRowsSelected();
29933
+ if (this.canSelectAll) {
29934
+ this.selectAllChanged();
29935
+ }
29911
29936
  }
29912
29937
  this.ref.markForCheck();
29913
29938
  });
29914
29939
  this.resetSubscription = this.dataTable.state.resetSource.subscribe(() => {
29915
29940
  this.checked = false;
29941
+ if (this.canSelectAll) {
29942
+ this.selectAllChanged();
29943
+ }
29916
29944
  this.ref.markForCheck();
29917
29945
  });
29918
29946
  }
@@ -29942,6 +29970,17 @@ class NovoDataTableCheckboxHeaderCell extends CdkHeaderCell {
29942
29970
  else {
29943
29971
  this.dataTable.selectRows(!this.checked);
29944
29972
  }
29973
+ if (this.canSelectAll) {
29974
+ this.selectAllChanged();
29975
+ }
29976
+ }
29977
+ selectAllChanged() {
29978
+ var _a, _b, _c;
29979
+ const allSelectedEvent = {
29980
+ allSelected: this.checked,
29981
+ 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,
29982
+ };
29983
+ this.dataTable.allSelected.emit(allSelectedEvent);
29945
29984
  }
29946
29985
  }
29947
29986
  NovoDataTableCheckboxHeaderCell.decorators = [
@@ -29969,7 +30008,8 @@ NovoDataTableCheckboxHeaderCell.ctorParameters = () => [
29969
30008
  ];
29970
30009
  NovoDataTableCheckboxHeaderCell.propDecorators = {
29971
30010
  role: [{ type: HostBinding, args: ['attr.role',] }],
29972
- maxSelected: [{ type: Input }]
30011
+ maxSelected: [{ type: Input }],
30012
+ canSelectAll: [{ type: Input }]
29973
30013
  };
29974
30014
 
29975
30015
  class NovoDataTableHeaderCell extends CdkHeaderCell {
@@ -30676,6 +30716,7 @@ NovoDateTimePickerElement.decorators = [
30676
30716
  [maxYear]="maxYear"
30677
30717
  [start]="start"
30678
30718
  [end]="end"
30719
+ [disabledDateMessage]="disabledDateMessage"
30679
30720
  [weekStart]="weekStart"
30680
30721
  ></novo-date-picker>
30681
30722
  </div>
@@ -30698,6 +30739,7 @@ NovoDateTimePickerElement.propDecorators = {
30698
30739
  end: [{ type: Input }],
30699
30740
  military: [{ type: Input }],
30700
30741
  weekStart: [{ type: Input }],
30742
+ disabledDateMessage: [{ type: Input }],
30701
30743
  onSelect: [{ type: Output }]
30702
30744
  };
30703
30745
 
@@ -30809,6 +30851,7 @@ NovoDateTimePickerInputElement.decorators = [
30809
30851
  (ngModelChange)="updateDate($event)"
30810
30852
  [start]="start"
30811
30853
  [end]="end"
30854
+ [disabledDateMessage]="disabledDateMessage"
30812
30855
  [maskOptions]="maskOptions"
30813
30856
  (blurEvent)="handleBlur($event)"
30814
30857
  (focusEvent)="handleFocus($event)"
@@ -30841,6 +30884,7 @@ NovoDateTimePickerInputElement.propDecorators = {
30841
30884
  disabled: [{ type: Input }],
30842
30885
  format: [{ type: Input }],
30843
30886
  weekStart: [{ type: Input }],
30887
+ disabledDateMessage: [{ type: Input }],
30844
30888
  blurEvent: [{ type: Output }],
30845
30889
  focusEvent: [{ type: Output }],
30846
30890
  changeEvent: [{ type: Output }]
@@ -31733,6 +31777,7 @@ class BaseControl extends ControlConfig {
31733
31777
  this.isEmpty = config.isEmpty;
31734
31778
  }
31735
31779
  this.weekStart = config.weekStart || 0;
31780
+ this.disabledDateMessage = config.disabledDateMessage;
31736
31781
  }
31737
31782
  }
31738
31783
 
@@ -32179,6 +32224,7 @@ class NovoFormControl extends FormControl {
32179
32224
  this.tipWell = control.tipWell;
32180
32225
  this.customControlConfig = control.customControlConfig;
32181
32226
  this.warning = control.warning;
32227
+ this.disabledDateMessage = control.disabledDateMessage;
32182
32228
  // Reactive Form, need to enable/disable, can't bind to [disabled]
32183
32229
  if (this.readOnly) {
32184
32230
  this.disable();
@@ -32554,7 +32600,7 @@ class FormUtils {
32554
32600
  closeOnSelect: field.closeOnSelect,
32555
32601
  layoutOptions: field.layoutOptions,
32556
32602
  };
32557
- this.inferStartDate(controlConfig, field);
32603
+ this.inferDateRange(controlConfig, field);
32558
32604
  // TODO: getControlOptions should always return the correct format
32559
32605
  const optionsConfig = this.getControlOptions(field, http, config, fieldData);
32560
32606
  if (Array.isArray(optionsConfig) && !(type === 'chips' || type === 'picker')) {
@@ -33065,23 +33111,23 @@ class FormUtils {
33065
33111
  return addDays(startOfToday(), dateRange.minOffset);
33066
33112
  }
33067
33113
  }
33068
- /**
33069
- * Get the min start date of a Date base on field data.
33070
- */
33071
- getStartDate(field) {
33072
- if (field.allowedDateRange) {
33073
- return this.getStartDateFromRange(field.allowedDateRange);
33114
+ getEndDateFromRange(dateRange) {
33115
+ if (dateRange.maxDate) {
33116
+ return parse(dateRange.maxDate);
33117
+ }
33118
+ else if (dateRange.minOffset) {
33119
+ return addDays(startOfToday(), dateRange.minOffset);
33074
33120
  }
33075
- // there is no restriction on the start date
33076
- return null;
33077
33121
  }
33078
- inferStartDate(controlConfig, field) {
33079
- if (field.dataType === 'Date') {
33080
- const startDate = this.getStartDate(field);
33081
- if (startDate) {
33082
- controlConfig.startDate = startDate;
33083
- }
33084
- return startDate;
33122
+ /**
33123
+ * Get the min start date and max end date of a Date base on field data.
33124
+ */
33125
+ inferDateRange(controlConfig, field) {
33126
+ var _a;
33127
+ if (field.dataType === 'Date' && field.allowedDateRange) {
33128
+ controlConfig.startDate = this.getStartDateFromRange(field.allowedDateRange);
33129
+ controlConfig.endDate = this.getEndDateFromRange(field.allowedDateRange);
33130
+ controlConfig.disabledDateMessage = (_a = field.allowedDateRange) === null || _a === void 0 ? void 0 : _a.disabledDateMessage;
33085
33131
  }
33086
33132
  }
33087
33133
  inflateEmbeddedProperties(data) {
@@ -35049,7 +35095,7 @@ NovoControlTemplates.decorators = [
35049
35095
  <!--Date-->
35050
35096
  <ng-template novoTemplate="date" let-control let-form="form" let-errors="errors" let-methods="methods">
35051
35097
  <div [formGroup]="form" class="novo-control-input-container" [tooltip]="control.tooltip" [tooltipPosition]="control.tooltipPosition" [tooltipSize]="control?.tooltipSize" [tooltipPreline]="control?.tooltipPreline" [removeTooltipArrow]="control?.removeTooltipArrow" [tooltipAutoPosition]="control?.tooltipAutoPosition">
35052
- <novo-date-picker-input [attr.id]="control.key" [name]="control.key" [formControlName]="control.key" [start]="control.startDate" [end]="control.endDate" [format]="control.dateFormat" [allowInvalidDate]="control.allowInvalidDate" [textMaskEnabled]="control.textMaskEnabled" [placeholder]="control.placeholder" [weekStart]="control.weekStart" (focusEvent)="methods.handleFocus($event)" (blurEvent)="methods.handleBlur($event)" (changeEvent)="methods.emitChange($event)"></novo-date-picker-input>
35098
+ <novo-date-picker-input [attr.id]="control.key" [name]="control.key" [formControlName]="control.key" [start]="control.startDate" [end]="control.endDate" [disabledDateMessage]="control.disabledDateMessage" [format]="control.dateFormat" [allowInvalidDate]="control.allowInvalidDate" [textMaskEnabled]="control.textMaskEnabled" [placeholder]="control.placeholder" [weekStart]="control.weekStart" (focusEvent)="methods.handleFocus($event)" (blurEvent)="methods.handleBlur($event)" (changeEvent)="methods.emitChange($event)"></novo-date-picker-input>
35053
35099
  </div>
35054
35100
  </ng-template>
35055
35101