@colijnit/corecomponents_v12 12.0.31 → 12.0.32
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 +136 -0
- 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 +161 -0
- package/esm2015/lib/components/filter-item/filter-item.module.js +29 -0
- package/esm2015/public-api.js +3 -1
- package/fesm2015/colijnit-corecomponents_v12.js +180 -1
- package/fesm2015/colijnit-corecomponents_v12.js.map +1 -1
- package/lib/components/filter-item/filter-item.component.d.ts +37 -0
- package/lib/components/filter-item/filter-item.module.d.ts +2 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -9786,6 +9786,140 @@
|
|
|
9786
9786
|
},] }
|
|
9787
9787
|
];
|
|
9788
9788
|
|
|
9789
|
+
var FilterItemComponent = /** @class */ (function () {
|
|
9790
|
+
function FilterItemComponent(iconService) {
|
|
9791
|
+
this.iconService = iconService;
|
|
9792
|
+
this.icons = exports.CoreComponentsIcon;
|
|
9793
|
+
this.initialLimit = 10;
|
|
9794
|
+
this.expanded = false;
|
|
9795
|
+
// Set to false to use filter item with a multi selectable collection. Set to true to specify custom content
|
|
9796
|
+
this.customContent = false;
|
|
9797
|
+
// Set to true to show filter input field.
|
|
9798
|
+
this.searchable = true;
|
|
9799
|
+
// Set to false to never show the 'show more' and 'show less' links to expand and contract.
|
|
9800
|
+
this.showMore = false;
|
|
9801
|
+
this.showMoreLabel = 'Show more';
|
|
9802
|
+
this.showLessLabel = 'Show less';
|
|
9803
|
+
this.selectionChange = new core.EventEmitter();
|
|
9804
|
+
this.selectedCollection = [];
|
|
9805
|
+
this.filteredCollection = [];
|
|
9806
|
+
this.limitTo = 10;
|
|
9807
|
+
this.filterText = "";
|
|
9808
|
+
this._collection = [];
|
|
9809
|
+
}
|
|
9810
|
+
Object.defineProperty(FilterItemComponent.prototype, "collection", {
|
|
9811
|
+
get: function () {
|
|
9812
|
+
return this._collection;
|
|
9813
|
+
},
|
|
9814
|
+
set: function (value) {
|
|
9815
|
+
this._collection = value;
|
|
9816
|
+
this.filteredCollection = this._collection.slice();
|
|
9817
|
+
},
|
|
9818
|
+
enumerable: false,
|
|
9819
|
+
configurable: true
|
|
9820
|
+
});
|
|
9821
|
+
FilterItemComponent.prototype.showClass = function () {
|
|
9822
|
+
return true;
|
|
9823
|
+
};
|
|
9824
|
+
FilterItemComponent.prototype.ngOnInit = function () {
|
|
9825
|
+
this.setToInitialLimit();
|
|
9826
|
+
};
|
|
9827
|
+
FilterItemComponent.prototype.setToInitialLimit = function () {
|
|
9828
|
+
this.limitTo = this.initialLimit;
|
|
9829
|
+
};
|
|
9830
|
+
FilterItemComponent.prototype.increaseLimit = function () {
|
|
9831
|
+
this.limitTo += 10;
|
|
9832
|
+
};
|
|
9833
|
+
FilterItemComponent.prototype.updateSelection = function () {
|
|
9834
|
+
this.selectedCollection = this.collection.filter(function (item) { return item.checked === true; });
|
|
9835
|
+
this.selectionChange.emit(this.selectedCollection);
|
|
9836
|
+
};
|
|
9837
|
+
FilterItemComponent.prototype.moreToShow = function () {
|
|
9838
|
+
if (!this.showMore) {
|
|
9839
|
+
return false;
|
|
9840
|
+
}
|
|
9841
|
+
return this.filteredCollection.length > this.limitTo;
|
|
9842
|
+
};
|
|
9843
|
+
FilterItemComponent.prototype.lessToShow = function () {
|
|
9844
|
+
if (!this.showMore) {
|
|
9845
|
+
return false;
|
|
9846
|
+
}
|
|
9847
|
+
return this.filteredCollection.length <= this.limitTo && this.filteredCollection.length > this.initialLimit;
|
|
9848
|
+
};
|
|
9849
|
+
// Applies filter to the collection.
|
|
9850
|
+
FilterItemComponent.prototype.applyFilter = function (text) {
|
|
9851
|
+
var _this = this;
|
|
9852
|
+
var _a;
|
|
9853
|
+
if (!this.collection) {
|
|
9854
|
+
return [];
|
|
9855
|
+
}
|
|
9856
|
+
console.log('filteren');
|
|
9857
|
+
var filterText = this.filterText.toLowerCase();
|
|
9858
|
+
var filteredItemCount = 0;
|
|
9859
|
+
this.filteredCollection = (_a = this.collection) === null || _a === void 0 ? void 0 : _a.filter(function (item) {
|
|
9860
|
+
var labelText = item[_this.fields.text].toLowerCase();
|
|
9861
|
+
var isHiddenByFilter = (labelText.indexOf(filterText) === -1);
|
|
9862
|
+
if (isHiddenByFilter) {
|
|
9863
|
+
return false;
|
|
9864
|
+
}
|
|
9865
|
+
else {
|
|
9866
|
+
filteredItemCount++;
|
|
9867
|
+
return true;
|
|
9868
|
+
}
|
|
9869
|
+
});
|
|
9870
|
+
};
|
|
9871
|
+
return FilterItemComponent;
|
|
9872
|
+
}());
|
|
9873
|
+
FilterItemComponent.decorators = [
|
|
9874
|
+
{ type: core.Component, args: [{
|
|
9875
|
+
selector: "co-filter-item",
|
|
9876
|
+
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 >\n <div class=\"co-filter-item-collapsable-content\">\n <div class=\"co-filter-item-custom-content\" *ngIf=\"customContent; else collectionContent\">\n <ng-content></ng-content>\n </div>\n <ng-template #collectionContent>\n <div class=\"co-filter-item-collection-content\">\n <co-input-text\n *ngIf=\"searchable\"\n [placeholder]=\"searchPlaceholder\"\n [(model)]=\"filterText\"\n (modelChange)=\"applyFilter($event)\"\n >\n </co-input-text>\n <div class=\"co-filter-item-collection-results\">\n <div class=\"co-filter-item-collection-result-items\"\n *ngFor=\"let option of filteredCollection; let index = index\">\n <div class=\"co-filter-item-collection-result-item\" *ngIf=\"index < limitTo || !showMore\">\n <co-input-checkbox [label]=\"option[fields.text]\"\n [(model)]=\"option['checked']\"\n (modelChange)=\"updateSelection()\"\n ></co-input-checkbox>\n </div>\n </div>\n </div>\n <div class=\"co-filter-show-more-or-less\" *ngIf=\"showMore\">\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 </ng-template>\n </div>\n </co-collapsible>\n </div>\n\n ",
|
|
9877
|
+
encapsulation: core.ViewEncapsulation.None
|
|
9878
|
+
},] }
|
|
9879
|
+
];
|
|
9880
|
+
FilterItemComponent.ctorParameters = function () { return [
|
|
9881
|
+
{ type: IconCacheService }
|
|
9882
|
+
]; };
|
|
9883
|
+
FilterItemComponent.propDecorators = {
|
|
9884
|
+
collection: [{ type: core.Input }],
|
|
9885
|
+
fields: [{ type: core.Input }],
|
|
9886
|
+
placeholder: [{ type: core.Input }],
|
|
9887
|
+
initialLimit: [{ type: core.Input }],
|
|
9888
|
+
expanded: [{ type: core.Input }],
|
|
9889
|
+
customContent: [{ type: core.Input }],
|
|
9890
|
+
searchable: [{ type: core.Input }],
|
|
9891
|
+
showMore: [{ type: core.Input }],
|
|
9892
|
+
searchPlaceholder: [{ type: core.Input }],
|
|
9893
|
+
showMoreLabel: [{ type: core.Input }],
|
|
9894
|
+
showLessLabel: [{ type: core.Input }],
|
|
9895
|
+
selectionChange: [{ type: core.Output }],
|
|
9896
|
+
showClass: [{ type: core.HostBinding, args: ["class.co-filter-item",] }]
|
|
9897
|
+
};
|
|
9898
|
+
|
|
9899
|
+
var FilterItemModule = /** @class */ (function () {
|
|
9900
|
+
function FilterItemModule() {
|
|
9901
|
+
}
|
|
9902
|
+
return FilterItemModule;
|
|
9903
|
+
}());
|
|
9904
|
+
FilterItemModule.decorators = [
|
|
9905
|
+
{ type: core.NgModule, args: [{
|
|
9906
|
+
imports: [
|
|
9907
|
+
common.CommonModule,
|
|
9908
|
+
CollapsibleModule,
|
|
9909
|
+
InputTextModule,
|
|
9910
|
+
InputCheckboxMultiSelectModule,
|
|
9911
|
+
InputCheckboxModule,
|
|
9912
|
+
IconModule,
|
|
9913
|
+
],
|
|
9914
|
+
declarations: [
|
|
9915
|
+
FilterItemComponent
|
|
9916
|
+
],
|
|
9917
|
+
exports: [
|
|
9918
|
+
FilterItemComponent
|
|
9919
|
+
]
|
|
9920
|
+
},] }
|
|
9921
|
+
];
|
|
9922
|
+
|
|
9789
9923
|
/*
|
|
9790
9924
|
* Public API Surface of corecomponents
|
|
9791
9925
|
*/
|
|
@@ -9829,6 +9963,8 @@
|
|
|
9829
9963
|
exports.CollapsibleModule = CollapsibleModule;
|
|
9830
9964
|
exports.DropDownListComponent = DropDownListComponent;
|
|
9831
9965
|
exports.DropDownModule = DropDownModule;
|
|
9966
|
+
exports.FilterItemComponent = FilterItemComponent;
|
|
9967
|
+
exports.FilterItemModule = FilterItemModule;
|
|
9832
9968
|
exports.FormComponent = FormComponent;
|
|
9833
9969
|
exports.FormMasterService = FormMasterService;
|
|
9834
9970
|
exports.FormModule = FormModule;
|