{"version":3,"file":"pebula-ngrid-detail-row.mjs","sources":["../../../../libs/ngrid/detail-row/src/lib/detail-row/tokens.ts","../../../../libs/ngrid/detail-row/src/lib/detail-row/row.ts","../../../../libs/ngrid/detail-row/src/lib/detail-row/directives.ts","../../../../libs/ngrid/detail-row/src/lib/detail-row/detail-row-controller.ts","../../../../libs/ngrid/detail-row/src/lib/detail-row/detail-row-plugin.ts","../../../../libs/ngrid/detail-row/src/lib/table-detail-row.module.ts","../../../../libs/ngrid/detail-row/src/pebula-ngrid-detail-row.ts"],"sourcesContent":["export interface PblDetailsRowToggleEvent<T = any> {\n  row: T;\n  expended: boolean;\n  toggle(): void;\n}\n\nexport const PLUGIN_KEY: 'detailRow' = 'detailRow';\n","import {\n  ChangeDetectionStrategy,\n  Component,\n  OnInit,\n  OnDestroy,\n  ViewEncapsulation,\n  ViewContainerRef,\n  ViewChild,\n} from '@angular/core';\nimport { ENTER, SPACE } from '@angular/cdk/keycodes';\nimport { CdkRow } from '@angular/cdk/table';\n\nimport { unrx } from '@pebula/ngrid/core';\nimport { PblNgridRowComponent } from '@pebula/ngrid';\nimport { PblDetailsRowToggleEvent, PLUGIN_KEY } from './tokens';\nimport { DetailRowController } from './detail-row-controller';\n\ndeclare module '@pebula/ngrid/lib/grid/context/types' {\n  interface ExternalRowContextState {\n    detailRow: boolean;\n  }\n}\n\nexport const PBL_NGRID_ROW_TEMPLATE = '<ng-content select=\".pbl-ngrid-row-prefix\"></ng-content><ng-container #viewRef></ng-container><ng-content select=\".pbl-ngrid-row-suffix\"></ng-content>';\n\n@Component({\n  selector: 'pbl-ngrid-row[detailRow]',\n  exportAs: 'pblNgridDetailRow',\n  host: { // tslint:disable-line:no-host-metadata-property\n    class: 'pbl-ngrid-row pbl-row-detail-parent',\n    role: 'row',\n    '[attr.tabindex]': 'grid.rowFocus',\n    '(keydown)': 'handleKeydown($event)'\n  },\n  template: PBL_NGRID_ROW_TEMPLATE,\n  styles: [ `.pbl-row-detail-parent { position: relative; cursor: pointer; }` ],\n  providers: [\n    { provide: CdkRow, useExisting: PblNgridDetailRowComponent }\n  ],\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  encapsulation: ViewEncapsulation.None,\n})\nexport class PblNgridDetailRowComponent extends PblNgridRowComponent implements OnInit, OnDestroy, PblDetailsRowToggleEvent {\n\n  get expended(): boolean {\n    return this.opened;\n  }\n\n  get height() {\n    return super.height + this.controller.getDetailRowHeight(this);\n  }\n\n  get row() { return this.context.$implicit; }\n\n  // We must explicitly define the inherited properties which have angular annotations\n  // Because angular will not detect them when building this library.\n  // TODO: When moving up to IVY see if this one get fixed\n  @ViewChild('viewRef', { read: ViewContainerRef, static: true }) _viewRef: ViewContainerRef;\n\n  private opened = false;\n  private plugin: import('./detail-row-plugin').PblNgridDetailRowPluginDirective<any>;\n  private controller: DetailRowController;\n\n  ngOnInit(): void {\n    super.ngOnInit();\n    this.plugin.addDetailRow(this);\n    const tradeEvents = this._extApi.pluginCtrl.getPlugin('targetEvents');\n\n    tradeEvents.cellClick\n      .pipe(unrx(this))\n      .subscribe( event => {\n        if (event.type === 'data' && event.row === this.context.$implicit) {\n          const { excludeToggleFrom } = this.plugin;\n          if (!excludeToggleFrom || !excludeToggleFrom.some( c => event.column.id === c )) {\n            this.toggle();\n          }\n        }\n      });\n\n    tradeEvents.rowClick\n      .pipe(unrx(this))\n      .subscribe( event => {\n        if (!event.root && event.type === 'data' && event.row === this.context.$implicit) {\n          this.toggle();\n        }\n      });\n  }\n\n  ngOnDestroy(): void {\n    unrx.kill(this);\n    this.plugin.removeDetailRow(this);\n    this.controller.clearDetailRow(this, true);\n    super.ngOnDestroy();\n  }\n\n  updateRow() {\n    if (super.updateRow()) { // only if row has changed (TODO: use identity based change detection?)\n      switch (this.plugin.whenContextChange) {\n        case 'context':\n          const isContextOpened = !!this.context.getExternal('detailRow');\n          isContextOpened && this.opened\n            ? this.controller.updateDetailRow(this) // if already opened, just update the context\n            : this.toggle(isContextOpened, true) // if not opened, force to the context state\n          ;\n          break;\n        case 'render':\n          if (this.opened) {\n            this.controller.updateDetailRow(this);\n          }\n          break;\n        case 'close':\n          this.toggle(false, true);\n          break;\n      }\n      this.plugin.markForCheck();\n      this.controller.detectChanges(this);\n      this.plugin.toggledRowContextChange.next(this);\n      return true;\n    }\n    return false;\n  }\n\n  toggle(forceState?: boolean, fromRender = false): void {\n    if (this.opened !== forceState) {\n      let opened = false;\n      if (this.opened) {\n        this.controller.clearDetailRow(this, fromRender);\n        this.element.classList.remove('pbl-row-detail-opened');\n      } else if (this.controller.render(this, fromRender)) {\n        opened = true;\n        this.element.classList.add('pbl-row-detail-opened');\n      }\n\n      if (this.opened !== opened) {\n        this.opened = opened;\n        this.context.setExternal('detailRow', opened, true);\n        this.plugin.detailRowToggled(this);\n      }\n    }\n  }\n\n  /**\n   * @internal\n   */\n  handleKeydown(event: KeyboardEvent): void {\n    if ( event.target === this.element ) {\n      const keyCode = event.keyCode;\n      const isToggleKey = keyCode === ENTER || keyCode === SPACE;\n      if ( isToggleKey ) {\n        event.preventDefault(); // prevents the page from scrolling down when pressing space\n        this.toggle();\n      }\n    }\n  }\n\n  protected onCtor() {\n    super.onCtor();\n    this.plugin = this._extApi.pluginCtrl.getPlugin(PLUGIN_KEY); // TODO: THROW IF NO PLUGIN...\n    this.controller = this.plugin.detailRowCtrl;\n  }\n}\n","// tslint:disable:use-host-property-decorator\nimport {\n  Component,\n  Directive,\n  OnInit,\n  OnDestroy,\n  TemplateRef,\n  Input,\n} from '@angular/core';\n\nimport { PblNgridRegistryService, PblNgridSingleTemplateRegistry, PblNgridRowContext, PblNgridRowDef } from '@pebula/ngrid';\n\ndeclare module '@pebula/ngrid/core/lib/registry/types' {\n  interface PblNgridSingleRegistryMap {\n    detailRowParent?: PblNgridDetailRowParentRefDirective<any>;\n    detailRow?: PblNgridDetailRowDefDirective;\n  }\n}\n\nexport interface PblNgridDetailRowContext<T = any> {\n  $implicit: T;\n  rowContext: PblNgridRowContext<T>;\n  animation: {\n    /**\n     * When true, indicates that the toggle (open/close) trigger of the detail row was from a rendering operation and not a user interaction.\n     * For example, scrolling out of view or changing the row's context due to virtual scroll updates.\n     *\n     * This flag is here to note that allowing you to customize behavior, especially when using animation.\n     * You should disable animations (angular & CSS) when the toggle came from a rendering operation and not from user click to prevent\n     * flickering and strange behaviors with virtual scrolling.\n     *\n     * When using angular animation, you can use the `[@.disable]` binding to make sure no animations run (`[@.disable]=\"animation.fromRender\"`)\n     * or when using CSS animation, use a class to disable the animations.\n     *\n     * > If you're not using the dynamic virtual scroll or your animation is not changing the height, you can ignore this value.\n     */\n    fromRender: boolean;\n\n    /**\n     * Invoke this function to notify the grid that an animation operation has ended.\n     * This is required when `hasAnimation` is turned on on the structural directive `pblNgridDetailRowDef`.\n     * If hasAnimation is enabled and this function is not called the grid will not be able to measure the new height\n     * of the detail row effecting virtual scroll calculations.\n     *\n     * You should call via angular`s animation events `(@.myTrigger.done)=\"animation.end()\"` or if using CSS animations via `(animationend)=\"animation.end()\"`\n     *\n     * > If you're not using the dynamic virtual scroll or your animation is not changing the height, you can ignore this value.\n     */\n    end: () => void;\n  }\n}\n\n/**\n * Marks the element as the display element for the detail row itself.\n */\n@Directive({ selector: '[pblNgridDetailRowDef]' })\nexport class PblNgridDetailRowDefDirective extends PblNgridSingleTemplateRegistry<PblNgridDetailRowContext, 'detailRow'> {\n  readonly kind: 'detailRow' = 'detailRow';\n\n  /**\n   * Define the height measure strategy to use when the detail row is opened or closed.\n   *\n   * When we toggle the detail row we need to update the height so we can notify the dynamic virtual scroll to take this into account.\n   * If we have a toggle animation, the height must be measured at the end of the animation otherwise we can measure it once the element is created.\n   *\n   * By not setting value (the default) or setting false, the measurement will take place immediately.\n   * If we want to support animations we can apply 1 of 2 strategies:\n   *\n   * - `interaction` - If the toggle origin is from a user interaction (e.g. click) or a programmatic API then it WILL NOT\n   *                   measure the height until `animation.end()` is called on the detail row context.\n   *                   Otherwise, it will measure it immediately.\n   *                   A Non-Interaction origin can happen from scrolling out of view or changing the row's context due to virtual scroll updates.\n   *                   See `fromRender` on the context for more details.\n   *                   I.E: When `fromRender` is true, the grid will measure the height immediately, otherwise it will wait for you to call `animation.end()`\n   *\n   * - `always` - Will always assume animation is running when toggling the detail row and WILL NOT measure the height\n   *              until `animation.end()` is called on the detail row context.\n   *\n   * If you are using animation, we strongly suggest to use `interaction` mode!\n   *\n   * > If you're not using the dynamic virtual scroll or your animation is not changing the height, you can ignore this value.\n   */\n  // tslint:disable-next-line: no-input-rename\n  @Input('pblNgridDetailRowDefHasAnimation') hasAnimation: 'always' | 'interaction' | false | undefined;\n\n  constructor(tRef: TemplateRef<PblNgridDetailRowContext>, registry: PblNgridRegistryService) { super(tRef, registry); }\n\n}\n\n@Directive({\n  selector: '[pblNgridDetailRowParentRef]',\n  inputs: ['columns: pblNgridDetailRowParentRef', 'when: pblNgridDetailRowParentRefWhen'],\n})\nexport class PblNgridDetailRowParentRefDirective<T> extends PblNgridRowDef<T> implements OnInit, OnDestroy {\n\n  ngOnInit(): void {\n    this.registry.setSingle('detailRowParent', this as any);\n  }\n\n  ngOnDestroy(): void {\n    if (this.registry.getSingle('detailRowParent') === this) {\n      this.registry.setSingle('detailRowParent',  undefined);\n    }\n  }\n}\n","import { EmbeddedViewRef, ViewContainerRef } from '@angular/core';\nimport { PblNgridExtensionApi } from '@pebula/ngrid';\nimport { PblNgridDetailRowContext, PblNgridDetailRowDefDirective } from './directives';\nimport { PblNgridDetailRowComponent } from './row';\n\nconst NOOP = () => {};\n\ninterface DetailRowViewState {\n  viewRef: EmbeddedViewRef<PblNgridDetailRowContext>\n}\n\ninterface PendingOperation {\n  type: 'render' | 'clear';\n  fromRender: boolean;\n}\n\n/**\n * In charge of handling the lifecycle of detail row instances.\n * The whole lifecycle: Create, update, move, destroy, etc...\n *\n * This controller also sync's the rendering process to make sure we reuse detail rom elements within\n * a single rendering cycle (i.e. not long term caching but a short term one).\n * This is done for performance and to prevent flickering when a row is moved into a different element due to virtual scroll.\n * When this happen we just want to move all dom elements properly, swap the context and trigger change detection.\n * If we have left over rows to render we create new elements or if we have left over rows to clear, we remove them.\n * The logic for this relay on the fact that the row's context.$implicit is updated in a sync iteration by the cdk table\n * and afterwards we will have the onRenderRows event fired, allowing us to sync changes.\n * We also relay on the fact that the event run immediately after the iterations and everything is sync.\n *\n * > In the future, this is where we can support detail row caching\n */\nexport class DetailRowController {\n\n  private viewMap = new Map<PblNgridDetailRowComponent, DetailRowViewState>();\n  private pendingOps = new Map<PblNgridDetailRowComponent, PendingOperation>();\n  private deferOps = false;\n  private detailRowDef: PblNgridDetailRowDefDirective;\n\n  private runMeasure = () => this.extApi.grid.viewport.reMeasureCurrentRenderedContent();\n\n  constructor(private readonly vcRef: ViewContainerRef,\n              private readonly extApi: PblNgridExtensionApi) {\n    extApi.onInit(() => {\n      this.detailRowDef = extApi.grid.registry.getSingle('detailRow');\n      extApi.cdkTable.beforeRenderRows.subscribe(() => this.deferOps = true );\n      extApi.cdkTable.onRenderRows.subscribe(() => this.flushPendingOps());\n    });\n\n    extApi.grid.registry.changes\n      .subscribe( changes => {\n        for (const c of changes) {\n          switch (c.type) {\n            case 'detailRow':\n              if (c.op === 'remove') {\n                this.detailRowDef = undefined;\n              } else {\n                this.detailRowDef = c.value;\n              }\n              break;\n          }\n        }\n      });\n  }\n\n  render(parent: PblNgridDetailRowComponent, fromRender: boolean): boolean {\n    if (this.viewMap.has(parent)) {\n      this.pendingOps.delete(parent); // if clear, then render we don't want to clear it later\n      this.updateDetailRow(parent);\n      return true;\n    } else if (!this.deferOps) {\n      return this._render(parent, fromRender);\n    } else if (parent.context.$implicit && this.detailRowDef) {\n      this.pendingOps.set(parent, { type: 'render', fromRender });\n      return true;\n    }\n    return false;\n  }\n\n  clearDetailRow(parent: PblNgridDetailRowComponent, fromRender: boolean) {\n    const state = this.viewMap.get(parent);\n    if (state) {\n      if (this.deferOps) {\n        this.pendingOps.set(parent, { type: 'clear', fromRender });\n      } else {\n        this._clearDetailRow(parent, fromRender);\n      }\n    }\n  }\n\n  updateDetailRow(parent: PblNgridDetailRowComponent) {\n    const state = this.viewMap.get(parent);\n    if (state) {\n      Object.assign(state.viewRef.context, this.createDetailRowContext(parent, true));\n      state.viewRef.detectChanges();\n    }\n  }\n\n  getDetailRowHeight(parent: PblNgridDetailRowComponent) {\n    let total = 0;\n    const state = this.viewMap.get(parent);\n    if (state) {\n      for (const e of state.viewRef.rootNodes) {\n        total += e.getBoundingClientRect().height;\n      }\n    }\n    return total;\n  }\n\n  detectChanges(parent: PblNgridDetailRowComponent) {\n    const state = this.viewMap.get(parent);\n    if (state) {\n      state.viewRef.detectChanges();\n    }\n  }\n\n  private createDetailRowContext(parent: PblNgridDetailRowComponent, fromRender: boolean): PblNgridDetailRowContext {\n    return {\n      $implicit: parent.context.$implicit,\n      rowContext: parent.context,\n      animation: { fromRender, end: () => this.checkHasAnimation(fromRender) ? this.runMeasure() : undefined, },\n    }\n  }\n\n  private flushPendingOps() {\n    if (this.deferOps) {\n      this.deferOps = false;\n\n      const toRender: Array<[PblNgridDetailRowComponent, PendingOperation]> = [];\n      const toClear: Array<[PblNgridDetailRowComponent, PendingOperation]> = [];\n      for (const entry of this.pendingOps.entries()) {\n        const col = entry[1].type === 'clear' ? toClear : toRender;\n        col.push(entry);\n      }\n      this.pendingOps.clear();\n\n      for (const [parent, op] of toRender) {\n        if (this.viewMap.has(parent)) {\n          if (typeof ngDevMode === 'undefined' || ngDevMode) {\n            throw new Error('Invalid detail row state.');\n          }\n          return;\n        }\n        if (toClear.length) {\n          const [clearParent] = toClear.pop();\n\n          this.viewMap.set(parent, this.viewMap.get(clearParent));\n          this.viewMap.delete(clearParent);\n          this.insertElementsToRow(parent); // don't detect changes, we'll do it in updateDetailRow\n          this.updateDetailRow(parent);\n\n          // notify about size changes\n          if (!this.checkHasAnimation(op.fromRender)) {\n            this.runMeasure();\n          }\n        } else {\n          // when no more cleared left for reuse\n          this._render(parent, op.fromRender);\n        }\n      }\n\n      // remove cleared we can't reuse\n      for (const [parent, op] of toClear) {\n        this._clearDetailRow(parent, op.fromRender);\n      }\n    }\n  }\n\n  private _render(parent: PblNgridDetailRowComponent, fromRender: boolean): boolean {\n    if (parent.context.$implicit && this.detailRowDef) {\n      const context = this.createDetailRowContext(parent, fromRender);\n\n      this.viewMap.set(parent, { viewRef: this.vcRef.createEmbeddedView(this.detailRowDef.tRef, context) })\n      this.insertElementsToRow(parent, true);\n\n      // notify about size changes\n      if (!this.checkHasAnimation(fromRender)) {\n        this.runMeasure();\n      }\n      return true;\n    }\n    return false;\n  }\n\n  private _clearDetailRow(parent: PblNgridDetailRowComponent, fromRender: boolean) {\n    const state = this.viewMap.get(parent);\n    if (state) {\n      const { viewRef } = state;\n\n      if (viewRef.context.animation.fromRender !== fromRender) {\n        viewRef.context.animation.fromRender = fromRender;\n        viewRef.detectChanges();\n      }\n\n      viewRef.destroy();\n\n      if (!this.checkHasAnimation(fromRender)) {\n        this.runMeasure();\n      }\n\n      this.viewMap.delete(parent);\n    }\n  }\n\n  private insertElementsToRow(parent: PblNgridDetailRowComponent, detectChanges?: boolean) {\n    const { viewRef } = this.viewMap.get(parent);\n    const beforeNode = parent.element.nextSibling;\n    for (const e of viewRef.rootNodes) {\n      parent.element.parentElement.insertBefore(e, beforeNode);\n    }\n    if (detectChanges) {\n      viewRef.detectChanges();\n    }\n  }\n\n  private checkHasAnimation(fromRender: boolean) {\n    return this.detailRowDef.hasAnimation === 'always' || (this.detailRowDef.hasAnimation === 'interaction' && !fromRender);\n  }\n}\n","import { Directive, EventEmitter, Injector, Input, OnDestroy, Output, ComponentFactoryResolver, ComponentRef, NgZone, ViewContainerRef, Component } from '@angular/core';\nimport { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { PblNgridComponent, PblNgridPluginController } from '@pebula/ngrid';\n\nimport { PblDetailsRowToggleEvent, PLUGIN_KEY } from './tokens';\nimport { PblNgridDetailRowComponent } from './row';\nimport { PblNgridDetailRowParentRefDirective } from './directives';\nimport { DetailRowController } from './detail-row-controller';\n\ndeclare module '@pebula/ngrid/lib/ext/types' {\n  interface PblNgridPluginExtension {\n    detailRow?: PblNgridDetailRowPluginDirective<any>;\n  }\n}\n\nexport const ROW_WHEN_TRUE = () => true;\nexport const ROW_WHEN_FALSE = () => false;\n\nexport function toggleDetailRow<T = any>(grid: PblNgridComponent<T>, row: T, forceState?: boolean): boolean | void {\n  const controller = PblNgridPluginController.find(grid);\n  if (controller) {\n    const plugin = controller.getPlugin(PLUGIN_KEY);\n    if (plugin) {\n      return plugin.toggleDetailRow(row, forceState);\n    }\n  }\n}\n\n@Directive({ selector: 'pbl-ngrid[detailRow]', exportAs: 'pblNgridDetailRow' })\nexport class PblNgridDetailRowPluginDirective<T> implements OnDestroy {\n  /**\n   * Detail row control (none / all rows / selective rows)\n   *\n   * A detail row is an additional row added below a row rendered with the context of the row above it.\n   *\n   * You can enable/disable detail row for the entire grid by setting `detailRow` to true/false respectively.\n   * To control detail row per row, provide a predicate.\n   */\n  @Input() get detailRow(): ( (index: number, rowData: T) => boolean ) | boolean { return this._detailRow; }\n  set detailRow(value: ( (index: number, rowData: T) => boolean ) | boolean ) {\n    if (this._detailRow !== value) {\n      const grid = this.grid;\n\n      if (typeof value === 'function') {\n        this._isSimpleRow = (index: number, rowData: T) => !(value as any)(index, rowData);\n        this._isDetailRow = value;\n      } else {\n        value = coerceBooleanProperty(value);\n        this._isDetailRow = value ? ROW_WHEN_TRUE : ROW_WHEN_FALSE;\n        this._isSimpleRow = value ? ROW_WHEN_FALSE : ROW_WHEN_TRUE;\n      }\n      this._detailRow = value;\n\n      if (grid.isInit) {\n        this.updateTable();\n      }\n    }\n  }\n\n  @Input() set singleDetailRow(value: boolean) {\n    value = coerceBooleanProperty(value);\n    if (this._forceSingle !== value) {\n      this._forceSingle = value;\n      if (value && this._openedRow && this._openedRow.expended) {\n        for (const detailRow of this._detailRowRows) {\n          if (detailRow.context.$implicit !== this._openedRow.row) {\n            detailRow.toggle(false);\n          }\n        }\n      }\n    }\n  }\n\n  /**\n   * A list of columns that will not trigger a detail row toggle when clicked.\n   */\n  @Input() excludeToggleFrom: string[];\n\n  /**\n   * Set the behavior when the row's context is changed while the detail row is opened  (another row is displayed in place of the current row) or closed.\n   *\n   * - context: use the context to determine if to open or close the detail row\n   * - ignore: don't do anything, leave as is (for manual intervention)\n   * - close: close the detail row\n   * - render: re-render the row with the new context\n   *\n   * The default behavior is `context`\n   *\n   * This scenario will pop-up when using pagination and the user move between pages or change the page size.\n   * It might also happen when the data is updated due to custom refresh calls on the datasource or any other scenario that might invoke a datasource update.\n   *\n   * The `ignore` phase, when used, will not trigger an update, leaving the detail row opened and showing data from the previous row.\n   * The `ignore` is intended for use with `toggledRowContextChange`, which will emit when the row context has changed, this will allow the developer to\n   * toggle the row (mimic `close`) or update the context manually. For example, if toggling open the detail row invokes a \"fetch\" operation that retrieves data for the detail row\n   * this will allow updates on context change.\n   *\n   * Usually, what you will want is \"context\" (the default) which will remember the last state of the row and open it based on it.\n   *\n   * > Note that for \"context\" to work you need to use a datasource in client side mode and it must have a primary/identity column (pIndex) or it will not be able to identify the rows.\n   *\n   * > Note that `toggledRowContextChange` fires regardless of the value set in `whenContextChange`\n   */\n  @Input() whenContextChange: 'ignore' | 'close' | 'render' | 'context' = 'context';\n\n  /**\n   * Emits whenever a detail row instance is toggled on/off\n   * Emits an event handler with the row, the toggle state and a toggle operation method.\n   */\n  @Output() toggleChange = new EventEmitter<PblDetailsRowToggleEvent<T>>();\n  /**\n   * Emits whenever the row context has changed while the row is toggled open.\n   * This scenario is unique and will occur only when a detail row is opened AND the parent row has changed.\n   *\n   * For example, when using pagination and the user navigates to the next/previous set or when the rows per page size is changed.\n   * It might also occur when the data is updated due to custom refresh calls on the datasource or any other scenario that might invoke a datasource update.\n   *\n   * Emits an event handler with the row, the toggle state and a toggle operation method.\n   */\n  @Output() toggledRowContextChange = new EventEmitter<PblDetailsRowToggleEvent<T>>();\n\n  public readonly detailRowCtrl: DetailRowController;\n\n  private _openedRow?: PblDetailsRowToggleEvent<T>;\n  private _forceSingle: boolean;\n  private _isSimpleRow: (index: number, rowData: T) => boolean = ROW_WHEN_TRUE;\n  private _isDetailRow: (index: number, rowData: T) => boolean = ROW_WHEN_FALSE;\n  private _detailRowRows = new Set<PblNgridDetailRowComponent>();\n  private _detailRow: ( (index: number, rowData: T) => boolean ) | boolean;\n  private _detailRowDef: PblNgridDetailRowParentRefDirective<T>;\n  private _defaultParentRef: ComponentRef<PblNgridDefaultDetailRowParentComponent>;\n  private _removePlugin: (grid: PblNgridComponent<any>) => void;\n  private _cdPending: boolean;\n  private readonly grid: PblNgridComponent<any>;\n\n  constructor(vcRef: ViewContainerRef,\n              private readonly pluginCtrl: PblNgridPluginController<T>,\n              private readonly ngZone: NgZone,\n              private readonly injector: Injector) {\n    this._removePlugin = pluginCtrl.setPlugin(PLUGIN_KEY, this);\n    this.grid = pluginCtrl.extApi.grid;\n    this.detailRowCtrl = new DetailRowController(vcRef, pluginCtrl.extApi);\n\n    pluginCtrl.onInit()\n      .subscribe(() => {\n        pluginCtrl.ensurePlugin('targetEvents'); // Depends on target-events plugin\n\n        this.grid.registry.changes\n          .subscribe( changes => {\n            for (const c of changes) {\n              switch (c.type) {\n                case 'detailRowParent':\n                  if (c.op === 'remove') {\n                    this.pluginCtrl.extApi.cdkTable.removeRowDef(c.value);\n                    this._detailRowDef = undefined;\n                  }\n                  this.setupDetailRowParent();\n                  break;\n              }\n            }\n          });\n\n        // if we start with an initial value, then update the grid cause we didn't do that\n        // when it was set (we cant cause we're not init)\n        // otherwise just setup the parent.\n        if (this._detailRow) {\n          this.updateTable();\n        } else {\n          this.setupDetailRowParent();\n        }\n      });\n  }\n\n  addDetailRow(detailRow: PblNgridDetailRowComponent): void {\n    this._detailRowRows.add(detailRow);\n  }\n\n  removeDetailRow(detailRow: PblNgridDetailRowComponent): void {\n    this._detailRowRows.delete(detailRow);\n  }\n\n  toggleDetailRow(row: any, forceState?: boolean): boolean | void {\n    for (const detailRow of this._detailRowRows) {\n      if (detailRow.context.$implicit === row) {\n        detailRow.toggle(forceState);\n        return detailRow.expended;\n      }\n    }\n  }\n\n  markForCheck() {\n    if (!this._cdPending) {\n      this._cdPending = true;\n      this.ngZone.runOutsideAngular(() => Promise.resolve()\n        .then(() => {\n          this.ngZone.run(() => {\n            this._cdPending = false;\n            this._defaultParentRef?.changeDetectorRef.markForCheck();\n          });\n        }));\n    }\n  }\n\n  ngOnDestroy(): void {\n    if (this._defaultParentRef) {\n      this._defaultParentRef.destroy();\n    }\n    this._removePlugin(this.grid);\n  }\n\n  /** @internal */\n  detailRowToggled(event: PblDetailsRowToggleEvent<T>): void {\n    // logic for closing previous row\n    const isSelf = this._openedRow && this._openedRow.row === event.row;\n    if (event.expended) {\n      if (this._forceSingle && this._openedRow && this._openedRow.expended && !isSelf) {\n        this._openedRow.toggle();\n      }\n      this._openedRow = event;\n    } else if (isSelf) {\n      this._openedRow = undefined;\n    }\n    this.toggleChange.emit(event);\n  }\n\n  private setupDetailRowParent(): void {\n    const grid = this.grid;\n    const cdkTable = this.pluginCtrl.extApi.cdkTable;\n    if (this._detailRowDef) {\n      cdkTable.removeRowDef(this._detailRowDef);\n      this._detailRowDef = undefined;\n    }\n    if (this.detailRow) {\n      let detailRow = this.pluginCtrl.extApi.registry.getSingle('detailRowParent');\n      if (detailRow) {\n        this._detailRowDef = detailRow = detailRow.clone();\n        Object.defineProperty(detailRow, 'when', { enumerable: true,  get: () => this._isDetailRow });\n      } else if (!this._defaultParentRef) {\n        // We don't have a template in the registry, so we register the default component which will push a new template to the registry\n        // TODO: move to module? set in root registry? put elsewhere to avoid grid sync (see event of registry change)...\n        this._defaultParentRef = this.injector.get(ComponentFactoryResolver)\n          .resolveComponentFactory(PblNgridDefaultDetailRowParentComponent)\n          .create(this.injector);\n        this._defaultParentRef.changeDetectorRef.detectChanges(); // kick it for immediate emission of the registry value\n        return;\n      }\n    }\n    this.resetTableRowDefs();\n  }\n\n  private resetTableRowDefs(): void {\n    if (this._detailRowDef) {\n      this._detailRow === false\n        ? this.pluginCtrl.extApi.cdkTable.removeRowDef(this._detailRowDef)\n        : this.pluginCtrl.extApi.cdkTable.addRowDef(this._detailRowDef)\n      ;\n    }\n  }\n\n  /**\n   * Update the grid with detail row info.\n   * Instead of calling for a change detection cycle we can assign the new predicates directly to the pblNgridRowDef instances.\n   */\n  private updateTable(): void {\n    this.grid._tableRowDef.when = this._isSimpleRow;\n    this.setupDetailRowParent();\n    // Once we changed the `when` predicate on the `CdkRowDef` we must:\n    //   1. Update the row cache (property `rowDefs`) to reflect the new change\n    this.pluginCtrl.extApi.cdkTable.updateRowDefCache();\n\n    //   2. re-render all rows.\n    // The logic for re-rendering all rows is handled in `CdkTable._forceRenderDataRows()` which is a private method.\n    // This is a workaround, assigning to `multiTemplateDataRows` will invoke the setter which\n    // also calls `CdkTable._forceRenderDataRows()`\n    // TODO: This is risky, the setter logic might change.\n    // for example, if material will chack for change in `multiTemplateDataRows` setter from previous value...\n    this.pluginCtrl.extApi.cdkTable.multiTemplateDataRows = !!this._detailRow;\n  }\n\n  static ngAcceptInputType_detailRow: BooleanInput | ( (index: number, rowData: any) => boolean );\n}\n\n/**\n * Use to set the a default `pblNgridDetailRowParentRef` if the user did not set one.\n * @internal\n */\n @Component({\n  selector: 'pbl-ngrid-default-detail-row-parent',\n  template: `<pbl-ngrid-row *pblNgridDetailRowParentRef=\"let row;\" detailRow></pbl-ngrid-row>`,\n})\nexport class PblNgridDefaultDetailRowParentComponent { }\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { CdkTableModule } from '@angular/cdk/table';\nimport { PblNgridModule, ngridPlugin } from '@pebula/ngrid';\nimport { PblNgridTargetEventsModule } from '@pebula/ngrid/target-events';\n\nimport { PLUGIN_KEY } from './detail-row/tokens';\nimport { PblNgridDetailRowParentRefDirective, PblNgridDetailRowDefDirective } from './detail-row/directives';\nimport { PblNgridDetailRowPluginDirective, PblNgridDefaultDetailRowParentComponent } from './detail-row/detail-row-plugin';\nimport { PblNgridDetailRowComponent } from './detail-row/row';\n\nconst DETAIL_ROW = [\n  PblNgridDetailRowPluginDirective,\n  PblNgridDetailRowComponent,\n  PblNgridDetailRowParentRefDirective,\n  PblNgridDetailRowDefDirective,\n];\n\n@NgModule({\n    imports: [CommonModule, CdkTableModule, PblNgridModule, PblNgridTargetEventsModule],\n    declarations: [DETAIL_ROW, PblNgridDefaultDetailRowParentComponent],\n    exports: [DETAIL_ROW]\n})\nexport class PblNgridDetailRowModule {\n  static readonly NGRID_PLUGIN = ngridPlugin({ id: PLUGIN_KEY }, PblNgridDetailRowPluginDirective);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i2.PblNgridDetailRowComponent","i3.PblNgridDetailRowParentRefDirective"],"mappings":";;;;;;;;;;;AAMO,MAAM,UAAU,GAAgB,WAAW;;ACiB3C,MAAM,sBAAsB,GAAG,wJAAwJ,CAAC;AAmBzL,MAAO,0BAA2B,SAAQ,oBAAoB,CAAA;AAjBpE,IAAA,WAAA,GAAA;;AAkCU,QAAA,IAAM,CAAA,MAAA,GAAG,KAAK,CAAC;KAqGxB;AApHC,IAAA,IAAI,QAAQ,GAAA;QACV,OAAO,IAAI,CAAC,MAAM,CAAC;KACpB;AAED,IAAA,IAAI,MAAM,GAAA;AACR,QAAA,OAAO,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;KAChE;IAED,IAAI,GAAG,GAAK,EAAA,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;IAW5C,QAAQ,GAAA;QACN,KAAK,CAAC,QAAQ,EAAE,CAAC;AACjB,QAAA,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;AAC/B,QAAA,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;AAEt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