apex-grid 3.1.0 → 3.3.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.
Files changed (200) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/README.md +201 -53
  3. package/components/cell.d.ts +14 -1
  4. package/components/cell.js +48 -6
  5. package/components/cell.js.map +1 -1
  6. package/components/filter-row.d.ts +3 -6
  7. package/components/filter-row.js +79 -109
  8. package/components/filter-row.js.map +1 -1
  9. package/components/grid.d.ts +416 -70
  10. package/components/grid.js +398 -11
  11. package/components/grid.js.map +1 -1
  12. package/components/group-header-row.d.ts +34 -0
  13. package/components/group-header-row.js +125 -0
  14. package/components/group-header-row.js.map +1 -0
  15. package/components/header-row.d.ts +13 -2
  16. package/components/header-row.js +33 -18
  17. package/components/header-row.js.map +1 -1
  18. package/components/header.d.ts +11 -0
  19. package/components/header.js +136 -6
  20. package/components/header.js.map +1 -1
  21. package/components/paginator.d.ts +6 -1
  22. package/components/paginator.js +17 -11
  23. package/components/paginator.js.map +1 -1
  24. package/components/row.d.ts +28 -0
  25. package/components/row.js +100 -3
  26. package/components/row.js.map +1 -1
  27. package/components/toolbar.d.ts +8 -1
  28. package/components/toolbar.js +25 -7
  29. package/components/toolbar.js.map +1 -1
  30. package/controllers/data-operation.js +1 -0
  31. package/controllers/data-operation.js.map +1 -1
  32. package/controllers/dom.d.ts +24 -6
  33. package/controllers/dom.js +62 -5
  34. package/controllers/dom.js.map +1 -1
  35. package/controllers/editing.d.ts +68 -1
  36. package/controllers/editing.js +129 -44
  37. package/controllers/editing.js.map +1 -1
  38. package/controllers/filter.d.ts +1 -1
  39. package/controllers/filter.js +16 -5
  40. package/controllers/filter.js.map +1 -1
  41. package/controllers/history.d.ts +86 -0
  42. package/controllers/history.js +118 -0
  43. package/controllers/history.js.map +1 -0
  44. package/controllers/navigation.d.ts +15 -0
  45. package/controllers/navigation.js +53 -0
  46. package/controllers/navigation.js.map +1 -1
  47. package/controllers/reorder.js +3 -1
  48. package/controllers/reorder.js.map +1 -1
  49. package/controllers/row-pin.d.ts +59 -0
  50. package/controllers/row-pin.js +75 -0
  51. package/controllers/row-pin.js.map +1 -0
  52. package/controllers/row-reorder.d.ts +161 -0
  53. package/controllers/row-reorder.js +332 -0
  54. package/controllers/row-reorder.js.map +1 -0
  55. package/controllers/sort.d.ts +1 -1
  56. package/controllers/sort.js +11 -3
  57. package/controllers/sort.js.map +1 -1
  58. package/controllers/state.d.ts +33 -0
  59. package/controllers/state.js +37 -2
  60. package/controllers/state.js.map +1 -1
  61. package/controllers/tree.d.ts +8 -0
  62. package/controllers/tree.js +0 -0
  63. package/controllers/tree.js.map +1 -1
  64. package/custom-elements.json +4415 -875
  65. package/docs/assets/hierarchy.js +1 -1
  66. package/docs/assets/highlight.css +28 -0
  67. package/docs/assets/navigation.js +1 -1
  68. package/docs/assets/search.js +1 -1
  69. package/docs/functions/custom.html +3 -0
  70. package/docs/functions/interpolate.html +4 -0
  71. package/docs/functions/localize.html +8 -0
  72. package/docs/functions/max.html +3 -0
  73. package/docs/functions/min.html +3 -0
  74. package/docs/functions/pattern.html +3 -0
  75. package/docs/functions/required.html +3 -0
  76. package/docs/hierarchy.html +1 -1
  77. package/docs/index.html +185 -55
  78. package/docs/interfaces/ApexCellValidationFailedEvent.html +13 -0
  79. package/docs/interfaces/ApexCellValueChangedEvent.html +1 -1
  80. package/docs/interfaces/ApexCellValueChangingEvent.html +2 -2
  81. package/docs/interfaces/ApexColumnGroupContext.html +6 -0
  82. package/docs/interfaces/ApexColumnMovedEvent.html +2 -2
  83. package/docs/interfaces/ApexColumnMovingEvent.html +1 -1
  84. package/docs/interfaces/ApexDetailContext.html +2 -2
  85. package/docs/interfaces/ApexGridEventMap.html +37 -9
  86. package/docs/interfaces/ApexHistoryChangedEvent.html +6 -0
  87. package/docs/interfaces/ApexPageChangedEvent.html +1 -1
  88. package/docs/interfaces/ApexRowMovingEvent.html +9 -0
  89. package/docs/interfaces/ApexRowPinningEvent.html +8 -0
  90. package/docs/interfaces/ApexStateChangedEvent.html +4 -0
  91. package/docs/interfaces/BaseApexCellContext.html +1 -1
  92. package/docs/interfaces/BaseApexEditorContext.html +1 -1
  93. package/docs/interfaces/BaseColumnConfiguration.html +42 -17
  94. package/docs/interfaces/CSVExportOptions.html +2 -2
  95. package/docs/interfaces/ColumnGroupConfiguration.html +12 -0
  96. package/docs/interfaces/ColumnLayoutState.html +2 -0
  97. package/docs/interfaces/ColumnSchema.html +22 -0
  98. package/docs/interfaces/DataPipelineConfiguration.html +2 -2
  99. package/docs/interfaces/EditingHistoryConfiguration.html +10 -0
  100. package/docs/interfaces/ExportFormat.html +2 -2
  101. package/docs/interfaces/ExportOptions.html +1 -1
  102. package/docs/interfaces/FilterStateSnapshot.html +4 -0
  103. package/docs/interfaces/GetStateOptions.html +4 -0
  104. package/docs/interfaces/GridCapabilities.html +8 -0
  105. package/docs/interfaces/GridEditingConfiguration.html +4 -2
  106. package/docs/interfaces/GridRowPinningConfiguration.html +5 -0
  107. package/docs/interfaces/GridRowReorderingConfiguration.html +22 -0
  108. package/docs/interfaces/GridSchema.html +19 -0
  109. package/docs/interfaces/GridState.html +41 -0
  110. package/docs/interfaces/GridTreeConfiguration.html +2 -2
  111. package/docs/interfaces/PaginationConfiguration.html +1 -1
  112. package/docs/interfaces/PaginationState.html +1 -1
  113. package/docs/interfaces/SetStateOptions.html +9 -0
  114. package/docs/interfaces/SetStateResult.html +11 -0
  115. package/docs/interfaces/SortStateSnapshot.html +2 -0
  116. package/docs/interfaces/ValidatorContext.html +8 -0
  117. package/docs/media/_tokens.scss +131 -44
  118. package/docs/media/package.json +1 -1
  119. package/docs/media/state-persistence.html +189 -0
  120. package/docs/modules.html +1 -1
  121. package/docs/types/DataPipelineParams.html +2 -2
  122. package/docs/types/EditMode.html +2 -2
  123. package/docs/types/GridLocaleKey.html +3 -0
  124. package/docs/types/GridLocaleText.html +5 -0
  125. package/docs/types/LocaleParams.html +2 -0
  126. package/docs/types/PaginationMode.html +1 -1
  127. package/docs/types/RowDropPosition.html +2 -0
  128. package/docs/types/RowPinPosition.html +2 -0
  129. package/docs/types/RowRef.html +3 -0
  130. package/docs/types/Validator.html +4 -0
  131. package/docs/variables/EN_LOCALE.html +9 -0
  132. package/docs/variables/esLocale.html +8 -0
  133. package/i18n/en.d.ts +151 -0
  134. package/i18n/en.js +125 -0
  135. package/i18n/en.js.map +1 -0
  136. package/i18n/es.d.ts +18 -0
  137. package/i18n/es.js +125 -0
  138. package/i18n/es.js.map +1 -0
  139. package/i18n/index.d.ts +3 -0
  140. package/i18n/index.js +4 -0
  141. package/i18n/index.js.map +1 -0
  142. package/i18n/localize.d.ts +23 -0
  143. package/i18n/localize.js +15 -0
  144. package/i18n/localize.js.map +1 -0
  145. package/index.d.ts +8 -2
  146. package/index.js +2 -0
  147. package/index.js.map +1 -1
  148. package/internal/feature-module.d.ts +46 -0
  149. package/internal/feature-module.js +11 -0
  150. package/internal/feature-module.js.map +1 -1
  151. package/internal/flip.js +1 -1
  152. package/internal/flip.js.map +1 -1
  153. package/internal/icons.d.ts +9 -7
  154. package/internal/icons.js +75 -35
  155. package/internal/icons.js.map +1 -1
  156. package/internal/index.d.ts +5 -3
  157. package/internal/index.js +2 -1
  158. package/internal/index.js.map +1 -1
  159. package/internal/state-schema.d.ts +85 -0
  160. package/internal/state-schema.js +27 -0
  161. package/internal/state-schema.js.map +1 -0
  162. package/internal/state-snapshot.d.ts +152 -0
  163. package/internal/state-snapshot.js +115 -0
  164. package/internal/state-snapshot.js.map +1 -0
  165. package/internal/tags.d.ts +1 -0
  166. package/internal/tags.js +1 -0
  167. package/internal/tags.js.map +1 -1
  168. package/internal/types.d.ts +162 -2
  169. package/internal/types.js.map +1 -1
  170. package/internal/utils.d.ts +12 -0
  171. package/internal/utils.js +17 -0
  172. package/internal/utils.js.map +1 -1
  173. package/internal/validators.d.ts +31 -0
  174. package/internal/validators.js +44 -0
  175. package/internal/validators.js.map +1 -0
  176. package/package.json +1 -1
  177. package/styles/_tokens.css.js +1 -1
  178. package/styles/_tokens.css.js.map +1 -1
  179. package/styles/body-cell/body-cell.css.js +1 -1
  180. package/styles/body-cell/body-cell.css.js.map +1 -1
  181. package/styles/body-row/body-row.css.js +1 -1
  182. package/styles/body-row/body-row.css.js.map +1 -1
  183. package/styles/filter-row/filter-row.css.js +1 -1
  184. package/styles/filter-row/filter-row.css.js.map +1 -1
  185. package/styles/grid/_grid.base.css.js +1 -1
  186. package/styles/grid/_grid.base.css.js.map +1 -1
  187. package/styles/grid/grid.css.js +1 -1
  188. package/styles/grid/grid.css.js.map +1 -1
  189. package/styles/group-header-row/group-header-row.css.d.ts +1 -0
  190. package/styles/group-header-row/group-header-row.css.js +3 -0
  191. package/styles/group-header-row/group-header-row.css.js.map +1 -0
  192. package/styles/header-cell/header-cell.css.js +1 -1
  193. package/styles/header-cell/header-cell.css.js.map +1 -1
  194. package/styles/header-row/header-row.base.css.js +1 -1
  195. package/styles/header-row/header-row.base.css.js.map +1 -1
  196. package/styles/paginator/paginator.css.js +1 -1
  197. package/styles/paginator/paginator.css.js.map +1 -1
  198. package/styles/toolbar/toolbar.css.js +1 -1
  199. package/styles/toolbar/toolbar.css.js.map +1 -1
  200. package/docs/classes/ApexGrid.html +0 -393
@@ -4,6 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
+ var _a;
7
8
  import { consume } from '@lit/context';
8
9
  import { html, LitElement } from 'lit';
9
10
  import { property, query } from 'lit/decorators.js';
@@ -12,14 +13,16 @@ import { getColumnTypeRenderer } from '../internal/column-types.js';
12
13
  import { registerComponent } from '../internal/register.js';
13
14
  import { GRID_CELL_TAG } from '../internal/tags.js';
14
15
  import { styles } from '../styles/body-cell/body-cell.css.js';
15
- export default class ApexGridCell extends LitElement {
16
+ class ApexGridCell extends LitElement {
16
17
  constructor() {
17
18
  super(...arguments);
18
19
  this.active = false;
19
20
  this.editing = false;
20
21
  this.colindex = 0;
21
22
  this.decorationVersion = 0;
23
+ this.validationVersion = 0;
22
24
  this.#decoratedKeys = [];
25
+ this.#errors = null;
23
26
  this.#handleClick = (event) => {
24
27
  if (this.isEditing) {
25
28
  event.stopPropagation();
@@ -122,7 +125,7 @@ export default class ApexGridCell extends LitElement {
122
125
  }
123
126
  static { this.styles = styles; }
124
127
  static register() {
125
- registerComponent(ApexGridCell);
128
+ registerComponent(_a);
126
129
  }
127
130
  get context() {
128
131
  const ctx = {
@@ -148,6 +151,8 @@ export default class ApexGridCell extends LitElement {
148
151
  return this.editingController.isEditable(this.column);
149
152
  }
150
153
  #decoratedKeys;
154
+ static #ERROR_ID = 'apex-cell-error';
155
+ #errors;
151
156
  connectedCallback() {
152
157
  super.connectedCallback();
153
158
  this.setAttribute('role', 'gridcell');
@@ -184,8 +189,37 @@ export default class ApexGridCell extends LitElement {
184
189
  else {
185
190
  this.removeAttribute('data-tree-expanded');
186
191
  }
192
+ this.#applyValidation();
187
193
  this.#applyDecoration();
188
194
  }
195
+ #applyValidation() {
196
+ const errors = this.state && this.row?.data
197
+ ? (this.editingController?.getCellErrors(this.row.data, this.column.key) ?? null)
198
+ : null;
199
+ this.#errors = errors && errors.length > 0 ? errors : null;
200
+ if (this.#errors) {
201
+ this.setAttribute('aria-invalid', 'true');
202
+ this.setAttribute('aria-errormessage', _a.#ERROR_ID);
203
+ this.setAttribute('data-invalid', '');
204
+ this.setAttribute('title', this.#errors.join('; '));
205
+ }
206
+ else {
207
+ this.removeAttribute('aria-invalid');
208
+ this.removeAttribute('aria-errormessage');
209
+ this.removeAttribute('data-invalid');
210
+ this.removeAttribute('title');
211
+ }
212
+ }
213
+ renderError() {
214
+ if (!this.#errors)
215
+ return null;
216
+ return html `<span
217
+ part="cell-error"
218
+ id=${_a.#ERROR_ID}
219
+ role="alert"
220
+ >${this.#errors.join('; ')}</span
221
+ >`;
222
+ }
189
223
  #applyDecoration() {
190
224
  const decoration = this.state && this.row
191
225
  ? this.state.decorateCell({
@@ -321,7 +355,7 @@ export default class ApexGridCell extends LitElement {
321
355
  ? html `<button
322
356
  type="button"
323
357
  part="tree-toggle"
324
- aria-label=${expanded ? 'Collapse row' : 'Expand row'}
358
+ aria-label=${expanded ? this.state.localize('row.collapse') : this.state.localize('row.expand')}
325
359
  aria-expanded=${expanded ? 'true' : 'false'}
326
360
  @click=${handleClick}
327
361
  >
@@ -371,16 +405,21 @@ export default class ApexGridCell extends LitElement {
371
405
  return html `${this.resolveDisplayValue()}`;
372
406
  }
373
407
  render() {
408
+ const error = this.renderError();
374
409
  if (this.isEditing) {
375
- return this.renderEditor();
410
+ return html `${this.renderEditor()}${error}`;
376
411
  }
377
412
  const affordance = this.renderTreeAffordance();
378
413
  if (affordance) {
379
- return html `${affordance}<span part="tree-cell-content">${this.renderCellBody()}</span>`;
414
+ return html `${affordance}<span part="tree-cell-content"
415
+ >${this.renderCellBody()}</span
416
+ >${error}`;
380
417
  }
381
- return this.renderCellBody();
418
+ return html `${this.renderCellBody()}${error}`;
382
419
  }
383
420
  }
421
+ _a = ApexGridCell;
422
+ export default ApexGridCell;
384
423
  __decorate([
385
424
  property({ attribute: false })
386
425
  ], ApexGridCell.prototype, "value", void 0);
@@ -406,4 +445,7 @@ __decorate([
406
445
  __decorate([
407
446
  property({ attribute: false, type: Number })
408
447
  ], ApexGridCell.prototype, "decorationVersion", void 0);
448
+ __decorate([
449
+ property({ attribute: false, type: Number })
450
+ ], ApexGridCell.prototype, "validationVersion", void 0);
409
451
  //# sourceMappingURL=cell.js.map
@@ -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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,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAChB","sourcesContent":["import { consume } from '@lit/context';\nimport { html, LitElement } 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 * 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 /** Decoration attribute keys applied on the previous update, for cleanup. */\n #decoratedKeys: string[] = [];\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 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.#applyDecoration();\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() {\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 }\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 #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.#commitWith();\n return;\n case 'Escape':\n event.preventDefault();\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.#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.#cancel();\n return;\n }\n if (event.key === 'Tab') {\n event.preventDefault();\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 this.#pendingValue = this.column.type === 'number' ? target.valueAsNumber : 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=${expanded ? 'Collapse row' : 'Expand row'}\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 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 if (this.isEditing) {\n return this.renderEditor();\n }\n const affordance = this.renderTreeAffordance();\n if (affordance) {\n return html`${affordance}<span part=\"tree-cell-content\">${this.renderCellBody()}</span>`;\n }\n return this.renderCellBody();\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,EAAE,MAAM,KAAK,CAAC;AACvC,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;AAS9D,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,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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 * 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 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() {\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 }\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 #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.#commitWith();\n return;\n case 'Escape':\n event.preventDefault();\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.#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.#cancel();\n return;\n }\n if (event.key === 'Tab') {\n event.preventDefault();\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 this.#pendingValue = this.column.type === 'number' ? target.valueAsNumber : 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 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,7 +1,6 @@
1
1
  import { LitElement, nothing } from 'lit';
2
2
  import { type StateController } from '../controllers/state.js';
3
3
  import type { ColumnConfiguration } from '../internal/types.js';
4
- import type { FilterExpressionTree } from '../operations/filter/tree.js';
5
4
  import type { FilterExpression, FilterOperation } from '../operations/filter/types.js';
6
5
  type ExpressionChipProps<T> = {
7
6
  expression: FilterExpression<T>;
@@ -19,6 +18,8 @@ export default class ApexFilterRow<T extends object> extends LitElement {
19
18
  protected get filterController(): import("../controllers/filter.js").FilterController<T>;
20
19
  protected get condition(): FilterOperation<T>;
21
20
  active: boolean;
21
+ /** Bounding rect of the filter icon that opened this panel. Used for positioning. */
22
+ triggerRect: DOMRect | null;
22
23
  input: HTMLInputElement;
23
24
  conditionElement: HTMLElement;
24
25
  dropdown: HTMLElement;
@@ -27,18 +28,14 @@ export default class ApexFilterRow<T extends object> extends LitElement {
27
28
  expression: FilterExpression<T>;
28
29
  connectedCallback(): void;
29
30
  disconnectedCallback(): void;
30
- protected activeChanged(): void;
31
+ protected activeChanged(): Promise<void>;
31
32
  protected renderCriteriaButton(expr: FilterExpression<T>, index: number): import("lit-html").TemplateResult<1> | typeof nothing;
32
33
  protected renderExpressionChip(props: ExpressionChipProps<T>): import("lit-html").TemplateResult<1>;
33
34
  protected renderActiveChips(): typeof nothing | import("lit-html").TemplateResult<1>[];
34
35
  protected renderFilterActions(): import("lit-html").TemplateResult<1>;
35
36
  protected renderDropdown(): import("lit-html").TemplateResult<1>;
36
37
  protected renderDropdownTarget(): import("lit-html").TemplateResult<1>;
37
- protected renderInputArea(): import("lit-html").TemplateResult<1>;
38
38
  protected renderActiveState(): import("lit-html").TemplateResult<1>;
39
- protected renderInactiveChips(column: ColumnConfiguration<T>, state: FilterExpressionTree<T>): import("lit-html").TemplateResult<1>[];
40
- protected renderFilterState(column: ColumnConfiguration<T>): import("lit-html").TemplateResult<1> | import("lit-html").TemplateResult<1>[];
41
- protected renderInactiveState(): import("lit-html").TemplateResult<1>;
42
39
  protected render(): import("lit-html").TemplateResult<1>;
43
40
  }
44
41
  declare global {
@@ -7,19 +7,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { consume } from '@lit/context';
8
8
  import { html, LitElement, nothing } from 'lit';
9
9
  import { property, query, state } from 'lit/decorators.js';
10
- import { ifDefined } from 'lit/directives/if-defined.js';
11
10
  import { gridStateContext } from '../controllers/state.js';
12
11
  import { DEFAULT_COLUMN_CONFIG } from '../internal/constants.js';
13
12
  import { renderIcon } from '../internal/icons.js';
14
13
  import { registerComponent } from '../internal/register.js';
15
14
  import { GRID_FILTER_ROW_TAG } from '../internal/tags.js';
16
- import { getDisplayColumns, getFilterOperandsFor, getPinEdge } from '../internal/utils.js';
15
+ import { getFilterOperandsFor } from '../internal/utils.js';
17
16
  import { watch } from '../internal/watch.js';
18
17
  import { styles } from '../styles/filter-row/filter-row.css.js';
19
18
  export default class ApexFilterRow extends LitElement {
20
19
  constructor() {
21
20
  super(...arguments);
22
21
  this.active = false;
22
+ this.triggerRect = null;
23
23
  this.dropdownOpen = false;
24
24
  this.column = DEFAULT_COLUMN_CONFIG;
25
25
  this.#handleDropdownItemClick = (event) => {
@@ -33,18 +33,29 @@ export default class ApexFilterRow extends LitElement {
33
33
  this.input?.focus();
34
34
  };
35
35
  this.#handleOutsidePointer = (event) => {
36
- if (!this.dropdownOpen)
37
- return;
38
36
  const path = event.composedPath();
39
- if (path.includes(this.dropdown) || path.includes(this.conditionElement))
37
+ if (this.dropdownOpen) {
38
+ if (!path.includes(this.dropdown) && !path.includes(this.conditionElement)) {
39
+ this.dropdownOpen = false;
40
+ }
40
41
  return;
41
- this.dropdownOpen = false;
42
+ }
43
+ if (this.active && !path.includes(this)) {
44
+ this.active = false;
45
+ }
42
46
  };
43
47
  this.#handleDocumentKey = (event) => {
44
- if (this.dropdownOpen && event.key === 'Escape') {
48
+ if (event.key !== 'Escape')
49
+ return;
50
+ if (this.dropdownOpen) {
45
51
  event.stopPropagation();
46
52
  this.dropdownOpen = false;
47
53
  this.conditionElement?.focus();
54
+ return;
55
+ }
56
+ if (this.active) {
57
+ event.stopPropagation();
58
+ this.active = false;
48
59
  }
49
60
  };
50
61
  this.#openDropdownList = () => {
@@ -73,14 +84,9 @@ export default class ApexFilterRow extends LitElement {
73
84
  #removeExpression(expression) {
74
85
  this.filterController.removeExpression(expression);
75
86
  }
76
- async #show() {
77
- this.active = true;
78
- await this.updateComplete;
79
- this.input?.select();
80
- }
81
87
  #applyCondition(key) {
82
88
  this.expression.condition = getFilterOperandsFor(this.column)[key];
83
- if (this.input.value || this.expression.condition.unary) {
89
+ if (this.input?.value || this.expression.condition.unary) {
84
90
  this.filterController.filterWithEvent(this.expression, 'modify');
85
91
  }
86
92
  this.requestUpdate();
@@ -109,7 +115,8 @@ export default class ApexFilterRow extends LitElement {
109
115
  event.stopPropagation();
110
116
  switch (event.key) {
111
117
  case 'Enter':
112
- this.input.value = '';
118
+ if (this.input)
119
+ this.input.value = '';
113
120
  this.#setDefaultExpression();
114
121
  return;
115
122
  case 'Escape':
@@ -121,13 +128,12 @@ export default class ApexFilterRow extends LitElement {
121
128
  }
122
129
  #handleResetClick() {
123
130
  this.filterController.removeAllExpressions(this.column.key);
131
+ this.#setDefaultExpression();
124
132
  this.requestUpdate();
125
133
  }
126
134
  #openDropdownList;
127
135
  connectedCallback() {
128
136
  super.connectedCallback();
129
- this.setAttribute('role', 'row');
130
- this.setAttribute('aria-rowindex', '2');
131
137
  document.addEventListener('pointerdown', this.#handleOutsidePointer, true);
132
138
  document.addEventListener('keydown', this.#handleDocumentKey, true);
133
139
  }
@@ -136,9 +142,24 @@ export default class ApexFilterRow extends LitElement {
136
142
  document.removeEventListener('keydown', this.#handleDocumentKey, true);
137
143
  super.disconnectedCallback();
138
144
  }
139
- activeChanged() {
140
- this.style.display = this.active ? 'flex' : '';
141
- if (!this.active) {
145
+ async activeChanged() {
146
+ if (this.active && this.triggerRect) {
147
+ const panelWidth = 240;
148
+ const viewportWidth = window.innerWidth;
149
+ let left = this.triggerRect.left;
150
+ if (left + panelWidth > viewportWidth - 8) {
151
+ left = Math.max(8, viewportWidth - panelWidth - 8);
152
+ }
153
+ this.style.setProperty('--fp-top', `${this.triggerRect.bottom + 4}px`);
154
+ this.style.setProperty('--fp-left', `${left}px`);
155
+ this.setAttribute('data-active', '');
156
+ await this.updateComplete;
157
+ this.input?.select();
158
+ }
159
+ else {
160
+ this.removeAttribute('data-active');
161
+ this.style.removeProperty('--fp-top');
162
+ this.style.removeProperty('--fp-left');
142
163
  this.column = DEFAULT_COLUMN_CONFIG;
143
164
  }
144
165
  this.state.host.requestUpdate();
@@ -166,7 +187,7 @@ export default class ApexFilterRow extends LitElement {
166
187
  if (this.active && this.expression === expression) {
167
188
  this.#setDefaultExpression();
168
189
  await this.updateComplete;
169
- this.input.focus();
190
+ this.input?.focus();
170
191
  }
171
192
  this.requestUpdate();
172
193
  };
@@ -200,7 +221,7 @@ export default class ApexFilterRow extends LitElement {
200
221
  <button
201
222
  part="chip-remove"
202
223
  type="button"
203
- aria-label="Remove filter"
224
+ aria-label=${this.state.localize('filter.removeFilter')}
204
225
  @click=${props.onRemove}
205
226
  >
206
227
  ${renderIcon('close')}
@@ -229,7 +250,7 @@ export default class ApexFilterRow extends LitElement {
229
250
  part="action"
230
251
  @click=${this.#handleResetClick}
231
252
  >
232
- ${renderIcon('refresh')} Reset
253
+ ${renderIcon('refresh')} ${this.state.localize('filter.reset')}
233
254
  </button>
234
255
  <button
235
256
  id="close"
@@ -239,7 +260,7 @@ export default class ApexFilterRow extends LitElement {
239
260
  this.active = false;
240
261
  }}
241
262
  >
242
- ${renderIcon('close')} Close
263
+ ${renderIcon('close')} ${this.state.localize('filter.close')}
243
264
  </button>
244
265
  `;
245
266
  }
@@ -247,7 +268,7 @@ export default class ApexFilterRow extends LitElement {
247
268
  return html `<ul
248
269
  part="dropdown"
249
270
  role="listbox"
250
- aria-label="Filter condition"
271
+ aria-label=${this.state.localize('filter.conditionList')}
251
272
  ?hidden=${!this.dropdownOpen}
252
273
  @click=${this.#handleDropdownItemClick}
253
274
  >
@@ -260,109 +281,55 @@ export default class ApexFilterRow extends LitElement {
260
281
  aria-selected=${this.condition.name === key}
261
282
  ?selected=${this.condition.name === key}
262
283
  >
263
- ${renderIcon(key)}<span>${operand?.label ?? key}</span>
284
+ ${renderIcon(key)}<span
285
+ >${this.state.localize(`filter.operator.${key}`, undefined, operand?.label ?? key)}</span
286
+ >
264
287
  </li>
265
288
  `)}
266
289
  </ul>`;
267
290
  }
268
291
  renderDropdownTarget() {
292
+ const conditionLabel = this.state.localize(`filter.operator.${this.condition.name}`, undefined, this.condition.label ?? this.condition.name);
269
293
  return html `<button
270
294
  id="condition"
271
295
  type="button"
272
296
  part="condition-trigger"
273
- aria-label="Change filter condition"
297
+ aria-label=${this.state.localize('filter.changeCondition')}
274
298
  aria-haspopup="listbox"
275
299
  aria-expanded=${this.dropdownOpen ? 'true' : 'false'}
276
300
  @click=${this.#openDropdownList}
277
301
  >
278
- ${renderIcon(this.condition.name)}
302
+ <span>${conditionLabel}</span>
303
+ ${renderIcon('chevron-down')}
279
304
  </button>`;
280
305
  }
281
- renderInputArea() {
282
- return html `<div part="filter-field">
283
- ${this.renderDropdownTarget()}
284
- <input
285
- part="filter-input"
286
- type="text"
287
- .value=${ifDefined(this.expression.searchTerm)}
288
- placeholder="Add filter value"
289
- ?readonly=${this.condition.unary}
290
- @input=${this.#handleInput}
291
- @keydown=${this.#handleKeydown}
292
- />
293
- ${this.renderDropdown()}
294
- </div>`;
295
- }
296
306
  renderActiveState() {
297
- return html `<div part="active-state">
298
- <div part="filter-row-input">${this.renderInputArea()}</div>
299
- <div part="filter-row-filters">${this.renderActiveChips()}</div>
300
- <div part="filter-row-actions">${this.renderFilterActions()}</div>
301
- </div> `;
302
- }
303
- renderInactiveChips(column, state) {
304
- return Array.from(state).map((expression, idx) => {
305
- const props = {
306
- expression,
307
- selected: false,
308
- onRemove: this.#chipRemoveFor(expression),
309
- onSelect: async (e) => {
310
- e.stopPropagation();
311
- this.column = column;
312
- this.expression = expression;
313
- this.#show();
314
- },
315
- };
316
- return html `${this.renderCriteriaButton(expression, idx)}${this.renderExpressionChip(props)}`;
317
- });
318
- }
319
- renderFilterState(column) {
320
- const state = this.filterController.get(column.key);
321
- const partial = state && state.length < 3;
322
- const hidden = state && state.length >= 3;
323
- const open = () => {
324
- this.column = column;
325
- this.#setDefaultExpression();
326
- this.#show();
327
- };
328
- const count = hidden ? html `<span part="filter-chip-count">${state.length}</span>` : nothing;
329
- const chip = html `<button
330
- part="filter-chip"
331
- type="button"
332
- data-column=${column.key}
333
- @click=${open}
334
- >
335
- ${renderIcon('filter')}<span>Filter</span>${count}
336
- </button>`;
337
- return partial ? this.renderInactiveChips(column, state) : chip;
338
- }
339
- renderInactiveState() {
340
- const pinOffsets = this.state.pinOffsets;
341
- const displayColumns = getDisplayColumns(this.state.host.columns);
342
- const selectionPlaceholder = this.state.selection.showCheckboxColumn
343
- ? html `<div part="filter-row-preview" data-pinned="start"></div>`
344
- : nothing;
345
- const expansionPlaceholder = this.state.expansion.showToggleColumn
346
- ? html `<div part="filter-row-preview" data-pinned="start"></div>`
347
- : nothing;
348
- return html `${selectionPlaceholder}${expansionPlaceholder}${displayColumns.map((column, index) => {
349
- if (column.hidden)
350
- return nothing;
351
- const offset = pinOffsets.get(column.key);
352
- const pinStyle = column.pinned && typeof offset === 'number' ? `--apex-pin-offset:${offset}px` : '';
353
- const edge = getPinEdge(displayColumns, index);
354
- return html `<div
355
- part="filter-row-preview"
356
- data-pinned=${column.pinned ?? 'none'}
357
- data-pin-edge=${edge ?? 'none'}
358
- style=${pinStyle}
359
- >
360
- ${column.filter ? this.renderFilterState(column) : nothing}
361
- </div>`;
362
- })}`;
307
+ const hasChips = Boolean(this.filterController.get(this.column.key)?.length);
308
+ return html `
309
+ <div part="panel">
310
+ <div part="condition-row">
311
+ ${this.renderDropdownTarget()}
312
+ ${this.renderDropdown()}
313
+ </div>
314
+ ${!this.condition.unary
315
+ ? html `<div part="panel-input-row">
316
+ <input
317
+ part="filter-input"
318
+ type="text"
319
+ .value=${this.expression?.searchTerm ?? ''}
320
+ placeholder=${this.state.localize('filter.inputPlaceholder')}
321
+ @input=${this.#handleInput}
322
+ @keydown=${this.#handleKeydown}
323
+ />
324
+ </div>`
325
+ : nothing}
326
+ ${hasChips ? html `<div part="chips-row">${this.renderActiveChips()}</div>` : nothing}
327
+ <div part="panel-footer">${this.renderFilterActions()}</div>
328
+ </div>
329
+ `;
363
330
  }
364
331
  render() {
365
- return html `${this.active ? this.renderActiveState() : this.renderInactiveState()}`;
332
+ return html `${this.active ? this.renderActiveState() : nothing}`;
366
333
  }
367
334
  }
368
335
  __decorate([
@@ -372,6 +339,9 @@ __decorate([
372
339
  __decorate([
373
340
  property({ attribute: false })
374
341
  ], ApexFilterRow.prototype, "active", void 0);
342
+ __decorate([
343
+ property({ attribute: false })
344
+ ], ApexFilterRow.prototype, "triggerRect", void 0);
375
345
  __decorate([
376
346
  query('input')
377
347
  ], ApexFilterRow.prototype, "input", void 0);