@progress/kendo-angular-grid
Version:
Kendo UI Grid for Angular - high performance data grid with paging, filtering, virtualization, CRUD, and more.
105 lines (104 loc) • 4.99 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, forwardRef, ContentChild, SkipSelf, Host, Optional, Input } from '@angular/core';
import { ColumnBase } from './column-base';
import { CellTemplateDirective } from '../rendering/cell-template.directive';
import { IdService } from '../common/id.service';
import { SelectionService } from '../selection/selection.service';
import { CellSelectionService } from '../selection/cell-selection.service';
import * as i0 from "@angular/core";
import * as i1 from "../selection/selection.service";
import * as i2 from "../selection/cell-selection.service";
import * as i3 from "./column-base";
import * as i4 from "../common/id.service";
/**
* Represents the checkbox column for selecting rows in the Grid. [See example](slug:grid_row_selection#toc-select-all-checkbox).
*
* @example
* ```html
* <kendo-grid [selectable]="{enabled: true, checkboxOnly: true}">
* <kendo-grid-checkbox-column title="Default checkbox"></kendo-grid-checkbox-column>
* <kendo-grid-column field="ProductID"></kendo-grid-column>
* </kendo-grid>
* ```
*/
export class CheckboxColumnComponent extends ColumnBase {
selectionService;
cellSelectionService;
parent;
/**
* Determines whether a select-all `kendoGridSelectAllCheckbox` checkbox will be displayed in the header.
*/
showSelectAll;
/**
* Determines whether checkboxes will be rendered for rows which are marked as non-selectable. By default, such checkboxes are visible and disabled.
*/
showDisabledCheckbox = true;
/*
* @hidden
*/
isCheckboxColumn = true;
template;
constructor(selectionService, cellSelectionService, parent, idService) {
super(parent, idService);
this.selectionService = selectionService;
this.cellSelectionService = cellSelectionService;
this.parent = parent;
}
get templateRef() {
return this.template ? this.template.templateRef : undefined;
}
/**
* @hidden
*/
rowSelectable(rowIdx) {
return !this.selectionService.nonSelectableRows.has(rowIdx) && !this.cellSelectionService.nonSelectableRows.has(rowIdx);
}
/**
* Defines a function that is used to determine the rowspan of each column cell.
*/
set cellRowspan(cellRowspan) {
super.cellRowspan = cellRowspan;
}
get cellRowspan() {
return super.cellRowspan;
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CheckboxColumnComponent, deps: [{ token: i1.SelectionService }, { token: i2.CellSelectionService }, { token: i3.ColumnBase, host: true, optional: true, skipSelf: true }, { token: i4.IdService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: CheckboxColumnComponent, isStandalone: true, selector: "kendo-grid-checkbox-column", inputs: { showSelectAll: "showSelectAll", showDisabledCheckbox: "showDisabledCheckbox" }, providers: [
{
provide: ColumnBase,
useExisting: forwardRef(() => CheckboxColumnComponent)
}
], queries: [{ propertyName: "template", first: true, predicate: CellTemplateDirective, descendants: true }], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CheckboxColumnComponent, decorators: [{
type: Component,
args: [{
providers: [
{
provide: ColumnBase,
useExisting: forwardRef(() => CheckboxColumnComponent)
}
],
selector: 'kendo-grid-checkbox-column',
template: ``,
standalone: true
}]
}], ctorParameters: function () { return [{ type: i1.SelectionService }, { type: i2.CellSelectionService }, { type: i3.ColumnBase, decorators: [{
type: SkipSelf
}, {
type: Host
}, {
type: Optional
}] }, { type: i4.IdService, decorators: [{
type: Optional
}] }]; }, propDecorators: { showSelectAll: [{
type: Input
}], showDisabledCheckbox: [{
type: Input
}], template: [{
type: ContentChild,
args: [CellTemplateDirective, { static: false }]
}] } });