@colijnit/corecomponents_v12 12.1.7 → 12.1.8
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/colijnit-corecomponents_v12.umd.js +231 -177
- package/bundles/colijnit-corecomponents_v12.umd.js.map +1 -1
- package/colijnit-corecomponents_v12.metadata.json +1 -1
- package/esm2015/lib/components/filter-item/filter-item.component.js +187 -162
- package/esm2015/lib/core/enum/filterItem-mode.enum.js +13 -3
- package/esm2015/lib/directives/overlay/overlay.directive.js +26 -7
- package/fesm2015/colijnit-corecomponents_v12.js +222 -168
- package/fesm2015/colijnit-corecomponents_v12.js.map +1 -1
- package/lib/components/filter-item/filter-item.component.d.ts +24 -23
- package/lib/core/enum/filterItem-mode.enum.d.ts +1 -1
- package/lib/directives/overlay/overlay.directive.d.ts +5 -0
- package/package.json +1 -1
- package/colijnit-corecomponents_v12-12.1.4.tgz +0 -0
|
@@ -5131,10 +5131,20 @@ IconCollapseHandleModule.decorators = [
|
|
|
5131
5131
|
|
|
5132
5132
|
var FilterItemMode;
|
|
5133
5133
|
(function (FilterItemMode) {
|
|
5134
|
-
|
|
5134
|
+
//This mode makes the Filter display a multi select list
|
|
5135
|
+
// Input will be passed along directly as a string with the following syntax: "?>='choice 1', ?<='choice2'"
|
|
5136
|
+
FilterItemMode["Filterlist"] = "filterlist";
|
|
5137
|
+
//This mode makes the Filter display a single select list
|
|
5138
|
+
// Input will be passed along directly as a simple string.
|
|
5135
5139
|
FilterItemMode["SingleSelectList"] = "singleSelectList";
|
|
5140
|
+
//This mode makes the Filter display a multi select list
|
|
5141
|
+
// Input will be passed along directly as a simple string.
|
|
5136
5142
|
FilterItemMode["SelectListWithStringCollectionOutput"] = "selectListWithStringCollectionOutput";
|
|
5143
|
+
//This mode makes the Filter display a multi select list
|
|
5144
|
+
// Available choices will need to have their identifying value be a number. The summation of all these numbers will be passed along.
|
|
5137
5145
|
FilterItemMode["SelectListWithNumberOutput"] = "selectListWithNumberOutput";
|
|
5146
|
+
//This mode makes the Filter display a min and max field. This should eventually be a slider.
|
|
5147
|
+
// input is passed along as "min - max"
|
|
5138
5148
|
FilterItemMode["Slider"] = "slider";
|
|
5139
5149
|
//This mode makes the Filter display a simple textfield.
|
|
5140
5150
|
// The value typed into the field will be passed along directly as a string.
|
|
@@ -5155,7 +5165,7 @@ var FilterItemMode;
|
|
|
5155
5165
|
// It's value will be passed along as either a "?='T'" or and "?='F'".
|
|
5156
5166
|
FilterItemMode["CheckboxToText"] = "checkboxToText";
|
|
5157
5167
|
//This mode makes the Filter display a simple checkBox.
|
|
5158
|
-
// It's value will be passed along as either a
|
|
5168
|
+
// It's value will be passed along as either a 1 or and 0.
|
|
5159
5169
|
FilterItemMode["CheckboxToBinary"] = "checkboxToBinary";
|
|
5160
5170
|
})(FilterItemMode || (FilterItemMode = {}));
|
|
5161
5171
|
|
|
@@ -5409,6 +5419,11 @@ InputDatePickerComponent.propDecorators = {
|
|
|
5409
5419
|
|
|
5410
5420
|
class OverlayDirective {
|
|
5411
5421
|
constructor(elementRef) {
|
|
5422
|
+
/**
|
|
5423
|
+
* true; Element is added to the parent template
|
|
5424
|
+
* false; Element is added to the bottom of the DOM
|
|
5425
|
+
*/
|
|
5426
|
+
this.inline = false;
|
|
5412
5427
|
this.keepInView = false;
|
|
5413
5428
|
this.inheritWidth = false;
|
|
5414
5429
|
this.rightAlign = false;
|
|
@@ -5469,12 +5484,25 @@ class OverlayDirective {
|
|
|
5469
5484
|
if (this._elementRef && this._elementRef.nativeElement && this._parent && this._parent.nativeElement) {
|
|
5470
5485
|
const elementRect = this._elementRef.nativeElement.getBoundingClientRect();
|
|
5471
5486
|
const parentBoundingRect = this._parent.nativeElement.getBoundingClientRect();
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5487
|
+
let parentRect = {};
|
|
5488
|
+
if (!this.inline) {
|
|
5489
|
+
parentRect = {
|
|
5490
|
+
bottom: parentBoundingRect.bottom,
|
|
5491
|
+
right: parentBoundingRect.right,
|
|
5492
|
+
left: parentBoundingRect.left,
|
|
5493
|
+
top: parentBoundingRect.top,
|
|
5494
|
+
width: parentBoundingRect.width
|
|
5495
|
+
};
|
|
5496
|
+
}
|
|
5497
|
+
else {
|
|
5498
|
+
parentRect = {
|
|
5499
|
+
bottom: this._parent.nativeElement.offsetTop + parentBoundingRect.height,
|
|
5500
|
+
right: this._parent.nativeElement.offsetLeft + parentBoundingRect.width,
|
|
5501
|
+
left: this._parent.nativeElement.offsetLeft,
|
|
5502
|
+
top: this._parent.nativeElement.offsetTop,
|
|
5503
|
+
width: parentBoundingRect.width
|
|
5504
|
+
};
|
|
5505
|
+
}
|
|
5478
5506
|
this._placeElement(window.innerHeight, window.innerWidth, parentRect, elementRect);
|
|
5479
5507
|
}
|
|
5480
5508
|
}
|
|
@@ -5527,6 +5555,7 @@ OverlayDirective.ctorParameters = () => [
|
|
|
5527
5555
|
OverlayDirective.propDecorators = {
|
|
5528
5556
|
parent: [{ type: Input, args: ["overlay",] }],
|
|
5529
5557
|
view: [{ type: Input }],
|
|
5558
|
+
inline: [{ type: Input }],
|
|
5530
5559
|
keepInView: [{ type: Input }],
|
|
5531
5560
|
inheritWidth: [{ type: Input }],
|
|
5532
5561
|
rightAlign: [{ type: Input }],
|
|
@@ -10957,19 +10986,18 @@ function emailValidator(control) {
|
|
|
10957
10986
|
}
|
|
10958
10987
|
|
|
10959
10988
|
class FilterItemComponent {
|
|
10960
|
-
constructor(iconService) {
|
|
10989
|
+
constructor(iconService, _changeDetector) {
|
|
10961
10990
|
this.iconService = iconService;
|
|
10991
|
+
this._changeDetector = _changeDetector;
|
|
10962
10992
|
this.icons = CoreComponentsIcon;
|
|
10963
10993
|
this.modes = FilterItemMode;
|
|
10964
|
-
this.mode = this.modes.
|
|
10994
|
+
this.mode = this.modes.Filterlist;
|
|
10965
10995
|
this.initialLimit = 10;
|
|
10966
10996
|
this.expanded = false;
|
|
10967
10997
|
// Set to false to use filter item with a multi selectable collection. Set to true to specify custom content
|
|
10968
10998
|
this.customContent = false;
|
|
10969
10999
|
// Set to true to show all results. Set to false to get 'show more' and 'show less' buttons to expand and contract.
|
|
10970
11000
|
this.showAllResults = false;
|
|
10971
|
-
//@Input()
|
|
10972
|
-
//public singleSelect: boolean = false;
|
|
10973
11001
|
this.filterButtonLabel = "Search";
|
|
10974
11002
|
this.searchPlaceholder = 'Search...';
|
|
10975
11003
|
this.showMoreLabel = 'Show more';
|
|
@@ -10990,40 +11018,42 @@ class FilterItemComponent {
|
|
|
10990
11018
|
var _a;
|
|
10991
11019
|
this._collection = value;
|
|
10992
11020
|
this.filteredCollection = (_a = this._collection) === null || _a === void 0 ? void 0 : _a.slice();
|
|
11021
|
+
//reset the model in case there was no collection to set its values on when it was set.
|
|
11022
|
+
this.model = this._model;
|
|
10993
11023
|
}
|
|
10994
11024
|
get collection() {
|
|
10995
11025
|
return this._collection;
|
|
10996
11026
|
}
|
|
10997
11027
|
set model(filterString) {
|
|
10998
|
-
|
|
10999
|
-
this.
|
|
11000
|
-
|
|
11001
|
-
|
|
11002
|
-
this.
|
|
11003
|
-
|
|
11004
|
-
|
|
11005
|
-
this.
|
|
11006
|
-
|
|
11007
|
-
|
|
11008
|
-
this.
|
|
11009
|
-
|
|
11010
|
-
|
|
11011
|
-
this.
|
|
11012
|
-
|
|
11013
|
-
|
|
11014
|
-
this.
|
|
11015
|
-
|
|
11016
|
-
|
|
11017
|
-
|
|
11018
|
-
|
|
11019
|
-
|
|
11020
|
-
|
|
11021
|
-
|
|
11022
|
-
|
|
11023
|
-
|
|
11024
|
-
|
|
11025
|
-
|
|
11026
|
-
|
|
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;
|
|
11027
11057
|
}
|
|
11028
11058
|
}
|
|
11029
11059
|
get model() {
|
|
@@ -11032,8 +11062,6 @@ class FilterItemComponent {
|
|
|
11032
11062
|
ngOnInit() {
|
|
11033
11063
|
this.setToInitialLimit();
|
|
11034
11064
|
this.showButton = this.valueSelected();
|
|
11035
|
-
this.sliderMin = this.sliderDefaultMin;
|
|
11036
|
-
this.sliderMax = this.sliderDefaultMax;
|
|
11037
11065
|
this.checkBoxToTextModel = false;
|
|
11038
11066
|
}
|
|
11039
11067
|
setToInitialLimit() {
|
|
@@ -11057,46 +11085,49 @@ class FilterItemComponent {
|
|
|
11057
11085
|
return ((_a = this.filteredCollection) === null || _a === void 0 ? void 0 : _a.length) <= this.limitTo && ((_b = this.filteredCollection) === null || _b === void 0 ? void 0 : _b.length) > this.initialLimit;
|
|
11058
11086
|
}
|
|
11059
11087
|
handleModelChange(model) {
|
|
11060
|
-
|
|
11061
|
-
this.
|
|
11062
|
-
|
|
11063
|
-
|
|
11064
|
-
|
|
11065
|
-
|
|
11066
|
-
this.
|
|
11067
|
-
|
|
11068
|
-
|
|
11069
|
-
|
|
11070
|
-
|
|
11071
|
-
this.
|
|
11072
|
-
|
|
11073
|
-
|
|
11074
|
-
|
|
11075
|
-
|
|
11076
|
-
|
|
11077
|
-
this.
|
|
11078
|
-
|
|
11079
|
-
|
|
11080
|
-
|
|
11081
|
-
|
|
11082
|
-
this.
|
|
11083
|
-
|
|
11084
|
-
|
|
11085
|
-
this.
|
|
11086
|
-
|
|
11087
|
-
|
|
11088
|
-
this.
|
|
11089
|
-
|
|
11090
|
-
|
|
11091
|
-
this.
|
|
11092
|
-
|
|
11093
|
-
|
|
11094
|
-
this.
|
|
11095
|
-
|
|
11096
|
-
|
|
11097
|
-
|
|
11088
|
+
switch (this.mode) {
|
|
11089
|
+
case this.modes.Filterlist:
|
|
11090
|
+
this.showButton = true;
|
|
11091
|
+
model.checked = !model.checked;
|
|
11092
|
+
this._createModelForFilterList();
|
|
11093
|
+
break;
|
|
11094
|
+
case this.modes.SelectListWithStringCollectionOutput:
|
|
11095
|
+
this.showButton = true;
|
|
11096
|
+
model.checked = !model.checked;
|
|
11097
|
+
this._createModelForStringCollectionList();
|
|
11098
|
+
break;
|
|
11099
|
+
case this.modes.SingleSelectList:
|
|
11100
|
+
this.showButton = true;
|
|
11101
|
+
this.uncheckForSingleSelect(model);
|
|
11102
|
+
model.checked = !model.checked;
|
|
11103
|
+
this._createModelForSingleSelectList();
|
|
11104
|
+
break;
|
|
11105
|
+
case this.modes.SelectListWithNumberOutput:
|
|
11106
|
+
this.showButton = true;
|
|
11107
|
+
model.checked = !model.checked;
|
|
11108
|
+
this._createModelForSelectListWithNumberOutput();
|
|
11109
|
+
break;
|
|
11110
|
+
case this.modes.Slider:
|
|
11111
|
+
this._createModelForSliderMode();
|
|
11112
|
+
break;
|
|
11113
|
+
case this.modes.CheckboxToText:
|
|
11114
|
+
this._createModelForCheckboxToText();
|
|
11115
|
+
break;
|
|
11116
|
+
case this.modes.CheckboxToSimpleText:
|
|
11117
|
+
this._createModelForCheckboxToSimpleText();
|
|
11118
|
+
break;
|
|
11119
|
+
case this.modes.CheckboxToBinary:
|
|
11120
|
+
this._createModelForCheckboxToBinary();
|
|
11121
|
+
break;
|
|
11122
|
+
case this.modes.DateRangeField:
|
|
11123
|
+
this._createModelForDateRange(model);
|
|
11124
|
+
break;
|
|
11125
|
+
case this.modes.TextField:
|
|
11126
|
+
this._model = (typeof this._model === 'string' && this._model.length === 0) ? undefined : this._model;
|
|
11127
|
+
break;
|
|
11098
11128
|
}
|
|
11099
11129
|
this.modelChange.emit(this._model);
|
|
11130
|
+
this.collectionChange.emit(this.collection);
|
|
11100
11131
|
}
|
|
11101
11132
|
uncheckForSingleSelect(model) {
|
|
11102
11133
|
this.collection.forEach(m => {
|
|
@@ -11105,7 +11136,51 @@ class FilterItemComponent {
|
|
|
11105
11136
|
}
|
|
11106
11137
|
});
|
|
11107
11138
|
}
|
|
11108
|
-
|
|
11139
|
+
valueSelected() {
|
|
11140
|
+
if (this.collection) {
|
|
11141
|
+
return !!this.collection.find(c => c.checked);
|
|
11142
|
+
}
|
|
11143
|
+
return false;
|
|
11144
|
+
}
|
|
11145
|
+
// Applies filter to the collection.
|
|
11146
|
+
applyFilter(text) {
|
|
11147
|
+
var _a, _b;
|
|
11148
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
11149
|
+
if (!isNaN(this.minSearchCharsToLoadCollection) && this.collectionLoadFn) {
|
|
11150
|
+
if (text.length === this.minSearchCharsToLoadCollection && text.length > this.filterText.length) {
|
|
11151
|
+
this.collection = yield this.collectionLoadFn(text);
|
|
11152
|
+
}
|
|
11153
|
+
else if (text.length < this.minSearchCharsToLoadCollection) {
|
|
11154
|
+
this.collection = undefined;
|
|
11155
|
+
}
|
|
11156
|
+
}
|
|
11157
|
+
this.filterText = text;
|
|
11158
|
+
if (!this.collection) {
|
|
11159
|
+
return [];
|
|
11160
|
+
}
|
|
11161
|
+
const filterText = (_a = this.filterText) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase();
|
|
11162
|
+
let filteredItemCount = 0;
|
|
11163
|
+
this.filteredCollection = (_b = this.collection) === null || _b === void 0 ? void 0 : _b.filter((item) => {
|
|
11164
|
+
var _a;
|
|
11165
|
+
const labelText = (_a = item.description) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase();
|
|
11166
|
+
const isHiddenByFilter = ((labelText === null || labelText === void 0 ? void 0 : labelText.indexOf(filterText)) === -1);
|
|
11167
|
+
if (isHiddenByFilter) {
|
|
11168
|
+
return false;
|
|
11169
|
+
}
|
|
11170
|
+
else {
|
|
11171
|
+
filteredItemCount++;
|
|
11172
|
+
return true;
|
|
11173
|
+
}
|
|
11174
|
+
});
|
|
11175
|
+
});
|
|
11176
|
+
}
|
|
11177
|
+
onButtonClicked() {
|
|
11178
|
+
this.filterButtonClicked.emit();
|
|
11179
|
+
}
|
|
11180
|
+
/////////////////////////////////////////////////////////////
|
|
11181
|
+
//Model creation for all of the different options available//
|
|
11182
|
+
/////////////////////////////////////////////////////////////
|
|
11183
|
+
_createModelForFilterList() {
|
|
11109
11184
|
let filterRange = [];
|
|
11110
11185
|
if (this.collection !== null && this.collection !== undefined) {
|
|
11111
11186
|
this.collection.forEach((viewModel) => {
|
|
@@ -11113,28 +11188,43 @@ class FilterItemComponent {
|
|
|
11113
11188
|
filterRange.push(`?='${viewModel.code}'`);
|
|
11114
11189
|
}
|
|
11115
11190
|
});
|
|
11116
|
-
|
|
11191
|
+
if (filterRange.length > 0) {
|
|
11192
|
+
this._model = filterRange.join(',');
|
|
11193
|
+
}
|
|
11194
|
+
else {
|
|
11195
|
+
this._model = undefined;
|
|
11196
|
+
}
|
|
11117
11197
|
}
|
|
11118
11198
|
}
|
|
11119
|
-
|
|
11199
|
+
_createModelForStringCollectionList() {
|
|
11120
11200
|
let filterRange = [];
|
|
11121
11201
|
this.collection.forEach((viewModel) => {
|
|
11122
11202
|
if (viewModel.checked) {
|
|
11123
11203
|
filterRange.push(viewModel.code.toString());
|
|
11124
11204
|
}
|
|
11125
11205
|
});
|
|
11126
|
-
|
|
11206
|
+
if (filterRange.length > 0) {
|
|
11207
|
+
this._model = filterRange;
|
|
11208
|
+
}
|
|
11209
|
+
else {
|
|
11210
|
+
this._model = undefined;
|
|
11211
|
+
}
|
|
11127
11212
|
}
|
|
11128
|
-
|
|
11213
|
+
_createModelForSingleSelectList() {
|
|
11129
11214
|
let filterString = "";
|
|
11130
11215
|
this.collection.forEach((viewModel) => {
|
|
11131
11216
|
if (viewModel.checked) {
|
|
11132
11217
|
filterString = viewModel.code.toString();
|
|
11133
11218
|
}
|
|
11134
11219
|
});
|
|
11135
|
-
|
|
11220
|
+
if (filterString.length > 0) {
|
|
11221
|
+
this._model = filterString;
|
|
11222
|
+
}
|
|
11223
|
+
else {
|
|
11224
|
+
this._model = undefined;
|
|
11225
|
+
}
|
|
11136
11226
|
}
|
|
11137
|
-
|
|
11227
|
+
_createModelForSelectListWithNumberOutput() {
|
|
11138
11228
|
let filterNumber = null;
|
|
11139
11229
|
this.collection.forEach((viewModel) => {
|
|
11140
11230
|
if (viewModel.checked) {
|
|
@@ -11146,14 +11236,14 @@ class FilterItemComponent {
|
|
|
11146
11236
|
});
|
|
11147
11237
|
this._model = filterNumber;
|
|
11148
11238
|
}
|
|
11149
|
-
|
|
11239
|
+
_createModelForSliderMode() {
|
|
11150
11240
|
this.sliderMin = !!this.sliderMin ? this.sliderMin : this.sliderDefaultMin;
|
|
11151
11241
|
this.sliderMax = !!this.sliderMax ? this.sliderMax : this.sliderDefaultMax;
|
|
11152
11242
|
let trueLowerBound = Math.min(this.sliderMin, this.sliderMax);
|
|
11153
11243
|
let trueUpperBound = Math.max(this.sliderMin, this.sliderMax);
|
|
11154
11244
|
this._model = `${trueLowerBound} - ${trueUpperBound}`;
|
|
11155
11245
|
}
|
|
11156
|
-
|
|
11246
|
+
_createModelForCheckboxToText() {
|
|
11157
11247
|
if (this.checkBoxToTextModel) {
|
|
11158
11248
|
this._model = "?='J'";
|
|
11159
11249
|
}
|
|
@@ -11161,7 +11251,7 @@ class FilterItemComponent {
|
|
|
11161
11251
|
this._model = "?='N'";
|
|
11162
11252
|
}
|
|
11163
11253
|
}
|
|
11164
|
-
|
|
11254
|
+
_createModelForCheckboxToSimpleText() {
|
|
11165
11255
|
if (this.checkBoxToTextModel) {
|
|
11166
11256
|
this._model = "J";
|
|
11167
11257
|
}
|
|
@@ -11169,7 +11259,7 @@ class FilterItemComponent {
|
|
|
11169
11259
|
this._model = "N";
|
|
11170
11260
|
}
|
|
11171
11261
|
}
|
|
11172
|
-
|
|
11262
|
+
_createModelForCheckboxToBinary() {
|
|
11173
11263
|
if (this.checkBoxToTextModel) {
|
|
11174
11264
|
this._model = 1;
|
|
11175
11265
|
}
|
|
@@ -11177,14 +11267,13 @@ class FilterItemComponent {
|
|
|
11177
11267
|
this._model = 0;
|
|
11178
11268
|
}
|
|
11179
11269
|
}
|
|
11180
|
-
|
|
11270
|
+
_createModelForDateRange(dates) {
|
|
11181
11271
|
if (dates) {
|
|
11182
11272
|
let startDate = dates[0];
|
|
11183
11273
|
let endDate = dates[1];
|
|
11184
11274
|
const startDateRequest = startDate ? this._formatDateToString(startDate) : '';
|
|
11185
11275
|
const endDateRequest = endDate ? this._formatDateToString(endDate) : '';
|
|
11186
|
-
|
|
11187
|
-
this._model = filter;
|
|
11276
|
+
this._model = `?>=\'${startDateRequest}\'& ?<=\'${endDateRequest}\'`;
|
|
11188
11277
|
}
|
|
11189
11278
|
}
|
|
11190
11279
|
_formatDateToString(date) {
|
|
@@ -11193,18 +11282,22 @@ class FilterItemComponent {
|
|
|
11193
11282
|
let year = date.getFullYear();
|
|
11194
11283
|
return `${day}-${month}-${year}`;
|
|
11195
11284
|
}
|
|
11196
|
-
|
|
11285
|
+
////////////////////////////////////////////////////////////
|
|
11286
|
+
//Model reading for all of the different options available//
|
|
11287
|
+
////////////////////////////////////////////////////////////
|
|
11288
|
+
_readModelForFilterList(filterModel) {
|
|
11197
11289
|
let filterList = [];
|
|
11198
11290
|
let itemsToCheck = [];
|
|
11199
|
-
this.
|
|
11200
|
-
|
|
11291
|
+
this._uncheckAll();
|
|
11292
|
+
this._model = filterModel;
|
|
11293
|
+
if (filterModel !== null && filterModel !== undefined && typeof filterModel === 'string' && filterModel.length != 0 && this.collection !== null && this.collection !== undefined) {
|
|
11201
11294
|
filterList = filterModel.split(",");
|
|
11202
11295
|
filterList.forEach((filter) => {
|
|
11203
11296
|
itemsToCheck.push(filter.substr(3, filter.length - 4));
|
|
11204
11297
|
});
|
|
11205
11298
|
for (const item of itemsToCheck) {
|
|
11206
11299
|
let filter = this.collection.find(element => element.code.toString() === item);
|
|
11207
|
-
if (filter) {
|
|
11300
|
+
if (filter !== null && filter !== undefined) {
|
|
11208
11301
|
filter.checked = true;
|
|
11209
11302
|
}
|
|
11210
11303
|
else {
|
|
@@ -11213,25 +11306,23 @@ class FilterItemComponent {
|
|
|
11213
11306
|
}
|
|
11214
11307
|
this._model = filterModel;
|
|
11215
11308
|
}
|
|
11216
|
-
else {
|
|
11217
|
-
this._model = undefined;
|
|
11218
|
-
}
|
|
11219
11309
|
}
|
|
11220
|
-
|
|
11221
|
-
this.
|
|
11222
|
-
|
|
11223
|
-
|
|
11310
|
+
_readModelForSingleSelectList(singleSelectModel) {
|
|
11311
|
+
this._uncheckAll();
|
|
11312
|
+
this._model = singleSelectModel;
|
|
11313
|
+
if (singleSelectModel !== null && singleSelectModel !== undefined && this.collection !== null && this.collection !== undefined) {
|
|
11314
|
+
let filter = this.collection.find(element => element.code.toString() === singleSelectModel);
|
|
11224
11315
|
if (filter) {
|
|
11225
11316
|
filter.checked = true;
|
|
11226
11317
|
}
|
|
11227
|
-
this.createModelForSingleSelectList();
|
|
11228
11318
|
}
|
|
11229
11319
|
}
|
|
11230
|
-
|
|
11231
|
-
this.
|
|
11320
|
+
_readModelForStringCollectionList(collectionModel) {
|
|
11321
|
+
this._uncheckAll();
|
|
11322
|
+
this._model = collectionModel;
|
|
11232
11323
|
if (collectionModel !== null && collectionModel !== undefined && this.collection !== null && this.collection !== undefined) {
|
|
11233
11324
|
this.collection.forEach((viewModel) => {
|
|
11234
|
-
if (collectionModel.indexOf(viewModel.code) > -1) {
|
|
11325
|
+
if (collectionModel.indexOf(viewModel.code.toString()) > -1) {
|
|
11235
11326
|
viewModel.checked = true;
|
|
11236
11327
|
}
|
|
11237
11328
|
else {
|
|
@@ -11240,9 +11331,10 @@ class FilterItemComponent {
|
|
|
11240
11331
|
});
|
|
11241
11332
|
}
|
|
11242
11333
|
}
|
|
11243
|
-
|
|
11244
|
-
this.
|
|
11245
|
-
|
|
11334
|
+
_readModelForSelectListWithNumberOutput(numberModel) {
|
|
11335
|
+
this._uncheckAll();
|
|
11336
|
+
this._model = numberModel;
|
|
11337
|
+
if (numberModel !== null && numberModel !== undefined && this.collection !== null && this.collection !== undefined) {
|
|
11246
11338
|
for (const item of this.collection) {
|
|
11247
11339
|
const itemCode = item.code;
|
|
11248
11340
|
const modValue = (numberModel % (2 * itemCode));
|
|
@@ -11250,14 +11342,15 @@ class FilterItemComponent {
|
|
|
11250
11342
|
}
|
|
11251
11343
|
}
|
|
11252
11344
|
}
|
|
11253
|
-
|
|
11345
|
+
_uncheckAll() {
|
|
11254
11346
|
if (this.collection !== null && this.collection !== undefined) {
|
|
11255
11347
|
this.collection.forEach(m => {
|
|
11256
11348
|
m.checked = false;
|
|
11257
11349
|
});
|
|
11258
11350
|
}
|
|
11259
11351
|
}
|
|
11260
|
-
|
|
11352
|
+
_readModelForSliderMode(sliderModel) {
|
|
11353
|
+
this._model = sliderModel;
|
|
11261
11354
|
if (sliderModel !== undefined && sliderModel !== null) {
|
|
11262
11355
|
let sliderInputCollection = sliderModel.split(' - ');
|
|
11263
11356
|
this.sliderMin = parseInt(sliderInputCollection[0]);
|
|
@@ -11268,7 +11361,8 @@ class FilterItemComponent {
|
|
|
11268
11361
|
this.sliderMax = this.sliderDefaultMax;
|
|
11269
11362
|
}
|
|
11270
11363
|
}
|
|
11271
|
-
|
|
11364
|
+
_readModelForCheckboxToText(checkboxToTextModel) {
|
|
11365
|
+
this._model = checkboxToTextModel;
|
|
11272
11366
|
if (checkboxToTextModel !== undefined && checkboxToTextModel !== null) {
|
|
11273
11367
|
this.checkBoxToTextModel = (checkboxToTextModel.indexOf('J') > -1);
|
|
11274
11368
|
}
|
|
@@ -11276,7 +11370,8 @@ class FilterItemComponent {
|
|
|
11276
11370
|
this.checkBoxToTextModel = false;
|
|
11277
11371
|
}
|
|
11278
11372
|
}
|
|
11279
|
-
|
|
11373
|
+
_readModelForCheckboxToBinary(checkboxToBinary) {
|
|
11374
|
+
this._model = checkboxToBinary;
|
|
11280
11375
|
if (checkboxToBinary !== undefined && checkboxToBinary !== null) {
|
|
11281
11376
|
this.checkBoxToTextModel = (checkboxToBinary >= 1);
|
|
11282
11377
|
}
|
|
@@ -11284,15 +11379,14 @@ class FilterItemComponent {
|
|
|
11284
11379
|
this.checkBoxToTextModel = false;
|
|
11285
11380
|
}
|
|
11286
11381
|
}
|
|
11287
|
-
|
|
11382
|
+
_readModelForDateField(dateFieldModel) {
|
|
11383
|
+
this._model = dateFieldModel;
|
|
11288
11384
|
if (dateFieldModel !== undefined && dateFieldModel !== null) {
|
|
11289
11385
|
this._model = new Date(dateFieldModel);
|
|
11290
11386
|
}
|
|
11291
|
-
else {
|
|
11292
|
-
this._model = undefined;
|
|
11293
|
-
}
|
|
11294
11387
|
}
|
|
11295
|
-
|
|
11388
|
+
_readModelForDateRangeField(dateRangeFieldModel) {
|
|
11389
|
+
this._model = dateRangeFieldModel;
|
|
11296
11390
|
if (dateRangeFieldModel !== undefined && dateRangeFieldModel !== null) {
|
|
11297
11391
|
let dateCollection = dateRangeFieldModel.split('&');
|
|
11298
11392
|
let startString = dateCollection[0].trim().substr(4, dateCollection[0].length - 5);
|
|
@@ -11303,47 +11397,6 @@ class FilterItemComponent {
|
|
|
11303
11397
|
this.dateRangeEnd = new Date(parseInt(endDateComponents[2]), parseInt(endDateComponents[1]) - 1, parseInt(endDateComponents[0]));
|
|
11304
11398
|
}
|
|
11305
11399
|
}
|
|
11306
|
-
valueSelected() {
|
|
11307
|
-
if (this.collection) {
|
|
11308
|
-
return !!this.collection.find(c => c.checked);
|
|
11309
|
-
}
|
|
11310
|
-
return false;
|
|
11311
|
-
}
|
|
11312
|
-
// Applies filter to the collection.
|
|
11313
|
-
applyFilter(text) {
|
|
11314
|
-
var _a, _b;
|
|
11315
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
11316
|
-
if (!isNaN(this.minSearchCharsToLoadCollection) && this.collectionLoadFn) {
|
|
11317
|
-
if (text.length === this.minSearchCharsToLoadCollection && text.length > this.filterText.length) {
|
|
11318
|
-
this.collection = yield this.collectionLoadFn(text);
|
|
11319
|
-
}
|
|
11320
|
-
else if (text.length < this.minSearchCharsToLoadCollection) {
|
|
11321
|
-
this.collection = undefined;
|
|
11322
|
-
}
|
|
11323
|
-
}
|
|
11324
|
-
this.filterText = text;
|
|
11325
|
-
if (!this.collection) {
|
|
11326
|
-
return [];
|
|
11327
|
-
}
|
|
11328
|
-
const filterText = (_a = this.filterText) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase();
|
|
11329
|
-
let filteredItemCount = 0;
|
|
11330
|
-
this.filteredCollection = (_b = this.collection) === null || _b === void 0 ? void 0 : _b.filter((item) => {
|
|
11331
|
-
var _a;
|
|
11332
|
-
const labelText = (_a = item.description) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase();
|
|
11333
|
-
const isHiddenByFilter = ((labelText === null || labelText === void 0 ? void 0 : labelText.indexOf(filterText)) === -1);
|
|
11334
|
-
if (isHiddenByFilter) {
|
|
11335
|
-
return false;
|
|
11336
|
-
}
|
|
11337
|
-
else {
|
|
11338
|
-
filteredItemCount++;
|
|
11339
|
-
return true;
|
|
11340
|
-
}
|
|
11341
|
-
});
|
|
11342
|
-
});
|
|
11343
|
-
}
|
|
11344
|
-
onButtonClicked() {
|
|
11345
|
-
this.filterButtonClicked.emit();
|
|
11346
|
-
}
|
|
11347
11400
|
}
|
|
11348
11401
|
FilterItemComponent.decorators = [
|
|
11349
11402
|
{ type: Component, args: [{
|
|
@@ -11364,8 +11417,8 @@ FilterItemComponent.decorators = [
|
|
|
11364
11417
|
(keydown)="showButton=true" (mousedown)="showButton=true">
|
|
11365
11418
|
<ng-content></ng-content>
|
|
11366
11419
|
</div>
|
|
11367
|
-
<ng-template #collectionContent
|
|
11368
|
-
<div class="co-filter-item-collection-content" *ngIf="mode === modes.
|
|
11420
|
+
<ng-template #collectionContent>
|
|
11421
|
+
<div class="co-filter-item-collection-content" *ngIf="mode === modes.Filterlist || mode === modes.SingleSelectList
|
|
11369
11422
|
|| mode === modes.SelectListWithNumberOutput || mode === modes.SelectListWithStringCollectionOutput">
|
|
11370
11423
|
<co-input-text
|
|
11371
11424
|
*ngIf="collection?.length > 10 || minSearchCharsToLoadCollection"
|
|
@@ -11437,14 +11490,14 @@ FilterItemComponent.decorators = [
|
|
|
11437
11490
|
[(model)]="sliderMax"
|
|
11438
11491
|
(modelChange)="handleModelChange($event)"
|
|
11439
11492
|
></co-input-text>
|
|
11440
|
-
<!-- <co-icon [iconData]="iconService.getIcon(icons.Check)" (click)="filterOnPrice()"></co-icon>-->
|
|
11441
11493
|
</div>
|
|
11442
11494
|
<div class="co-filter-item-checkbox-content" *ngIf="mode === modes.Checkbox ">
|
|
11443
11495
|
<co-input-checkbox
|
|
11444
11496
|
[(model)]="model"
|
|
11445
11497
|
(modelChange)="handleModelChange($event)"></co-input-checkbox>
|
|
11446
11498
|
</div>
|
|
11447
|
-
<div class="co-filter-item-checkbox-content"
|
|
11499
|
+
<div class="co-filter-item-checkbox-content"
|
|
11500
|
+
*ngIf="mode === modes.CheckboxToText || mode === modes.CheckboxToSimpleText || mode === modes.CheckboxToBinary">
|
|
11448
11501
|
<co-input-checkbox
|
|
11449
11502
|
[(model)]="checkBoxToTextModel"
|
|
11450
11503
|
(modelChange)="handleModelChange($event)"></co-input-checkbox>
|
|
@@ -11478,7 +11531,8 @@ FilterItemComponent.decorators = [
|
|
|
11478
11531
|
},] }
|
|
11479
11532
|
];
|
|
11480
11533
|
FilterItemComponent.ctorParameters = () => [
|
|
11481
|
-
{ type: IconCacheService }
|
|
11534
|
+
{ type: IconCacheService },
|
|
11535
|
+
{ type: ChangeDetectorRef }
|
|
11482
11536
|
];
|
|
11483
11537
|
FilterItemComponent.propDecorators = {
|
|
11484
11538
|
mode: [{ type: Input }],
|