@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
|
@@ -5658,10 +5658,20 @@
|
|
|
5658
5658
|
|
|
5659
5659
|
exports.FilterItemMode = void 0;
|
|
5660
5660
|
(function (FilterItemMode) {
|
|
5661
|
-
|
|
5661
|
+
//This mode makes the Filter display a multi select list
|
|
5662
|
+
// Input will be passed along directly as a string with the following syntax: "?>='choice 1', ?<='choice2'"
|
|
5663
|
+
FilterItemMode["Filterlist"] = "filterlist";
|
|
5664
|
+
//This mode makes the Filter display a single select list
|
|
5665
|
+
// Input will be passed along directly as a simple string.
|
|
5662
5666
|
FilterItemMode["SingleSelectList"] = "singleSelectList";
|
|
5667
|
+
//This mode makes the Filter display a multi select list
|
|
5668
|
+
// Input will be passed along directly as a simple string.
|
|
5663
5669
|
FilterItemMode["SelectListWithStringCollectionOutput"] = "selectListWithStringCollectionOutput";
|
|
5670
|
+
//This mode makes the Filter display a multi select list
|
|
5671
|
+
// Available choices will need to have their identifying value be a number. The summation of all these numbers will be passed along.
|
|
5664
5672
|
FilterItemMode["SelectListWithNumberOutput"] = "selectListWithNumberOutput";
|
|
5673
|
+
//This mode makes the Filter display a min and max field. This should eventually be a slider.
|
|
5674
|
+
// input is passed along as "min - max"
|
|
5665
5675
|
FilterItemMode["Slider"] = "slider";
|
|
5666
5676
|
//This mode makes the Filter display a simple textfield.
|
|
5667
5677
|
// The value typed into the field will be passed along directly as a string.
|
|
@@ -5682,7 +5692,7 @@
|
|
|
5682
5692
|
// It's value will be passed along as either a "?='T'" or and "?='F'".
|
|
5683
5693
|
FilterItemMode["CheckboxToText"] = "checkboxToText";
|
|
5684
5694
|
//This mode makes the Filter display a simple checkBox.
|
|
5685
|
-
// It's value will be passed along as either a
|
|
5695
|
+
// It's value will be passed along as either a 1 or and 0.
|
|
5686
5696
|
FilterItemMode["CheckboxToBinary"] = "checkboxToBinary";
|
|
5687
5697
|
})(exports.FilterItemMode || (exports.FilterItemMode = {}));
|
|
5688
5698
|
|
|
@@ -5925,6 +5935,11 @@
|
|
|
5925
5935
|
var OverlayDirective = /** @class */ (function () {
|
|
5926
5936
|
function OverlayDirective(elementRef) {
|
|
5927
5937
|
var _this = this;
|
|
5938
|
+
/**
|
|
5939
|
+
* true; Element is added to the parent template
|
|
5940
|
+
* false; Element is added to the bottom of the DOM
|
|
5941
|
+
*/
|
|
5942
|
+
this.inline = false;
|
|
5928
5943
|
this.keepInView = false;
|
|
5929
5944
|
this.inheritWidth = false;
|
|
5930
5945
|
this.rightAlign = false;
|
|
@@ -5990,12 +6005,25 @@
|
|
|
5990
6005
|
if (this._elementRef && this._elementRef.nativeElement && this._parent && this._parent.nativeElement) {
|
|
5991
6006
|
var elementRect = this._elementRef.nativeElement.getBoundingClientRect();
|
|
5992
6007
|
var parentBoundingRect = this._parent.nativeElement.getBoundingClientRect();
|
|
5993
|
-
var parentRect = {
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
6008
|
+
var parentRect = {};
|
|
6009
|
+
if (!this.inline) {
|
|
6010
|
+
parentRect = {
|
|
6011
|
+
bottom: parentBoundingRect.bottom,
|
|
6012
|
+
right: parentBoundingRect.right,
|
|
6013
|
+
left: parentBoundingRect.left,
|
|
6014
|
+
top: parentBoundingRect.top,
|
|
6015
|
+
width: parentBoundingRect.width
|
|
6016
|
+
};
|
|
6017
|
+
}
|
|
6018
|
+
else {
|
|
6019
|
+
parentRect = {
|
|
6020
|
+
bottom: this._parent.nativeElement.offsetTop + parentBoundingRect.height,
|
|
6021
|
+
right: this._parent.nativeElement.offsetLeft + parentBoundingRect.width,
|
|
6022
|
+
left: this._parent.nativeElement.offsetLeft,
|
|
6023
|
+
top: this._parent.nativeElement.offsetTop,
|
|
6024
|
+
width: parentBoundingRect.width
|
|
6025
|
+
};
|
|
6026
|
+
}
|
|
5999
6027
|
this._placeElement(window.innerHeight, window.innerWidth, parentRect, elementRect);
|
|
6000
6028
|
}
|
|
6001
6029
|
};
|
|
@@ -6049,6 +6077,7 @@
|
|
|
6049
6077
|
OverlayDirective.propDecorators = {
|
|
6050
6078
|
parent: [{ type: i0.Input, args: ["overlay",] }],
|
|
6051
6079
|
view: [{ type: i0.Input }],
|
|
6080
|
+
inline: [{ type: i0.Input }],
|
|
6052
6081
|
keepInView: [{ type: i0.Input }],
|
|
6053
6082
|
inheritWidth: [{ type: i0.Input }],
|
|
6054
6083
|
rightAlign: [{ type: i0.Input }],
|
|
@@ -11523,19 +11552,17 @@
|
|
|
11523
11552
|
}
|
|
11524
11553
|
|
|
11525
11554
|
var FilterItemComponent = /** @class */ (function () {
|
|
11526
|
-
function FilterItemComponent(iconService) {
|
|
11555
|
+
function FilterItemComponent(iconService, _changeDetector) {
|
|
11527
11556
|
this.iconService = iconService;
|
|
11557
|
+
this._changeDetector = _changeDetector;
|
|
11528
11558
|
this.icons = exports.CoreComponentsIcon;
|
|
11529
11559
|
this.modes = exports.FilterItemMode;
|
|
11530
|
-
this.mode = this.modes.FilterList;
|
|
11531
11560
|
this.initialLimit = 10;
|
|
11532
11561
|
this.expanded = false;
|
|
11533
11562
|
// Set to false to use filter item with a multi selectable collection. Set to true to specify custom content
|
|
11534
11563
|
this.customContent = false;
|
|
11535
11564
|
// Set to true to show all results. Set to false to get 'show more' and 'show less' buttons to expand and contract.
|
|
11536
11565
|
this.showAllResults = false;
|
|
11537
|
-
//@Input()
|
|
11538
|
-
//public singleSelect: boolean = false;
|
|
11539
11566
|
this.filterButtonLabel = "Search";
|
|
11540
11567
|
this.searchPlaceholder = 'Search...';
|
|
11541
11568
|
this.showMoreLabel = 'Show more';
|
|
@@ -11551,7 +11578,19 @@
|
|
|
11551
11578
|
this.filterText = "";
|
|
11552
11579
|
this.showButton = false;
|
|
11553
11580
|
this._collection = [];
|
|
11581
|
+
this._mode = this.modes.Filterlist;
|
|
11554
11582
|
}
|
|
11583
|
+
Object.defineProperty(FilterItemComponent.prototype, "mode", {
|
|
11584
|
+
get: function () {
|
|
11585
|
+
return this._mode;
|
|
11586
|
+
},
|
|
11587
|
+
set: function (value) {
|
|
11588
|
+
this._mode = value;
|
|
11589
|
+
this.readModelForMode(this._model);
|
|
11590
|
+
},
|
|
11591
|
+
enumerable: false,
|
|
11592
|
+
configurable: true
|
|
11593
|
+
});
|
|
11555
11594
|
Object.defineProperty(FilterItemComponent.prototype, "collection", {
|
|
11556
11595
|
get: function () {
|
|
11557
11596
|
return this._collection;
|
|
@@ -11560,6 +11599,8 @@
|
|
|
11560
11599
|
var _a;
|
|
11561
11600
|
this._collection = value;
|
|
11562
11601
|
this.filteredCollection = (_a = this._collection) === null || _a === void 0 ? void 0 : _a.slice();
|
|
11602
|
+
//reset the model in case there was no collection to set its values on when it was set.
|
|
11603
|
+
this.model = this._model;
|
|
11563
11604
|
},
|
|
11564
11605
|
enumerable: false,
|
|
11565
11606
|
configurable: true
|
|
@@ -11568,37 +11609,8 @@
|
|
|
11568
11609
|
get: function () {
|
|
11569
11610
|
return this._model;
|
|
11570
11611
|
},
|
|
11571
|
-
set: function (
|
|
11572
|
-
|
|
11573
|
-
this.readModelForFilterList(filterString);
|
|
11574
|
-
}
|
|
11575
|
-
else if (this.mode === this.modes.SingleSelectList) {
|
|
11576
|
-
this.readModelForSingleSelectList(filterString);
|
|
11577
|
-
}
|
|
11578
|
-
else if (this.mode === this.modes.SelectListWithStringCollectionOutput) {
|
|
11579
|
-
this.readModelForStringCollectionList(filterString);
|
|
11580
|
-
}
|
|
11581
|
-
else if (this.mode === this.modes.SelectListWithNumberOutput) {
|
|
11582
|
-
this.readModelForSelectListWithNumberOutput(filterString);
|
|
11583
|
-
}
|
|
11584
|
-
else if (this.mode === this.modes.Slider) {
|
|
11585
|
-
this.readModelForSliderMode(filterString);
|
|
11586
|
-
}
|
|
11587
|
-
else if (this.mode === this.modes.CheckboxToText || this.mode === this.modes.CheckboxToSimpleText) {
|
|
11588
|
-
this.readModelForCheckboxToText(filterString);
|
|
11589
|
-
}
|
|
11590
|
-
else if (this.mode === this.modes.CheckboxToBinary) {
|
|
11591
|
-
this.readModelForCheckboxToBinary(filterString);
|
|
11592
|
-
}
|
|
11593
|
-
else if (this.mode === this.modes.DateField) {
|
|
11594
|
-
this.readModelForDateField(filterString);
|
|
11595
|
-
}
|
|
11596
|
-
else if (this.mode === this.modes.DateRangeField) {
|
|
11597
|
-
this.readModelForDateRangeField(filterString);
|
|
11598
|
-
}
|
|
11599
|
-
else if (this.mode === this.modes.Checkbox || this.mode === this.modes.TextField) {
|
|
11600
|
-
this._model = filterString;
|
|
11601
|
-
}
|
|
11612
|
+
set: function (newModel) {
|
|
11613
|
+
this.readModelForMode(newModel);
|
|
11602
11614
|
},
|
|
11603
11615
|
enumerable: false,
|
|
11604
11616
|
configurable: true
|
|
@@ -11606,8 +11618,6 @@
|
|
|
11606
11618
|
FilterItemComponent.prototype.ngOnInit = function () {
|
|
11607
11619
|
this.setToInitialLimit();
|
|
11608
11620
|
this.showButton = this.valueSelected();
|
|
11609
|
-
this.sliderMin = this.sliderDefaultMin;
|
|
11610
|
-
this.sliderMax = this.sliderDefaultMax;
|
|
11611
11621
|
this.checkBoxToTextModel = false;
|
|
11612
11622
|
};
|
|
11613
11623
|
FilterItemComponent.prototype.setToInitialLimit = function () {
|
|
@@ -11631,46 +11641,102 @@
|
|
|
11631
11641
|
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;
|
|
11632
11642
|
};
|
|
11633
11643
|
FilterItemComponent.prototype.handleModelChange = function (model) {
|
|
11634
|
-
|
|
11635
|
-
this.
|
|
11636
|
-
|
|
11637
|
-
|
|
11638
|
-
|
|
11639
|
-
|
|
11640
|
-
this.
|
|
11641
|
-
|
|
11642
|
-
|
|
11643
|
-
|
|
11644
|
-
|
|
11645
|
-
this.
|
|
11646
|
-
|
|
11647
|
-
|
|
11648
|
-
|
|
11649
|
-
|
|
11650
|
-
|
|
11651
|
-
this.
|
|
11652
|
-
|
|
11653
|
-
|
|
11654
|
-
|
|
11655
|
-
|
|
11656
|
-
this.
|
|
11657
|
-
|
|
11658
|
-
|
|
11659
|
-
this.
|
|
11660
|
-
|
|
11661
|
-
|
|
11662
|
-
this.
|
|
11663
|
-
|
|
11664
|
-
|
|
11665
|
-
this.
|
|
11666
|
-
|
|
11667
|
-
|
|
11668
|
-
this.
|
|
11669
|
-
|
|
11670
|
-
|
|
11671
|
-
|
|
11644
|
+
switch (this.mode) {
|
|
11645
|
+
case this.modes.Filterlist:
|
|
11646
|
+
this.showButton = true;
|
|
11647
|
+
model.checked = !model.checked;
|
|
11648
|
+
this._createModelForFilterList();
|
|
11649
|
+
break;
|
|
11650
|
+
case this.modes.SelectListWithStringCollectionOutput:
|
|
11651
|
+
this.showButton = true;
|
|
11652
|
+
model.checked = !model.checked;
|
|
11653
|
+
this._createModelForStringCollectionList();
|
|
11654
|
+
break;
|
|
11655
|
+
case this.modes.SingleSelectList:
|
|
11656
|
+
this.showButton = true;
|
|
11657
|
+
this.uncheckForSingleSelect(model);
|
|
11658
|
+
model.checked = !model.checked;
|
|
11659
|
+
this._createModelForSingleSelectList();
|
|
11660
|
+
break;
|
|
11661
|
+
case this.modes.SelectListWithNumberOutput:
|
|
11662
|
+
this.showButton = true;
|
|
11663
|
+
model.checked = !model.checked;
|
|
11664
|
+
this._createModelForSelectListWithNumberOutput();
|
|
11665
|
+
break;
|
|
11666
|
+
case this.modes.Slider:
|
|
11667
|
+
this._createModelForSliderMode();
|
|
11668
|
+
break;
|
|
11669
|
+
case this.modes.CheckboxToText:
|
|
11670
|
+
this._createModelForCheckboxToText();
|
|
11671
|
+
break;
|
|
11672
|
+
case this.modes.CheckboxToSimpleText:
|
|
11673
|
+
this._createModelForCheckboxToSimpleText();
|
|
11674
|
+
break;
|
|
11675
|
+
case this.modes.CheckboxToBinary:
|
|
11676
|
+
this._createModelForCheckboxToBinary();
|
|
11677
|
+
break;
|
|
11678
|
+
case this.modes.DateRangeField:
|
|
11679
|
+
this._createModelForDateRange(model);
|
|
11680
|
+
break;
|
|
11681
|
+
case this.modes.TextField:
|
|
11682
|
+
this._model = (typeof this._model === 'string' && this._model.length === 0) ? undefined : this._model;
|
|
11683
|
+
break;
|
|
11672
11684
|
}
|
|
11673
11685
|
this.modelChange.emit(this._model);
|
|
11686
|
+
this.collectionChange.emit(this.collection);
|
|
11687
|
+
};
|
|
11688
|
+
FilterItemComponent.prototype.valueSelected = function () {
|
|
11689
|
+
if (this.collection) {
|
|
11690
|
+
return !!this.collection.find(function (c) { return c.checked; });
|
|
11691
|
+
}
|
|
11692
|
+
return false;
|
|
11693
|
+
};
|
|
11694
|
+
// Applies filter to the collection.
|
|
11695
|
+
FilterItemComponent.prototype.applyFilter = function (text) {
|
|
11696
|
+
var _a, _b;
|
|
11697
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11698
|
+
var _c, filterText, filteredItemCount;
|
|
11699
|
+
return __generator(this, function (_d) {
|
|
11700
|
+
switch (_d.label) {
|
|
11701
|
+
case 0:
|
|
11702
|
+
if (!(!isNaN(this.minSearchCharsToLoadCollection) && this.collectionLoadFn)) return [3 /*break*/, 3];
|
|
11703
|
+
if (!(text.length === this.minSearchCharsToLoadCollection && text.length > this.filterText.length)) return [3 /*break*/, 2];
|
|
11704
|
+
_c = this;
|
|
11705
|
+
return [4 /*yield*/, this.collectionLoadFn(text)];
|
|
11706
|
+
case 1:
|
|
11707
|
+
_c.collection = _d.sent();
|
|
11708
|
+
return [3 /*break*/, 3];
|
|
11709
|
+
case 2:
|
|
11710
|
+
if (text.length < this.minSearchCharsToLoadCollection) {
|
|
11711
|
+
this.collection = undefined;
|
|
11712
|
+
}
|
|
11713
|
+
_d.label = 3;
|
|
11714
|
+
case 3:
|
|
11715
|
+
this.filterText = text;
|
|
11716
|
+
if (!this.collection) {
|
|
11717
|
+
return [2 /*return*/, []];
|
|
11718
|
+
}
|
|
11719
|
+
filterText = (_a = this.filterText) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase();
|
|
11720
|
+
filteredItemCount = 0;
|
|
11721
|
+
this.filteredCollection = (_b = this.collection) === null || _b === void 0 ? void 0 : _b.filter(function (item) {
|
|
11722
|
+
var _a;
|
|
11723
|
+
var labelText = (_a = item.description) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase();
|
|
11724
|
+
var isHiddenByFilter = ((labelText === null || labelText === void 0 ? void 0 : labelText.indexOf(filterText)) === -1);
|
|
11725
|
+
if (isHiddenByFilter) {
|
|
11726
|
+
return false;
|
|
11727
|
+
}
|
|
11728
|
+
else {
|
|
11729
|
+
filteredItemCount++;
|
|
11730
|
+
return true;
|
|
11731
|
+
}
|
|
11732
|
+
});
|
|
11733
|
+
return [2 /*return*/];
|
|
11734
|
+
}
|
|
11735
|
+
});
|
|
11736
|
+
});
|
|
11737
|
+
};
|
|
11738
|
+
FilterItemComponent.prototype.onButtonClicked = function () {
|
|
11739
|
+
this.filterButtonClicked.emit();
|
|
11674
11740
|
};
|
|
11675
11741
|
FilterItemComponent.prototype.uncheckForSingleSelect = function (model) {
|
|
11676
11742
|
this.collection.forEach(function (m) {
|
|
@@ -11679,7 +11745,42 @@
|
|
|
11679
11745
|
}
|
|
11680
11746
|
});
|
|
11681
11747
|
};
|
|
11682
|
-
FilterItemComponent.prototype.
|
|
11748
|
+
FilterItemComponent.prototype.readModelForMode = function (newModel) {
|
|
11749
|
+
switch (this.mode) {
|
|
11750
|
+
case this.modes.Filterlist:
|
|
11751
|
+
this._readModelForFilterList(newModel);
|
|
11752
|
+
break;
|
|
11753
|
+
case this.modes.SingleSelectList:
|
|
11754
|
+
this._readModelForSingleSelectList(newModel);
|
|
11755
|
+
break;
|
|
11756
|
+
case this.modes.SelectListWithStringCollectionOutput:
|
|
11757
|
+
this._readModelForStringCollectionList(newModel);
|
|
11758
|
+
break;
|
|
11759
|
+
case this.modes.SelectListWithNumberOutput:
|
|
11760
|
+
this._readModelForSelectListWithNumberOutput(newModel);
|
|
11761
|
+
break;
|
|
11762
|
+
case this.modes.Slider:
|
|
11763
|
+
this._readModelForSliderMode(newModel);
|
|
11764
|
+
break;
|
|
11765
|
+
case this.modes.CheckboxToText:
|
|
11766
|
+
case this.modes.CheckboxToSimpleText:
|
|
11767
|
+
this._readModelForCheckboxToText(newModel);
|
|
11768
|
+
break;
|
|
11769
|
+
case this.modes.CheckboxToBinary:
|
|
11770
|
+
this._readModelForCheckboxToBinary(newModel);
|
|
11771
|
+
break;
|
|
11772
|
+
case this.modes.DateField:
|
|
11773
|
+
this._readModelForDateField(newModel);
|
|
11774
|
+
break;
|
|
11775
|
+
case this.modes.DateRangeField:
|
|
11776
|
+
this._readModelForDateRangeField(newModel);
|
|
11777
|
+
break;
|
|
11778
|
+
}
|
|
11779
|
+
};
|
|
11780
|
+
/////////////////////////////////////////////////////////////
|
|
11781
|
+
//Model creation for all of the different options available//
|
|
11782
|
+
/////////////////////////////////////////////////////////////
|
|
11783
|
+
FilterItemComponent.prototype._createModelForFilterList = function () {
|
|
11683
11784
|
var filterRange = [];
|
|
11684
11785
|
if (this.collection !== null && this.collection !== undefined) {
|
|
11685
11786
|
this.collection.forEach(function (viewModel) {
|
|
@@ -11687,28 +11788,43 @@
|
|
|
11687
11788
|
filterRange.push("?='" + viewModel.code + "'");
|
|
11688
11789
|
}
|
|
11689
11790
|
});
|
|
11690
|
-
|
|
11791
|
+
if (filterRange.length > 0) {
|
|
11792
|
+
this._model = filterRange.join(',');
|
|
11793
|
+
}
|
|
11794
|
+
else {
|
|
11795
|
+
this._model = undefined;
|
|
11796
|
+
}
|
|
11691
11797
|
}
|
|
11692
11798
|
};
|
|
11693
|
-
FilterItemComponent.prototype.
|
|
11799
|
+
FilterItemComponent.prototype._createModelForStringCollectionList = function () {
|
|
11694
11800
|
var filterRange = [];
|
|
11695
11801
|
this.collection.forEach(function (viewModel) {
|
|
11696
11802
|
if (viewModel.checked) {
|
|
11697
11803
|
filterRange.push(viewModel.code.toString());
|
|
11698
11804
|
}
|
|
11699
11805
|
});
|
|
11700
|
-
|
|
11806
|
+
if (filterRange.length > 0) {
|
|
11807
|
+
this._model = filterRange;
|
|
11808
|
+
}
|
|
11809
|
+
else {
|
|
11810
|
+
this._model = undefined;
|
|
11811
|
+
}
|
|
11701
11812
|
};
|
|
11702
|
-
FilterItemComponent.prototype.
|
|
11813
|
+
FilterItemComponent.prototype._createModelForSingleSelectList = function () {
|
|
11703
11814
|
var filterString = "";
|
|
11704
11815
|
this.collection.forEach(function (viewModel) {
|
|
11705
11816
|
if (viewModel.checked) {
|
|
11706
11817
|
filterString = viewModel.code.toString();
|
|
11707
11818
|
}
|
|
11708
11819
|
});
|
|
11709
|
-
|
|
11820
|
+
if (filterString.length > 0) {
|
|
11821
|
+
this._model = filterString;
|
|
11822
|
+
}
|
|
11823
|
+
else {
|
|
11824
|
+
this._model = undefined;
|
|
11825
|
+
}
|
|
11710
11826
|
};
|
|
11711
|
-
FilterItemComponent.prototype.
|
|
11827
|
+
FilterItemComponent.prototype._createModelForSelectListWithNumberOutput = function () {
|
|
11712
11828
|
var filterNumber = null;
|
|
11713
11829
|
this.collection.forEach(function (viewModel) {
|
|
11714
11830
|
if (viewModel.checked) {
|
|
@@ -11720,14 +11836,14 @@
|
|
|
11720
11836
|
});
|
|
11721
11837
|
this._model = filterNumber;
|
|
11722
11838
|
};
|
|
11723
|
-
FilterItemComponent.prototype.
|
|
11839
|
+
FilterItemComponent.prototype._createModelForSliderMode = function () {
|
|
11724
11840
|
this.sliderMin = !!this.sliderMin ? this.sliderMin : this.sliderDefaultMin;
|
|
11725
11841
|
this.sliderMax = !!this.sliderMax ? this.sliderMax : this.sliderDefaultMax;
|
|
11726
11842
|
var trueLowerBound = Math.min(this.sliderMin, this.sliderMax);
|
|
11727
11843
|
var trueUpperBound = Math.max(this.sliderMin, this.sliderMax);
|
|
11728
11844
|
this._model = trueLowerBound + " - " + trueUpperBound;
|
|
11729
11845
|
};
|
|
11730
|
-
FilterItemComponent.prototype.
|
|
11846
|
+
FilterItemComponent.prototype._createModelForCheckboxToText = function () {
|
|
11731
11847
|
if (this.checkBoxToTextModel) {
|
|
11732
11848
|
this._model = "?='J'";
|
|
11733
11849
|
}
|
|
@@ -11735,7 +11851,7 @@
|
|
|
11735
11851
|
this._model = "?='N'";
|
|
11736
11852
|
}
|
|
11737
11853
|
};
|
|
11738
|
-
FilterItemComponent.prototype.
|
|
11854
|
+
FilterItemComponent.prototype._createModelForCheckboxToSimpleText = function () {
|
|
11739
11855
|
if (this.checkBoxToTextModel) {
|
|
11740
11856
|
this._model = "J";
|
|
11741
11857
|
}
|
|
@@ -11743,7 +11859,7 @@
|
|
|
11743
11859
|
this._model = "N";
|
|
11744
11860
|
}
|
|
11745
11861
|
};
|
|
11746
|
-
FilterItemComponent.prototype.
|
|
11862
|
+
FilterItemComponent.prototype._createModelForCheckboxToBinary = function () {
|
|
11747
11863
|
if (this.checkBoxToTextModel) {
|
|
11748
11864
|
this._model = 1;
|
|
11749
11865
|
}
|
|
@@ -11751,14 +11867,13 @@
|
|
|
11751
11867
|
this._model = 0;
|
|
11752
11868
|
}
|
|
11753
11869
|
};
|
|
11754
|
-
FilterItemComponent.prototype.
|
|
11870
|
+
FilterItemComponent.prototype._createModelForDateRange = function (dates) {
|
|
11755
11871
|
if (dates) {
|
|
11756
11872
|
var startDate = dates[0];
|
|
11757
11873
|
var endDate = dates[1];
|
|
11758
11874
|
var startDateRequest = startDate ? this._formatDateToString(startDate) : '';
|
|
11759
11875
|
var endDateRequest = endDate ? this._formatDateToString(endDate) : '';
|
|
11760
|
-
|
|
11761
|
-
this._model = filter;
|
|
11876
|
+
this._model = "?>='" + startDateRequest + "'& ?<='" + endDateRequest + "'";
|
|
11762
11877
|
}
|
|
11763
11878
|
};
|
|
11764
11879
|
FilterItemComponent.prototype._formatDateToString = function (date) {
|
|
@@ -11767,24 +11882,25 @@
|
|
|
11767
11882
|
var year = date.getFullYear();
|
|
11768
11883
|
return day + "-" + month + "-" + year;
|
|
11769
11884
|
};
|
|
11770
|
-
|
|
11885
|
+
////////////////////////////////////////////////////////////
|
|
11886
|
+
//Model reading for all of the different options available//
|
|
11887
|
+
////////////////////////////////////////////////////////////
|
|
11888
|
+
FilterItemComponent.prototype._readModelForFilterList = function (filterModel) {
|
|
11771
11889
|
var e_1, _c;
|
|
11772
11890
|
var filterList = [];
|
|
11773
11891
|
var itemsToCheck = [];
|
|
11774
|
-
this.
|
|
11775
|
-
|
|
11892
|
+
this._uncheckAll();
|
|
11893
|
+
this._model = filterModel;
|
|
11894
|
+
if (filterModel !== null && filterModel !== undefined && typeof filterModel === 'string' && filterModel.length != 0 && this.collection !== null && this.collection !== undefined) {
|
|
11776
11895
|
filterList = filterModel.split(",");
|
|
11777
11896
|
filterList.forEach(function (filter) {
|
|
11778
11897
|
itemsToCheck.push(filter.substr(3, filter.length - 4));
|
|
11779
11898
|
});
|
|
11780
11899
|
var _loop_1 = function (item) {
|
|
11781
11900
|
var filter = this_1.collection.find(function (element) { return element.code.toString() === item; });
|
|
11782
|
-
if (filter) {
|
|
11901
|
+
if (filter !== null && filter !== undefined) {
|
|
11783
11902
|
filter.checked = true;
|
|
11784
11903
|
}
|
|
11785
|
-
else {
|
|
11786
|
-
filter.checked = false;
|
|
11787
|
-
}
|
|
11788
11904
|
};
|
|
11789
11905
|
var this_1 = this;
|
|
11790
11906
|
try {
|
|
@@ -11802,25 +11918,23 @@
|
|
|
11802
11918
|
}
|
|
11803
11919
|
this._model = filterModel;
|
|
11804
11920
|
}
|
|
11805
|
-
else {
|
|
11806
|
-
this._model = undefined;
|
|
11807
|
-
}
|
|
11808
11921
|
};
|
|
11809
|
-
FilterItemComponent.prototype.
|
|
11810
|
-
this.
|
|
11811
|
-
|
|
11812
|
-
|
|
11813
|
-
|
|
11922
|
+
FilterItemComponent.prototype._readModelForSingleSelectList = function (singleSelectModel) {
|
|
11923
|
+
this._uncheckAll();
|
|
11924
|
+
this._model = singleSelectModel;
|
|
11925
|
+
if (singleSelectModel !== null && singleSelectModel !== undefined && this.collection !== null && this.collection !== undefined) {
|
|
11926
|
+
var filter = this.collection.find(function (element) { return element.code.toString() === singleSelectModel; });
|
|
11927
|
+
if (filter !== null && filter !== undefined) {
|
|
11814
11928
|
filter.checked = true;
|
|
11815
11929
|
}
|
|
11816
|
-
this.createModelForSingleSelectList();
|
|
11817
11930
|
}
|
|
11818
11931
|
};
|
|
11819
|
-
FilterItemComponent.prototype.
|
|
11820
|
-
this.
|
|
11932
|
+
FilterItemComponent.prototype._readModelForStringCollectionList = function (collectionModel) {
|
|
11933
|
+
this._uncheckAll();
|
|
11934
|
+
this._model = collectionModel;
|
|
11821
11935
|
if (collectionModel !== null && collectionModel !== undefined && this.collection !== null && this.collection !== undefined) {
|
|
11822
11936
|
this.collection.forEach(function (viewModel) {
|
|
11823
|
-
if (collectionModel.indexOf(viewModel.code) > -1) {
|
|
11937
|
+
if (collectionModel.indexOf(viewModel.code.toString()) > -1) {
|
|
11824
11938
|
viewModel.checked = true;
|
|
11825
11939
|
}
|
|
11826
11940
|
else {
|
|
@@ -11829,10 +11943,11 @@
|
|
|
11829
11943
|
});
|
|
11830
11944
|
}
|
|
11831
11945
|
};
|
|
11832
|
-
FilterItemComponent.prototype.
|
|
11946
|
+
FilterItemComponent.prototype._readModelForSelectListWithNumberOutput = function (numberModel) {
|
|
11833
11947
|
var e_2, _c;
|
|
11834
|
-
this.
|
|
11835
|
-
|
|
11948
|
+
this._uncheckAll();
|
|
11949
|
+
this._model = numberModel;
|
|
11950
|
+
if (numberModel !== null && numberModel !== undefined && this.collection !== null && this.collection !== undefined) {
|
|
11836
11951
|
try {
|
|
11837
11952
|
for (var _d = __values(this.collection), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
11838
11953
|
var item = _e.value;
|
|
@@ -11850,14 +11965,15 @@
|
|
|
11850
11965
|
}
|
|
11851
11966
|
}
|
|
11852
11967
|
};
|
|
11853
|
-
FilterItemComponent.prototype.
|
|
11968
|
+
FilterItemComponent.prototype._uncheckAll = function () {
|
|
11854
11969
|
if (this.collection !== null && this.collection !== undefined) {
|
|
11855
11970
|
this.collection.forEach(function (m) {
|
|
11856
11971
|
m.checked = false;
|
|
11857
11972
|
});
|
|
11858
11973
|
}
|
|
11859
11974
|
};
|
|
11860
|
-
FilterItemComponent.prototype.
|
|
11975
|
+
FilterItemComponent.prototype._readModelForSliderMode = function (sliderModel) {
|
|
11976
|
+
this._model = sliderModel;
|
|
11861
11977
|
if (sliderModel !== undefined && sliderModel !== null) {
|
|
11862
11978
|
var sliderInputCollection = sliderModel.split(' - ');
|
|
11863
11979
|
this.sliderMin = parseInt(sliderInputCollection[0]);
|
|
@@ -11868,7 +11984,8 @@
|
|
|
11868
11984
|
this.sliderMax = this.sliderDefaultMax;
|
|
11869
11985
|
}
|
|
11870
11986
|
};
|
|
11871
|
-
FilterItemComponent.prototype.
|
|
11987
|
+
FilterItemComponent.prototype._readModelForCheckboxToText = function (checkboxToTextModel) {
|
|
11988
|
+
this._model = checkboxToTextModel;
|
|
11872
11989
|
if (checkboxToTextModel !== undefined && checkboxToTextModel !== null) {
|
|
11873
11990
|
this.checkBoxToTextModel = (checkboxToTextModel.indexOf('J') > -1);
|
|
11874
11991
|
}
|
|
@@ -11876,7 +11993,8 @@
|
|
|
11876
11993
|
this.checkBoxToTextModel = false;
|
|
11877
11994
|
}
|
|
11878
11995
|
};
|
|
11879
|
-
FilterItemComponent.prototype.
|
|
11996
|
+
FilterItemComponent.prototype._readModelForCheckboxToBinary = function (checkboxToBinary) {
|
|
11997
|
+
this._model = checkboxToBinary;
|
|
11880
11998
|
if (checkboxToBinary !== undefined && checkboxToBinary !== null) {
|
|
11881
11999
|
this.checkBoxToTextModel = (checkboxToBinary >= 1);
|
|
11882
12000
|
}
|
|
@@ -11884,7 +12002,8 @@
|
|
|
11884
12002
|
this.checkBoxToTextModel = false;
|
|
11885
12003
|
}
|
|
11886
12004
|
};
|
|
11887
|
-
FilterItemComponent.prototype.
|
|
12005
|
+
FilterItemComponent.prototype._readModelForDateField = function (dateFieldModel) {
|
|
12006
|
+
this._model = dateFieldModel;
|
|
11888
12007
|
if (dateFieldModel !== undefined && dateFieldModel !== null) {
|
|
11889
12008
|
this._model = new Date(dateFieldModel);
|
|
11890
12009
|
}
|
|
@@ -11892,7 +12011,8 @@
|
|
|
11892
12011
|
this._model = undefined;
|
|
11893
12012
|
}
|
|
11894
12013
|
};
|
|
11895
|
-
FilterItemComponent.prototype.
|
|
12014
|
+
FilterItemComponent.prototype._readModelForDateRangeField = function (dateRangeFieldModel) {
|
|
12015
|
+
this._model = dateRangeFieldModel;
|
|
11896
12016
|
if (dateRangeFieldModel !== undefined && dateRangeFieldModel !== null) {
|
|
11897
12017
|
var dateCollection = dateRangeFieldModel.split('&');
|
|
11898
12018
|
var startString = dateCollection[0].trim().substr(4, dateCollection[0].length - 5);
|
|
@@ -11902,72 +12022,24 @@
|
|
|
11902
12022
|
this.dateRangeStart = new Date(parseInt(startDateComponents[2]), parseInt(startDateComponents[1]) - 1, parseInt(startDateComponents[0]));
|
|
11903
12023
|
this.dateRangeEnd = new Date(parseInt(endDateComponents[2]), parseInt(endDateComponents[1]) - 1, parseInt(endDateComponents[0]));
|
|
11904
12024
|
}
|
|
11905
|
-
|
|
11906
|
-
|
|
11907
|
-
|
|
11908
|
-
return !!this.collection.find(function (c) { return c.checked; });
|
|
12025
|
+
else {
|
|
12026
|
+
this.dateRangeStart = undefined;
|
|
12027
|
+
this.dateRangeEnd = undefined;
|
|
11909
12028
|
}
|
|
11910
|
-
return false;
|
|
11911
|
-
};
|
|
11912
|
-
// Applies filter to the collection.
|
|
11913
|
-
FilterItemComponent.prototype.applyFilter = function (text) {
|
|
11914
|
-
var _a, _b;
|
|
11915
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
11916
|
-
var _c, filterText, filteredItemCount;
|
|
11917
|
-
return __generator(this, function (_d) {
|
|
11918
|
-
switch (_d.label) {
|
|
11919
|
-
case 0:
|
|
11920
|
-
if (!(!isNaN(this.minSearchCharsToLoadCollection) && this.collectionLoadFn)) return [3 /*break*/, 3];
|
|
11921
|
-
if (!(text.length === this.minSearchCharsToLoadCollection && text.length > this.filterText.length)) return [3 /*break*/, 2];
|
|
11922
|
-
_c = this;
|
|
11923
|
-
return [4 /*yield*/, this.collectionLoadFn(text)];
|
|
11924
|
-
case 1:
|
|
11925
|
-
_c.collection = _d.sent();
|
|
11926
|
-
return [3 /*break*/, 3];
|
|
11927
|
-
case 2:
|
|
11928
|
-
if (text.length < this.minSearchCharsToLoadCollection) {
|
|
11929
|
-
this.collection = undefined;
|
|
11930
|
-
}
|
|
11931
|
-
_d.label = 3;
|
|
11932
|
-
case 3:
|
|
11933
|
-
this.filterText = text;
|
|
11934
|
-
if (!this.collection) {
|
|
11935
|
-
return [2 /*return*/, []];
|
|
11936
|
-
}
|
|
11937
|
-
filterText = (_a = this.filterText) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase();
|
|
11938
|
-
filteredItemCount = 0;
|
|
11939
|
-
this.filteredCollection = (_b = this.collection) === null || _b === void 0 ? void 0 : _b.filter(function (item) {
|
|
11940
|
-
var _a;
|
|
11941
|
-
var labelText = (_a = item.description) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase();
|
|
11942
|
-
var isHiddenByFilter = ((labelText === null || labelText === void 0 ? void 0 : labelText.indexOf(filterText)) === -1);
|
|
11943
|
-
if (isHiddenByFilter) {
|
|
11944
|
-
return false;
|
|
11945
|
-
}
|
|
11946
|
-
else {
|
|
11947
|
-
filteredItemCount++;
|
|
11948
|
-
return true;
|
|
11949
|
-
}
|
|
11950
|
-
});
|
|
11951
|
-
return [2 /*return*/];
|
|
11952
|
-
}
|
|
11953
|
-
});
|
|
11954
|
-
});
|
|
11955
|
-
};
|
|
11956
|
-
FilterItemComponent.prototype.onButtonClicked = function () {
|
|
11957
|
-
this.filterButtonClicked.emit();
|
|
11958
12029
|
};
|
|
11959
12030
|
return FilterItemComponent;
|
|
11960
12031
|
}());
|
|
11961
12032
|
FilterItemComponent.decorators = [
|
|
11962
12033
|
{ type: i0.Component, args: [{
|
|
11963
12034
|
selector: "co-filter-item",
|
|
11964
|
-
template: "\n <div class=\"co-filter-item-header\">\n <co-collapsible\n [headerTitle]=\"placeholder\"\n [expandButtonLast]=\"true\"\n [iconData]=\"iconService.getIcon(icons.ArrowPointDown)\"\n [expanded]=\"expanded\"\n [showButton]=\"showButton\"\n [buttonText]=\"filterButtonLabel\"\n (buttonClicked)=\"onButtonClicked()\"\n >\n <div class=\"co-filter-item-collapsable-content\">\n <div class=\"co-filter-item-custom-content\" *ngIf=\"customContent; else collectionContent\"\n (keydown)=\"showButton=true\" (mousedown)=\"showButton=true\">\n <ng-content></ng-content>\n </div>\n <ng-template #collectionContent
|
|
12035
|
+
template: "\n <div class=\"co-filter-item-header\">\n <co-collapsible\n [headerTitle]=\"placeholder\"\n [expandButtonLast]=\"true\"\n [iconData]=\"iconService.getIcon(icons.ArrowPointDown)\"\n [expanded]=\"expanded\"\n [showButton]=\"showButton\"\n [buttonText]=\"filterButtonLabel\"\n (buttonClicked)=\"onButtonClicked()\"\n >\n <div class=\"co-filter-item-collapsable-content\">\n <div class=\"co-filter-item-custom-content\" *ngIf=\"customContent; else collectionContent\"\n (keydown)=\"showButton=true\" (mousedown)=\"showButton=true\">\n <ng-content></ng-content>\n </div>\n <ng-template #collectionContent>\n <div class=\"co-filter-item-collection-content\" *ngIf=\"mode === modes.Filterlist || mode === modes.SingleSelectList\n || mode === modes.SelectListWithNumberOutput || mode === modes.SelectListWithStringCollectionOutput\">\n <co-input-text\n *ngIf=\"collection?.length > 10 || minSearchCharsToLoadCollection\"\n [placeholder]=\"searchPlaceholder\"\n [model]=\"filterText\"\n (modelChange)=\"applyFilter($event)\"\n >\n </co-input-text>\n <div class=\"no-results\" *ngIf=\"filteredCollection?.length === 0\">\n <span [textContent]=\"noResultsLabel\"></span>\n </div>\n <div class=\"co-filter-item-collection-results\">\n <ng-container\n *ngFor=\"let option of filteredCollection; let index = index\">\n <div class=\"co-filter-item-collection-result-item\" *ngIf=\"index < limitTo || showAllResults\">\n <co-input-checkbox *ngIf=\"mode !== modes.SingleSelectList\"\n [label]=\"option.description\"\n [model]=\"option.checked\"\n [clickableLabel]=\"false\"\n (modelChange)=\"handleModelChange(option)\"\n ></co-input-checkbox>\n <co-input-radio-button *ngIf=\"mode === modes.SingleSelectList\"\n [label]=\"option.description\"\n [model]=\"option.checked\"\n (modelChange)=\"handleModelChange(option)\"\n ></co-input-radio-button>\n <div class=\"co-filter-item-amount\" *ngIf=\"option.count\"\n [textContent]=\"option.count.toString() | append: ')' | prepend: ' ('\"\n ></div>\n </div>\n\n </ng-container>\n </div>\n <div class=\"co-filter-show-more-or-less\" *ngIf=\"!showAllResults\">\n <div class=\"co-filter-show-more clickable\"\n *ngIf=\"moreToShow()\">\n <a (click)=\"increaseLimit()\">\n <co-icon [iconData]=\"iconService.getIcon(icons.ArrowPointDown)\"></co-icon>\n <span [textContent]=\"showMoreLabel\"></span>\n </a>\n </div>\n <div class=\"co-filter-show-less clickable\"\n *ngIf=\"lessToShow()\">\n <a (click)=\"setToInitialLimit()\">\n <co-icon [iconData]=\"iconService.getIcon(icons.ArrowPointUp)\"></co-icon>\n <span [textContent]=\"showLessLabel\"></span>\n </a>\n </div>\n </div>\n </div>\n <div class=\"co-filter-item-slider-content\" *ngIf=\"mode === modes.Slider\">\n <co-input-text\n class=\"slider-from\"\n [type]=\"'number'\"\n [digitsOnly]=\"true\"\n [hideArrowButtons]=\"true\"\n [excludePlusMinus]=\"true\"\n [label]=\"'FROM' | localize\"\n [(model)]=\"sliderMin\"\n (modelChange)=\"handleModelChange($event)\"\n ></co-input-text>\n <co-input-text\n class=\"slider-to\"\n [type]=\"'number'\"\n [digitsOnly]=\"true\"\n [hideArrowButtons]=\"true\"\n [excludePlusMinus]=\"true\"\n [label]=\"'TO' | localize\"\n [(model)]=\"sliderMax\"\n (modelChange)=\"handleModelChange($event)\"\n ></co-input-text>\n </div>\n <div class=\"co-filter-item-checkbox-content\" *ngIf=\"mode === modes.Checkbox \">\n <co-input-checkbox\n [(model)]=\"model\"\n (modelChange)=\"handleModelChange($event)\"></co-input-checkbox>\n </div>\n <div class=\"co-filter-item-checkbox-content\"\n *ngIf=\"mode === modes.CheckboxToText || mode === modes.CheckboxToSimpleText || mode === modes.CheckboxToBinary\">\n <co-input-checkbox\n [(model)]=\"checkBoxToTextModel\"\n (modelChange)=\"handleModelChange($event)\"></co-input-checkbox>\n </div>\n <div class=\"co-filter-item-textfield-content\" *ngIf=\"mode === modes.TextField\">\n <co-input-text\n [(model)]=\"model\"\n (modelChange)=\"handleModelChange($event)\"></co-input-text>\n </div>\n <div class=\"co-filter-item-dateField-content\" *ngIf=\"mode === modes.DateField\">\n <co-input-date\n [(model)]=\"model\"\n (modelChange)=\"handleModelChange($event)\"\n ></co-input-date>\n </div>\n <div class=\"co-filter-item-dateField-content\" *ngIf=\"mode === modes.DateRangeField\">\n <co-input-date-range\n [model]=\"[dateRangeStart, dateRangeEnd]\"\n (modelChange)=\"handleModelChange($event)\"\n [placeholder]=\"'SELECT_DATE' | localize\">\n </co-input-date-range>\n </div>\n </ng-template>\n </div>\n </co-collapsible>\n </div>\n\n ",
|
|
11965
12036
|
encapsulation: i0.ViewEncapsulation.None,
|
|
11966
12037
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
11967
12038
|
},] }
|
|
11968
12039
|
];
|
|
11969
12040
|
FilterItemComponent.ctorParameters = function () { return [
|
|
11970
|
-
{ type: IconCacheService }
|
|
12041
|
+
{ type: IconCacheService },
|
|
12042
|
+
{ type: i0.ChangeDetectorRef }
|
|
11971
12043
|
]; };
|
|
11972
12044
|
FilterItemComponent.propDecorators = {
|
|
11973
12045
|
mode: [{ type: i0.Input }],
|