@colijnit/corecomponents_v12 12.1.7 → 12.1.9
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 +251 -179
- 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 +203 -164
- 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 +238 -170
- package/fesm2015/colijnit-corecomponents_v12.js.map +1 -1
- package/lib/components/filter-item/filter-item.component.d.ts +30 -26
- 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,17 @@ 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.FilterList;
|
|
10965
10994
|
this.initialLimit = 10;
|
|
10966
10995
|
this.expanded = false;
|
|
10967
10996
|
// Set to false to use filter item with a multi selectable collection. Set to true to specify custom content
|
|
10968
10997
|
this.customContent = false;
|
|
10969
10998
|
// Set to true to show all results. Set to false to get 'show more' and 'show less' buttons to expand and contract.
|
|
10970
10999
|
this.showAllResults = false;
|
|
10971
|
-
//@Input()
|
|
10972
|
-
//public singleSelect: boolean = false;
|
|
10973
11000
|
this.filterButtonLabel = "Search";
|
|
10974
11001
|
this.searchPlaceholder = 'Search...';
|
|
10975
11002
|
this.showMoreLabel = 'Show more';
|
|
@@ -10985,46 +11012,27 @@ class FilterItemComponent {
|
|
|
10985
11012
|
this.filterText = "";
|
|
10986
11013
|
this.showButton = false;
|
|
10987
11014
|
this._collection = [];
|
|
11015
|
+
this._mode = this.modes.Filterlist;
|
|
11016
|
+
}
|
|
11017
|
+
set mode(value) {
|
|
11018
|
+
this._mode = value;
|
|
11019
|
+
this.readModelForMode(this._model);
|
|
11020
|
+
}
|
|
11021
|
+
get mode() {
|
|
11022
|
+
return this._mode;
|
|
10988
11023
|
}
|
|
10989
11024
|
set collection(value) {
|
|
10990
11025
|
var _a;
|
|
10991
11026
|
this._collection = value;
|
|
10992
11027
|
this.filteredCollection = (_a = this._collection) === null || _a === void 0 ? void 0 : _a.slice();
|
|
11028
|
+
//reset the model in case there was no collection to set its values on when it was set.
|
|
11029
|
+
this.model = this._model;
|
|
10993
11030
|
}
|
|
10994
11031
|
get collection() {
|
|
10995
11032
|
return this._collection;
|
|
10996
11033
|
}
|
|
10997
|
-
set model(
|
|
10998
|
-
|
|
10999
|
-
this.readModelForFilterList(filterString);
|
|
11000
|
-
}
|
|
11001
|
-
else if (this.mode === this.modes.SingleSelectList) {
|
|
11002
|
-
this.readModelForSingleSelectList(filterString);
|
|
11003
|
-
}
|
|
11004
|
-
else if (this.mode === this.modes.SelectListWithStringCollectionOutput) {
|
|
11005
|
-
this.readModelForStringCollectionList(filterString);
|
|
11006
|
-
}
|
|
11007
|
-
else if (this.mode === this.modes.SelectListWithNumberOutput) {
|
|
11008
|
-
this.readModelForSelectListWithNumberOutput(filterString);
|
|
11009
|
-
}
|
|
11010
|
-
else if (this.mode === this.modes.Slider) {
|
|
11011
|
-
this.readModelForSliderMode(filterString);
|
|
11012
|
-
}
|
|
11013
|
-
else if (this.mode === this.modes.CheckboxToText || this.mode === this.modes.CheckboxToSimpleText) {
|
|
11014
|
-
this.readModelForCheckboxToText(filterString);
|
|
11015
|
-
}
|
|
11016
|
-
else if (this.mode === this.modes.CheckboxToBinary) {
|
|
11017
|
-
this.readModelForCheckboxToBinary(filterString);
|
|
11018
|
-
}
|
|
11019
|
-
else if (this.mode === this.modes.DateField) {
|
|
11020
|
-
this.readModelForDateField(filterString);
|
|
11021
|
-
}
|
|
11022
|
-
else if (this.mode === this.modes.DateRangeField) {
|
|
11023
|
-
this.readModelForDateRangeField(filterString);
|
|
11024
|
-
}
|
|
11025
|
-
else if (this.mode === this.modes.Checkbox || this.mode === this.modes.TextField) {
|
|
11026
|
-
this._model = filterString;
|
|
11027
|
-
}
|
|
11034
|
+
set model(newModel) {
|
|
11035
|
+
this.readModelForMode(newModel);
|
|
11028
11036
|
}
|
|
11029
11037
|
get model() {
|
|
11030
11038
|
return this._model;
|
|
@@ -11032,8 +11040,6 @@ class FilterItemComponent {
|
|
|
11032
11040
|
ngOnInit() {
|
|
11033
11041
|
this.setToInitialLimit();
|
|
11034
11042
|
this.showButton = this.valueSelected();
|
|
11035
|
-
this.sliderMin = this.sliderDefaultMin;
|
|
11036
|
-
this.sliderMax = this.sliderDefaultMax;
|
|
11037
11043
|
this.checkBoxToTextModel = false;
|
|
11038
11044
|
}
|
|
11039
11045
|
setToInitialLimit() {
|
|
@@ -11057,46 +11063,90 @@ class FilterItemComponent {
|
|
|
11057
11063
|
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
11064
|
}
|
|
11059
11065
|
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
|
-
|
|
11066
|
+
switch (this.mode) {
|
|
11067
|
+
case this.modes.Filterlist:
|
|
11068
|
+
this.showButton = true;
|
|
11069
|
+
model.checked = !model.checked;
|
|
11070
|
+
this._createModelForFilterList();
|
|
11071
|
+
break;
|
|
11072
|
+
case this.modes.SelectListWithStringCollectionOutput:
|
|
11073
|
+
this.showButton = true;
|
|
11074
|
+
model.checked = !model.checked;
|
|
11075
|
+
this._createModelForStringCollectionList();
|
|
11076
|
+
break;
|
|
11077
|
+
case this.modes.SingleSelectList:
|
|
11078
|
+
this.showButton = true;
|
|
11079
|
+
this.uncheckForSingleSelect(model);
|
|
11080
|
+
model.checked = !model.checked;
|
|
11081
|
+
this._createModelForSingleSelectList();
|
|
11082
|
+
break;
|
|
11083
|
+
case this.modes.SelectListWithNumberOutput:
|
|
11084
|
+
this.showButton = true;
|
|
11085
|
+
model.checked = !model.checked;
|
|
11086
|
+
this._createModelForSelectListWithNumberOutput();
|
|
11087
|
+
break;
|
|
11088
|
+
case this.modes.Slider:
|
|
11089
|
+
this._createModelForSliderMode();
|
|
11090
|
+
break;
|
|
11091
|
+
case this.modes.CheckboxToText:
|
|
11092
|
+
this._createModelForCheckboxToText();
|
|
11093
|
+
break;
|
|
11094
|
+
case this.modes.CheckboxToSimpleText:
|
|
11095
|
+
this._createModelForCheckboxToSimpleText();
|
|
11096
|
+
break;
|
|
11097
|
+
case this.modes.CheckboxToBinary:
|
|
11098
|
+
this._createModelForCheckboxToBinary();
|
|
11099
|
+
break;
|
|
11100
|
+
case this.modes.DateRangeField:
|
|
11101
|
+
this._createModelForDateRange(model);
|
|
11102
|
+
break;
|
|
11103
|
+
case this.modes.TextField:
|
|
11104
|
+
this._model = (typeof this._model === 'string' && this._model.length === 0) ? undefined : this._model;
|
|
11105
|
+
break;
|
|
11098
11106
|
}
|
|
11099
11107
|
this.modelChange.emit(this._model);
|
|
11108
|
+
this.collectionChange.emit(this.collection);
|
|
11109
|
+
}
|
|
11110
|
+
valueSelected() {
|
|
11111
|
+
if (this.collection) {
|
|
11112
|
+
return !!this.collection.find(c => c.checked);
|
|
11113
|
+
}
|
|
11114
|
+
return false;
|
|
11115
|
+
}
|
|
11116
|
+
// Applies filter to the collection.
|
|
11117
|
+
applyFilter(text) {
|
|
11118
|
+
var _a, _b;
|
|
11119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
11120
|
+
if (!isNaN(this.minSearchCharsToLoadCollection) && this.collectionLoadFn) {
|
|
11121
|
+
if (text.length === this.minSearchCharsToLoadCollection && text.length > this.filterText.length) {
|
|
11122
|
+
this.collection = yield this.collectionLoadFn(text);
|
|
11123
|
+
}
|
|
11124
|
+
else if (text.length < this.minSearchCharsToLoadCollection) {
|
|
11125
|
+
this.collection = undefined;
|
|
11126
|
+
}
|
|
11127
|
+
}
|
|
11128
|
+
this.filterText = text;
|
|
11129
|
+
if (!this.collection) {
|
|
11130
|
+
return [];
|
|
11131
|
+
}
|
|
11132
|
+
const filterText = (_a = this.filterText) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase();
|
|
11133
|
+
let filteredItemCount = 0;
|
|
11134
|
+
this.filteredCollection = (_b = this.collection) === null || _b === void 0 ? void 0 : _b.filter((item) => {
|
|
11135
|
+
var _a;
|
|
11136
|
+
const labelText = (_a = item.description) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase();
|
|
11137
|
+
const isHiddenByFilter = ((labelText === null || labelText === void 0 ? void 0 : labelText.indexOf(filterText)) === -1);
|
|
11138
|
+
if (isHiddenByFilter) {
|
|
11139
|
+
return false;
|
|
11140
|
+
}
|
|
11141
|
+
else {
|
|
11142
|
+
filteredItemCount++;
|
|
11143
|
+
return true;
|
|
11144
|
+
}
|
|
11145
|
+
});
|
|
11146
|
+
});
|
|
11147
|
+
}
|
|
11148
|
+
onButtonClicked() {
|
|
11149
|
+
this.filterButtonClicked.emit();
|
|
11100
11150
|
}
|
|
11101
11151
|
uncheckForSingleSelect(model) {
|
|
11102
11152
|
this.collection.forEach(m => {
|
|
@@ -11105,7 +11155,42 @@ class FilterItemComponent {
|
|
|
11105
11155
|
}
|
|
11106
11156
|
});
|
|
11107
11157
|
}
|
|
11108
|
-
|
|
11158
|
+
readModelForMode(newModel) {
|
|
11159
|
+
switch (this.mode) {
|
|
11160
|
+
case this.modes.Filterlist:
|
|
11161
|
+
this._readModelForFilterList(newModel);
|
|
11162
|
+
break;
|
|
11163
|
+
case this.modes.SingleSelectList:
|
|
11164
|
+
this._readModelForSingleSelectList(newModel);
|
|
11165
|
+
break;
|
|
11166
|
+
case this.modes.SelectListWithStringCollectionOutput:
|
|
11167
|
+
this._readModelForStringCollectionList(newModel);
|
|
11168
|
+
break;
|
|
11169
|
+
case this.modes.SelectListWithNumberOutput:
|
|
11170
|
+
this._readModelForSelectListWithNumberOutput(newModel);
|
|
11171
|
+
break;
|
|
11172
|
+
case this.modes.Slider:
|
|
11173
|
+
this._readModelForSliderMode(newModel);
|
|
11174
|
+
break;
|
|
11175
|
+
case this.modes.CheckboxToText:
|
|
11176
|
+
case this.modes.CheckboxToSimpleText:
|
|
11177
|
+
this._readModelForCheckboxToText(newModel);
|
|
11178
|
+
break;
|
|
11179
|
+
case this.modes.CheckboxToBinary:
|
|
11180
|
+
this._readModelForCheckboxToBinary(newModel);
|
|
11181
|
+
break;
|
|
11182
|
+
case this.modes.DateField:
|
|
11183
|
+
this._readModelForDateField(newModel);
|
|
11184
|
+
break;
|
|
11185
|
+
case this.modes.DateRangeField:
|
|
11186
|
+
this._readModelForDateRangeField(newModel);
|
|
11187
|
+
break;
|
|
11188
|
+
}
|
|
11189
|
+
}
|
|
11190
|
+
/////////////////////////////////////////////////////////////
|
|
11191
|
+
//Model creation for all of the different options available//
|
|
11192
|
+
/////////////////////////////////////////////////////////////
|
|
11193
|
+
_createModelForFilterList() {
|
|
11109
11194
|
let filterRange = [];
|
|
11110
11195
|
if (this.collection !== null && this.collection !== undefined) {
|
|
11111
11196
|
this.collection.forEach((viewModel) => {
|
|
@@ -11113,28 +11198,43 @@ class FilterItemComponent {
|
|
|
11113
11198
|
filterRange.push(`?='${viewModel.code}'`);
|
|
11114
11199
|
}
|
|
11115
11200
|
});
|
|
11116
|
-
|
|
11201
|
+
if (filterRange.length > 0) {
|
|
11202
|
+
this._model = filterRange.join(',');
|
|
11203
|
+
}
|
|
11204
|
+
else {
|
|
11205
|
+
this._model = undefined;
|
|
11206
|
+
}
|
|
11117
11207
|
}
|
|
11118
11208
|
}
|
|
11119
|
-
|
|
11209
|
+
_createModelForStringCollectionList() {
|
|
11120
11210
|
let filterRange = [];
|
|
11121
11211
|
this.collection.forEach((viewModel) => {
|
|
11122
11212
|
if (viewModel.checked) {
|
|
11123
11213
|
filterRange.push(viewModel.code.toString());
|
|
11124
11214
|
}
|
|
11125
11215
|
});
|
|
11126
|
-
|
|
11216
|
+
if (filterRange.length > 0) {
|
|
11217
|
+
this._model = filterRange;
|
|
11218
|
+
}
|
|
11219
|
+
else {
|
|
11220
|
+
this._model = undefined;
|
|
11221
|
+
}
|
|
11127
11222
|
}
|
|
11128
|
-
|
|
11223
|
+
_createModelForSingleSelectList() {
|
|
11129
11224
|
let filterString = "";
|
|
11130
11225
|
this.collection.forEach((viewModel) => {
|
|
11131
11226
|
if (viewModel.checked) {
|
|
11132
11227
|
filterString = viewModel.code.toString();
|
|
11133
11228
|
}
|
|
11134
11229
|
});
|
|
11135
|
-
|
|
11230
|
+
if (filterString.length > 0) {
|
|
11231
|
+
this._model = filterString;
|
|
11232
|
+
}
|
|
11233
|
+
else {
|
|
11234
|
+
this._model = undefined;
|
|
11235
|
+
}
|
|
11136
11236
|
}
|
|
11137
|
-
|
|
11237
|
+
_createModelForSelectListWithNumberOutput() {
|
|
11138
11238
|
let filterNumber = null;
|
|
11139
11239
|
this.collection.forEach((viewModel) => {
|
|
11140
11240
|
if (viewModel.checked) {
|
|
@@ -11146,14 +11246,14 @@ class FilterItemComponent {
|
|
|
11146
11246
|
});
|
|
11147
11247
|
this._model = filterNumber;
|
|
11148
11248
|
}
|
|
11149
|
-
|
|
11249
|
+
_createModelForSliderMode() {
|
|
11150
11250
|
this.sliderMin = !!this.sliderMin ? this.sliderMin : this.sliderDefaultMin;
|
|
11151
11251
|
this.sliderMax = !!this.sliderMax ? this.sliderMax : this.sliderDefaultMax;
|
|
11152
11252
|
let trueLowerBound = Math.min(this.sliderMin, this.sliderMax);
|
|
11153
11253
|
let trueUpperBound = Math.max(this.sliderMin, this.sliderMax);
|
|
11154
11254
|
this._model = `${trueLowerBound} - ${trueUpperBound}`;
|
|
11155
11255
|
}
|
|
11156
|
-
|
|
11256
|
+
_createModelForCheckboxToText() {
|
|
11157
11257
|
if (this.checkBoxToTextModel) {
|
|
11158
11258
|
this._model = "?='J'";
|
|
11159
11259
|
}
|
|
@@ -11161,7 +11261,7 @@ class FilterItemComponent {
|
|
|
11161
11261
|
this._model = "?='N'";
|
|
11162
11262
|
}
|
|
11163
11263
|
}
|
|
11164
|
-
|
|
11264
|
+
_createModelForCheckboxToSimpleText() {
|
|
11165
11265
|
if (this.checkBoxToTextModel) {
|
|
11166
11266
|
this._model = "J";
|
|
11167
11267
|
}
|
|
@@ -11169,7 +11269,7 @@ class FilterItemComponent {
|
|
|
11169
11269
|
this._model = "N";
|
|
11170
11270
|
}
|
|
11171
11271
|
}
|
|
11172
|
-
|
|
11272
|
+
_createModelForCheckboxToBinary() {
|
|
11173
11273
|
if (this.checkBoxToTextModel) {
|
|
11174
11274
|
this._model = 1;
|
|
11175
11275
|
}
|
|
@@ -11177,14 +11277,13 @@ class FilterItemComponent {
|
|
|
11177
11277
|
this._model = 0;
|
|
11178
11278
|
}
|
|
11179
11279
|
}
|
|
11180
|
-
|
|
11280
|
+
_createModelForDateRange(dates) {
|
|
11181
11281
|
if (dates) {
|
|
11182
11282
|
let startDate = dates[0];
|
|
11183
11283
|
let endDate = dates[1];
|
|
11184
11284
|
const startDateRequest = startDate ? this._formatDateToString(startDate) : '';
|
|
11185
11285
|
const endDateRequest = endDate ? this._formatDateToString(endDate) : '';
|
|
11186
|
-
|
|
11187
|
-
this._model = filter;
|
|
11286
|
+
this._model = `?>=\'${startDateRequest}\'& ?<=\'${endDateRequest}\'`;
|
|
11188
11287
|
}
|
|
11189
11288
|
}
|
|
11190
11289
|
_formatDateToString(date) {
|
|
@@ -11193,45 +11292,44 @@ class FilterItemComponent {
|
|
|
11193
11292
|
let year = date.getFullYear();
|
|
11194
11293
|
return `${day}-${month}-${year}`;
|
|
11195
11294
|
}
|
|
11196
|
-
|
|
11295
|
+
////////////////////////////////////////////////////////////
|
|
11296
|
+
//Model reading for all of the different options available//
|
|
11297
|
+
////////////////////////////////////////////////////////////
|
|
11298
|
+
_readModelForFilterList(filterModel) {
|
|
11197
11299
|
let filterList = [];
|
|
11198
11300
|
let itemsToCheck = [];
|
|
11199
|
-
this.
|
|
11200
|
-
|
|
11301
|
+
this._uncheckAll();
|
|
11302
|
+
this._model = filterModel;
|
|
11303
|
+
if (filterModel !== null && filterModel !== undefined && typeof filterModel === 'string' && filterModel.length != 0 && this.collection !== null && this.collection !== undefined) {
|
|
11201
11304
|
filterList = filterModel.split(",");
|
|
11202
11305
|
filterList.forEach((filter) => {
|
|
11203
11306
|
itemsToCheck.push(filter.substr(3, filter.length - 4));
|
|
11204
11307
|
});
|
|
11205
11308
|
for (const item of itemsToCheck) {
|
|
11206
11309
|
let filter = this.collection.find(element => element.code.toString() === item);
|
|
11207
|
-
if (filter) {
|
|
11310
|
+
if (filter !== null && filter !== undefined) {
|
|
11208
11311
|
filter.checked = true;
|
|
11209
11312
|
}
|
|
11210
|
-
else {
|
|
11211
|
-
filter.checked = false;
|
|
11212
|
-
}
|
|
11213
11313
|
}
|
|
11214
11314
|
this._model = filterModel;
|
|
11215
11315
|
}
|
|
11216
|
-
else {
|
|
11217
|
-
this._model = undefined;
|
|
11218
|
-
}
|
|
11219
11316
|
}
|
|
11220
|
-
|
|
11221
|
-
this.
|
|
11222
|
-
|
|
11223
|
-
|
|
11224
|
-
|
|
11317
|
+
_readModelForSingleSelectList(singleSelectModel) {
|
|
11318
|
+
this._uncheckAll();
|
|
11319
|
+
this._model = singleSelectModel;
|
|
11320
|
+
if (singleSelectModel !== null && singleSelectModel !== undefined && this.collection !== null && this.collection !== undefined) {
|
|
11321
|
+
let filter = this.collection.find(element => element.code.toString() === singleSelectModel);
|
|
11322
|
+
if (filter !== null && filter !== undefined) {
|
|
11225
11323
|
filter.checked = true;
|
|
11226
11324
|
}
|
|
11227
|
-
this.createModelForSingleSelectList();
|
|
11228
11325
|
}
|
|
11229
11326
|
}
|
|
11230
|
-
|
|
11231
|
-
this.
|
|
11327
|
+
_readModelForStringCollectionList(collectionModel) {
|
|
11328
|
+
this._uncheckAll();
|
|
11329
|
+
this._model = collectionModel;
|
|
11232
11330
|
if (collectionModel !== null && collectionModel !== undefined && this.collection !== null && this.collection !== undefined) {
|
|
11233
11331
|
this.collection.forEach((viewModel) => {
|
|
11234
|
-
if (collectionModel.indexOf(viewModel.code) > -1) {
|
|
11332
|
+
if (collectionModel.indexOf(viewModel.code.toString()) > -1) {
|
|
11235
11333
|
viewModel.checked = true;
|
|
11236
11334
|
}
|
|
11237
11335
|
else {
|
|
@@ -11240,9 +11338,10 @@ class FilterItemComponent {
|
|
|
11240
11338
|
});
|
|
11241
11339
|
}
|
|
11242
11340
|
}
|
|
11243
|
-
|
|
11244
|
-
this.
|
|
11245
|
-
|
|
11341
|
+
_readModelForSelectListWithNumberOutput(numberModel) {
|
|
11342
|
+
this._uncheckAll();
|
|
11343
|
+
this._model = numberModel;
|
|
11344
|
+
if (numberModel !== null && numberModel !== undefined && this.collection !== null && this.collection !== undefined) {
|
|
11246
11345
|
for (const item of this.collection) {
|
|
11247
11346
|
const itemCode = item.code;
|
|
11248
11347
|
const modValue = (numberModel % (2 * itemCode));
|
|
@@ -11250,14 +11349,15 @@ class FilterItemComponent {
|
|
|
11250
11349
|
}
|
|
11251
11350
|
}
|
|
11252
11351
|
}
|
|
11253
|
-
|
|
11352
|
+
_uncheckAll() {
|
|
11254
11353
|
if (this.collection !== null && this.collection !== undefined) {
|
|
11255
11354
|
this.collection.forEach(m => {
|
|
11256
11355
|
m.checked = false;
|
|
11257
11356
|
});
|
|
11258
11357
|
}
|
|
11259
11358
|
}
|
|
11260
|
-
|
|
11359
|
+
_readModelForSliderMode(sliderModel) {
|
|
11360
|
+
this._model = sliderModel;
|
|
11261
11361
|
if (sliderModel !== undefined && sliderModel !== null) {
|
|
11262
11362
|
let sliderInputCollection = sliderModel.split(' - ');
|
|
11263
11363
|
this.sliderMin = parseInt(sliderInputCollection[0]);
|
|
@@ -11268,7 +11368,8 @@ class FilterItemComponent {
|
|
|
11268
11368
|
this.sliderMax = this.sliderDefaultMax;
|
|
11269
11369
|
}
|
|
11270
11370
|
}
|
|
11271
|
-
|
|
11371
|
+
_readModelForCheckboxToText(checkboxToTextModel) {
|
|
11372
|
+
this._model = checkboxToTextModel;
|
|
11272
11373
|
if (checkboxToTextModel !== undefined && checkboxToTextModel !== null) {
|
|
11273
11374
|
this.checkBoxToTextModel = (checkboxToTextModel.indexOf('J') > -1);
|
|
11274
11375
|
}
|
|
@@ -11276,7 +11377,8 @@ class FilterItemComponent {
|
|
|
11276
11377
|
this.checkBoxToTextModel = false;
|
|
11277
11378
|
}
|
|
11278
11379
|
}
|
|
11279
|
-
|
|
11380
|
+
_readModelForCheckboxToBinary(checkboxToBinary) {
|
|
11381
|
+
this._model = checkboxToBinary;
|
|
11280
11382
|
if (checkboxToBinary !== undefined && checkboxToBinary !== null) {
|
|
11281
11383
|
this.checkBoxToTextModel = (checkboxToBinary >= 1);
|
|
11282
11384
|
}
|
|
@@ -11284,7 +11386,8 @@ class FilterItemComponent {
|
|
|
11284
11386
|
this.checkBoxToTextModel = false;
|
|
11285
11387
|
}
|
|
11286
11388
|
}
|
|
11287
|
-
|
|
11389
|
+
_readModelForDateField(dateFieldModel) {
|
|
11390
|
+
this._model = dateFieldModel;
|
|
11288
11391
|
if (dateFieldModel !== undefined && dateFieldModel !== null) {
|
|
11289
11392
|
this._model = new Date(dateFieldModel);
|
|
11290
11393
|
}
|
|
@@ -11292,7 +11395,8 @@ class FilterItemComponent {
|
|
|
11292
11395
|
this._model = undefined;
|
|
11293
11396
|
}
|
|
11294
11397
|
}
|
|
11295
|
-
|
|
11398
|
+
_readModelForDateRangeField(dateRangeFieldModel) {
|
|
11399
|
+
this._model = dateRangeFieldModel;
|
|
11296
11400
|
if (dateRangeFieldModel !== undefined && dateRangeFieldModel !== null) {
|
|
11297
11401
|
let dateCollection = dateRangeFieldModel.split('&');
|
|
11298
11402
|
let startString = dateCollection[0].trim().substr(4, dateCollection[0].length - 5);
|
|
@@ -11302,47 +11406,10 @@ class FilterItemComponent {
|
|
|
11302
11406
|
this.dateRangeStart = new Date(parseInt(startDateComponents[2]), parseInt(startDateComponents[1]) - 1, parseInt(startDateComponents[0]));
|
|
11303
11407
|
this.dateRangeEnd = new Date(parseInt(endDateComponents[2]), parseInt(endDateComponents[1]) - 1, parseInt(endDateComponents[0]));
|
|
11304
11408
|
}
|
|
11305
|
-
|
|
11306
|
-
|
|
11307
|
-
|
|
11308
|
-
return !!this.collection.find(c => c.checked);
|
|
11409
|
+
else {
|
|
11410
|
+
this.dateRangeStart = undefined;
|
|
11411
|
+
this.dateRangeEnd = undefined;
|
|
11309
11412
|
}
|
|
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
11413
|
}
|
|
11347
11414
|
}
|
|
11348
11415
|
FilterItemComponent.decorators = [
|
|
@@ -11364,8 +11431,8 @@ FilterItemComponent.decorators = [
|
|
|
11364
11431
|
(keydown)="showButton=true" (mousedown)="showButton=true">
|
|
11365
11432
|
<ng-content></ng-content>
|
|
11366
11433
|
</div>
|
|
11367
|
-
<ng-template #collectionContent
|
|
11368
|
-
<div class="co-filter-item-collection-content" *ngIf="mode === modes.
|
|
11434
|
+
<ng-template #collectionContent>
|
|
11435
|
+
<div class="co-filter-item-collection-content" *ngIf="mode === modes.Filterlist || mode === modes.SingleSelectList
|
|
11369
11436
|
|| mode === modes.SelectListWithNumberOutput || mode === modes.SelectListWithStringCollectionOutput">
|
|
11370
11437
|
<co-input-text
|
|
11371
11438
|
*ngIf="collection?.length > 10 || minSearchCharsToLoadCollection"
|
|
@@ -11437,14 +11504,14 @@ FilterItemComponent.decorators = [
|
|
|
11437
11504
|
[(model)]="sliderMax"
|
|
11438
11505
|
(modelChange)="handleModelChange($event)"
|
|
11439
11506
|
></co-input-text>
|
|
11440
|
-
<!-- <co-icon [iconData]="iconService.getIcon(icons.Check)" (click)="filterOnPrice()"></co-icon>-->
|
|
11441
11507
|
</div>
|
|
11442
11508
|
<div class="co-filter-item-checkbox-content" *ngIf="mode === modes.Checkbox ">
|
|
11443
11509
|
<co-input-checkbox
|
|
11444
11510
|
[(model)]="model"
|
|
11445
11511
|
(modelChange)="handleModelChange($event)"></co-input-checkbox>
|
|
11446
11512
|
</div>
|
|
11447
|
-
<div class="co-filter-item-checkbox-content"
|
|
11513
|
+
<div class="co-filter-item-checkbox-content"
|
|
11514
|
+
*ngIf="mode === modes.CheckboxToText || mode === modes.CheckboxToSimpleText || mode === modes.CheckboxToBinary">
|
|
11448
11515
|
<co-input-checkbox
|
|
11449
11516
|
[(model)]="checkBoxToTextModel"
|
|
11450
11517
|
(modelChange)="handleModelChange($event)"></co-input-checkbox>
|
|
@@ -11478,7 +11545,8 @@ FilterItemComponent.decorators = [
|
|
|
11478
11545
|
},] }
|
|
11479
11546
|
];
|
|
11480
11547
|
FilterItemComponent.ctorParameters = () => [
|
|
11481
|
-
{ type: IconCacheService }
|
|
11548
|
+
{ type: IconCacheService },
|
|
11549
|
+
{ type: ChangeDetectorRef }
|
|
11482
11550
|
];
|
|
11483
11551
|
FilterItemComponent.propDecorators = {
|
|
11484
11552
|
mode: [{ type: Input }],
|