Skip to content

Commit c08188c

Browse files
committed
refactor(grid-lite): add booleanAttribute for input coercion
1 parent a2a1f31 commit c08188c

3 files changed

Lines changed: 19 additions & 19 deletions

File tree

projects/igniteui-angular/grids/lite/src/grid-lite-column.component.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ChangeDetectionStrategy, Component, contentChild, CUSTOM_ELEMENTS_SCHEMA, Directive, effect, EmbeddedViewRef, inject, input, TemplateRef, ViewContainerRef } from '@angular/core';
1+
import { booleanAttribute, ChangeDetectionStrategy, Component, contentChild, CUSTOM_ELEMENTS_SCHEMA, Directive, effect, EmbeddedViewRef, inject, input, TemplateRef, ViewContainerRef } from '@angular/core';
22
import { ColumnConfiguration, ColumnSortConfiguration, IgcCellContext, IgcHeaderContext, Keys, DataType } from 'igniteui-grid-lite';
33

44
/** Configuration object for grid columns. */
@@ -88,25 +88,25 @@ export class IgxGridLiteColumnComponent<T extends object = any> {
8888
public readonly width = input<string>();
8989

9090
/** Indicates whether the column is hidden. */
91-
public readonly hidden = input<boolean>(false);
91+
public readonly hidden = input(false, { transform: booleanAttribute });
9292

9393
/** Indicates whether the column is resizable. */
94-
public readonly resizable = input<boolean>(false);
94+
public readonly resizable = input(false, { transform: booleanAttribute });
9595

9696
/** Indicates whether the column is sortable. */
97-
public readonly sortable = input<boolean>(false);
97+
public readonly sortable = input(false, { transform: booleanAttribute });
9898

9999
/** Whether sort operations will be case sensitive. */
100-
public readonly sortingCaseSensitive = input<boolean>(false);
100+
public readonly sortingCaseSensitive = input(false, { transform: booleanAttribute });
101101

102102
/** Sort configuration for the column (e.g., custom comparer). */
103103
public readonly sortConfiguration = input<IgxGridLiteColumnSortConfiguration<T>>();
104104

105105
/** Indicates whether the column is filterable. */
106-
public readonly filterable = input<boolean>(false);
106+
public readonly filterable = input(false, { transform: booleanAttribute });
107107

108108
/** Whether filter operations will be case sensitive. */
109-
public readonly filteringCaseSensitive = input<boolean>(false);
109+
public readonly filteringCaseSensitive = input(false, { transform: booleanAttribute });
110110

111111
/** Custom header template for the column. */
112112
public readonly headerTemplate = input<TemplateRef<IgxGridLiteHeaderTemplateContext<T>>>();

projects/igniteui-angular/grids/lite/src/grid-lite.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ChangeDetectionStrategy, Component, CUSTOM_ELEMENTS_SCHEMA, ElementRef, Input, input, OnInit, output, signal, viewChild } from '@angular/core';
1+
import { booleanAttribute, ChangeDetectionStrategy, Component, CUSTOM_ELEMENTS_SCHEMA, ElementRef, Input, input, OnInit, output, signal, viewChild } from '@angular/core';
22
import { DataPipelineConfiguration, FilterExpression, GridLiteSortingOptions, IgcGridLite, Keys, SortingExpression } from 'igniteui-grid-lite';
33
import { IgxGridLiteColumnConfiguration } from './grid-lite-column.component';
44

@@ -39,7 +39,7 @@ export class IgxGridLiteComponent<T extends object = any> implements OnInit {
3939
* @remarks
4040
* This property is ignored if any existing column configuration already exists in the grid.
4141
*/
42-
public readonly autoGenerate = input<boolean>(false);
42+
public readonly autoGenerate = input(false, { transform: booleanAttribute });;
4343

4444
/** Sort configuration property for the grid. */
4545
public readonly sortingOptions = input<IgxGridLiteSortingOptions>({
@@ -164,7 +164,7 @@ export class IgxGridLiteComponent<T extends object = any> implements OnInit {
164164
//#endregion
165165

166166
/**
167-
* @internal
167+
* @hidden @internal
168168
*/
169169
public ngOnInit(): void {
170170
IgcGridLite.register();

src/app/grid-lite/grid-lite.sample.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
field="firstName"
1010
dataType="string"
1111
header="First Name"
12-
[width]="'250px'"
13-
[sortable]="true"
14-
[sortingCaseSensitive]="true"
15-
[filterable]="true"
16-
[filteringCaseSensitive]="false"
12+
width="250px"
13+
sortable
14+
sortingCaseSensitive
15+
filterable
16+
filteringCaseSensitive
1717
[headerTemplate]="headerTemplate"
1818
>
1919
</igx-grid-lite-column>
@@ -22,7 +22,7 @@
2222
dataType="string"
2323
header="Last Name"
2424
[cellTemplate]="cellTemplate"
25-
[sortable]="true"
25+
sortable
2626
>
2727
<ng-template igxGridLiteHeader let-column let-parent="parent">
2828
<div>{{column.header}} Templated inline</div>
@@ -33,9 +33,9 @@
3333
field="age"
3434
dataType="number"
3535
header="Age"
36-
[filterable]="true"
37-
[resizable]="true"
38-
[sortable]="true"
36+
filterable
37+
resizable
38+
sortable
3939
></igx-grid-lite-column>
4040
<igx-grid-lite-column field="active" dataType="boolean" header="Active">
4141
<ng-template

0 commit comments

Comments
 (0)