apex-grid 3.5.0 → 3.6.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/CHANGELOG.md +338 -0
- package/LICENSE.md +125 -0
- package/README.md +64 -10
- package/components/cell.d.ts +30 -4
- package/components/cell.js +199 -53
- package/components/cell.js.map +1 -1
- package/components/filter-row.d.ts +2 -0
- package/components/filter-row.js +82 -28
- package/components/filter-row.js.map +1 -1
- package/components/grid.d.ts +146 -36
- package/components/grid.js +442 -103
- package/components/grid.js.map +1 -1
- package/components/group-header-row.js +28 -25
- package/components/group-header-row.js.map +1 -1
- package/components/header-row.d.ts +7 -5
- package/components/header-row.js +11 -9
- package/components/header-row.js.map +1 -1
- package/components/header.js +32 -20
- package/components/header.js.map +1 -1
- package/components/row.d.ts +19 -3
- package/components/row.js +69 -23
- package/components/row.js.map +1 -1
- package/components/toolbar.js +2 -1
- package/components/toolbar.js.map +1 -1
- package/components/virtualizer.d.ts +40 -0
- package/components/virtualizer.js +116 -5
- package/components/virtualizer.js.map +1 -1
- package/controllers/dom.d.ts +4 -4
- package/controllers/dom.js +40 -22
- package/controllers/dom.js.map +1 -1
- package/controllers/editing.d.ts +104 -37
- package/controllers/editing.js +230 -78
- package/controllers/editing.js.map +1 -1
- package/controllers/expansion.d.ts +14 -5
- package/controllers/expansion.js +24 -1
- package/controllers/expansion.js.map +1 -1
- package/controllers/filter.d.ts +10 -2
- package/controllers/filter.js +62 -17
- package/controllers/filter.js.map +1 -1
- package/controllers/history.d.ts +45 -8
- package/controllers/history.js +58 -20
- package/controllers/history.js.map +1 -1
- package/controllers/navigation.d.ts +67 -13
- package/controllers/navigation.js +191 -51
- package/controllers/navigation.js.map +1 -1
- package/controllers/pagination.d.ts +6 -0
- package/controllers/pagination.js +10 -2
- package/controllers/pagination.js.map +1 -1
- package/controllers/reorder.js +38 -22
- package/controllers/reorder.js.map +1 -1
- package/controllers/resize.d.ts +17 -2
- package/controllers/resize.js +16 -6
- package/controllers/resize.js.map +1 -1
- package/controllers/row-pin.d.ts +20 -2
- package/controllers/row-pin.js +16 -9
- package/controllers/row-pin.js.map +1 -1
- package/controllers/row-reorder.d.ts +31 -11
- package/controllers/row-reorder.js +117 -37
- package/controllers/row-reorder.js.map +1 -1
- package/controllers/selection.d.ts +11 -4
- package/controllers/selection.js +26 -11
- package/controllers/selection.js.map +1 -1
- package/controllers/sort.d.ts +22 -2
- package/controllers/sort.js +29 -23
- package/controllers/sort.js.map +1 -1
- package/controllers/state.d.ts +56 -7
- package/controllers/state.js +76 -6
- package/controllers/state.js.map +1 -1
- package/controllers/tree.d.ts +15 -10
- package/controllers/tree.js +0 -0
- package/controllers/tree.js.map +1 -1
- package/custom-elements.json +3156 -277
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/highlight.css +15 -8
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/ApexGrid.html +155 -81
- package/docs/classes/ApexGridPaginator.html +1 -1
- package/docs/classes/ApexGridToolbar.html +3 -3
- package/docs/functions/localize.html +2 -2
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +74 -11
- package/docs/interfaces/ApexCellValidationFailedEvent.html +3 -2
- package/docs/interfaces/ApexCellValueChangedEvent.html +4 -2
- package/docs/interfaces/ApexCellValueChangingEvent.html +3 -2
- package/docs/interfaces/ApexGridEventMap.html +5 -2
- package/docs/interfaces/ApexRowEditEndedEvent.html +2 -1
- package/docs/interfaces/ApexRowEditStartedEvent.html +2 -1
- package/docs/interfaces/ApexRowMovingEvent.html +9 -3
- package/docs/interfaces/ApexRowPinningEvent.html +1 -1
- package/docs/interfaces/ApexTreeRowExpandedEvent.html +4 -1
- package/docs/interfaces/ApexTreeRowExpandingEvent.html +4 -1
- package/docs/interfaces/BaseApexCellContext.html +1 -1
- package/docs/interfaces/BaseApexEditorContext.html +1 -1
- package/docs/interfaces/BaseFilterExpression.html +2 -2
- package/docs/interfaces/CSVExportOptions.html +12 -4
- package/docs/interfaces/DataPipelineConfiguration.html +1 -1
- package/docs/interfaces/ExportOptions.html +5 -3
- package/docs/interfaces/GridExpansionConfiguration.html +6 -2
- package/docs/interfaces/GridRowReorderingConfiguration.html +1 -1
- package/docs/interfaces/PaginationState.html +1 -1
- package/docs/interfaces/SetStateResult.html +3 -2
- package/docs/interfaces/ValidatorContext.html +7 -2
- package/docs/media/_token-values.scss +118 -0
- package/docs/media/package.json +3 -2
- package/docs/modules.html +1 -1
- package/docs/types/ExportSource.html +6 -4
- package/docs/types/OperandKeys.html +9 -0
- package/docs/variables/EN_LOCALE.html +2 -2
- package/i18n/en.d.ts +5 -0
- package/i18n/en.js +5 -0
- package/i18n/en.js.map +1 -1
- package/i18n/es.js +5 -0
- package/i18n/es.js.map +1 -1
- package/internal/column-types.d.ts +27 -1
- package/internal/column-types.js +75 -49
- package/internal/column-types.js.map +1 -1
- package/internal/constants.d.ts +1 -2
- package/internal/constants.js +0 -4
- package/internal/constants.js.map +1 -1
- package/internal/document-styles.d.ts +30 -0
- package/internal/document-styles.js +48 -0
- package/internal/document-styles.js.map +1 -0
- package/internal/export.d.ts +39 -7
- package/internal/export.js +35 -34
- package/internal/export.js.map +1 -1
- package/internal/feature-module.d.ts +60 -3
- package/internal/feature-module.js +6 -0
- package/internal/feature-module.js.map +1 -1
- package/internal/index.d.ts +6 -4
- package/internal/index.js +5 -3
- package/internal/index.js.map +1 -1
- package/internal/normalize-case.d.ts +8 -1
- package/internal/normalize-case.js +3 -2
- package/internal/normalize-case.js.map +1 -1
- package/internal/state-snapshot.d.ts +60 -8
- package/internal/state-snapshot.js +87 -19
- package/internal/state-snapshot.js.map +1 -1
- package/internal/types.d.ts +17 -2
- package/internal/types.js.map +1 -1
- package/internal/utils.d.ts +34 -6
- package/internal/utils.js +30 -21
- package/internal/utils.js.map +1 -1
- package/internal/validators.js +1 -0
- package/internal/validators.js.map +1 -1
- package/operations/filter/operands/number.js +9 -6
- package/operations/filter/operands/number.js.map +1 -1
- package/operations/filter/operands/string.js +2 -3
- package/operations/filter/operands/string.js.map +1 -1
- package/operations/filter/types.d.ts +13 -1
- package/operations/filter/types.js.map +1 -1
- package/operations/filter.d.ts +6 -0
- package/operations/filter.js +23 -7
- package/operations/filter.js.map +1 -1
- package/operations/quick-filter.js +2 -5
- package/operations/quick-filter.js.map +1 -1
- package/operations/sort.d.ts +21 -2
- package/operations/sort.js +41 -14
- package/operations/sort.js.map +1 -1
- package/package.json +8 -3
- package/setup.d.ts +11 -0
- package/setup.js +9 -19
- package/setup.js.map +1 -1
- package/styles/_token-values.css.d.ts +1 -0
- package/styles/_token-values.css.js +3 -0
- package/styles/_token-values.css.js.map +1 -0
- package/styles/_tokens.css.js +1 -1
- package/styles/_tokens.css.js.map +1 -1
- package/styles/body-cell/body-cell.css.js +1 -1
- package/styles/body-cell/body-cell.css.js.map +1 -1
- package/styles/body-cell/cell-renderers.css.js +1 -1
- package/styles/body-cell/cell-renderers.css.js.map +1 -1
- package/styles/body-row/body-row.css.js +1 -1
- package/styles/body-row/body-row.css.js.map +1 -1
- package/styles/document-tokens.css.d.ts +1 -0
- package/styles/document-tokens.css.js +3 -0
- package/styles/document-tokens.css.js.map +1 -0
- package/styles/filter-row/filter-row.css.js +1 -1
- package/styles/filter-row/filter-row.css.js.map +1 -1
- package/styles/grid/_grid.base.css.js +1 -1
- package/styles/grid/_grid.base.css.js.map +1 -1
- package/styles/grid/grid.css.js +1 -1
- package/styles/grid/grid.css.js.map +1 -1
- package/styles/group-header-row/group-header-row.css.js +1 -1
- package/styles/group-header-row/group-header-row.css.js.map +1 -1
- package/styles/header-cell/header-cell.css.js +1 -1
- package/styles/header-cell/header-cell.css.js.map +1 -1
- package/styles/header-row/header-row.base.css.js +1 -1
- package/styles/header-row/header-row.base.css.js.map +1 -1
- package/styles/paginator/paginator.css.js +1 -1
- package/styles/paginator/paginator.css.js.map +1 -1
- package/styles/toolbar/toolbar.css.js +1 -1
- package/styles/toolbar/toolbar.css.js.map +1 -1
- package/tokens.css +78 -0
- package/LICENSE +0 -80
- package/docs/media/LICENSE +0 -80
- package/docs/media/_tokens.scss +0 -214
package/components/cell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell.js","sourceRoot":"","sources":["../../src/components/cell.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAwB,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOpD,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAU9D,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,OAAQ,KAA4B,CAAC,IAAI,KAAK,QAAQ;QACrD,KAA0B,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CACjD,CAAC;AACJ,CAAC;AAQD,MAAqB,YAA+B,SAAQ,UAAU;IAAtE;;QA4BS,WAAM,GAAG,KAAK,CAAC;QAOf,YAAO,GAAG,KAAK,CAAC;QAsDhB,aAAQ,GAAG,CAAC,CAAC;QASb,sBAAiB,GAAG,CAAC,CAAC;QAStB,sBAAiB,GAAG,CAAC,CAAC;QAG7B,mBAAc,GAAa,EAAE,CAAC;QAM9B,YAAO,GAA6B,IAAI,CAAC;QAkJzC,iBAAY,GAAG,CAAC,KAAiB,EAAE,EAAE;YACnC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;gBAEnB,KAAK,CAA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B;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;AAOf;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CACpB;AAIhB;IAFN,OAAO,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACvD,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CACG;AAQxB;IADT,KAAK,CAAC,2BAA2B,CAAC;mDACU;AA0CtC;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CACzB;AASb;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAChB;AAStB;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAChB","sourcesContent":["import { consume } from '@lit/context';\nimport { html, LitElement, type PropertyValues } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { gridStateContext, type StateController } from '../controllers/state.js';\nimport { getColumnTypeRenderer } from '../internal/column-types.js';\nimport { registerComponent } from '../internal/register.js';\nimport { GRID_CELL_TAG } from '../internal/tags.js';\nimport type {\n ApexCellContext,\n ApexEditorContext,\n ColumnConfiguration,\n PropertyType,\n} from '../internal/types.js';\nimport { styles } from '../styles/body-cell/body-cell.css.js';\nimport type ApexGridRow from './row.js';\n\n/**\n * A spreadsheet-style error value (e.g. the enterprise formula engine's\n * `#VALUE!` / `#DIV/0!`). Duck-typed so core carries no dependency on the\n * enterprise layer: any value that is an object carrying a `#...` string `code`\n * is rendered as that code, even in a typed (currency / number) column whose\n * numeric renderer would otherwise coerce it to `NaN` and show nothing.\n */\nfunction isErrorLike(value: unknown): value is { code: string } {\n return (\n typeof value === 'object' &&\n value !== null &&\n typeof (value as { code?: unknown }).code === 'string' &&\n (value as { code: string }).code.startsWith('#')\n );\n}\n\n/**\n * Component representing a DOM cell of the Apex grid.\n *\n * @csspart cell - The cell host element.\n * @csspart editor - The editor wrapper rendered while the cell is in edit mode.\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 * Whether the cell is currently in edit mode. Set by the parent row from the\n * editing controller's state so cells re-render on edit state changes.\n */\n @property({ type: Boolean, reflect: true })\n public editing = false;\n\n @consume({ context: gridStateContext, subscribe: true })\n @property({ attribute: false })\n public state!: StateController<T>;\n\n /**\n * The parent row component holding this cell.\n */\n public row!: ApexGridRow<T>;\n\n @query('input, [data-apex-editor]')\n protected editorElement!: HTMLElement | null;\n\n protected get context(): ApexCellContext<T> {\n const ctx = {\n parent: this,\n row: this.row,\n column: this.column,\n value: this.value,\n } as unknown as {\n parent: ApexGridCell<T>;\n row: ApexGridRow<T>;\n column: ColumnConfiguration<T>;\n value: PropertyType<T>;\n commit?: (value: unknown) => Promise<boolean>;\n };\n // Only expose `commit` when the column is editable — non-editable\n // interactive widgets should render as read-only.\n if (this.isEditable) {\n ctx.commit = (next: unknown) =>\n this.editingController.commitImmediate(this.row.index, this.column.key, next);\n }\n return ctx as unknown as ApexCellContext<T>;\n }\n\n protected get editingController() {\n return this.state.editing;\n }\n\n protected get isEditing(): boolean {\n return this.editing;\n }\n\n protected get isEditable(): boolean {\n if (!this.editingController) return false;\n return this.editingController.isEditable(this.column);\n }\n\n /**\n * 1-based column index used to populate `aria-colindex`. Accounts for the\n * auto-rendered selection + expansion columns ahead of the data columns.\n */\n @property({ attribute: false, type: Number })\n public colindex = 0;\n\n /**\n * Reactive token forwarded from {@link StateController.decorationVersion}.\n * Changing it re-runs {@link willUpdate} so module-driven cell decoration is\n * re-evaluated when it changes (e.g. while dragging a selection range). Stays\n * `0` for the community grid, so cells are never re-decorated there.\n */\n @property({ attribute: false, type: Number })\n public decorationVersion = 0;\n\n /**\n * Reactive token forwarded from {@link EditingController.validationVersion}.\n * Changing it re-runs {@link willUpdate} so the cell re-reads its validation\n * errors and toggles `aria-invalid` / the inline error node. Stays `0` until\n * the first validation failure.\n */\n @property({ attribute: false, type: Number })\n public validationVersion = 0;\n\n /** Decoration attribute keys applied on the previous update, for cleanup. */\n #decoratedKeys: string[] = [];\n\n /** DOM id of the inline error node, referenced by `aria-errormessage`. */\n static readonly #ERROR_ID = 'apex-cell-error';\n\n /** Validation errors resolved in {@link willUpdate}, consumed in render. */\n #errors: readonly string[] | null = null;\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.setAttribute('role', 'gridcell');\n this.addEventListener('click', this.#handleClick);\n this.addEventListener('dblclick', this.#handleDoubleClick);\n this.addEventListener('keydown', this.#handleCellKeydown);\n this.addEventListener('focusout', this.#handleCellFocusOut);\n }\n\n public override disconnectedCallback(): void {\n this.removeEventListener('click', this.#handleClick);\n this.removeEventListener('dblclick', this.#handleDoubleClick);\n this.removeEventListener('keydown', this.#handleCellKeydown);\n this.removeEventListener('focusout', this.#handleCellFocusOut);\n super.disconnectedCallback();\n }\n\n protected override willUpdate() {\n if (this.colindex > 0) {\n this.setAttribute('aria-colindex', String(this.colindex));\n } else {\n this.removeAttribute('aria-colindex');\n }\n // Roving tabindex: the active cell is the grid body's single tab stop, so\n // real focus (not just `aria-current`) tracks keyboard navigation and\n // screen readers follow arrow-key movement cell to cell.\n this.tabIndex = this.active ? 0 : -1;\n if (this.active) {\n this.setAttribute('aria-current', 'true');\n } else {\n this.removeAttribute('aria-current');\n }\n // Reflect tree-expanded state on the group cell so the SCSS chevron\n // rotation triggers from this attribute (cheaper than per-render style\n // mutations and keeps the SVG transform purely declarative).\n const tree = this.state?.tree;\n const isGroup = tree?.enabled && this.row?.data && tree.isGroupColumn(this.column.key);\n if (isGroup && tree.isExpanded(this.row.data)) {\n this.setAttribute('data-tree-expanded', '');\n } else {\n this.removeAttribute('data-tree-expanded');\n }\n\n this.#applyValidation();\n this.#applyDecoration();\n }\n\n /**\n * Reflects the cell's validation state from the editing controller: stores the\n * current error messages for {@link render} and toggles `aria-invalid` +\n * `aria-errormessage` + `data-invalid` on the host. Inert for cells whose\n * column has no validators (the lookup returns `null`).\n */\n #applyValidation(): void {\n const errors =\n this.state && this.row?.data\n ? (this.editingController?.getCellErrors(this.row.data, this.column.key) ?? null)\n : null;\n this.#errors = errors && errors.length > 0 ? errors : null;\n\n if (this.#errors) {\n this.setAttribute('aria-invalid', 'true');\n this.setAttribute('aria-errormessage', ApexGridCell.#ERROR_ID);\n this.setAttribute('data-invalid', '');\n this.setAttribute('title', this.#errors.join('; '));\n } else {\n this.removeAttribute('aria-invalid');\n this.removeAttribute('aria-errormessage');\n this.removeAttribute('data-invalid');\n this.removeAttribute('title');\n }\n }\n\n /**\n * The inline error node surfaced when the cell is invalid. `role=\"alert\"`\n * announces the message when it appears, covering the cross-shadow gap where\n * an `aria-errormessage` IDREF on the host can't reach this node.\n */\n protected renderError() {\n if (!this.#errors) return null;\n return html`<span\n part=\"cell-error\"\n id=${ApexGridCell.#ERROR_ID}\n role=\"alert\"\n >${this.#errors.join('; ')}</span\n >`;\n }\n\n /**\n * Reflects module-contributed decoration attributes (see {@link CellDecorator})\n * onto the cell host, reconciling against the previous update so attributes\n * that are no longer present are removed. Inert for the community grid:\n * `state.decorateCell` returns `null` with no modules, so nothing is set.\n */\n #applyDecoration(): void {\n const decoration =\n this.state && this.row\n ? this.state.decorateCell({\n row: this.row.data,\n rowIndex: this.row.index,\n column: this.column,\n value: this.value as unknown,\n })\n : null;\n const next = decoration?.attributes ?? {};\n\n // Remove anything we set last time that's gone (or explicitly cleared).\n for (const key of this.#decoratedKeys) {\n if (next[key] == null) this.removeAttribute(key);\n }\n\n const applied: string[] = [];\n for (const [key, value] of Object.entries(next)) {\n if (value == null) {\n this.removeAttribute(key);\n } else {\n this.setAttribute(key, value);\n applied.push(key);\n }\n }\n this.#decoratedKeys = applied;\n }\n\n protected override updated(changed: PropertyValues<this>) {\n if (this.isEditing) {\n const editor = this.editorElement;\n editor?.focus();\n if (editor instanceof HTMLInputElement) {\n if (editor.type === 'text' || editor.type === 'number') {\n editor.select();\n }\n }\n return;\n }\n // A keyboard-committed (or cancelled) edit removes the focused editor from\n // the DOM; hand focus back to the cell host so grid navigation continues\n // from where the user was. Pointer-driven exits (blur / outside click)\n // never set the flag, so they don't steal focus from the click target.\n if (changed.get('editing') === true && this.#refocusAfterEdit) {\n this.#refocusAfterEdit = false;\n this.focus();\n }\n }\n\n #handleClick = (event: MouseEvent) => {\n if (this.isEditing) {\n // Don't let clicks inside the editor bubble into navigation / outside-click commits.\n event.stopPropagation();\n return;\n }\n if (!this.isEditable) return;\n // Boolean cells handle interaction in their display widget — clicking the\n // checkbox commits inline via `ctx.commit`. We never enter edit mode for\n // booleans, which avoids the visual reflow between display/editor markup\n // and lets a single click toggle the value.\n if (this.column.type === 'boolean') return;\n if (this.editingController.trigger !== 'click') return;\n this.#startEdit();\n };\n\n #handleDoubleClick = (event: MouseEvent) => {\n if (this.isEditing) {\n event.stopPropagation();\n return;\n }\n if (!this.isEditable) return;\n if (this.column.type === 'boolean') return;\n if (this.editingController.trigger !== 'doubleClick') return;\n this.#startEdit();\n };\n\n #startEdit() {\n if (!this.row) return;\n this.editingController.editCell(this.row.index, this.column.key);\n }\n\n #pendingValue: unknown;\n\n /** Set by keyboard-driven commit/cancel so `updated` refocuses the cell host. */\n #refocusAfterEdit = false;\n\n #commitWith = async (value?: unknown): Promise<boolean> => {\n return this.editingController.commitCell(value ?? this.#pendingValue);\n };\n\n #cancel = () => {\n this.editingController.cancelCell();\n };\n\n #handleKeydown = (event: KeyboardEvent) => {\n event.stopPropagation();\n switch (event.key) {\n case 'Enter':\n event.preventDefault();\n this.#refocusAfterEdit = true;\n this.#commitWith();\n return;\n case 'Escape':\n event.preventDefault();\n this.#refocusAfterEdit = true;\n this.#cancel();\n return;\n case 'Tab':\n // Commit first; navigation moves to the next/prev cell. Editing of the\n // landed cell stays manual (Enter to re-edit) for predictability.\n event.preventDefault();\n this.#refocusAfterEdit = true;\n this.#commitWith();\n return;\n default:\n return;\n }\n };\n\n #handleBlur = () => {\n if (!this.isEditing) return;\n if (this.editingController.mode === 'cell') {\n this.#commitWith();\n } else {\n // Row mode — stash the value and exit the cell editor; the row stays open.\n this.editingController.commitCell(this.#pendingValue);\n }\n };\n\n /**\n * Cell-level keydown that catches keys bubbling out of registry-built\n * editors (the default editor stops propagation on its own input).\n *\n * - Escape always cancels the edit.\n * - Tab commits (or closes when there's no draft — `commitCell()` with\n * `undefined` value is treated as \"no change\" by the controller).\n *\n * Per-editor `keydown` handlers that need to consume Enter (e.g. the\n * built-in `<select>` editor) still get the first crack — they call\n * `event.stopPropagation()` and we never see those keys here.\n */\n #handleCellKeydown = (event: KeyboardEvent) => {\n if (!this.isEditing) return;\n if (event.key === 'Escape') {\n event.preventDefault();\n this.#refocusAfterEdit = true;\n this.#cancel();\n return;\n }\n if (event.key === 'Tab') {\n event.preventDefault();\n this.#refocusAfterEdit = true;\n this.#commitWith();\n }\n };\n\n /**\n * Cell-level focus-out: commits the active edit when focus truly leaves\n * the cell (clicking another cell, tabbing past the editor, blurring to\n * the document body). The default editor's input also has `@blur` which\n * commits first; by that time `isEditing` is false and this is a no-op.\n *\n * For built-in registry editors `commitCell()` with no explicit value\n * resolves to the current data value — same shape as \"no change\", so\n * losing focus without picking discards the open editor without writing\n * spurious data.\n */\n #handleCellFocusOut = (event: FocusEvent) => {\n if (!this.isEditing) return;\n const next = event.relatedTarget as Node | null;\n if (next && (this.contains(next) || this.shadowRoot?.contains(next))) return;\n if (this.editingController.mode === 'cell') {\n this.#commitWith();\n } else {\n this.editingController.commitCell(this.#pendingValue);\n }\n };\n\n #handleTextInput = (event: Event) => {\n const target = event.target as HTMLInputElement;\n if (this.column.type === 'number') {\n // An empty (or non-parseable) number field clears the value to null rather\n // than committing NaN, which would render as the text \"NaN\".\n const numeric = target.valueAsNumber;\n this.#pendingValue = target.value === '' || Number.isNaN(numeric) ? null : numeric;\n return;\n }\n this.#pendingValue = target.value;\n };\n\n #handleCheckboxChange = (event: Event) => {\n const target = event.target as HTMLInputElement;\n this.#pendingValue = target.checked;\n // Booleans commit immediately — toggling is the whole interaction.\n this.#commitWith(target.checked);\n };\n\n protected renderDefaultEditor() {\n const value = this.value as unknown;\n if (this.column.type === 'boolean') {\n this.#pendingValue = Boolean(value);\n return html`<input\n type=\"checkbox\"\n part=\"editor\"\n data-apex-editor\n ?checked=${Boolean(value)}\n @change=${this.#handleCheckboxChange}\n @keydown=${this.#handleKeydown}\n @blur=${this.#handleBlur}\n />`;\n }\n if (this.column.type === 'number') {\n this.#pendingValue = value;\n return html`<input\n type=\"number\"\n part=\"editor\"\n data-apex-editor\n .value=${value == null ? '' : String(value)}\n @input=${this.#handleTextInput}\n @keydown=${this.#handleKeydown}\n @blur=${this.#handleBlur}\n />`;\n }\n this.#pendingValue = value;\n return html`<input\n type=\"text\"\n part=\"editor\"\n data-apex-editor\n .value=${value == null ? '' : String(value)}\n @input=${this.#handleTextInput}\n @keydown=${this.#handleKeydown}\n @blur=${this.#handleBlur}\n />`;\n }\n\n protected renderEditor() {\n const template = this.column.editorTemplate;\n const ctx = {\n parent: this,\n row: this.row,\n column: this.column,\n value: this.value,\n commit: (next: unknown) => this.editingController.commitCell(next),\n cancel: () => this.editingController.cancelCell(),\n };\n if (template) {\n // For custom editors we don't know the draft shape; reset pending so\n // cell-level commit doesn't write a stale value from a previous edit.\n this.#pendingValue = this.value;\n return template(ctx as unknown as ApexEditorContext<T> as never);\n }\n const typeRenderer = getColumnTypeRenderer<T>(this.column.type);\n if (typeRenderer?.editor) {\n this.#pendingValue = this.value;\n return typeRenderer.editor(ctx as never);\n }\n return this.renderDefaultEditor();\n }\n\n /**\n * Renders the tree affordance — depth-based indent + a chevron toggle (or\n * leaf spacer) — that prefixes the group cell when {@link ApexGrid.tree}\n * is enabled. Returns `nothing` for every other cell.\n */\n protected renderTreeAffordance() {\n const tree = this.state?.tree;\n if (!tree?.enabled) return null;\n if (!this.row?.data) return null;\n if (!tree.isGroupColumn(this.column.key)) return null;\n\n const data = this.row.data;\n const meta = tree.getMeta(data);\n if (!meta) return null;\n\n const indent = meta.depth * tree.childIndent;\n const expanded = tree.isExpanded(data);\n const handleClick = (event: MouseEvent) => {\n event.stopPropagation();\n if (!meta.hasChildren) return;\n void tree.toggleRow(data);\n };\n\n const chevron = meta.hasChildren\n ? html`<button\n type=\"button\"\n part=\"tree-toggle\"\n aria-label=${\n expanded ? this.state.localize('row.collapse') : this.state.localize('row.expand')\n }\n aria-expanded=${expanded ? 'true' : 'false'}\n @click=${handleClick}\n >\n <svg\n part=\"tree-chevron\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n width=\"14\"\n height=\"14\"\n >\n <path\n d=\"M9 6l6 6-6 6\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </button>`\n : html`<span part=\"tree-spacer\" aria-hidden=\"true\"></span>`;\n\n return html`<span\n part=\"tree-indent\"\n aria-hidden=\"true\"\n style=${`inline-size: ${indent}px`}\n ></span>${chevron}`;\n }\n\n /**\n * Resolves the value to display for the cell. Synthesized tree parents\n * (those that appear only as a path segment with no backing data) render\n * their last path segment in the group column and nothing elsewhere.\n */\n protected resolveDisplayValue(): unknown {\n const tree = this.state?.tree;\n if (tree?.enabled && this.row?.data && tree.isSynthesized(this.row.data)) {\n return tree.isGroupColumn(this.column.key) ? tree.getLabel(this.row.data) : '';\n }\n return this.value;\n }\n\n protected renderCellBody() {\n if (this.column.cellTemplate) {\n return this.column.cellTemplate(this.context as ApexCellContext<T> as never);\n }\n // A formula error is a first-class cell value: render its code as text so it\n // stays visible in typed columns (a currency/number renderer would coerce it\n // to NaN and show an empty cell).\n const value = this.resolveDisplayValue();\n if (isErrorLike(value)) {\n return html`${value.code}`;\n }\n const typeRenderer = getColumnTypeRenderer<T>(this.column.type);\n if (typeRenderer?.display) {\n // Synthesized parents have no real backing data — route them through\n // a plain text render instead of the typed renderer.\n const tree = this.state?.tree;\n if (tree?.enabled && this.row?.data && tree.isSynthesized(this.row.data)) {\n return html`${this.resolveDisplayValue()}`;\n }\n return typeRenderer.display(this.context as never);\n }\n return html`${this.resolveDisplayValue()}`;\n }\n\n protected override render() {\n const error = this.renderError();\n if (this.isEditing) {\n return html`${this.renderEditor()}${error}`;\n }\n const affordance = this.renderTreeAffordance();\n if (affordance) {\n return html`${affordance}<span part=\"tree-cell-content\"\n >${this.renderCellBody()}</span\n >${error}`;\n }\n return html`${this.renderCellBody()}${error}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [ApexGridCell.tagName]: ApexGridCell<object>;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"cell.js","sourceRoot":"","sources":["../../src/components/cell.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAwB,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAA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ASd;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAChB;AAUtB;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iDACR;AAShB;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAChB","sourcesContent":["import { consume } from '@lit/context';\nimport { html, LitElement, type PropertyValues } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { gridStateContext, type StateController } from '../controllers/state.js';\nimport { getColumnTypeRenderer } from '../internal/column-types.js';\nimport { registerComponent } from '../internal/register.js';\nimport { GRID_CELL_TAG, GRID_ROW_TAG } from '../internal/tags.js';\nimport type {\n ActiveNode,\n ApexCellContext,\n ApexEditorContext,\n ColumnConfiguration,\n PropertyType,\n} from '../internal/types.js';\nimport { styles } from '../styles/body-cell/body-cell.css.js';\nimport type ApexGridRow from './row.js';\n\n/**\n * A spreadsheet-style error value (e.g. the enterprise formula engine's\n * `#VALUE!` / `#DIV/0!`). Duck-typed so core carries no dependency on the\n * enterprise layer: any value that is an object carrying a `#...` string `code`\n * is rendered as that code, even in a typed (currency / number) column whose\n * numeric renderer would otherwise coerce it to `NaN` and show nothing.\n */\nfunction isErrorLike(value: unknown): value is { code: string } {\n return (\n typeof value === 'object' &&\n value !== null &&\n typeof (value as { code?: unknown }).code === 'string' &&\n (value as { code: string }).code.startsWith('#')\n );\n}\n\n/** The body rows rendered under `body` (the rows' shared parent). */\nfunction renderedRows<T extends object>(body: Element | null): ApexGridRow<T>[] {\n if (!body) return [];\n return Array.from(body.children).filter(\n (element) => element.localName === GRID_ROW_TAG\n ) as unknown as ApexGridRow<T>[];\n}\n\n/**\n * The cell Tab moves to from column `key` of view row `from`: the neighbouring\n * column (`keys`) of that row or, past the row edge, the first (or last) column\n * of the nearest row in that direction that renders cells, skipping full-width\n * rows. `null` at the edge of the grid's `count` view rows.\n */\nfunction tabTarget<T extends object>(\n count: number,\n from: number,\n keys: ColumnConfiguration<T>['key'][],\n key: ColumnConfiguration<T>['key'],\n step: 1 | -1,\n isFullWidth: (index: number) => boolean\n): ActiveNode<T> | null {\n const column = keys[keys.indexOf(key) + step];\n if (column !== undefined) return { row: from, column };\n const wrapColumn = keys[step > 0 ? 0 : keys.length - 1];\n for (let index = from + step; index >= 0 && index < count; index += step) {\n if (!isFullWidth(index)) return { row: index, column: wrapColumn };\n }\n return null;\n}\n\n/**\n * The view row nearest `start` (clamped to the `count` rows) that renders\n * cells, looking in the `step` direction first. `-1` when none does.\n */\nfunction nearestCellRow(\n count: number,\n start: number,\n step: 1 | -1,\n isFullWidth: (index: number) => boolean\n): number {\n const origin = Math.min(Math.max(start, 0), count - 1);\n for (let distance = 0; distance < count; distance++) {\n for (const index of [origin + distance * step, origin - distance * step]) {\n if (index >= 0 && index < count && !isFullWidth(index)) return index;\n }\n }\n return -1;\n}\n\n/** The rendered cell for `node` under `body`, if its row is rendered. */\nfunction findRenderedCell<T extends object>(body: Element | null, node: ActiveNode<T>) {\n return renderedRows<T>(body)\n .find((row) => row.index === node.row)\n ?.cells.find((cell) => cell.column.key === node.column);\n}\n\n/**\n * Scrolls `scroller` (the grid host, which owns the body's scrolling) so view\n * row `index`, outside the rows rendered under `body`, lands about mid-view,\n * placing it from the rendered rows' positions and average height. The\n * virtualizer then renders it on the scroll and the landed cell is aligned\n * exactly. (The virtualizer's own `element(index).scrollIntoView()` pin does\n * not work with the grid host as the scroller: it jumps to the end of the\n * range and renders no rows.)\n */\nfunction scrollRowIntoRange(scroller: HTMLElement, body: Element | null, index: number) {\n const rows = renderedRows(body).sort((a, b) => a.index - b.index);\n const first = rows.at(0);\n const last = rows.at(-1);\n if (!first || !last) return;\n const top = first.getBoundingClientRect().top;\n const height = (last.getBoundingClientRect().bottom - top) / (last.index - first.index + 1);\n const view = scroller.getBoundingClientRect();\n const rowCentre = top + (index - first.index + 0.5) * height;\n scroller.scrollTop += rowCentre - (view.top + scroller.clientHeight / 2);\n}\n\n/**\n * Component representing a DOM cell of the Apex grid.\n *\n * @csspart cell - The cell host element.\n * @csspart editor - The editor wrapper rendered while the cell is in edit mode.\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 * Whether the cell is currently in edit mode. Set by the parent row from the\n * editing controller's state so cells re-render on edit state changes.\n */\n @property({ type: Boolean, reflect: true })\n public editing = false;\n\n @consume({ context: gridStateContext, subscribe: true })\n @property({ attribute: false })\n public state!: StateController<T>;\n\n /**\n * The parent row component holding this cell.\n */\n public row!: ApexGridRow<T>;\n\n @query('input, [data-apex-editor]')\n protected editorElement!: HTMLElement | null;\n\n protected get context(): ApexCellContext<T> {\n const ctx = {\n parent: this,\n row: this.row,\n column: this.column,\n value: this.value,\n } as unknown as {\n parent: ApexGridCell<T>;\n row: ApexGridRow<T>;\n column: ColumnConfiguration<T>;\n value: PropertyType<T>;\n commit?: (value: unknown) => Promise<boolean>;\n };\n // Only expose `commit` when the column is editable — non-editable\n // interactive widgets should render as read-only.\n if (this.isEditable) {\n ctx.commit = (next: unknown) =>\n this.editingController.commitImmediate(this.row.data, this.column.key, next);\n }\n return ctx as unknown as ApexCellContext<T>;\n }\n\n protected get editingController() {\n return this.state.editing;\n }\n\n protected get isEditing(): boolean {\n return this.editing;\n }\n\n protected get isEditable(): boolean {\n if (!this.editingController) return false;\n return this.editingController.isEditable(this.column);\n }\n\n /** Whether the cell's row renders in a pinned band rather than the body. */\n get #inPinnedBand(): boolean {\n const pin = this.state.rowPin;\n return pin.hasPinnedRows && pin.enabled && pin.isPinned(this.row.data);\n }\n\n /**\n * 1-based column index used to populate `aria-colindex`. Accounts for the\n * auto-rendered selection + expansion columns ahead of the data columns.\n */\n @property({ attribute: false, type: Number })\n public colindex = 0;\n\n /**\n * The parent row's view index, set by the row. Changing it re-decorates the\n * cell (decoration such as a range selection is positional), so a row that\n * moves with the same data (sort, filter, an expand above it) never keeps a\n * stale highlight.\n *\n * @internal\n */\n @property({ attribute: false })\n public rowIndex = -1;\n\n /**\n * Reactive token forwarded from {@link StateController.decorationVersion}.\n * Changing it re-applies module-driven cell decoration (e.g. while dragging a\n * selection range) without re-rendering the cell content. Stays `0` for the\n * community grid, so cells are never re-decorated there.\n */\n @property({ attribute: false, type: Number })\n public decorationVersion = 0;\n\n /**\n * Reactive token forwarded from {@link StateController.dataVersion}, bumped\n * once per pipeline run. Re-renders only a cell that reads its row beyond\n * its own value (see {@link shouldUpdate}).\n *\n * @internal\n */\n @property({ attribute: false })\n public dataVersion = 0;\n\n /**\n * Reactive token forwarded from {@link EditingController.validationVersion}.\n * Changing it re-runs {@link willUpdate} so the cell re-reads its validation\n * errors and toggles `aria-invalid` / the inline error node. Stays `0` until\n * the first validation failure.\n */\n @property({ attribute: false, type: Number })\n public validationVersion = 0;\n\n /** Decoration attribute keys applied on the previous update, for cleanup. */\n #decoratedKeys: string[] = [];\n\n /** DOM id of the inline error node, referenced by `aria-errormessage`. */\n static readonly #ERROR_ID = 'apex-cell-error';\n\n /** Validation errors resolved in {@link willUpdate}, consumed in render. */\n #errors: readonly string[] | null = null;\n\n /** Whether {@link value} currently shows a staged row-mode value. */\n #staged = false;\n\n /**\n * The held draft the editor resumed from when it opened on an edit already\n * in progress (see {@link #editorValue}), or `null`.\n */\n #resumed: { value: unknown } | null = null;\n\n /** Set by a reconnect, whose context re-request is a bare requestUpdate(). */\n #reconnected = false;\n\n public override connectedCallback(): void {\n // A moved row reconnects its cells; the state context consumer then\n // requests an update with nothing changed, which needs no render.\n this.#reconnected = this.hasUpdated && !this.isUpdatePending;\n super.connectedCallback();\n this.setAttribute('role', 'gridcell');\n this.addEventListener('click', this.#handleClick);\n this.addEventListener('dblclick', this.#handleDoubleClick);\n this.addEventListener('keydown', this.#handleCellKeydown);\n this.addEventListener('focusout', this.#handleCellFocusOut);\n }\n\n public override disconnectedCallback(): void {\n this.removeEventListener('click', this.#handleClick);\n this.removeEventListener('dblclick', this.#handleDoubleClick);\n this.removeEventListener('keydown', this.#handleCellKeydown);\n this.removeEventListener('focusout', this.#handleCellFocusOut);\n super.disconnectedCallback();\n }\n\n /**\n * Skips the render when only positional or decoration tokens changed: the\n * decoration is host attributes, so it is reconciled here and the cell\n * template (type renderers, user templates) is not re-run. A cell that reads\n * its row beyond {@link value} (a `cellTemplate`, which may read other fields\n * or the row index, or the tree group cell, whose chevron shows the row's\n * expansion) still renders when the row index or the data token moves.\n */\n protected override shouldUpdate(changed: PropertyValues<this>): boolean {\n const reconnected = this.#reconnected;\n this.#reconnected = false;\n // A bare requestUpdate() (empty map) renders, as Lit callers expect.\n if (!this.hasUpdated || (!changed.size && !reconnected)) return true;\n const tree = this.state?.tree;\n const readsRow =\n this.column.cellTemplate || (tree?.enabled && tree.isGroupColumn(this.column.key));\n for (const key of changed.keys()) {\n const token = key === 'rowIndex' || key === 'dataVersion';\n if (key !== 'decorationVersion' && (readsRow || !token)) return true;\n }\n if (changed.has('decorationVersion') || changed.has('rowIndex')) this.#applyDecoration();\n return false;\n }\n\n protected override willUpdate(changed: PropertyValues<this>) {\n this.#applyStaged();\n if (changed.has('editing')) {\n this.#resumed = this.editing\n ? this.editingController.heldDraft(this.row.data, this.column.key)\n : null;\n }\n if (this.colindex > 0) {\n this.setAttribute('aria-colindex', String(this.colindex));\n } else {\n this.removeAttribute('aria-colindex');\n }\n // Roving tabindex: the active cell is the grid body's single tab stop, so\n // real focus (not just `aria-current`) tracks keyboard navigation and\n // screen readers follow arrow-key movement cell to cell.\n this.tabIndex = this.active ? 0 : -1;\n if (this.active) {\n this.setAttribute('aria-current', 'true');\n } else {\n this.removeAttribute('aria-current');\n }\n // Reflect tree-expanded state on the group cell so the SCSS chevron\n // rotation triggers from this attribute (cheaper than per-render style\n // mutations and keeps the SVG transform purely declarative).\n const tree = this.state?.tree;\n const isGroup = tree?.enabled && this.row?.data && tree.isGroupColumn(this.column.key);\n if (isGroup && tree.isExpanded(this.row.data)) {\n this.setAttribute('data-tree-expanded', '');\n } else {\n this.removeAttribute('data-tree-expanded');\n }\n\n this.#applyValidation();\n this.#applyDecoration();\n }\n\n /**\n * Row mode: while the row is in edit, shows the cell's staged value in\n * place of the record's (display and a re-opened editor alike), and the\n * record's again once the row commits or cancels. One property read for\n * cells of rows not in edit.\n */\n #applyStaged(): void {\n const staged = this.state?.editing?.activeRow\n ? this.editingController.stagedValues(this.row.data)\n : null;\n const key = this.column.key;\n if (staged?.has(key)) {\n this.value = staged.get(key) as PropertyType<T>;\n this.#staged = true;\n } else if (this.#staged) {\n this.#staged = false;\n this.value = this.row.data[key] as PropertyType<T>;\n }\n }\n\n /**\n * Reflects the cell's validation state from the editing controller: stores the\n * current error messages for {@link render} and toggles `aria-invalid` +\n * `aria-errormessage` + `data-invalid` on the host. Inert for cells whose\n * column has no validators (the lookup returns `null`).\n */\n #applyValidation(): void {\n const errors =\n this.state && this.row?.data\n ? (this.editingController?.getCellErrors(this.row.data, this.column.key) ?? null)\n : null;\n this.#errors = errors && errors.length > 0 ? errors : null;\n\n if (this.#errors) {\n this.setAttribute('aria-invalid', 'true');\n this.setAttribute('aria-errormessage', ApexGridCell.#ERROR_ID);\n this.setAttribute('data-invalid', '');\n this.setAttribute('title', this.#errors.join('; '));\n } else {\n this.removeAttribute('aria-invalid');\n this.removeAttribute('aria-errormessage');\n this.removeAttribute('data-invalid');\n this.removeAttribute('title');\n }\n }\n\n /**\n * The inline error node surfaced when the cell is invalid. `role=\"alert\"`\n * announces the message when it appears, covering the cross-shadow gap where\n * an `aria-errormessage` IDREF on the host can't reach this node.\n */\n protected renderError() {\n if (!this.#errors) return null;\n return html`<span\n part=\"cell-error\"\n id=${ApexGridCell.#ERROR_ID}\n role=\"alert\"\n >${this.#errors.join('; ')}</span\n >`;\n }\n\n /**\n * Reflects module-contributed decoration attributes (see {@link CellDecorator})\n * onto the cell host, reconciling against the previous update so attributes\n * that are no longer present are removed. Inert for the community grid:\n * `state.decorateCell` returns `null` with no modules, so nothing is set.\n */\n #applyDecoration(): void {\n const decoration =\n this.state && this.row\n ? this.state.decorateCell({\n row: this.row.data,\n // A pinned row is outside the body view (`pageItems`), so its\n // band-local index must not match a body row's.\n rowIndex: this.#inPinnedBand ? -1 : this.rowIndex,\n column: this.column,\n value: this.value as unknown,\n })\n : null;\n const next = decoration?.attributes ?? {};\n\n // Remove anything we set last time that's gone (or explicitly cleared).\n for (const key of this.#decoratedKeys) {\n if (next[key] == null) this.removeAttribute(key);\n }\n\n const applied: string[] = [];\n for (const [key, value] of Object.entries(next)) {\n if (value == null) {\n this.removeAttribute(key);\n } else {\n this.setAttribute(key, value);\n applied.push(key);\n }\n }\n this.#decoratedKeys = applied;\n }\n\n protected override updated(changed: PropertyValues<this>) {\n if (this.isEditing) {\n // Focus and select only on entering edit mode: a mid-edit re-render\n // (validation, decoration) must keep the caret and the user's focus.\n if (!changed.has('editing')) return;\n const editor = this.editorElement;\n editor?.focus();\n if (editor instanceof HTMLInputElement) {\n if (editor.type === 'text' || editor.type === 'number') {\n editor.select();\n }\n }\n return;\n }\n // A keyboard-committed (or cancelled) edit removes the focused editor from\n // the DOM; hand focus back to the cell host so grid navigation continues\n // from where the user was. Pointer-driven exits (blur / outside click)\n // never set the flag, so they don't steal focus from the click target.\n if (changed.get('editing') === true && this.#refocusAfterEdit) {\n this.#refocusAfterEdit = false;\n this.focus();\n }\n }\n\n #handleClick = (event: MouseEvent) => {\n if (this.isEditing) {\n // Don't let clicks inside the editor bubble into navigation / outside-click commits.\n event.stopPropagation();\n return;\n }\n if (!this.isEditable) return;\n // Boolean cells handle interaction in their display widget — clicking the\n // checkbox commits inline via `ctx.commit`. We never enter edit mode for\n // booleans, which avoids the visual reflow between display/editor markup\n // and lets a single click toggle the value.\n if (this.column.type === 'boolean') return;\n if (this.editingController.trigger !== 'click') return;\n this.#startEdit();\n };\n\n #handleDoubleClick = (event: MouseEvent) => {\n if (this.isEditing) {\n event.stopPropagation();\n return;\n }\n if (!this.isEditable) return;\n if (this.column.type === 'boolean') return;\n if (this.editingController.trigger !== 'doubleClick') return;\n this.#startEdit();\n };\n\n #startEdit() {\n if (!this.row) return;\n // By record, so a pinned row edits its own record, not the body row at\n // its band-local index.\n this.editingController.editRecord(this.row.data, this.column.key);\n }\n\n /** Set by keyboard-driven commit/cancel so `updated` refocuses the cell host. */\n #refocusAfterEdit = false;\n\n /** Commits the open editor's draft (held by the editing controller). */\n #commit = (): Promise<boolean> => this.editingController.commitCell();\n\n #cancel = () => {\n this.editingController.cancelCell();\n };\n\n /**\n * Tab while editing: commits the draft and, once the commit is accepted,\n * moves the active cell and focus to the next cell (Shift+Tab: the previous\n * one), wrapping across rows, and scrolls it into view. The landed cell\n * stays closed (Enter or F2 opens it); a rejected commit keeps the editor\n * open. With no cell to land on (grid edge, only full-width rows such as\n * group headers beyond), focus stays on the edited record's cell.\n *\n * The target is resolved after the commit settles, from the edited record's\n * position in {@link ApexGrid.pageItems}: a commit can re-sort or regroup\n * the rows (the edited value is a sort or group key), so the record may now\n * sit at another index, outside the rows the virtualizer renders; the target\n * row is scrolled into view before it is focused. When the commit removed\n * the record from the view (filtered out, moved into a collapsed group, or\n * replaced by a listener writing a new object), focus stays in the grid on\n * the cell nearest the edited position.\n */\n #commitAndTab(event: KeyboardEvent): void {\n event.preventDefault();\n if (this.#inPinnedBand) {\n // Pinned rows sit outside the body's keyboard model: commit and keep\n // focus on this cell.\n this.#refocusAfterEdit = true;\n void this.#commit();\n return;\n }\n const step = event.shiftKey ? -1 : 1;\n const host = this.state.host;\n const body = this.row.parentElement as\n | (HTMLElement & { updateComplete?: Promise<unknown> })\n | null;\n const record = this.row.data;\n const origin = this.row.index;\n const key = this.column.key;\n const columns = this.row.columns;\n const keys = this.row.cells.map((cell) => cell.column.key);\n // The grid, then the rows' container (the virtualizer re-renders its rows\n // in its own update), then the rows themselves (a row that now holds a\n // full-width record drops its cells in its own update).\n const settle = async () => {\n await host.updateComplete;\n await body?.updateComplete;\n await Promise.all(renderedRows<T>(body).map((row) => row.updateComplete));\n };\n void this.#commit().then(async (committed) => {\n if (!committed) return;\n await settle();\n const items = host.pageItems;\n const isFullWidth = (index: number) =>\n items[index] == null ||\n this.state.presentRow(items[index], { columns, rowIndex: index }) !== null;\n const from = items.indexOf(record);\n let target: ActiveNode<T> | null;\n if (from >= 0) {\n target = tabTarget(items.length, from, keys, key, step, isFullWidth) ?? {\n row: from,\n column: key,\n };\n } else {\n const row = nearestCellRow(items.length, origin, step, isFullWidth);\n target = row < 0 ? null : { row, column: key };\n }\n if (!target) {\n body?.focus({ preventScroll: true });\n return;\n }\n this.state.active = target;\n await settle();\n let cell = findRenderedCell(body, target);\n // The target row is outside the rendered range: scroll towards it and\n // let the virtualizer render (two frames), re-aiming from the newly\n // rendered rows when the estimate fell short.\n for (let attempt = 0; !cell && attempt < 3; attempt++) {\n scrollRowIntoRange(host as unknown as HTMLElement, body, target.row);\n await new Promise(requestAnimationFrame);\n await new Promise(requestAnimationFrame);\n await settle();\n cell = findRenderedCell(body, target);\n }\n if (!cell) {\n body?.focus({ preventScroll: true });\n return;\n }\n cell.focus({ preventScroll: true });\n cell.scrollIntoView({ block: 'nearest', inline: 'nearest' });\n // The virtualizer's own layout pass, a frame or two later, can move or\n // re-create the landed row (an items change from the commit, such as a\n // quick filter dropping the record), which drops focus to the document.\n // Land again while the active cell is still the target.\n await new Promise(requestAnimationFrame);\n await new Promise(requestAnimationFrame);\n const active = this.state.active;\n const dropped = !document.activeElement || document.activeElement === document.body;\n if (dropped && active.row === target.row && active.column === target.column) {\n findRenderedCell(body, target)?.focus({ preventScroll: true });\n }\n });\n }\n\n #handleKeydown = (event: KeyboardEvent) => {\n event.stopPropagation();\n switch (event.key) {\n case 'Enter':\n event.preventDefault();\n this.#refocusAfterEdit = true;\n this.#commit();\n return;\n case 'Escape':\n event.preventDefault();\n this.#refocusAfterEdit = true;\n this.#cancel();\n return;\n case 'Tab':\n this.#commitAndTab(event);\n return;\n default:\n return;\n }\n };\n\n /**\n * Cell-level keydown that catches keys bubbling out of registry-built\n * editors (the default editor stops propagation on its own input).\n *\n * - Escape always cancels the edit.\n * - Tab commits the draft (or just closes when nothing was typed) and\n * moves to the next cell.\n *\n * Per-editor `keydown` handlers that need to consume Enter (e.g. the\n * built-in `<select>` editor) still get the first crack — they call\n * `event.stopPropagation()` and we never see those keys here.\n */\n #handleCellKeydown = (event: KeyboardEvent) => {\n if (!this.isEditing) return;\n if (event.key === 'Escape') {\n event.preventDefault();\n this.#refocusAfterEdit = true;\n this.#cancel();\n return;\n }\n if (event.key === 'Tab') this.#commitAndTab(event);\n };\n\n /**\n * Cell-level focus-out, the single focus-loss commit path: commits the\n * editor's draft when focus truly leaves the cell (clicking another cell or\n * a control outside the grid, blurring to the document body). In row mode\n * the value is staged and the row stays open.\n *\n * With no draft (nothing typed or picked) `commitCell()` resolves to the\n * current data value, so losing focus closes the editor without writing.\n * A failed validation keeps the editor open with its error.\n */\n #handleCellFocusOut = (event: FocusEvent) => {\n if (!this.isEditing) return;\n const next = event.relatedTarget as Node | null;\n if (next && (this.contains(next) || this.shadowRoot?.contains(next))) return;\n // A pointer exit never hands focus back to the cell, even after an\n // earlier keyboard commit that failed validation set the flag.\n this.#refocusAfterEdit = false;\n this.#commit();\n };\n\n /** Number and currency columns share the built-in number editor. */\n get #isNumeric(): boolean {\n const type = this.column.type;\n return type === 'number' || type === 'currency';\n }\n\n #handleTextInput = (event: Event) => {\n const target = event.target as HTMLInputElement;\n if (this.#isNumeric) {\n // An empty (or non-parseable) number field clears the value to null rather\n // than committing NaN, which would render as the text \"NaN\".\n const numeric = target.valueAsNumber;\n this.editingController.setDraft(\n target.value === '' || Number.isNaN(numeric) ? null : numeric\n );\n return;\n }\n this.editingController.setDraft(target.value);\n };\n\n #handleCheckboxChange = async (event: Event) => {\n const target = event.target as HTMLInputElement;\n // Booleans commit immediately: toggling is the whole interaction. A\n // rejected toggle flips back so the box never shows an unsaved state.\n if (!(await this.editingController.commitCell(target.checked))) {\n target.checked = !target.checked;\n }\n };\n\n /**\n * The value the editor shows: the cell value, or the held draft when the\n * editor opened on an edit already in progress (its record paged or\n * scrolled back into view), so what it shows is what a commit writes. Read\n * once on opening, so a later re-render never rewrites what the user is\n * typing.\n */\n get #editorValue(): unknown {\n return this.#resumed ? this.#resumed.value : this.value;\n }\n\n protected renderDefaultEditor() {\n const value = this.#editorValue;\n if (this.column.type === 'boolean') {\n return html`<input\n type=\"checkbox\"\n part=\"editor\"\n data-apex-editor\n ?checked=${Boolean(value)}\n @change=${this.#handleCheckboxChange}\n @keydown=${this.#handleKeydown}\n />`;\n }\n if (this.#isNumeric) {\n return html`<input\n type=\"number\"\n part=\"editor\"\n data-apex-editor\n .value=${value == null ? '' : String(value)}\n @input=${this.#handleTextInput}\n @keydown=${this.#handleKeydown}\n />`;\n }\n return html`<input\n type=\"text\"\n part=\"editor\"\n data-apex-editor\n .value=${value == null ? '' : String(value)}\n @input=${this.#handleTextInput}\n @keydown=${this.#handleKeydown}\n />`;\n }\n\n protected renderEditor() {\n const template = this.column.editorTemplate;\n const ctx = {\n parent: this,\n row: this.row,\n column: this.column,\n value: this.#editorValue,\n commit: (next: unknown) => this.editingController.commitCell(next),\n cancel: () => this.editingController.cancelCell(),\n setDraft: (next: unknown) => this.editingController.setDraft(next),\n };\n if (template) {\n return template(ctx as unknown as ApexEditorContext<T> as never);\n }\n const typeRenderer = getColumnTypeRenderer<T>(this.column.type);\n if (typeRenderer?.editor) {\n return typeRenderer.editor(ctx as never);\n }\n return this.renderDefaultEditor();\n }\n\n /**\n * Renders the tree affordance — depth-based indent + a chevron toggle (or\n * leaf spacer) — that prefixes the group cell when {@link ApexGrid.tree}\n * is enabled. Returns `nothing` for every other cell.\n */\n protected renderTreeAffordance() {\n const tree = this.state?.tree;\n if (!tree?.enabled) return null;\n if (!this.row?.data) return null;\n if (!tree.isGroupColumn(this.column.key)) return null;\n\n const data = this.row.data;\n const meta = tree.getMeta(data);\n if (!meta) return null;\n\n const indent = meta.depth * tree.childIndent;\n const expanded = tree.isExpanded(data);\n const handleClick = (event: MouseEvent) => {\n event.stopPropagation();\n if (!meta.hasChildren) return;\n void tree.toggleRow(data);\n };\n\n const chevron = meta.hasChildren\n ? html`<button\n type=\"button\"\n part=\"tree-toggle\"\n aria-label=${\n expanded ? this.state.localize('row.collapse') : this.state.localize('row.expand')\n }\n aria-expanded=${expanded ? 'true' : 'false'}\n @click=${handleClick}\n >\n <svg\n part=\"tree-chevron\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n width=\"14\"\n height=\"14\"\n >\n <path\n d=\"M9 6l6 6-6 6\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </button>`\n : html`<span part=\"tree-spacer\" aria-hidden=\"true\"></span>`;\n\n return html`<span\n part=\"tree-indent\"\n aria-hidden=\"true\"\n style=${`inline-size: ${indent}px`}\n ></span>${chevron}`;\n }\n\n /**\n * Resolves the value to display for the cell. Synthesized tree parents\n * (those that appear only as a path segment with no backing data) render\n * their last path segment in the group column and nothing elsewhere.\n */\n protected resolveDisplayValue(): unknown {\n const tree = this.state?.tree;\n if (tree?.enabled && this.row?.data && tree.isSynthesized(this.row.data)) {\n return tree.isGroupColumn(this.column.key) ? tree.getLabel(this.row.data) : '';\n }\n return this.value;\n }\n\n protected renderCellBody() {\n if (this.column.cellTemplate) {\n return this.column.cellTemplate(this.context as ApexCellContext<T> as never);\n }\n // A formula error is a first-class cell value: render its code as text so it\n // stays visible in typed columns (a currency/number renderer would coerce it\n // to NaN and show an empty cell).\n const value = this.resolveDisplayValue();\n if (isErrorLike(value)) {\n return html`${value.code}`;\n }\n const typeRenderer = getColumnTypeRenderer<T>(this.column.type);\n if (typeRenderer?.display) {\n // Synthesized parents have no real backing data — route them through\n // a plain text render instead of the typed renderer.\n const tree = this.state?.tree;\n if (tree?.enabled && this.row?.data && tree.isSynthesized(this.row.data)) {\n return html`${this.resolveDisplayValue()}`;\n }\n return typeRenderer.display(this.context as never);\n }\n return html`${this.resolveDisplayValue()}`;\n }\n\n protected override render() {\n const error = this.renderError();\n if (this.isEditing) {\n return html`${this.renderEditor()}${error}`;\n }\n const affordance = this.renderTreeAffordance();\n if (affordance) {\n return html`${affordance}<span part=\"tree-cell-content\"\n >${this.renderCellBody()}</span\n >${error}`;\n }\n return html`${this.renderCellBody()}${error}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [ApexGridCell.tagName]: ApexGridCell<object>;\n }\n}\n"]}
|
|
@@ -28,6 +28,8 @@ export default class ApexFilterRow<T extends object> extends LitElement {
|
|
|
28
28
|
expression: FilterExpression<T>;
|
|
29
29
|
connectedCallback(): void;
|
|
30
30
|
disconnectedCallback(): void;
|
|
31
|
+
/** Switching the open panel to another column moves it under that column. */
|
|
32
|
+
protected triggerChanged(): void;
|
|
31
33
|
protected activeChanged(): Promise<void>;
|
|
32
34
|
protected renderCriteriaButton(expr: FilterExpression<T>, index: number): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
33
35
|
protected renderExpressionChip(props: ExpressionChipProps<T>): import("lit-html").TemplateResult<1>;
|
package/components/filter-row.js
CHANGED
|
@@ -78,12 +78,14 @@ export default class ApexFilterRow extends LitElement {
|
|
|
78
78
|
}
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
|
-
if (this.active && !
|
|
81
|
+
if (this.active && !this.#fromPanel(event)) {
|
|
82
82
|
this.active = false;
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
this.#handleDocumentKey = (event) => {
|
|
86
|
-
|
|
86
|
+
const origin = event.composedPath()[0];
|
|
87
|
+
const unowned = origin === document.body || origin === document.documentElement;
|
|
88
|
+
if (event.key !== 'Escape' || !this.active || !(unowned || this.#fromPanel(event)))
|
|
87
89
|
return;
|
|
88
90
|
if (this.dropdownOpen) {
|
|
89
91
|
event.stopPropagation();
|
|
@@ -99,6 +101,19 @@ export default class ApexFilterRow extends LitElement {
|
|
|
99
101
|
this.#openDropdownList = () => {
|
|
100
102
|
this.dropdownOpen = !this.dropdownOpen;
|
|
101
103
|
};
|
|
104
|
+
this.#position = () => {
|
|
105
|
+
const rect = this.#trigger()?.getBoundingClientRect() ?? this.triggerRect;
|
|
106
|
+
if (!rect)
|
|
107
|
+
return;
|
|
108
|
+
const width = this.offsetWidth;
|
|
109
|
+
const viewportWidth = window.innerWidth;
|
|
110
|
+
let left = rect.left;
|
|
111
|
+
if (left + width > viewportWidth - 8) {
|
|
112
|
+
left = Math.max(8, viewportWidth - width - 8);
|
|
113
|
+
}
|
|
114
|
+
this.style.setProperty('--fp-top', `${rect.bottom + 4}px`);
|
|
115
|
+
this.style.setProperty('--fp-left', `${left}px`);
|
|
116
|
+
};
|
|
102
117
|
}
|
|
103
118
|
static get tagName() {
|
|
104
119
|
return GRID_FILTER_ROW_TAG;
|
|
@@ -108,7 +123,7 @@ export default class ApexFilterRow extends LitElement {
|
|
|
108
123
|
registerComponent(ApexFilterRow);
|
|
109
124
|
}
|
|
110
125
|
get isNumeric() {
|
|
111
|
-
return this.column
|
|
126
|
+
return this.state.isNumericColumn(this.column);
|
|
112
127
|
}
|
|
113
128
|
get filterController() {
|
|
114
129
|
return this.state.filtering;
|
|
@@ -120,12 +135,23 @@ export default class ApexFilterRow extends LitElement {
|
|
|
120
135
|
this.expression = this.filterController.getDefaultExpression(this.column);
|
|
121
136
|
}
|
|
122
137
|
#removeExpression(expression) {
|
|
123
|
-
this.filterController.removeExpression(expression);
|
|
138
|
+
return this.filterController.removeExpression(expression);
|
|
124
139
|
}
|
|
125
|
-
#
|
|
126
|
-
this.
|
|
127
|
-
|
|
128
|
-
|
|
140
|
+
#isApplied(expression) {
|
|
141
|
+
return Boolean(this.filterController.get(expression.key)?.has(expression));
|
|
142
|
+
}
|
|
143
|
+
#commit(expression, change) {
|
|
144
|
+
return this.filterController.filterWithEvent({ ...expression, ...change }, this.#isApplied(expression) ? 'modify' : 'add', expression);
|
|
145
|
+
}
|
|
146
|
+
async #applyCondition(key) {
|
|
147
|
+
const expression = this.expression;
|
|
148
|
+
const condition = getFilterOperandsFor(this.column)[key];
|
|
149
|
+
const term = expression.searchTerm;
|
|
150
|
+
if (condition.unary || (term != null && term !== '')) {
|
|
151
|
+
await this.#commit(expression, { condition });
|
|
152
|
+
}
|
|
153
|
+
else if (!this.#isApplied(expression) || (await this.#removeExpression(expression))) {
|
|
154
|
+
expression.condition = condition;
|
|
129
155
|
}
|
|
130
156
|
this.requestUpdate();
|
|
131
157
|
}
|
|
@@ -149,22 +175,31 @@ export default class ApexFilterRow extends LitElement {
|
|
|
149
175
|
}
|
|
150
176
|
#handleTriggerKeydown;
|
|
151
177
|
#handleDropdownKeydown;
|
|
178
|
+
#trigger() {
|
|
179
|
+
return this.state.headerRow?.headers
|
|
180
|
+
.find((header) => header.column.key === this.column.key)
|
|
181
|
+
?.renderRoot.querySelector('[part~="filter-btn"]');
|
|
182
|
+
}
|
|
183
|
+
#fromPanel(event) {
|
|
184
|
+
const path = event.composedPath();
|
|
185
|
+
const trigger = this.#trigger();
|
|
186
|
+
return path.includes(this) || (!!trigger && path.includes(trigger));
|
|
187
|
+
}
|
|
152
188
|
#handleOutsidePointer;
|
|
153
189
|
#handleDocumentKey;
|
|
154
|
-
#handleInput(event) {
|
|
190
|
+
async #handleInput(event) {
|
|
155
191
|
event.stopPropagation();
|
|
156
192
|
const raw = event.target.value ?? '';
|
|
157
193
|
const value = this.isNumeric ? Number.parseFloat(raw) : raw;
|
|
158
194
|
const shouldUpdate = this.isNumeric ? !Number.isNaN(value) : !!value;
|
|
159
|
-
const
|
|
160
|
-
? 'modify'
|
|
161
|
-
: 'add';
|
|
195
|
+
const expression = this.expression;
|
|
162
196
|
if (shouldUpdate) {
|
|
163
|
-
this
|
|
164
|
-
this.filterController.filterWithEvent(this.expression, type);
|
|
197
|
+
await this.#commit(expression, { searchTerm: value });
|
|
165
198
|
}
|
|
166
|
-
else
|
|
167
|
-
|
|
199
|
+
else if ((!this.#isApplied(expression) || (await this.#removeExpression(expression))) &&
|
|
200
|
+
raw === '' &&
|
|
201
|
+
!this.#isApplied(expression)) {
|
|
202
|
+
expression.searchTerm = undefined;
|
|
168
203
|
}
|
|
169
204
|
this.requestUpdate();
|
|
170
205
|
}
|
|
@@ -193,23 +228,31 @@ export default class ApexFilterRow extends LitElement {
|
|
|
193
228
|
super.connectedCallback();
|
|
194
229
|
document.addEventListener('pointerdown', this.#handleOutsidePointer, true);
|
|
195
230
|
document.addEventListener('keydown', this.#handleDocumentKey, true);
|
|
231
|
+
if (this.active)
|
|
232
|
+
this.#listenForMoves(true);
|
|
196
233
|
}
|
|
197
234
|
disconnectedCallback() {
|
|
198
235
|
document.removeEventListener('pointerdown', this.#handleOutsidePointer, true);
|
|
199
236
|
document.removeEventListener('keydown', this.#handleDocumentKey, true);
|
|
237
|
+
this.#listenForMoves(false);
|
|
200
238
|
super.disconnectedCallback();
|
|
201
239
|
}
|
|
240
|
+
#listenForMoves(on) {
|
|
241
|
+
const method = on ? 'addEventListener' : 'removeEventListener';
|
|
242
|
+
window[method]('scroll', this.#position, true);
|
|
243
|
+
window[method]('resize', this.#position);
|
|
244
|
+
this.state?.host[method]('scroll', this.#position);
|
|
245
|
+
}
|
|
246
|
+
#position;
|
|
247
|
+
triggerChanged() {
|
|
248
|
+
if (this.active)
|
|
249
|
+
this.#position();
|
|
250
|
+
}
|
|
202
251
|
async activeChanged() {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
const viewportWidth = window.innerWidth;
|
|
206
|
-
let left = this.triggerRect.left;
|
|
207
|
-
if (left + panelWidth > viewportWidth - 8) {
|
|
208
|
-
left = Math.max(8, viewportWidth - panelWidth - 8);
|
|
209
|
-
}
|
|
210
|
-
this.style.setProperty('--fp-top', `${this.triggerRect.bottom + 4}px`);
|
|
211
|
-
this.style.setProperty('--fp-left', `${left}px`);
|
|
252
|
+
this.#listenForMoves(this.active);
|
|
253
|
+
if (this.active) {
|
|
212
254
|
this.setAttribute('data-active', '');
|
|
255
|
+
this.#position();
|
|
213
256
|
await this.updateComplete;
|
|
214
257
|
this.input?.select();
|
|
215
258
|
}
|
|
@@ -224,8 +267,7 @@ export default class ApexFilterRow extends LitElement {
|
|
|
224
267
|
#chipCriteriaFor(expression) {
|
|
225
268
|
return async (e) => {
|
|
226
269
|
e.stopPropagation();
|
|
227
|
-
expression
|
|
228
|
-
this.filterController.filterWithEvent(expression, 'modify');
|
|
270
|
+
await this.#commit(expression, { criteria: expression.criteria === 'and' ? 'or' : 'and' });
|
|
229
271
|
this.requestUpdate();
|
|
230
272
|
};
|
|
231
273
|
}
|
|
@@ -260,6 +302,15 @@ export default class ApexFilterRow extends LitElement {
|
|
|
260
302
|
</button>`
|
|
261
303
|
: nothing;
|
|
262
304
|
}
|
|
305
|
+
#termLabel(term) {
|
|
306
|
+
if (!Array.isArray(term))
|
|
307
|
+
return term;
|
|
308
|
+
return term
|
|
309
|
+
.map((value) => typeof value === 'string' && value.startsWith('\u0000')
|
|
310
|
+
? this.state.localize('setFilter.blanks')
|
|
311
|
+
: String(value))
|
|
312
|
+
.join(', ');
|
|
313
|
+
}
|
|
263
314
|
renderExpressionChip(props) {
|
|
264
315
|
const { name, unary } = props.expression.condition;
|
|
265
316
|
const { searchTerm: term } = props.expression;
|
|
@@ -273,7 +324,7 @@ export default class ApexFilterRow extends LitElement {
|
|
|
273
324
|
@click=${props.onSelect}
|
|
274
325
|
>
|
|
275
326
|
${renderIcon(name)}
|
|
276
|
-
<span>${unary ? name : term}</span>
|
|
327
|
+
<span>${unary ? name : this.#termLabel(term)}</span>
|
|
277
328
|
</button>
|
|
278
329
|
<button
|
|
279
330
|
part="chip-remove"
|
|
@@ -419,6 +470,9 @@ __decorate([
|
|
|
419
470
|
__decorate([
|
|
420
471
|
property({ attribute: false })
|
|
421
472
|
], ApexFilterRow.prototype, "expression", void 0);
|
|
473
|
+
__decorate([
|
|
474
|
+
watch('triggerRect', { waitUntilFirstUpdate: true })
|
|
475
|
+
], ApexFilterRow.prototype, "triggerChanged", null);
|
|
422
476
|
__decorate([
|
|
423
477
|
watch('active', { waitUntilFirstUpdate: true })
|
|
424
478
|
], ApexFilterRow.prototype, "activeChanged", null);
|
|
@@ -1 +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,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAwB,MAAM,yBAAyB,CAAC;AAEjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,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;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAC;AAShE,MAAM,CAAC,OAAO,OAAO,aAAgC,SAAQ,UAAU;IAAvE;;QA4BS,WAAM,GAAG,KAAK,CAAC;QAIf,gBAAW,GAAmB,IAAI,CA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CAAC,UAAU,EAAE,UAAqB,IAAI,EAAE;8BACxC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,yBAAyB,CAAC;yBACnD,IAAI,CAAC,YAAY;2BACf,IAAI,CAAC,cAAc;;mBAE3B;YACP,CAAC,CAAC,OACN;UACE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAA,yBAAyB,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO;mCACzD,IAAI,CAAC,mBAAmB,EAAE;;KAExD,CAAC;IACJ,CAAC;IAEkB,MAAM;QACvB,OAAO,IAAI,CAAA,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IACnE,CAAC;;AA7bM;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;AAIf;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;kDACW;AAGnC;IADN,KAAK,CAAC,OAAO,CAAC;4CACiB;AAGzB;IADN,KAAK,CAAC,YAAY,CAAC;uDACkB;AAG/B;IADN,KAAK,CAAC,oBAAoB,CAAC;+CACE;AAGpB;IADT,KAAK,EAAE;mDACuB;AAGxB;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;6CACyD;AAGjF;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iDACS;AA2LxB;IADf,KAAK,CAAC,QAAQ,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;kDAuB/C","sourcesContent":["import { consume } from '@lit/context';\nimport { html, LitElement, nothing } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { gridStateContext, type StateController } from '../controllers/state.js';\nimport type { GridLocaleKey } from '../i18n/index.js';\nimport { DEFAULT_COLUMN_CONFIG } from '../internal/constants.js';\nimport { renderIcon } from '../internal/icons.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 { 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\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 /** Bounding rect of the filter icon that opened this panel. Used for positioning. */\n @property({ attribute: false })\n public triggerRect: DOMRect | null = null;\n\n @query('input')\n public input!: HTMLInputElement;\n\n @query('#condition')\n public conditionElement!: HTMLElement;\n\n @query('[part~=\"dropdown\"]')\n public dropdown!: HTMLElement;\n\n @state()\n protected dropdownOpen = false;\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 #applyCondition(key: OperandKeys<T[typeof this.column.key]>) {\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 #selectOption(target: HTMLElement | null) {\n if (!target) return;\n const value = target.dataset.value as OperandKeys<T[typeof this.column.key]>;\n this.#applyCondition(value);\n this.dropdownOpen = false;\n this.input?.focus();\n }\n\n #handleDropdownItemClick = (event: Event) => {\n event.stopPropagation();\n this.#selectOption((event.target as HTMLElement).closest<HTMLElement>('[data-value]'));\n };\n\n #dropdownOptions(): HTMLElement[] {\n return Array.from(this.dropdown?.querySelectorAll<HTMLElement>('[role=\"option\"]') ?? []);\n }\n\n /** Moves focus into the dropdown, landing on the selected (or first) option. */\n #focusDropdownOption() {\n requestAnimationFrame(() => {\n const options = this.#dropdownOptions();\n (options.find((option) => option.matches('[aria-selected=\"true\"]')) ?? options[0])?.focus();\n });\n }\n\n /** ArrowDown on the condition trigger opens the listbox and focuses into it. */\n #handleTriggerKeydown = (event: KeyboardEvent) => {\n if (event.key !== 'ArrowDown' && event.key !== 'Down') return;\n event.preventDefault();\n event.stopPropagation();\n this.dropdownOpen = true;\n this.#focusDropdownOption();\n };\n\n /** Listbox keyboard pattern: arrows/Home/End rove, Enter/Space pick. */\n #handleDropdownKeydown = (event: KeyboardEvent) => {\n const options = this.#dropdownOptions();\n const current = options.findIndex((option) => option.matches(':focus'));\n switch (event.key) {\n case 'ArrowDown':\n case 'Down':\n event.preventDefault();\n event.stopPropagation();\n options[Math.min(current + 1, options.length - 1)]?.focus();\n return;\n case 'ArrowUp':\n case 'Up':\n event.preventDefault();\n event.stopPropagation();\n options[Math.max(current - 1, 0)]?.focus();\n return;\n case 'Home':\n event.preventDefault();\n event.stopPropagation();\n options[0]?.focus();\n return;\n case 'End':\n event.preventDefault();\n event.stopPropagation();\n options[options.length - 1]?.focus();\n return;\n case 'Enter':\n case ' ':\n event.preventDefault();\n event.stopPropagation();\n this.#selectOption(options[current] ?? null);\n return;\n default:\n return;\n }\n };\n\n #handleOutsidePointer = (event: PointerEvent) => {\n const path = event.composedPath();\n\n // Close the condition dropdown if clicking outside it.\n if (this.dropdownOpen) {\n if (!path.includes(this.dropdown) && !path.includes(this.conditionElement)) {\n this.dropdownOpen = false;\n }\n return;\n }\n\n // Close the whole panel if clicking outside it.\n if (this.active && !path.includes(this)) {\n this.active = false;\n }\n };\n\n #handleDocumentKey = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') return;\n\n if (this.dropdownOpen) {\n event.stopPropagation();\n this.dropdownOpen = false;\n this.conditionElement?.focus();\n return;\n }\n\n if (this.active) {\n event.stopPropagation();\n this.active = false;\n }\n };\n\n #handleInput(event: Event) {\n event.stopPropagation();\n\n const raw = (event.target as HTMLInputElement).value ?? '';\n const value = this.isNumeric ? Number.parseFloat(raw) : raw;\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 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 if (this.input) 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.#setDefaultExpression();\n this.requestUpdate();\n }\n\n #openDropdownList = () => {\n this.dropdownOpen = !this.dropdownOpen;\n };\n\n public override connectedCallback(): void {\n super.connectedCallback();\n document.addEventListener('pointerdown', this.#handleOutsidePointer, true);\n document.addEventListener('keydown', this.#handleDocumentKey, true);\n }\n\n public override disconnectedCallback(): void {\n document.removeEventListener('pointerdown', this.#handleOutsidePointer, true);\n document.removeEventListener('keydown', this.#handleDocumentKey, true);\n super.disconnectedCallback();\n }\n\n @watch('active', { waitUntilFirstUpdate: true })\n protected async activeChanged() {\n if (this.active && this.triggerRect) {\n const panelWidth = 240;\n const viewportWidth = window.innerWidth;\n let left = this.triggerRect.left;\n // Clamp so the panel doesn't overflow the right edge of the viewport.\n if (left + panelWidth > viewportWidth - 8) {\n left = Math.max(8, viewportWidth - panelWidth - 8);\n }\n this.style.setProperty('--fp-top', `${this.triggerRect.bottom + 4}px`);\n this.style.setProperty('--fp-left', `${left}px`);\n this.setAttribute('data-active', '');\n await this.updateComplete;\n this.input?.select();\n } else {\n this.removeAttribute('data-active');\n this.style.removeProperty('--fp-top');\n this.style.removeProperty('--fp-left');\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 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`<button\n type=\"button\"\n part=\"criteria\"\n @click=${this.#chipCriteriaFor(expr)}\n >\n ${expr.criteria}\n </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 return html`<div\n part=\"expression-chip\"\n ?selected=${props.selected}\n >\n <button\n part=\"chip-body\"\n type=\"button\"\n @click=${props.onSelect}\n >\n ${renderIcon(name)}\n <span>${unary ? name : term}</span>\n </button>\n <button\n part=\"chip-remove\"\n type=\"button\"\n aria-label=${this.state.localize('filter.removeFilter')}\n @click=${props.onRemove}\n >\n ${renderIcon('close')}\n </button>\n </div>`;\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 <button\n id=\"reset\"\n type=\"button\"\n part=\"action\"\n @click=${this.#handleResetClick}\n >\n ${renderIcon('refresh')} ${this.state.localize('filter.reset')}\n </button>\n <button\n id=\"close\"\n type=\"button\"\n part=\"action\"\n @click=${() => {\n this.active = false;\n }}\n >\n ${renderIcon('close')} ${this.state.localize('filter.close')}\n </button>\n `;\n }\n\n protected renderDropdown() {\n return html`<ul\n part=\"dropdown\"\n role=\"listbox\"\n aria-label=${this.state.localize('filter.conditionList')}\n ?hidden=${!this.dropdownOpen}\n @click=${this.#handleDropdownItemClick}\n @keydown=${this.#handleDropdownKeydown}\n >\n ${Object.entries(getFilterOperandsFor(this.column)).map(\n ([key, operand]) => html`\n <li\n part=\"dropdown-item\"\n role=\"option\"\n tabindex=\"-1\"\n data-value=${key}\n aria-selected=${this.condition.name === key}\n ?selected=${this.condition.name === key}\n >\n ${renderIcon(key)}<span\n >${this.state.localize(\n `filter.operator.${key}` as GridLocaleKey,\n undefined,\n operand?.label ?? key\n )}</span\n >\n </li>\n `\n )}\n </ul>`;\n }\n\n protected renderDropdownTarget() {\n const conditionLabel = this.state.localize(\n `filter.operator.${this.condition.name}` as GridLocaleKey,\n undefined,\n (this.condition as FilterOperation<T>).label ?? this.condition.name\n );\n return html`<button\n id=\"condition\"\n type=\"button\"\n part=\"condition-trigger\"\n aria-label=${this.state.localize('filter.changeCondition')}\n aria-haspopup=\"listbox\"\n aria-expanded=${this.dropdownOpen ? 'true' : 'false'}\n @click=${this.#openDropdownList}\n @keydown=${this.#handleTriggerKeydown}\n >\n <span>${conditionLabel}</span>\n ${renderIcon('chevron-down')}\n </button>`;\n }\n\n protected renderActiveState() {\n const hasChips = Boolean(this.filterController.get(this.column.key)?.length);\n return html`\n <div part=\"panel\">\n <div part=\"condition-row\">\n ${this.renderDropdownTarget()}\n ${this.renderDropdown()}\n </div>\n ${\n !this.condition.unary\n ? html`<div part=\"panel-input-row\">\n <input\n part=\"filter-input\"\n type=\"text\"\n .value=${(this.expression?.searchTerm as string) ?? ''}\n placeholder=${this.state.localize('filter.inputPlaceholder')}\n @input=${this.#handleInput}\n @keydown=${this.#handleKeydown}\n />\n </div>`\n : nothing\n }\n ${hasChips ? html`<div part=\"chips-row\">${this.renderActiveChips()}</div>` : nothing}\n <div part=\"panel-footer\">${this.renderFilterActions()}</div>\n </div>\n `;\n }\n\n protected override render() {\n return html`${this.active ? this.renderActiveState() : nothing}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [ApexFilterRow.tagName]: ApexFilterRow<object>;\n }\n}\n"]}
|
|
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,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAwB,MAAM,yBAAyB,CAAC;AAEjF,OAAO,EAAE,qBAAqB,EAAE,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AAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IACnE,CAAC;;AAvhBM;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;AAIf;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;kDACW;AAGnC;IADN,KAAK,CAAC,OAAO,CAAC;4CACiB;AAGzB;IADN,KAAK,CAAC,YAAY,CAAC;uDACkB;AAG/B;IADN,KAAK,CAAC,oBAAoB,CAAC;+CACE;AAGpB;IADT,KAAK,EAAE;mDACuB;AAGxB;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;6CACyD;AAGjF;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iDACS;AAyQ9B;IADT,KAAK,CAAC,aAAa,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;mDAGpD;AAGe;IADf,KAAK,CAAC,QAAQ,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;kDAgB/C","sourcesContent":["import { consume } from '@lit/context';\nimport { html, LitElement, nothing } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { gridStateContext, type StateController } from '../controllers/state.js';\nimport type { GridLocaleKey } from '../i18n/index.js';\nimport { DEFAULT_COLUMN_CONFIG } from '../internal/constants.js';\nimport { renderIcon } from '../internal/icons.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 { 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\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.state.isNumericColumn(this.column);\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 /** Bounding rect of the filter icon that opened this panel. Used for positioning. */\n @property({ attribute: false })\n public triggerRect: DOMRect | null = null;\n\n @query('input')\n public input!: HTMLInputElement;\n\n @query('#condition')\n public conditionElement!: HTMLElement;\n\n @query('[part~=\"dropdown\"]')\n public dropdown!: HTMLElement;\n\n @state()\n protected dropdownOpen = false;\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 return this.filterController.removeExpression(expression);\n }\n\n #isApplied(expression: FilterExpression<T>) {\n return Boolean(this.filterController.get(expression.key)?.has(expression));\n }\n\n /**\n * Proposes `change` to `expression` through the cancelable `filtering`\n * event: `add` while the expression is the draft, `modify` once it is\n * applied. The expression itself changes only when the event passes.\n */\n #commit(expression: FilterExpression<T>, change: Record<string, unknown>) {\n return this.filterController.filterWithEvent(\n { ...expression, ...change } as FilterExpression<T>,\n this.#isApplied(expression) ? 'modify' : 'add',\n expression\n );\n }\n\n async #applyCondition(key: OperandKeys<T[typeof this.column.key]>) {\n const expression = this.expression;\n // XXX: Types\n const condition = (getFilterOperandsFor(this.column) as any)[key] as FilterOperation<\n T[keyof T]\n >;\n const term = expression.searchTerm;\n\n if (condition.unary || (term != null && term !== '')) {\n await this.#commit(expression, { condition });\n } else if (!this.#isApplied(expression) || (await this.#removeExpression(expression))) {\n // A binary condition without a term filters nothing yet: it stays the\n // draft until a term is typed, and an applied unary filter is dropped.\n expression.condition = condition;\n }\n\n this.requestUpdate();\n }\n\n #selectOption(target: HTMLElement | null) {\n if (!target) return;\n const value = target.dataset.value as OperandKeys<T[typeof this.column.key]>;\n this.#applyCondition(value);\n this.dropdownOpen = false;\n this.input?.focus();\n }\n\n #handleDropdownItemClick = (event: Event) => {\n event.stopPropagation();\n this.#selectOption((event.target as HTMLElement).closest<HTMLElement>('[data-value]'));\n };\n\n #dropdownOptions(): HTMLElement[] {\n return Array.from(this.dropdown?.querySelectorAll<HTMLElement>('[role=\"option\"]') ?? []);\n }\n\n /** Moves focus into the dropdown, landing on the selected (or first) option. */\n #focusDropdownOption() {\n requestAnimationFrame(() => {\n const options = this.#dropdownOptions();\n (options.find((option) => option.matches('[aria-selected=\"true\"]')) ?? options[0])?.focus();\n });\n }\n\n /** ArrowDown on the condition trigger opens the listbox and focuses into it. */\n #handleTriggerKeydown = (event: KeyboardEvent) => {\n if (event.key !== 'ArrowDown' && event.key !== 'Down') return;\n event.preventDefault();\n event.stopPropagation();\n this.dropdownOpen = true;\n this.#focusDropdownOption();\n };\n\n /** Listbox keyboard pattern: arrows/Home/End rove, Enter/Space pick. */\n #handleDropdownKeydown = (event: KeyboardEvent) => {\n const options = this.#dropdownOptions();\n const current = options.findIndex((option) => option.matches(':focus'));\n switch (event.key) {\n case 'ArrowDown':\n case 'Down':\n event.preventDefault();\n event.stopPropagation();\n options[Math.min(current + 1, options.length - 1)]?.focus();\n return;\n case 'ArrowUp':\n case 'Up':\n event.preventDefault();\n event.stopPropagation();\n options[Math.max(current - 1, 0)]?.focus();\n return;\n case 'Home':\n event.preventDefault();\n event.stopPropagation();\n options[0]?.focus();\n return;\n case 'End':\n event.preventDefault();\n event.stopPropagation();\n options[options.length - 1]?.focus();\n return;\n case 'Enter':\n case ' ':\n event.preventDefault();\n event.stopPropagation();\n this.#selectOption(options[current] ?? null);\n return;\n default:\n return;\n }\n };\n\n /** The filter button of the open column, found live so the panel tracks it. */\n #trigger() {\n return this.state.headerRow?.headers\n .find((header) => header.column.key === this.column.key)\n ?.renderRoot.querySelector('[part~=\"filter-btn\"]');\n }\n\n /** Whether an event came from the panel or from the button that opened it. */\n #fromPanel(event: Event) {\n const path = event.composedPath();\n const trigger = this.#trigger();\n return path.includes(this) || (!!trigger && path.includes(trigger));\n }\n\n #handleOutsidePointer = (event: PointerEvent) => {\n const path = event.composedPath();\n\n // Close the condition dropdown if clicking outside it.\n if (this.dropdownOpen) {\n if (!path.includes(this.dropdown) && !path.includes(this.conditionElement)) {\n this.dropdownOpen = false;\n }\n return;\n }\n\n // Close the whole panel if clicking outside it. A press on the open\n // column's filter button is left to its click, which toggles the panel.\n if (this.active && !this.#fromPanel(event)) {\n this.active = false;\n }\n };\n\n #handleDocumentKey = (event: KeyboardEvent) => {\n // Escape belongs to whatever has focus outside the panel. With focus on\n // the page itself (a click on panel chrome drops it there) nobody else\n // owns it, so it still closes the panel.\n const origin = event.composedPath()[0];\n const unowned = origin === document.body || origin === document.documentElement;\n if (event.key !== 'Escape' || !this.active || !(unowned || this.#fromPanel(event))) return;\n\n if (this.dropdownOpen) {\n event.stopPropagation();\n this.dropdownOpen = false;\n this.conditionElement?.focus();\n return;\n }\n\n if (this.active) {\n event.stopPropagation();\n this.active = false;\n }\n };\n\n async #handleInput(event: Event) {\n event.stopPropagation();\n\n const raw = (event.target as HTMLInputElement).value ?? '';\n const value = this.isNumeric ? Number.parseFloat(raw) : raw;\n const shouldUpdate = this.isNumeric ? !Number.isNaN(value as number) : !!value;\n const expression = this.expression;\n\n // A cancelled change leaves the typed text alone: the chip shows the\n // term still in effect, and resetting the input would fight the user.\n if (shouldUpdate) {\n await this.#commit(expression, { searchTerm: value });\n } else if (\n (!this.#isApplied(expression) || (await this.#removeExpression(expression))) &&\n raw === '' &&\n !this.#isApplied(expression)\n ) {\n // An emptied input leaves a draft with no term, as the input shows.\n // A partial number ('-', '.') keeps the old term so the value binding\n // does not wipe the typed character, and an input event that applied\n // the expression again while the removal settled keeps its term.\n expression.searchTerm = undefined;\n }\n\n this.requestUpdate();\n }\n\n #handleKeydown(event: KeyboardEvent) {\n event.stopPropagation();\n\n switch (event.key) {\n case 'Enter':\n if (this.input) 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.#setDefaultExpression();\n this.requestUpdate();\n }\n\n #openDropdownList = () => {\n this.dropdownOpen = !this.dropdownOpen;\n };\n\n public override connectedCallback(): void {\n super.connectedCallback();\n document.addEventListener('pointerdown', this.#handleOutsidePointer, true);\n document.addEventListener('keydown', this.#handleDocumentKey, true);\n if (this.active) this.#listenForMoves(true);\n }\n\n public override disconnectedCallback(): void {\n document.removeEventListener('pointerdown', this.#handleOutsidePointer, true);\n document.removeEventListener('keydown', this.#handleDocumentKey, true);\n this.#listenForMoves(false);\n super.disconnectedCallback();\n }\n\n /** Keeps the panel under its trigger while the page or the grid scrolls or resizes. */\n #listenForMoves(on: boolean) {\n const method = on ? 'addEventListener' : 'removeEventListener';\n // Scroll does not bubble or cross shadow roots: capture the page's\n // scrollers on window and listen on the grid, which scrolls itself.\n window[method]('scroll', this.#position, true);\n window[method]('resize', this.#position);\n this.state?.host[method]('scroll', this.#position);\n }\n\n #position = () => {\n const rect = this.#trigger()?.getBoundingClientRect() ?? this.triggerRect;\n if (!rect) return;\n // Measured, so a root font size other than 16px still clamps correctly.\n const width = this.offsetWidth;\n const viewportWidth = window.innerWidth;\n let left = rect.left;\n // Clamp so the panel doesn't overflow the right edge of the viewport.\n if (left + width > viewportWidth - 8) {\n left = Math.max(8, viewportWidth - width - 8);\n }\n this.style.setProperty('--fp-top', `${rect.bottom + 4}px`);\n this.style.setProperty('--fp-left', `${left}px`);\n };\n\n /** Switching the open panel to another column moves it under that column. */\n @watch('triggerRect', { waitUntilFirstUpdate: true })\n protected triggerChanged() {\n if (this.active) this.#position();\n }\n\n @watch('active', { waitUntilFirstUpdate: true })\n protected async activeChanged() {\n this.#listenForMoves(this.active);\n if (this.active) {\n this.setAttribute('data-active', '');\n this.#position();\n await this.updateComplete;\n this.input?.select();\n } else {\n this.removeAttribute('data-active');\n this.style.removeProperty('--fp-top');\n this.style.removeProperty('--fp-left');\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 await this.#commit(expression, { criteria: expression.criteria === 'and' ? 'or' : 'and' });\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`<button\n type=\"button\"\n part=\"criteria\"\n @click=${this.#chipCriteriaFor(expr)}\n >\n ${expr.criteria}\n </button>`\n : nothing;\n }\n\n /**\n * Chip text for a term. An array of values (a set filter selection) reads as a list, and a\n * token starting with a NUL character (the set filter's blank token) as the blanks label.\n */\n #termLabel(term: unknown): unknown {\n if (!Array.isArray(term)) return term;\n return term\n .map((value) =>\n typeof value === 'string' && value.startsWith('\\u0000')\n ? this.state.localize('setFilter.blanks')\n : String(value)\n )\n .join(', ');\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 return html`<div\n part=\"expression-chip\"\n ?selected=${props.selected}\n >\n <button\n part=\"chip-body\"\n type=\"button\"\n @click=${props.onSelect}\n >\n ${renderIcon(name)}\n <span>${unary ? name : this.#termLabel(term)}</span>\n </button>\n <button\n part=\"chip-remove\"\n type=\"button\"\n aria-label=${this.state.localize('filter.removeFilter')}\n @click=${props.onRemove}\n >\n ${renderIcon('close')}\n </button>\n </div>`;\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 <button\n id=\"reset\"\n type=\"button\"\n part=\"action\"\n @click=${this.#handleResetClick}\n >\n ${renderIcon('refresh')} ${this.state.localize('filter.reset')}\n </button>\n <button\n id=\"close\"\n type=\"button\"\n part=\"action\"\n @click=${() => {\n this.active = false;\n }}\n >\n ${renderIcon('close')} ${this.state.localize('filter.close')}\n </button>\n `;\n }\n\n protected renderDropdown() {\n return html`<ul\n part=\"dropdown\"\n role=\"listbox\"\n aria-label=${this.state.localize('filter.conditionList')}\n ?hidden=${!this.dropdownOpen}\n @click=${this.#handleDropdownItemClick}\n @keydown=${this.#handleDropdownKeydown}\n >\n ${Object.entries(getFilterOperandsFor(this.column)).map(\n ([key, operand]) => html`\n <li\n part=\"dropdown-item\"\n role=\"option\"\n tabindex=\"-1\"\n data-value=${key}\n aria-selected=${this.condition.name === key}\n ?selected=${this.condition.name === key}\n >\n ${renderIcon(key)}<span\n >${this.state.localize(\n `filter.operator.${key}` as GridLocaleKey,\n undefined,\n operand?.label ?? key\n )}</span\n >\n </li>\n `\n )}\n </ul>`;\n }\n\n protected renderDropdownTarget() {\n const conditionLabel = this.state.localize(\n `filter.operator.${this.condition.name}` as GridLocaleKey,\n undefined,\n (this.condition as FilterOperation<T>).label ?? this.condition.name\n );\n return html`<button\n id=\"condition\"\n type=\"button\"\n part=\"condition-trigger\"\n aria-label=${this.state.localize('filter.changeCondition')}\n aria-haspopup=\"listbox\"\n aria-expanded=${this.dropdownOpen ? 'true' : 'false'}\n @click=${this.#openDropdownList}\n @keydown=${this.#handleTriggerKeydown}\n >\n <span>${conditionLabel}</span>\n ${renderIcon('chevron-down')}\n </button>`;\n }\n\n protected renderActiveState() {\n const hasChips = Boolean(this.filterController.get(this.column.key)?.length);\n return html`\n <div part=\"panel\">\n <div part=\"condition-row\">\n ${this.renderDropdownTarget()}\n ${this.renderDropdown()}\n </div>\n ${\n !this.condition.unary\n ? html`<div part=\"panel-input-row\">\n <input\n part=\"filter-input\"\n type=\"text\"\n .value=${(this.expression?.searchTerm as string) ?? ''}\n placeholder=${this.state.localize('filter.inputPlaceholder')}\n @input=${this.#handleInput}\n @keydown=${this.#handleKeydown}\n />\n </div>`\n : nothing\n }\n ${hasChips ? html`<div part=\"chips-row\">${this.renderActiveChips()}</div>` : nothing}\n <div part=\"panel-footer\">${this.renderFilterActions()}</div>\n </div>\n `;\n }\n\n protected override render() {\n return html`${this.active ? this.renderActiveState() : nothing}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [ApexFilterRow.tagName]: ApexFilterRow<object>;\n }\n}\n"]}
|