UNPKG

@progress/kendo-angular-filter

Version:
42 lines (41 loc) 1.89 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { Injectable } from '@angular/core'; import * as i0 from "@angular/core"; /** * @hidden */ export class FilterService { normalizedValue = { logic: 'and', filters: [] }; filters = []; addFilterGroup(item) { const filterGroup = { logic: 'and', filters: [] }; item.filters.push(filterGroup); } addFilterExpression(item) { const filterExpression = { operator: 'eq', value: null, field: null }; item.filters.push(filterExpression); } remove(item, positionIndex, parentItem) { if (!parentItem) { parentItem = this.normalizedValue; } if (item === parentItem) { parentItem.filters = []; return; } const index = parentItem.filters.indexOf(item); if (index >= 0 && index === positionIndex) { parentItem.filters = parentItem.filters.filter((i) => i !== item); return; } parentItem.filters.forEach((filter) => filter.filters && this.remove(item, positionIndex, filter)); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FilterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FilterService }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FilterService, decorators: [{ type: Injectable }] });