igniteui-grid-lite 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/components/cell.d.ts +11 -15
  2. package/components/cell.js +14 -3
  3. package/components/cell.js.map +1 -1
  4. package/components/column.d.ts +2 -2
  5. package/components/column.js.map +1 -1
  6. package/components/filter-row.d.ts +5 -3
  7. package/components/filter-row.js +97 -67
  8. package/components/filter-row.js.map +1 -1
  9. package/components/grid.d.ts +49 -8
  10. package/components/grid.js +116 -79
  11. package/components/grid.js.map +1 -1
  12. package/components/header-row.d.ts +1 -2
  13. package/components/header-row.js +6 -8
  14. package/components/header-row.js.map +1 -1
  15. package/components/header.d.ts +9 -0
  16. package/components/header.js +37 -28
  17. package/components/header.js.map +1 -1
  18. package/components/row.d.ts +4 -4
  19. package/components/row.js +15 -4
  20. package/components/row.js.map +1 -1
  21. package/controllers/data-operation.d.ts +1 -7
  22. package/controllers/data-operation.js +7 -24
  23. package/controllers/data-operation.js.map +1 -1
  24. package/controllers/dom.d.ts +16 -9
  25. package/controllers/dom.js +71 -20
  26. package/controllers/dom.js.map +1 -1
  27. package/controllers/filter.d.ts +17 -13
  28. package/controllers/filter.js +51 -61
  29. package/controllers/filter.js.map +1 -1
  30. package/controllers/navigation.d.ts +13 -18
  31. package/controllers/navigation.js +71 -76
  32. package/controllers/navigation.js.map +1 -1
  33. package/controllers/resize.d.ts +11 -17
  34. package/controllers/resize.js +20 -16
  35. package/controllers/resize.js.map +1 -1
  36. package/controllers/sort.d.ts +13 -6
  37. package/controllers/sort.js +39 -41
  38. package/controllers/sort.js.map +1 -1
  39. package/controllers/state.d.ts +18 -19
  40. package/controllers/state.js +31 -35
  41. package/controllers/state.js.map +1 -1
  42. package/custom-elements.json +970 -488
  43. package/docs/igniteui-grid-lite.json +1293 -782
  44. package/index.d.ts +1 -1
  45. package/index.js.map +1 -1
  46. package/internal/a11y.d.ts +26 -0
  47. package/internal/a11y.js +24 -0
  48. package/internal/a11y.js.map +1 -0
  49. package/internal/body-focus.d.ts +6 -0
  50. package/internal/body-focus.js +46 -0
  51. package/internal/body-focus.js.map +1 -0
  52. package/internal/constants.d.ts +6 -2
  53. package/internal/constants.js +3 -4
  54. package/internal/constants.js.map +1 -1
  55. package/internal/element-from-event-path.d.ts +1 -1
  56. package/internal/element-from-event-path.js +2 -9
  57. package/internal/element-from-event-path.js.map +1 -1
  58. package/internal/normalize-case.d.ts +5 -1
  59. package/internal/normalize-case.js +2 -1
  60. package/internal/normalize-case.js.map +1 -1
  61. package/internal/part-map.js +9 -17
  62. package/internal/part-map.js.map +1 -1
  63. package/internal/tags.d.ts +1 -2
  64. package/internal/tags.js +1 -2
  65. package/internal/tags.js.map +1 -1
  66. package/internal/types.d.ts +19 -8
  67. package/internal/types.js.map +1 -1
  68. package/internal/utils.d.ts +7 -8
  69. package/internal/utils.js +22 -5
  70. package/internal/utils.js.map +1 -1
  71. package/internal/watch.js +8 -9
  72. package/internal/watch.js.map +1 -1
  73. package/operations/base.js +3 -2
  74. package/operations/base.js.map +1 -1
  75. package/operations/filter/state.d.ts +0 -1
  76. package/operations/filter/state.js +2 -8
  77. package/operations/filter/state.js.map +1 -1
  78. package/operations/filter/tree.d.ts +1 -2
  79. package/operations/filter/tree.js +2 -7
  80. package/operations/filter/tree.js.map +1 -1
  81. package/operations/filter/types.d.ts +1 -1
  82. package/operations/filter/types.js.map +1 -1
  83. package/operations/filter.js +16 -3
  84. package/operations/filter.js.map +1 -1
  85. package/operations/sort/types.d.ts +1 -1
  86. package/operations/sort/types.js.map +1 -1
  87. package/operations/sort.d.ts +0 -1
  88. package/operations/sort.js +12 -10
  89. package/operations/sort.js.map +1 -1
  90. package/package.json +2 -3
  91. package/styles/header-cell/header-cell.css.js +1 -1
  92. package/styles/header-cell/header-cell.css.js.map +1 -1
  93. package/styles/themes/filtering-row-themes.js +2 -30
  94. package/styles/themes/filtering-row-themes.js.map +1 -1
  95. package/styles/themes/grid-header-themes.js +2 -20
  96. package/styles/themes/grid-header-themes.js.map +1 -1
  97. package/styles/themes/grid-themes.js +10 -31
  98. package/styles/themes/grid-themes.js.map +1 -1
  99. package/styles/themes/grid.base.css.js +1 -1
  100. package/styles/themes/grid.base.css.js.map +1 -1
  101. package/styles/themes/shared/grid.common.css.js +1 -1
  102. package/styles/themes/shared/grid.common.css.js.map +1 -1
  103. package/components/virtualizer.d.ts +0 -12
  104. package/components/virtualizer.js +0 -20
  105. package/components/virtualizer.js.map +0 -1
  106. package/internal/virt-flow-layout.d.ts +0 -4
  107. package/internal/virt-flow-layout.js +0 -15
  108. package/internal/virt-flow-layout.js.map +0 -1
@@ -1,31 +1,27 @@
1
1
  import { LitElement, type PropertyValues } from 'lit';
2
2
  import type { ColumnConfiguration, IgcCellContext, PropertyType } from '../internal/types.js';
3
3
  import type IgcGridLiteRow from './row.js';
4
- /**
5
- * Component representing a DOM cell of the Igc grid.
6
- */
7
4
  export default class IgcGridLiteCell<T extends object> extends LitElement {
8
5
  static get tagName(): "igc-grid-lite-cell";
9
6
  static styles: import("lit").CSSResult;
10
7
  static register(): void;
11
8
  private readonly _adoptedStylesController;
9
+ private readonly _a11y;
12
10
  adoptRootStyles: boolean;
13
11
  /**
14
- * The value which will be rendered by the component.
12
+ * Position of the cell among the visible columns. Written as its 1-based
13
+ * `aria-colindex`.
14
+ *
15
+ * @internal
15
16
  */
17
+ _colIndex: number;
18
+ /** The rendered value. */
16
19
  value: PropertyType<T>;
17
- /**
18
- * A reference to the column configuration object.
19
- */
20
+ /** The column configuration. */
20
21
  column: ColumnConfiguration<T>;
21
- /**
22
- * Indicates whether this is the active cell in the grid.
23
- *
24
- */
22
+ /** Whether this is the active cell in the grid. */
25
23
  active: boolean;
26
- /**
27
- * The parent row component holding this cell.
28
- */
24
+ /** The parent row. */
29
25
  row: IgcGridLiteRow<T>;
30
26
  rowIndex: number;
31
27
  cellTemplate?: (context: IgcCellContext<T>) => unknown;
@@ -33,7 +29,7 @@ export default class IgcGridLiteCell<T extends object> extends LitElement {
33
29
  private get _shouldAdoptStyles();
34
30
  connectedCallback(): void;
35
31
  protected update(props: PropertyValues<this>): void;
36
- protected render(): import("lit-html").TemplateResult<1>;
32
+ protected render(): import("lit-html/directive.js").DirectiveResult<typeof import("lit-html/directives/cache.js").CacheDirective>;
37
33
  }
38
34
  declare global {
39
35
  interface HTMLElementTagNameMap {
@@ -8,6 +8,7 @@ import { θaddAdoptedStylesController as addAdoptedStylesController } from 'igni
8
8
  import { html, LitElement } from 'lit';
9
9
  import { property } from 'lit/decorators.js';
10
10
  import { cache } from 'lit/directives/cache.js';
11
+ import { addA11y } from '../internal/a11y.js';
11
12
  import { registerComponent } from '../internal/register.js';
12
13
  import { GRID_CELL_TAG } from '../internal/tags.js';
13
14
  import { styles } from '../styles/body-cell/body-cell.css.js';
@@ -15,7 +16,9 @@ export default class IgcGridLiteCell extends LitElement {
15
16
  constructor() {
16
17
  super(...arguments);
17
18
  this._adoptedStylesController = addAdoptedStylesController(this);
19
+ this._a11y = addA11y(this, 'gridcell');
18
20
  this.adoptRootStyles = false;
21
+ this._colIndex = -1;
19
22
  this.active = false;
20
23
  this.rowIndex = -1;
21
24
  }
@@ -39,23 +42,31 @@ export default class IgcGridLiteCell extends LitElement {
39
42
  }
40
43
  connectedCallback() {
41
44
  super.connectedCallback();
45
+ this.tabIndex = -1;
42
46
  this._adoptedStylesController.shouldAdoptStyles(this._shouldAdoptStyles);
43
47
  }
44
48
  update(props) {
45
- if (props.has('adoptRootStyles')) {
49
+ if (props.has('adoptRootStyles') || props.has('cellTemplate')) {
46
50
  this._adoptedStylesController.shouldAdoptStyles(this._shouldAdoptStyles);
47
51
  }
52
+ this._a11y.set({
53
+ ariaColIndex: `${this._colIndex}`,
54
+ ariaSelected: this.active ? 'true' : null,
55
+ });
48
56
  super.update(props);
49
57
  }
50
58
  render() {
51
- return html `${cache(this.cellTemplate
59
+ return cache(this.cellTemplate
52
60
  ? this.cellTemplate(this.context)
53
- : html `<span part="text">${this.value}</span>`)}`;
61
+ : html `<span part="text">${this.value}</span>`);
54
62
  }
55
63
  }
56
64
  __decorate([
57
65
  property({ attribute: false })
58
66
  ], IgcGridLiteCell.prototype, "adoptRootStyles", void 0);
67
+ __decorate([
68
+ property({ attribute: false })
69
+ ], IgcGridLiteCell.prototype, "_colIndex", void 0);
59
70
  __decorate([
60
71
  property({ attribute: false })
61
72
  ], IgcGridLiteCell.prototype, "value", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"cell.js","sourceRoot":"","sources":["../../src/components/cell.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,2BAA2B,IAAI,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACnG,OAAO,EAAE,IAAI,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAM9D,MAAM,CAAC,OAAO,OAAO,eAAkC,SAAQ,UAAU;IAAzE;;QAWmB,6BAAwB,GAAG,0BAA0B,CAAC,IAAI,CAAC,CAAC;QAGtE,oBAAe,GAAG,KAAK,CAAC;QAmBxB,WAAM,GAAG,KAAK,CAAC;QASf,aAAQ,GAAG,CAAC,CAAC,CAAC;IAsCvB,CAAC;IA/EQ,MAAM,KAAK,OAAO;QACvB,OAAO,aAAa,CAAC;IACvB,CAAC;aAEsB,WAAM,GAAG,MAAM,AAAT,CAAU;IAEhC,MAAM,CAAC,QAAQ;QACpB,iBAAiB,CAAC,eAAe,CAAC,CAAC;IACrC,CAAC;IAsCD,IAAc,OAAO;QACnB,OAAO;YACL,MAAM,EAAE,IAAI;YACZ,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,KAAK,EAAE,IAAI,CAAC,KAAK;SACc,CAAC;IACpC,CAAC;IAED,IAAY,kBAAkB;QAC5B,OAAO,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC;IAC3D,CAAC;IAEe,iBAAiB;QAC/B,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,wBAAwB,CAAC,iBAAiB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAC3E,CAAC;IAEkB,MAAM,CAAC,KAA2B;QACnD,IAAI,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,wBAAwB,CAAC,iBAAiB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC3E,CAAC;QAED,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IAEkB,MAAM;QACvB,OAAO,IAAI,CAAA,GAAG,KAAK,CACjB,IAAI,CAAC,YAAY;YACf,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAc,CAAC;YACxC,CAAC,CAAC,IAAI,CAAA,qBAAqB,IAAI,CAAC,KAAK,SAAS,CACjD,EAAE,CAAC;IACN,CAAC;;AAjEM;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;wDACA;AAMxB;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;8CACA;AAMxB;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;+CACQ;AAOhC;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CACrB;AAMf;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CACA;AAGxB;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iDACV;AAGd;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;qDAC+B","sourcesContent":["import { θaddAdoptedStylesController as addAdoptedStylesController } from 'igniteui-webcomponents';\nimport { html, LitElement, type PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { cache } from 'lit/directives/cache.js';\nimport { registerComponent } from '../internal/register.js';\nimport { GRID_CELL_TAG } from '../internal/tags.js';\nimport type { ColumnConfiguration, IgcCellContext, PropertyType } from '../internal/types.js';\nimport { styles } from '../styles/body-cell/body-cell.css.js';\nimport type IgcGridLiteRow from './row.js';\n\n/**\n * Component representing a DOM cell of the Igc grid.\n */\nexport default class IgcGridLiteCell<T extends object> extends LitElement {\n public static get tagName() {\n return GRID_CELL_TAG;\n }\n\n public static override styles = styles;\n\n public static register(): void {\n registerComponent(IgcGridLiteCell);\n }\n\n private readonly _adoptedStylesController = addAdoptedStylesController(this);\n\n @property({ attribute: false })\n public adoptRootStyles = false;\n\n /**\n * The value which will be rendered by the component.\n */\n @property({ attribute: false })\n public value!: PropertyType<T>;\n\n /**\n * A reference to the column configuration object.\n */\n @property({ attribute: false })\n public column!: ColumnConfiguration<T>;\n\n /**\n * Indicates whether this is the active cell in the grid.\n *\n */\n @property({ type: Boolean, reflect: true })\n public active = false;\n\n /**\n * The parent row component holding this cell.\n */\n @property({ attribute: false })\n public row!: IgcGridLiteRow<T>;\n\n @property({ attribute: false })\n public rowIndex = -1;\n\n @property({ attribute: false })\n public cellTemplate?: (context: IgcCellContext<T>) => unknown;\n\n protected get context(): IgcCellContext<T> {\n return {\n parent: this,\n row: this.row,\n column: this.column,\n value: this.value,\n } as unknown as IgcCellContext<T>;\n }\n\n private get _shouldAdoptStyles(): boolean {\n return this.adoptRootStyles && this.cellTemplate != null;\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this._adoptedStylesController.shouldAdoptStyles(this._shouldAdoptStyles);\n }\n\n protected override update(props: PropertyValues<this>): void {\n if (props.has('adoptRootStyles')) {\n this._adoptedStylesController.shouldAdoptStyles(this._shouldAdoptStyles);\n }\n\n super.update(props);\n }\n\n protected override render() {\n return html`${cache(\n this.cellTemplate\n ? this.cellTemplate(this.context as any)\n : html`<span part=\"text\">${this.value}</span>`\n )}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [IgcGridLiteCell.tagName]: IgcGridLiteCell<object>;\n }\n}\n"]}
1
+ {"version":3,"file":"cell.js","sourceRoot":"","sources":["../../src/components/cell.ts"],"names":[],"mappings":"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","sourcesContent":["import { θaddAdoptedStylesController as addAdoptedStylesController } from 'igniteui-webcomponents';\nimport { html, LitElement, type PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { cache } from 'lit/directives/cache.js';\nimport { addA11y } from '../internal/a11y.js';\nimport { registerComponent } from '../internal/register.js';\nimport { GRID_CELL_TAG } from '../internal/tags.js';\nimport type { ColumnConfiguration, IgcCellContext, PropertyType } from '../internal/types.js';\nimport { styles } from '../styles/body-cell/body-cell.css.js';\nimport type IgcGridLiteRow from './row.js';\n\nexport default class IgcGridLiteCell<T extends object> extends LitElement {\n public static get tagName() {\n return GRID_CELL_TAG;\n }\n\n public static override styles = styles;\n\n public static register(): void {\n registerComponent(IgcGridLiteCell);\n }\n\n private readonly _adoptedStylesController = addAdoptedStylesController(this);\n private readonly _a11y = addA11y(this, 'gridcell');\n\n @property({ attribute: false })\n public adoptRootStyles = false;\n\n /**\n * Position of the cell among the visible columns. Written as its 1-based\n * `aria-colindex`.\n *\n * @internal\n */\n @property({ attribute: false })\n public _colIndex = -1;\n\n /** The rendered value. */\n @property({ attribute: false })\n public value!: PropertyType<T>;\n\n /** The column configuration. */\n @property({ attribute: false })\n public column!: ColumnConfiguration<T>;\n\n /** Whether this is the active cell in the grid. */\n @property({ type: Boolean, reflect: true })\n public active = false;\n\n /** The parent row. */\n @property({ attribute: false })\n public row!: IgcGridLiteRow<T>;\n\n @property({ attribute: false })\n public rowIndex = -1;\n\n @property({ attribute: false })\n public cellTemplate?: (context: IgcCellContext<T>) => unknown;\n\n protected get context(): IgcCellContext<T> {\n return {\n parent: this,\n row: this.row,\n column: this.column,\n value: this.value,\n } as unknown as IgcCellContext<T>;\n }\n\n private get _shouldAdoptStyles(): boolean {\n return this.adoptRootStyles && this.cellTemplate != null;\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n\n // Roving focus target: focus here announces the cell.\n this.tabIndex = -1;\n this._adoptedStylesController.shouldAdoptStyles(this._shouldAdoptStyles);\n }\n\n protected override update(props: PropertyValues<this>): void {\n if (props.has('adoptRootStyles') || props.has('cellTemplate')) {\n this._adoptedStylesController.shouldAdoptStyles(this._shouldAdoptStyles);\n }\n\n // The grid has no cell selection. `aria-selected` marks only the active cell.\n this._a11y.set({\n ariaColIndex: `${this._colIndex}`,\n ariaSelected: this.active ? 'true' : null,\n });\n\n super.update(props);\n }\n\n protected override render() {\n return cache(\n this.cellTemplate\n ? this.cellTemplate(this.context)\n : html`<span part=\"text\">${this.value}</span>`\n );\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [IgcGridLiteCell.tagName]: IgcGridLiteCell<object>;\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { LitElement, type PropertyValues } from 'lit';
2
- import type { BaseColumnConfiguration, ColumnSortConfiguration, IgcCellContext, IgcHeaderContext, Keys } from '../internal/types.js';
2
+ import type { BaseColumnConfiguration, ColumnSortConfiguration, DataType, IgcCellContext, IgcHeaderContext, Keys } from '../internal/types.js';
3
3
  /**
4
4
  * @element igc-grid-lite-column
5
5
  */
@@ -12,7 +12,7 @@ export declare class IgcGridLiteColumn<T extends object = any> extends LitElemen
12
12
  /** The field from the data for this column. */
13
13
  field: Keys<T>;
14
14
  /** The data type of the column's values. */
15
- dataType?: 'number' | 'string' | 'boolean';
15
+ dataType?: DataType;
16
16
  /** The header text of the column. */
17
17
  header?: string;
18
18
  /** The width of the column. */
@@ -1 +1 @@
1
- {"version":3,"file":"column.js","sourceRoot":"","sources":["../../src/components/column.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAYtD,MAAM,OAAO,iBACX,SAAQ,UAAU;IADpB;;QA6BS,aAAQ,GAAqC,QAAQ,CAAC;QAY7C,WAAM,GAAG,KAAK,CAAC;QAIxB,cAAS,GAAG,KAAK,CAAC;QAIlB,aAAQ,GAAG,KAAK,CAAC;QAIjB,yBAAoB,GAAG,KAAK,CAAC;QAQ7B,eAAU,GAAG,KAAK,CAAC;QAInB,2BAAsB,GAAG,KAAK,CAAC;IAqBxC,CAAC;IAlFQ,MAAM,KAAK,OAAO;QACvB,OAAO,eAAe,CAAC;IACzB,CAAC;aAEsB,WAAM,GAAG,GAAG,CAAA;;;;;GAKlC,AAL4B,CAK3B;IAEK,MAAM,CAAC,QAAQ;QACpB,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IA0DkB,MAAM,CAAC,KAA2B;QACnD,IAAI,IAAI,CAAC,UAAU,IAAI,KAAK,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YACtC,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAED,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IAEkB,MAAM;QACvB,OAAO,OAAO,CAAC;IACjB,CAAC;;AAhES;IADT,OAAO,CAAC,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC;qDACwB;AAI7D;IADN,QAAQ,EAAE;gDACY;AAIhB;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;mDACwB;AAItD;IADN,QAAQ,EAAE;iDACY;AAIhB;IADN,QAAQ,EAAE;gDACW;AAIN;IADf,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDACG;AAIxB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oDACH;AAIlB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDACJ;AAIjB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,CAAC;+DAC7B;AAI7B;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4DACuB;AAI/C;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qDACF;AAInB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAAC;iEAC7B;AAI/B;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;yDACkC;AAI1D;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;uDACmC","sourcesContent":["import { consume } from '@lit/context';\nimport { css, LitElement, nothing, type PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { COLUMN_UPDATE_CONTEXT } from '../internal/context.js';\nimport { registerComponent } from '../internal/register.js';\nimport { GRID_COLUMN_TAG } from '../internal/tags.js';\nimport type {\n BaseColumnConfiguration,\n ColumnSortConfiguration,\n IgcCellContext,\n IgcHeaderContext,\n Keys,\n} from '../internal/types.js';\n\n/**\n * @element igc-grid-lite-column\n */\nexport class IgcGridLiteColumn<T extends object = any>\n extends LitElement\n implements BaseColumnConfiguration<T>\n{\n public static get tagName() {\n return GRID_COLUMN_TAG;\n }\n\n public static override styles = css`\n :host {\n display: none;\n contain: strict;\n }\n `;\n\n public static register(): void {\n registerComponent(IgcGridLiteColumn);\n }\n\n /** Callback context to notify the parent grid about configuration changes */\n @consume({ context: COLUMN_UPDATE_CONTEXT })\n protected _setConfig?: (config: BaseColumnConfiguration<T>) => void;\n\n /** The field from the data for this column. */\n @property()\n public field!: Keys<T>;\n\n /** The data type of the column's values. */\n @property({ attribute: 'data-type' })\n public dataType?: 'number' | 'string' | 'boolean' = 'string';\n\n /** The header text of the column. */\n @property()\n public header?: string;\n\n /** The width of the column. */\n @property()\n public width?: string;\n\n /** Indicates whether the column is hidden. */\n @property({ type: Boolean })\n public override hidden = false;\n\n /** Indicates whether the column is resizable. */\n @property({ type: Boolean })\n public resizable = false;\n\n /** Indicates whether the column is sortable. */\n @property({ type: Boolean })\n public sortable = false;\n\n /** Whether sort operations will be case sensitive. */\n @property({ type: Boolean, attribute: 'sorting-case-sensitive' })\n public sortingCaseSensitive = false;\n\n /** Sort configuration for the column (e.g., custom comparer). */\n @property({ attribute: false })\n public sortConfiguration?: ColumnSortConfiguration<T>;\n\n /** Indicates whether the column is filterable. */\n @property({ type: Boolean })\n public filterable = false;\n\n /** Whether filter operations will be case sensitive. */\n @property({ type: Boolean, attribute: 'filtering-case-sensitive' })\n public filteringCaseSensitive = false;\n\n /** Custom header template for the column. */\n @property({ attribute: false })\n public headerTemplate?: (params: IgcHeaderContext<T>) => unknown;\n\n /** Custom cell template for the column. */\n @property({ attribute: false })\n public cellTemplate?: (params: IgcCellContext<T, any>) => unknown;\n\n protected override update(props: PropertyValues<this>): void {\n if (this.hasUpdated && props.size > 0) {\n this._setConfig?.(this);\n }\n\n super.update(props);\n }\n\n protected override render(): unknown {\n return nothing;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [IgcGridLiteColumn.tagName]: IgcGridLiteColumn;\n }\n}\n"]}
1
+ {"version":3,"file":"column.js","sourceRoot":"","sources":["../../src/components/column.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAatD,MAAM,OAAO,iBACX,SAAQ,UAAU;IADpB;;QA6BS,aAAQ,GAAc,QAAQ,CAAC;QAYtB,WAAM,GAAG,KAAK,CAAC;QAIxB,cAAS,GAAG,KAAK,CAAC;QAIlB,aAAQ,GAAG,KAAK,CAAC;QAIjB,yBAAoB,GAAG,KAAK,CAAC;QAQ7B,eAAU,GAAG,KAAK,CAAC;QAInB,2BAAsB,GAAG,KAAK,CAAC;IAqBxC,CAAC;IAlFQ,MAAM,KAAK,OAAO;QACvB,OAAO,eAAe,CAAC;IACzB,CAAC;aAEsB,WAAM,GAAG,GAAG,CAAA;;;;;GAKlC,AAL4B,CAK3B;IAEK,MAAM,CAAC,QAAQ;QACpB,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IA0DkB,MAAM,CAAC,KAA2B;QACnD,IAAI,IAAI,CAAC,UAAU,IAAI,KAAK,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YACtC,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAED,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IAEkB,MAAM;QACvB,OAAO,OAAO,CAAC;IACjB,CAAC;;AAhES;IADT,OAAO,CAAC,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC;qDACwB;AAI7D;IADN,QAAQ,EAAE;gDACY;AAIhB;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;mDACC;AAI/B;IADN,QAAQ,EAAE;iDACY;AAIhB;IADN,QAAQ,EAAE;gDACW;AAIN;IADf,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDACG;AAIxB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oDACH;AAIlB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDACJ;AAIjB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,CAAC;+DAC7B;AAI7B;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4DACuB;AAI/C;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qDACF;AAInB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAAC;iEAC7B;AAI/B;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;yDACkC;AAI1D;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;uDACmC","sourcesContent":["import { consume } from '@lit/context';\nimport { css, LitElement, nothing, type PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { COLUMN_UPDATE_CONTEXT } from '../internal/context.js';\nimport { registerComponent } from '../internal/register.js';\nimport { GRID_COLUMN_TAG } from '../internal/tags.js';\nimport type {\n BaseColumnConfiguration,\n ColumnSortConfiguration,\n DataType,\n IgcCellContext,\n IgcHeaderContext,\n Keys,\n} from '../internal/types.js';\n\n/**\n * @element igc-grid-lite-column\n */\nexport class IgcGridLiteColumn<T extends object = any>\n extends LitElement\n implements BaseColumnConfiguration<T>\n{\n public static get tagName() {\n return GRID_COLUMN_TAG;\n }\n\n public static override styles = css`\n :host {\n display: none;\n contain: strict;\n }\n `;\n\n public static register(): void {\n registerComponent(IgcGridLiteColumn);\n }\n\n /** Callback context to notify the parent grid about configuration changes */\n @consume({ context: COLUMN_UPDATE_CONTEXT })\n protected _setConfig?: (config: BaseColumnConfiguration<T>) => void;\n\n /** The field from the data for this column. */\n @property()\n public field!: Keys<T>;\n\n /** The data type of the column's values. */\n @property({ attribute: 'data-type' })\n public dataType?: DataType = 'string';\n\n /** The header text of the column. */\n @property()\n public header?: string;\n\n /** The width of the column. */\n @property()\n public width?: string;\n\n /** Indicates whether the column is hidden. */\n @property({ type: Boolean })\n public override hidden = false;\n\n /** Indicates whether the column is resizable. */\n @property({ type: Boolean })\n public resizable = false;\n\n /** Indicates whether the column is sortable. */\n @property({ type: Boolean })\n public sortable = false;\n\n /** Whether sort operations will be case sensitive. */\n @property({ type: Boolean, attribute: 'sorting-case-sensitive' })\n public sortingCaseSensitive = false;\n\n /** Sort configuration for the column (e.g., custom comparer). */\n @property({ attribute: false })\n public sortConfiguration?: ColumnSortConfiguration<T>;\n\n /** Indicates whether the column is filterable. */\n @property({ type: Boolean })\n public filterable = false;\n\n /** Whether filter operations will be case sensitive. */\n @property({ type: Boolean, attribute: 'filtering-case-sensitive' })\n public filteringCaseSensitive = false;\n\n /** Custom header template for the column. */\n @property({ attribute: false })\n public headerTemplate?: (params: IgcHeaderContext<T>) => unknown;\n\n /** Custom cell template for the column. */\n @property({ attribute: false })\n public cellTemplate?: (params: IgcCellContext<T, any>) => unknown;\n\n protected override update(props: PropertyValues<this>): void {\n if (this.hasUpdated && props.size > 0) {\n this._setConfig?.(this);\n }\n\n super.update(props);\n }\n\n protected override render(): unknown {\n return nothing;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [IgcGridLiteColumn.tagName]: IgcGridLiteColumn;\n }\n}\n"]}
@@ -12,8 +12,9 @@ type ExpressionChipProps<T> = {
12
12
  };
13
13
  export default class IgcFilterRow<T extends object> extends LitElement {
14
14
  #private;
15
- static get tagName(): "igc-filter-row";
15
+ static get tagName(): "igc-grid-lite-filter-row";
16
16
  static styles: import("lit").CSSResult;
17
+ /** Deferred by the grid until a filterable column shows: only this row uses the editors. */
17
18
  static register(): void;
18
19
  private readonly _adoptedStylesController;
19
20
  state: StateController<T>;
@@ -28,6 +29,7 @@ export default class IgcFilterRow<T extends object> extends LitElement {
28
29
  expression: FilterExpression<T>;
29
30
  adoptRootStyles: boolean;
30
31
  constructor();
32
+ private get _shouldAdoptStyles();
31
33
  private _handleThemeChange;
32
34
  protected update(props: PropertyValues<this>): void;
33
35
  protected activeChanged(): void;
@@ -41,8 +43,8 @@ export default class IgcFilterRow<T extends object> extends LitElement {
41
43
  protected renderActiveState(): import("lit-html").TemplateResult<1>;
42
44
  protected renderInactiveChips(column: ColumnConfiguration<T>, state: FilterExpressionTree<T>): import("lit-html").TemplateResult<1>[];
43
45
  protected renderFilterState(column: ColumnConfiguration<T>): import("lit-html").TemplateResult<1> | import("lit-html").TemplateResult<1>[];
44
- protected renderInactiveState(): (import("lit-html").TemplateResult<1> | typeof nothing)[];
45
- protected render(): import("lit-html").TemplateResult<1>;
46
+ protected renderInactiveState(): import("lit-html").TemplateResult<1>[];
47
+ protected render(): import("lit-html").TemplateResult<1> | import("lit-html").TemplateResult<1>[];
46
48
  }
47
49
  declare global {
48
50
  interface HTMLElementTagNameMap {
@@ -5,18 +5,21 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { consume } from '@lit/context';
8
- import { θaddAdoptedStylesController as addAdoptedStylesController, θaddThemingController as addThemingController, IgcDropdownComponent, IgcInputComponent, } from 'igniteui-webcomponents';
8
+ import { θaddAdoptedStylesController as addAdoptedStylesController, θaddThemingController as addThemingController, IgcButtonComponent, IgcChipComponent, IgcDropdownComponent, IgcInputComponent, } from 'igniteui-webcomponents';
9
9
  import { html, LitElement, nothing } from 'lit';
10
10
  import { property, query } from 'lit/decorators.js';
11
11
  import { ifDefined } from 'lit/directives/if-defined.js';
12
+ import { addA11y, FILTER_ROW_INDEX } from '../internal/a11y.js';
12
13
  import { DEFAULT_COLUMN_CONFIG } from '../internal/constants.js';
13
14
  import { GRID_STATE_CONTEXT } from '../internal/context.js';
14
15
  import { registerComponent } from '../internal/register.js';
15
16
  import { GRID_FILTER_ROW_TAG } from '../internal/tags.js';
16
- import { getFilterOperandsFor } from '../internal/utils.js';
17
+ import { getFilterOperandsFor, resolveCondition, visibleColumns } from '../internal/utils.js';
17
18
  import { watch } from '../internal/watch.js';
18
19
  import { styles } from '../styles/filter-row/filter-row.css.js';
19
20
  import { all } from '../styles/themes/filtering-row-themes.js';
21
+ const MAX_PREVIEW_CHIPS = 3;
22
+ const FILTER_ROW_LABEL = 'Column filters';
20
23
  function prefixedIcon(icon) {
21
24
  return html `
22
25
  <igc-icon
@@ -32,7 +35,7 @@ export default class IgcFilterRow extends LitElement {
32
35
  }
33
36
  static { this.styles = styles; }
34
37
  static register() {
35
- registerComponent(IgcFilterRow);
38
+ registerComponent(IgcFilterRow, IgcButtonComponent, IgcChipComponent, IgcInputComponent, IgcDropdownComponent);
36
39
  }
37
40
  get isNumeric() {
38
41
  return this.column.dataType === 'number';
@@ -49,37 +52,46 @@ export default class IgcFilterRow extends LitElement {
49
52
  this.active = false;
50
53
  this.column = DEFAULT_COLUMN_CONFIG;
51
54
  this.adoptRootStyles = false;
55
+ addA11y(this, 'row').set({
56
+ ariaRowIndex: `${FILTER_ROW_INDEX}`,
57
+ ariaLabel: FILTER_ROW_LABEL,
58
+ });
52
59
  addThemingController(this, all, {
53
60
  themeChange: this._handleThemeChange,
54
61
  });
55
62
  }
63
+ get _shouldAdoptStyles() {
64
+ return this.adoptRootStyles && this.column.headerTemplate != null;
65
+ }
56
66
  _handleThemeChange() {
57
67
  this._adoptedStylesController.invalidateCache(this.ownerDocument);
58
- this._adoptedStylesController.shouldAdoptStyles(this.adoptRootStyles && this.column.headerTemplate != null);
68
+ this._adoptedStylesController.shouldAdoptStyles(this._shouldAdoptStyles);
59
69
  }
60
70
  update(props) {
61
71
  if (props.has('adoptRootStyles')) {
62
- this._adoptedStylesController.shouldAdoptStyles(this.adoptRootStyles && this.column.headerTemplate != null);
72
+ this._adoptedStylesController.shouldAdoptStyles(this._shouldAdoptStyles);
63
73
  }
64
74
  super.update(props);
65
75
  }
66
76
  #setDefaultExpression() {
67
77
  this.expression = this.filterController.getDefaultExpression(this.column);
68
78
  }
69
- #removeExpression(expression) {
70
- this.filterController.removeExpression(expression);
71
- }
72
- async #show() {
73
- this.active = true;
79
+ async #selectInput() {
74
80
  await this.updateComplete;
75
81
  this.input?.select();
76
82
  }
83
+ #show() {
84
+ this.active = true;
85
+ this.#selectInput();
86
+ }
77
87
  #handleConditionChanged(event) {
78
88
  event.stopPropagation();
79
- const key = event.detail.value;
80
- this.expression.condition = getFilterOperandsFor(this.column)[key];
81
- if (this.input.value || this.expression.condition.unary) {
82
- this.filterController.filterWithEvent(this.expression, 'modify');
89
+ const condition = resolveCondition(this.column, event.detail.value);
90
+ if (this.input.value || condition.unary) {
91
+ this.filterController.filterWithEvent({ ...this.expression, condition }, 'modify', this.expression);
92
+ }
93
+ else {
94
+ this.expression.condition = condition;
83
95
  }
84
96
  this.requestUpdate();
85
97
  }
@@ -87,15 +99,14 @@ export default class IgcFilterRow extends LitElement {
87
99
  event.stopPropagation();
88
100
  const value = this.isNumeric ? Number.parseFloat(event.detail) : event.detail;
89
101
  const shouldUpdate = this.isNumeric ? !Number.isNaN(value) : !!value;
90
- const type = this.filterController.get(this.expression.key)?.has(this.expression)
91
- ? 'modify'
92
- : 'add';
93
102
  if (shouldUpdate) {
94
- this.expression.searchTerm = value;
95
- this.filterController.filterWithEvent(this.expression, type);
103
+ const type = this.filterController.get(this.expression.key)?.has(this.expression)
104
+ ? 'modify'
105
+ : 'add';
106
+ this.filterController.filterWithEvent({ ...this.expression, searchTerm: value }, type, this.expression);
96
107
  }
97
108
  else {
98
- this.#removeExpression(this.expression);
109
+ this.filterController.removeExpression(this.expression);
99
110
  }
100
111
  this.requestUpdate();
101
112
  }
@@ -109,8 +120,6 @@ export default class IgcFilterRow extends LitElement {
109
120
  case 'Escape':
110
121
  this.active = false;
111
122
  return;
112
- default:
113
- return;
114
123
  }
115
124
  }
116
125
  #handleResetClick() {
@@ -120,18 +129,30 @@ export default class IgcFilterRow extends LitElement {
120
129
  #openDropdownList() {
121
130
  this.dropdown.toggle(this.input);
122
131
  }
132
+ #handleConditionKeydown(event) {
133
+ if (event.key !== 'Enter' && event.key !== ' ') {
134
+ return;
135
+ }
136
+ event.preventDefault();
137
+ event.stopPropagation();
138
+ this.#openDropdownList();
139
+ }
140
+ #nameFor(field) {
141
+ const column = this.state.columns.find((each) => each.field === field);
142
+ return String(column?.header ?? field);
143
+ }
123
144
  activeChanged() {
124
145
  this.style.display = this.active ? 'flex' : '';
125
146
  if (!this.active) {
126
147
  this.column = DEFAULT_COLUMN_CONFIG;
127
148
  }
128
- this.state.host.requestUpdate();
149
+ this.state.updateObservers();
129
150
  }
130
151
  #chipCriteriaFor(expression) {
131
152
  return async (e) => {
132
153
  e.stopPropagation();
133
- expression.criteria = expression.criteria === 'and' ? 'or' : 'and';
134
- this.filterController.filterWithEvent(expression, 'modify');
154
+ const criteria = expression.criteria === 'and' ? 'or' : 'and';
155
+ this.filterController.filterWithEvent({ ...expression, criteria }, 'modify', expression);
135
156
  this.requestUpdate();
136
157
  };
137
158
  }
@@ -139,14 +160,13 @@ export default class IgcFilterRow extends LitElement {
139
160
  return async (e) => {
140
161
  e.stopPropagation();
141
162
  this.expression = expression;
142
- await this.updateComplete;
143
- this.input?.select();
163
+ await this.#selectInput();
144
164
  };
145
165
  }
146
166
  #chipRemoveFor(expression) {
147
167
  return async (e) => {
148
168
  e.stopPropagation();
149
- this.#removeExpression(expression);
169
+ this.filterController.removeExpression(expression);
150
170
  if (this.active && this.expression === expression) {
151
171
  this.#setDefaultExpression();
152
172
  await this.updateComplete;
@@ -171,10 +191,15 @@ export default class IgcFilterRow extends LitElement {
171
191
  const { name, unary } = props.expression.condition;
172
192
  const { searchTerm: term } = props.expression;
173
193
  const prefix = html `<span slot="select"></span>${prefixedIcon(name)}`;
194
+ const expression = `${this.#nameFor(props.expression.key)} ${name} ${unary ? '' : term}`.trim();
174
195
  return html `
175
196
  <igc-chip
176
197
  selectable
177
198
  removable
199
+ .resourceStrings=${{
200
+ chip_remove: `Remove filter ${expression}`,
201
+ chip_select: `Edit filter ${expression}`,
202
+ }}
178
203
  ?selected=${props.selected}
179
204
  @igcRemove=${props.onRemove}
180
205
  @igcSelect=${props.onSelect}
@@ -183,19 +208,20 @@ export default class IgcFilterRow extends LitElement {
183
208
  </igc-chip>
184
209
  `;
185
210
  }
211
+ #renderChips(state, onSelectFor) {
212
+ return Array.from(state).map((expression, idx) => {
213
+ const props = {
214
+ expression,
215
+ selected: this.active && this.expression === expression,
216
+ onRemove: this.#chipRemoveFor(expression),
217
+ onSelect: onSelectFor(expression),
218
+ };
219
+ return html `${this.renderCriteriaButton(expression, idx)}${this.renderExpressionChip(props)}`;
220
+ });
221
+ }
186
222
  renderActiveChips() {
187
223
  const state = this.filterController.get(this.column.field);
188
- return !state
189
- ? nothing
190
- : Array.from(state).map((expression, idx) => {
191
- const props = {
192
- expression,
193
- selected: this.expression === expression,
194
- onRemove: this.#chipRemoveFor(expression),
195
- onSelect: this.#chipSelectFor(expression),
196
- };
197
- return html `${this.renderCriteriaButton(expression, idx)}${this.renderExpressionChip(props)}`;
198
- });
224
+ return state ? this.#renderChips(state, (expr) => this.#chipSelectFor(expr)) : nothing;
199
225
  }
200
226
  renderFilterActions() {
201
227
  return html `
@@ -234,12 +260,18 @@ export default class IgcFilterRow extends LitElement {
234
260
  </igc-dropdown>`;
235
261
  }
236
262
  renderDropdownTarget() {
263
+ const condition = this.condition.label ?? this.condition.name;
237
264
  return html `<igc-icon
238
265
  id="condition"
239
266
  slot="prefix"
240
267
  collection="internal"
268
+ role="button"
269
+ tabindex="0"
270
+ aria-haspopup="listbox"
271
+ aria-label=${`Filter condition: ${condition}`}
241
272
  .name=${this.condition.name}
242
273
  @click=${this.#openDropdownList}
274
+ @keydown=${this.#handleConditionKeydown}
243
275
  >
244
276
  </igc-icon>`;
245
277
  }
@@ -248,7 +280,7 @@ export default class IgcFilterRow extends LitElement {
248
280
  <igc-input
249
281
  outlined
250
282
  value=${ifDefined(this.expression.searchTerm)}
251
- placeholder="Add filter value"
283
+ placeholder=${`Filter ${this.#nameFor(this.column.field)}`}
252
284
  ?readonly=${this.condition.unary}
253
285
  @igcInput=${this.#handleInput}
254
286
  @keydown=${this.#handleKeydown}
@@ -260,7 +292,10 @@ export default class IgcFilterRow extends LitElement {
260
292
  }
261
293
  renderActiveState() {
262
294
  return html `
263
- <div part="active-state">
295
+ <div
296
+ part="active-state"
297
+ role="gridcell"
298
+ >
264
299
  <div part="filter-row-input">${this.renderInputArea()}</div>
265
300
  <div part="filter-row-filters">${this.renderActiveChips()}</div>
266
301
  <div part="filter-row-actions">${this.renderFilterActions()}</div>
@@ -268,49 +303,44 @@ export default class IgcFilterRow extends LitElement {
268
303
  `;
269
304
  }
270
305
  renderInactiveChips(column, state) {
271
- return Array.from(state).map((expression, idx) => {
272
- const props = {
273
- expression,
274
- selected: false,
275
- onRemove: this.#chipRemoveFor(expression),
276
- onSelect: async (e) => {
277
- e.stopPropagation();
278
- this.column = column;
279
- this.expression = expression;
280
- this.#show();
281
- },
282
- };
283
- return html `${this.renderCriteriaButton(expression, idx)}${this.renderExpressionChip(props)}`;
306
+ return this.#renderChips(state, (expression) => async (e) => {
307
+ e.stopPropagation();
308
+ this.column = column;
309
+ this.expression = expression;
310
+ this.#show();
284
311
  });
285
312
  }
286
313
  renderFilterState(column) {
287
314
  const state = this.filterController.get(column.field);
288
- const partial = state && state.length < 3;
289
- const hidden = state && state.length >= 3;
315
+ if (state && state.length < MAX_PREVIEW_CHIPS) {
316
+ return this.renderInactiveChips(column, state);
317
+ }
290
318
  const open = () => {
291
319
  this.column = column;
292
320
  this.#setDefaultExpression();
293
321
  this.#show();
294
322
  };
295
- const count = hidden ? html `<span slot="suffix">${state.length}</span>` : nothing;
296
- const chip = html `<igc-chip
323
+ const count = state ? html `<span slot="suffix">${state.length}</span>` : nothing;
324
+ return html `<igc-chip
297
325
  data-column=${column.field}
326
+ aria-label=${`Filter ${this.#nameFor(column.field)}`}
298
327
  @click=${open}
299
328
  >${prefixedIcon('filter')}Filter${count}</igc-chip
300
329
  >`;
301
- return partial ? this.renderInactiveChips(column, state) : chip;
302
330
  }
303
331
  renderInactiveState() {
304
- return this.state.columns.map((column) => column.hidden
305
- ? nothing
306
- : html `
307
- <div part="filter-row-preview">
308
- ${column.filterable ? this.renderFilterState(column) : nothing}
309
- </div>
310
- `);
332
+ return visibleColumns(this.state.columns).map((column, index) => html `
333
+ <div
334
+ part="filter-row-preview"
335
+ role="gridcell"
336
+ aria-colindex=${index + 1}
337
+ >
338
+ ${column.filterable ? this.renderFilterState(column) : nothing}
339
+ </div>
340
+ `);
311
341
  }
312
342
  render() {
313
- return html `${this.active ? this.renderActiveState() : this.renderInactiveState()}`;
343
+ return this.active ? this.renderActiveState() : this.renderInactiveState();
314
344
  }
315
345
  }
316
346
  __decorate([