@colijnit/corecomponents_v12 12.1.8 → 12.2.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.
@@ -6700,12 +6700,18 @@ class InputDateRangePickerComponent extends BaseInputDatePickerDirective {
6700
6700
  const day = this.model[0].toLocaleString("default", { day: "2-digit" });
6701
6701
  this.firstDateAsString = `${year}-${month}-${day}`;
6702
6702
  }
6703
+ else {
6704
+ this.firstDateAsString = ``;
6705
+ }
6703
6706
  if (this.model[1]) {
6704
6707
  const year = this.model[1].toLocaleString("default", { year: "numeric" });
6705
6708
  const month = this.model[1].toLocaleString("default", { month: "2-digit" });
6706
6709
  const day = this.model[1].toLocaleString("default", { day: "2-digit" });
6707
6710
  this.secondDateAsString = `${year}-${month}-${day}`;
6708
6711
  }
6712
+ else {
6713
+ this.secondDateAsString = ``;
6714
+ }
6709
6715
  }
6710
6716
  }
6711
6717
  InputDateRangePickerComponent.decorators = [
@@ -10991,7 +10997,6 @@ class FilterItemComponent {
10991
10997
  this._changeDetector = _changeDetector;
10992
10998
  this.icons = CoreComponentsIcon;
10993
10999
  this.modes = FilterItemMode;
10994
- this.mode = this.modes.Filterlist;
10995
11000
  this.initialLimit = 10;
10996
11001
  this.expanded = false;
10997
11002
  // Set to false to use filter item with a multi selectable collection. Set to true to specify custom content
@@ -11013,6 +11018,14 @@ class FilterItemComponent {
11013
11018
  this.filterText = "";
11014
11019
  this.showButton = false;
11015
11020
  this._collection = [];
11021
+ this._mode = this.modes.Filterlist;
11022
+ }
11023
+ set mode(value) {
11024
+ this._mode = value;
11025
+ this.readModelForMode(this._model);
11026
+ }
11027
+ get mode() {
11028
+ return this._mode;
11016
11029
  }
11017
11030
  set collection(value) {
11018
11031
  var _a;
@@ -11024,37 +11037,8 @@ class FilterItemComponent {
11024
11037
  get collection() {
11025
11038
  return this._collection;
11026
11039
  }
11027
- set model(filterString) {
11028
- switch (this.mode) {
11029
- case this.modes.Filterlist:
11030
- this._readModelForFilterList(filterString);
11031
- break;
11032
- case this.modes.SingleSelectList:
11033
- this._readModelForSingleSelectList(filterString);
11034
- break;
11035
- case this.modes.SelectListWithStringCollectionOutput:
11036
- this._readModelForStringCollectionList(filterString);
11037
- break;
11038
- case this.modes.SelectListWithNumberOutput:
11039
- this._readModelForSelectListWithNumberOutput(filterString);
11040
- break;
11041
- case this.modes.Slider:
11042
- this._readModelForSliderMode(filterString);
11043
- break;
11044
- case this.modes.CheckboxToText:
11045
- case this.modes.CheckboxToSimpleText:
11046
- this._readModelForCheckboxToText(filterString);
11047
- break;
11048
- case this.modes.CheckboxToBinary:
11049
- this._readModelForCheckboxToBinary(filterString);
11050
- break;
11051
- case this.modes.DateField:
11052
- this._readModelForDateField(filterString);
11053
- break;
11054
- case this.modes.DateRangeField:
11055
- this._readModelForDateRangeField(filterString);
11056
- break;
11057
- }
11040
+ set model(newModel) {
11041
+ this.readModelForMode(newModel);
11058
11042
  }
11059
11043
  get model() {
11060
11044
  return this._model;
@@ -11062,7 +11046,9 @@ class FilterItemComponent {
11062
11046
  ngOnInit() {
11063
11047
  this.setToInitialLimit();
11064
11048
  this.showButton = this.valueSelected();
11065
- this.checkBoxToTextModel = false;
11049
+ if (this.checkBoxToTextModel === undefined || this.checkBoxToTextModel === null) {
11050
+ this.checkBoxToTextModel = false;
11051
+ }
11066
11052
  }
11067
11053
  setToInitialLimit() {
11068
11054
  this.limitTo = this.initialLimit;
@@ -11108,34 +11094,33 @@ class FilterItemComponent {
11108
11094
  this._createModelForSelectListWithNumberOutput();
11109
11095
  break;
11110
11096
  case this.modes.Slider:
11097
+ this.showButton = true;
11111
11098
  this._createModelForSliderMode();
11112
11099
  break;
11113
11100
  case this.modes.CheckboxToText:
11101
+ this.showButton = true;
11114
11102
  this._createModelForCheckboxToText();
11115
11103
  break;
11116
11104
  case this.modes.CheckboxToSimpleText:
11105
+ this.showButton = true;
11117
11106
  this._createModelForCheckboxToSimpleText();
11118
11107
  break;
11119
11108
  case this.modes.CheckboxToBinary:
11109
+ this.showButton = true;
11120
11110
  this._createModelForCheckboxToBinary();
11121
11111
  break;
11122
11112
  case this.modes.DateRangeField:
11113
+ this.showButton = true;
11123
11114
  this._createModelForDateRange(model);
11124
11115
  break;
11125
11116
  case this.modes.TextField:
11117
+ this.showButton = true;
11126
11118
  this._model = (typeof this._model === 'string' && this._model.length === 0) ? undefined : this._model;
11127
11119
  break;
11128
11120
  }
11129
11121
  this.modelChange.emit(this._model);
11130
11122
  this.collectionChange.emit(this.collection);
11131
11123
  }
11132
- uncheckForSingleSelect(model) {
11133
- this.collection.forEach(m => {
11134
- if (m.code !== model.code && m.description !== model.description) {
11135
- m.checked = false;
11136
- }
11137
- });
11138
- }
11139
11124
  valueSelected() {
11140
11125
  if (this.collection) {
11141
11126
  return !!this.collection.find(c => c.checked);
@@ -11177,6 +11162,47 @@ class FilterItemComponent {
11177
11162
  onButtonClicked() {
11178
11163
  this.filterButtonClicked.emit();
11179
11164
  }
11165
+ uncheckForSingleSelect(model) {
11166
+ this.collection.forEach(m => {
11167
+ if (m.code !== model.code && m.description !== model.description) {
11168
+ m.checked = false;
11169
+ }
11170
+ });
11171
+ }
11172
+ readModelForMode(newModel) {
11173
+ switch (this.mode) {
11174
+ case this.modes.Filterlist:
11175
+ this._readModelForFilterList(newModel);
11176
+ break;
11177
+ case this.modes.SingleSelectList:
11178
+ this._readModelForSingleSelectList(newModel);
11179
+ break;
11180
+ case this.modes.SelectListWithStringCollectionOutput:
11181
+ this._readModelForStringCollectionList(newModel);
11182
+ break;
11183
+ case this.modes.SelectListWithNumberOutput:
11184
+ this._readModelForSelectListWithNumberOutput(newModel);
11185
+ break;
11186
+ case this.modes.Slider:
11187
+ this._readModelForSliderMode(newModel);
11188
+ break;
11189
+ case this.modes.CheckboxToText:
11190
+ case this.modes.CheckboxToSimpleText:
11191
+ this._readModelForCheckboxToText(newModel);
11192
+ break;
11193
+ case this.modes.CheckboxToBinary:
11194
+ this._readModelForCheckboxToBinary(newModel);
11195
+ break;
11196
+ case this.modes.DateField:
11197
+ this._readModelForDateField(newModel);
11198
+ break;
11199
+ case this.modes.DateRangeField:
11200
+ this._readModelForDateRangeField(newModel);
11201
+ break;
11202
+ default:
11203
+ this._model = newModel;
11204
+ }
11205
+ }
11180
11206
  /////////////////////////////////////////////////////////////
11181
11207
  //Model creation for all of the different options available//
11182
11208
  /////////////////////////////////////////////////////////////
@@ -11300,9 +11326,6 @@ class FilterItemComponent {
11300
11326
  if (filter !== null && filter !== undefined) {
11301
11327
  filter.checked = true;
11302
11328
  }
11303
- else {
11304
- filter.checked = false;
11305
- }
11306
11329
  }
11307
11330
  this._model = filterModel;
11308
11331
  }
@@ -11312,7 +11335,7 @@ class FilterItemComponent {
11312
11335
  this._model = singleSelectModel;
11313
11336
  if (singleSelectModel !== null && singleSelectModel !== undefined && this.collection !== null && this.collection !== undefined) {
11314
11337
  let filter = this.collection.find(element => element.code.toString() === singleSelectModel);
11315
- if (filter) {
11338
+ if (filter !== null && filter !== undefined) {
11316
11339
  filter.checked = true;
11317
11340
  }
11318
11341
  }
@@ -11384,6 +11407,9 @@ class FilterItemComponent {
11384
11407
  if (dateFieldModel !== undefined && dateFieldModel !== null) {
11385
11408
  this._model = new Date(dateFieldModel);
11386
11409
  }
11410
+ else {
11411
+ this._model = undefined;
11412
+ }
11387
11413
  }
11388
11414
  _readModelForDateRangeField(dateRangeFieldModel) {
11389
11415
  this._model = dateRangeFieldModel;
@@ -11396,6 +11422,10 @@ class FilterItemComponent {
11396
11422
  this.dateRangeStart = new Date(parseInt(startDateComponents[2]), parseInt(startDateComponents[1]) - 1, parseInt(startDateComponents[0]));
11397
11423
  this.dateRangeEnd = new Date(parseInt(endDateComponents[2]), parseInt(endDateComponents[1]) - 1, parseInt(endDateComponents[0]));
11398
11424
  }
11425
+ else {
11426
+ this.dateRangeStart = undefined;
11427
+ this.dateRangeEnd = undefined;
11428
+ }
11399
11429
  }
11400
11430
  }
11401
11431
  FilterItemComponent.decorators = [