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
|
@@ -5,7 +5,7 @@ import type ApexGridRow from './row.js';
|
|
|
5
5
|
* Component representing a DOM cell of the Apex grid.
|
|
6
6
|
*/
|
|
7
7
|
export default class ApexGridCell<T extends object> extends LitElement {
|
|
8
|
-
static get
|
|
8
|
+
static get tagName(): "apex-grid-cell";
|
|
9
9
|
static styles: import("lit").CSSResult;
|
|
10
10
|
static register(): void;
|
|
11
11
|
/**
|
|
@@ -30,7 +30,6 @@ export default class ApexGridCell<T extends object> extends LitElement {
|
|
|
30
30
|
}
|
|
31
31
|
declare global {
|
|
32
32
|
interface HTMLElementTagNameMap {
|
|
33
|
-
[ApexGridCell.
|
|
33
|
+
[ApexGridCell.tagName]: ApexGridCell<object>;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
//# sourceMappingURL=cell.d.ts.map
|
|
@@ -8,24 +8,18 @@ import { html, LitElement } from 'lit';
|
|
|
8
8
|
import { property } from 'lit/decorators.js';
|
|
9
9
|
import { registerComponent } from '../internal/register.js';
|
|
10
10
|
import { GRID_CELL_TAG } from '../internal/tags.js';
|
|
11
|
-
import { styles } from '../styles/body-cell/body-cell
|
|
12
|
-
|
|
13
|
-
* Component representing a DOM cell of the Apex grid.
|
|
14
|
-
*/
|
|
15
|
-
class ApexGridCell extends LitElement {
|
|
11
|
+
import { styles } from '../styles/body-cell/body-cell.css.js';
|
|
12
|
+
export default class ApexGridCell extends LitElement {
|
|
16
13
|
constructor() {
|
|
17
14
|
super(...arguments);
|
|
18
|
-
/**
|
|
19
|
-
* Indicates whether this is the active cell in the grid.
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
15
|
this.active = false;
|
|
23
16
|
}
|
|
24
|
-
static get
|
|
17
|
+
static get tagName() {
|
|
25
18
|
return GRID_CELL_TAG;
|
|
26
19
|
}
|
|
20
|
+
static { this.styles = styles; }
|
|
27
21
|
static register() {
|
|
28
|
-
registerComponent(
|
|
22
|
+
registerComponent(ApexGridCell);
|
|
29
23
|
}
|
|
30
24
|
get context() {
|
|
31
25
|
return {
|
|
@@ -41,7 +35,6 @@ class ApexGridCell extends LitElement {
|
|
|
41
35
|
: html `${this.value}`;
|
|
42
36
|
}
|
|
43
37
|
}
|
|
44
|
-
ApexGridCell.styles = styles;
|
|
45
38
|
__decorate([
|
|
46
39
|
property({ attribute: false })
|
|
47
40
|
], ApexGridCell.prototype, "value", void 0);
|
|
@@ -51,5 +44,4 @@ __decorate([
|
|
|
51
44
|
__decorate([
|
|
52
45
|
property({ type: Boolean, reflect: true })
|
|
53
46
|
], ApexGridCell.prototype, "active", void 0);
|
|
54
|
-
export default ApexGridCell;
|
|
55
47
|
//# sourceMappingURL=cell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cell.js","sourceRoot":"","sources":["../../src/components/cell.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAM9D,MAAM,CAAC,OAAO,OAAO,YAA+B,SAAQ,UAAU;IAAtE;;QA4BS,WAAM,GAAG,KAAK,CAAC;IAqBxB,CAAC;IAhDQ,MAAM,KAAK,OAAO;QACvB,OAAO,aAAa,CAAC;IACvB,CAAC;aAEsB,WAAM,GAAG,MAAM,AAAT,CAAU;IAEhC,MAAM,CAAC,QAAQ;QACpB,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC;IA0BD,IAAc,OAAO;QACnB,OAAO;YACL,MAAM,EAAE,IAAI;YACZ,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,KAAK,EAAE,IAAI,CAAC,KAAK;SACe,CAAC;IACrC,CAAC;IAEkB,MAAM;QACvB,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY;YAC7B,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,OAAoC,CAAC;YACrE,CAAC,CAAC,IAAI,CAAA,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;;AAjCM;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CACA;AAMxB;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CACQ;AAOhC;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CACrB","sourcesContent":["import { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { registerComponent } from '../internal/register.js';\nimport { GRID_CELL_TAG } from '../internal/tags.js';\nimport type { ApexCellContext, ColumnConfiguration, PropertyType } from '../internal/types.js';\nimport { styles } from '../styles/body-cell/body-cell.css.js';\nimport type ApexGridRow from './row.js';\n\n/**\n * Component representing a DOM cell of the Apex grid.\n */\nexport default class ApexGridCell<T extends object> extends LitElement {\n public static get tagName() {\n return GRID_CELL_TAG;\n }\n\n public static override styles = styles;\n\n public static register(): void {\n registerComponent(ApexGridCell);\n }\n\n /**\n * The value which will be rendered by the component.\n */\n @property({ attribute: false })\n public value!: PropertyType<T>;\n\n /**\n * A reference to the column configuration object.\n */\n @property({ attribute: false })\n public column!: ColumnConfiguration<T>;\n\n /**\n * Indicates whether this is the active cell in the grid.\n *\n */\n @property({ type: Boolean, reflect: true })\n public active = false;\n\n /**\n * The parent row component holding this cell.\n */\n public row!: ApexGridRow<T>;\n\n protected get context(): ApexCellContext<T> {\n return {\n parent: this,\n row: this.row,\n column: this.column,\n value: this.value,\n } as unknown as ApexCellContext<T>;\n }\n\n protected override render() {\n return this.column.cellTemplate\n ? this.column.cellTemplate(this.context as ApexCellContext<T> as any)\n : html`${this.value}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [ApexGridCell.tagName]: ApexGridCell<object>;\n }\n}\n"]}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
+
import { IgcDropdownComponent, type IgcIconComponent, IgcInputComponent } from 'igniteui-webcomponents';
|
|
1
2
|
import { LitElement, nothing } from 'lit';
|
|
2
|
-
import { StateController } from '../controllers/state.js';
|
|
3
|
+
import { type StateController } from '../controllers/state.js';
|
|
4
|
+
import type { ColumnConfiguration } from '../internal/types.js';
|
|
3
5
|
import type { FilterExpressionTree } from '../operations/filter/tree.js';
|
|
4
6
|
import type { FilterExpression, FilterOperation } from '../operations/filter/types.js';
|
|
5
|
-
import type { ColumnConfiguration } from '../internal/types.js';
|
|
6
|
-
import { IgcInputComponent, IgcDropdownComponent, IgcIconComponent } from 'igniteui-webcomponents';
|
|
7
7
|
type ExpressionChipProps<T> = {
|
|
8
8
|
expression: FilterExpression<T>;
|
|
9
9
|
selected: boolean;
|
|
10
|
-
onRemove:
|
|
11
|
-
onSelect:
|
|
10
|
+
onRemove: (e: Event) => Promise<void>;
|
|
11
|
+
onSelect: (e: Event) => Promise<void>;
|
|
12
12
|
};
|
|
13
13
|
export default class ApexFilterRow<T extends object> extends LitElement {
|
|
14
14
|
#private;
|
|
15
|
-
static get
|
|
15
|
+
static get tagName(): "apex-filter-row";
|
|
16
16
|
static styles: import("lit").CSSResult;
|
|
17
17
|
static register(): void;
|
|
18
18
|
state: StateController<T>;
|
|
@@ -41,8 +41,7 @@ export default class ApexFilterRow<T extends object> extends LitElement {
|
|
|
41
41
|
}
|
|
42
42
|
declare global {
|
|
43
43
|
interface HTMLElementTagNameMap {
|
|
44
|
-
[ApexFilterRow.
|
|
44
|
+
[ApexFilterRow.tagName]: ApexFilterRow<object>;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
export {};
|
|
48
|
-
//# sourceMappingURL=filter-row.d.ts.map
|
|
@@ -4,24 +4,18 @@ 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
|
-
|
|
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 _ApexFilterRow_instances, _ApexFilterRow_setDefaultExpression, _ApexFilterRow_removeExpression, _ApexFilterRow_show, _ApexFilterRow_handleConditionChanged, _ApexFilterRow_handleInput, _ApexFilterRow_handleKeydown, _ApexFilterRow_handleResetClick, _ApexFilterRow_openDropdownList, _ApexFilterRow_chipCriteriaFor, _ApexFilterRow_chipSelectFor, _ApexFilterRow_chipRemoveFor;
|
|
7
|
+
import { consume } from '@lit/context';
|
|
8
|
+
import { IgcDropdownComponent, IgcInputComponent, } from 'igniteui-webcomponents';
|
|
13
9
|
import { html, LitElement, nothing } from 'lit';
|
|
14
|
-
import { consume } from '@lit-labs/context';
|
|
15
10
|
import { property, query } from 'lit/decorators.js';
|
|
16
11
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
17
12
|
import { gridStateContext } from '../controllers/state.js';
|
|
18
13
|
import { DEFAULT_COLUMN_CONFIG } from '../internal/constants.js';
|
|
14
|
+
import { registerComponent } from '../internal/register.js';
|
|
19
15
|
import { GRID_FILTER_ROW_TAG } from '../internal/tags.js';
|
|
20
16
|
import { getFilterOperandsFor } from '../internal/utils.js';
|
|
21
|
-
import { registerComponent } from '../internal/register.js';
|
|
22
17
|
import { watch } from '../internal/watch.js';
|
|
23
|
-
import { styles } from '../styles/filter-row/filter-row
|
|
24
|
-
import { IgcInputComponent, IgcDropdownComponent, } from 'igniteui-webcomponents';
|
|
18
|
+
import { styles } from '../styles/filter-row/filter-row.css.js';
|
|
25
19
|
function prefixedIcon(icon) {
|
|
26
20
|
return html `<igc-icon
|
|
27
21
|
slot="prefix"
|
|
@@ -29,18 +23,18 @@ function prefixedIcon(icon) {
|
|
|
29
23
|
collection="internal"
|
|
30
24
|
></igc-icon>`;
|
|
31
25
|
}
|
|
32
|
-
class ApexFilterRow extends LitElement {
|
|
26
|
+
export default class ApexFilterRow extends LitElement {
|
|
33
27
|
constructor() {
|
|
34
28
|
super(...arguments);
|
|
35
|
-
_ApexFilterRow_instances.add(this);
|
|
36
29
|
this.active = false;
|
|
37
30
|
this.column = DEFAULT_COLUMN_CONFIG;
|
|
38
31
|
}
|
|
39
|
-
static get
|
|
32
|
+
static get tagName() {
|
|
40
33
|
return GRID_FILTER_ROW_TAG;
|
|
41
34
|
}
|
|
35
|
+
static { this.styles = styles; }
|
|
42
36
|
static register() {
|
|
43
|
-
registerComponent(
|
|
37
|
+
registerComponent(ApexFilterRow);
|
|
44
38
|
}
|
|
45
39
|
get isNumeric() {
|
|
46
40
|
return this.column.type === 'number';
|
|
@@ -51,6 +45,63 @@ class ApexFilterRow extends LitElement {
|
|
|
51
45
|
get condition() {
|
|
52
46
|
return this.expression.condition;
|
|
53
47
|
}
|
|
48
|
+
#setDefaultExpression() {
|
|
49
|
+
this.expression = this.filterController.getDefaultExpression(this.column);
|
|
50
|
+
}
|
|
51
|
+
#removeExpression(expression) {
|
|
52
|
+
this.filterController.removeExpression(expression);
|
|
53
|
+
}
|
|
54
|
+
async #show() {
|
|
55
|
+
this.active = true;
|
|
56
|
+
await this.updateComplete;
|
|
57
|
+
this.input?.select();
|
|
58
|
+
}
|
|
59
|
+
#handleConditionChanged(event) {
|
|
60
|
+
event.stopPropagation();
|
|
61
|
+
const key = event.detail.value;
|
|
62
|
+
this.expression.condition = getFilterOperandsFor(this.column)[key];
|
|
63
|
+
if (this.input.value || this.expression.condition.unary) {
|
|
64
|
+
this.filterController.filterWithEvent(this.expression, 'modify');
|
|
65
|
+
}
|
|
66
|
+
this.requestUpdate();
|
|
67
|
+
}
|
|
68
|
+
#handleInput(event) {
|
|
69
|
+
event.stopPropagation();
|
|
70
|
+
const value = this.isNumeric ? Number.parseFloat(event.detail) : event.detail;
|
|
71
|
+
const shouldUpdate = this.isNumeric ? !Number.isNaN(value) : !!value;
|
|
72
|
+
const type = this.filterController.get(this.expression.key)?.has(this.expression)
|
|
73
|
+
? 'modify'
|
|
74
|
+
: 'add';
|
|
75
|
+
if (shouldUpdate) {
|
|
76
|
+
this.expression.searchTerm = value;
|
|
77
|
+
this.filterController.filterWithEvent(this.expression, type);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
this.#removeExpression(this.expression);
|
|
81
|
+
}
|
|
82
|
+
this.requestUpdate();
|
|
83
|
+
}
|
|
84
|
+
#handleKeydown(event) {
|
|
85
|
+
event.stopPropagation();
|
|
86
|
+
switch (event.key) {
|
|
87
|
+
case 'Enter':
|
|
88
|
+
this.input.value = '';
|
|
89
|
+
this.#setDefaultExpression();
|
|
90
|
+
return;
|
|
91
|
+
case 'Escape':
|
|
92
|
+
this.active = false;
|
|
93
|
+
return;
|
|
94
|
+
default:
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
#handleResetClick() {
|
|
99
|
+
this.filterController.removeAllExpressions(this.column.key);
|
|
100
|
+
this.requestUpdate();
|
|
101
|
+
}
|
|
102
|
+
#openDropdownList() {
|
|
103
|
+
this.dropdown.toggle(this.input);
|
|
104
|
+
}
|
|
54
105
|
activeChanged() {
|
|
55
106
|
this.style.display = this.active ? 'flex' : '';
|
|
56
107
|
if (!this.active) {
|
|
@@ -58,11 +109,39 @@ class ApexFilterRow extends LitElement {
|
|
|
58
109
|
}
|
|
59
110
|
this.state.host.requestUpdate();
|
|
60
111
|
}
|
|
112
|
+
#chipCriteriaFor(expression) {
|
|
113
|
+
return async (e) => {
|
|
114
|
+
e.stopPropagation();
|
|
115
|
+
expression.criteria = expression.criteria === 'and' ? 'or' : 'and';
|
|
116
|
+
this.filterController.filterWithEvent(expression, 'modify');
|
|
117
|
+
this.requestUpdate();
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
#chipSelectFor(expression) {
|
|
121
|
+
return async (e) => {
|
|
122
|
+
e.stopPropagation();
|
|
123
|
+
this.expression = expression;
|
|
124
|
+
await this.updateComplete;
|
|
125
|
+
this.input?.select();
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
#chipRemoveFor(expression) {
|
|
129
|
+
return async (e) => {
|
|
130
|
+
e.stopPropagation();
|
|
131
|
+
this.#removeExpression(expression);
|
|
132
|
+
if (this.active && this.expression === expression) {
|
|
133
|
+
this.#setDefaultExpression();
|
|
134
|
+
await this.updateComplete;
|
|
135
|
+
this.input.focus();
|
|
136
|
+
}
|
|
137
|
+
this.requestUpdate();
|
|
138
|
+
};
|
|
139
|
+
}
|
|
61
140
|
renderCriteriaButton(expr, index) {
|
|
62
141
|
return index
|
|
63
142
|
? html `<igc-button
|
|
64
143
|
variant="flat"
|
|
65
|
-
@click=${
|
|
144
|
+
@click=${this.#chipCriteriaFor(expr)}
|
|
66
145
|
>
|
|
67
146
|
${expr.criteria}
|
|
68
147
|
</igc-button>`
|
|
@@ -90,8 +169,8 @@ class ApexFilterRow extends LitElement {
|
|
|
90
169
|
const props = {
|
|
91
170
|
expression,
|
|
92
171
|
selected: this.expression === expression,
|
|
93
|
-
onRemove:
|
|
94
|
-
onSelect:
|
|
172
|
+
onRemove: this.#chipRemoveFor(expression),
|
|
173
|
+
onSelect: this.#chipSelectFor(expression),
|
|
95
174
|
};
|
|
96
175
|
return html `${this.renderCriteriaButton(expression, idx)}${this.renderExpressionChip(props)}`;
|
|
97
176
|
});
|
|
@@ -101,14 +180,16 @@ class ApexFilterRow extends LitElement {
|
|
|
101
180
|
<igc-button
|
|
102
181
|
id="reset"
|
|
103
182
|
variant="flat"
|
|
104
|
-
@click=${
|
|
183
|
+
@click=${this.#handleResetClick}
|
|
105
184
|
>
|
|
106
185
|
${prefixedIcon('refresh')} Reset
|
|
107
186
|
</igc-button>
|
|
108
187
|
<igc-button
|
|
109
188
|
id="close"
|
|
110
189
|
variant="flat"
|
|
111
|
-
@click=${() =>
|
|
190
|
+
@click=${() => {
|
|
191
|
+
this.active = false;
|
|
192
|
+
}}
|
|
112
193
|
>
|
|
113
194
|
${prefixedIcon('close')} Close
|
|
114
195
|
</igc-button>
|
|
@@ -118,19 +199,16 @@ class ApexFilterRow extends LitElement {
|
|
|
118
199
|
return html `<igc-dropdown
|
|
119
200
|
flip
|
|
120
201
|
same-width
|
|
121
|
-
@igcChange=${
|
|
202
|
+
@igcChange=${this.#handleConditionChanged}
|
|
122
203
|
>
|
|
123
|
-
${Object.entries(getFilterOperandsFor(this.column)).map(([key, operand]) =>
|
|
124
|
-
var _a;
|
|
125
|
-
return html `
|
|
204
|
+
${Object.entries(getFilterOperandsFor(this.column)).map(([key, operand]) => html `
|
|
126
205
|
<igc-dropdown-item
|
|
127
206
|
.value=${key}
|
|
128
207
|
?selected=${this.condition.name === key}
|
|
129
208
|
>
|
|
130
|
-
${prefixedIcon(key)}${
|
|
209
|
+
${prefixedIcon(key)}${operand?.label ?? key}
|
|
131
210
|
</igc-dropdown-item>
|
|
132
|
-
|
|
133
|
-
})}
|
|
211
|
+
`)}
|
|
134
212
|
</igc-dropdown>`;
|
|
135
213
|
}
|
|
136
214
|
renderDropdownTarget() {
|
|
@@ -139,7 +217,7 @@ class ApexFilterRow extends LitElement {
|
|
|
139
217
|
slot="prefix"
|
|
140
218
|
collection="internal"
|
|
141
219
|
.name=${this.condition.name}
|
|
142
|
-
@click=${
|
|
220
|
+
@click=${this.#openDropdownList}
|
|
143
221
|
>
|
|
144
222
|
</igc-icon>`;
|
|
145
223
|
}
|
|
@@ -149,8 +227,8 @@ class ApexFilterRow extends LitElement {
|
|
|
149
227
|
value=${ifDefined(this.expression.searchTerm)}
|
|
150
228
|
placeholder="Add filter value"
|
|
151
229
|
?readonly=${this.condition.unary}
|
|
152
|
-
@igcInput=${
|
|
153
|
-
@keydown=${
|
|
230
|
+
@igcInput=${this.#handleInput}
|
|
231
|
+
@keydown=${this.#handleKeydown}
|
|
154
232
|
>
|
|
155
233
|
${this.renderDropdownTarget()}
|
|
156
234
|
</igc-input>
|
|
@@ -168,12 +246,12 @@ class ApexFilterRow extends LitElement {
|
|
|
168
246
|
const props = {
|
|
169
247
|
expression,
|
|
170
248
|
selected: false,
|
|
171
|
-
onRemove:
|
|
172
|
-
onSelect: (e) => {
|
|
249
|
+
onRemove: this.#chipRemoveFor(expression),
|
|
250
|
+
onSelect: async (e) => {
|
|
173
251
|
e.stopPropagation();
|
|
174
252
|
this.column = column;
|
|
175
253
|
this.expression = expression;
|
|
176
|
-
|
|
254
|
+
this.#show();
|
|
177
255
|
},
|
|
178
256
|
};
|
|
179
257
|
return html `${this.renderCriteriaButton(expression, idx)}${this.renderExpressionChip(props)}`;
|
|
@@ -185,8 +263,8 @@ class ApexFilterRow extends LitElement {
|
|
|
185
263
|
const hidden = state && state.length >= 3;
|
|
186
264
|
const open = () => {
|
|
187
265
|
this.column = column;
|
|
188
|
-
|
|
189
|
-
|
|
266
|
+
this.#setDefaultExpression();
|
|
267
|
+
this.#show();
|
|
190
268
|
};
|
|
191
269
|
const count = hidden ? html `<span slot="suffix">${state.length}</span>` : nothing;
|
|
192
270
|
const chip = html `<igc-chip
|
|
@@ -197,7 +275,7 @@ class ApexFilterRow extends LitElement {
|
|
|
197
275
|
return partial ? this.renderInactiveChips(column, state) : chip;
|
|
198
276
|
}
|
|
199
277
|
renderInactiveState() {
|
|
200
|
-
return this.state.host.columns.map(column => column.hidden
|
|
278
|
+
return this.state.host.columns.map((column) => column.hidden
|
|
201
279
|
? nothing
|
|
202
280
|
: html `<div part="filter-row-preview">
|
|
203
281
|
${column.filter ? this.renderFilterState(column) : nothing}
|
|
@@ -207,86 +285,6 @@ class ApexFilterRow extends LitElement {
|
|
|
207
285
|
return html `${this.active ? this.renderActiveState() : this.renderInactiveState()}`;
|
|
208
286
|
}
|
|
209
287
|
}
|
|
210
|
-
_ApexFilterRow_instances = new WeakSet(), _ApexFilterRow_setDefaultExpression = function _ApexFilterRow_setDefaultExpression() {
|
|
211
|
-
this.expression = this.filterController.getDefaultExpression(this.column);
|
|
212
|
-
}, _ApexFilterRow_removeExpression = function _ApexFilterRow_removeExpression(expression) {
|
|
213
|
-
this.filterController.removeExpression(expression);
|
|
214
|
-
}, _ApexFilterRow_show = async function _ApexFilterRow_show() {
|
|
215
|
-
var _a;
|
|
216
|
-
this.active = true;
|
|
217
|
-
await this.updateComplete;
|
|
218
|
-
(_a = this.input) === null || _a === void 0 ? void 0 : _a.select();
|
|
219
|
-
}, _ApexFilterRow_handleConditionChanged = function _ApexFilterRow_handleConditionChanged(event) {
|
|
220
|
-
event.stopPropagation();
|
|
221
|
-
const key = event.detail.value;
|
|
222
|
-
// XXX: Types
|
|
223
|
-
this.expression.condition = getFilterOperandsFor(this.column)[key];
|
|
224
|
-
if (this.input.value || this.expression.condition.unary) {
|
|
225
|
-
this.filterController.filterWithEvent(this.expression, 'modify');
|
|
226
|
-
}
|
|
227
|
-
this.requestUpdate();
|
|
228
|
-
}, _ApexFilterRow_handleInput = function _ApexFilterRow_handleInput(event) {
|
|
229
|
-
var _a;
|
|
230
|
-
event.stopPropagation();
|
|
231
|
-
const value = this.isNumeric ? parseFloat(event.detail) : event.detail;
|
|
232
|
-
const shouldUpdate = this.isNumeric ? !isNaN(value) : !!value;
|
|
233
|
-
const type = ((_a = this.filterController.get(this.expression.key)) === null || _a === void 0 ? void 0 : _a.has(this.expression))
|
|
234
|
-
? 'modify'
|
|
235
|
-
: 'add';
|
|
236
|
-
if (shouldUpdate) {
|
|
237
|
-
this.expression.searchTerm = value;
|
|
238
|
-
this.filterController.filterWithEvent(this.expression, type);
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
__classPrivateFieldGet(this, _ApexFilterRow_instances, "m", _ApexFilterRow_removeExpression).call(this, this.expression);
|
|
242
|
-
}
|
|
243
|
-
this.requestUpdate();
|
|
244
|
-
}, _ApexFilterRow_handleKeydown = function _ApexFilterRow_handleKeydown(event) {
|
|
245
|
-
event.stopPropagation();
|
|
246
|
-
switch (event.key) {
|
|
247
|
-
case 'Enter':
|
|
248
|
-
this.input.value = '';
|
|
249
|
-
__classPrivateFieldGet(this, _ApexFilterRow_instances, "m", _ApexFilterRow_setDefaultExpression).call(this);
|
|
250
|
-
return;
|
|
251
|
-
case 'Escape':
|
|
252
|
-
this.active = false;
|
|
253
|
-
return;
|
|
254
|
-
default:
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
}, _ApexFilterRow_handleResetClick = function _ApexFilterRow_handleResetClick() {
|
|
258
|
-
this.filterController.removeAllExpressions(this.column.key);
|
|
259
|
-
this.requestUpdate();
|
|
260
|
-
}, _ApexFilterRow_openDropdownList = function _ApexFilterRow_openDropdownList() {
|
|
261
|
-
this.dropdown.toggle(this.input);
|
|
262
|
-
}, _ApexFilterRow_chipCriteriaFor = function _ApexFilterRow_chipCriteriaFor(expression) {
|
|
263
|
-
return async (e) => {
|
|
264
|
-
e.stopPropagation();
|
|
265
|
-
expression.criteria = expression.criteria === 'and' ? 'or' : 'and';
|
|
266
|
-
this.filterController.filterWithEvent(expression, 'modify');
|
|
267
|
-
this.requestUpdate();
|
|
268
|
-
};
|
|
269
|
-
}, _ApexFilterRow_chipSelectFor = function _ApexFilterRow_chipSelectFor(expression) {
|
|
270
|
-
return async (e) => {
|
|
271
|
-
var _a;
|
|
272
|
-
e.stopPropagation();
|
|
273
|
-
this.expression = expression;
|
|
274
|
-
await this.updateComplete;
|
|
275
|
-
(_a = this.input) === null || _a === void 0 ? void 0 : _a.select();
|
|
276
|
-
};
|
|
277
|
-
}, _ApexFilterRow_chipRemoveFor = function _ApexFilterRow_chipRemoveFor(expression) {
|
|
278
|
-
return async (e) => {
|
|
279
|
-
e.stopPropagation();
|
|
280
|
-
__classPrivateFieldGet(this, _ApexFilterRow_instances, "m", _ApexFilterRow_removeExpression).call(this, expression);
|
|
281
|
-
if (this.active && this.expression === expression) {
|
|
282
|
-
__classPrivateFieldGet(this, _ApexFilterRow_instances, "m", _ApexFilterRow_setDefaultExpression).call(this);
|
|
283
|
-
await this.updateComplete;
|
|
284
|
-
this.input.focus();
|
|
285
|
-
}
|
|
286
|
-
this.requestUpdate();
|
|
287
|
-
};
|
|
288
|
-
};
|
|
289
|
-
ApexFilterRow.styles = styles;
|
|
290
288
|
__decorate([
|
|
291
289
|
consume({ context: gridStateContext, subscribe: true }),
|
|
292
290
|
property({ attribute: false })
|
|
@@ -312,5 +310,4 @@ __decorate([
|
|
|
312
310
|
__decorate([
|
|
313
311
|
watch('active', { waitUntilFirstUpdate: true })
|
|
314
312
|
], ApexFilterRow.prototype, "activeChanged", null);
|
|
315
|
-
export default ApexFilterRow;
|
|
316
313
|
//# sourceMappingURL=filter-row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-row.js","sourceRoot":"","sources":["../../src/components/filter-row.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EACL,oBAAoB,EAGpB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAwB,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG7C,O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C,CAAC,IAAI,CAAA;cACA,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO;iBACrD,CACZ,CAAC;IACJ,CAAC;IAEkB,MAAM;QACvB,OAAO,IAAI,CAAA,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,CAAC;IACtF,CAAC;;AArUM;IAFN,OAAO,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACvD,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CACG;AAe3B;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;6CACT;AAGf;IADN,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC;4CACA;AAG1B;IADN,KAAK,CAAC,YAAY,CAAC;uDACuB;AAGpC;IADN,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC;+CACG;AAGhC;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;6CACyD;AAGjF;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iDACS;AA+E9B;IADT,KAAK,CAAC,QAAQ,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;kDAS/C","sourcesContent":["import { consume } from '@lit/context';\nimport {\n IgcDropdownComponent,\n type IgcDropdownItemComponent,\n type IgcIconComponent,\n IgcInputComponent,\n} from 'igniteui-webcomponents';\nimport { html, LitElement, nothing } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { gridStateContext, type StateController } from '../controllers/state.js';\nimport { DEFAULT_COLUMN_CONFIG } from '../internal/constants.js';\nimport { registerComponent } from '../internal/register.js';\nimport { GRID_FILTER_ROW_TAG } from '../internal/tags.js';\nimport type { ColumnConfiguration } from '../internal/types.js';\nimport { getFilterOperandsFor } from '../internal/utils.js';\nimport { watch } from '../internal/watch.js';\nimport type { FilterExpressionTree } from '../operations/filter/tree.js';\nimport type { FilterExpression, FilterOperation, OperandKeys } from '../operations/filter/types.js';\nimport { styles } from '../styles/filter-row/filter-row.css.js';\n\ntype ExpressionChipProps<T> = {\n expression: FilterExpression<T>;\n selected: boolean;\n onRemove: (e: Event) => Promise<void>;\n onSelect: (e: Event) => Promise<void>;\n};\n\nfunction prefixedIcon(icon?: string) {\n return html`<igc-icon\n slot=\"prefix\"\n name=${ifDefined(icon)}\n collection=\"internal\"\n ></igc-icon>`;\n}\n\nexport default class ApexFilterRow<T extends object> extends LitElement {\n public static get tagName() {\n return GRID_FILTER_ROW_TAG;\n }\n\n public static override styles = styles;\n\n public static register() {\n registerComponent(ApexFilterRow);\n }\n\n @consume({ context: gridStateContext, subscribe: true })\n @property({ attribute: false })\n public state!: StateController<T>;\n\n protected get isNumeric() {\n return this.column.type === 'number';\n }\n\n protected get filterController() {\n return this.state.filtering;\n }\n\n protected get condition() {\n return this.expression.condition as FilterOperation<T>;\n }\n\n @property({ attribute: false })\n public active = false;\n\n @query(IgcInputComponent.tagName)\n public input!: IgcInputComponent;\n\n @query('#condition')\n public conditionElement!: IgcIconComponent;\n\n @query(IgcDropdownComponent.tagName)\n public dropdown!: IgcDropdownComponent;\n\n @property({ attribute: false })\n public column: ColumnConfiguration<T> = DEFAULT_COLUMN_CONFIG as ColumnConfiguration<T>;\n\n @property({ attribute: false })\n public expression!: FilterExpression<T>;\n\n #setDefaultExpression() {\n this.expression = this.filterController.getDefaultExpression(this.column);\n }\n\n #removeExpression(expression: FilterExpression<T>) {\n this.filterController.removeExpression(expression);\n }\n\n async #show() {\n this.active = true;\n\n await this.updateComplete;\n this.input?.select();\n }\n\n #handleConditionChanged(event: CustomEvent<IgcDropdownItemComponent>) {\n event.stopPropagation();\n const key = event.detail.value as OperandKeys<T[typeof this.column.key]>;\n\n // XXX: Types\n this.expression.condition = (getFilterOperandsFor(this.column) as any)[key] as FilterOperation<\n T[keyof T]\n >;\n\n if (this.input.value || this.expression.condition.unary) {\n this.filterController.filterWithEvent(this.expression, 'modify');\n }\n\n this.requestUpdate();\n }\n\n #handleInput(event: CustomEvent<string>) {\n event.stopPropagation();\n\n const value = this.isNumeric ? Number.parseFloat(event.detail) : event.detail;\n const shouldUpdate = this.isNumeric ? !Number.isNaN(value as number) : !!value;\n const type = this.filterController.get(this.expression.key)?.has(this.expression)\n ? 'modify'\n : 'add';\n\n if (shouldUpdate) {\n this.expression.searchTerm = value as any;\n\n this.filterController.filterWithEvent(this.expression, type);\n } else {\n this.#removeExpression(this.expression);\n }\n\n this.requestUpdate();\n }\n\n #handleKeydown(event: KeyboardEvent) {\n event.stopPropagation();\n\n switch (event.key) {\n case 'Enter':\n this.input.value = '';\n this.#setDefaultExpression();\n return;\n case 'Escape':\n this.active = false;\n return;\n default:\n return;\n }\n }\n\n #handleResetClick() {\n this.filterController.removeAllExpressions(this.column.key);\n this.requestUpdate();\n }\n\n #openDropdownList() {\n this.dropdown.toggle(this.input);\n }\n\n @watch('active', { waitUntilFirstUpdate: true })\n protected activeChanged() {\n this.style.display = this.active ? 'flex' : '';\n\n if (!this.active) {\n this.column = DEFAULT_COLUMN_CONFIG as ColumnConfiguration<T>;\n }\n\n this.state.host.requestUpdate();\n }\n\n #chipCriteriaFor(expression: FilterExpression<T>) {\n return async (e: Event) => {\n e.stopPropagation();\n\n expression.criteria = expression.criteria === 'and' ? 'or' : 'and';\n this.filterController.filterWithEvent(expression, 'modify');\n this.requestUpdate();\n };\n }\n\n #chipSelectFor(expression: FilterExpression<T>) {\n return async (e: Event) => {\n e.stopPropagation();\n this.expression = expression;\n await this.updateComplete;\n this.input?.select();\n };\n }\n\n #chipRemoveFor(expression: FilterExpression<T>) {\n return async (e: Event) => {\n e.stopPropagation();\n this.#removeExpression(expression);\n\n if (this.active && this.expression === expression) {\n this.#setDefaultExpression();\n await this.updateComplete;\n this.input.focus();\n }\n\n this.requestUpdate();\n };\n }\n\n protected renderCriteriaButton(expr: FilterExpression<T>, index: number) {\n return index\n ? html`<igc-button\n variant=\"flat\"\n @click=${this.#chipCriteriaFor(expr)}\n >\n ${expr.criteria}\n </igc-button>`\n : nothing;\n }\n\n protected renderExpressionChip(props: ExpressionChipProps<T>) {\n const { name, unary } = props.expression.condition as FilterOperation<T>;\n const { searchTerm: term } = props.expression;\n\n const prefix = html`<span slot=\"select\"></span>${prefixedIcon(name)}`;\n\n return html`<igc-chip\n selectable\n removable\n ?selected=${props.selected}\n @igcRemove=${props.onRemove}\n @igcSelect=${props.onSelect}\n >\n ${prefix}${unary ? name : term}\n </igc-chip>`;\n }\n\n protected renderActiveChips() {\n const state = this.filterController.get(this.column.key);\n\n return !state\n ? nothing\n : Array.from(state).map((expression, idx) => {\n const props: ExpressionChipProps<T> = {\n expression,\n selected: this.expression === expression,\n onRemove: this.#chipRemoveFor(expression),\n onSelect: this.#chipSelectFor(expression),\n };\n\n return html`${this.renderCriteriaButton(expression, idx)}${this.renderExpressionChip(\n props\n )}`;\n });\n }\n\n protected renderFilterActions() {\n return html`\n <igc-button\n id=\"reset\"\n variant=\"flat\"\n @click=${this.#handleResetClick}\n >\n ${prefixedIcon('refresh')} Reset\n </igc-button>\n <igc-button\n id=\"close\"\n variant=\"flat\"\n @click=${() => {\n this.active = false;\n }}\n >\n ${prefixedIcon('close')} Close\n </igc-button>\n `;\n }\n\n protected renderDropdown() {\n return html`<igc-dropdown\n flip\n same-width\n @igcChange=${this.#handleConditionChanged}\n >\n ${Object.entries(getFilterOperandsFor(this.column)).map(\n ([key, operand]) => html`\n <igc-dropdown-item\n .value=${key}\n ?selected=${this.condition.name === key}\n >\n ${prefixedIcon(key)}${operand?.label ?? key}\n </igc-dropdown-item>\n `\n )}\n </igc-dropdown>`;\n }\n\n protected renderDropdownTarget() {\n return html`<igc-icon\n id=\"condition\"\n slot=\"prefix\"\n collection=\"internal\"\n .name=${this.condition.name}\n @click=${this.#openDropdownList}\n >\n </igc-icon>`;\n }\n\n protected renderInputArea() {\n return html`<igc-input\n outlined\n value=${ifDefined(this.expression.searchTerm)}\n placeholder=\"Add filter value\"\n ?readonly=${this.condition.unary}\n @igcInput=${this.#handleInput}\n @keydown=${this.#handleKeydown}\n >\n ${this.renderDropdownTarget()}\n </igc-input>\n ${this.renderDropdown()}`;\n }\n\n protected renderActiveState() {\n return html`<div part=\"active-state\">\n <div part=\"filter-row-input\">${this.renderInputArea()}</div>\n <div part=\"filter-row-filters\">${this.renderActiveChips()}</div>\n <div part=\"filter-row-actions\">${this.renderFilterActions()}</div>\n </div> `;\n }\n\n protected renderInactiveChips(column: ColumnConfiguration<T>, state: FilterExpressionTree<T>) {\n return Array.from(state).map((expression, idx) => {\n const props: ExpressionChipProps<T> = {\n expression,\n selected: false,\n onRemove: this.#chipRemoveFor(expression),\n onSelect: async (e: Event) => {\n e.stopPropagation();\n this.column = column;\n this.expression = expression;\n this.#show();\n },\n };\n\n return html`${this.renderCriteriaButton(expression, idx)}${this.renderExpressionChip(props)}`;\n });\n }\n\n protected renderFilterState(column: ColumnConfiguration<T>) {\n const state = this.filterController.get(column.key);\n\n const partial = state && state.length < 3;\n const hidden = state && state.length >= 3;\n\n const open = () => {\n this.column = column;\n this.#setDefaultExpression();\n this.#show();\n };\n\n const count = hidden ? html`<span slot=\"suffix\">${state.length}</span>` : nothing;\n const chip = html`<igc-chip\n data-column=${column.key}\n @click=${open}\n >${prefixedIcon('filter')}Filter${count}</igc-chip\n >`;\n\n return partial ? this.renderInactiveChips(column, state) : chip;\n }\n\n protected renderInactiveState() {\n return this.state.host.columns.map((column) =>\n column.hidden\n ? nothing\n : html`<div part=\"filter-row-preview\">\n ${column.filter ? this.renderFilterState(column) : nothing}\n </div>`\n );\n }\n\n protected override render() {\n return html`${this.active ? this.renderActiveState() : this.renderInactiveState()}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [ApexFilterRow.tagName]: ApexFilterRow<object>;\n }\n}\n"]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
+
import { ContextProvider } from '@lit/context';
|
|
1
2
|
import { nothing } from 'lit';
|
|
2
|
-
import { ContextProvider } from '@lit-labs/context';
|
|
3
|
-
import { StateController } from '../controllers/state.js';
|
|
4
3
|
import { DataOperationsController } from '../controllers/data-operation.js';
|
|
5
4
|
import { GridDOMController } from '../controllers/dom.js';
|
|
5
|
+
import { StateController } from '../controllers/state.js';
|
|
6
6
|
import { EventEmitterBase } from '../internal/mixins/event-emitter.js';
|
|
7
7
|
import type { ColumnConfiguration, DataPipelineConfiguration, GridSortConfiguration, Keys } from '../internal/types.js';
|
|
8
8
|
import type { FilterExpression } from '../operations/filter/types.js';
|
|
9
9
|
import type { SortExpression } from '../operations/sort/types.js';
|
|
10
|
-
import
|
|
10
|
+
import ApexFilterRow from './filter-row.js';
|
|
11
11
|
import ApexGridHeaderRow from './header-row.js';
|
|
12
12
|
import ApexGridRow from './row.js';
|
|
13
|
-
import
|
|
13
|
+
import ApexVirtualizer from './virtualizer.js';
|
|
14
14
|
/**
|
|
15
15
|
* Event object for the filtering event of the grid.
|
|
16
16
|
*/
|
|
@@ -102,7 +102,7 @@ export interface ApexGridEventMap<T extends object> {
|
|
|
102
102
|
*
|
|
103
103
|
*/
|
|
104
104
|
export declare class ApexGrid<T extends object> extends EventEmitterBase<ApexGridEventMap<T>> {
|
|
105
|
-
static get
|
|
105
|
+
static get tagName(): "apex-grid";
|
|
106
106
|
static styles: import("lit").CSSResult;
|
|
107
107
|
static register(): void;
|
|
108
108
|
protected stateController: StateController<T>;
|
|
@@ -110,7 +110,7 @@ export declare class ApexGrid<T extends object> extends EventEmitterBase<ApexGri
|
|
|
110
110
|
protected dataController: DataOperationsController<T>;
|
|
111
111
|
protected stateProvider: ContextProvider<{
|
|
112
112
|
__context__: StateController<any>;
|
|
113
|
-
}>;
|
|
113
|
+
}, this>;
|
|
114
114
|
protected scrollContainer: ApexVirtualizer;
|
|
115
115
|
protected headerRow: ApexGridHeaderRow<T>;
|
|
116
116
|
protected filterRow: ApexFilterRow<T>;
|
|
@@ -187,6 +187,7 @@ export declare class ApexGrid<T extends object> extends EventEmitterBase<ApexGri
|
|
|
187
187
|
protected watchColumns(_: ColumnConfiguration<T>[], newConfig?: ColumnConfiguration<T>[]): void;
|
|
188
188
|
protected dataChanged(): void;
|
|
189
189
|
protected pipeline(): Promise<void>;
|
|
190
|
+
constructor();
|
|
190
191
|
/**
|
|
191
192
|
* Performs a filter operation in the grid based on the passed expression(s).
|
|
192
193
|
*/
|
|
@@ -220,7 +221,6 @@ export declare class ApexGrid<T extends object> extends EventEmitterBase<ApexGri
|
|
|
220
221
|
}
|
|
221
222
|
declare global {
|
|
222
223
|
interface HTMLElementTagNameMap {
|
|
223
|
-
[ApexGrid.
|
|
224
|
+
[ApexGrid.tagName]: ApexGrid<object>;
|
|
224
225
|
}
|
|
225
226
|
}
|
|
226
|
-
//# sourceMappingURL=grid.d.ts.map
|