@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
|
@@ -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,18 @@
|
|
|
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.
|
|
11560
|
+
this.mode = this.modes.Filterlist;
|
|
11531
11561
|
this.initialLimit = 10;
|
|
11532
11562
|
this.expanded = false;
|
|
11533
11563
|
// Set to false to use filter item with a multi selectable collection. Set to true to specify custom content
|
|
11534
11564
|
this.customContent = false;
|
|
11535
11565
|
// Set to true to show all results. Set to false to get 'show more' and 'show less' buttons to expand and contract.
|
|
11536
11566
|
this.showAllResults = false;
|
|
11537
|
-
//@Input()
|
|
11538
|
-
//public singleSelect: boolean = false;
|
|
11539
11567
|
this.filterButtonLabel = "Search";
|
|
11540
11568
|
this.searchPlaceholder = 'Search...';
|
|
11541
11569
|
this.showMoreLabel = 'Show more';
|
|
@@ -11560,6 +11588,8 @@
|
|
|
11560
11588
|
var _a;
|
|
11561
11589
|
this._collection = value;
|
|
11562
11590
|
this.filteredCollection = (_a = this._collection) === null || _a === void 0 ? void 0 : _a.slice();
|
|
11591
|
+
//reset the model in case there was no collection to set its values on when it was set.
|
|
11592
|
+
this.model = this._model;
|
|
11563
11593
|
},
|
|
11564
11594
|
enumerable: false,
|
|
11565
11595
|
configurable: true
|
|
@@ -11569,35 +11599,35 @@
|
|
|
11569
11599
|
return this._model;
|
|
11570
11600
|
},
|
|
11571
11601
|
set: function (filterString) {
|
|
11572
|
-
|
|
11573
|
-
this.
|
|
11574
|
-
|
|
11575
|
-
|
|
11576
|
-
this.
|
|
11577
|
-
|
|
11578
|
-
|
|
11579
|
-
this.
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
this.
|
|
11583
|
-
|
|
11584
|
-
|
|
11585
|
-
this.
|
|
11586
|
-
|
|
11587
|
-
|
|
11588
|
-
this.
|
|
11589
|
-
|
|
11590
|
-
|
|
11591
|
-
|
|
11592
|
-
|
|
11593
|
-
|
|
11594
|
-
|
|
11595
|
-
|
|
11596
|
-
|
|
11597
|
-
|
|
11598
|
-
|
|
11599
|
-
|
|
11600
|
-
|
|
11602
|
+
switch (this.mode) {
|
|
11603
|
+
case this.modes.Filterlist:
|
|
11604
|
+
this._readModelForFilterList(filterString);
|
|
11605
|
+
break;
|
|
11606
|
+
case this.modes.SingleSelectList:
|
|
11607
|
+
this._readModelForSingleSelectList(filterString);
|
|
11608
|
+
break;
|
|
11609
|
+
case this.modes.SelectListWithStringCollectionOutput:
|
|
11610
|
+
this._readModelForStringCollectionList(filterString);
|
|
11611
|
+
break;
|
|
11612
|
+
case this.modes.SelectListWithNumberOutput:
|
|
11613
|
+
this._readModelForSelectListWithNumberOutput(filterString);
|
|
11614
|
+
break;
|
|
11615
|
+
case this.modes.Slider:
|
|
11616
|
+
this._readModelForSliderMode(filterString);
|
|
11617
|
+
break;
|
|
11618
|
+
case this.modes.CheckboxToText:
|
|
11619
|
+
case this.modes.CheckboxToSimpleText:
|
|
11620
|
+
this._readModelForCheckboxToText(filterString);
|
|
11621
|
+
break;
|
|
11622
|
+
case this.modes.CheckboxToBinary:
|
|
11623
|
+
this._readModelForCheckboxToBinary(filterString);
|
|
11624
|
+
break;
|
|
11625
|
+
case this.modes.DateField:
|
|
11626
|
+
this._readModelForDateField(filterString);
|
|
11627
|
+
break;
|
|
11628
|
+
case this.modes.DateRangeField:
|
|
11629
|
+
this._readModelForDateRangeField(filterString);
|
|
11630
|
+
break;
|
|
11601
11631
|
}
|
|
11602
11632
|
},
|
|
11603
11633
|
enumerable: false,
|
|
@@ -11606,8 +11636,6 @@
|
|
|
11606
11636
|
FilterItemComponent.prototype.ngOnInit = function () {
|
|
11607
11637
|
this.setToInitialLimit();
|
|
11608
11638
|
this.showButton = this.valueSelected();
|
|
11609
|
-
this.sliderMin = this.sliderDefaultMin;
|
|
11610
|
-
this.sliderMax = this.sliderDefaultMax;
|
|
11611
11639
|
this.checkBoxToTextModel = false;
|
|
11612
11640
|
};
|
|
11613
11641
|
FilterItemComponent.prototype.setToInitialLimit = function () {
|
|
@@ -11631,46 +11659,49 @@
|
|
|
11631
11659
|
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
11660
|
};
|
|
11633
11661
|
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
|
-
|
|
11662
|
+
switch (this.mode) {
|
|
11663
|
+
case this.modes.Filterlist:
|
|
11664
|
+
this.showButton = true;
|
|
11665
|
+
model.checked = !model.checked;
|
|
11666
|
+
this._createModelForFilterList();
|
|
11667
|
+
break;
|
|
11668
|
+
case this.modes.SelectListWithStringCollectionOutput:
|
|
11669
|
+
this.showButton = true;
|
|
11670
|
+
model.checked = !model.checked;
|
|
11671
|
+
this._createModelForStringCollectionList();
|
|
11672
|
+
break;
|
|
11673
|
+
case this.modes.SingleSelectList:
|
|
11674
|
+
this.showButton = true;
|
|
11675
|
+
this.uncheckForSingleSelect(model);
|
|
11676
|
+
model.checked = !model.checked;
|
|
11677
|
+
this._createModelForSingleSelectList();
|
|
11678
|
+
break;
|
|
11679
|
+
case this.modes.SelectListWithNumberOutput:
|
|
11680
|
+
this.showButton = true;
|
|
11681
|
+
model.checked = !model.checked;
|
|
11682
|
+
this._createModelForSelectListWithNumberOutput();
|
|
11683
|
+
break;
|
|
11684
|
+
case this.modes.Slider:
|
|
11685
|
+
this._createModelForSliderMode();
|
|
11686
|
+
break;
|
|
11687
|
+
case this.modes.CheckboxToText:
|
|
11688
|
+
this._createModelForCheckboxToText();
|
|
11689
|
+
break;
|
|
11690
|
+
case this.modes.CheckboxToSimpleText:
|
|
11691
|
+
this._createModelForCheckboxToSimpleText();
|
|
11692
|
+
break;
|
|
11693
|
+
case this.modes.CheckboxToBinary:
|
|
11694
|
+
this._createModelForCheckboxToBinary();
|
|
11695
|
+
break;
|
|
11696
|
+
case this.modes.DateRangeField:
|
|
11697
|
+
this._createModelForDateRange(model);
|
|
11698
|
+
break;
|
|
11699
|
+
case this.modes.TextField:
|
|
11700
|
+
this._model = (typeof this._model === 'string' && this._model.length === 0) ? undefined : this._model;
|
|
11701
|
+
break;
|
|
11672
11702
|
}
|
|
11673
11703
|
this.modelChange.emit(this._model);
|
|
11704
|
+
this.collectionChange.emit(this.collection);
|
|
11674
11705
|
};
|
|
11675
11706
|
FilterItemComponent.prototype.uncheckForSingleSelect = function (model) {
|
|
11676
11707
|
this.collection.forEach(function (m) {
|
|
@@ -11679,7 +11710,63 @@
|
|
|
11679
11710
|
}
|
|
11680
11711
|
});
|
|
11681
11712
|
};
|
|
11682
|
-
FilterItemComponent.prototype.
|
|
11713
|
+
FilterItemComponent.prototype.valueSelected = function () {
|
|
11714
|
+
if (this.collection) {
|
|
11715
|
+
return !!this.collection.find(function (c) { return c.checked; });
|
|
11716
|
+
}
|
|
11717
|
+
return false;
|
|
11718
|
+
};
|
|
11719
|
+
// Applies filter to the collection.
|
|
11720
|
+
FilterItemComponent.prototype.applyFilter = function (text) {
|
|
11721
|
+
var _a, _b;
|
|
11722
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11723
|
+
var _c, filterText, filteredItemCount;
|
|
11724
|
+
return __generator(this, function (_d) {
|
|
11725
|
+
switch (_d.label) {
|
|
11726
|
+
case 0:
|
|
11727
|
+
if (!(!isNaN(this.minSearchCharsToLoadCollection) && this.collectionLoadFn)) return [3 /*break*/, 3];
|
|
11728
|
+
if (!(text.length === this.minSearchCharsToLoadCollection && text.length > this.filterText.length)) return [3 /*break*/, 2];
|
|
11729
|
+
_c = this;
|
|
11730
|
+
return [4 /*yield*/, this.collectionLoadFn(text)];
|
|
11731
|
+
case 1:
|
|
11732
|
+
_c.collection = _d.sent();
|
|
11733
|
+
return [3 /*break*/, 3];
|
|
11734
|
+
case 2:
|
|
11735
|
+
if (text.length < this.minSearchCharsToLoadCollection) {
|
|
11736
|
+
this.collection = undefined;
|
|
11737
|
+
}
|
|
11738
|
+
_d.label = 3;
|
|
11739
|
+
case 3:
|
|
11740
|
+
this.filterText = text;
|
|
11741
|
+
if (!this.collection) {
|
|
11742
|
+
return [2 /*return*/, []];
|
|
11743
|
+
}
|
|
11744
|
+
filterText = (_a = this.filterText) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase();
|
|
11745
|
+
filteredItemCount = 0;
|
|
11746
|
+
this.filteredCollection = (_b = this.collection) === null || _b === void 0 ? void 0 : _b.filter(function (item) {
|
|
11747
|
+
var _a;
|
|
11748
|
+
var labelText = (_a = item.description) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase();
|
|
11749
|
+
var isHiddenByFilter = ((labelText === null || labelText === void 0 ? void 0 : labelText.indexOf(filterText)) === -1);
|
|
11750
|
+
if (isHiddenByFilter) {
|
|
11751
|
+
return false;
|
|
11752
|
+
}
|
|
11753
|
+
else {
|
|
11754
|
+
filteredItemCount++;
|
|
11755
|
+
return true;
|
|
11756
|
+
}
|
|
11757
|
+
});
|
|
11758
|
+
return [2 /*return*/];
|
|
11759
|
+
}
|
|
11760
|
+
});
|
|
11761
|
+
});
|
|
11762
|
+
};
|
|
11763
|
+
FilterItemComponent.prototype.onButtonClicked = function () {
|
|
11764
|
+
this.filterButtonClicked.emit();
|
|
11765
|
+
};
|
|
11766
|
+
/////////////////////////////////////////////////////////////
|
|
11767
|
+
//Model creation for all of the different options available//
|
|
11768
|
+
/////////////////////////////////////////////////////////////
|
|
11769
|
+
FilterItemComponent.prototype._createModelForFilterList = function () {
|
|
11683
11770
|
var filterRange = [];
|
|
11684
11771
|
if (this.collection !== null && this.collection !== undefined) {
|
|
11685
11772
|
this.collection.forEach(function (viewModel) {
|
|
@@ -11687,28 +11774,43 @@
|
|
|
11687
11774
|
filterRange.push("?='" + viewModel.code + "'");
|
|
11688
11775
|
}
|
|
11689
11776
|
});
|
|
11690
|
-
|
|
11777
|
+
if (filterRange.length > 0) {
|
|
11778
|
+
this._model = filterRange.join(',');
|
|
11779
|
+
}
|
|
11780
|
+
else {
|
|
11781
|
+
this._model = undefined;
|
|
11782
|
+
}
|
|
11691
11783
|
}
|
|
11692
11784
|
};
|
|
11693
|
-
FilterItemComponent.prototype.
|
|
11785
|
+
FilterItemComponent.prototype._createModelForStringCollectionList = function () {
|
|
11694
11786
|
var filterRange = [];
|
|
11695
11787
|
this.collection.forEach(function (viewModel) {
|
|
11696
11788
|
if (viewModel.checked) {
|
|
11697
11789
|
filterRange.push(viewModel.code.toString());
|
|
11698
11790
|
}
|
|
11699
11791
|
});
|
|
11700
|
-
|
|
11792
|
+
if (filterRange.length > 0) {
|
|
11793
|
+
this._model = filterRange;
|
|
11794
|
+
}
|
|
11795
|
+
else {
|
|
11796
|
+
this._model = undefined;
|
|
11797
|
+
}
|
|
11701
11798
|
};
|
|
11702
|
-
FilterItemComponent.prototype.
|
|
11799
|
+
FilterItemComponent.prototype._createModelForSingleSelectList = function () {
|
|
11703
11800
|
var filterString = "";
|
|
11704
11801
|
this.collection.forEach(function (viewModel) {
|
|
11705
11802
|
if (viewModel.checked) {
|
|
11706
11803
|
filterString = viewModel.code.toString();
|
|
11707
11804
|
}
|
|
11708
11805
|
});
|
|
11709
|
-
|
|
11806
|
+
if (filterString.length > 0) {
|
|
11807
|
+
this._model = filterString;
|
|
11808
|
+
}
|
|
11809
|
+
else {
|
|
11810
|
+
this._model = undefined;
|
|
11811
|
+
}
|
|
11710
11812
|
};
|
|
11711
|
-
FilterItemComponent.prototype.
|
|
11813
|
+
FilterItemComponent.prototype._createModelForSelectListWithNumberOutput = function () {
|
|
11712
11814
|
var filterNumber = null;
|
|
11713
11815
|
this.collection.forEach(function (viewModel) {
|
|
11714
11816
|
if (viewModel.checked) {
|
|
@@ -11720,14 +11822,14 @@
|
|
|
11720
11822
|
});
|
|
11721
11823
|
this._model = filterNumber;
|
|
11722
11824
|
};
|
|
11723
|
-
FilterItemComponent.prototype.
|
|
11825
|
+
FilterItemComponent.prototype._createModelForSliderMode = function () {
|
|
11724
11826
|
this.sliderMin = !!this.sliderMin ? this.sliderMin : this.sliderDefaultMin;
|
|
11725
11827
|
this.sliderMax = !!this.sliderMax ? this.sliderMax : this.sliderDefaultMax;
|
|
11726
11828
|
var trueLowerBound = Math.min(this.sliderMin, this.sliderMax);
|
|
11727
11829
|
var trueUpperBound = Math.max(this.sliderMin, this.sliderMax);
|
|
11728
11830
|
this._model = trueLowerBound + " - " + trueUpperBound;
|
|
11729
11831
|
};
|
|
11730
|
-
FilterItemComponent.prototype.
|
|
11832
|
+
FilterItemComponent.prototype._createModelForCheckboxToText = function () {
|
|
11731
11833
|
if (this.checkBoxToTextModel) {
|
|
11732
11834
|
this._model = "?='J'";
|
|
11733
11835
|
}
|
|
@@ -11735,7 +11837,7 @@
|
|
|
11735
11837
|
this._model = "?='N'";
|
|
11736
11838
|
}
|
|
11737
11839
|
};
|
|
11738
|
-
FilterItemComponent.prototype.
|
|
11840
|
+
FilterItemComponent.prototype._createModelForCheckboxToSimpleText = function () {
|
|
11739
11841
|
if (this.checkBoxToTextModel) {
|
|
11740
11842
|
this._model = "J";
|
|
11741
11843
|
}
|
|
@@ -11743,7 +11845,7 @@
|
|
|
11743
11845
|
this._model = "N";
|
|
11744
11846
|
}
|
|
11745
11847
|
};
|
|
11746
|
-
FilterItemComponent.prototype.
|
|
11848
|
+
FilterItemComponent.prototype._createModelForCheckboxToBinary = function () {
|
|
11747
11849
|
if (this.checkBoxToTextModel) {
|
|
11748
11850
|
this._model = 1;
|
|
11749
11851
|
}
|
|
@@ -11751,14 +11853,13 @@
|
|
|
11751
11853
|
this._model = 0;
|
|
11752
11854
|
}
|
|
11753
11855
|
};
|
|
11754
|
-
FilterItemComponent.prototype.
|
|
11856
|
+
FilterItemComponent.prototype._createModelForDateRange = function (dates) {
|
|
11755
11857
|
if (dates) {
|
|
11756
11858
|
var startDate = dates[0];
|
|
11757
11859
|
var endDate = dates[1];
|
|
11758
11860
|
var startDateRequest = startDate ? this._formatDateToString(startDate) : '';
|
|
11759
11861
|
var endDateRequest = endDate ? this._formatDateToString(endDate) : '';
|
|
11760
|
-
|
|
11761
|
-
this._model = filter;
|
|
11862
|
+
this._model = "?>='" + startDateRequest + "'& ?<='" + endDateRequest + "'";
|
|
11762
11863
|
}
|
|
11763
11864
|
};
|
|
11764
11865
|
FilterItemComponent.prototype._formatDateToString = function (date) {
|
|
@@ -11767,19 +11868,23 @@
|
|
|
11767
11868
|
var year = date.getFullYear();
|
|
11768
11869
|
return day + "-" + month + "-" + year;
|
|
11769
11870
|
};
|
|
11770
|
-
|
|
11871
|
+
////////////////////////////////////////////////////////////
|
|
11872
|
+
//Model reading for all of the different options available//
|
|
11873
|
+
////////////////////////////////////////////////////////////
|
|
11874
|
+
FilterItemComponent.prototype._readModelForFilterList = function (filterModel) {
|
|
11771
11875
|
var e_1, _c;
|
|
11772
11876
|
var filterList = [];
|
|
11773
11877
|
var itemsToCheck = [];
|
|
11774
|
-
this.
|
|
11775
|
-
|
|
11878
|
+
this._uncheckAll();
|
|
11879
|
+
this._model = filterModel;
|
|
11880
|
+
if (filterModel !== null && filterModel !== undefined && typeof filterModel === 'string' && filterModel.length != 0 && this.collection !== null && this.collection !== undefined) {
|
|
11776
11881
|
filterList = filterModel.split(",");
|
|
11777
11882
|
filterList.forEach(function (filter) {
|
|
11778
11883
|
itemsToCheck.push(filter.substr(3, filter.length - 4));
|
|
11779
11884
|
});
|
|
11780
11885
|
var _loop_1 = function (item) {
|
|
11781
11886
|
var filter = this_1.collection.find(function (element) { return element.code.toString() === item; });
|
|
11782
|
-
if (filter) {
|
|
11887
|
+
if (filter !== null && filter !== undefined) {
|
|
11783
11888
|
filter.checked = true;
|
|
11784
11889
|
}
|
|
11785
11890
|
else {
|
|
@@ -11802,25 +11907,23 @@
|
|
|
11802
11907
|
}
|
|
11803
11908
|
this._model = filterModel;
|
|
11804
11909
|
}
|
|
11805
|
-
else {
|
|
11806
|
-
this._model = undefined;
|
|
11807
|
-
}
|
|
11808
11910
|
};
|
|
11809
|
-
FilterItemComponent.prototype.
|
|
11810
|
-
this.
|
|
11811
|
-
|
|
11812
|
-
|
|
11911
|
+
FilterItemComponent.prototype._readModelForSingleSelectList = function (singleSelectModel) {
|
|
11912
|
+
this._uncheckAll();
|
|
11913
|
+
this._model = singleSelectModel;
|
|
11914
|
+
if (singleSelectModel !== null && singleSelectModel !== undefined && this.collection !== null && this.collection !== undefined) {
|
|
11915
|
+
var filter = this.collection.find(function (element) { return element.code.toString() === singleSelectModel; });
|
|
11813
11916
|
if (filter) {
|
|
11814
11917
|
filter.checked = true;
|
|
11815
11918
|
}
|
|
11816
|
-
this.createModelForSingleSelectList();
|
|
11817
11919
|
}
|
|
11818
11920
|
};
|
|
11819
|
-
FilterItemComponent.prototype.
|
|
11820
|
-
this.
|
|
11921
|
+
FilterItemComponent.prototype._readModelForStringCollectionList = function (collectionModel) {
|
|
11922
|
+
this._uncheckAll();
|
|
11923
|
+
this._model = collectionModel;
|
|
11821
11924
|
if (collectionModel !== null && collectionModel !== undefined && this.collection !== null && this.collection !== undefined) {
|
|
11822
11925
|
this.collection.forEach(function (viewModel) {
|
|
11823
|
-
if (collectionModel.indexOf(viewModel.code) > -1) {
|
|
11926
|
+
if (collectionModel.indexOf(viewModel.code.toString()) > -1) {
|
|
11824
11927
|
viewModel.checked = true;
|
|
11825
11928
|
}
|
|
11826
11929
|
else {
|
|
@@ -11829,10 +11932,11 @@
|
|
|
11829
11932
|
});
|
|
11830
11933
|
}
|
|
11831
11934
|
};
|
|
11832
|
-
FilterItemComponent.prototype.
|
|
11935
|
+
FilterItemComponent.prototype._readModelForSelectListWithNumberOutput = function (numberModel) {
|
|
11833
11936
|
var e_2, _c;
|
|
11834
|
-
this.
|
|
11835
|
-
|
|
11937
|
+
this._uncheckAll();
|
|
11938
|
+
this._model = numberModel;
|
|
11939
|
+
if (numberModel !== null && numberModel !== undefined && this.collection !== null && this.collection !== undefined) {
|
|
11836
11940
|
try {
|
|
11837
11941
|
for (var _d = __values(this.collection), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
11838
11942
|
var item = _e.value;
|
|
@@ -11850,14 +11954,15 @@
|
|
|
11850
11954
|
}
|
|
11851
11955
|
}
|
|
11852
11956
|
};
|
|
11853
|
-
FilterItemComponent.prototype.
|
|
11957
|
+
FilterItemComponent.prototype._uncheckAll = function () {
|
|
11854
11958
|
if (this.collection !== null && this.collection !== undefined) {
|
|
11855
11959
|
this.collection.forEach(function (m) {
|
|
11856
11960
|
m.checked = false;
|
|
11857
11961
|
});
|
|
11858
11962
|
}
|
|
11859
11963
|
};
|
|
11860
|
-
FilterItemComponent.prototype.
|
|
11964
|
+
FilterItemComponent.prototype._readModelForSliderMode = function (sliderModel) {
|
|
11965
|
+
this._model = sliderModel;
|
|
11861
11966
|
if (sliderModel !== undefined && sliderModel !== null) {
|
|
11862
11967
|
var sliderInputCollection = sliderModel.split(' - ');
|
|
11863
11968
|
this.sliderMin = parseInt(sliderInputCollection[0]);
|
|
@@ -11868,7 +11973,8 @@
|
|
|
11868
11973
|
this.sliderMax = this.sliderDefaultMax;
|
|
11869
11974
|
}
|
|
11870
11975
|
};
|
|
11871
|
-
FilterItemComponent.prototype.
|
|
11976
|
+
FilterItemComponent.prototype._readModelForCheckboxToText = function (checkboxToTextModel) {
|
|
11977
|
+
this._model = checkboxToTextModel;
|
|
11872
11978
|
if (checkboxToTextModel !== undefined && checkboxToTextModel !== null) {
|
|
11873
11979
|
this.checkBoxToTextModel = (checkboxToTextModel.indexOf('J') > -1);
|
|
11874
11980
|
}
|
|
@@ -11876,7 +11982,8 @@
|
|
|
11876
11982
|
this.checkBoxToTextModel = false;
|
|
11877
11983
|
}
|
|
11878
11984
|
};
|
|
11879
|
-
FilterItemComponent.prototype.
|
|
11985
|
+
FilterItemComponent.prototype._readModelForCheckboxToBinary = function (checkboxToBinary) {
|
|
11986
|
+
this._model = checkboxToBinary;
|
|
11880
11987
|
if (checkboxToBinary !== undefined && checkboxToBinary !== null) {
|
|
11881
11988
|
this.checkBoxToTextModel = (checkboxToBinary >= 1);
|
|
11882
11989
|
}
|
|
@@ -11884,15 +11991,14 @@
|
|
|
11884
11991
|
this.checkBoxToTextModel = false;
|
|
11885
11992
|
}
|
|
11886
11993
|
};
|
|
11887
|
-
FilterItemComponent.prototype.
|
|
11994
|
+
FilterItemComponent.prototype._readModelForDateField = function (dateFieldModel) {
|
|
11995
|
+
this._model = dateFieldModel;
|
|
11888
11996
|
if (dateFieldModel !== undefined && dateFieldModel !== null) {
|
|
11889
11997
|
this._model = new Date(dateFieldModel);
|
|
11890
11998
|
}
|
|
11891
|
-
else {
|
|
11892
|
-
this._model = undefined;
|
|
11893
|
-
}
|
|
11894
11999
|
};
|
|
11895
|
-
FilterItemComponent.prototype.
|
|
12000
|
+
FilterItemComponent.prototype._readModelForDateRangeField = function (dateRangeFieldModel) {
|
|
12001
|
+
this._model = dateRangeFieldModel;
|
|
11896
12002
|
if (dateRangeFieldModel !== undefined && dateRangeFieldModel !== null) {
|
|
11897
12003
|
var dateCollection = dateRangeFieldModel.split('&');
|
|
11898
12004
|
var startString = dateCollection[0].trim().substr(4, dateCollection[0].length - 5);
|
|
@@ -11903,71 +12009,19 @@
|
|
|
11903
12009
|
this.dateRangeEnd = new Date(parseInt(endDateComponents[2]), parseInt(endDateComponents[1]) - 1, parseInt(endDateComponents[0]));
|
|
11904
12010
|
}
|
|
11905
12011
|
};
|
|
11906
|
-
FilterItemComponent.prototype.valueSelected = function () {
|
|
11907
|
-
if (this.collection) {
|
|
11908
|
-
return !!this.collection.find(function (c) { return c.checked; });
|
|
11909
|
-
}
|
|
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
|
-
};
|
|
11959
12012
|
return FilterItemComponent;
|
|
11960
12013
|
}());
|
|
11961
12014
|
FilterItemComponent.decorators = [
|
|
11962
12015
|
{ type: i0.Component, args: [{
|
|
11963
12016
|
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
|
|
12017
|
+
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
12018
|
encapsulation: i0.ViewEncapsulation.None,
|
|
11966
12019
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
11967
12020
|
},] }
|
|
11968
12021
|
];
|
|
11969
12022
|
FilterItemComponent.ctorParameters = function () { return [
|
|
11970
|
-
{ type: IconCacheService }
|
|
12023
|
+
{ type: IconCacheService },
|
|
12024
|
+
{ type: i0.ChangeDetectorRef }
|
|
11971
12025
|
]; };
|
|
11972
12026
|
FilterItemComponent.propDecorators = {
|
|
11973
12027
|
mode: [{ type: i0.Input }],
|