{"version":3,"file":"pebula-ngrid-sticky.mjs","sources":["../../../../libs/ngrid/sticky/src/lib/sticky/sticky-plugin.ts","../../../../libs/ngrid/sticky/src/lib/sticky.module.ts","../../../../libs/ngrid/sticky/src/pebula-ngrid-sticky.ts"],"sourcesContent":["import { Directive, Input, IterableDiffers, IterableDiffer, IterableChangeRecord, OnDestroy, AfterViewInit } from '@angular/core';\n\nimport { ON_INVALIDATE_HEADERS, ON_RESIZE_ROW } from '@pebula/ngrid/core';\nimport { PblNgridComponent, PblNgridPluginController } from '@pebula/ngrid';\n\n\ndeclare module '@pebula/ngrid/lib/ext/types' {\n  interface PblNgridPluginExtension {\n    sticky?: PblNgridStickyPluginDirective;\n  }\n}\n\nexport const PLUGIN_KEY: 'sticky' = 'sticky';\n\nexport function setStickyRow(grid: PblNgridComponent<any>, type: 'header' | 'footer', bulk: Array<['table' | number, boolean]>): void;\nexport function setStickyRow(grid: PblNgridComponent<any>, type: 'header' | 'footer', value: 'table' | number, state: boolean): void;\nexport function setStickyRow(grid: PblNgridComponent<any>, type: 'header' | 'footer', valueOrBulk: Array<['table' | number, boolean]> | 'table' | number, state?: boolean): void {\n  const isHeader = type === 'header';\n  const queryList = isHeader ? grid._headerRowDefs : grid._footerRowDefs;\n  const bulk: Array<['table' | number, boolean]> = Array.isArray(valueOrBulk) ? valueOrBulk : [ [valueOrBulk, state] ];\n\n  const addOneIfMainExists = (isHeader && grid.showHeader) || (!isHeader && grid.showFooter) ? 1 : 0;\n\n  let changed: boolean;\n  for (const [value, state] of bulk) {\n    // the index from the user is 0 based or the grid header/footer row.\n    // we store them both, so we need to convert... our first is always the grid header/footer and then we have the same order as the user's.\n    let idx = value === 'table' ? 0 : value + addOneIfMainExists;\n    if (!isHeader) {\n      // sticky-styler stickRows() methods will reverse the order of footer columns\n      // so we actually need to set another row to make the row we want sticky.\n      // we could reverse the collection, but choosing the opposite side is better.\n      // think [0, 1, 2, 3, 4] and we want 1. sticky-styler will reverse to [4, 3, 2, 1, 0] so doing nothing will stick 3.\n      // the opposite is length MINUS 1 MINUS index which is 5 - 1 - 1 which is 3, in the revered array its the row 1 which is what we wanted.\n      idx = (queryList.length - 1) - idx;\n    }\n\n    const rowDef = queryList.toArray()[idx];\n    if (rowDef && rowDef.sticky !== state) {\n      rowDef.sticky = state;\n      changed = true;\n    }\n  }\n\n  if (changed) {\n    const cdkTable = PblNgridPluginController.find(grid).extApi.cdkTable;\n    if (isHeader) {\n      cdkTable.updateStickyHeaderRowStyles();\n    } else {\n      cdkTable.updateStickyFooterRowStyles();\n    }\n  }\n}\n\nexport function setStickyColumns(grid: PblNgridComponent<any>, type: 'start' | 'end', bulk: Array<[string | number, boolean]>): void;\nexport function setStickyColumns(grid: PblNgridComponent<any>, type: 'start' | 'end', value: string  | number, state: boolean): void;\nexport function setStickyColumns(grid: PblNgridComponent<any>, type: 'start' | 'end', valueOrBulk: Array<[string  | number, boolean]> | string  | number, state?: boolean): void {\n  const bulk: Array<[string | number, boolean]> = Array.isArray(valueOrBulk) ? valueOrBulk : [ [valueOrBulk, state] ];\n  let changed: boolean;\n  for (let [columnId, state] of bulk) {\n    if (typeof columnId === 'string') {\n      columnId = grid.columnApi.visibleColumns.findIndex( c => c.orgProp === columnId );\n    }\n    const c = grid.columnApi.visibleColumns[columnId];\n    if (c) {\n      changed = true;\n      c.pin = state ? type : undefined;\n      if (type === 'end') {\n        c.columnDef.stickyEnd = state;\n        c.columnDef.sticky = false;\n      } else {\n        c.columnDef.sticky = state;\n        c.columnDef.stickyEnd = false;\n      }\n    }\n  }\n  if (changed) {\n    const cdkTable = PblNgridPluginController.find(grid).extApi.cdkTable;\n    cdkTable.updateStickyColumnStyles();\n  }\n}\n\n@Directive({ selector: 'pbl-ngrid[stickyColumnStart], pbl-ngrid[stickyColumnEnd], pbl-ngrid[stickyHeader], pbl-ngrid[stickyFooter]' })\nexport class PblNgridStickyPluginDirective implements AfterViewInit, OnDestroy {\n  /**\n   * Set the header rows you want to apply sticky positioning to.\n   * Valid values are:\n   *   - `grid` - Literal string `grid` that will set the grid's main header row.\n   *   - number  - The index of the row, for multi-header row. The index refers to the order you defined the header/headerGroup rows (base 0);\n   *\n   * For performance considerations only new values will trigger a change (i.e. the array should be treated as immutable).\n   * Manipulating the array will not trigger a change (the sticky state will not change) unless sending a copy of it (replacing it, e.g. Array.slice())\n   */\n  @Input() set stickyColumnStart(value: Array<string | number>) {\n    if (!this._startDiffer) {\n      this._startDiffer = this._differs.find([]).create();\n    }\n    this.applyColumnDiff('start', value, this._startDiffer);\n  }\n\n  /**\n   * Set the footer rows you want to apply sticky positioning to.\n   * Valid values are:\n   *   - `grid` - Literal string `grid` that will set the grid's main footer row.\n   *   - number  - The index of the row, for multi-footer row. The index refers to the order you defined the footer rows (base 0);\n   *\n   * For performance considerations only new values will trigger a change (i.e. the array should be treated as immutable).\n   * Manipulating the array will not trigger a change (the sticky state will not change) unless sending a copy of it (replacing it, e.g. Array.slice())\n   */\n  @Input() set stickyColumnEnd(value: Array<string | number>) {\n    if (!this._endDiffer) {\n      this._endDiffer = this._differs.find([]).create();\n    }\n    this.applyColumnDiff('end', value, this._endDiffer);\n  }\n\n    /**\n   * Set the header rows you want to apply sticky positioning to.\n   * Valid values are:\n   *   - `grid` - Literal string `grid` that will set the grid's main header row.\n   *   - number  - The index of the row, for multi-header row. The index refers to the order you defined the header/headerGroup rows (base 0);\n   *\n   * For performance considerations only new values will trigger a change (i.e. the array should be treated as immutable).\n   * Manipulating the array will not trigger a change (the sticky state will not change) unless sending a copy of it (replacing it, e.g. Array.slice())\n   */\n  @Input() set stickyHeader(value: Array<'table' | number>) {\n    if (!this._headerDiffer) {\n      this._headerDiffer = this._differs.find([]).create();\n    }\n    this.applyRowDiff('header', value, this._headerDiffer);\n  }\n\n  /**\n   * Set the footer rows you want to apply sticky positioning to.\n   * Valid values are:\n   *   - `grid` - Literal string `grid` that will set the grid's main footer row.\n   *   - number  - The index of the row, for multi-footer row. The index refers to the order you defined the footer rows (base 0);\n   *\n   * For performance considerations only new values will trigger a change (i.e. the array should be treated as immutable).\n   * Manipulating the array will not trigger a change (the sticky state will not change) unless sending a copy of it (replacing it, e.g. Array.slice())\n   */\n  @Input() set stickyFooter(value: Array<'table' | number>) {\n    if (!this._footerDiffer) {\n      this._footerDiffer = this._differs.find([]).create();\n    }\n    this.applyRowDiff('footer', value, this._footerDiffer);\n  }\n\n  private _startDiffer: IterableDiffer<string | number>;\n  private _endDiffer: IterableDiffer<string | number>;\n  private _headerDiffer: IterableDiffer<'table' | number>;\n  private _footerDiffer: IterableDiffer<'table' | number>;\n\n  private _columnCache: { start: Array<string | number>; end: Array<string | number>; } = { start: [], end: [] };\n  private _removePlugin: (grid: PblNgridComponent<any>) => void;\n  private viewInitialized = false;\n\n  constructor (protected readonly grid: PblNgridComponent<any>,\n               protected readonly _differs: IterableDiffers,\n               protected readonly pluginCtrl: PblNgridPluginController) {\n    this._removePlugin = pluginCtrl.setPlugin(PLUGIN_KEY, this);\n\n    pluginCtrl.events\n      .pipe(ON_RESIZE_ROW)\n      .subscribe( () => {\n        const cdkTable = pluginCtrl.extApi.cdkTable;\n        cdkTable.updateStickyHeaderRowStyles();\n        cdkTable.updateStickyColumnStyles();\n        cdkTable.updateStickyFooterRowStyles();\n      });\n\n      pluginCtrl.events\n        .pipe(ON_INVALIDATE_HEADERS)\n        .subscribe( () => {\n          if (this._startDiffer && this.grid.isInit) {\n            this._startDiffer.diff([]);\n            this.applyColumnDiff('start', this._columnCache.start, this._startDiffer)\n          }\n\n          if (this._endDiffer && this.grid.isInit) {\n            this._endDiffer.diff([]);\n            this.applyColumnDiff('end', this._columnCache.end, this._endDiffer)\n          }\n        });\n  }\n\n  ngAfterViewInit(): void {\n    this.viewInitialized = true;\n  }\n\n  ngOnDestroy(): void {\n    this._removePlugin(this.grid);\n  }\n\n  protected applyColumnDiff(type: 'start' | 'end', value: Array<string | number>, differ: IterableDiffer<string | number>): void {\n    if (!this.viewInitialized) {\n      requestAnimationFrame(() => this.applyColumnDiff(type, value, differ));\n      return;\n    }\n\n    this._columnCache[type] = value || [];\n\n    const changes = differ.diff(value || []);\n    const bulk: Array<[string | number, boolean]> = [];\n    changes.forEachOperation((record: IterableChangeRecord<string | number>, prevIndex: number, currentIndex: number) => {\n      if (record.previousIndex == null) {\n        bulk.push([record.item, true]);\n      } else if (currentIndex == null) {\n        bulk.push([record.item, false]);\n      }\n    });\n    if (bulk.length > 0) {\n      setStickyColumns(this.grid, type, bulk);\n    }\n  }\n\n  protected applyRowDiff(type: 'header' | 'footer', value: Array<'table' | number>, differ: IterableDiffer<'table' | number>): void {\n    if (!this.grid.isInit) {\n      this.pluginCtrl.onInit()\n        .subscribe(() => {\n          this.applyRowDiff(type, value, differ);\n        });\n      return;\n    }\n\n    const changes = differ.diff(value || []);\n    const bulk: Array<['table' | number, boolean]> = [];\n    changes.forEachOperation((record: IterableChangeRecord<'table' | number>, prevIndex: number, currentIndex: number) => {\n      if (record.previousIndex == null) {\n        bulk.push([record.item, true]);\n      } else if (currentIndex == null) {\n        bulk.push([record.item, false]);\n      }\n    });\n    if (bulk.length > 0) {\n      setStickyRow(this.grid, type, bulk);\n    }\n  }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { CdkTableModule } from '@angular/cdk/table';\nimport { PblNgridConfigService } from '@pebula/ngrid/core';\n\nimport { PblNgridModule, PblNgridPluginController, ngridPlugin } from '@pebula/ngrid';\nimport { PblNgridStickyPluginDirective, setStickyRow, setStickyColumns, PLUGIN_KEY } from './sticky/sticky-plugin';\n\ndeclare module '@pebula/ngrid/core/lib/configuration/type' {\n  interface PblNgridConfig {\n    stickyPlugin?: {\n      headers?: Array<'table' | number>;\n      footers?: Array<'table' | number>;\n      columnStart?: Array<string | number>;\n      columnEnd?: Array<string | number>;\n    }\n  }\n}\n\nconst MAPPER = <T>(v: T): [T, boolean] => [v, true];\n\n@NgModule({\n  imports: [ CommonModule, CdkTableModule, PblNgridModule ],\n  declarations: [ PblNgridStickyPluginDirective ],\n  exports: [ PblNgridStickyPluginDirective ],\n})\nexport class PblNgridStickyModule {\n\n  static readonly NGRID_PLUGIN = ngridPlugin({ id: PLUGIN_KEY }, PblNgridStickyPluginDirective);\n\n  constructor(configService: PblNgridConfigService) {\n    PblNgridPluginController.onCreatedSafe(\n      PblNgridStickyModule,\n      (grid, controller) => {\n        if (controller && !controller.hasPlugin('sticky')) {\n          controller.onInit()\n            .subscribe(() => {\n              const stickyPluginConfig = configService.get('stickyPlugin');\n              if (stickyPluginConfig) {\n                if (stickyPluginConfig.headers) {\n                  setStickyRow(grid, 'header', stickyPluginConfig.headers.map(MAPPER));\n                }\n                if (stickyPluginConfig.footers) {\n                  setStickyRow(grid, 'footer', stickyPluginConfig.footers.map(MAPPER));\n                }\n                if (stickyPluginConfig.columnStart) {\n                  setStickyColumns(grid, 'start', stickyPluginConfig.columnStart.map(MAPPER));\n                }\n                if (stickyPluginConfig.columnEnd) {\n                  setStickyColumns(grid, 'end', stickyPluginConfig.columnEnd.map(MAPPER));\n                }\n              }\n            });\n        }\n      },\n    );\n  }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;;AAYO,MAAM,UAAU,GAAa,QAAQ,CAAC;AAIvC,SAAU,YAAY,CAAC,IAA4B,EAAE,IAAyB,EAAE,WAAkE,EAAE,KAAe,EAAA;AACvK,IAAA,MAAM,QAAQ,GAAG,IAAI,KAAK,QAAQ,CAAC;AACnC,IAAA,MAAM,SAAS,GAAG,QAAQ,GAAG,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;IACvE,MAAM,IAAI,GAAuC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW,GAAG,CAAE,CAAC,WAAW,EAAE,KAAK,CAAC,CAAE,CAAC;IAErH,MAAM,kBAAkB,GAAG,CAAC,QAAQ,IAAI,IAAI,CAAC,UAAU,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC,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