apex-grid 1.0.1 → 1.1.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/{dist/src/components → components}/cell.d.ts +2 -3
- package/{dist/src/components → components}/cell.js +5 -13
- package/components/cell.js.map +1 -0
- package/{dist/src/components → components}/filter-row.d.ts +7 -8
- package/{dist/src/components → components}/filter-row.js +113 -116
- package/components/filter-row.js.map +1 -0
- package/{dist/src/components → components}/grid.d.ts +8 -8
- package/{dist/src/components → components}/grid.js +72 -151
- package/components/grid.js.map +1 -0
- package/{dist/src/components → components}/header-row.d.ts +5 -6
- package/{dist/src/components → components}/header-row.js +21 -27
- package/components/header-row.js.map +1 -0
- package/{dist/src/components → components}/header.d.ts +4 -5
- package/components/header.js +137 -0
- package/components/header.js.map +1 -0
- package/{dist/src/components → components}/row.d.ts +2 -3
- package/{dist/src/components → components}/row.js +8 -12
- package/components/row.js.map +1 -0
- package/{dist/src/components → components}/virtualizer.d.ts +2 -3
- package/{dist/src/components → components}/virtualizer.js +2 -2
- package/components/virtualizer.js.map +1 -0
- package/{dist/src/controllers → controllers}/data-operation.d.ts +5 -6
- package/{dist/src/controllers → controllers}/data-operation.js +10 -11
- package/controllers/data-operation.js.map +1 -0
- package/{dist/src/controllers → controllers}/dom.d.ts +4 -5
- package/controllers/dom.js +54 -0
- package/controllers/dom.js.map +1 -0
- package/{dist/src/controllers → controllers}/filter.d.ts +2 -3
- package/controllers/filter.js +105 -0
- package/controllers/filter.js.map +1 -0
- package/{dist/src/controllers → controllers}/navigation.d.ts +2 -3
- package/{dist/src/controllers → controllers}/navigation.js +9 -14
- package/controllers/navigation.js.map +1 -0
- package/{dist/src/controllers → controllers}/resize.d.ts +2 -3
- package/controllers/resize.js +52 -0
- package/controllers/resize.js.map +1 -0
- package/{dist/src/controllers → controllers}/sort.d.ts +1 -2
- package/controllers/sort.js +94 -0
- package/controllers/sort.js.map +1 -0
- package/{dist/src/controllers → controllers}/state.d.ts +3 -4
- package/{dist/src/controllers → controllers}/state.js +4 -7
- package/controllers/state.js.map +1 -0
- package/custom-elements.json +320 -123
- package/{dist/src/define.d.ts → define.d.ts} +0 -1
- package/define.js.map +1 -0
- package/docs/assets/hierarchy.js +1 -0
- package/{dist/docs → docs}/assets/highlight.css +28 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1633 -0
- package/docs/classes/ApexGrid.html +74 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +10 -0
- package/docs/interfaces/ApexFilteredEvent.html +6 -0
- package/docs/interfaces/ApexFilteringEvent.html +12 -0
- package/docs/interfaces/ApexGridEventMap.html +17 -0
- package/docs/interfaces/ApexHeaderContext.html +6 -0
- package/docs/interfaces/BaseApexCellContext.html +10 -0
- package/docs/interfaces/BaseColumnConfiguration.html +28 -0
- package/docs/interfaces/BaseColumnSortConfiguration.html +6 -0
- package/docs/interfaces/BaseFilterExpression.html +15 -0
- package/docs/interfaces/BaseSortExpression.html +12 -0
- package/docs/interfaces/ColumnFilterConfiguration.html +4 -0
- package/docs/interfaces/DataPipelineConfiguration.html +6 -0
- package/docs/interfaces/GridSortConfiguration.html +6 -0
- package/docs/modules.html +1 -0
- package/docs/types/ApexCellContext.html +2 -0
- package/docs/types/BasePropertyType.html +2 -0
- package/docs/types/BaseSortComparer.html +2 -0
- package/docs/types/ColumnConfiguration.html +2 -0
- package/docs/types/ColumnSortConfiguration.html +2 -0
- package/docs/types/DataPipelineHook.html +2 -0
- package/docs/types/DataPipelineParams.html +8 -0
- package/docs/types/DataType.html +2 -0
- package/docs/types/FilterCriteria.html +6 -0
- package/docs/types/FilterExpression.html +2 -0
- package/docs/types/Keys.html +2 -0
- package/docs/types/PropertyType.html +2 -0
- package/docs/types/SortComparer.html +2 -0
- package/docs/types/SortExpression.html +2 -0
- package/docs/types/SortState.html +2 -0
- package/docs/types/SortingDirection.html +3 -0
- package/{dist/src/index.d.ts → index.d.ts} +4 -5
- package/index.js.map +1 -0
- package/{dist/src/internal → internal}/constants.d.ts +0 -1
- package/internal/constants.js.map +1 -0
- package/{dist/src/internal → internal}/icon-registry.d.ts +0 -1
- package/internal/icon-registry.js.map +1 -0
- package/{dist/src/internal → internal}/is-defined.d.ts +0 -1
- package/internal/is-defined.js.map +1 -0
- package/{dist/src/internal → internal}/mixins/event-emitter.d.ts +0 -1
- package/internal/mixins/event-emitter.js.map +1 -0
- package/{dist/src/internal → internal}/normalize-case.d.ts +0 -1
- package/internal/normalize-case.js.map +1 -0
- package/{dist/src/internal → internal}/part-map.d.ts +0 -1
- package/{dist/src/internal → internal}/part-map.js +1 -1
- package/internal/part-map.js.map +1 -0
- package/{dist/src/internal → internal}/register.d.ts +3 -4
- package/internal/register.js +9 -0
- package/internal/register.js.map +1 -0
- package/{dist/src/internal → internal}/tags.d.ts +0 -1
- package/internal/tags.js.map +1 -0
- package/internal/theming.d.ts +34 -0
- package/internal/theming.js +123 -0
- package/internal/theming.js.map +1 -0
- package/{dist/src/internal → internal}/types.d.ts +3 -4
- package/internal/types.js.map +1 -0
- package/{dist/src/internal → internal}/utils.d.ts +0 -1
- package/{dist/src/internal → internal}/utils.js +3 -6
- package/internal/utils.js.map +1 -0
- package/{dist/src/internal → internal}/watch.d.ts +0 -1
- package/{dist/src/internal → internal}/watch.js +2 -2
- package/internal/watch.js.map +1 -0
- package/{dist/src/operations → operations}/base.d.ts +0 -1
- package/operations/base.js.map +1 -0
- package/{dist/src/operations → operations}/filter/operands/boolean.d.ts +0 -1
- package/{dist/src/operations → operations}/filter/operands/boolean.js +5 -5
- package/operations/filter/operands/boolean.js.map +1 -0
- package/{dist/src/operations → operations}/filter/operands/number.d.ts +0 -1
- package/{dist/src/operations → operations}/filter/operands/number.js +2 -2
- package/operations/filter/operands/number.js.map +1 -0
- package/{dist/src/operations → operations}/filter/operands/string.d.ts +0 -1
- package/{dist/src/operations → operations}/filter/operands/string.js +2 -2
- package/operations/filter/operands/string.js.map +1 -0
- package/{dist/src/operations → operations}/filter/state.d.ts +1 -2
- package/{dist/src/operations → operations}/filter/state.js +3 -4
- package/operations/filter/state.js.map +1 -0
- package/{dist/src/operations → operations}/filter/tree.d.ts +1 -2
- package/{dist/src/operations → operations}/filter/tree.js +5 -6
- package/operations/filter/tree.js.map +1 -0
- package/{dist/src/operations → operations}/filter/types.d.ts +0 -1
- package/operations/filter/types.js.map +1 -0
- package/{dist/src/operations → operations}/filter.d.ts +0 -1
- package/{dist/src/operations → operations}/filter.js +4 -7
- package/operations/filter.js.map +1 -0
- package/{dist/src/operations → operations}/sort/types.d.ts +0 -1
- package/operations/sort/types.js.map +1 -0
- package/{dist/src/operations → operations}/sort.d.ts +0 -1
- package/{dist/src/operations → operations}/sort.js +5 -5
- package/operations/sort.js.map +1 -0
- package/package.json +23 -82
- package/{dist/src/styles/body-row/body-row-styles.css.d.ts → styles/_common.css.d.ts} +0 -1
- package/styles/_common.css.js +3 -0
- package/styles/_common.css.js.map +1 -0
- package/{dist/src/styles/body-cell/body-cell-styles.css.d.ts → styles/body-cell/body-cell.css.d.ts} +0 -1
- package/styles/body-cell/body-cell.css.js +3 -0
- package/styles/body-cell/body-cell.css.js.map +1 -0
- package/{dist/src/styles/filter-row/filter-row-styles.css.d.ts → styles/body-row/body-row.css.d.ts} +0 -1
- package/styles/body-row/body-row.css.js +3 -0
- package/styles/body-row/body-row.css.js.map +1 -0
- package/{dist/src/styles/grid/themes/light/grid.fluent-styles.css.d.ts → styles/filter-row/filter-row.css.d.ts} +0 -1
- package/styles/filter-row/filter-row.css.js +3 -0
- package/styles/filter-row/filter-row.css.js.map +1 -0
- package/styles/grid/_grid.base.css.d.ts +1 -0
- package/styles/grid/_grid.base.css.js +3 -0
- package/styles/grid/_grid.base.css.js.map +1 -0
- package/styles/grid/themes/light/grid.bootstrap.css.d.ts +1 -0
- package/styles/grid/themes/light/grid.bootstrap.css.js +3 -0
- package/styles/grid/themes/light/grid.bootstrap.css.js.map +1 -0
- package/styles/grid/themes/light/grid.fluent.css.d.ts +1 -0
- package/styles/grid/themes/light/grid.fluent.css.js +3 -0
- package/styles/grid/themes/light/grid.fluent.css.js.map +1 -0
- package/styles/grid/themes/light/grid.indigo.css.d.ts +1 -0
- package/styles/grid/themes/light/grid.indigo.css.js +3 -0
- package/styles/grid/themes/light/grid.indigo.css.js.map +1 -0
- package/styles/grid/themes/light/grid.material.css.d.ts +1 -0
- package/styles/grid/themes/light/grid.material.css.js +3 -0
- package/styles/grid/themes/light/grid.material.css.js.map +1 -0
- package/styles/header-cell/header-cell.css.d.ts +1 -0
- package/styles/header-cell/header-cell.css.js +3 -0
- package/styles/header-cell/header-cell.css.js.map +1 -0
- package/styles/header-row/header-row.base.css.d.ts +1 -0
- package/styles/header-row/header-row.base.css.js +3 -0
- package/styles/header-row/header-row.base.css.js.map +1 -0
- package/dist/bundle.js +0 -2194
- package/dist/docs/assets/main.js +0 -58
- package/dist/docs/assets/search.js +0 -1
- package/dist/docs/assets/style.css +0 -1365
- package/dist/docs/classes/ApexGrid.html +0 -327
- package/dist/docs/index.html +0 -82
- package/dist/docs/interfaces/ApexFilteredEvent.html +0 -104
- package/dist/docs/interfaces/ApexFilteringEvent.html +0 -116
- package/dist/docs/interfaces/ApexGridEventMap.html +0 -127
- package/dist/docs/interfaces/ApexHeaderContext.html +0 -104
- package/dist/docs/interfaces/BaseApexCellContext.html +0 -120
- package/dist/docs/interfaces/BaseColumnConfiguration.html +0 -196
- package/dist/docs/interfaces/BaseColumnSortConfiguration.html +0 -106
- package/dist/docs/interfaces/BaseFilterExpression.html +0 -132
- package/dist/docs/interfaces/BaseSortExpression.html +0 -124
- package/dist/docs/interfaces/ColumnFilterConfiguration.html +0 -92
- package/dist/docs/interfaces/DataPipelineConfiguration.html +0 -104
- package/dist/docs/interfaces/GridSortConfiguration.html +0 -99
- package/dist/docs/modules.html +0 -102
- package/dist/docs/types/ApexCellContext.html +0 -74
- package/dist/docs/types/BasePropertyType.html +0 -74
- package/dist/docs/types/BaseSortComparer.html +0 -89
- package/dist/docs/types/ColumnConfiguration.html +0 -74
- package/dist/docs/types/ColumnSortConfiguration.html +0 -74
- package/dist/docs/types/DataPipelineHook.html +0 -85
- package/dist/docs/types/DataPipelineParams.html +0 -87
- package/dist/docs/types/DataType.html +0 -67
- package/dist/docs/types/FilterCriteria.html +0 -71
- package/dist/docs/types/FilterExpression.html +0 -74
- package/dist/docs/types/Keys.html +0 -72
- package/dist/docs/types/PropertyType.html +0 -74
- package/dist/docs/types/SortComparer.html +0 -74
- package/dist/docs/types/SortExpression.html +0 -74
- package/dist/docs/types/SortState.html +0 -72
- package/dist/docs/types/SortingDirection.html +0 -69
- package/dist/src/components/cell.d.ts.map +0 -1
- package/dist/src/components/cell.js.map +0 -1
- package/dist/src/components/filter-row.d.ts.map +0 -1
- package/dist/src/components/filter-row.js.map +0 -1
- package/dist/src/components/grid.d.ts.map +0 -1
- package/dist/src/components/grid.js.map +0 -1
- package/dist/src/components/header-row.d.ts.map +0 -1
- package/dist/src/components/header-row.js.map +0 -1
- package/dist/src/components/header.d.ts.map +0 -1
- package/dist/src/components/header.js +0 -144
- package/dist/src/components/header.js.map +0 -1
- package/dist/src/components/row.d.ts.map +0 -1
- package/dist/src/components/row.js.map +0 -1
- package/dist/src/components/virtualizer.d.ts.map +0 -1
- package/dist/src/components/virtualizer.js.map +0 -1
- package/dist/src/controllers/data-operation.d.ts.map +0 -1
- package/dist/src/controllers/data-operation.js.map +0 -1
- package/dist/src/controllers/dom.d.ts.map +0 -1
- package/dist/src/controllers/dom.js +0 -60
- package/dist/src/controllers/dom.js.map +0 -1
- package/dist/src/controllers/filter.d.ts.map +0 -1
- package/dist/src/controllers/filter.js +0 -119
- package/dist/src/controllers/filter.js.map +0 -1
- package/dist/src/controllers/navigation.d.ts.map +0 -1
- package/dist/src/controllers/navigation.js.map +0 -1
- package/dist/src/controllers/resize.d.ts.map +0 -1
- package/dist/src/controllers/resize.js +0 -70
- package/dist/src/controllers/resize.js.map +0 -1
- package/dist/src/controllers/sort.d.ts.map +0 -1
- package/dist/src/controllers/sort.js +0 -94
- package/dist/src/controllers/sort.js.map +0 -1
- package/dist/src/controllers/state.d.ts.map +0 -1
- package/dist/src/controllers/state.js.map +0 -1
- package/dist/src/define.d.ts.map +0 -1
- package/dist/src/define.js.map +0 -1
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js.map +0 -1
- package/dist/src/internal/constants.d.ts.map +0 -1
- package/dist/src/internal/constants.js.map +0 -1
- package/dist/src/internal/icon-registry.d.ts.map +0 -1
- package/dist/src/internal/icon-registry.js.map +0 -1
- package/dist/src/internal/is-defined.d.ts.map +0 -1
- package/dist/src/internal/is-defined.js.map +0 -1
- package/dist/src/internal/mixins/event-emitter.d.ts.map +0 -1
- package/dist/src/internal/mixins/event-emitter.js.map +0 -1
- package/dist/src/internal/normalize-case.d.ts.map +0 -1
- package/dist/src/internal/normalize-case.js.map +0 -1
- package/dist/src/internal/part-map.d.ts.map +0 -1
- package/dist/src/internal/part-map.js.map +0 -1
- package/dist/src/internal/register.d.ts.map +0 -1
- package/dist/src/internal/register.js +0 -9
- package/dist/src/internal/register.js.map +0 -1
- package/dist/src/internal/tags.d.ts.map +0 -1
- package/dist/src/internal/tags.js.map +0 -1
- package/dist/src/internal/types.d.ts.map +0 -1
- package/dist/src/internal/types.js.map +0 -1
- package/dist/src/internal/utils.d.ts.map +0 -1
- package/dist/src/internal/utils.js.map +0 -1
- package/dist/src/internal/watch.d.ts.map +0 -1
- package/dist/src/internal/watch.js.map +0 -1
- package/dist/src/operations/base.d.ts.map +0 -1
- package/dist/src/operations/base.js.map +0 -1
- package/dist/src/operations/filter/operands/boolean.d.ts.map +0 -1
- package/dist/src/operations/filter/operands/boolean.js.map +0 -1
- package/dist/src/operations/filter/operands/number.d.ts.map +0 -1
- package/dist/src/operations/filter/operands/number.js.map +0 -1
- package/dist/src/operations/filter/operands/string.d.ts.map +0 -1
- package/dist/src/operations/filter/operands/string.js.map +0 -1
- package/dist/src/operations/filter/state.d.ts.map +0 -1
- package/dist/src/operations/filter/state.js.map +0 -1
- package/dist/src/operations/filter/tree.d.ts.map +0 -1
- package/dist/src/operations/filter/tree.js.map +0 -1
- package/dist/src/operations/filter/types.d.ts.map +0 -1
- package/dist/src/operations/filter/types.js.map +0 -1
- package/dist/src/operations/filter.d.ts.map +0 -1
- package/dist/src/operations/filter.js.map +0 -1
- package/dist/src/operations/sort/types.d.ts.map +0 -1
- package/dist/src/operations/sort/types.js.map +0 -1
- package/dist/src/operations/sort.d.ts.map +0 -1
- package/dist/src/operations/sort.js.map +0 -1
- package/dist/src/styles/body-cell/body-cell-styles.css.d.ts.map +0 -1
- package/dist/src/styles/body-cell/body-cell-styles.css.js +0 -71
- package/dist/src/styles/body-cell/body-cell-styles.css.js.map +0 -1
- package/dist/src/styles/body-row/body-row-styles.css.d.ts.map +0 -1
- package/dist/src/styles/body-row/body-row-styles.css.js +0 -38
- package/dist/src/styles/body-row/body-row-styles.css.js.map +0 -1
- package/dist/src/styles/filter-row/filter-row-styles.css.d.ts.map +0 -1
- package/dist/src/styles/filter-row/filter-row-styles.css.js +0 -96
- package/dist/src/styles/filter-row/filter-row-styles.css.js.map +0 -1
- package/dist/src/styles/grid/themes/light/grid.bootstrap-styles.css.d.ts +0 -2
- package/dist/src/styles/grid/themes/light/grid.bootstrap-styles.css.d.ts.map +0 -1
- package/dist/src/styles/grid/themes/light/grid.bootstrap-styles.css.js +0 -83
- package/dist/src/styles/grid/themes/light/grid.bootstrap-styles.css.js.map +0 -1
- package/dist/src/styles/grid/themes/light/grid.fluent-styles.css.d.ts.map +0 -1
- package/dist/src/styles/grid/themes/light/grid.fluent-styles.css.js +0 -83
- package/dist/src/styles/grid/themes/light/grid.fluent-styles.css.js.map +0 -1
- package/dist/src/styles/grid/themes/light/grid.indigo-styles.css.d.ts +0 -2
- package/dist/src/styles/grid/themes/light/grid.indigo-styles.css.d.ts.map +0 -1
- package/dist/src/styles/grid/themes/light/grid.indigo-styles.css.js +0 -83
- package/dist/src/styles/grid/themes/light/grid.indigo-styles.css.js.map +0 -1
- package/dist/src/styles/grid/themes/light/grid.material-styles.css.d.ts +0 -2
- package/dist/src/styles/grid/themes/light/grid.material-styles.css.d.ts.map +0 -1
- package/dist/src/styles/grid/themes/light/grid.material-styles.css.js +0 -83
- package/dist/src/styles/grid/themes/light/grid.material-styles.css.js.map +0 -1
- package/dist/src/styles/header-cell/header-cell-styles.css.d.ts +0 -2
- package/dist/src/styles/header-cell/header-cell-styles.css.d.ts.map +0 -1
- package/dist/src/styles/header-cell/header-cell-styles.css.js +0 -141
- package/dist/src/styles/header-cell/header-cell-styles.css.js.map +0 -1
- package/dist/src/styles/header-row/header-row.base-styles.css.d.ts +0 -2
- package/dist/src/styles/header-row/header-row.base-styles.css.d.ts.map +0 -1
- package/dist/src/styles/header-row/header-row.base-styles.css.js +0 -35
- package/dist/src/styles/header-row/header-row.base-styles.css.js.map +0 -1
- /package/{dist/src/define.js → define.js} +0 -0
- /package/{dist/docs → docs}/.nojekyll +0 -0
- /package/{dist/src/index.js → index.js} +0 -0
- /package/{dist/src/internal → internal}/constants.js +0 -0
- /package/{dist/src/internal → internal}/icon-registry.js +0 -0
- /package/{dist/src/internal → internal}/is-defined.js +0 -0
- /package/{dist/src/internal → internal}/mixins/event-emitter.js +0 -0
- /package/{dist/src/internal → internal}/normalize-case.js +0 -0
- /package/{dist/src/internal → internal}/tags.js +0 -0
- /package/{dist/src/internal → internal}/types.js +0 -0
- /package/{dist/src/operations → operations}/base.js +0 -0
- /package/{dist/src/operations → operations}/filter/types.js +0 -0
- /package/{dist/src/operations → operations}/sort/types.js +0 -0
|
@@ -4,150 +4,69 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
+
import { ContextProvider } from '@lit/context';
|
|
8
|
+
import { IgcButtonComponent, IgcChipComponent, IgcDropdownComponent, IgcInputComponent, } from 'igniteui-webcomponents';
|
|
7
9
|
import { html, nothing } from 'lit';
|
|
8
|
-
import { ContextProvider } from '@lit-labs/context';
|
|
9
10
|
import { eventOptions, property, query, queryAll, state } from 'lit/decorators.js';
|
|
10
11
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
11
|
-
import { GRID_TAG } from '../internal/tags.js';
|
|
12
|
-
import { StateController, gridStateContext } from '../controllers/state.js';
|
|
13
12
|
import { DataOperationsController } from '../controllers/data-operation.js';
|
|
14
13
|
import { GridDOMController } from '../controllers/dom.js';
|
|
15
|
-
import {
|
|
16
|
-
import { watch } from '../internal/watch.js';
|
|
14
|
+
import { gridStateContext, StateController } from '../controllers/state.js';
|
|
17
15
|
import { DEFAULT_COLUMN_CONFIG, PIPELINE } from '../internal/constants.js';
|
|
18
|
-
import {
|
|
16
|
+
import { EventEmitterBase } from '../internal/mixins/event-emitter.js';
|
|
19
17
|
import { registerComponent } from '../internal/register.js';
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
18
|
+
import { GRID_TAG } from '../internal/tags.js';
|
|
19
|
+
import { addThemingController } from '../internal/theming.js';
|
|
20
|
+
import { asArray, autoGenerateColumns, getFilterOperandsFor } from '../internal/utils.js';
|
|
21
|
+
import { watch } from '../internal/watch.js';
|
|
22
|
+
import { styles as bootstrap } from '../styles/grid/themes/light/grid.bootstrap.css.js';
|
|
23
|
+
import { styles as fluent } from '../styles/grid/themes/light/grid.fluent.css.js';
|
|
24
|
+
import { styles as indigo } from '../styles/grid/themes/light/grid.indigo.css.js';
|
|
25
|
+
import { styles as material } from '../styles/grid/themes/light/grid.material.css.js';
|
|
27
26
|
import ApexGridCell from './cell.js';
|
|
28
27
|
import ApexFilterRow from './filter-row.js';
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
* Out of the box it provides row virtualization, sort and filter operations (client and server side),
|
|
35
|
-
* the ability to template cells and headers and column hiding.
|
|
36
|
-
*
|
|
37
|
-
* @element apex-grid
|
|
38
|
-
*
|
|
39
|
-
* @fires sorting - Emitted when sorting is initiated through the UI.
|
|
40
|
-
* @fires sorted - Emitted when a sort operation initiated through the UI has completed.
|
|
41
|
-
* @fires filtering - Emitted when filtering is initiated through the UI.
|
|
42
|
-
* @fires filtered - Emitted when a filter operation initiated through the UI has completed.
|
|
43
|
-
*
|
|
44
|
-
*/
|
|
45
|
-
let ApexGrid = class ApexGrid extends EventEmitterBase {
|
|
46
|
-
constructor() {
|
|
47
|
-
super(...arguments);
|
|
48
|
-
this.stateController = new StateController(this);
|
|
49
|
-
this.DOM = new GridDOMController(this, this.stateController);
|
|
50
|
-
this.dataController = new DataOperationsController(this);
|
|
51
|
-
this.stateProvider = new ContextProvider(this, {
|
|
52
|
-
context: gridStateContext,
|
|
53
|
-
initialValue: this.stateController,
|
|
54
|
-
});
|
|
55
|
-
this.dataState = [];
|
|
56
|
-
/** Column configuration for the grid. */
|
|
57
|
-
this.columns = [];
|
|
58
|
-
/** The data source for the grid. */
|
|
59
|
-
this.data = [];
|
|
60
|
-
/**
|
|
61
|
-
* Whether the grid will try to "resolve" its column configuration based on the passed
|
|
62
|
-
* data source.
|
|
63
|
-
*
|
|
64
|
-
* @remarks
|
|
65
|
-
* This is usually executed on initial rendering in the DOM. It depends on having an existing data source
|
|
66
|
-
* to infer the column configuration for the grid.
|
|
67
|
-
* Passing an empty data source or having a late bound data source (such as a HTTP request) will usually
|
|
68
|
-
* result in empty column configuration for the grid.
|
|
69
|
-
*
|
|
70
|
-
* This property is ignored if any existing column configuration already exists in the grid.
|
|
71
|
-
*
|
|
72
|
-
* In a scenario where you want to bind a new data source and still keep the auto-generation behavior,
|
|
73
|
-
* make sure to reset the column collection of the grid before passing in the new data source.
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* ```typescript
|
|
77
|
-
* // assuming autoGenerate is set to true
|
|
78
|
-
* grid.columns = [];
|
|
79
|
-
* grid.data = [...];
|
|
80
|
-
* ```
|
|
81
|
-
*
|
|
82
|
-
* @attr auto-generate
|
|
83
|
-
*/
|
|
84
|
-
this.autoGenerate = false;
|
|
85
|
-
/** Sort configuration property for the grid. */
|
|
86
|
-
this.sortConfiguration = {
|
|
87
|
-
multiple: true,
|
|
88
|
-
triState: true,
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
static get is() {
|
|
28
|
+
import ApexGridHeaderRow from './header-row.js';
|
|
29
|
+
import ApexGridRow from './row.js';
|
|
30
|
+
import ApexVirtualizer from './virtualizer.js';
|
|
31
|
+
export class ApexGrid extends EventEmitterBase {
|
|
32
|
+
static get tagName() {
|
|
92
33
|
return GRID_TAG;
|
|
93
34
|
}
|
|
35
|
+
static { this.styles = bootstrap; }
|
|
94
36
|
static register() {
|
|
95
|
-
registerComponent(
|
|
96
|
-
defineComponents(IgcButtonComponent, IgcChipComponent, IgcInputComponent, IgcDropdownComponent, IgcIconComponent);
|
|
37
|
+
registerComponent(ApexGrid, ApexVirtualizer, ApexGridRow, ApexGridHeaderRow, ApexFilterRow, IgcButtonComponent, IgcChipComponent, IgcInputComponent, IgcDropdownComponent);
|
|
97
38
|
}
|
|
98
|
-
/**
|
|
99
|
-
* Set the sort state for the grid.
|
|
100
|
-
*/
|
|
101
39
|
set sortExpressions(expressions) {
|
|
102
40
|
if (expressions.length) {
|
|
103
41
|
this.sort(expressions);
|
|
104
42
|
}
|
|
105
43
|
}
|
|
106
|
-
/**
|
|
107
|
-
* Get the sort state for the grid.
|
|
108
|
-
*/
|
|
109
44
|
get sortExpressions() {
|
|
110
45
|
return Array.from(this.stateController.sorting.state.values());
|
|
111
46
|
}
|
|
112
|
-
/**
|
|
113
|
-
* Set the filter state for the grid.
|
|
114
|
-
*/
|
|
115
47
|
set filterExpressions(expressions) {
|
|
116
48
|
if (expressions.length) {
|
|
117
49
|
this.filter(expressions);
|
|
118
50
|
}
|
|
119
51
|
}
|
|
120
|
-
/**
|
|
121
|
-
* Get the filter state for the grid.
|
|
122
|
-
*/
|
|
123
52
|
get filterExpressions() {
|
|
124
|
-
|
|
53
|
+
const expressions = [];
|
|
54
|
+
for (const each of this.stateController.filtering.state.values) {
|
|
55
|
+
expressions.push(...each.all);
|
|
56
|
+
}
|
|
57
|
+
return expressions;
|
|
125
58
|
}
|
|
126
|
-
/**
|
|
127
|
-
* Returns the collection of rendered row elements in the grid.
|
|
128
|
-
*
|
|
129
|
-
* @remarks
|
|
130
|
-
* Since the grid has virtualization, this property returns only the currently rendered
|
|
131
|
-
* chunk of elements in the DOM.
|
|
132
|
-
*/
|
|
133
59
|
get rows() {
|
|
134
60
|
return Array.from(this._rows);
|
|
135
61
|
}
|
|
136
|
-
/**
|
|
137
|
-
* Returns the state of the data source after sort/filter operations
|
|
138
|
-
* have been applied.
|
|
139
|
-
*/
|
|
140
62
|
get dataView() {
|
|
141
63
|
return this.dataState;
|
|
142
64
|
}
|
|
143
|
-
/**
|
|
144
|
-
* The total number of items in the {@link ApexGrid.dataView} collection.
|
|
145
|
-
*/
|
|
146
65
|
get totalItems() {
|
|
147
66
|
return this.dataState.length;
|
|
148
67
|
}
|
|
149
68
|
watchColumns(_, newConfig = []) {
|
|
150
|
-
this.columns = newConfig.map(config => ({ ...DEFAULT_COLUMN_CONFIG, ...config }));
|
|
69
|
+
this.columns = newConfig.map((config) => ({ ...DEFAULT_COLUMN_CONFIG, ...config }));
|
|
151
70
|
}
|
|
152
71
|
dataChanged() {
|
|
153
72
|
this.dataState = structuredClone(this.data);
|
|
@@ -159,57 +78,63 @@ let ApexGrid = class ApexGrid extends EventEmitterBase {
|
|
|
159
78
|
async pipeline() {
|
|
160
79
|
this.dataState = await this.dataController.apply(structuredClone(this.data), this.stateController);
|
|
161
80
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
81
|
+
constructor() {
|
|
82
|
+
super();
|
|
83
|
+
this.stateController = new StateController(this);
|
|
84
|
+
this.DOM = new GridDOMController(this, this.stateController);
|
|
85
|
+
this.dataController = new DataOperationsController(this);
|
|
86
|
+
this.stateProvider = new ContextProvider(this, {
|
|
87
|
+
context: gridStateContext,
|
|
88
|
+
initialValue: this.stateController,
|
|
89
|
+
});
|
|
90
|
+
this.dataState = [];
|
|
91
|
+
this.columns = [];
|
|
92
|
+
this.data = [];
|
|
93
|
+
this.autoGenerate = false;
|
|
94
|
+
this.sortConfiguration = {
|
|
95
|
+
multiple: true,
|
|
96
|
+
triState: true,
|
|
97
|
+
};
|
|
98
|
+
addThemingController(this, {
|
|
99
|
+
light: { bootstrap, material, fluent, indigo },
|
|
100
|
+
dark: { bootstrap, material, fluent, indigo },
|
|
101
|
+
});
|
|
102
|
+
}
|
|
165
103
|
filter(config) {
|
|
166
|
-
this.stateController.filtering.filter(asArray(config).map(each => typeof each.condition === 'string'
|
|
167
|
-
?
|
|
104
|
+
this.stateController.filtering.filter(asArray(config).map((each) => typeof each.condition === 'string'
|
|
105
|
+
?
|
|
168
106
|
Object.assign(each, {
|
|
169
107
|
condition: getFilterOperandsFor(this.getColumn(each.key))[each.condition],
|
|
170
108
|
})
|
|
171
109
|
: each));
|
|
172
110
|
}
|
|
173
|
-
/**
|
|
174
|
-
* Performs a sort operation in the grid based on the passed expression(s).
|
|
175
|
-
*/
|
|
176
111
|
sort(expressions) {
|
|
177
112
|
this.stateController.sorting.sort(expressions);
|
|
178
113
|
}
|
|
179
|
-
/**
|
|
180
|
-
* Resets the current sort state of the control.
|
|
181
|
-
*/
|
|
182
114
|
clearSort(key) {
|
|
183
115
|
this.stateController.sorting.reset(key);
|
|
184
116
|
this.requestUpdate(PIPELINE);
|
|
185
117
|
}
|
|
186
|
-
/**
|
|
187
|
-
* Resets the current filter state of the control.
|
|
188
|
-
*/
|
|
189
118
|
clearFilter(key) {
|
|
190
119
|
this.stateController.filtering.reset(key);
|
|
191
120
|
this.requestUpdate(PIPELINE);
|
|
192
121
|
}
|
|
193
|
-
/**
|
|
194
|
-
* Returns a {@link ColumnConfiguration} for a given column.
|
|
195
|
-
*/
|
|
196
122
|
getColumn(id) {
|
|
197
123
|
return typeof id === 'number'
|
|
198
124
|
? this.columns.at(id)
|
|
199
125
|
: this.columns.find(({ key }) => key === id);
|
|
200
126
|
}
|
|
201
|
-
/**
|
|
202
|
-
* Updates the column configuration of the grid.
|
|
203
|
-
*/
|
|
204
127
|
updateColumns(columns) {
|
|
205
|
-
asArray(columns)
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
128
|
+
for (const column of asArray(columns)) {
|
|
129
|
+
const instance = this.columns.find((curr) => curr.key === column.key);
|
|
130
|
+
if (instance) {
|
|
131
|
+
Object.assign(instance, column);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
209
134
|
this.requestUpdate(PIPELINE);
|
|
210
135
|
}
|
|
211
136
|
bodyClickHandler(event) {
|
|
212
|
-
const target = event.composedPath().find(el => el instanceof ApexGridCell);
|
|
137
|
+
const target = event.composedPath().find((el) => el instanceof ApexGridCell);
|
|
213
138
|
if (target) {
|
|
214
139
|
this.stateController.active = {
|
|
215
140
|
column: target.column.key,
|
|
@@ -223,10 +148,12 @@ let ApexGrid = class ApexGrid extends EventEmitterBase {
|
|
|
223
148
|
}
|
|
224
149
|
}
|
|
225
150
|
renderHeaderRow() {
|
|
226
|
-
return html
|
|
151
|
+
return html `
|
|
152
|
+
<apex-grid-header-row
|
|
227
153
|
style=${styleMap(this.DOM.columnSizes)}
|
|
228
154
|
.columns=${this.columns}
|
|
229
|
-
|
|
155
|
+
></apex-grid-header-row>
|
|
156
|
+
`;
|
|
230
157
|
}
|
|
231
158
|
renderBody() {
|
|
232
159
|
return html `
|
|
@@ -239,30 +166,33 @@ let ApexGrid = class ApexGrid extends EventEmitterBase {
|
|
|
239
166
|
`;
|
|
240
167
|
}
|
|
241
168
|
renderFilterRow() {
|
|
242
|
-
return this.columns.some(column => column.filter)
|
|
169
|
+
return this.columns.some((column) => column.filter)
|
|
243
170
|
? html `<apex-filter-row style=${styleMap(this.DOM.columnSizes)}></apex-filter-row>`
|
|
244
171
|
: nothing;
|
|
245
172
|
}
|
|
246
173
|
render() {
|
|
247
|
-
return html `
|
|
248
|
-
|
|
174
|
+
return html `
|
|
175
|
+
${this.stateController.resizing.renderIndicator()}
|
|
176
|
+
${this.renderHeaderRow()}
|
|
177
|
+
${this.renderFilterRow()}
|
|
178
|
+
${this.renderBody()}
|
|
179
|
+
`;
|
|
249
180
|
}
|
|
250
|
-
}
|
|
251
|
-
ApexGrid.styles = bootstrap;
|
|
181
|
+
}
|
|
252
182
|
__decorate([
|
|
253
|
-
query(ApexVirtualizer.
|
|
183
|
+
query(ApexVirtualizer.tagName)
|
|
254
184
|
], ApexGrid.prototype, "scrollContainer", void 0);
|
|
255
185
|
__decorate([
|
|
256
|
-
query(ApexGridHeaderRow.
|
|
186
|
+
query(ApexGridHeaderRow.tagName)
|
|
257
187
|
], ApexGrid.prototype, "headerRow", void 0);
|
|
258
188
|
__decorate([
|
|
259
|
-
query(ApexFilterRow.
|
|
189
|
+
query(ApexFilterRow.tagName)
|
|
260
190
|
], ApexGrid.prototype, "filterRow", void 0);
|
|
261
191
|
__decorate([
|
|
262
192
|
state()
|
|
263
193
|
], ApexGrid.prototype, "dataState", void 0);
|
|
264
194
|
__decorate([
|
|
265
|
-
queryAll(ApexGridRow.
|
|
195
|
+
queryAll(ApexGridRow.tagName)
|
|
266
196
|
], ApexGrid.prototype, "_rows", void 0);
|
|
267
197
|
__decorate([
|
|
268
198
|
property({ attribute: false })
|
|
@@ -297,13 +227,4 @@ __decorate([
|
|
|
297
227
|
__decorate([
|
|
298
228
|
eventOptions({ capture: true })
|
|
299
229
|
], ApexGrid.prototype, "bodyClickHandler", null);
|
|
300
|
-
ApexGrid = __decorate([
|
|
301
|
-
themes({
|
|
302
|
-
bootstrap,
|
|
303
|
-
fluent,
|
|
304
|
-
indigo,
|
|
305
|
-
material,
|
|
306
|
-
})
|
|
307
|
-
], ApexGrid);
|
|
308
|
-
export { ApexGrid };
|
|
309
230
|
//# sourceMappingURL=grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid.js","sourceRoot":"","sources":["../../src/components/grid.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EACL,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,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAO9D,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,C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C,OAAO,CAAC;2CACU;AAGjC;IADT,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC;2CACU;AAG7B;IADT,KAAK,EAAE;2CAC2B;AAGzB;IADT,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC;uCACe;AAItC;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;yCACoB;AAI5C;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;sCACJ;AA2BpB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;8CAC5B;AAIrB;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;mDAI7B;AAMK;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2DACiC;AAehE;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;+CAG9B;AAeD;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iDAS9B;AA6BS;IADT,KAAK,CAAC,SAAS,CAAC;4CAGhB;AAGS;IADT,KAAK,CAAC,MAAM,CAAC;2CAQb;AAGe;IADf,KAAK,CAAC,QAAQ,CAAC;wCAMf;AA0ES;IADT,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDAS/B","sourcesContent":["import { ContextProvider } from '@lit/context';\nimport {\n IgcButtonComponent,\n IgcChipComponent,\n IgcDropdownComponent,\n IgcInputComponent,\n} from 'igniteui-webcomponents';\nimport { html, nothing } from 'lit';\nimport { eventOptions, property, query, queryAll, state } from 'lit/decorators.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { DataOperationsController } from '../controllers/data-operation.js';\nimport { GridDOMController } from '../controllers/dom.js';\nimport { gridStateContext, StateController } from '../controllers/state.js';\nimport { DEFAULT_COLUMN_CONFIG, PIPELINE } from '../internal/constants.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 GridSortConfiguration,\n Keys,\n} from '../internal/types.js';\nimport { asArray, autoGenerateColumns, getFilterOperandsFor } from '../internal/utils.js';\nimport { watch } from '../internal/watch.js';\nimport type { FilterExpression } from '../operations/filter/types.js';\nimport type { SortExpression } from '../operations/sort/types.js';\nimport { styles as bootstrap } from '../styles/grid/themes/light/grid.bootstrap.css.js';\nimport { styles as fluent } from '../styles/grid/themes/light/grid.fluent.css.js';\nimport { styles as indigo } from '../styles/grid/themes/light/grid.indigo.css.js';\nimport { styles as material } from '../styles/grid/themes/light/grid.material.css.js';\nimport ApexGridCell from './cell.js';\nimport ApexFilterRow from './filter-row.js';\nimport ApexGridHeaderRow from './header-row.js';\nimport ApexGridRow from './row.js';\nimport ApexVirtualizer from './virtualizer.js';\n\n/**\n * Event object for the filtering event of the grid.\n */\nexport interface ApexFilteringEvent<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 ApexFilteredEvent<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 apex-grid.\n */\nexport interface ApexGridEventMap<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<SortExpression<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<SortExpression<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<ApexFilteringEvent<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<ApexFilteredEvent<T>>;\n}\n\n/**\n * Apex grid 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 apex-grid\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 ApexGrid<T extends object> extends EventEmitterBase<ApexGridEventMap<T>> {\n public static get tagName() {\n return GRID_TAG;\n }\n\n public static override styles = bootstrap;\n\n public static register() {\n registerComponent(\n ApexGrid,\n ApexVirtualizer,\n ApexGridRow,\n ApexGridHeaderRow,\n ApexFilterRow,\n IgcButtonComponent,\n IgcChipComponent,\n IgcInputComponent,\n IgcDropdownComponent\n );\n }\n\n protected stateController = new StateController<T>(this);\n protected DOM = new GridDOMController<T>(this, this.stateController);\n protected dataController = new DataOperationsController<T>(this);\n\n protected stateProvider = new ContextProvider(this, {\n context: gridStateContext,\n initialValue: this.stateController,\n });\n\n @query(ApexVirtualizer.tagName)\n protected scrollContainer!: ApexVirtualizer;\n\n @query(ApexGridHeaderRow.tagName)\n protected headerRow!: ApexGridHeaderRow<T>;\n\n @query(ApexFilterRow.tagName)\n protected filterRow!: ApexFilterRow<T>;\n\n @state()\n protected dataState: Array<T> = [];\n\n @queryAll(ApexGridRow.tagName)\n protected _rows!: NodeListOf<ApexGridRow<T>>;\n\n /** Column configuration for the grid. */\n @property({ attribute: false })\n public columns: Array<ColumnConfiguration<T>> = [];\n\n /** The data source for the grid. */\n @property({ attribute: false })\n public data: Array<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 sortConfiguration: GridSortConfiguration = {\n multiple: true,\n triState: true,\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 sortExpressions(expressions: SortExpression<T>[]) {\n if (expressions.length) {\n this.sort(expressions);\n }\n }\n\n /**\n * Get the sort state for the grid.\n */\n @property({ attribute: false })\n public get sortExpressions(): SortExpression<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 (expressions.length) {\n this.filter(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 const expressions: FilterExpression<T>[] = [];\n\n for (const each of this.stateController.filtering.state.values) {\n expressions.push(...each.all);\n }\n\n return expressions;\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 Array.from(this._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 ApexGrid.dataView} collection.\n */\n public get totalItems() {\n return this.dataState.length;\n }\n\n @watch('columns')\n protected watchColumns(_: ColumnConfiguration<T>[], newConfig: ColumnConfiguration<T>[] = []) {\n this.columns = newConfig.map((config) => ({ ...DEFAULT_COLUMN_CONFIG, ...config }));\n }\n\n @watch('data')\n protected dataChanged() {\n this.dataState = structuredClone(this.data);\n autoGenerateColumns(this);\n\n if (this.hasUpdated) {\n this.pipeline();\n }\n }\n\n @watch(PIPELINE)\n protected async pipeline() {\n this.dataState = await this.dataController.apply(\n structuredClone(this.data),\n this.stateController\n );\n }\n\n constructor() {\n super();\n\n addThemingController(this, {\n light: { bootstrap, material, fluent, indigo },\n dark: { bootstrap, material, fluent, indigo },\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>[]) {\n this.stateController.filtering.filter(\n asArray(config).map((each) =>\n typeof each.condition === 'string'\n ? // XXX: Types\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: SortExpression<T> | SortExpression<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>) {\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>) {\n this.stateController.filtering.reset(key);\n this.requestUpdate(PIPELINE);\n }\n\n /**\n * Returns a {@link ColumnConfiguration} for a given column.\n */\n public getColumn(id: Keys<T> | number) {\n return typeof id === 'number'\n ? this.columns.at(id)\n : this.columns.find(({ key }) => key === id);\n }\n\n /**\n * Updates the column configuration of the grid.\n */\n public updateColumns(columns: ColumnConfiguration<T> | ColumnConfiguration<T>[]) {\n for (const column of asArray(columns)) {\n const instance = this.columns.find((curr) => curr.key === column.key);\n if (instance) {\n Object.assign(instance, column);\n }\n }\n\n this.requestUpdate(PIPELINE);\n }\n\n @eventOptions({ capture: true })\n protected bodyClickHandler(event: MouseEvent) {\n const target = event.composedPath().find((el) => el instanceof ApexGridCell) as ApexGridCell<T>;\n if (target) {\n this.stateController.active = {\n column: target.column.key,\n row: target.row.index,\n };\n }\n }\n\n protected bodyKeydownHandler(event: KeyboardEvent) {\n if (this.scrollContainer.isSameNode(event.target as HTMLElement)) {\n this.stateController.navigation.navigate(event);\n }\n }\n\n protected renderHeaderRow() {\n return html`\n <apex-grid-header-row\n style=${styleMap(this.DOM.columnSizes)}\n .columns=${this.columns}\n ></apex-grid-header-row>\n `;\n }\n\n protected renderBody() {\n return html`\n <apex-virtualizer\n .items=${this.dataState}\n .renderItem=${this.DOM.rowRenderer}\n @click=${this.bodyClickHandler}\n @keydown=${this.bodyKeydownHandler}\n ></apex-virtualizer>\n `;\n }\n\n protected renderFilterRow() {\n return this.columns.some((column) => column.filter)\n ? html`<apex-filter-row style=${styleMap(this.DOM.columnSizes)}></apex-filter-row>`\n : nothing;\n }\n\n protected override render() {\n return html`\n ${this.stateController.resizing.renderIndicator()}\n ${this.renderHeaderRow()}\n ${this.renderFilterRow()}\n ${this.renderBody()}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [ApexGrid.tagName]: ApexGrid<object>;\n }\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { LitElement, PropertyValueMap } from 'lit';
|
|
2
|
-
import { StateController } from '../controllers/state.js';
|
|
3
|
-
import ApexGridHeader from './header.js';
|
|
1
|
+
import { LitElement, type PropertyValueMap } from 'lit';
|
|
2
|
+
import { type StateController } from '../controllers/state.js';
|
|
4
3
|
import type { ColumnConfiguration } from '../internal/types.js';
|
|
4
|
+
import ApexGridHeader from './header.js';
|
|
5
5
|
export default class ApexGridHeaderRow<T extends object> extends LitElement {
|
|
6
6
|
#private;
|
|
7
|
-
static get
|
|
7
|
+
static get tagName(): "apex-grid-header-row";
|
|
8
8
|
static styles: import("lit").CSSResult;
|
|
9
9
|
static register(): void;
|
|
10
10
|
protected _headers: NodeListOf<ApexGridHeader<T>>;
|
|
@@ -18,7 +18,6 @@ export default class ApexGridHeaderRow<T extends object> extends LitElement {
|
|
|
18
18
|
}
|
|
19
19
|
declare global {
|
|
20
20
|
interface HTMLElementTagNameMap {
|
|
21
|
-
[ApexGridHeaderRow.
|
|
21
|
+
[ApexGridHeaderRow.tagName]: ApexGridHeaderRow<object>;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
//# sourceMappingURL=header-row.d.ts.map
|
|
@@ -4,68 +4,63 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
-
};
|
|
12
|
-
var _ApexGridHeaderRow_instances, _ApexGridHeaderRow_activeFilterColumn;
|
|
7
|
+
import { consume } from '@lit/context';
|
|
13
8
|
import { html, LitElement, nothing } from 'lit';
|
|
14
|
-
import { consume } from '@lit-labs/context';
|
|
15
9
|
import { property, queryAll } from 'lit/decorators.js';
|
|
16
10
|
import { map } from 'lit/directives/map.js';
|
|
17
11
|
import { gridStateContext } from '../controllers/state.js';
|
|
18
12
|
import { partNameMap } from '../internal/part-map.js';
|
|
19
|
-
import { GRID_HEADER_ROW_TAG } from '../internal/tags.js';
|
|
20
13
|
import { registerComponent } from '../internal/register.js';
|
|
14
|
+
import { GRID_HEADER_ROW_TAG } from '../internal/tags.js';
|
|
15
|
+
import { styles } from '../styles/header-row/header-row.base.css.js';
|
|
21
16
|
import ApexGridHeader from './header.js';
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
static get is() {
|
|
17
|
+
export default class ApexGridHeaderRow extends LitElement {
|
|
18
|
+
static get tagName() {
|
|
25
19
|
return GRID_HEADER_ROW_TAG;
|
|
26
20
|
}
|
|
21
|
+
static { this.styles = styles; }
|
|
27
22
|
static register() {
|
|
28
|
-
registerComponent(
|
|
23
|
+
registerComponent(ApexGridHeaderRow, ApexGridHeader);
|
|
29
24
|
}
|
|
30
25
|
get headers() {
|
|
31
26
|
return Array.from(this._headers);
|
|
32
27
|
}
|
|
33
28
|
constructor() {
|
|
34
29
|
super();
|
|
35
|
-
_ApexGridHeaderRow_instances.add(this);
|
|
36
30
|
this.columns = [];
|
|
37
|
-
this.addEventListener('click',
|
|
31
|
+
this.addEventListener('click', this.#activeFilterColumn);
|
|
38
32
|
}
|
|
39
33
|
connectedCallback() {
|
|
40
34
|
super.connectedCallback();
|
|
41
35
|
this.setAttribute('tabindex', '0');
|
|
42
36
|
}
|
|
37
|
+
#activeFilterColumn(event) {
|
|
38
|
+
const header = event
|
|
39
|
+
.composedPath()
|
|
40
|
+
.filter((target) => target instanceof ApexGridHeader)
|
|
41
|
+
.at(0);
|
|
42
|
+
this.state.filtering.setActiveColumn(header?.column);
|
|
43
|
+
}
|
|
43
44
|
shouldUpdate(props) {
|
|
44
|
-
|
|
45
|
+
for (const header of this.headers) {
|
|
46
|
+
header.requestUpdate();
|
|
47
|
+
}
|
|
45
48
|
return super.shouldUpdate(props);
|
|
46
49
|
}
|
|
47
50
|
render() {
|
|
48
51
|
const filterRow = this.state.filtering.filterRow;
|
|
49
|
-
return html `${map(this.columns, column => column.hidden
|
|
52
|
+
return html `${map(this.columns, (column) => column.hidden
|
|
50
53
|
? nothing
|
|
51
54
|
: html `<apex-grid-header
|
|
52
55
|
part=${partNameMap({
|
|
53
|
-
filtered: column ===
|
|
56
|
+
filtered: column === filterRow?.column,
|
|
54
57
|
})}
|
|
55
58
|
.column=${column}
|
|
56
59
|
></apex-grid-header>`)}`;
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
|
-
_ApexGridHeaderRow_instances = new WeakSet(), _ApexGridHeaderRow_activeFilterColumn = function _ApexGridHeaderRow_activeFilterColumn(event) {
|
|
60
|
-
const header = event
|
|
61
|
-
.composedPath()
|
|
62
|
-
.filter(target => target instanceof ApexGridHeader)
|
|
63
|
-
.at(0);
|
|
64
|
-
this.state.filtering.setActiveColumn(header === null || header === void 0 ? void 0 : header.column);
|
|
65
|
-
};
|
|
66
|
-
ApexGridHeaderRow.styles = styles;
|
|
67
62
|
__decorate([
|
|
68
|
-
queryAll(ApexGridHeader.
|
|
63
|
+
queryAll(ApexGridHeader.tagName)
|
|
69
64
|
], ApexGridHeaderRow.prototype, "_headers", void 0);
|
|
70
65
|
__decorate([
|
|
71
66
|
consume({ context: gridStateContext, subscribe: true }),
|
|
@@ -74,5 +69,4 @@ __decorate([
|
|
|
74
69
|
__decorate([
|
|
75
70
|
property({ attribute: false })
|
|
76
71
|
], ApexGridHeaderRow.prototype, "columns", void 0);
|
|
77
|
-
export default ApexGridHeaderRow;
|
|
78
72
|
//# sourceMappingURL=header-row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header-row.js","sourceRoot":"","sources":["../../src/components/header-row.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,UA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E,CAAC,CAAC,CAAsB,CAAC;QAE9B,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvD,CAAC;IAEkB,YAAY,CAAC,KAAsD;QACpF,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClC,MAAM,CAAC,aAAa,EAAE,CAAC;QACzB,CAAC;QAED,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAEkB,MAAM;QACvB,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC;QAEjD,OAAO,IAAI,CAAA,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CACzC,MAAM,CAAC,MAAM;YACX,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,IAAI,CAAA;mBACK,WAAW,CAAC;gBACjB,QAAQ,EAAE,MAAM,KAAK,SAAS,EAAE,MAAM;aACvC,CAAC;sBACQ,MAAM;+BACG,CAC1B,EAAE,CAAC;IACN,CAAC;;AArDS;IADT,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC;mDACkB;AAI5C;IAFN,OAAO,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACvD,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;gDACG;AAG3B;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;kDACoB","sourcesContent":["import { consume } from '@lit/context';\nimport { html, LitElement, nothing, type PropertyValueMap } from 'lit';\nimport { property, queryAll } from 'lit/decorators.js';\nimport { map } from 'lit/directives/map.js';\nimport { gridStateContext, type StateController } from '../controllers/state.js';\nimport { partNameMap } from '../internal/part-map.js';\nimport { registerComponent } from '../internal/register.js';\nimport { GRID_HEADER_ROW_TAG } from '../internal/tags.js';\nimport type { ColumnConfiguration } from '../internal/types.js';\nimport { styles } from '../styles/header-row/header-row.base.css.js';\nimport ApexGridHeader from './header.js';\n\nexport default class ApexGridHeaderRow<T extends object> extends LitElement {\n public static get tagName() {\n return GRID_HEADER_ROW_TAG;\n }\n public static override styles = styles;\n\n public static register(): void {\n registerComponent(ApexGridHeaderRow, ApexGridHeader);\n }\n\n @queryAll(ApexGridHeader.tagName)\n protected _headers!: NodeListOf<ApexGridHeader<T>>;\n\n @consume({ context: gridStateContext, subscribe: true })\n @property({ attribute: false })\n public state!: StateController<T>;\n\n @property({ attribute: false })\n public columns: Array<ColumnConfiguration<T>> = [];\n\n public get headers() {\n return Array.from(this._headers);\n }\n\n constructor() {\n super();\n this.addEventListener('click', this.#activeFilterColumn);\n }\n\n public override connectedCallback() {\n super.connectedCallback();\n this.setAttribute('tabindex', '0');\n }\n\n #activeFilterColumn(event: MouseEvent) {\n const header = event\n .composedPath()\n .filter((target) => target instanceof ApexGridHeader)\n .at(0) as ApexGridHeader<T>;\n\n this.state.filtering.setActiveColumn(header?.column);\n }\n\n protected override shouldUpdate(props: PropertyValueMap<this> | Map<PropertyKey, this>): boolean {\n for (const header of this.headers) {\n header.requestUpdate();\n }\n\n return super.shouldUpdate(props);\n }\n\n protected override render() {\n const filterRow = this.state.filtering.filterRow;\n\n return html`${map(this.columns, (column) =>\n column.hidden\n ? nothing\n : html`<apex-grid-header\n part=${partNameMap({\n filtered: column === filterRow?.column,\n })}\n .column=${column}\n ></apex-grid-header>`\n )}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [ApexGridHeaderRow.tagName]: ApexGridHeaderRow<object>;\n }\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { LitElement, nothing } from 'lit';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import { type StateController } from '../controllers/state.js';
|
|
3
|
+
import type { ApexHeaderContext, ColumnConfiguration } from '../internal/types.js';
|
|
4
4
|
export default class ApexGridHeader<T extends object> extends LitElement {
|
|
5
5
|
#private;
|
|
6
|
-
static get
|
|
6
|
+
static get tagName(): "apex-grid-header";
|
|
7
7
|
static styles: import("lit").CSSResult;
|
|
8
8
|
static register(): void;
|
|
9
9
|
protected get context(): ApexHeaderContext<T>;
|
|
@@ -18,7 +18,6 @@ export default class ApexGridHeader<T extends object> extends LitElement {
|
|
|
18
18
|
}
|
|
19
19
|
declare global {
|
|
20
20
|
interface HTMLElementTagNameMap {
|
|
21
|
-
[ApexGridHeader.
|
|
21
|
+
[ApexGridHeader.tagName]: ApexGridHeader<object>;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
//# sourceMappingURL=header.d.ts.map
|