@progress/kendo-angular-grid
Version:
Kendo UI Grid for Angular - high performance data grid with paging, filtering, virtualization, CRUD, and more.
115 lines (114 loc) • 6.4 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { Component, ChangeDetectorRef } from '@angular/core';
import { FilterService } from '../filter.service';
import { BooleanFilterComponent } from '../boolean-filter.component';
import { replaceMessagePlaceholder } from '../../utils';
import { SizingOptionsService } from '../../layout/sizing-options.service';
import { ContextService } from '../../common/provider.service';
import { FocusableDirective } from '../../navigation/focusable.directive';
import { FilterInputDirective } from '../filter-input.directive';
import { FilterCellWrapperComponent } from './filter-cell-wrapper.component';
import { DropDownListComponent } from '@progress/kendo-angular-dropdowns';
import * as i0 from "@angular/core";
import * as i1 from "../filter.service";
import * as i2 from "../../common/provider.service";
import * as i3 from "../../layout/sizing-options.service";
/**
* Represents a Boolean filter-cell component.
* See the article about the [built-in filter components](slug:filter_row#toc-built-in-filter-row-components).
*
* @example
*
* ```html
* <kendo-grid-column field="Discontinued">
* <ng-template kendoGridFilterCellTemplate let-filter let-column="column">
* <kendo-grid-boolean-filter-cell
* [column]="column"
* [filter]="filter">
* </kendo-grid-boolean-filter-cell>
* </ng-template>
* </kendo-grid-column>
* ```
*/
export class BooleanFilterCellComponent extends BooleanFilterComponent {
cd;
/**
* @hidden
*/
size = 'medium';
subs;
constructor(filterService, ctx, cd, sizingService) {
super(filterService, ctx);
this.cd = cd;
this.subs = sizingService.changes.subscribe((size) => this.size = size);
}
ngOnDestroy() {
this.subs && this.subs.unsubscribe();
}
localizationChange() {
super.localizationChange();
this.cd.markForCheck();
}
/**
* @hidden
*/
get columnLabel() {
const localizationMsg = this.ctx.localization.get('booleanFilterCellLabel') || '';
const columnName = this.column.title || this.column.field;
return replaceMessagePlaceholder(localizationMsg, 'columnName', columnName);
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BooleanFilterCellComponent, deps: [{ token: i1.FilterService }, { token: i2.ContextService }, { token: i0.ChangeDetectorRef }, { token: i3.SizingOptionsService }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: BooleanFilterCellComponent, isStandalone: true, selector: "kendo-grid-boolean-filter-cell", usesInheritance: true, ngImport: i0, template: `
<kendo-grid-filter-wrapper-cell
[column]="column"
[filter]="filter"
[showOperators]="false"
[defaultOperator]="operator">
<kendo-dropdownlist
kendoFilterInput
kendoGridFocusable
[size]="size"
[columnLabel]="columnLabel"
[defaultItem]="defaultItem"
[data]="items"
textField="text"
valueField="value"
[popupSettings]="{ width: 'auto' }"
[valuePrimitive]="true"
[value]="currentFilter?.value">
</kendo-dropdownlist>
</kendo-grid-filter-wrapper-cell>
`, isInline: true, dependencies: [{ kind: "component", type: FilterCellWrapperComponent, selector: "kendo-grid-filter-wrapper-cell", inputs: ["showOperators"] }, { kind: "component", type: DropDownListComponent, selector: "kendo-dropdownlist", inputs: ["customIconClass", "showStickyHeader", "icon", "svgIcon", "loading", "data", "value", "textField", "valueField", "adaptiveMode", "title", "subtitle", "popupSettings", "listHeight", "defaultItem", "disabled", "itemDisabled", "readonly", "filterable", "virtual", "ignoreCase", "delay", "valuePrimitive", "tabindex", "tabIndex", "size", "rounded", "fillMode", "leftRightArrowsNavigation", "id"], outputs: ["valueChange", "filterChange", "selectionChange", "open", "opened", "close", "closed", "focus", "blur"], exportAs: ["kendoDropDownList"] }, { kind: "directive", type: FilterInputDirective, selector: "[kendoFilterInput]", inputs: ["filterDelay", "columnLabel", "value"] }, { kind: "directive", type: FocusableDirective, selector: "[kendoGridFocusable],\n [kendoGridEditCommand],\n [kendoGridRemoveCommand],\n [kendoGridSaveCommand],\n [kendoGridCancelCommand],\n [kendoGridSelectionCheckbox]\n ", inputs: ["kendoGridFocusable"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BooleanFilterCellComponent, decorators: [{
type: Component,
args: [{
selector: 'kendo-grid-boolean-filter-cell',
template: `
<kendo-grid-filter-wrapper-cell
[column]="column"
[filter]="filter"
[showOperators]="false"
[defaultOperator]="operator">
<kendo-dropdownlist
kendoFilterInput
kendoGridFocusable
[size]="size"
[columnLabel]="columnLabel"
[defaultItem]="defaultItem"
[data]="items"
textField="text"
valueField="value"
[popupSettings]="{ width: 'auto' }"
[valuePrimitive]="true"
[value]="currentFilter?.value">
</kendo-dropdownlist>
</kendo-grid-filter-wrapper-cell>
`,
standalone: true,
imports: [FilterCellWrapperComponent, DropDownListComponent, FilterInputDirective, FocusableDirective]
}]
}], ctorParameters: function () { return [{ type: i1.FilterService }, { type: i2.ContextService }, { type: i0.ChangeDetectorRef }, { type: i3.SizingOptionsService }]; } });