@progress/kendo-angular-grid
Version:
Kendo UI Grid for Angular - high performance data grid with paging, filtering, virtualization, CRUD, and more.
84 lines (83 loc) • 3.55 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
// eslint-disable no-access-missing-member
import { Input, Component } from '@angular/core';
import { ColumnComponent } from '../columns/column.component';
import { FilterService } from './filter.service';
import { BaseFilterCellComponent } from './base-filter-cell.component';
import { ContextService } from '../common/provider.service';
import * as i0 from "@angular/core";
import * as i1 from "./filter.service";
import * as i2 from "../common/provider.service";
/**
* @hidden
*/
export class BooleanFilterComponent extends BaseFilterCellComponent {
ctx;
/**
* The column with which the filter is associated.
* @type {ColumnComponent}
*/
column;
/**
* @hidden
*/
operator = "eq";
/**
* The current filter for the associated column field.
* @readonly
* @type {FilterDescriptor}
*/
get currentFilter() {
return this.filterByField(this.column.field);
}
/**
* The current filter operator for the associated column field.
* @readonly
* @type {string}
*/
get currentOperator() {
return this.currentFilter ? this.currentFilter.operator : this.operator;
}
items;
defaultItem;
subscription;
constructor(filterService, ctx) {
super(filterService);
this.ctx = ctx;
this.items = [
{ text: this.ctx.localization.get("filterIsTrue"), value: true },
{ text: this.ctx.localization.get("filterIsFalse"), value: false }
];
this.defaultItem = { text: this.ctx.localization.get("filterBooleanAll"), value: null };
}
ngOnInit() {
this.subscription = this.ctx.localization.changes.subscribe(this.localizationChange.bind(this));
}
ngOnDestroy() {
if (this.subscription) {
this.subscription.unsubscribe();
}
super.ngOnDestroy();
}
localizationChange() {
this.items = [
{ text: this.ctx.localization.get("filterIsTrue"), value: true },
{ text: this.ctx.localization.get("filterIsFalse"), value: false }
];
this.defaultItem = { text: this.ctx.localization.get("filterBooleanAll"), value: null };
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BooleanFilterComponent, deps: [{ token: i1.FilterService }, { token: i2.ContextService }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: BooleanFilterComponent, selector: "kendo-grid-boolean-filter-base", inputs: { column: "column" }, usesInheritance: true, ngImport: i0, template: ``, isInline: true });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BooleanFilterComponent, decorators: [{
type: Component,
args: [{
selector: 'kendo-grid-boolean-filter-base',
template: ``
}]
}], ctorParameters: function () { return [{ type: i1.FilterService }, { type: i2.ContextService }]; }, propDecorators: { column: [{
type: Input
}] } });