apex-grid 3.4.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 +439 -0
- package/LICENSE.md +125 -0
- package/README.md +107 -14
- 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 +257 -20
- package/components/grid.js +463 -99
- 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 +19 -9
- package/components/header-row.js.map +1 -1
- package/components/header.js +36 -22
- package/components/header.js.map +1 -1
- package/components/row.d.ts +19 -3
- package/components/row.js +96 -22
- 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 +45 -1
- package/components/virtualizer.js +184 -3
- 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 +68 -13
- package/controllers/navigation.js +196 -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 +42 -24
- 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 +65 -10
- package/controllers/state.js +86 -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 +3589 -452
- 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 +660 -0
- package/docs/classes/ApexGridPaginator.html +36 -0
- package/docs/classes/ApexGridToolbar.html +67 -0
- package/docs/functions/localize.html +2 -2
- package/docs/functions/setup.html +1 -2
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +105 -15
- package/docs/interfaces/ApexCellValidationFailedEvent.html +3 -2
- package/docs/interfaces/ApexCellValueChangedEvent.html +4 -2
- package/docs/interfaces/ApexCellValueChangingEvent.html +3 -2
- package/docs/interfaces/ApexColumnMovedEvent.html +2 -2
- package/docs/interfaces/ApexColumnMovingEvent.html +1 -1
- package/docs/interfaces/ApexDetailContext.html +2 -2
- package/docs/interfaces/ApexGridEventMap.html +9 -6
- 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/BaseColumnConfiguration.html +3 -3
- package/docs/interfaces/BaseFilterExpression.html +2 -2
- package/docs/interfaces/CSVExportOptions.html +13 -5
- package/docs/interfaces/DataPipelineConfiguration.html +2 -2
- package/docs/interfaces/EditingHistoryConfiguration.html +1 -1
- package/docs/interfaces/ExportFormat.html +2 -2
- package/docs/interfaces/ExportOptions.html +5 -3
- package/docs/interfaces/GridExpansionConfiguration.html +6 -2
- package/docs/interfaces/GridRowPinningConfiguration.html +1 -1
- package/docs/interfaces/GridRowReorderingConfiguration.html +2 -2
- package/docs/interfaces/PaginationConfiguration.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 +5 -5
- package/docs/media/state-persistence.html +0 -10
- package/docs/modules.html +1 -1
- package/docs/types/DataPipelineParams.html +2 -2
- package/docs/types/EditMode.html +2 -2
- package/docs/types/ExportSource.html +6 -4
- package/docs/types/GridLocaleText.html +1 -1
- package/docs/types/OperandKeys.html +9 -0
- package/docs/types/PaginationMode.html +1 -1
- package/docs/variables/EN_LOCALE.html +3 -3
- package/docs/variables/esLocale.html +1 -1
- package/i18n/en.d.ts +19 -0
- package/i18n/en.js +19 -0
- package/i18n/en.js.map +1 -1
- package/i18n/es.js +19 -0
- package/i18n/es.js.map +1 -1
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/index.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 +82 -3
- package/internal/feature-module.js +11 -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 +48 -6
- package/internal/utils.js +35 -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 -4
- package/setup.d.ts +23 -11
- package/setup.js +19 -21
- package/setup.js.map +1 -1
- package/styles/_common.css.js +1 -1
- package/styles/_common.css.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 -193
package/controllers/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/controllers/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAKL,eAAe,EACf,wBAAwB,EACxB,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,oBAAoB,GAGrB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;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,eAAe,EAAE,aAAa,EAAE,CAAC;QACtC,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,CAAC;QAChC,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE,CAAC;IAChC,CAAC;CACF;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAuB,qBAAqB,CAAC,CAAC","sourcesContent":["import { createContext } from '@lit/context';\nimport type { ReactiveController } from 'lit';\nimport type { GridLocaleKey, LocaleParams } from '../i18n/index.js';\nimport {\n type CellDecoration,\n type CellDecoratorContext,\n type CellInteraction,\n type GridFeatureModule,\n isCellDecorator,\n isCellInteractionHandler,\n isColumnMenuProvider,\n isRowPresenter,\n isRowTransformer,\n isSerializableModule,\n type PresentedRow,\n type RowPresenterContext,\n} from '../internal/feature-module.js';\nimport type { ActiveNode, GridHost } from '../internal/types.js';\nimport { EditingController } from './editing.js';\nimport { ExpansionController } from './expansion.js';\nimport { FilterController } from './filter.js';\nimport { HistoryController } from './history.js';\nimport { NavigationController } from './navigation.js';\nimport { PaginationController } from './pagination.js';\nimport { ReorderController } from './reorder.js';\nimport { ResizeController } from './resize.js';\nimport { RowPinController } from './row-pin.js';\nimport { RowReorderController } from './row-reorder.js';\nimport { SelectionController } from './selection.js';\nimport { SortController } from './sort.js';\nimport { TreeController } from './tree.js';\n\nexport class StateController<T extends object> implements ReactiveController {\n public sorting!: SortController<T>;\n public filtering!: FilterController<T>;\n public navigation!: NavigationController<T>;\n public resizing!: ResizeController<T>;\n public pagination!: PaginationController<T>;\n public reordering!: ReorderController<T>;\n public editing!: EditingController<T>;\n public history!: HistoryController<T>;\n public selection!: SelectionController<T>;\n public expansion!: ExpansionController<T>;\n public tree!: TreeController<T>;\n public rowPin!: RowPinController<T>;\n public rowReorder!: RowReorderController<T>;\n\n /**\n * Optional feature controllers contributed by {@link GridFeatureModule}s,\n * keyed by module id. Empty for the community `<apex-grid>` element; populated\n * by derived grids (e.g. `@apexcharts/grid-enterprise`) that pass modules to\n * the constructor.\n */\n public readonly modules = new Map<string, ReactiveController>();\n\n /**\n * Current message in the grid's polite live region. Bound by the host's\n * `renderLiveRegion()` template; mutated through {@link setAnnouncement}\n * so screen readers re-announce on every change.\n */\n public announcement = '';\n #announceToken = 0;\n\n /**\n * Updates the polite live region's text. Repeats are forced to fire by\n * appending a zero-width space — screen readers ignore unchanged content,\n * so two identical sort announcements wouldn't otherwise be read aloud.\n */\n public setAnnouncement(message: string): void {\n if (!message) {\n this.announcement = '';\n this.host.requestUpdate();\n return;\n }\n this.#announceToken = (this.#announceToken + 1) % 2;\n this.announcement = this.#announceToken ? message : `${message} `;\n this.host.requestUpdate();\n }\n\n /**\n * Resolves a built-in locale key to its display string, honoring the host\n * grid's {@link ApexGrid.localeText} overrides. Thin proxy to\n * {@link ApexGrid.localize} so components can localize via `this.state`.\n */\n public localize(key: GridLocaleKey, params?: LocaleParams, fallback?: string): string {\n return this.host.localize(key, params, fallback);\n }\n\n public get active() {\n return this.navigation.active;\n }\n\n public set active(node: ActiveNode<T>) {\n this.navigation.active = node;\n }\n\n public get headerRow() {\n // @ts-expect-error - Protected member access\n return this.host.headerRow;\n }\n\n public get scrollContainer() {\n // @ts-expect-error - Protected member access\n return this.host.scrollContainer;\n }\n\n public get paginator() {\n // @ts-expect-error - Protected member access\n return this.host.paginator;\n }\n\n public get toolbar() {\n // @ts-expect-error - Protected member access\n return this.host.toolbar;\n }\n\n /**\n * Cumulative pin offsets (in px) keyed by column key. Populated by the\n * {@link GridDOMController} after each layout.\n */\n public get pinOffsets(): Map<unknown, number> {\n // @ts-expect-error - Protected member access\n const dom = this.host.DOM as { pinOffsets?: Map<unknown, number> } | undefined;\n return dom?.pinOffsets ?? new Map();\n }\n\n constructor(\n public host: GridHost<T>,\n private extraModules: ReadonlyArray<GridFeatureModule<T>> = []\n ) {\n this.host.addController(this);\n this.init();\n }\n\n protected init() {\n this.sorting = new SortController(this.host);\n this.filtering = new FilterController(this.host);\n this.navigation = new NavigationController(this.host);\n this.resizing = new ResizeController(this.host);\n this.pagination = new PaginationController(this.host);\n this.reordering = new ReorderController(this.host);\n this.history = new HistoryController(this.host);\n this.editing = new EditingController(this.host, this.history);\n this.selection = new SelectionController(this.host);\n this.expansion = new ExpansionController(this.host);\n this.tree = new TreeController(this.host);\n this.rowPin = new RowPinController(this.host);\n this.rowReorder = new RowReorderController(this.host);\n\n for (const module of this.extraModules) {\n if (this.modules.has(module.id)) continue;\n this.modules.set(module.id, module.create(this.host, this));\n }\n }\n\n /**\n * Look up a feature controller contributed by a {@link GridFeatureModule},\n * by its module id. Returns `undefined` when no such module is registered.\n */\n public module<C extends ReactiveController>(id: string): C | undefined {\n return this.modules.get(id) as C | undefined;\n }\n\n /**\n * Runs the post-pipeline row transforms contributed by feature modules\n * implementing {@link RowTransformer}, in registration order. Returns the\n * input unchanged when no such module is registered — the community grid path\n * is a no-op pass-through.\n */\n public applyModuleTransforms(rows: T[]): T[] {\n let result = rows;\n for (const controller of this.modules.values()) {\n if (isRowTransformer<T>(controller)) {\n result = controller.processRows(result);\n }\n }\n return result;\n }\n\n /**\n * Asks feature modules implementing {@link RowPresenter} whether they render\n * the given row as full-width custom content (e.g. a group header). Returns\n * the first non-null result, or `null` when no module owns the row.\n */\n public presentRow(row: T, ctx: RowPresenterContext<T>): PresentedRow | null {\n for (const controller of this.modules.values()) {\n if (isRowPresenter<T>(controller)) {\n const presented = controller.presentRow(row, ctx);\n if (presented) return presented;\n }\n }\n return null;\n }\n\n /**\n * Monotonic token bumped by {@link bumpDecoration} whenever module-driven cell\n * decoration changes. Forwarded down to each cell as a reactive property so a\n * decoration-only change (e.g. dragging a selection range) re-renders cells\n * without re-running the data pipeline. Always `0` for the community grid.\n */\n #decorationVersion = 0;\n\n public get decorationVersion(): number {\n return this.#decorationVersion;\n }\n\n /**\n * Signals that {@link CellDecorator} output may have changed. Bumps the\n * {@link decorationVersion} and requests a host update so cells re-run their\n * decoration. Called by feature modules after mutating decoration state.\n */\n public bumpDecoration(): void {\n this.#decorationVersion += 1;\n this.host.requestUpdate();\n }\n\n /**\n * Whether any feature module implementing {@link ColumnMenuProvider} offers a\n * column header menu. The header uses this to show its kebab button even on\n * columns that are neither sortable nor resizable, so a module (the enterprise\n * context menu) can surface pin / hide / group / chart actions. Always `false`\n * for the community grid (no modules).\n */\n public get hasColumnMenu(): boolean {\n for (const controller of this.modules.values()) {\n if (isColumnMenuProvider(controller) && controller.providesColumnMenu()) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Collects per-cell decoration contributed by feature modules implementing\n * {@link CellDecorator}, merging their attribute maps (later modules win on a\n * key clash). Returns `null` when no module decorates the cell — the community\n * grid path, where each cell applies nothing.\n */\n public decorateCell(ctx: CellDecoratorContext<T>): CellDecoration | null {\n let attributes: Record<string, string | null | undefined> | null = null;\n for (const controller of this.modules.values()) {\n if (isCellDecorator<T>(controller)) {\n const decoration = controller.decorateCell(ctx);\n if (decoration) {\n attributes ??= {};\n Object.assign(attributes, decoration.attributes);\n }\n }\n }\n return attributes ? { attributes } : null;\n }\n\n /**\n * Forwards a body-cell pointer interaction to every feature module that\n * implements {@link CellInteractionHandler}. No-op for the community grid\n * (no modules); the grid only calls this when modules are registered.\n */\n public handleCellInteraction(interaction: CellInteraction<T>): void {\n for (const controller of this.modules.values()) {\n if (isCellInteractionHandler<T>(controller)) {\n controller.handleCellInteraction(interaction);\n }\n }\n }\n\n /**\n * Collects per-module snapshot state from feature controllers implementing\n * {@link SerializableModule}, keyed by module id. Returns an empty object for\n * the community grid (no modules). Used by `ApexGrid.getState`.\n */\n public serializeModuleState(): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const [id, controller] of this.modules) {\n if (isSerializableModule(controller)) {\n out[id] = controller.serializeState();\n }\n }\n return out;\n }\n\n /**\n * Dispatches previously-serialized state back to the matching feature modules\n * (by id) that implement {@link SerializableModule}. Missing ids and unknown\n * modules are ignored. Used by `ApexGrid.setState`.\n */\n public restoreModuleState(data: Record<string, unknown> | undefined): void {\n if (!data) return;\n for (const [id, controller] of this.modules) {\n if (isSerializableModule(controller) && Object.hasOwn(data, id)) {\n controller.restoreState(data[id]);\n }\n }\n }\n\n public hostConnected() {}\n\n public hostUpdate(): void {\n this.headerRow?.requestUpdate();\n this.scrollContainer?.requestUpdate();\n this.paginator?.requestUpdate();\n this.toolbar?.requestUpdate();\n }\n}\n\nexport const gridStateContext = createContext<StateController<any>>('gridStateController');\n"]}
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/controllers/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAKL,eAAe,EACf,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,oBAAoB,GAKrB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,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MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACvF,CAAC;IAEM,aAAa,KAAI,CAAC;IAElB,UAAU;QACf,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,CAAC;QAChC,IAAI,CAAC,eAAe,EAAE,aAAa,EAAE,CAAC;QACtC,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,CAAC;QAChC,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE,CAAC;IAChC,CAAC;CACF;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAuB,qBAAqB,CAAC,CAAC","sourcesContent":["import { createContext } from '@lit/context';\nimport type { ReactiveController } from 'lit';\nimport type { GridLocaleKey, LocaleParams } from '../i18n/index.js';\nimport {\n type CellDecoration,\n type CellDecoratorContext,\n type CellInteraction,\n type GridFeatureModule,\n isCellDecorator,\n isCellInteractionHandler,\n isColumnMenuProvider,\n isCoordinateLabeler,\n isRowAriaProvider,\n isRowPresenter,\n isRowTransformer,\n isSerializableModule,\n type PresentedRow,\n type RowAria,\n type RowPresenterContext,\n type RowTransformer,\n} from '../internal/feature-module.js';\nimport type { ActiveNode, ColumnConfiguration, GridHost } from '../internal/types.js';\nimport { isNumericColumn } from '../internal/utils.js';\nimport { EditingController } from './editing.js';\nimport { ExpansionController } from './expansion.js';\nimport { FilterController } from './filter.js';\nimport { HistoryController } from './history.js';\nimport { NavigationController } from './navigation.js';\nimport { PaginationController } from './pagination.js';\nimport { ReorderController } from './reorder.js';\nimport { ResizeController } from './resize.js';\nimport { RowPinController } from './row-pin.js';\nimport { RowReorderController } from './row-reorder.js';\nimport { SelectionController } from './selection.js';\nimport { SortController } from './sort.js';\nimport { TreeController } from './tree.js';\n\nexport class StateController<T extends object> implements ReactiveController {\n public sorting!: SortController<T>;\n public filtering!: FilterController<T>;\n public navigation!: NavigationController<T>;\n public resizing!: ResizeController<T>;\n public pagination!: PaginationController<T>;\n public reordering!: ReorderController<T>;\n public editing!: EditingController<T>;\n public history!: HistoryController<T>;\n public selection!: SelectionController<T>;\n public expansion!: ExpansionController<T>;\n public tree!: TreeController<T>;\n public rowPin!: RowPinController<T>;\n public rowReorder!: RowReorderController<T>;\n\n /**\n * Optional feature controllers contributed by {@link GridFeatureModule}s,\n * keyed by module id. Empty for the community `<apex-grid>` element; populated\n * by derived grids (e.g. `@apexcharts/grid-enterprise`) that pass modules to\n * the constructor.\n */\n public readonly modules = new Map<string, ReactiveController>();\n\n /**\n * Current message in the grid's polite live region. Bound by the host's\n * `renderLiveRegion()` template; mutated through {@link setAnnouncement}\n * so screen readers re-announce on every change.\n */\n public announcement = '';\n #announceToken = 0;\n\n /**\n * Updates the polite live region's text. Repeats are forced to fire by\n * appending a zero-width space — screen readers ignore unchanged content,\n * so two identical sort announcements wouldn't otherwise be read aloud.\n */\n public setAnnouncement(message: string): void {\n if (!message) {\n this.announcement = '';\n this.host.requestUpdate();\n return;\n }\n this.#announceToken = (this.#announceToken + 1) % 2;\n this.announcement = this.#announceToken ? message : `${message} `;\n this.host.requestUpdate();\n }\n\n /**\n * Resolves a built-in locale key to its display string, honoring the host\n * grid's {@link ApexGrid.localeText} overrides. Thin proxy to\n * {@link ApexGrid.localize} so components can localize via `this.state`.\n */\n public localize(key: GridLocaleKey, params?: LocaleParams, fallback?: string): string {\n return this.host.localize(key, params, fallback);\n }\n\n /**\n * Whether `column` holds numbers (`'number'`, `'currency'`, `'rating'`,\n * `'progress'`), so it filters with the number operands and a numeric term.\n * The one numeric-type rule the core filter applies; features that classify\n * columns should read it here rather than keep their own list.\n */\n public isNumericColumn(column: Pick<ColumnConfiguration<T>, 'type'>): boolean {\n return isNumericColumn(column);\n }\n\n public get active() {\n return this.navigation.active;\n }\n\n public set active(node: ActiveNode<T>) {\n this.navigation.active = node;\n }\n\n public get headerRow() {\n // @ts-expect-error - Protected member access\n return this.host.headerRow;\n }\n\n public get scrollContainer() {\n // @ts-expect-error - Protected member access\n return this.host.scrollContainer;\n }\n\n public get paginator() {\n // @ts-expect-error - Protected member access\n return this.host.paginator;\n }\n\n public get toolbar() {\n // @ts-expect-error - Protected member access\n return this.host.toolbar;\n }\n\n /**\n * Cumulative pin offsets (in px) keyed by column key. Populated by the\n * {@link GridDOMController} after each layout.\n */\n public get pinOffsets(): Map<unknown, number> {\n // @ts-expect-error - Protected member access\n const dom = this.host.DOM as { pinOffsets?: Map<unknown, number> } | undefined;\n return dom?.pinOffsets ?? new Map();\n }\n\n constructor(\n public host: GridHost<T>,\n private extraModules: ReadonlyArray<GridFeatureModule<T>> = []\n ) {\n this.host.addController(this);\n this.init();\n }\n\n protected init() {\n this.sorting = new SortController(this.host);\n this.filtering = new FilterController(this.host);\n this.navigation = new NavigationController(this.host);\n this.resizing = new ResizeController(this.host);\n this.pagination = new PaginationController(this.host);\n this.reordering = new ReorderController(this.host);\n this.history = new HistoryController(this.host);\n this.editing = new EditingController(this.host, this.history);\n this.selection = new SelectionController(this.host);\n this.expansion = new ExpansionController(this.host);\n this.tree = new TreeController(this.host);\n this.rowPin = new RowPinController(this.host);\n this.rowReorder = new RowReorderController(this.host);\n\n for (const module of this.extraModules) {\n if (this.modules.has(module.id)) continue;\n this.modules.set(module.id, module.create(this.host, this));\n }\n\n // Resolve the row transforms once, in their declared order. Array sort is\n // stable, so equal (or unset) orders keep registration order.\n if (this.modules.size) {\n const transformers: RowTransformer<T>[] = [];\n for (const controller of this.modules.values()) {\n if (isRowTransformer<T>(controller)) transformers.push(controller);\n }\n transformers.sort((a, b) => (a.transformOrder ?? 0) - (b.transformOrder ?? 0));\n this.#transformers = transformers;\n this.#synthesizers = transformers.filter((t) => typeof t.isSyntheticRow === 'function');\n }\n }\n\n /** {@link RowTransformer}s sorted by `transformOrder`. Empty for the community grid. */\n #transformers: ReadonlyArray<RowTransformer<T>> = [];\n /** The transformers that can synthesize rows. Empty for the community grid. */\n #synthesizers: ReadonlyArray<RowTransformer<T>> = [];\n\n /**\n * Look up a feature controller contributed by a {@link GridFeatureModule},\n * by its module id. Returns `undefined` when no such module is registered.\n */\n public module<C extends ReactiveController>(id: string): C | undefined {\n return this.modules.get(id) as C | undefined;\n }\n\n /**\n * Runs the post-pipeline row transforms contributed by feature modules\n * implementing {@link RowTransformer}, in ascending\n * {@link RowTransformer.transformOrder} (registration order breaks ties).\n * Returns the input unchanged when no such module is registered, so the\n * community grid path is a no-op pass-through.\n */\n public applyModuleTransforms(rows: T[]): T[] {\n let result = rows;\n for (const transformer of this.#transformers) {\n result = transformer.processRows(result);\n }\n return result;\n }\n\n /**\n * Whether `row` is a data record, as opposed to a row a feature module\n * synthesized into the view (a group header, a grand-total row). Every\n * consumer that treats the view as records (selection, export, paste, charts,\n * keyboard actions) should skip rows for which this is `false`. A row is\n * synthetic when any {@link RowTransformer} claims it through\n * {@link RowTransformer.isSyntheticRow}. Always `true` for the community grid,\n * which registers no modules, at the cost of one length check.\n */\n public isDataRow(row: T): boolean {\n for (const transformer of this.#synthesizers) {\n if (transformer.isSyntheticRow!(row)) return false;\n }\n return true;\n }\n\n /**\n * The data records of `rows` (see {@link isDataRow}), in order. Returns `rows`\n * itself, not a copy, when no module synthesizes rows (the community grid).\n */\n public dataRows(rows: ReadonlyArray<T>): ReadonlyArray<T> {\n if (this.#synthesizers.length === 0) return rows;\n return rows.filter((row) => this.isDataRow(row));\n }\n\n /**\n * Every data record `rows` (a view) covers, in order: its data rows plus the\n * records a synthesized row hides through\n * {@link RowTransformer.hiddenRecords} (a collapsed group's leaves). This is\n * what Select all selects and a `'view'` export writes. Returns `rows`\n * itself when no module synthesizes rows (the community grid).\n */\n public viewRecords(rows: ReadonlyArray<T>): ReadonlyArray<T> {\n if (this.#synthesizers.length === 0) return rows;\n const out: T[] = [];\n for (const row of rows) {\n if (this.isDataRow(row)) {\n out.push(row);\n continue;\n }\n for (const transformer of this.#synthesizers) {\n const hidden = transformer.hiddenRecords?.(row);\n if (!hidden?.length) continue;\n // A loop, not push(...hidden): a collapsed group can hold more leaves\n // than the engine accepts as call arguments.\n for (const record of hidden) out.push(record);\n break;\n }\n }\n return out;\n }\n\n /**\n * Asks feature modules implementing {@link RowPresenter} whether they render\n * the given row as full-width custom content (e.g. a group header). Returns\n * the first non-null result, or `null` when no module owns the row.\n */\n public presentRow(row: T, ctx: RowPresenterContext<T>): PresentedRow | null {\n for (const controller of this.modules.values()) {\n if (isRowPresenter<T>(controller)) {\n const presented = controller.presentRow(row, ctx);\n if (presented) return presented;\n }\n }\n return null;\n }\n\n /**\n * Asks feature modules implementing {@link RowAriaProvider} for ARIA\n * tree/expansion semantics on a normal (cell-rendered) row — e.g. pivoting's\n * expandable parent rows. Returns the first non-null result, or `null`.\n */\n public describeRow(row: T, ctx: RowPresenterContext<T>): RowAria | null {\n for (const controller of this.modules.values()) {\n if (isRowAriaProvider<T>(controller)) {\n const aria = controller.describeRow(row, ctx);\n if (aria) return aria;\n }\n }\n return null;\n }\n\n /**\n * The coordinate-hint label a module gives a row ({@link CoordinateLabeler}),\n * `null` for none, or `undefined` when no module labels rows (the gutter then\n * shows the view position). Only asked while `coordinateHints` is on.\n */\n public rowCoordinate(row: T): string | null | undefined {\n for (const controller of this.modules.values()) {\n if (isCoordinateLabeler<T>(controller)) {\n const label = controller.rowCoordinate(row);\n if (label !== undefined) return label;\n }\n }\n return undefined;\n }\n\n /** The coordinate-hint letter a module gives a column; see {@link rowCoordinate}. */\n public columnCoordinate(key: string): string | null | undefined {\n for (const controller of this.modules.values()) {\n if (isCoordinateLabeler<T>(controller)) {\n const label = controller.columnCoordinate(key);\n if (label !== undefined) return label;\n }\n }\n return undefined;\n }\n\n /**\n * Monotonic token bumped by {@link bumpDecoration} whenever module-driven cell\n * decoration changes. Forwarded down to each cell as a reactive property so a\n * decoration-only change (e.g. dragging a selection range) re-decorates cells\n * without re-running the data pipeline. Always `0` for the community grid.\n */\n #decorationVersion = 0;\n\n public get decorationVersion(): number {\n return this.#decorationVersion;\n }\n\n /**\n * Monotonic token the grid bumps once per data pipeline run, forwarded to\n * each body row and cell, so a cell whose output reads more than its own\n * value (a `cellTemplate` reading other row fields, the tree group cell's\n * chevron) re-renders after an edit, a data change or a tree toggle,\n * although its own value binding did not change.\n */\n public dataVersion = 0;\n\n /**\n * Signals that {@link CellDecorator} output may have changed. Bumps the\n * {@link decorationVersion} and requests a host update so cells re-run their\n * decoration. Called by feature modules after mutating decoration state.\n */\n public bumpDecoration(): void {\n this.#decorationVersion += 1;\n this.host.requestUpdate();\n }\n\n /**\n * Whether any feature module implementing {@link ColumnMenuProvider} offers a\n * column header menu. The header uses this to show its kebab button even on\n * columns that are neither sortable nor resizable, so a module (the enterprise\n * context menu) can surface pin / hide / group / chart actions. Always `false`\n * for the community grid (no modules).\n */\n public get hasColumnMenu(): boolean {\n for (const controller of this.modules.values()) {\n if (isColumnMenuProvider(controller) && controller.providesColumnMenu()) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Collects per-cell decoration contributed by feature modules implementing\n * {@link CellDecorator}, merging their attribute maps (later modules win on a\n * key clash). Returns `null` when no module decorates the cell — the community\n * grid path, where each cell applies nothing.\n */\n public decorateCell(ctx: CellDecoratorContext<T>): CellDecoration | null {\n let attributes: Record<string, string | null | undefined> | null = null;\n for (const controller of this.modules.values()) {\n if (isCellDecorator<T>(controller)) {\n const decoration = controller.decorateCell(ctx);\n if (decoration) {\n attributes ??= {};\n Object.assign(attributes, decoration.attributes);\n }\n }\n }\n return attributes ? { attributes } : null;\n }\n\n /**\n * Forwards a body-cell pointer interaction to every feature module that\n * implements {@link CellInteractionHandler}. No-op for the community grid\n * (no modules); the grid only calls this when modules are registered.\n */\n public handleCellInteraction(interaction: CellInteraction<T>): void {\n for (const controller of this.modules.values()) {\n if (isCellInteractionHandler<T>(controller)) {\n controller.handleCellInteraction(interaction);\n }\n }\n }\n\n /**\n * Collects per-module snapshot state from feature controllers implementing\n * {@link SerializableModule}, keyed by module id. Returns an empty object for\n * the community grid (no modules). Used by `ApexGrid.getState`.\n */\n public serializeModuleState(): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const [id, controller] of this.modules) {\n if (isSerializableModule(controller)) {\n out[id] = controller.serializeState();\n }\n }\n return out;\n }\n\n /**\n * Dispatches previously-serialized state back to the matching feature modules\n * (by id) that implement {@link SerializableModule}, in registration order.\n * Returns the ids in `data` that no registered module consumed, so the caller\n * can report them instead of counting them as applied. Used by\n * `ApexGrid.setState`.\n */\n public restoreModuleState(data: Record<string, unknown> | undefined): string[] {\n if (!data) return [];\n for (const [id, controller] of this.modules) {\n if (isSerializableModule(controller) && Object.hasOwn(data, id)) {\n controller.restoreState(data[id]);\n }\n }\n return Object.keys(data).filter((id) => !isSerializableModule(this.modules.get(id)));\n }\n\n public hostConnected() {}\n\n public hostUpdate(): void {\n this.headerRow?.requestUpdate();\n this.scrollContainer?.requestUpdate();\n this.paginator?.requestUpdate();\n this.toolbar?.requestUpdate();\n }\n}\n\nexport const gridStateContext = createContext<StateController<any>>('gridStateController');\n"]}
|
package/controllers/tree.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface TreeRowMeta {
|
|
|
13
13
|
hasChildren: boolean;
|
|
14
14
|
/** Stable key for the row (path-joined string). Useful for keyed reconciliation. */
|
|
15
15
|
key: string;
|
|
16
|
-
/** Last path segment
|
|
16
|
+
/** Last path segment, used as the group-column label for synthesized parents. */
|
|
17
17
|
label: string;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
@@ -21,19 +21,22 @@ export interface TreeRowMeta {
|
|
|
21
21
|
*
|
|
22
22
|
* @remarks
|
|
23
23
|
* Tree mode keeps the data array flat. Each row's hierarchy is derived from a
|
|
24
|
-
* user-supplied `getDataPath` callback
|
|
25
|
-
* controller:
|
|
24
|
+
* user-supplied `getDataPath` callback that returns the row's path from the
|
|
25
|
+
* root (the flat-array "tree data" pattern). The controller:
|
|
26
26
|
*
|
|
27
27
|
* 1. Builds an in-memory tree from the post-sort, post-filter rows.
|
|
28
|
-
* 2. Synthesizes parent nodes for any path level that lacks a backing row
|
|
28
|
+
* 2. Synthesizes parent nodes for any path level that lacks a backing row
|
|
29
|
+
* in the data. A level whose own row was filtered out shows that row.
|
|
29
30
|
* 3. Walks the tree honouring the current expansion set and emits a flat
|
|
30
31
|
* list of rows in display order.
|
|
31
32
|
* 4. Records per-row metadata (depth, hasChildren) that the cell renderer
|
|
32
33
|
* reads to draw the chevron + indentation.
|
|
33
34
|
*
|
|
34
|
-
* Expansion state is split into two sets
|
|
35
|
+
* Expansion state is split into two sets: `expanded` for rows that have
|
|
35
36
|
* backing data (keyed by reference, so it survives sort/filter), and
|
|
36
|
-
* `expandedKeys` for synthesized parents (keyed by their path string).
|
|
37
|
+
* `expandedKeys` for synthesized parents (keyed by their path string). Both
|
|
38
|
+
* follow a data refresh: entries whose row or path left the data are dropped,
|
|
39
|
+
* and `defaultExpanded` applies only to parents not seen before.
|
|
37
40
|
*/
|
|
38
41
|
export declare class TreeController<T extends object> implements ReactiveController {
|
|
39
42
|
#private;
|
|
@@ -42,6 +45,7 @@ export declare class TreeController<T extends object> implements ReactiveControl
|
|
|
42
45
|
expandedKeys: Set<string>;
|
|
43
46
|
constructor(host: GridHost<T>);
|
|
44
47
|
hostConnected(): void;
|
|
48
|
+
hostDisconnected(): void;
|
|
45
49
|
/** Whether tree mode is enabled at the grid level. */
|
|
46
50
|
get enabled(): boolean;
|
|
47
51
|
/** The configured indentation, in pixels, per depth level. */
|
|
@@ -79,7 +83,7 @@ export declare class TreeController<T extends object> implements ReactiveControl
|
|
|
79
83
|
*/
|
|
80
84
|
process(input: ReadonlyArray<T>): T[];
|
|
81
85
|
/**
|
|
82
|
-
* Replaces the expansion state wholesale
|
|
86
|
+
* Replaces the expansion state wholesale. Used by `ApexGrid.setState` to
|
|
83
87
|
* restore a snapshot. Sets both the backing-row set and the synthesized-parent
|
|
84
88
|
* key set directly (no `treeRowExpanding`/`treeRowExpanded` events), marks
|
|
85
89
|
* `defaultExpanded` as already applied so the next pipeline pass treats the
|
|
@@ -87,9 +91,10 @@ export declare class TreeController<T extends object> implements ReactiveControl
|
|
|
87
91
|
*/
|
|
88
92
|
restoreExpansion(expanded: Iterable<T>, expandedKeys: Iterable<string>): void;
|
|
89
93
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
94
|
+
* Reconciles the expansion state with replaced data. Called from the data
|
|
95
|
+
* watcher when the input array is replaced wholesale: expanded rows that
|
|
96
|
+
* left the data are dropped now, stale path keys on the next full build,
|
|
97
|
+
* and the next pass applies `defaultExpanded` to parents not seen before.
|
|
93
98
|
*/
|
|
94
99
|
resetForDataChange(): void;
|
|
95
100
|
}
|
package/controllers/tree.js
CHANGED
|
Binary file
|
package/controllers/tree.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../src/controllers/tree.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAKzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAGtC,MAAM,WAAW,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAkDnD,MAAM,OAAO,cAAc;IAIzB,KAAK,CAAiC;IACtC,cAAc,CAAkC;IAEhD,cAAc,CAAwB;IAEtC,gBAAgB,CAAS;IAEzB,SAAS,CAA4B;IAErC,YAAsB,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;QAZhC,aAAQ,GAAW,IAAI,GAAG,EAAE,CAAC;QAC7B,iBAAY,GAAgB,IAAI,GAAG,EAAE,CAAC;QAE7C,UAAK,GAAG,IAAI,OAAO,EAAkB,CAAC;QACtC,mBAAc,GAAG,IAAI,GAAG,EAAuB,CAAC;QAEhD,mBAAc,GAAG,IAAI,GA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,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE3E,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,kBAAkB,EAAE;YACtD,MAAM,EAAE;gBACN,KAAK;gBACL,OAAO;gBACP,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;gBAClC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;aAC3B;YACD,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;QACH,IAAI,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QAE3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC;QAE7B,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAElC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE;YACrC,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;SAChE,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["import type { ReactiveController } from 'lit';\nimport { PIPELINE } from '../internal/constants.js';\nimport type { GridHost, Keys } from '../internal/types.js';\nimport { getDisplayColumns } from '../internal/utils.js';\n\n/**\n * Default pixel indentation per depth level for the tree group column.\n */\nexport const DEFAULT_TREE_INDENT = 20;\n\n/** Sentinel value used to mark synthesized parents (those that exist only as a path segment, with no backing row). */\nconst SYNTHESIZED = Symbol('synthesized-tree-row');\n\n/**\n * Internal tree node. Built from the flat data + `getDataPath` callback;\n * lives only for the duration of one pipeline pass.\n */\ninterface TreeNode<T extends object> {\n /** The backing row when one exists at this path, else `null` (synthesized parent). */\n data: T | null;\n /** Path segments from root to this node. */\n path: readonly string[];\n /** `path.join('\u0000')` — used as stable string identity for synthesized nodes. */\n key: string;\n depth: number;\n parent: TreeNode<T> | null;\n children: TreeNode<T>[];\n}\n\n/**\n * Tree metadata exposed to renderers. One entry per row that ends up in the\n * flat output.\n */\nexport interface TreeRowMeta {\n depth: number;\n hasChildren: boolean;\n /** Stable key for the row (path-joined string). Useful for keyed reconciliation. */\n key: string;\n /** Last path segment — used as the group-column label for synthesized parents. */\n label: string;\n}\n\n/**\n * Reactive controller backing tree (nested-row) data.\n *\n * @remarks\n * Tree mode keeps the data array flat. Each row's hierarchy is derived from a\n * user-supplied `getDataPath` callback (AG Grid's \"tree data\" pattern). The\n * controller:\n *\n * 1. Builds an in-memory tree from the post-sort, post-filter rows.\n * 2. Synthesizes parent nodes for any path level that lacks a backing row.\n * 3. Walks the tree honouring the current expansion set and emits a flat\n * list of rows in display order.\n * 4. Records per-row metadata (depth, hasChildren) that the cell renderer\n * reads to draw the chevron + indentation.\n *\n * Expansion state is split into two sets — `expanded` for rows that have\n * backing data (keyed by reference, so it survives sort/filter), and\n * `expandedKeys` for synthesized parents (keyed by their path string).\n */\nexport class TreeController<T extends object> implements ReactiveController {\n public expanded: Set<T> = new Set();\n public expandedKeys: Set<string> = new Set();\n\n #meta = new WeakMap<T, TreeRowMeta>();\n #syntheticMeta = new Map<string, TreeRowMeta>();\n /** Synthesized parent placeholder rows so consumers still get a `T`-shaped object. */\n #syntheticRows = new Map<string, T>();\n /** Whether `defaultExpanded` has been applied once for the current data set. */\n #defaultsApplied = false;\n /** Most recently built root node. Used to walk the full tree for expand-all. */\n #lastRoot: TreeNode<T> | null = null;\n\n constructor(protected host: GridHost<T>) {\n this.host.addController(this);\n }\n\n public hostConnected() {}\n\n /** Whether tree mode is enabled at the grid level. */\n public get enabled(): boolean {\n return Boolean(this.host.tree?.enabled && this.host.tree?.getDataPath);\n }\n\n /** The configured indentation, in pixels, per depth level. */\n public get childIndent(): number {\n return this.host.tree?.childIndent ?? DEFAULT_TREE_INDENT;\n }\n\n /**\n * The column key that displays the chevron + indentation. Resolves to the\n * configured `groupColumnKey`, falling back to the first visible data column.\n */\n public get groupColumnKey(): Keys<T> | undefined {\n const configured = this.host.tree?.groupColumnKey;\n if (configured) return configured;\n const displayed = getDisplayColumns(this.host.columns).find((column) => !column.hidden);\n return displayed?.key;\n }\n\n public isGroupColumn(key: Keys<T>): boolean {\n return this.enabled && this.groupColumnKey === key;\n }\n\n /**\n * Per-row metadata. Populated as a side effect of {@link process}; reading\n * before the first pipeline pass returns `undefined`.\n */\n public getMeta(row: T): TreeRowMeta | undefined {\n return this.#meta.get(row);\n }\n\n public getDepth(row: T): number {\n return this.#meta.get(row)?.depth ?? 0;\n }\n\n public hasChildren(row: T): boolean {\n return Boolean(this.#meta.get(row)?.hasChildren);\n }\n\n public isSynthesized(row: T): boolean {\n return (row as { [SYNTHESIZED]?: boolean })[SYNTHESIZED] === true;\n }\n\n /** Group-column label override for synthesized parent rows. */\n public getLabel(row: T): string | null {\n if (!this.isSynthesized(row)) return null;\n return this.#meta.get(row)?.label ?? null;\n }\n\n public isExpanded(row: T): boolean {\n if (this.isSynthesized(row)) {\n const key = this.#meta.get(row)?.key;\n return key ? this.expandedKeys.has(key) : false;\n }\n return this.expanded.has(row);\n }\n\n /** Toggles the expansion state of a tree row. */\n public async toggleRow(row: T): Promise<boolean> {\n if (!this.enabled) return false;\n if (!this.hasChildren(row)) return false;\n const wasExpanded = this.isExpanded(row);\n return wasExpanded ? this.collapseRow(row) : this.expandRow(row);\n }\n\n public async expandRow(row: T): Promise<boolean> {\n if (!this.enabled) return false;\n if (!this.hasChildren(row)) return false;\n if (this.isExpanded(row)) return true;\n return this.#commit((nextData, nextKeys) => {\n if (this.isSynthesized(row)) {\n const key = this.#meta.get(row)?.key;\n if (key) nextKeys.add(key);\n } else {\n nextData.add(row);\n }\n });\n }\n\n public async collapseRow(row: T): Promise<boolean> {\n if (!this.enabled) return false;\n if (!this.isExpanded(row)) return true;\n return this.#commit((nextData, nextKeys) => {\n if (this.isSynthesized(row)) {\n const key = this.#meta.get(row)?.key;\n if (key) nextKeys.delete(key);\n } else {\n nextData.delete(row);\n }\n });\n }\n\n /** Expands every parent in the current tree. */\n public async expandAll(): Promise<boolean> {\n if (!this.enabled) return false;\n const root = this.#lastRoot;\n if (!root) return false;\n return this.#commit((nextData, nextKeys) => {\n const visit = (node: TreeNode<T>) => {\n if (node !== root && node.children.length > 0) {\n if (node.data) nextData.add(node.data);\n else nextKeys.add(node.key);\n }\n for (const child of node.children) visit(child);\n };\n visit(root);\n });\n }\n\n /** Collapses every currently-expanded row. */\n public async collapseAll(): Promise<boolean> {\n if (!this.enabled) return false;\n if (this.expanded.size === 0 && this.expandedKeys.size === 0) return true;\n return this.#commit((nextData, nextKeys) => {\n nextData.clear();\n nextKeys.clear();\n });\n }\n\n /**\n * Pipeline entry point. Called by {@link DataOperationsController.apply}\n * after sort/filter/quickFilter. Builds the tree, applies the configured\n * defaults the first time we see this data, and returns rows in\n * display-order with any synthesized parents inserted.\n */\n public process(input: ReadonlyArray<T>): T[] {\n if (!this.enabled) return input as T[];\n\n const getDataPath = this.host.tree!.getDataPath;\n const root = this.#buildTree(input, getDataPath);\n this.#lastRoot = root;\n\n // Apply defaultExpanded once per data set.\n if (!this.#defaultsApplied) {\n this.#applyDefaults(root);\n this.#defaultsApplied = true;\n }\n\n this.#refreshMeta(root);\n return this.#flatten(root);\n }\n\n /**\n * Replaces the expansion state wholesale — used by `ApexGrid.setState` to\n * restore a snapshot. Sets both the backing-row set and the synthesized-parent\n * key set directly (no `treeRowExpanding`/`treeRowExpanded` events), marks\n * `defaultExpanded` as already applied so the next pipeline pass treats the\n * restored state as authoritative, and re-runs the pipeline.\n */\n public restoreExpansion(expanded: Iterable<T>, expandedKeys: Iterable<string>): void {\n this.expanded = new Set(expanded);\n this.expandedKeys = new Set(expandedKeys);\n this.#defaultsApplied = true;\n this.host.requestUpdate(PIPELINE);\n }\n\n /**\n * Resets cached metadata + defaults flag so the next pipeline pass\n * re-applies `defaultExpanded`. Called from the data watcher when the\n * input array is replaced wholesale.\n */\n public resetForDataChange(): void {\n this.#defaultsApplied = false;\n // Don't clear `expanded`/`expandedKeys`; consumers may want them to\n // survive across pipeline passes. If a wholesale data swap orphans\n // references, those entries are simply ignored on the next pass.\n }\n\n // --- internals ---------------------------------------------------------\n\n #buildTree(rows: ReadonlyArray<T>, getDataPath: (row: T) => readonly string[]): TreeNode<T> {\n const root: TreeNode<T> = {\n data: null,\n path: [],\n key: '',\n depth: -1,\n parent: null,\n children: [],\n };\n const byKey = new Map<string, TreeNode<T>>();\n byKey.set('', root);\n\n for (const row of rows) {\n const fullPath = getDataPath(row);\n if (!fullPath || fullPath.length === 0) continue;\n\n let parent = root;\n for (let i = 0; i < fullPath.length; i++) {\n const sub = fullPath.slice(0, i + 1);\n const key = sub.join('\u0000');\n let node = byKey.get(key);\n if (!node) {\n node = {\n data: null,\n path: sub,\n key,\n depth: i,\n parent,\n children: [],\n };\n byKey.set(key, node);\n parent.children.push(node);\n }\n if (i === fullPath.length - 1) {\n // The terminal segment is the actual record. If we previously\n // saw a child path that synthesized this level, attach the data\n // now.\n node.data = row;\n }\n parent = node;\n }\n }\n\n return root;\n }\n\n #applyDefaults(root: TreeNode<T>): void {\n const setting = this.host.tree?.defaultExpanded;\n if (setting === undefined || setting === false) return;\n const expandToDepth = typeof setting === 'number' ? setting : Number.POSITIVE_INFINITY;\n const visit = (node: TreeNode<T>) => {\n if (node !== root && node.children.length > 0 && node.depth <= expandToDepth) {\n if (node.data) this.expanded.add(node.data);\n else this.expandedKeys.add(node.key);\n }\n for (const child of node.children) visit(child);\n };\n visit(root);\n }\n\n #refreshMeta(root: TreeNode<T>): void {\n // Recompute meta for every node in the tree, both synthesized and\n // backed. The metadata is fresh each pipeline pass since depth or\n // hasChildren may have changed (rows reordered, filter dropped a\n // descendant, etc.).\n const visit = (node: TreeNode<T>) => {\n if (node !== root) {\n const meta: TreeRowMeta = {\n depth: node.depth,\n hasChildren: node.children.length > 0,\n key: node.key,\n label: node.path[node.path.length - 1] ?? '',\n };\n if (node.data) {\n this.#meta.set(node.data, meta);\n } else {\n this.#syntheticMeta.set(node.key, meta);\n }\n }\n for (const child of node.children) visit(child);\n };\n visit(root);\n }\n\n #flatten(root: TreeNode<T>): T[] {\n const out: T[] = [];\n const walk = (node: TreeNode<T>) => {\n if (node !== root) {\n if (node.data) {\n out.push(node.data);\n } else {\n // Synthesize a `T`-shaped placeholder so callers don't trip on\n // `null` rows. The placeholder carries the SYNTHESIZED marker.\n let placeholder = this.#syntheticRows.get(node.key);\n if (!placeholder) {\n placeholder = Object.create(null) as T;\n Object.defineProperty(placeholder, SYNTHESIZED, {\n value: true,\n enumerable: false,\n });\n this.#syntheticRows.set(node.key, placeholder);\n }\n this.#meta.set(placeholder, this.#syntheticMeta.get(node.key)!);\n out.push(placeholder);\n }\n }\n const expanded =\n node === root ||\n (node.data ? this.expanded.has(node.data) : this.expandedKeys.has(node.key));\n if (expanded) {\n for (const child of node.children) walk(child);\n }\n };\n walk(root);\n return out;\n }\n\n async #commit(mutate: (nextData: Set<T>, nextKeys: Set<string>) => void): Promise<boolean> {\n const nextData = new Set(this.expanded);\n const nextKeys = new Set(this.expandedKeys);\n mutate(nextData, nextKeys);\n\n const dataChanged =\n nextData.size !== this.expanded.size || [...nextData].some((row) => !this.expanded.has(row));\n const keysChanged =\n nextKeys.size !== this.expandedKeys.size ||\n [...nextKeys].some((key) => !this.expandedKeys.has(key));\n if (!dataChanged && !keysChanged) return true;\n\n const added: T[] = [];\n const removed: T[] = [];\n for (const row of nextData) if (!this.expanded.has(row)) added.push(row);\n for (const row of this.expanded) if (!nextData.has(row)) removed.push(row);\n\n const proceed = this.host.emitEvent('treeRowExpanding', {\n detail: {\n added,\n removed,\n current: Array.from(this.expanded),\n next: Array.from(nextData),\n },\n cancelable: true,\n });\n if (!proceed) return false;\n\n this.expanded = nextData;\n this.expandedKeys = nextKeys;\n // Re-run the pipeline so the flat output reflects the new expansion set.\n this.host.requestUpdate(PIPELINE);\n\n this.host.emitEvent('treeRowExpanded', {\n detail: { added, removed, expanded: Array.from(this.expanded) },\n });\n return true;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../src/controllers/tree.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAK/C,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAGtC,MAAM,WAAW,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAGnD,MAAM,cAAc,GAAG,IAAI,CAAC;AA6D5B,MAAM,OAAO,cAAc;IAIzB,KAAK,CAAiC;IAEtC,cAAc,CAAwB;IAEtC,gBAAgB,CAAS;IAEzB,YAAY,CAAoB;IAChC,SAAS,CAAqB;IAE9B,iBAAiB,CAAS;IAE1B,SAAS,CAA4B;IAErC,QAAQ,CAA+B;IAEvC,YAAsB,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;QAlBhC,aAAQ,GAAW,IAAI,GAAG,EAAE,CAAC;QAC7B,iBAAY,GAAgB,IAAI,GAAG,EAAE,CAAC;QAE7C,UAAK,GAAG,IAAI,OAAO,EAAkB,CAAC;QAEtC,mBAAc,GAAG,IAAI,GAAG,EAAa,CAAC;QAEtC,qBAAgB,GAAG,KAAK,CAAC;QAEzB,iBAAY,GAAG,IAAI,OAAO,EAAK,CAAC;QAChC,cAAS,GAAG,IAAI,GAAG,EAAU,CAAC;QAE9B,sBAAiB,GAAG,KAAK,CAAC;QAE1B,cAAS,GAAuB,IAAI,CAAC;QAErC,aAAQ,GAA0B,IAAI,CAAC;QAevC,iBAAY,GAAG,GAAG,EAAE;YAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACvB,CAAC,CAAC;QAdA,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E,IAAI,CAAC,YAAY,CAAC;gBACvD,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC;aACvC;YACD,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;QACH,IAAI,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QAE3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC;QAE7B,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAElC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE;YACrC,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,EAAE;SACrF,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["import type { ReactiveController } from 'lit';\nimport { PIPELINE } from '../internal/constants.js';\nimport type { GridHost, Keys } from '../internal/types.js';\nimport { getDisplayColumns } from '../internal/utils.js';\nimport { retainPresent } from './expansion.js';\n\n/**\n * Default pixel indentation per depth level for the tree group column.\n */\nexport const DEFAULT_TREE_INDENT = 20;\n\n/** Sentinel value used to mark synthesized parents (those that exist only as a path segment, with no backing row). */\nconst SYNTHESIZED = Symbol('synthesized-tree-row');\n\n/** Joins path segments into a node key; a character no segment is expected to hold. */\nconst PATH_SEPARATOR = '\\0';\n\n/**\n * Internal tree node. Built from the flat data + `getDataPath` callback;\n * lives only for the duration of one pipeline pass.\n */\ninterface TreeNode<T extends object> {\n /** The backing row when one exists at this path, else `null` (synthesized parent). */\n data: T | null;\n /** Path segments from root to this node. */\n path: readonly string[];\n /** `path.join(PATH_SEPARATOR)`, the stable string identity for synthesized nodes. */\n key: string;\n depth: number;\n parent: TreeNode<T> | null;\n children: TreeNode<T>[];\n}\n\n/** Path key to record lookup over one data array, valid while that array is unchanged. */\ninterface RecordIndex<T extends object> {\n data: ReadonlyArray<T>;\n length: number;\n getDataPath: (row: T) => readonly string[];\n byKey: Map<string, T>;\n}\n\n/**\n * Tree metadata exposed to renderers. One entry per row that ends up in the\n * flat output.\n */\nexport interface TreeRowMeta {\n depth: number;\n hasChildren: boolean;\n /** Stable key for the row (path-joined string). Useful for keyed reconciliation. */\n key: string;\n /** Last path segment, used as the group-column label for synthesized parents. */\n label: string;\n}\n\n/**\n * Reactive controller backing tree (nested-row) data.\n *\n * @remarks\n * Tree mode keeps the data array flat. Each row's hierarchy is derived from a\n * user-supplied `getDataPath` callback that returns the row's path from the\n * root (the flat-array \"tree data\" pattern). The controller:\n *\n * 1. Builds an in-memory tree from the post-sort, post-filter rows.\n * 2. Synthesizes parent nodes for any path level that lacks a backing row\n * in the data. A level whose own row was filtered out shows that row.\n * 3. Walks the tree honouring the current expansion set and emits a flat\n * list of rows in display order.\n * 4. Records per-row metadata (depth, hasChildren) that the cell renderer\n * reads to draw the chevron + indentation.\n *\n * Expansion state is split into two sets: `expanded` for rows that have\n * backing data (keyed by reference, so it survives sort/filter), and\n * `expandedKeys` for synthesized parents (keyed by their path string). Both\n * follow a data refresh: entries whose row or path left the data are dropped,\n * and `defaultExpanded` applies only to parents not seen before.\n */\nexport class TreeController<T extends object> implements ReactiveController {\n public expanded: Set<T> = new Set();\n public expandedKeys: Set<string> = new Set();\n\n #meta = new WeakMap<T, TreeRowMeta>();\n /** Synthesized parent placeholder rows so consumers still get a `T`-shaped object. */\n #syntheticRows = new Map<string, T>();\n /** Whether `defaultExpanded` has been applied once for the current data set. */\n #defaultsApplied = false;\n /** Parents `defaultExpanded` has already been weighed for, by row and by path. */\n #seenParents = new WeakSet<T>();\n #seenKeys = new Set<string>();\n /** Set on a data change: the next build over the whole data prunes stale path keys. */\n #reconcilePending = false;\n /** Most recently built root node. Used to walk the full tree for expand-all. */\n #lastRoot: TreeNode<T> | null = null;\n /** The first record per path key in `host.data`, built once per data array when needed. */\n #records: RecordIndex<T> | null = null;\n\n constructor(protected host: GridHost<T>) {\n this.host.addController(this);\n }\n\n public hostConnected() {\n this.host.addEventListener('cellValueChanged', this.#dropRecords);\n }\n\n public hostDisconnected() {\n this.host.removeEventListener('cellValueChanged', this.#dropRecords);\n }\n\n /** An edit writes through to the record in place and may change its path. */\n #dropRecords = () => {\n this.#records = null;\n };\n\n /** Whether tree mode is enabled at the grid level. */\n public get enabled(): boolean {\n return Boolean(this.host.tree?.enabled && this.host.tree?.getDataPath);\n }\n\n /** The configured indentation, in pixels, per depth level. */\n public get childIndent(): number {\n return this.host.tree?.childIndent ?? DEFAULT_TREE_INDENT;\n }\n\n /**\n * The column key that displays the chevron + indentation. Resolves to the\n * configured `groupColumnKey`, falling back to the first visible data column.\n */\n public get groupColumnKey(): Keys<T> | undefined {\n const configured = this.host.tree?.groupColumnKey;\n if (configured) return configured;\n const displayed = getDisplayColumns(this.host.columns).find((column) => !column.hidden);\n return displayed?.key;\n }\n\n public isGroupColumn(key: Keys<T>): boolean {\n return this.enabled && this.groupColumnKey === key;\n }\n\n /**\n * Per-row metadata. Populated as a side effect of {@link process}; reading\n * before the first pipeline pass returns `undefined`.\n */\n public getMeta(row: T): TreeRowMeta | undefined {\n return this.#meta.get(row);\n }\n\n public getDepth(row: T): number {\n return this.#meta.get(row)?.depth ?? 0;\n }\n\n public hasChildren(row: T): boolean {\n return Boolean(this.#meta.get(row)?.hasChildren);\n }\n\n public isSynthesized(row: T): boolean {\n return (row as { [SYNTHESIZED]?: boolean })[SYNTHESIZED] === true;\n }\n\n /** Group-column label override for synthesized parent rows. */\n public getLabel(row: T): string | null {\n if (!this.isSynthesized(row)) return null;\n return this.#meta.get(row)?.label ?? null;\n }\n\n public isExpanded(row: T): boolean {\n if (this.isSynthesized(row)) {\n const key = this.#meta.get(row)?.key;\n return key ? this.expandedKeys.has(key) : false;\n }\n return this.expanded.has(row);\n }\n\n /** Toggles the expansion state of a tree row. */\n public async toggleRow(row: T): Promise<boolean> {\n if (!this.enabled) return false;\n if (!this.hasChildren(row)) return false;\n const wasExpanded = this.isExpanded(row);\n return wasExpanded ? this.collapseRow(row) : this.expandRow(row);\n }\n\n public async expandRow(row: T): Promise<boolean> {\n if (!this.enabled) return false;\n if (!this.hasChildren(row)) return false;\n if (this.isExpanded(row)) return true;\n return this.#commit((nextData, nextKeys) => {\n if (this.isSynthesized(row)) {\n const key = this.#meta.get(row)?.key;\n if (key) nextKeys.add(key);\n } else {\n nextData.add(row);\n }\n });\n }\n\n public async collapseRow(row: T): Promise<boolean> {\n if (!this.enabled) return false;\n if (!this.isExpanded(row)) return true;\n return this.#commit((nextData, nextKeys) => {\n if (this.isSynthesized(row)) {\n const key = this.#meta.get(row)?.key;\n if (key) nextKeys.delete(key);\n } else {\n nextData.delete(row);\n }\n });\n }\n\n /** Expands every parent in the current tree. */\n public async expandAll(): Promise<boolean> {\n if (!this.enabled) return false;\n const root = this.#lastRoot;\n if (!root) return false;\n return this.#commit((nextData, nextKeys) => {\n const visit = (node: TreeNode<T>) => {\n if (node !== root && node.children.length > 0) {\n if (node.data) nextData.add(node.data);\n else nextKeys.add(node.key);\n }\n for (const child of node.children) visit(child);\n };\n visit(root);\n });\n }\n\n /** Collapses every currently-expanded row. */\n public async collapseAll(): Promise<boolean> {\n if (!this.enabled) return false;\n if (this.expanded.size === 0 && this.expandedKeys.size === 0) return true;\n return this.#commit((nextData, nextKeys) => {\n nextData.clear();\n nextKeys.clear();\n });\n }\n\n /**\n * Pipeline entry point. Called by {@link DataOperationsController.apply}\n * after sort/filter/quickFilter. Builds the tree, applies the configured\n * defaults the first time we see this data, and returns rows in\n * display-order with any synthesized parents inserted.\n */\n public process(input: ReadonlyArray<T>): T[] {\n if (!this.enabled) return input as T[];\n\n const getDataPath = this.host.tree!.getDataPath;\n const root = this.#buildTree(input, getDataPath);\n this.#lastRoot = root;\n\n // Apply defaultExpanded once per data set, to parents not seen before.\n const applyDefaults = !this.#defaultsApplied;\n this.#defaultsApplied = true;\n // Only a build over the whole data knows which path keys are gone.\n const reconcile = this.#reconcilePending && input.length >= (this.host.data?.length ?? 0);\n if (reconcile) this.#reconcilePending = false;\n\n this.#refreshMeta(root, applyDefaults, reconcile);\n return this.#flatten(root);\n }\n\n /**\n * Replaces the expansion state wholesale. Used by `ApexGrid.setState` to\n * restore a snapshot. Sets both the backing-row set and the synthesized-parent\n * key set directly (no `treeRowExpanding`/`treeRowExpanded` events), marks\n * `defaultExpanded` as already applied so the next pipeline pass treats the\n * restored state as authoritative, and re-runs the pipeline.\n */\n public restoreExpansion(expanded: Iterable<T>, expandedKeys: Iterable<string>): void {\n this.expanded = new Set(expanded);\n this.expandedKeys = new Set(expandedKeys);\n this.#defaultsApplied = true;\n this.host.requestUpdate(PIPELINE);\n }\n\n /**\n * Reconciles the expansion state with replaced data. Called from the data\n * watcher when the input array is replaced wholesale: expanded rows that\n * left the data are dropped now, stale path keys on the next full build,\n * and the next pass applies `defaultExpanded` to parents not seen before.\n */\n public resetForDataChange(): void {\n this.#defaultsApplied = false;\n this.#reconcilePending = true;\n this.#records = null;\n this.expanded = retainPresent(this.expanded, this.host.data ?? []);\n }\n\n // --- internals ---------------------------------------------------------\n\n #buildTree(rows: ReadonlyArray<T>, getDataPath: (row: T) => readonly string[]): TreeNode<T> {\n const root: TreeNode<T> = {\n data: null,\n path: [],\n key: '',\n depth: -1,\n parent: null,\n children: [],\n };\n const byKey = new Map<string, TreeNode<T>>();\n byKey.set('', root);\n /** Twins made so far per node; twins stay out of `byKey`, so no path resolves to one. */\n const twins = new Map<TreeNode<T>, number>();\n /** Levels first reached as an ancestor, which may still lack a record. */\n const intermediate: TreeNode<T>[] = [];\n\n for (const row of rows) {\n const fullPath = getDataPath(row);\n if (!fullPath || fullPath.length === 0) continue;\n\n let parent = root;\n for (let i = 0; i < fullPath.length; i++) {\n const sub = fullPath.slice(0, i + 1);\n const key = sub.join(PATH_SEPARATOR);\n let node = byKey.get(key);\n if (!node) {\n node = {\n data: null,\n path: sub,\n key,\n depth: i,\n parent,\n children: [],\n };\n byKey.set(key, node);\n parent.children.push(node);\n if (i < fullPath.length - 1) intermediate.push(node);\n }\n if (i === fullPath.length - 1) {\n // The terminal segment is the actual record. If we previously\n // saw a child path that synthesized this level, attach the data\n // now. A second row with the same path gets a sibling node, so\n // no row is dropped.\n if (node.data && node.data !== row) this.#addTwin(node, row, twins, getDataPath);\n else node.data = row;\n }\n parent = node;\n }\n }\n\n this.#adoptFilteredAncestors(rows, intermediate, getDataPath);\n return root;\n }\n\n /**\n * Adds a sibling of `node` for another row that returns the same path, so\n * no row is dropped. The earliest of those rows in `host.data` keeps the\n * path node and its descendants whatever the sort order, so sorting never\n * moves children between them; the others sit next to it in sort order.\n */\n #addTwin(\n node: TreeNode<T>,\n row: T,\n twins: Map<TreeNode<T>, number>,\n getDataPath: (row: T) => readonly string[]\n ): void {\n const n = (twins.get(node) ?? 0) + 1;\n twins.set(node, n);\n const twin: TreeNode<T> = {\n ...node,\n data: row,\n key: `${node.key}${PATH_SEPARATOR}${PATH_SEPARATOR}${n}`,\n children: [],\n };\n const siblings = node.parent!.children;\n siblings.push(twin);\n if (this.#recordAt(node.key, getDataPath) === row) {\n // The owner arrived after a later duplicate: it takes the path node,\n // and the twin takes the slot the duplicate was sorted into.\n twin.data = node.data;\n node.data = row;\n siblings[siblings.indexOf(node)] = twin;\n siblings[siblings.length - 1] = node;\n }\n }\n\n /**\n * Gives an ancestor level its own record when a filter removed that record\n * but kept a descendant. Otherwise the ancestor renders as a blank\n * placeholder with an expansion state of its own, so the match sits under a\n * collapsed level the user had opened. Runs only when the input is a\n * filtered subset of the data and some ancestor level lacks a record; the\n * lookup costs one pass over the data per data array (and after a cell\n * edit), then a map hit per level, so filter keystrokes and expand clicks\n * stay O(visible).\n */\n #adoptFilteredAncestors(\n rows: ReadonlyArray<T>,\n intermediate: ReadonlyArray<TreeNode<T>>,\n getDataPath: (row: T) => readonly string[]\n ): void {\n if ((this.host.data?.length ?? 0) <= rows.length) return;\n for (const node of intermediate) {\n if (!node.data) node.data = this.#recordAt(node.key, getDataPath) ?? null;\n }\n }\n\n /**\n * The first record in `host.data` whose path joins to `key`. A hit is\n * checked against the record's current path, since a path can change in\n * place without a new data array; a stale hit rebuilds the index once.\n */\n #recordAt(key: string, getDataPath: (row: T) => readonly string[]): T | undefined {\n const record = this.#recordsByKey(getDataPath).get(key);\n if (!record || getDataPath(record)?.join(PATH_SEPARATOR) === key) return record;\n this.#records = null;\n return this.#recordsByKey(getDataPath).get(key);\n }\n\n /**\n * The first record per path key in `host.data`. Built on first use and\n * kept while the data array, its length and `getDataPath` are unchanged\n * and no cell edit was applied.\n */\n #recordsByKey(getDataPath: (row: T) => readonly string[]): Map<string, T> {\n const data = this.host.data ?? [];\n const cached = this.#records;\n if (\n cached?.data === data &&\n cached.length === data.length &&\n cached.getDataPath === getDataPath\n ) {\n return cached.byKey;\n }\n const byKey = new Map<string, T>();\n for (const row of data) {\n const path = getDataPath(row);\n if (!path?.length) continue;\n const key = path.join(PATH_SEPARATOR);\n if (!byKey.has(key)) byKey.set(key, row);\n }\n this.#records = { data, length: data.length, getDataPath, byKey };\n return byKey;\n }\n\n /**\n * Records fresh metadata for every node, both synthesized and backed, since\n * depth or hasChildren may change between passes (rows reordered, a filter\n * dropped a descendant). The same walk weighs `defaultExpanded` for parents\n * seen for the first time and, on a reconciling pass, drops the path keys\n * and placeholders of synthesized parents that left the data.\n */\n #refreshMeta(root: TreeNode<T>, applyDefaults: boolean, reconcile: boolean): void {\n const setting = applyDefaults ? this.host.tree?.defaultExpanded : undefined;\n const expandToDepth =\n setting === true ? Number.POSITIVE_INFINITY : typeof setting === 'number' ? setting : -1;\n const liveKeys = reconcile ? new Set<string>() : null;\n const visit = (node: TreeNode<T>) => {\n if (node !== root) {\n const meta: TreeRowMeta = {\n depth: node.depth,\n hasChildren: node.children.length > 0,\n key: node.key,\n label: node.path[node.path.length - 1] ?? '',\n };\n if (node.data) {\n this.#meta.set(node.data, meta);\n if (meta.hasChildren && !this.#seenParents.has(node.data)) {\n this.#seenParents.add(node.data);\n if (node.depth <= expandToDepth) this.expanded.add(node.data);\n }\n } else {\n this.#meta.set(this.#placeholder(node.key), meta);\n liveKeys?.add(node.key);\n if (!this.#seenKeys.has(node.key)) {\n this.#seenKeys.add(node.key);\n if (node.depth <= expandToDepth) this.expandedKeys.add(node.key);\n }\n }\n }\n for (const child of node.children) visit(child);\n };\n visit(root);\n\n if (liveKeys) {\n for (const key of this.expandedKeys) if (!liveKeys.has(key)) this.expandedKeys.delete(key);\n for (const key of this.#seenKeys) if (!liveKeys.has(key)) this.#seenKeys.delete(key);\n for (const key of this.#syntheticRows.keys()) {\n if (!liveKeys.has(key)) this.#syntheticRows.delete(key);\n }\n }\n }\n\n /**\n * The placeholder row of a synthesized parent, stable per path so callers\n * can hold on to it. It carries the SYNTHESIZED marker.\n */\n #placeholder(key: string): T {\n let placeholder = this.#syntheticRows.get(key);\n if (!placeholder) {\n placeholder = Object.create(null) as T;\n Object.defineProperty(placeholder, SYNTHESIZED, { value: true, enumerable: false });\n this.#syntheticRows.set(key, placeholder);\n }\n return placeholder;\n }\n\n #flatten(root: TreeNode<T>): T[] {\n const out: T[] = [];\n const walk = (node: TreeNode<T>) => {\n if (node !== root) out.push(node.data ?? this.#placeholder(node.key));\n const expanded =\n node === root ||\n (node.data ? this.expanded.has(node.data) : this.expandedKeys.has(node.key));\n if (expanded) {\n for (const child of node.children) walk(child);\n }\n };\n walk(root);\n return out;\n }\n\n /** Rows for an event payload: backed rows, then the placeholders of `keys`. */\n #rowsOf(rows: Iterable<T>, keys: Iterable<string>): T[] {\n const out = Array.from(rows);\n for (const key of keys) {\n const placeholder = this.#syntheticRows.get(key);\n if (placeholder) out.push(placeholder);\n }\n return out;\n }\n\n async #commit(mutate: (nextData: Set<T>, nextKeys: Set<string>) => void): Promise<boolean> {\n const nextData = new Set(this.expanded);\n const nextKeys = new Set(this.expandedKeys);\n mutate(nextData, nextKeys);\n\n const addedRows = [...nextData].filter((row) => !this.expanded.has(row));\n const removedRows = [...this.expanded].filter((row) => !nextData.has(row));\n const addedKeys = [...nextKeys].filter((key) => !this.expandedKeys.has(key));\n const removedKeys = [...this.expandedKeys].filter((key) => !nextKeys.has(key));\n if (!addedRows.length && !removedRows.length && !addedKeys.length && !removedKeys.length) {\n return true;\n }\n\n // Synthesized parents appear in the payload as their placeholder rows,\n // the same objects pageItems holds, so listeners can tell them apart.\n const added = this.#rowsOf(addedRows, addedKeys);\n const removed = this.#rowsOf(removedRows, removedKeys);\n\n const proceed = this.host.emitEvent('treeRowExpanding', {\n detail: {\n added,\n removed,\n current: this.#rowsOf(this.expanded, this.expandedKeys),\n next: this.#rowsOf(nextData, nextKeys),\n },\n cancelable: true,\n });\n if (!proceed) return false;\n\n this.expanded = nextData;\n this.expandedKeys = nextKeys;\n // Re-run the pipeline so the flat output reflects the new expansion set.\n this.host.requestUpdate(PIPELINE);\n\n this.host.emitEvent('treeRowExpanded', {\n detail: { added, removed, expanded: this.#rowsOf(this.expanded, this.expandedKeys) },\n });\n return true;\n }\n}\n"]}
|