igniteui-grid-lite 0.4.0-beta.3 → 0.4.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 +2 -0
- package/components/cell.js +12 -2
- package/components/cell.js.map +1 -1
- package/components/column.d.ts +3 -3
- package/components/column.js.map +1 -1
- package/components/grid.d.ts +7 -7
- package/components/grid.js.map +1 -1
- package/components/row.js +2 -0
- package/components/row.js.map +1 -1
- package/controllers/navigation.d.ts +3 -3
- package/custom-elements.json +1865 -1848
- package/docs/classes/IgcGridLite.html +1 -1
- package/docs/classes/IgcGridLiteColumn.html +2 -2
- 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
|
@@ -25,6 +25,8 @@ export default class IgcGridLiteCell<T extends object> extends LitElement {
|
|
|
25
25
|
* The parent row component holding this cell.
|
|
26
26
|
*/
|
|
27
27
|
row: IgcGridLiteRow<T>;
|
|
28
|
+
rowIndex: number;
|
|
29
|
+
cellTemplate?: (context: IgcCellContext<T>) => unknown;
|
|
28
30
|
protected get context(): IgcCellContext<T>;
|
|
29
31
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
30
32
|
}
|
package/components/cell.js
CHANGED
|
@@ -14,6 +14,7 @@ export default class IgcGridLiteCell extends LitElement {
|
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments);
|
|
16
16
|
this.active = false;
|
|
17
|
+
this.rowIndex = -1;
|
|
17
18
|
}
|
|
18
19
|
static get tagName() {
|
|
19
20
|
return GRID_CELL_TAG;
|
|
@@ -31,8 +32,8 @@ export default class IgcGridLiteCell extends LitElement {
|
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
34
|
render() {
|
|
34
|
-
return html `${cache(this.
|
|
35
|
-
? this.
|
|
35
|
+
return html `${cache(this.cellTemplate
|
|
36
|
+
? this.cellTemplate(this.context)
|
|
36
37
|
: html `<span part="text">${this.value}</span>`)}`;
|
|
37
38
|
}
|
|
38
39
|
}
|
|
@@ -45,4 +46,13 @@ __decorate([
|
|
|
45
46
|
__decorate([
|
|
46
47
|
property({ type: Boolean, reflect: true })
|
|
47
48
|
], IgcGridLiteCell.prototype, "active", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
property({ attribute: false })
|
|
51
|
+
], IgcGridLiteCell.prototype, "row", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
property({ attribute: false })
|
|
54
|
+
], IgcGridLiteCell.prototype, "rowIndex", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
property({ attribute: false })
|
|
57
|
+
], IgcGridLiteCell.prototype, "cellTemplate", void 0);
|
|
48
58
|
//# 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,EAAE,MAAM,KAAK,CAAC;AACvC,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,MAA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IACN,CAAC;;AA1CM;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 } 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 /**\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 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":[],"m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AE,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"]}
|
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;
|
|
@@ -224,6 +224,6 @@ export declare class IgcGridLite<T extends object> extends EventEmitterBase<IgcG
|
|
|
224
224
|
}
|
|
225
225
|
declare global {
|
|
226
226
|
interface HTMLElementTagNameMap {
|
|
227
|
-
[IgcGridLite.tagName]: IgcGridLite
|
|
227
|
+
[IgcGridLite.tagName]: IgcGridLite;
|
|
228
228
|
}
|
|
229
229
|
}
|
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,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAO/C,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CA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AE,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,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,CAA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B,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 = 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 /** 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;\n }\n}\n"]}
|
package/components/row.js
CHANGED
|
@@ -38,7 +38,9 @@ export default class IgcGridLiteRow extends LitElement {
|
|
|
38
38
|
part="cell"
|
|
39
39
|
.active=${key === column.field && index === this.index}
|
|
40
40
|
.column=${column}
|
|
41
|
+
.cellTemplate=${column.cellTemplate}
|
|
41
42
|
.row=${this}
|
|
43
|
+
.rowIndex=${this.index}
|
|
42
44
|
.value=${resolveFieldValue(data, column.field)}
|
|
43
45
|
></igc-grid-lite-cell>`)}
|
|
44
46
|
`;
|
package/components/row.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row.js","sourceRoot":"","sources":["../../src/components/row.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,eAAe,MAAM,WAAW,CAAC;AAKxC,MAAM,CAAC,OAAO,OAAO,cAAiC,SAAQ,UAAU;IAAxE;;QAcS,YAAO,GAAkC,EAAE,CAAC;QAM5C,UAAK,GAAG,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"row.js","sourceRoot":"","sources":["../../src/components/row.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC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;+CACoB;AAG5C;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;kDACG;AAG3B;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;6CAC3B","sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { map } from 'lit/directives/map.js';\nimport { registerComponent } from '../internal/register.js';\nimport { GRID_ROW_TAG } from '../internal/tags.js';\nimport type { ActiveNode, ColumnConfiguration } from '../internal/types.js';\nimport { resolveFieldValue } from '../internal/utils.js';\nimport { styles } from '../styles/body-row/body-row.css.js';\nimport IgcGridLiteCell from './cell.js';\n\n/**\n * Component representing the DOM row in the IgcGridLite.\n */\nexport default class IgcGridLiteRow<T extends object> extends LitElement {\n public static get tagName() {\n return GRID_ROW_TAG;\n }\n public static override styles = styles;\n\n public static register(): void {\n registerComponent(IgcGridLiteRow, IgcGridLiteCell);\n }\n\n @property({ attribute: false })\n public data?: T;\n\n @property({ attribute: false })\n public columns: Array<ColumnConfiguration<T>> = [];\n\n @property({ attribute: false })\n public activeNode?: ActiveNode<T>;\n\n @property({ type: Number, attribute: false })\n public index = -1;\n\n public get cells(): IgcGridLiteCell<T>[] {\n return Array.from(\n this.renderRoot.querySelectorAll<IgcGridLiteCell<T>>(IgcGridLiteCell.tagName)\n );\n }\n\n protected override render() {\n const { column: key, row: index } = this.activeNode ?? {};\n const data = this.data ?? ({} as T);\n\n return html`\n ${map(this.columns, (column) =>\n column.hidden\n ? nothing\n : html`<igc-grid-lite-cell\n part=\"cell\"\n .active=${key === column.field && index === this.index}\n .column=${column}\n .cellTemplate=${column.cellTemplate}\n .row=${this as IgcGridLiteRow<T>}\n .rowIndex=${this.index}\n .value=${resolveFieldValue(data, column.field)}\n ></igc-grid-lite-cell>`\n )}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [IgcGridLiteRow.tagName]: IgcGridLiteRow<object>;\n }\n}\n"]}
|
|
@@ -10,9 +10,9 @@ export declare class NavigationController<T extends object> implements ReactiveC
|
|
|
10
10
|
protected _active: Readonly<ActiveNode<any>>;
|
|
11
11
|
protected get nextNode(): ActiveNode<T>;
|
|
12
12
|
protected get _columns(): import("../index.js").ColumnConfiguration<T>[];
|
|
13
|
-
protected get _firstColumn(): Exclude<keyof T & string, keyof T> | (Keys<T> & string) | (Keys<T> & number) | (Keys<T> & symbol) | (Keys<T> & `${string}.${string}`);
|
|
14
|
-
protected getPreviousColumn(key: Keys<T>): Exclude<keyof T & string, keyof T> | (Keys<T> & string) | (Keys<T> & number) | (Keys<T> & symbol) | (Keys<T> & `${string}.${string}`);
|
|
15
|
-
protected getNextColumn(key: Keys<T>): Exclude<keyof T & string, keyof T> | (Keys<T> & string) | (Keys<T> & number) | (Keys<T> & symbol) | (Keys<T> & `${string}.${string}`);
|
|
13
|
+
protected get _firstColumn(): Exclude<keyof T & string, keyof T> | (Keys<T> & string) | (Keys<T> & number) | (Keys<T> & symbol) | (Keys<T> & `${string}.${string}`) | (Keys<T> & `${string}.${string}.${string}`);
|
|
14
|
+
protected getPreviousColumn(key: Keys<T>): Exclude<keyof T & string, keyof T> | (Keys<T> & string) | (Keys<T> & number) | (Keys<T> & symbol) | (Keys<T> & `${string}.${string}`) | (Keys<T> & `${string}.${string}.${string}`);
|
|
15
|
+
protected getNextColumn(key: Keys<T>): Exclude<keyof T & string, keyof T> | (Keys<T> & string) | (Keys<T> & number) | (Keys<T> & symbol) | (Keys<T> & `${string}.${string}`) | (Keys<T> & `${string}.${string}.${string}`);
|
|
16
16
|
protected queryRowByIndex(index: number): IgcGridLiteRow<T>;
|
|
17
17
|
protected scrollToCell(node: ActiveNode<T>): void;
|
|
18
18
|
get active(): ActiveNode<T>;
|