igniteui-grid-lite 0.4.0-beta.3 → 0.5.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.
- package/components/cell.d.ts +6 -1
- package/components/cell.js +24 -2
- package/components/cell.js.map +1 -1
- package/components/column.d.ts +3 -3
- package/components/column.js.map +1 -1
- package/components/filter-row.d.ts +2 -2
- package/components/grid.d.ts +8 -7
- package/components/grid.js +6 -0
- package/components/grid.js.map +1 -1
- package/components/header-row.d.ts +1 -0
- package/components/header-row.js +16 -10
- package/components/header-row.js.map +1 -1
- package/components/header.d.ts +7 -3
- package/components/header.js +34 -13
- package/components/header.js.map +1 -1
- package/components/row.d.ts +1 -0
- package/components/row.js +19 -11
- package/components/row.js.map +1 -1
- package/controllers/navigation.d.ts +3 -3
- package/controllers/resize.d.ts +1 -1
- package/controllers/root-styles.d.ts +15 -0
- package/controllers/root-styles.js +67 -0
- package/controllers/root-styles.js.map +1 -0
- package/custom-elements.json +2046 -1821
- package/docs/assets/hierarchy.js +1 -1
- package/docs/classes/IgcGridLite.html +1 -1
- package/docs/classes/IgcGridLiteColumn.html +2 -2
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/IgcFilteredEvent.html +1 -1
- package/docs/interfaces/IgcFilteringEvent.html +1 -1
- package/docs/interfaces/IgcGridLiteEventMap.html +3 -3
- package/docs/interfaces/IgcHeaderContext.html +2 -2
- package/docs/types/ColumnConfiguration.html +1 -1
- package/docs/types/FilterExpression.html +1 -1
- package/docs/types/IgcCellContext.html +1 -1
- package/docs/types/SortingExpression.html +1 -1
- package/internal/types.d.ts +8 -6
- package/internal/types.js.map +1 -1
- package/operations/filter/types.d.ts +1 -1
- package/operations/filter/types.js.map +1 -1
- package/operations/sort/types.d.ts +1 -1
- package/operations/sort/types.js.map +1 -1
- package/package.json +1 -1
package/components/cell.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
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
4
|
/**
|
|
@@ -8,6 +8,8 @@ export default class IgcGridLiteCell<T extends object> extends LitElement {
|
|
|
8
8
|
static get tagName(): "igc-grid-lite-cell";
|
|
9
9
|
static styles: import("lit").CSSResult;
|
|
10
10
|
static register(): void;
|
|
11
|
+
private readonly _adoptedStylesController;
|
|
12
|
+
adoptRootStyles: boolean;
|
|
11
13
|
/**
|
|
12
14
|
* The value which will be rendered by the component.
|
|
13
15
|
*/
|
|
@@ -25,7 +27,10 @@ export default class IgcGridLiteCell<T extends object> extends LitElement {
|
|
|
25
27
|
* The parent row component holding this cell.
|
|
26
28
|
*/
|
|
27
29
|
row: IgcGridLiteRow<T>;
|
|
30
|
+
rowIndex: number;
|
|
31
|
+
cellTemplate?: (context: IgcCellContext<T>) => unknown;
|
|
28
32
|
protected get context(): IgcCellContext<T>;
|
|
33
|
+
protected update(props: PropertyValues<this>): void;
|
|
29
34
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
30
35
|
}
|
|
31
36
|
declare global {
|
package/components/cell.js
CHANGED
|
@@ -7,13 +7,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { html, LitElement } from 'lit';
|
|
8
8
|
import { property } from 'lit/decorators.js';
|
|
9
9
|
import { cache } from 'lit/directives/cache.js';
|
|
10
|
+
import { AdoptedStylesController } from '../controllers/root-styles.js';
|
|
10
11
|
import { registerComponent } from '../internal/register.js';
|
|
11
12
|
import { GRID_CELL_TAG } from '../internal/tags.js';
|
|
12
13
|
import { styles } from '../styles/body-cell/body-cell.css.js';
|
|
13
14
|
export default class IgcGridLiteCell extends LitElement {
|
|
14
15
|
constructor() {
|
|
15
16
|
super(...arguments);
|
|
17
|
+
this._adoptedStylesController = new AdoptedStylesController(this);
|
|
18
|
+
this.adoptRootStyles = false;
|
|
16
19
|
this.active = false;
|
|
20
|
+
this.rowIndex = -1;
|
|
17
21
|
}
|
|
18
22
|
static get tagName() {
|
|
19
23
|
return GRID_CELL_TAG;
|
|
@@ -30,12 +34,21 @@ export default class IgcGridLiteCell extends LitElement {
|
|
|
30
34
|
value: this.value,
|
|
31
35
|
};
|
|
32
36
|
}
|
|
37
|
+
update(props) {
|
|
38
|
+
if (props.has('adoptRootStyles')) {
|
|
39
|
+
this._adoptedStylesController.shouldAdoptStyles(this.adoptRootStyles && this.cellTemplate != null);
|
|
40
|
+
}
|
|
41
|
+
super.update(props);
|
|
42
|
+
}
|
|
33
43
|
render() {
|
|
34
|
-
return html `${cache(this.
|
|
35
|
-
? this.
|
|
44
|
+
return html `${cache(this.cellTemplate
|
|
45
|
+
? this.cellTemplate(this.context)
|
|
36
46
|
: html `<span part="text">${this.value}</span>`)}`;
|
|
37
47
|
}
|
|
38
48
|
}
|
|
49
|
+
__decorate([
|
|
50
|
+
property({ attribute: false })
|
|
51
|
+
], IgcGridLiteCell.prototype, "adoptRootStyles", void 0);
|
|
39
52
|
__decorate([
|
|
40
53
|
property({ attribute: false })
|
|
41
54
|
], IgcGridLiteCell.prototype, "value", void 0);
|
|
@@ -45,4 +58,13 @@ __decorate([
|
|
|
45
58
|
__decorate([
|
|
46
59
|
property({ type: Boolean, reflect: true })
|
|
47
60
|
], IgcGridLiteCell.prototype, "active", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
property({ attribute: false })
|
|
63
|
+
], IgcGridLiteCell.prototype, "row", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
property({ attribute: false })
|
|
66
|
+
], IgcGridLiteCell.prototype, "rowIndex", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
property({ attribute: false })
|
|
69
|
+
], IgcGridLiteCell.prototype, "cellTemplate", void 0);
|
|
48
70
|
//# sourceMappingURL=cell.js.map
|
package/components/cell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell.js","sourceRoot":"","sources":["../../src/components/cell.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"cell.js","sourceRoot":"","sources":["../../src/components/cell.ts"],"names":[],"mappings":";;;;;;AAAA,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,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,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,IAAI,uBAAuB,CAAC,IAAI,CAAC,CAAC;QAGvE,oBAAe,GAAG,KAAK,CAAC;QAmBxB,WAAM,GAAG,KAAK,CAAC;QASf,aAAQ,GAAG,CAAC,CAAC,CAAC;IA+BvB,CAAC;IAxEQ,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;IAEkB,MAAM,CAAC,KAA2B;QACnD,IAAI,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,wBAAwB,CAAC,iBAAiB,CAC7C,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAClD,CAAC;QACJ,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;;AA1DM;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 { html, LitElement, type PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { cache } from 'lit/directives/cache.js';\nimport { AdoptedStylesController } from '../controllers/root-styles.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 = new AdoptedStylesController(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 protected override update(props: PropertyValues<this>): void {\n if (props.has('adoptRootStyles')) {\n this._adoptedStylesController.shouldAdoptStyles(\n this.adoptRootStyles && this.cellTemplate != null\n );\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"]}
|
package/components/column.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { BaseColumnConfiguration, ColumnSortConfiguration, IgcCellContext,
|
|
|
3
3
|
/**
|
|
4
4
|
* @element igc-grid-lite-column
|
|
5
5
|
*/
|
|
6
|
-
export declare class IgcGridLiteColumn<T extends object> extends LitElement implements BaseColumnConfiguration<T> {
|
|
6
|
+
export declare class IgcGridLiteColumn<T extends object = any> extends LitElement implements BaseColumnConfiguration<T> {
|
|
7
7
|
static get tagName(): "igc-grid-lite-column";
|
|
8
8
|
static styles: import("lit").CSSResult;
|
|
9
9
|
static register(): void;
|
|
@@ -34,12 +34,12 @@ export declare class IgcGridLiteColumn<T extends object> extends LitElement impl
|
|
|
34
34
|
/** Custom header template for the column. */
|
|
35
35
|
headerTemplate?: (params: IgcHeaderContext<T>) => unknown;
|
|
36
36
|
/** Custom cell template for the column. */
|
|
37
|
-
cellTemplate?: (params: IgcCellContext<T>) => unknown;
|
|
37
|
+
cellTemplate?: (params: IgcCellContext<T, any>) => unknown;
|
|
38
38
|
protected update(props: PropertyValues<this>): void;
|
|
39
39
|
protected render(): unknown;
|
|
40
40
|
}
|
|
41
41
|
declare global {
|
|
42
42
|
interface HTMLElementTagNameMap {
|
|
43
|
-
[IgcGridLiteColumn.tagName]: IgcGridLiteColumn
|
|
43
|
+
[IgcGridLiteColumn.tagName]: IgcGridLiteColumn;
|
|
44
44
|
}
|
|
45
45
|
}
|
package/components/column.js.map
CHANGED
|
@@ -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,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,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"]}
|
|
@@ -26,7 +26,7 @@ export default class IgcFilterRow<T extends object> extends LitElement {
|
|
|
26
26
|
column: ColumnConfiguration<T>;
|
|
27
27
|
expression: FilterExpression<T>;
|
|
28
28
|
protected activeChanged(): void;
|
|
29
|
-
protected renderCriteriaButton(expr: FilterExpression<T>, index: number):
|
|
29
|
+
protected renderCriteriaButton(expr: FilterExpression<T>, index: number): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
30
30
|
protected renderExpressionChip(props: ExpressionChipProps<T>): import("lit-html").TemplateResult<1>;
|
|
31
31
|
protected renderActiveChips(): typeof nothing | import("lit-html").TemplateResult<1>[];
|
|
32
32
|
protected renderFilterActions(): import("lit-html").TemplateResult<1>;
|
|
@@ -36,7 +36,7 @@ export default class IgcFilterRow<T extends object> extends LitElement {
|
|
|
36
36
|
protected renderActiveState(): import("lit-html").TemplateResult<1>;
|
|
37
37
|
protected renderInactiveChips(column: ColumnConfiguration<T>, state: FilterExpressionTree<T>): import("lit-html").TemplateResult<1>[];
|
|
38
38
|
protected renderFilterState(column: ColumnConfiguration<T>): import("lit-html").TemplateResult<1> | import("lit-html").TemplateResult<1>[];
|
|
39
|
-
protected renderInactiveState(): (
|
|
39
|
+
protected renderInactiveState(): (import("lit-html").TemplateResult<1> | typeof nothing)[];
|
|
40
40
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
41
41
|
}
|
|
42
42
|
declare global {
|
package/components/grid.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import IgcGridLiteRow from './row.js';
|
|
|
8
8
|
/**
|
|
9
9
|
* Event object for the filtering event of the grid.
|
|
10
10
|
*/
|
|
11
|
-
export interface IgcFilteringEvent<T extends object> {
|
|
11
|
+
export interface IgcFilteringEvent<T extends object = any> {
|
|
12
12
|
/**
|
|
13
13
|
* The target column for the filter operation.
|
|
14
14
|
*/
|
|
@@ -31,7 +31,7 @@ export interface IgcFilteringEvent<T extends object> {
|
|
|
31
31
|
/**
|
|
32
32
|
* Event object for the filtered event of the grid.
|
|
33
33
|
*/
|
|
34
|
-
export interface IgcFilteredEvent<T extends object> {
|
|
34
|
+
export interface IgcFilteredEvent<T extends object = any> {
|
|
35
35
|
/**
|
|
36
36
|
* The target column for the filter operation.
|
|
37
37
|
*/
|
|
@@ -44,7 +44,7 @@ export interface IgcFilteredEvent<T extends object> {
|
|
|
44
44
|
/**
|
|
45
45
|
* Events for the igc-grid-lite.
|
|
46
46
|
*/
|
|
47
|
-
export interface IgcGridLiteEventMap<T extends object> {
|
|
47
|
+
export interface IgcGridLiteEventMap<T extends object = any> {
|
|
48
48
|
/**
|
|
49
49
|
* Emitted when sorting is initiated through the UI.
|
|
50
50
|
* Returns the sort expression which will be used for the operation.
|
|
@@ -55,14 +55,14 @@ export interface IgcGridLiteEventMap<T extends object> {
|
|
|
55
55
|
*
|
|
56
56
|
* @event
|
|
57
57
|
*/
|
|
58
|
-
sorting: CustomEvent<SortingExpression<T>>;
|
|
58
|
+
sorting: CustomEvent<SortingExpression<T, any>>;
|
|
59
59
|
/**
|
|
60
60
|
* Emitted when a sort operation initiated through the UI has completed.
|
|
61
61
|
* Returns the sort expression used for the operation.
|
|
62
62
|
*
|
|
63
63
|
* @event
|
|
64
64
|
*/
|
|
65
|
-
sorted: CustomEvent<SortingExpression<T>>;
|
|
65
|
+
sorted: CustomEvent<SortingExpression<T, any>>;
|
|
66
66
|
/**
|
|
67
67
|
* Emitted when filtering is initiated through the UI.
|
|
68
68
|
*
|
|
@@ -95,7 +95,7 @@ export interface IgcGridLiteEventMap<T extends object> {
|
|
|
95
95
|
* @fires filtered - Emitted when a filter operation initiated through the UI has completed.
|
|
96
96
|
*
|
|
97
97
|
*/
|
|
98
|
-
export declare class IgcGridLite<T extends object> extends EventEmitterBase<IgcGridLiteEventMap<T>> {
|
|
98
|
+
export declare class IgcGridLite<T extends object = any> extends EventEmitterBase<IgcGridLiteEventMap<T>> {
|
|
99
99
|
static get tagName(): "igc-grid-lite";
|
|
100
100
|
static styles: import("lit").CSSResult[];
|
|
101
101
|
static register(): void;
|
|
@@ -113,6 +113,7 @@ export declare class IgcGridLite<T extends object> extends EventEmitterBase<IgcG
|
|
|
113
113
|
private _updateObservers;
|
|
114
114
|
private _updateConfiguration;
|
|
115
115
|
protected _dataState: T[];
|
|
116
|
+
adoptRootStyles: boolean;
|
|
116
117
|
/** The data source for the grid. */
|
|
117
118
|
data: T[];
|
|
118
119
|
/**
|
|
@@ -224,6 +225,6 @@ export declare class IgcGridLite<T extends object> extends EventEmitterBase<IgcG
|
|
|
224
225
|
}
|
|
225
226
|
declare global {
|
|
226
227
|
interface HTMLElementTagNameMap {
|
|
227
|
-
[IgcGridLite.tagName]: IgcGridLite
|
|
228
|
+
[IgcGridLite.tagName]: IgcGridLite;
|
|
228
229
|
}
|
|
229
230
|
}
|
package/components/grid.js
CHANGED
|
@@ -115,6 +115,7 @@ export class IgcGridLite extends EventEmitterBase {
|
|
|
115
115
|
this._initialSortExpressions = [];
|
|
116
116
|
this._initialFilterExpressions = [];
|
|
117
117
|
this._dataState = [];
|
|
118
|
+
this.adoptRootStyles = false;
|
|
118
119
|
this.data = [];
|
|
119
120
|
this.autoGenerate = false;
|
|
120
121
|
this.sortingOptions = {
|
|
@@ -131,6 +132,7 @@ export class IgcGridLite extends EventEmitterBase {
|
|
|
131
132
|
part="row"
|
|
132
133
|
exportparts="cell"
|
|
133
134
|
style=${styleMap(styles)}
|
|
135
|
+
.adoptRootStyles=${this.adoptRootStyles}
|
|
134
136
|
.index=${index}
|
|
135
137
|
.activeNode=${activeNode}
|
|
136
138
|
.data=${item}
|
|
@@ -212,6 +214,7 @@ export class IgcGridLite extends EventEmitterBase {
|
|
|
212
214
|
<igc-grid-lite-header-row
|
|
213
215
|
tabindex="0"
|
|
214
216
|
style=${styleMap(this._domController.columnSizes)}
|
|
217
|
+
.adoptRootStyles=${this.adoptRootStyles}
|
|
215
218
|
.columns=${this._stateController.columns}
|
|
216
219
|
></igc-grid-lite-header-row>
|
|
217
220
|
`;
|
|
@@ -243,6 +246,9 @@ export class IgcGridLite extends EventEmitterBase {
|
|
|
243
246
|
__decorate([
|
|
244
247
|
state()
|
|
245
248
|
], IgcGridLite.prototype, "_dataState", void 0);
|
|
249
|
+
__decorate([
|
|
250
|
+
property({ type: Boolean, reflect: true, attribute: 'adopt-root-styles' })
|
|
251
|
+
], IgcGridLite.prototype, "adoptRootStyles", void 0);
|
|
246
252
|
__decorate([
|
|
247
253
|
property({ attribute: false })
|
|
248
254
|
], IgcGridLite.prototype, "data", void 0);
|
package/components/grid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid.js","sourceRoot":"","sources":["../../src/components/grid.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EACL,qBAAqB,IAAI,oBAAoB,EAC7C,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CA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vB,OAAO,IAAI,CAAA;;QAEP,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,eAAe,EAAE,IAAI,IAAI,CAAC,gBAAgB,EAAE;QAC3E,IAAI,CAAC,gBAAgB,EAAE,IAAI,IAAI,CAAC,WAAW,EAAE;KAChD,CAAC;IACJ,CAAC;;AAjTS;IADT,KAAK,EAAE;+CACuB;AAIxB;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;yCACT;AA2Bf;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;iDAC5B;AAIrB;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;mDAG7B;AAMK;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;8DACiC;AAiBhE;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;qDAG9B;AAiBD;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;oDAG9B;AAiCS;IADT,KAAK,CAAC,MAAM,CAAC;8CAUb;AAGe;IADf,KAAK,CAAC,QAAQ,CAAC;2CAGf;AA2GS;IADT,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDAO/B","sourcesContent":["import { ContextProvider } from '@lit/context';\nimport type { RenderItemFunction } from '@lit-labs/virtualizer/virtualize.js';\nimport {\n θaddThemingController as addThemingController,\n IgcButtonComponent,\n IgcChipComponent,\n IgcDropdownComponent,\n IgcInputComponent,\n} from 'igniteui-webcomponents';\nimport { html, nothing } from 'lit';\nimport { eventOptions, property, state } from 'lit/decorators.js';\nimport { cache } from 'lit/directives/cache.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { createDataOperationsController } from '../controllers/data-operation.js';\nimport { createDomController } from '../controllers/dom.js';\nimport { createStateController } from '../controllers/state.js';\nimport { PIPELINE } from '../internal/constants.js';\nimport { COLUMN_UPDATE_CONTEXT, GRID_STATE_CONTEXT } from '../internal/context.js';\nimport { getElementFromEventPath } from '../internal/element-from-event-path.js';\nimport { EventEmitterBase } from '../internal/mixins/event-emitter.js';\nimport { registerComponent } from '../internal/register.js';\nimport { GRID_TAG } from '../internal/tags.js';\nimport type {\n ColumnConfiguration,\n DataPipelineConfiguration,\n GridLiteSortingOptions,\n Keys,\n} from '../internal/types.js';\nimport { asArray, getFilterOperandsFor, isNumber, isString } from '../internal/utils.js';\nimport { watch } from '../internal/watch.js';\nimport type { FilterExpression } from '../operations/filter/types.js';\nimport type { SortingExpression } from '../operations/sort/types.js';\nimport { styles } from '../styles/themes/grid.base.css.js';\nimport { all } from '../styles/themes/grid-themes.js';\nimport { styles as shared } from '../styles/themes/shared/grid.common.css.js';\nimport IgcGridLiteCell from './cell.js';\nimport { IgcGridLiteColumn } from './column.js';\nimport IgcFilterRow from './filter-row.js';\nimport IgcGridLiteHeaderRow from './header-row.js';\nimport IgcGridLiteRow from './row.js';\nimport IgcVirtualizer from './virtualizer.js';\n\n/** Column reducer matching either direct column element or one nested in container */\nfunction columnReducer<T extends Element>(acc: T[], el: T): T[] {\n const tag = IgcGridLiteColumn.tagName;\n const column = el.matches(tag) ? el : el.querySelector(tag);\n if (column) acc.push(column as T);\n return acc;\n}\n\n/**\n * Event object for the filtering event of the grid.\n */\nexport interface IgcFilteringEvent<T extends object> {\n /**\n * The target column for the filter operation.\n */\n key: Keys<T>;\n\n /**\n * The filter expression(s) to apply.\n */\n expressions: FilterExpression<T>[];\n\n /**\n * The type of modification which will be applied to the filter\n * state of the column.\n *\n * @remarks\n * `add` - a new filter expression will be added to the state of the column.\n * `modify` - an existing filter expression will be modified.\n * `remove` - the expression(s) will be removed from the state of the column.\n */\n type: 'add' | 'modify' | 'remove';\n}\n\n/**\n * Event object for the filtered event of the grid.\n */\nexport interface IgcFilteredEvent<T extends object> {\n /**\n * The target column for the filter operation.\n */\n key: Keys<T>;\n\n /**\n * The filter state of the column after the operation.\n */\n state: FilterExpression<T>[];\n}\n\n/**\n * Events for the igc-grid-lite.\n */\nexport interface IgcGridLiteEventMap<T extends object> {\n /**\n * Emitted when sorting is initiated through the UI.\n * Returns the sort expression which will be used for the operation.\n *\n * @remarks\n * The event is cancellable which prevents the operation from being applied.\n * The expression can be modified prior to the operation running.\n *\n * @event\n */\n sorting: CustomEvent<SortingExpression<T>>;\n /**\n * Emitted when a sort operation initiated through the UI has completed.\n * Returns the sort expression used for the operation.\n *\n * @event\n */\n sorted: CustomEvent<SortingExpression<T>>;\n /**\n * Emitted when filtering is initiated through the UI.\n *\n * @remarks\n * The event is cancellable which prevents the operation from being applied.\n * The expression can be modified prior to the operation running.\n *\n * @event\n */\n filtering: CustomEvent<IgcFilteringEvent<T>>;\n /**\n * Emitted when a filter operation initiated through the UI has completed.\n * Returns the filter state for the affected column.\n *\n * @event\n */\n filtered: CustomEvent<IgcFilteredEvent<T>>;\n}\n\n/**\n * IgcGridLite is a web component for displaying data in a tabular format quick and easy.\n *\n * Out of the box it provides row virtualization, sort and filter operations (client and server side),\n * the ability to template cells and headers and column hiding.\n *\n * @element igc-grid-lite\n *\n * @fires sorting - Emitted when sorting is initiated through the UI.\n * @fires sorted - Emitted when a sort operation initiated through the UI has completed.\n * @fires filtering - Emitted when filtering is initiated through the UI.\n * @fires filtered - Emitted when a filter operation initiated through the UI has completed.\n *\n */\nexport class IgcGridLite<T extends object> extends EventEmitterBase<IgcGridLiteEventMap<T>> {\n public static get tagName() {\n return GRID_TAG;\n }\n\n public static override styles = [styles, shared];\n\n public static register(): void {\n registerComponent(\n IgcGridLite,\n IgcGridLiteColumn,\n IgcVirtualizer,\n IgcGridLiteRow,\n IgcGridLiteHeaderRow,\n IgcFilterRow,\n IgcButtonComponent,\n IgcChipComponent,\n IgcInputComponent,\n IgcDropdownComponent\n );\n }\n\n protected readonly _stateController = createStateController(this, this._updateObservers);\n protected readonly _domController = createDomController(this, this._stateController);\n protected readonly _dataController = createDataOperationsController(this);\n\n protected readonly _stateProvider = new ContextProvider(this, {\n context: GRID_STATE_CONTEXT,\n initialValue: this._stateController,\n });\n\n protected readonly _columnUpdateProvider = new ContextProvider(this, {\n context: COLUMN_UPDATE_CONTEXT,\n initialValue: ((config: ColumnConfiguration<T>) => {\n this._updateConfiguration(config);\n }) as any,\n });\n\n private _initialSortExpressions: SortingExpression<T>[] = [];\n private _initialFilterExpressions: FilterExpression<T>[] = [];\n\n private _updateObservers(): void {\n this._stateProvider.updateObservers();\n }\n\n private _updateConfiguration(config: ColumnConfiguration<T>): void {\n this._stateController.updateColumnsConfiguration(asArray(config));\n }\n\n @state()\n protected _dataState: T[] = [];\n\n /** The data source for the grid. */\n @property({ attribute: false })\n public data: T[] = [];\n\n /**\n * Whether the grid will try to \"resolve\" its column configuration based on the passed\n * data source.\n *\n * @remarks\n * This is usually executed on initial rendering in the DOM. It depends on having an existing data source\n * to infer the column configuration for the grid.\n * Passing an empty data source or having a late bound data source (such as a HTTP request) will usually\n * result in empty column configuration for the grid.\n *\n * This property is ignored if any existing column configuration already exists in the grid.\n *\n * In a scenario where you want to bind a new data source and still keep the auto-generation behavior,\n * make sure to reset the column collection of the grid before passing in the new data source.\n *\n * @example\n * ```typescript\n * // assuming autoGenerate is set to true\n * grid.columns = [];\n * grid.data = [...];\n * ```\n *\n * @attr auto-generate\n */\n @property({ type: Boolean, attribute: 'auto-generate' })\n public autoGenerate = false;\n\n /** Sort configuration property for the grid. */\n @property({ attribute: false })\n public sortingOptions: GridLiteSortingOptions = {\n mode: 'multiple',\n };\n\n /**\n * Configuration object which controls remote data operations for the grid.\n */\n @property({ attribute: false })\n public dataPipelineConfiguration!: DataPipelineConfiguration<T>;\n\n /**\n * Set the sort state for the grid.\n */\n public set sortingExpressions(expressions: SortingExpression<T>[]) {\n if (this.hasUpdated && expressions.length) {\n this.sort(expressions);\n } else {\n this._initialSortExpressions = expressions;\n }\n }\n\n /**\n * Get the sort state for the grid.\n */\n @property({ attribute: false })\n public get sortingExpressions(): SortingExpression<T>[] {\n return Array.from(this._stateController.sorting.state.values());\n }\n\n /**\n * Set the filter state for the grid.\n */\n public set filterExpressions(expressions: FilterExpression<T>[]) {\n if (this.hasUpdated && expressions.length) {\n this.filter(expressions);\n } else {\n this._initialFilterExpressions = expressions;\n }\n }\n\n /**\n * Get the filter state for the grid.\n */\n @property({ attribute: false })\n public get filterExpressions(): FilterExpression<T>[] {\n return this._stateController.filtering.state.values.flatMap((each) => each.all);\n }\n\n public get columns(): ColumnConfiguration<T>[] {\n return this._stateController.columns.map((col) => ({ ...col }));\n }\n\n /**\n * Returns the collection of rendered row elements in the grid.\n *\n * @remarks\n * Since the grid has virtualization, this property returns only the currently rendered\n * chunk of elements in the DOM.\n */\n public get rows() {\n return this._stateController.rows;\n }\n\n /**\n * Returns the state of the data source after sort/filter operations\n * have been applied.\n */\n public get dataView(): ReadonlyArray<T> {\n return this._dataState;\n }\n\n /**\n * The total number of items in the {@link IgcGridLite.dataView} collection.\n */\n public get totalItems(): number {\n return this._dataState.length;\n }\n\n @watch('data')\n protected dataChanged() {\n this._dataState = [...this.data];\n\n if (this.hasUpdated) {\n if (!this._hasAssignedColumns()) {\n this._stateController.setAutoColumnConfiguration();\n }\n this.pipeline();\n }\n }\n\n @watch(PIPELINE)\n protected async pipeline() {\n this._dataState = await this._dataController.apply([...this.data], this._stateController);\n }\n\n constructor() {\n super();\n\n addThemingController(this, all);\n }\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const root = super.createRenderRoot();\n root.addEventListener('slotchange', this._handleSlotChange.bind(this));\n return root;\n }\n\n protected override firstUpdated(): void {\n this.updateComplete.then(() => {\n if (this.autoGenerate && !this._hasAssignedColumns()) {\n this._stateController.setAutoColumnConfiguration();\n }\n\n if (this._initialFilterExpressions.length) {\n this.filter(this._initialFilterExpressions);\n }\n\n if (this._initialSortExpressions.length) {\n this.sort(this._initialSortExpressions);\n }\n });\n }\n\n private _hasAssignedColumns(): boolean {\n const slot = this.renderRoot.querySelector('slot') as HTMLSlotElement;\n const assignedNodes = slot\n .assignedElements({ flatten: true })\n .reduce<Element[]>(columnReducer, []);\n return assignedNodes.length > 0;\n }\n\n private _handleSlotChange(event: Event): void {\n const slot = event.target as HTMLSlotElement;\n const assignedNodes = slot\n .assignedElements({ flatten: true })\n .reduce<Element[]>(columnReducer, []);\n\n this._stateController.setColumnConfiguration(\n assignedNodes as unknown as ColumnConfiguration<T>[]\n );\n }\n\n /**\n * Performs a filter operation in the grid based on the passed expression(s).\n */\n public filter(config: FilterExpression<T> | FilterExpression<T>[]): void {\n this._stateController.filtering.filter(\n asArray(config).map((each) =>\n isString(each.condition)\n ? Object.assign(each, {\n condition: (getFilterOperandsFor(this.getColumn(each.key)!) as any)[each.condition],\n })\n : each\n )\n );\n }\n\n /**\n * Performs a sort operation in the grid based on the passed expression(s).\n */\n public sort(expressions: SortingExpression<T> | SortingExpression<T>[]) {\n this._stateController.sorting.sort(expressions);\n }\n\n /**\n * Resets the current sort state of the control.\n */\n public clearSort(key?: Keys<T>): void {\n this._stateController.sorting.reset(key);\n this.requestUpdate(PIPELINE);\n }\n\n /**\n * Resets the current filter state of the control.\n */\n public clearFilter(key?: Keys<T>): void {\n this._stateController.filtering.reset(key);\n this.requestUpdate(PIPELINE);\n }\n\n /**\n * Navigates to a position in the grid based on provided row index and column field.\n * @param row The row index to navigate to\n * @param column The column field to navigate to, if any\n * @param activate Optionally also activate the navigated cell\n */\n public async navigateTo(row: number, column?: Keys<T>, activate = false) {\n await this._stateController.navigation.navigateTo(row, column, activate);\n }\n\n /**\n * Returns a {@link ColumnConfiguration} for a given column.\n */\n public getColumn(id: Keys<T> | number): ColumnConfiguration<T> | undefined {\n return this._stateController.columns.find((column, index) =>\n isNumber(id) ? index === id : column.field === id\n );\n }\n\n @eventOptions({ capture: true })\n protected _bodyClickHandler(event: PointerEvent): void {\n const target = getElementFromEventPath<IgcGridLiteCell<T>>(IgcGridLiteCell.tagName, event);\n\n if (target) {\n this._stateController.active = { column: target.column.field, row: target.row.index };\n }\n }\n\n protected _bodyKeydownHandler(event: KeyboardEvent): void {\n if (event.target === this._stateController.virtualizer) {\n this._stateController.navigation.navigate(event);\n }\n }\n\n protected _renderRow: RenderItemFunction<T> = (item: T, index: number) => {\n const styles = {\n ...this._domController.columnSizes,\n ...this._domController.getActiveRowStyles(index),\n };\n const activeNode = this._stateController.active;\n\n return html`\n <igc-grid-lite-row\n part=\"row\"\n exportparts=\"cell\"\n style=${styleMap(styles)}\n .index=${index}\n .activeNode=${activeNode}\n .data=${item}\n .columns=${this._stateController.columns}\n ></igc-grid-lite-row>\n `;\n };\n\n protected _renderHeaderRow() {\n return html`\n <igc-grid-lite-header-row\n tabindex=\"0\"\n style=${styleMap(this._domController.columnSizes)}\n .columns=${this._stateController.columns}\n ></igc-grid-lite-header-row>\n `;\n }\n\n protected _renderBody() {\n return html`\n <igc-virtualizer\n tabindex=\"0\"\n .items=${this._dataState}\n .renderItem=${this._renderRow}\n @click=${this._bodyClickHandler}\n @keydown=${this._bodyKeydownHandler}\n ></igc-virtualizer>\n `;\n }\n\n protected _renderFilterRow() {\n return html`${cache(\n this._stateController.columns.some((column) => column.filterable)\n ? html`<igc-filter-row style=${styleMap(this._domController.columnSizes)}></igc-filter-row>`\n : nothing\n )}`;\n }\n\n protected override render() {\n return html`\n <slot part=\"column-sink\"></slot>\n ${this._stateController.resizing.renderIndicator()} ${this._renderHeaderRow()}\n ${this._renderFilterRow()} ${this._renderBody()}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [IgcGridLite.tagName]: IgcGridLite<object>;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"grid.js","sourceRoot":"","sources":["../../src/components/grid.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EACL,qBAAqB,IAAI,oBAAoB,EAC7C,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB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;AAiBD;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;oDAG9B;AAiCS;IADT,KAAK,CAAC,MAAM,CAAC;8CAUb;AAGe;IADf,KAAK,CAAC,QAAQ,CAAC;2CAGf;AA2GS;IADT,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDAO/B","sourcesContent":["import { ContextProvider } from '@lit/context';\nimport type { RenderItemFunction } from '@lit-labs/virtualizer/virtualize.js';\nimport {\n θaddThemingController as addThemingController,\n IgcButtonComponent,\n IgcChipComponent,\n IgcDropdownComponent,\n IgcInputComponent,\n} from 'igniteui-webcomponents';\nimport { html, nothing } from 'lit';\nimport { eventOptions, property, state } from 'lit/decorators.js';\nimport { cache } from 'lit/directives/cache.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { createDataOperationsController } from '../controllers/data-operation.js';\nimport { createDomController } from '../controllers/dom.js';\nimport { createStateController } from '../controllers/state.js';\nimport { PIPELINE } from '../internal/constants.js';\nimport { COLUMN_UPDATE_CONTEXT, GRID_STATE_CONTEXT } from '../internal/context.js';\nimport { getElementFromEventPath } from '../internal/element-from-event-path.js';\nimport { EventEmitterBase } from '../internal/mixins/event-emitter.js';\nimport { registerComponent } from '../internal/register.js';\nimport { GRID_TAG } from '../internal/tags.js';\nimport type {\n ColumnConfiguration,\n DataPipelineConfiguration,\n GridLiteSortingOptions,\n Keys,\n} from '../internal/types.js';\nimport { asArray, getFilterOperandsFor, isNumber, isString } from '../internal/utils.js';\nimport { watch } from '../internal/watch.js';\nimport type { FilterExpression } from '../operations/filter/types.js';\nimport type { SortingExpression } from '../operations/sort/types.js';\nimport { styles } from '../styles/themes/grid.base.css.js';\nimport { all } from '../styles/themes/grid-themes.js';\nimport { styles as shared } from '../styles/themes/shared/grid.common.css.js';\nimport IgcGridLiteCell from './cell.js';\nimport { IgcGridLiteColumn } from './column.js';\nimport IgcFilterRow from './filter-row.js';\nimport IgcGridLiteHeaderRow from './header-row.js';\nimport IgcGridLiteRow from './row.js';\nimport IgcVirtualizer from './virtualizer.js';\n\n/** Column reducer matching either direct column element or one nested in container */\nfunction columnReducer<T extends Element>(acc: T[], el: T): T[] {\n const tag = IgcGridLiteColumn.tagName;\n const column = el.matches(tag) ? el : el.querySelector(tag);\n if (column) acc.push(column as T);\n return acc;\n}\n\n/**\n * Event object for the filtering event of the grid.\n */\nexport interface IgcFilteringEvent<T extends object = any> {\n /**\n * The target column for the filter operation.\n */\n key: Keys<T>;\n\n /**\n * The filter expression(s) to apply.\n */\n expressions: FilterExpression<T>[];\n\n /**\n * The type of modification which will be applied to the filter\n * state of the column.\n *\n * @remarks\n * `add` - a new filter expression will be added to the state of the column.\n * `modify` - an existing filter expression will be modified.\n * `remove` - the expression(s) will be removed from the state of the column.\n */\n type: 'add' | 'modify' | 'remove';\n}\n\n/**\n * Event object for the filtered event of the grid.\n */\nexport interface IgcFilteredEvent<T extends object = any> {\n /**\n * The target column for the filter operation.\n */\n key: Keys<T>;\n\n /**\n * The filter state of the column after the operation.\n */\n state: FilterExpression<T>[];\n}\n\n/**\n * Events for the igc-grid-lite.\n */\nexport interface IgcGridLiteEventMap<T extends object = any> {\n /**\n * Emitted when sorting is initiated through the UI.\n * Returns the sort expression which will be used for the operation.\n *\n * @remarks\n * The event is cancellable which prevents the operation from being applied.\n * The expression can be modified prior to the operation running.\n *\n * @event\n */\n sorting: CustomEvent<SortingExpression<T, any>>;\n /**\n * Emitted when a sort operation initiated through the UI has completed.\n * Returns the sort expression used for the operation.\n *\n * @event\n */\n sorted: CustomEvent<SortingExpression<T, any>>;\n /**\n * Emitted when filtering is initiated through the UI.\n *\n * @remarks\n * The event is cancellable which prevents the operation from being applied.\n * The expression can be modified prior to the operation running.\n *\n * @event\n */\n filtering: CustomEvent<IgcFilteringEvent<T>>;\n /**\n * Emitted when a filter operation initiated through the UI has completed.\n * Returns the filter state for the affected column.\n *\n * @event\n */\n filtered: CustomEvent<IgcFilteredEvent<T>>;\n}\n\n/**\n * IgcGridLite is a web component for displaying data in a tabular format quick and easy.\n *\n * Out of the box it provides row virtualization, sort and filter operations (client and server side),\n * the ability to template cells and headers and column hiding.\n *\n * @element igc-grid-lite\n *\n * @fires sorting - Emitted when sorting is initiated through the UI.\n * @fires sorted - Emitted when a sort operation initiated through the UI has completed.\n * @fires filtering - Emitted when filtering is initiated through the UI.\n * @fires filtered - Emitted when a filter operation initiated through the UI has completed.\n *\n */\nexport class IgcGridLite<T extends object = any> extends EventEmitterBase<IgcGridLiteEventMap<T>> {\n public static get tagName() {\n return GRID_TAG;\n }\n\n public static override styles = [styles, shared];\n\n public static register(): void {\n registerComponent(\n IgcGridLite,\n IgcGridLiteColumn,\n IgcVirtualizer,\n IgcGridLiteRow,\n IgcGridLiteHeaderRow,\n IgcFilterRow,\n IgcButtonComponent,\n IgcChipComponent,\n IgcInputComponent,\n IgcDropdownComponent\n );\n }\n\n protected readonly _stateController = createStateController(this, this._updateObservers);\n protected readonly _domController = createDomController(this, this._stateController);\n protected readonly _dataController = createDataOperationsController(this);\n\n protected readonly _stateProvider = new ContextProvider(this, {\n context: GRID_STATE_CONTEXT,\n initialValue: this._stateController,\n });\n\n protected readonly _columnUpdateProvider = new ContextProvider(this, {\n context: COLUMN_UPDATE_CONTEXT,\n initialValue: ((config: ColumnConfiguration<T>) => {\n this._updateConfiguration(config);\n }) as any,\n });\n\n private _initialSortExpressions: SortingExpression<T>[] = [];\n private _initialFilterExpressions: FilterExpression<T>[] = [];\n\n private _updateObservers(): void {\n this._stateProvider.updateObservers();\n }\n\n private _updateConfiguration(config: ColumnConfiguration<T>): void {\n this._stateController.updateColumnsConfiguration(asArray(config));\n }\n\n @state()\n protected _dataState: T[] = [];\n\n @property({ type: Boolean, reflect: true, attribute: 'adopt-root-styles' })\n public adoptRootStyles = false;\n\n /** The data source for the grid. */\n @property({ attribute: false })\n public data: T[] = [];\n\n /**\n * Whether the grid will try to \"resolve\" its column configuration based on the passed\n * data source.\n *\n * @remarks\n * This is usually executed on initial rendering in the DOM. It depends on having an existing data source\n * to infer the column configuration for the grid.\n * Passing an empty data source or having a late bound data source (such as a HTTP request) will usually\n * result in empty column configuration for the grid.\n *\n * This property is ignored if any existing column configuration already exists in the grid.\n *\n * In a scenario where you want to bind a new data source and still keep the auto-generation behavior,\n * make sure to reset the column collection of the grid before passing in the new data source.\n *\n * @example\n * ```typescript\n * // assuming autoGenerate is set to true\n * grid.columns = [];\n * grid.data = [...];\n * ```\n *\n * @attr auto-generate\n */\n @property({ type: Boolean, attribute: 'auto-generate' })\n public autoGenerate = false;\n\n /** Sort configuration property for the grid. */\n @property({ attribute: false })\n public sortingOptions: GridLiteSortingOptions = {\n mode: 'multiple',\n };\n\n /**\n * Configuration object which controls remote data operations for the grid.\n */\n @property({ attribute: false })\n public dataPipelineConfiguration!: DataPipelineConfiguration<T>;\n\n /**\n * Set the sort state for the grid.\n */\n public set sortingExpressions(expressions: SortingExpression<T>[]) {\n if (this.hasUpdated && expressions.length) {\n this.sort(expressions);\n } else {\n this._initialSortExpressions = expressions;\n }\n }\n\n /**\n * Get the sort state for the grid.\n */\n @property({ attribute: false })\n public get sortingExpressions(): SortingExpression<T>[] {\n return Array.from(this._stateController.sorting.state.values());\n }\n\n /**\n * Set the filter state for the grid.\n */\n public set filterExpressions(expressions: FilterExpression<T>[]) {\n if (this.hasUpdated && expressions.length) {\n this.filter(expressions);\n } else {\n this._initialFilterExpressions = expressions;\n }\n }\n\n /**\n * Get the filter state for the grid.\n */\n @property({ attribute: false })\n public get filterExpressions(): FilterExpression<T>[] {\n return this._stateController.filtering.state.values.flatMap((each) => each.all);\n }\n\n public get columns(): ColumnConfiguration<T>[] {\n return this._stateController.columns.map((col) => ({ ...col }));\n }\n\n /**\n * Returns the collection of rendered row elements in the grid.\n *\n * @remarks\n * Since the grid has virtualization, this property returns only the currently rendered\n * chunk of elements in the DOM.\n */\n public get rows() {\n return this._stateController.rows;\n }\n\n /**\n * Returns the state of the data source after sort/filter operations\n * have been applied.\n */\n public get dataView(): ReadonlyArray<T> {\n return this._dataState;\n }\n\n /**\n * The total number of items in the {@link IgcGridLite.dataView} collection.\n */\n public get totalItems(): number {\n return this._dataState.length;\n }\n\n @watch('data')\n protected dataChanged() {\n this._dataState = [...this.data];\n\n if (this.hasUpdated) {\n if (!this._hasAssignedColumns()) {\n this._stateController.setAutoColumnConfiguration();\n }\n this.pipeline();\n }\n }\n\n @watch(PIPELINE)\n protected async pipeline() {\n this._dataState = await this._dataController.apply([...this.data], this._stateController);\n }\n\n constructor() {\n super();\n\n addThemingController(this, all);\n }\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const root = super.createRenderRoot();\n root.addEventListener('slotchange', this._handleSlotChange.bind(this));\n return root;\n }\n\n protected override firstUpdated(): void {\n this.updateComplete.then(() => {\n if (this.autoGenerate && !this._hasAssignedColumns()) {\n this._stateController.setAutoColumnConfiguration();\n }\n\n if (this._initialFilterExpressions.length) {\n this.filter(this._initialFilterExpressions);\n }\n\n if (this._initialSortExpressions.length) {\n this.sort(this._initialSortExpressions);\n }\n });\n }\n\n private _hasAssignedColumns(): boolean {\n const slot = this.renderRoot.querySelector('slot') as HTMLSlotElement;\n const assignedNodes = slot\n .assignedElements({ flatten: true })\n .reduce<Element[]>(columnReducer, []);\n return assignedNodes.length > 0;\n }\n\n private _handleSlotChange(event: Event): void {\n const slot = event.target as HTMLSlotElement;\n const assignedNodes = slot\n .assignedElements({ flatten: true })\n .reduce<Element[]>(columnReducer, []);\n\n this._stateController.setColumnConfiguration(\n assignedNodes as unknown as ColumnConfiguration<T>[]\n );\n }\n\n /**\n * Performs a filter operation in the grid based on the passed expression(s).\n */\n public filter(config: FilterExpression<T> | FilterExpression<T>[]): void {\n this._stateController.filtering.filter(\n asArray(config).map((each) =>\n isString(each.condition)\n ? Object.assign(each, {\n condition: (getFilterOperandsFor(this.getColumn(each.key)!) as any)[each.condition],\n })\n : each\n )\n );\n }\n\n /**\n * Performs a sort operation in the grid based on the passed expression(s).\n */\n public sort(expressions: SortingExpression<T> | SortingExpression<T>[]) {\n this._stateController.sorting.sort(expressions);\n }\n\n /**\n * Resets the current sort state of the control.\n */\n public clearSort(key?: Keys<T>): void {\n this._stateController.sorting.reset(key);\n this.requestUpdate(PIPELINE);\n }\n\n /**\n * Resets the current filter state of the control.\n */\n public clearFilter(key?: Keys<T>): void {\n this._stateController.filtering.reset(key);\n this.requestUpdate(PIPELINE);\n }\n\n /**\n * Navigates to a position in the grid based on provided row index and column field.\n * @param row The row index to navigate to\n * @param column The column field to navigate to, if any\n * @param activate Optionally also activate the navigated cell\n */\n public async navigateTo(row: number, column?: Keys<T>, activate = false) {\n await this._stateController.navigation.navigateTo(row, column, activate);\n }\n\n /**\n * Returns a {@link ColumnConfiguration} for a given column.\n */\n public getColumn(id: Keys<T> | number): ColumnConfiguration<T> | undefined {\n return this._stateController.columns.find((column, index) =>\n isNumber(id) ? index === id : column.field === id\n );\n }\n\n @eventOptions({ capture: true })\n protected _bodyClickHandler(event: PointerEvent): void {\n const target = getElementFromEventPath<IgcGridLiteCell<T>>(IgcGridLiteCell.tagName, event);\n\n if (target) {\n this._stateController.active = { column: target.column.field, row: target.row.index };\n }\n }\n\n protected _bodyKeydownHandler(event: KeyboardEvent): void {\n if (event.target === this._stateController.virtualizer) {\n this._stateController.navigation.navigate(event);\n }\n }\n\n protected _renderRow: RenderItemFunction<T> = (item: T, index: number) => {\n const styles = {\n ...this._domController.columnSizes,\n ...this._domController.getActiveRowStyles(index),\n };\n const activeNode = this._stateController.active;\n\n return html`\n <igc-grid-lite-row\n part=\"row\"\n exportparts=\"cell\"\n style=${styleMap(styles)}\n .adoptRootStyles=${this.adoptRootStyles}\n .index=${index}\n .activeNode=${activeNode}\n .data=${item}\n .columns=${this._stateController.columns}\n ></igc-grid-lite-row>\n `;\n };\n\n protected _renderHeaderRow() {\n return html`\n <igc-grid-lite-header-row\n tabindex=\"0\"\n style=${styleMap(this._domController.columnSizes)}\n .adoptRootStyles=${this.adoptRootStyles}\n .columns=${this._stateController.columns}\n ></igc-grid-lite-header-row>\n `;\n }\n\n protected _renderBody() {\n return html`\n <igc-virtualizer\n tabindex=\"0\"\n .items=${this._dataState}\n .renderItem=${this._renderRow}\n @click=${this._bodyClickHandler}\n @keydown=${this._bodyKeydownHandler}\n ></igc-virtualizer>\n `;\n }\n\n protected _renderFilterRow() {\n return html`${cache(\n this._stateController.columns.some((column) => column.filterable)\n ? html`<igc-filter-row style=${styleMap(this._domController.columnSizes)}></igc-filter-row>`\n : nothing\n )}`;\n }\n\n protected override render() {\n return html`\n <slot part=\"column-sink\"></slot>\n ${this._stateController.resizing.renderIndicator()} ${this._renderHeaderRow()}\n ${this._renderFilterRow()} ${this._renderBody()}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [IgcGridLite.tagName]: IgcGridLite;\n }\n}\n"]}
|
|
@@ -6,6 +6,7 @@ export default class IgcGridLiteHeaderRow<T extends object> extends LitElement {
|
|
|
6
6
|
static styles: import("lit").CSSResult;
|
|
7
7
|
static register(): void;
|
|
8
8
|
private readonly _state?;
|
|
9
|
+
adoptRootStyles: boolean;
|
|
9
10
|
columns: ColumnConfiguration<T>[];
|
|
10
11
|
get headers(): IgcGridLiteHeader<T>[];
|
|
11
12
|
constructor();
|
package/components/header-row.js
CHANGED
|
@@ -5,9 +5,9 @@ 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 { html, LitElement
|
|
8
|
+
import { html, LitElement } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
|
-
import {
|
|
10
|
+
import { repeat } from 'lit/directives/repeat.js';
|
|
11
11
|
import { GRID_STATE_CONTEXT } from '../internal/context.js';
|
|
12
12
|
import { getElementFromEventPath } from '../internal/element-from-event-path.js';
|
|
13
13
|
import { partMap } from '../internal/part-map.js';
|
|
@@ -28,6 +28,7 @@ export default class IgcGridLiteHeaderRow extends LitElement {
|
|
|
28
28
|
}
|
|
29
29
|
constructor() {
|
|
30
30
|
super();
|
|
31
|
+
this.adoptRootStyles = false;
|
|
31
32
|
this.columns = [];
|
|
32
33
|
this.addEventListener('click', this._setActiveFilterColumn);
|
|
33
34
|
}
|
|
@@ -43,19 +44,24 @@ export default class IgcGridLiteHeaderRow extends LitElement {
|
|
|
43
44
|
}
|
|
44
45
|
render() {
|
|
45
46
|
const filterRow = this._state?.filtering.filterRow;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
const columns = this.columns.filter((column) => !column.hidden);
|
|
48
|
+
return html `
|
|
49
|
+
${repeat(columns, (column) => column, (column) => html `
|
|
50
|
+
<igc-grid-lite-header
|
|
51
|
+
part=${partMap({ filtered: column.field === filterRow?.column?.field })}
|
|
52
|
+
.adoptRootStyles=${this.adoptRootStyles}
|
|
53
|
+
.column=${column}
|
|
54
|
+
></igc-grid-lite-header>
|
|
55
|
+
`)}
|
|
56
|
+
`;
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
59
|
__decorate([
|
|
57
60
|
consume({ context: GRID_STATE_CONTEXT, subscribe: true })
|
|
58
61
|
], IgcGridLiteHeaderRow.prototype, "_state", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
property({ attribute: false })
|
|
64
|
+
], IgcGridLiteHeaderRow.prototype, "adoptRootStyles", void 0);
|
|
59
65
|
__decorate([
|
|
60
66
|
property({ attribute: false })
|
|
61
67
|
], IgcGridLiteHeaderRow.prototype, "columns", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-row.js","sourceRoot":"","sources":["../../src/components/header-row.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,UAAU,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,sBAAsB,CAAC,KAAmB;QAChD,MAAM,MAAM,GAAG,uBAAuB,CAAuB,iBAAiB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC/F,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzD,CAAC;IAEkB,YAAY,CAAC,KAA2B;QACzD,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClC,MAAM,CAAC,aAAa,EAAE,CAAC;QACzB,CAAC;QAED,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAEkB,MAAM;QACvB,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC;QACnD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAEhE,OAAO,IAAI,CAAA;QACP,MAAM,CACN,OAAO,EACP,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAClB,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAA;;mBAEL,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,KAAK,KAAK,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;+BACpD,IAAI,CAAC,eAAe;sBAC7B,MAAM;;SAEnB,CACF;KACF,CAAC;IACJ,CAAC;;AAjDgB;IADhB,OAAO,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;oDACb;AAGtC;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;6DACA;AAGxB;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;qDACe","sourcesContent":["import { consume } from '@lit/context';\nimport { html, LitElement, type PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport type { StateController } from '../controllers/state.js';\nimport { GRID_STATE_CONTEXT } from '../internal/context.js';\nimport { getElementFromEventPath } from '../internal/element-from-event-path.js';\nimport { partMap } from '../internal/part-map.js';\nimport { registerComponent } from '../internal/register.js';\nimport { GRID_HEADER_ROW_TAG } from '../internal/tags.js';\nimport type { ColumnConfiguration } from '../internal/types.js';\nimport { styles } from '../styles/header-row/header-row.base.css.js';\nimport IgcGridLiteHeader from './header.js';\n\nexport default class IgcGridLiteHeaderRow<T extends object> extends LitElement {\n public static get tagName() {\n return GRID_HEADER_ROW_TAG;\n }\n public static override styles = styles;\n\n public static register(): void {\n registerComponent(IgcGridLiteHeaderRow, IgcGridLiteHeader);\n }\n\n @consume({ context: GRID_STATE_CONTEXT, subscribe: true })\n private readonly _state?: StateController<T>;\n\n @property({ attribute: false })\n public adoptRootStyles = false;\n\n @property({ attribute: false })\n public columns: ColumnConfiguration<T>[] = [];\n\n public get headers(): IgcGridLiteHeader<T>[] {\n return Array.from(\n this.renderRoot.querySelectorAll<IgcGridLiteHeader<T>>(IgcGridLiteHeader.tagName)\n );\n }\n\n constructor() {\n super();\n this.addEventListener('click', this._setActiveFilterColumn);\n }\n\n private _setActiveFilterColumn(event: PointerEvent): void {\n const header = getElementFromEventPath<IgcGridLiteHeader<T>>(IgcGridLiteHeader.tagName, event);\n this._state?.filtering.setActiveColumn(header?.column);\n }\n\n protected override shouldUpdate(props: PropertyValues<this>): boolean {\n for (const header of this.headers) {\n header.requestUpdate();\n }\n\n return super.shouldUpdate(props);\n }\n\n protected override render() {\n const filterRow = this._state?.filtering.filterRow;\n const columns = this.columns.filter((column) => !column.hidden);\n\n return html`\n ${repeat(\n columns,\n (column) => column,\n (column) => html`\n <igc-grid-lite-header\n part=${partMap({ filtered: column.field === filterRow?.column?.field })}\n .adoptRootStyles=${this.adoptRootStyles}\n .column=${column}\n ></igc-grid-lite-header>\n `\n )}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [IgcGridLiteHeaderRow.tagName]: IgcGridLiteHeaderRow<object>;\n }\n}\n"]}
|
package/components/header.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LitElement, nothing } from 'lit';
|
|
1
|
+
import { LitElement, nothing, type PropertyValues } from 'lit';
|
|
2
2
|
import type { StateController } from '../controllers/state.js';
|
|
3
3
|
import type { ColumnConfiguration, IgcHeaderContext } from '../internal/types.js';
|
|
4
4
|
export default class IgcGridLiteHeader<T extends object> extends LitElement {
|
|
@@ -6,15 +6,19 @@ export default class IgcGridLiteHeader<T extends object> extends LitElement {
|
|
|
6
6
|
static get tagName(): "igc-grid-lite-header";
|
|
7
7
|
static styles: import("lit").CSSResult;
|
|
8
8
|
static register(): void;
|
|
9
|
+
private readonly _adoptedStylesController;
|
|
9
10
|
protected get context(): IgcHeaderContext<T>;
|
|
10
11
|
protected get isSortable(): boolean;
|
|
11
12
|
protected get resizeController(): import("../controllers/resize.js").ResizeController<T>;
|
|
12
13
|
state: StateController<T>;
|
|
13
14
|
column: ColumnConfiguration<T>;
|
|
15
|
+
adoptRootStyles: boolean;
|
|
14
16
|
constructor();
|
|
15
|
-
protected
|
|
17
|
+
protected update(props: PropertyValues<this>): void;
|
|
18
|
+
private _handleThemeChange;
|
|
19
|
+
protected renderSortPart(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
16
20
|
protected renderContentPart(): import("lit-html").TemplateResult<1>;
|
|
17
|
-
protected renderResizePart():
|
|
21
|
+
protected renderResizePart(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
18
22
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
19
23
|
}
|
|
20
24
|
declare global {
|
package/components/header.js
CHANGED
|
@@ -8,6 +8,7 @@ import { consume } from '@lit/context';
|
|
|
8
8
|
import { θaddThemingController as addThemingController, IgcIconComponent, } from 'igniteui-webcomponents';
|
|
9
9
|
import { html, LitElement, nothing } from 'lit';
|
|
10
10
|
import { property } from 'lit/decorators.js';
|
|
11
|
+
import { AdoptedStylesController } from '../controllers/root-styles.js';
|
|
11
12
|
import { MIN_COL_RESIZE_WIDTH, SORT_ICON_ASCENDING, SORT_ICON_DESCENDING, } from '../internal/constants.js';
|
|
12
13
|
import { GRID_STATE_CONTEXT } from '../internal/context.js';
|
|
13
14
|
import { partMap } from '../internal/part-map.js';
|
|
@@ -37,7 +38,33 @@ export default class IgcGridLiteHeader extends LitElement {
|
|
|
37
38
|
}
|
|
38
39
|
constructor() {
|
|
39
40
|
super();
|
|
40
|
-
|
|
41
|
+
this._adoptedStylesController = new AdoptedStylesController(this);
|
|
42
|
+
this.adoptRootStyles = false;
|
|
43
|
+
this.#handleResize = ({ clientX }) => {
|
|
44
|
+
const { left } = this.getBoundingClientRect();
|
|
45
|
+
const width = Math.max(clientX - left, MIN_COL_RESIZE_WIDTH);
|
|
46
|
+
const x = this.offsetLeft + width;
|
|
47
|
+
this.resizeController.resize(this.column, width, x);
|
|
48
|
+
};
|
|
49
|
+
this.#handlePointerLost = () => {
|
|
50
|
+
this.resizeController.indicatorActive = false;
|
|
51
|
+
this.removeEventListener('pointermove', this.#handleResize);
|
|
52
|
+
this.resizeController.stop();
|
|
53
|
+
};
|
|
54
|
+
this.#handleAutosize = () => this.resizeController.autosize(this.column, this);
|
|
55
|
+
addThemingController(this, all, {
|
|
56
|
+
themeChange: this._handleThemeChange,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
update(props) {
|
|
60
|
+
if (props.has('adoptRootStyles')) {
|
|
61
|
+
this._adoptedStylesController.shouldAdoptStyles(this.adoptRootStyles && this.column.headerTemplate != null);
|
|
62
|
+
}
|
|
63
|
+
super.update(props);
|
|
64
|
+
}
|
|
65
|
+
_handleThemeChange() {
|
|
66
|
+
AdoptedStylesController.invalidateCache(this.ownerDocument);
|
|
67
|
+
this._adoptedStylesController.shouldAdoptStyles(this.adoptRootStyles && this.column.headerTemplate != null);
|
|
41
68
|
}
|
|
42
69
|
#addResizeEventHandlers() {
|
|
43
70
|
const config = { once: true };
|
|
@@ -52,12 +79,7 @@ export default class IgcGridLiteHeader extends LitElement {
|
|
|
52
79
|
e.stopPropagation();
|
|
53
80
|
this.state.sorting.sortFromHeaderClick(this.column);
|
|
54
81
|
}
|
|
55
|
-
#handleResize
|
|
56
|
-
const { left } = this.getBoundingClientRect();
|
|
57
|
-
const width = Math.max(clientX - left, MIN_COL_RESIZE_WIDTH);
|
|
58
|
-
const x = this.offsetLeft + width;
|
|
59
|
-
this.resizeController.resize(this.column, width, x);
|
|
60
|
-
};
|
|
82
|
+
#handleResize;
|
|
61
83
|
#handleResizeStart(ev) {
|
|
62
84
|
const { target, pointerId } = ev;
|
|
63
85
|
ev.preventDefault();
|
|
@@ -65,12 +87,8 @@ export default class IgcGridLiteHeader extends LitElement {
|
|
|
65
87
|
this.resizeController.start(this);
|
|
66
88
|
target.setPointerCapture(pointerId);
|
|
67
89
|
}
|
|
68
|
-
#handlePointerLost
|
|
69
|
-
|
|
70
|
-
this.removeEventListener('pointermove', this.#handleResize);
|
|
71
|
-
this.resizeController.stop();
|
|
72
|
-
};
|
|
73
|
-
#handleAutosize = () => this.resizeController.autosize(this.column, this);
|
|
90
|
+
#handlePointerLost;
|
|
91
|
+
#handleAutosize;
|
|
74
92
|
renderSortPart() {
|
|
75
93
|
const state = this.state.sorting.state.get(this.column.field);
|
|
76
94
|
const idx = Array.from(this.state.sorting.state.values()).indexOf(state);
|
|
@@ -135,4 +153,7 @@ __decorate([
|
|
|
135
153
|
__decorate([
|
|
136
154
|
property({ attribute: false })
|
|
137
155
|
], IgcGridLiteHeader.prototype, "column", void 0);
|
|
156
|
+
__decorate([
|
|
157
|
+
property({ attribute: false })
|
|
158
|
+
], IgcGridLiteHeader.prototype, "adoptRootStyles", void 0);
|
|
138
159
|
//# sourceMappingURL=header.js.map
|