@progress/kendo-angular-grid
Version:
Kendo UI Grid for Angular - high performance data grid with paging, filtering, virtualization, CRUD, and more.
126 lines (125 loc) • 7.06 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, Input } from '@angular/core';
import { FilterService } from '../filter.service';
import { StringFilterComponent } from "../string-filter.component";
import { replaceMessagePlaceholder } from '../../utils';
import { SizingOptionsService } from '../../layout/sizing-options.service';
import { ContextService } from '../../common/provider.service';
import { FormsModule } from '@angular/forms';
import { FilterInputDirective } from '../filter-input.directive';
import { FocusableDirective } from '../../navigation/focusable.directive';
import { FilterCellWrapperComponent } from './filter-cell-wrapper.component';
import { TextBoxComponent } from '@progress/kendo-angular-inputs';
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";
import * as i4 from "@angular/forms";
/**
* Represents a string 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="ProductName" title="Product Name">
* <ng-template kendoGridFilterCellTemplate let-filter let-column="column">
* <kendo-grid-string-filter-cell
* [column]="column"
* [filter]="filter">
* </kendo-grid-string-filter-cell>
* </ng-template>
* </kendo-grid-column>
* ```
*/
export class StringFilterCellComponent extends StringFilterComponent {
/**
* Determines the delay time (in milliseconds) before the filter value is submitted.
* A value of `0` indicates no delay.
* @type {boolean}
* @default 500
*/
filterDelay = 500;
/**
* Determines if the drop-down filter operators will be displayed.
* @type {boolean}
* @default true
*/
showOperators = true;
/**
* The placeholder text for the filter input.
* @type {string}
*/
placeholder;
subs;
constructor(filterService, ctx, sizingService) {
super(filterService, ctx);
this.subs = sizingService.changes.subscribe((size) => this.size = size);
}
ngOnDestroy() {
if (this.subs) {
this.subs.unsubscribe();
}
}
/**
* @hidden
*/
get columnLabel() {
const localizationMsg = this.ctx.localization.get('filterInputLabel') || '';
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: StringFilterCellComponent, deps: [{ token: i1.FilterService }, { token: i2.ContextService }, { token: i3.SizingOptionsService }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: StringFilterCellComponent, isStandalone: true, selector: "kendo-grid-string-filter-cell", inputs: { filterDelay: "filterDelay", showOperators: "showOperators", placeholder: "placeholder" }, usesInheritance: true, ngImport: i0, template: `
<kendo-grid-filter-wrapper-cell
[column]="column"
[filter]="filter"
[operators]="operators"
[defaultOperator]="operator"
[showOperators]="showOperators">
<kendo-textbox
[size]="size"
kendoGridFocusable
kendoFilterInput
[columnLabel]="columnLabel"
[filterDelay]="filterDelay"
[placeholder]="placeholder"
[ngModel]="currentFilter?.value ?? null"
></kendo-textbox>
</kendo-grid-filter-wrapper-cell>
`, isInline: true, dependencies: [{ kind: "component", type: FilterCellWrapperComponent, selector: "kendo-grid-filter-wrapper-cell", inputs: ["showOperators"] }, { kind: "component", type: TextBoxComponent, selector: "kendo-textbox", inputs: ["focusableId", "title", "type", "disabled", "readonly", "tabindex", "value", "selectOnFocus", "showSuccessIcon", "showErrorIcon", "clearButton", "successIcon", "successSvgIcon", "errorIcon", "errorSvgIcon", "clearButtonIcon", "clearButtonSvgIcon", "size", "rounded", "fillMode", "tabIndex", "placeholder", "maxlength", "inputAttributes"], outputs: ["valueChange", "inputFocus", "inputBlur", "focus", "blur"], exportAs: ["kendoTextBox"] }, { kind: "directive", type: FocusableDirective, selector: "[kendoGridFocusable],\n [kendoGridEditCommand],\n [kendoGridRemoveCommand],\n [kendoGridSaveCommand],\n [kendoGridCancelCommand],\n [kendoGridSelectionCheckbox]\n ", inputs: ["kendoGridFocusable"] }, { kind: "directive", type: FilterInputDirective, selector: "[kendoFilterInput]", inputs: ["filterDelay", "columnLabel", "value"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: StringFilterCellComponent, decorators: [{
type: Component,
args: [{
selector: 'kendo-grid-string-filter-cell',
template: `
<kendo-grid-filter-wrapper-cell
[column]="column"
[filter]="filter"
[operators]="operators"
[defaultOperator]="operator"
[showOperators]="showOperators">
<kendo-textbox
[size]="size"
kendoGridFocusable
kendoFilterInput
[columnLabel]="columnLabel"
[filterDelay]="filterDelay"
[placeholder]="placeholder"
[ngModel]="currentFilter?.value ?? null"
></kendo-textbox>
</kendo-grid-filter-wrapper-cell>
`,
standalone: true,
imports: [FilterCellWrapperComponent, TextBoxComponent, FocusableDirective, FilterInputDirective, FormsModule]
}]
}], ctorParameters: function () { return [{ type: i1.FilterService }, { type: i2.ContextService }, { type: i3.SizingOptionsService }]; }, propDecorators: { filterDelay: [{
type: Input
}], showOperators: [{
type: Input
}], placeholder: [{
type: Input
}] } });