igniteui-grid-lite 0.4.0-beta.1 → 0.4.0-beta.3
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/column.js +1 -1
- package/components/column.js.map +1 -1
- package/components/grid.js +10 -4
- package/components/grid.js.map +1 -1
- package/components/header.js +1 -2
- package/components/header.js.map +1 -1
- package/custom-elements.json +1779 -1922
- package/internal/types.d.ts +10 -1
- package/internal/types.js.map +1 -1
- package/package.json +2 -2
- package/styles/themes/grid-header-themes.d.ts +1 -1
- package/styles/themes/grid-header-themes.js +4 -4
- package/styles/themes/grid-header-themes.js.map +1 -1
- package/styles/themes/grid-themes.d.ts +1 -1
- package/styles/themes/grid-themes.js +10 -10
- package/styles/themes/grid-themes.js.map +1 -1
- package/internal/theming.d.ts +0 -34
- package/internal/theming.js +0 -121
- package/internal/theming.js.map +0 -1
package/components/column.js
CHANGED
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,GAAG,KAAK,CAAC;QAIjB,yBAAoB,GAAG,KAAK,CAAC;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;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;uDAC8B","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>\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>) => 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<object>;\n }\n}\n"]}
|
package/components/grid.js
CHANGED
|
@@ -5,7 +5,7 @@ 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 { ContextProvider } from '@lit/context';
|
|
8
|
-
import { IgcButtonComponent, IgcChipComponent, IgcDropdownComponent, IgcInputComponent, } from 'igniteui-webcomponents';
|
|
8
|
+
import { θaddThemingController as addThemingController, IgcButtonComponent, IgcChipComponent, IgcDropdownComponent, IgcInputComponent, } from 'igniteui-webcomponents';
|
|
9
9
|
import { html, nothing } from 'lit';
|
|
10
10
|
import { eventOptions, property, state } from 'lit/decorators.js';
|
|
11
11
|
import { cache } from 'lit/directives/cache.js';
|
|
@@ -19,7 +19,6 @@ import { getElementFromEventPath } from '../internal/element-from-event-path.js'
|
|
|
19
19
|
import { EventEmitterBase } from '../internal/mixins/event-emitter.js';
|
|
20
20
|
import { registerComponent } from '../internal/register.js';
|
|
21
21
|
import { GRID_TAG } from '../internal/tags.js';
|
|
22
|
-
import { addThemingController } from '../internal/theming.js';
|
|
23
22
|
import { asArray, getFilterOperandsFor, isNumber, isString } from '../internal/utils.js';
|
|
24
23
|
import { watch } from '../internal/watch.js';
|
|
25
24
|
import { styles } from '../styles/themes/grid.base.css.js';
|
|
@@ -31,6 +30,13 @@ import IgcFilterRow from './filter-row.js';
|
|
|
31
30
|
import IgcGridLiteHeaderRow from './header-row.js';
|
|
32
31
|
import IgcGridLiteRow from './row.js';
|
|
33
32
|
import IgcVirtualizer from './virtualizer.js';
|
|
33
|
+
function columnReducer(acc, el) {
|
|
34
|
+
const tag = IgcGridLiteColumn.tagName;
|
|
35
|
+
const column = el.matches(tag) ? el : el.querySelector(tag);
|
|
36
|
+
if (column)
|
|
37
|
+
acc.push(column);
|
|
38
|
+
return acc;
|
|
39
|
+
}
|
|
34
40
|
export class IgcGridLite extends EventEmitterBase {
|
|
35
41
|
static get tagName() {
|
|
36
42
|
return GRID_TAG;
|
|
@@ -156,14 +162,14 @@ export class IgcGridLite extends EventEmitterBase {
|
|
|
156
162
|
const slot = this.renderRoot.querySelector('slot');
|
|
157
163
|
const assignedNodes = slot
|
|
158
164
|
.assignedElements({ flatten: true })
|
|
159
|
-
.
|
|
165
|
+
.reduce(columnReducer, []);
|
|
160
166
|
return assignedNodes.length > 0;
|
|
161
167
|
}
|
|
162
168
|
_handleSlotChange(event) {
|
|
163
169
|
const slot = event.target;
|
|
164
170
|
const assignedNodes = slot
|
|
165
171
|
.assignedElements({ flatten: true })
|
|
166
|
-
.
|
|
172
|
+
.reduce(columnReducer, []);
|
|
167
173
|
this._stateController.setColumnConfiguration(assignedNodes);
|
|
168
174
|
}
|
|
169
175
|
filter(config) {
|
package/components/grid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid.js","sourceRoot":"","sources":["../../src/components/grid.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO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{ RenderItemFunction } from '@lit-labs/virtualizer/virtualize.js';\nimport {\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 { addThemingController } from '../internal/theming.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/**\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 .filter((element) => element.matches(IgcGridLiteColumn.tagName));\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 .filter((element) => element.matches(IgcGridLiteColumn.tagName));\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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,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"]}
|
package/components/header.js
CHANGED
|
@@ -5,7 +5,7 @@ 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 { IgcIconComponent } from 'igniteui-webcomponents';
|
|
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
11
|
import { MIN_COL_RESIZE_WIDTH, SORT_ICON_ASCENDING, SORT_ICON_DESCENDING, } from '../internal/constants.js';
|
|
@@ -13,7 +13,6 @@ import { GRID_STATE_CONTEXT } from '../internal/context.js';
|
|
|
13
13
|
import { partMap } from '../internal/part-map.js';
|
|
14
14
|
import { registerComponent } from '../internal/register.js';
|
|
15
15
|
import { GRID_HEADER_TAG } from '../internal/tags.js';
|
|
16
|
-
import { addThemingController } from '../internal/theming.js';
|
|
17
16
|
import { styles } from '../styles/header-cell/header-cell.css.js';
|
|
18
17
|
import { all } from '../styles/themes/grid-header-themes.js';
|
|
19
18
|
export default class IgcGridLiteHeader extends LitElement {
|
package/components/header.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.js","sourceRoot":"","sources":["../../src/components/header.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,
|
|
1
|
+
{"version":3,"file":"header.js","sourceRoot":"","sources":["../../src/components/header.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EACL,qBAAqB,IAAI,oBAAoB,EAC7C,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AAClE,OAAO,EAAE,GAAG,EAAE,MAAM,wCAAwC,CAAC;AAE7D,MAAM,CAAC,OAAO,OAAO,iBAAoC,SAAQ,UAAU;IAClE,MAAM,KAAK,OAAO;QACvB,OAAO,eAAe,CAAC;IACzB,CAAC;aAEsB,WAAM,GAAG,MAAM,CAAC;IAEhC,MAAM,CAAC,QAAQ;QACpB,iBAAiB,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;IACzD,CAAC;IAED,IAAc,OAAO;QACnB,OAAO;YACL,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC;IACJ,CAAC;IAED,IAAc,UA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CAAC;YACb,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI,CAAC,UAAU;YACzB,QAAQ,EAAE,IAAI,CAAC,gBAAgB,CAAC,eAAe;SAChD,CAAC;;UAEA,IAAI,CAAC,iBAAiB,EAAE;8BACJ,IAAI,CAAC,cAAc,EAAE;;QAE3C,IAAI,CAAC,gBAAgB,EAAE;KAC1B,CAAC;IACJ,CAAC;;AAvHM;IAFN,OAAO,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACzD,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;gDACG;AAG3B;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iDACQ","sourcesContent":["import { consume } from '@lit/context';\nimport {\n θaddThemingController as addThemingController,\n IgcIconComponent,\n} from 'igniteui-webcomponents';\nimport { html, LitElement, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport type { StateController } from '../controllers/state.js';\nimport {\n MIN_COL_RESIZE_WIDTH,\n SORT_ICON_ASCENDING,\n SORT_ICON_DESCENDING,\n} from '../internal/constants.js';\nimport { GRID_STATE_CONTEXT } from '../internal/context.js';\nimport { partMap } from '../internal/part-map.js';\nimport { registerComponent } from '../internal/register.js';\nimport { GRID_HEADER_TAG } from '../internal/tags.js';\nimport type { ColumnConfiguration, IgcHeaderContext } from '../internal/types.js';\nimport { styles } from '../styles/header-cell/header-cell.css.js';\nimport { all } from '../styles/themes/grid-header-themes.js';\n\nexport default class IgcGridLiteHeader<T extends object> extends LitElement {\n public static get tagName() {\n return GRID_HEADER_TAG;\n }\n\n public static override styles = styles;\n\n public static register(): void {\n registerComponent(IgcGridLiteHeader, IgcIconComponent);\n }\n\n protected get context(): IgcHeaderContext<T> {\n return {\n parent: this,\n column: this.column,\n };\n }\n\n protected get isSortable() {\n return Boolean(this.column.sortable);\n }\n\n protected get resizeController() {\n return this.state.resizing;\n }\n\n @consume({ context: GRID_STATE_CONTEXT, subscribe: true })\n @property({ attribute: false })\n public state!: StateController<T>;\n\n @property({ attribute: false })\n public column!: ColumnConfiguration<T>;\n\n constructor() {\n super();\n\n addThemingController(this, all);\n }\n\n #addResizeEventHandlers() {\n const config: AddEventListenerOptions = { once: true };\n\n this.addEventListener(\n 'gotpointercapture',\n () => {\n this.resizeController.indicatorActive = true;\n },\n config\n );\n this.addEventListener('lostpointercapture', this.#handlePointerLost, config);\n this.addEventListener('pointerup', (e) => this.releasePointerCapture(e.pointerId), config);\n this.addEventListener('pointermove', this.#handleResize);\n }\n\n #handleClick(e: Event) {\n e.stopPropagation();\n this.state.sorting.sortFromHeaderClick(this.column);\n }\n\n #handleResize = ({ clientX }: PointerEvent) => {\n const { left } = this.getBoundingClientRect();\n const width = Math.max(clientX - left, MIN_COL_RESIZE_WIDTH);\n const x = this.offsetLeft + width;\n\n this.resizeController.resize(this.column, width, x);\n };\n\n #handleResizeStart(ev: PointerEvent) {\n const { target, pointerId } = ev;\n\n ev.preventDefault();\n\n this.#addResizeEventHandlers();\n this.resizeController.start(this);\n\n (target as HTMLElement).setPointerCapture(pointerId);\n }\n\n #handlePointerLost = () => {\n this.resizeController.indicatorActive = false;\n this.removeEventListener('pointermove', this.#handleResize);\n this.resizeController.stop();\n };\n\n #handleAutosize = () => this.resizeController.autosize(this.column, this);\n\n protected renderSortPart() {\n const state = this.state.sorting.state.get(this.column.field);\n const idx = Array.from(this.state.sorting.state.values()).indexOf(state!);\n const attr =\n this.state.host.sortingOptions.mode === 'multiple' ? (idx > -1 ? idx + 1 : nothing) : nothing;\n const icon = state\n ? state.direction === 'ascending'\n ? SORT_ICON_ASCENDING\n : SORT_ICON_DESCENDING\n : SORT_ICON_ASCENDING;\n\n return state || this.isSortable\n ? html`<span\n part=${partMap({ action: true, sorted: !!state?.direction })}\n @click=${this.isSortable ? this.#handleClick : nothing}\n >\n <igc-icon\n part=${partMap({ 'sorting-action': !!state })}\n data-sortIndex=${attr}\n name=${icon}\n collection=\"internal\"\n ></igc-icon>\n </span>`\n : nothing;\n }\n\n protected renderContentPart() {\n const defaultContent = this.column.header ?? this.column.field;\n const template = this.column.headerTemplate;\n\n return html`\n <span part=\"title\">\n <span>${template ? template(this.context) : html`${defaultContent}`}</span>\n </span>\n `;\n }\n\n protected renderResizePart() {\n return this.column.resizable\n ? html`<span\n part=\"resizable\"\n @dblclick=${this.#handleAutosize}\n @pointerdown=${this.#handleResizeStart}\n ></span>`\n : nothing;\n }\n\n protected override render() {\n return html`\n <div\n part=${partMap({\n content: true,\n sortable: this.isSortable,\n resizing: this.resizeController.indicatorActive,\n })}\n >\n ${this.renderContentPart()}\n <div part=\"actions\">${this.renderSortPart()}</div>\n </div>\n ${this.renderResizePart()}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [IgcGridLiteHeader.tagName]: IgcGridLiteHeader<object>;\n }\n}\n"]}
|