{"version":3,"file":"ngx-datatables-net.mjs","sources":["../../../projects/ngx-datatables-net/src/lib/datatables.tokens.ts","../../../projects/ngx-datatables-net/src/lib/dt-render.ts","../../../projects/ngx-datatables-net/src/lib/dt-table.directive.ts","../../../projects/ngx-datatables-net/src/lib/dt-editable.directive.ts","../../../projects/ngx-datatables-net/src/lib/provide-datatables.ts","../../../projects/ngx-datatables-net/src/public-api.ts","../../../projects/ngx-datatables-net/src/ngx-datatables-net.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport DataTableCore from 'datatables.net';\nimport type { Config } from 'datatables.net';\n\n/**\n * The shape of the DataTables constructor (`new (element, options) => Api`).\n *\n * This is the framework-agnostic, **non-jQuery** entry point. The default export of\n * `datatables.net` (and of every styling package such as `datatables.net-dt`) is exactly\n * this constructor, the styling packages return the *same* constructor after registering\n * their CSS classes as a side-effect of import.\n */\nexport type DataTableConstructor = typeof DataTableCore;\n\n/**\n * DI token for the DataTable constructor the directive instantiates.\n *\n * Defaults to the unstyled core (`datatables.net`). Styling adapters\n * (`ngx-datatables-net/dt`, `/bs5`, `/tailwind`, `/material`) override this token so the\n * directive constructs a styled table without any per-adapter code in the directive itself.\n */\nexport const DATA_TABLE = new InjectionToken<DataTableConstructor>(\n  'ngx-datatables-net: DataTable constructor',\n  { providedIn: 'root', factory: () => DataTableCore },\n);\n\n/**\n * DI token for application-wide default DataTables options. Merged *under* each table's own\n * `dtOptions` (per-table options win). Provide via `provideDataTables(withOptions({...}))`.\n */\nexport const DT_DEFAULT_OPTIONS = new InjectionToken<Config>(\n  'ngx-datatables-net: default DataTables options',\n);\n\n/**\n * DI token for a CSS class the directive adds to the DataTables container element after init.\n *\n * Styling adapters that ship their own scoped stylesheet (Tailwind, Material) provide this so the\n * directive auto-scopes their CSS, e.g. `ngxdt-tailwind` / `ngxdt-material`. This lets the authored\n * adapter CSS be self-contained and lets multiple styling themes coexist on one page.\n */\nexport const DT_STYLE_SCOPE = new InjectionToken<string>(\n  'ngx-datatables-net: container style-scope class',\n);\n\n/**\n * When true, the directive escapes every column that has no explicit `render`, overriding\n * DataTables' unsafe HTML-by-default behavior. Enabled via `provideDataTables(withSafeDefaults())`.\n */\nexport const DT_ESCAPE_DEFAULTS = new InjectionToken<boolean>(\n  'ngx-datatables-net: escape columns by default',\n);\n","import { inject, SecurityContext } from '@angular/core';\nimport { DomSanitizer } from '@angular/platform-browser';\n\n/**\n * A DataTables column render function: `(data, type, row, meta) => cell-output`.\n * Mirrors the signature DataTables passes to `columns.render`.\n */\nexport type DtRenderFn<T = unknown> = (\n  data: unknown,\n  type: 'display' | 'filter' | 'sort' | 'type' | string,\n  row: T,\n  meta: { row: number; col: number; settings: unknown },\n) => unknown;\n\n/**\n * SECURITY, why this exists.\n *\n * DataTables writes cell content to the DOM directly (via jQuery), which **bypasses Angular's\n * template sanitization**. `DomSanitizer` only guards values bound through Angular templates, so\n * an HTML cell renderer fed user data is a live XSS sink. This helper funnels HTML output through\n * `DomSanitizer.sanitize(SecurityContext.HTML, value)` before it ever reaches DataTables.\n *\n * Use it ONLY for the `'display'` (and optionally `'filter'`) render types, sort/type values\n * should remain the raw underlying data so ordering and filtering stay correct.\n *\n * @example\n * columns: [{ data: 'bio', render: createSanitizedHtmlRenderer(sanitizer, r => r.bioHtml) }]\n */\nexport function createSanitizedHtmlRenderer<T = unknown>(\n  sanitizer: DomSanitizer,\n  /** Extract the raw HTML string to render for a row. Defaults to the cell `data`. */\n  html: (row: T, data: unknown) => string | null | undefined = (_row, data) =>\n    data == null ? '' : String(data),\n): DtRenderFn<T> {\n  return (data, type, row) => {\n    // Only sanitize the user-visible 'display' output; keep raw data for sort/filter/type so\n    // DataTables' ordering and searching operate on the unescaped underlying value.\n    if (type !== 'display' && type !== 'filter') {\n      return data;\n    }\n    const raw = html(row, data);\n    return sanitizer.sanitize(SecurityContext.HTML, raw ?? '') ?? '';\n  };\n}\n\nconst HTML_ENTITIES: Record<string, string> = {\n  '&': '&amp;',\n  '<': '&lt;',\n  '>': '&gt;',\n  '\"': '&quot;',\n  \"'\": '&#39;',\n};\n\n/**\n * A render function that ESCAPES HTML for display/filter, leaving raw data for sort/type.\n *\n * IMPORTANT: DataTables does **not** escape cell content by default, it writes data as innerHTML,\n * which is an XSS sink for untrusted data. This renderer makes a column render as plain, escaped\n * text. It is what `withSafeDefaults()` applies to every column that has no explicit `render`.\n */\nexport function escapeHtmlRenderer<T = unknown>(): DtRenderFn<T> {\n  return (data, type) => {\n    // Only escape STRINGS for display/filter, strings are the only XSS carrier. Numbers, booleans,\n    // null/undefined and objects are passed through unchanged so DataTables' `defaultContent`,\n    // null-data columns and numeric formatting keep working (escaping them would print \"[object\n    // Object]\" or clobber defaultContent).\n    if (type !== 'display' && type !== 'filter') {\n      return data;\n    }\n    if (typeof data !== 'string') {\n      return data;\n    }\n    return data.replace(/[&<>\"']/g, (ch) => HTML_ENTITIES[ch]);\n  };\n}\n\n/**\n * Injectable convenience: returns a factory bound to the current injector's `DomSanitizer`.\n * Call within an injection context (constructor / field initializer).\n *\n * @example\n * private readonly safeHtml = injectSanitizedHtmlRenderer();\n * // ...\n * { data: 'note', render: this.safeHtml(r => r.noteHtml) }\n */\nexport function injectSanitizedHtmlRenderer(): <T = unknown>(\n  html?: (row: T, data: unknown) => string | null | undefined,\n) => DtRenderFn<T> {\n  const sanitizer = inject(DomSanitizer);\n  return <T = unknown>(html?: (row: T, data: unknown) => string | null | undefined) =>\n    createSanitizedHtmlRenderer<T>(sanitizer, html);\n}\n","import {\n  afterNextRender,\n  afterRenderEffect,\n  ApplicationRef,\n  ChangeDetectorRef,\n  computed,\n  DestroyRef,\n  Directive,\n  ElementRef,\n  type EmbeddedViewRef,\n  inject,\n  input,\n  NgZone,\n  output,\n  signal,\n  type TemplateRef,\n  untracked,\n} from '@angular/core';\nimport DataTableCore from 'datatables.net';\nimport type { Api, Config, ConfigColumns } from 'datatables.net';\nimport {\n  DATA_TABLE,\n  DT_DEFAULT_OPTIONS,\n  DT_ESCAPE_DEFAULTS,\n  DT_STYLE_SCOPE,\n} from './datatables.tokens';\nimport type { DtCellContext, DtColumn } from './dt-cell-template';\nimport { escapeHtmlRenderer } from './dt-render';\nimport type { DtEvent, DtRowClickEvent, DtSelectEvent } from './dt-events';\n\n/**\n * `[dtTable]`, wraps a native `<table>` as a DataTables instance using the non-jQuery API.\n *\n * Design (see `docs/ARCHITECTURE.md`):\n * - Init happens in `afterNextRender` (browser-only), so SSR renders plain HTML and the table is\n *   enhanced only on the client (no `document`/layout access on the server).\n * - Reconciliation runs in an `afterRenderEffect`: a new `dtData` reference takes the cheap path\n *   (`clear -> rows.add -> draw`); a new `dtOptions`/`dtColumns` reference recreates the table.\n * - Zoneless-correct: construction and data writes run via `runOutsideAngular`; event callbacks\n *   re-enter Angular and `markForCheck()`. Selection/instance are also exposed as signals.\n * - Angular cell templates: columns may carry a `dtTemplate` (`DtColumn`), rendered as live\n *   EmbeddedViews into the cells so pipes, `routerLink`, components and bindings work.\n * - Teardown via `DestroyRef`: detaches listeners, destroys cell views, and calls `destroy()`.\n *\n * @typeParam T row data shape.\n */\n@Directive({\n  selector: 'table[dtTable]',\n  exportAs: 'dtTable',\n})\nexport class DtTableDirective<T = unknown> {\n  private readonly host = inject<ElementRef<HTMLTableElement>>(ElementRef);\n  private readonly zone = inject(NgZone);\n  private readonly cdr = inject(ChangeDetectorRef);\n  private readonly appRef = inject(ApplicationRef);\n  private readonly destroyRef = inject(DestroyRef);\n  private readonly ctor = inject(DATA_TABLE, { optional: true }) ?? DataTableCore;\n  private readonly appDefaults = inject(DT_DEFAULT_OPTIONS, { optional: true }) ?? {};\n  private readonly styleScope = inject(DT_STYLE_SCOPE, { optional: true }) ?? null;\n  private readonly escapeDefaults = inject(DT_ESCAPE_DEFAULTS, { optional: true }) ?? false;\n\n  // ---- Inputs -------------------------------------------------------------------------------\n  /** DataTables options object (`Config`). A new reference recreates the table. */\n  readonly options = input<Config>({}, { alias: 'dtOptions' });\n  /** Row data. A new array reference reconciles via the cheap `clear/rows.add/draw` path. */\n  readonly data = input<readonly T[] | undefined>(undefined, { alias: 'dtData' });\n  /**\n   * Column definitions. A new reference recreates the table. Convenience for `options.columns`.\n   * Columns may carry a `dtTemplate` (`DtColumn`) to render the cell with an Angular template.\n   */\n  readonly columns = input<DtColumn<T>[] | undefined>(undefined, { alias: 'dtColumns' });\n\n  // ---- State (signals, the zoneless-native read channel) -----------------------------------\n  private readonly _instance = signal<Api<T> | undefined>(undefined);\n  /** The live DataTables `Api` instance, or `undefined` until initialized (SSR / pre-render). */\n  readonly instance = this._instance.asReadonly();\n  /** `true` once the table has been constructed on the client. */\n  readonly ready = computed(() => this._instance() !== undefined);\n\n  private readonly _selected = signal<readonly T[]>([]);\n  /** Current selection (row data). Requires the Select extension; otherwise stays empty. */\n  readonly selected = this._selected.asReadonly();\n\n  // ---- Outputs ------------------------------------------------------------------------------\n  /** Emits the `Api` instance once, immediately after the table is created. */\n  readonly initialized = output<Api<T>>({ alias: 'dtInit' });\n  /** DataTables `draw` event. */\n  readonly draw = output<DtEvent<T>>({ alias: 'dtDraw' });\n  /** DataTables `page` event. */\n  readonly page = output<DtEvent<T>>({ alias: 'dtPage' });\n  /** DataTables `xhr` event (Ajax/server-side data load). */\n  readonly xhr = output<DtEvent<T>>({ alias: 'dtXhr' });\n  /** Select extension `select` event. */\n  readonly select = output<DtSelectEvent<T>>({ alias: 'dtSelect' });\n  /** Select extension `deselect` event. */\n  readonly deselect = output<DtSelectEvent<T>>({ alias: 'dtDeselect' });\n  /** Row click (delegated listener on `<tbody>`), with resolved row data. */\n  readonly rowClick = output<DtRowClickEvent<T>>({ alias: 'dtRowClick' });\n\n  // ---- Reconciliation bookkeeping ----------------------------------------------------------\n  // Options/columns use a STRUCTURAL key (not reference identity) so that passing an inline object\n  // literal does NOT trigger an endless recreate loop. Functions (render/ajax) and TemplateRefs are\n  // compared by presence, not identity.\n  private lastOptionsKey = '';\n  private lastColumnsKey = '';\n  private lastData: readonly T[] | undefined;\n  private rowClickCleanup?: () => void;\n\n  // Angular cell templates: colIndex -> TemplateRef, plus the live EmbeddedViews currently mounted\n  // into cells (rebuilt on every draw, torn down on redraw/destroy to avoid leaks).\n  private cellTemplates = new Map<number, TemplateRef<DtCellContext<T>>>();\n  private readonly cellViews = new Set<EmbeddedViewRef<DtCellContext<T>>>();\n\n  /** Stable structural key; functions and TemplateRefs collapse to markers so the key serializes. */\n  private structuralKey(value: unknown): string {\n    try {\n      return (\n        JSON.stringify(value, (_k, v) => {\n          if (typeof v === 'function') return ' fn';\n          // TemplateRef / ViewRef instances are circular; collapse to a stable marker.\n          if (v && typeof v === 'object' && typeof v.createEmbeddedView === 'function') return ' tpl';\n          return v;\n        }) ?? ''\n      );\n    } catch {\n      return ''; // circular / non-serializable, treat as unchanged to avoid loops\n    }\n  }\n\n  constructor() {\n    // Create once after the first render, browser only (skipped during SSR).\n    afterNextRender(() => this.create());\n\n    // React to input changes after each render commit.\n    afterRenderEffect(() => {\n      const options = this.options();\n      const columns = this.columns();\n      const data = this.data();\n      const api = untracked(this._instance);\n      if (!api) {\n        return; // Not yet created; create() will pick up the current values.\n      }\n      const optionsKey = this.structuralKey(options);\n      const columnsKey = this.structuralKey(columns);\n      if (optionsKey !== this.lastOptionsKey || columnsKey !== this.lastColumnsKey) {\n        this.recreate();\n        return;\n      }\n      if (data !== this.lastData) {\n        this.lastData = data;\n        this.applyData(api, data);\n      }\n    });\n\n    this.destroyRef.onDestroy(() => this.destroy());\n  }\n\n  /** Build the merged DataTables config from app defaults + inputs. */\n  private buildConfig(): Config {\n    const config: Config = { ...this.appDefaults, ...this.options() };\n    const cols = this.columns();\n    if (cols) {\n      config.columns = cols;\n    }\n    const data = this.data();\n    if (data !== undefined) {\n      config.data = data as unknown[];\n    }\n    // Pull Angular cell templates off the columns (handles both the dtColumns input and\n    // options.columns) and replace them with a display-empty render shim.\n    config.columns = this.extractCellTemplates(config.columns as DtColumn<T>[] | undefined);\n    if (this.escapeDefaults) {\n      // Append a lowest-priority `_all` escaping renderer. DataTables precedence means any\n      // explicit `columns[].render` or earlier `columnDefs` entry wins, so only columns WITHOUT a\n      // custom renderer are escaped, neutralising DataTables' unsafe HTML-by-default behavior.\n      config.columnDefs = [\n        ...(config.columnDefs ?? []),\n        { targets: '_all', render: escapeHtmlRenderer() },\n      ];\n    }\n    return config;\n  }\n\n  /**\n   * Pull any `dtTemplate` off the columns into `this.cellTemplates`, returning DataTables-safe\n   * column clones. A templated column without its own `render` gets a shim that renders empty for\n   * `display` (the Angular template fills the cell) while keeping the raw value for sort/filter/type\n   * so ordering and search stay correct.\n   */\n  private extractCellTemplates(cols: DtColumn<T>[] | undefined): ConfigColumns[] | undefined {\n    this.cellTemplates = new Map();\n    if (!cols) {\n      return undefined;\n    }\n    return cols.map((col, index) => {\n      if (!col.dtTemplate) {\n        return col as ConfigColumns;\n      }\n      this.cellTemplates.set(index, col.dtTemplate);\n      const { dtTemplate: _omit, ...rest } = col;\n      const shimmed = { ...rest } as ConfigColumns;\n      if (shimmed.render === undefined) {\n        shimmed.render = (data: unknown, type: string) => (type === 'display' ? '' : data);\n      }\n      return shimmed;\n    });\n  }\n\n  /** Construct the DataTables instance and wire events. */\n  private create(): void {\n    const el = this.host.nativeElement;\n    const config = this.buildConfig();\n    this.lastOptionsKey = this.structuralKey(this.options());\n    this.lastColumnsKey = this.structuralKey(this.columns());\n    this.lastData = this.data();\n\n    let api: Api<T>;\n    try {\n      api = this.zone.runOutsideAngular(() => new this.ctor<T>(el, config));\n    } catch (error) {\n      // A failed DataTables init (bad option, missing extension, etc.) must not silently swallow\n      // the table, surface it and leave the plain markup in place.\n      console.error('[ngx-datatables-net] Failed to initialize DataTable:', error);\n      return;\n    }\n    // Adapter-supplied style scope (Tailwind/Material): tag the DataTables container so the\n    // adapter's self-contained, scoped stylesheet applies.\n    if (this.styleScope) {\n      const container = api.table().container() as HTMLElement | null;\n      container?.classList.add(this.styleScope);\n    }\n    this._instance.set(api);\n    this.bindEvents(api);\n    // The initial draw fired during construction (before the draw handler was attached), so mount\n    // any cell templates for the first page now.\n    this.renderCellTemplates(api);\n    // Emit init inside the zone so template (dtInit) handlers schedule change detection.\n    this.zone.run(() => {\n      this.initialized.emit(api);\n      this.cdr.markForCheck();\n    });\n  }\n\n  /** Destroy and rebuild, used when options/columns change. */\n  private recreate(): void {\n    this.teardownInstance();\n    this.create();\n  }\n\n  /** Cheap data reconciliation: replace rows without a full re-init. */\n  private applyData(api: Api<T>, data: readonly T[] | undefined): void {\n    this.zone.runOutsideAngular(() => {\n      api.clear();\n      if (data && data.length) {\n        api.rows.add(data as T[]);\n      }\n      api.draw(false); // false -> keep the current paging position\n    });\n  }\n\n  private bindEvents(api: Api<T>): void {\n    api.on('draw.ngxdt', (event) => {\n      // Re-mount cell templates for the page that was just drawn (paging/sort/filter/data change).\n      this.renderCellTemplates(api);\n      this.emitInZone(() => this.draw.emit({ api, event, args: [] }));\n    });\n    api.on('page.ngxdt', (event) =>\n      this.emitInZone(() => this.page.emit({ api, event, args: [] })),\n    );\n    api.on('xhr.ngxdt', (event, settings, json) =>\n      this.emitInZone(() => this.xhr.emit({ api, event, args: [settings, json] })),\n    );\n    api.on('select.ngxdt', (event, _dt, itemType, indexes) => {\n      const selected = this.readSelection(api);\n      this._selected.set(selected);\n      this.emitInZone(() =>\n        this.select.emit({ api, event, itemType: itemType as string, indexes, selected }),\n      );\n    });\n    api.on('deselect.ngxdt', (event, _dt, itemType, indexes) => {\n      const selected = this.readSelection(api);\n      this._selected.set(selected);\n      this.emitInZone(() =>\n        this.deselect.emit({ api, event, itemType: itemType as string, indexes, selected }),\n      );\n    });\n    this.bindRowClick(api);\n  }\n\n  /** Delegated row-click listener on the persistent `<tbody>` element. */\n  private bindRowClick(api: Api<T>): void {\n    const tbody = this.host.nativeElement.querySelector('tbody');\n    if (!tbody) {\n      return;\n    }\n    const handler = (event: Event) => {\n      const target = event.target as HTMLElement | null;\n      const tr = target?.closest('tr') as HTMLTableRowElement | null;\n      if (!tr || !tbody.contains(tr)) {\n        return;\n      }\n      const row = api.row(tr);\n      const rowData = row.data() as T | undefined;\n      if (rowData === undefined) {\n        return; // header/footer or detached row\n      }\n      this.emitInZone(() =>\n        this.rowClick.emit({\n          api,\n          row: rowData,\n          index: row.index() as number,\n          element: tr,\n          event: event as MouseEvent,\n        }),\n      );\n    };\n    tbody.addEventListener('click', handler);\n    this.rowClickCleanup = () => tbody.removeEventListener('click', handler);\n  }\n\n  /** Read the current Select-extension selection as row data; empty if Select isn't loaded. */\n  private readSelection(api: Api<T>): readonly T[] {\n    try {\n      return (api.rows({ selected: true } as never).data().toArray() as T[]) ?? [];\n    } catch {\n      return [];\n    }\n  }\n\n  /**\n   * (Re)mount Angular cell templates into the current page's cells. Old views are destroyed first\n   * so paging/sort/filter/data redraws never leak EmbeddedViews. No-op when no column uses a\n   * template.\n   */\n  private renderCellTemplates(api: Api<T>): void {\n    if (!this.cellTemplates.size) {\n      return;\n    }\n    this.destroyCellViews();\n    const appRef = this.appRef;\n    const views = this.cellViews;\n    this.cellTemplates.forEach((template, colIndex) => {\n      const cells = api.cells(null as never, colIndex, { page: 'current' } as never) as unknown as {\n        every(\n          cb: (this: { node(): HTMLElement | null; data(): unknown; index(): { row: number } }) => void,\n        ): void;\n      };\n      cells.every(function () {\n        const cell = this.node();\n        if (!cell) {\n          return;\n        }\n        const cellData = this.data();\n        const rowIndex = this.index().row;\n        const row = api.row(rowIndex).data() as T;\n        const view = template.createEmbeddedView({\n          $implicit: cellData,\n          cellData,\n          row,\n          rowIndex,\n          colIndex,\n        });\n        appRef.attachView(view);\n        view.detectChanges();\n        cell.replaceChildren(...(view.rootNodes as Node[]));\n        views.add(view);\n      });\n    });\n  }\n\n  /** Detach and destroy all mounted cell-template views. */\n  private destroyCellViews(): void {\n    this.cellViews.forEach((view) => {\n      this.appRef.detachView(view);\n      view.destroy();\n    });\n    this.cellViews.clear();\n  }\n\n  /** Re-enter Angular for an event emission so zoned and zoneless consumers both update. */\n  private emitInZone(fn: () => void): void {\n    this.zone.run(() => {\n      fn();\n      this.cdr.markForCheck();\n    });\n  }\n\n  private teardownInstance(): void {\n    this.destroyCellViews();\n    this.rowClickCleanup?.();\n    this.rowClickCleanup = undefined;\n    const api = untracked(this._instance);\n    if (api) {\n      this.zone.runOutsideAngular(() => {\n        api.off('.ngxdt');\n        api.destroy();\n      });\n    }\n    this._instance.set(undefined);\n    this._selected.set([]);\n  }\n\n  private destroy(): void {\n    this.teardownInstance();\n  }\n}\n","import {\n  afterRenderEffect,\n  ApplicationRef,\n  ChangeDetectorRef,\n  DestroyRef,\n  Directive,\n  ElementRef,\n  type EmbeddedViewRef,\n  inject,\n  input,\n  NgZone,\n  output,\n  untracked,\n} from '@angular/core';\nimport { isObservable, type Observable } from 'rxjs';\nimport type { Api } from 'datatables.net';\nimport { DtTableDirective } from './dt-table.directive';\nimport type { DtColumn } from './dt-cell-template';\nimport type {\n  DtCellEditCancel,\n  DtCellEditCancelReason,\n  DtCellEditCommit,\n  DtCellEditError,\n  DtCellSaveHandler,\n  DtEditContext,\n  DtEditorConfig,\n  DtEditorOption,\n  DtEditorTemplateContext,\n} from './dt-editable.types';\n\n/** Imperative handle over a mounted editor control (native or custom-template). */\ninterface EditorControl {\n  /** The element inserted into the cell. */\n  readonly root: HTMLElement;\n  /** Read the control's current value in the editor's native value type. */\n  read(): unknown;\n  /** Move focus into the control. */\n  focus(): void;\n  /** Enable/disable the control while an async save is in flight. */\n  setBusy(busy: boolean): void;\n  /** Remove listeners / release resources. Does NOT touch the cell DOM. */\n  destroy(): void;\n  /** For `custom` editors, the backing EmbeddedView (so it can be detached + destroyed). */\n  readonly view?: EmbeddedViewRef<DtEditorTemplateContext<unknown>>;\n}\n\n/** Bookkeeping for the single in-flight edit. */\ninterface ActiveEdit<T> {\n  readonly td: HTMLTableCellElement;\n  readonly cell: ReturnType<Api<T>['cell']>;\n  readonly config: DtEditorConfig<T>;\n  readonly ctx: DtEditContext<T>;\n  /** Original cell child nodes, preserved so cancel restores them (incl. live cell-template views). */\n  readonly savedNodes: ChildNode[];\n  readonly control: EditorControl;\n  /** Wrapper element hosting the control (and any error/busy affordances). */\n  readonly wrapper: HTMLElement;\n  /** True while an async save handler is pending; blocks further commit/cancel. */\n  saving: boolean;\n  /** Inline error element (validation or save failure), if currently shown. */\n  errorEl: HTMLElement | null;\n  /** Monotonic token so a stale async save can't write after the editor moved on. */\n  saveToken: number;\n  /** Tears down an in-flight async save subscription (Observable) on teardown/destroy. */\n  saveCleanup: (() => void) | null;\n}\n\n/**\n * `[dtEditable]` — double-click-to-edit-in-place companion to `[dtTable]`.\n *\n * Put it on the same `<table>` as `dtTable`. Columns opt in by carrying an `editor` config\n * (`DtColumn.editor`); a column with no `editor` is read-only. Double-clicking an editable cell\n * opens the configured control (text, textarea, number, date, checkbox, select, multiselect, or a\n * custom `<ng-template>`). Enter / blur commits, Escape cancels.\n *\n * Design mirrors `DtTableDirective`:\n * - The dblclick listener is delegated on the persistent `<tbody>` and (re)attached via an\n *   `afterRenderEffect` keyed on the host's `instance()` signal, so it survives table recreation.\n * - Native controls are built as real DOM elements (full control over parsing, keyboard and a11y);\n *   only `custom` editors use `createEmbeddedView`, attached to `ApplicationRef` like cell templates.\n * - Zoneless-correct: DataTables writes run via `runOutsideAngular`; output emissions re-enter\n *   Angular and `markForCheck()`. Native control listeners fire outside Angular and re-enter on emit.\n * - Commit writes through the DataTables `Api` (`cell().data(v).draw(false)`), keeping sort, filter\n *   and search correct. Cancel restores the exact original cell nodes without a redraw.\n *\n * @typeParam T row data shape (matched to the host `dtTable`).\n */\n@Directive({\n  selector: 'table[dtEditable]',\n  exportAs: 'dtEditable',\n})\nexport class DtEditableDirective<T = unknown> {\n  private readonly host = inject(DtTableDirective) as unknown as DtTableDirective<T>;\n  private readonly hostEl = inject<ElementRef<HTMLTableElement>>(ElementRef);\n  private readonly zone = inject(NgZone);\n  private readonly cdr = inject(ChangeDetectorRef);\n  private readonly appRef = inject(ApplicationRef);\n  private readonly destroyRef = inject(DestroyRef);\n\n  // ---- Inputs -------------------------------------------------------------------------------\n  /**\n   * Type-inference anchor ONLY. `[dtData]` is owned by `dtTable`; declaring the same alias here\n   * lets Angular's template type-checker infer this directive's row type `T` from the bound data\n   * (sibling directives can't otherwise share a generic), so `(dtCellEdit)` etc. are typed. The\n   * value is never read here — `dtTable` is the single source of truth for the data.\n   */\n  readonly dataTypeAnchor = input<readonly T[] | undefined>(undefined, { alias: 'dtData' });\n\n  /**\n   * Optional pessimistic save handler. Runs on commit BEFORE the cell is written. Return a Promise\n   * or Observable to defer the write until it settles (the control shows a busy state); reject/throw\n   * to keep the cell unchanged, surface `dtCellEditError`, and leave the editor open for retry.\n   * Return `void` (or any non-thenable) for a synchronous commit.\n   */\n  readonly save = input<DtCellSaveHandler<T> | undefined>(undefined, { alias: 'dtSave' });\n\n  // ---- Outputs ------------------------------------------------------------------------------\n  /** Emitted when an edit begins (editor opened). */\n  readonly editStart = output<DtEditContext<T>>({ alias: 'dtCellEditStart' });\n  /** Emitted after a changed value is validated, saved and written to the cell. */\n  readonly edit = output<DtCellEditCommit<T>>({ alias: 'dtCellEdit' });\n  /** Emitted when an edit is abandoned (Escape, blur-with-no-change, programmatic close, …). */\n  readonly editCancel = output<DtCellEditCancel<T>>({ alias: 'dtCellEditCancel' });\n  /** Emitted when an async/sync save handler fails; the cell is left unchanged. */\n  readonly editError = output<DtCellEditError<T>>({ alias: 'dtCellEditError' });\n\n  // ---- State --------------------------------------------------------------------------------\n  private active: ActiveEdit<T> | null = null;\n  /** Guard against re-entrant commit/cancel from blur events fired while the cell DOM is changing. */\n  private finishing = false;\n  /** When the next close was keyboard-initiated, return focus to the cell (not on blur/redraw). */\n  private refocusCell = false;\n  /** Set once the directive is destroyed, so a late async save resolution does nothing. */\n  private destroyed = false;\n  /** A Tab move queued behind an in-flight async save, applied once the save commits. */\n  private pendingAdvance: { rowIndex: number; fromCol: number; direction: 1 | -1 } | null = null;\n  private listenerCleanup?: () => void;\n\n  constructor() {\n    // (Re)attach the delegated dblclick listener whenever the table instance appears or changes.\n    // A change of instance means the table was (re)created or destroyed; any editor still open\n    // belongs to now-orphaned DOM, so discard it (silently — the table itself is being rebuilt).\n    afterRenderEffect(() => {\n      const api = this.host.instance();\n      untracked(() => {\n        this.discardActive();\n        this.detachListener();\n        if (api) {\n          this.attachListener(api);\n        }\n      });\n    });\n\n    this.destroyRef.onDestroy(() => {\n      this.destroyed = true;\n      this.discardActive();\n      this.detachListener();\n    });\n  }\n\n  // ---- Listener wiring ----------------------------------------------------------------------\n  private attachListener(api: Api<T>): void {\n    const tbody = this.hostEl.nativeElement.querySelector('tbody');\n    if (!tbody) {\n      return;\n    }\n    const dblHandler = (event: Event) => this.onDblClick(event, api, tbody);\n    tbody.addEventListener('dblclick', dblHandler);\n    // Any redraw NOT caused by our own commit (sort/page/filter/external data change) invalidates an\n    // open editor. We hook `preDraw` (fires BEFORE DataTables touches the DOM) so the editor is\n    // cleanly removed and the cell restored before the redraw re-renders it. Our own commit sets\n    // `finishing`, so this no-ops during that draw.\n    const preDrawHandler = () => this.onPreDraw();\n    api.on('preDraw.ngxedit', preDrawHandler);\n    this.listenerCleanup = () => {\n      tbody.removeEventListener('dblclick', dblHandler);\n      api.off('preDraw.ngxedit', preDrawHandler);\n    };\n  }\n\n  private detachListener(): void {\n    this.listenerCleanup?.();\n    this.listenerCleanup = undefined;\n  }\n\n  private onPreDraw(): void {\n    // An in-flight save (`saving`) can't be cancelled, so we let it settle. DataTables reuses cached\n    // row nodes, so the busy editor survives the external redraw, and the save's own commit-draw then\n    // re-renders the cell cleanly — no orphaned editor is left behind.\n    if (this.active && !this.finishing && !this.active.saving) {\n      this.zone.run(() => this.cancel('programmatic'));\n    }\n  }\n\n  // ---- Open ---------------------------------------------------------------------------------\n  private onDblClick(event: Event, api: Api<T>, tbody: Element): void {\n    const target = event.target as HTMLElement | null;\n    const td = target?.closest('td') as HTMLTableCellElement | null;\n    if (!td || !tbody.contains(td)) {\n      return;\n    }\n    let index: { row: number; column: number } | undefined;\n    let cell: ReturnType<Api<T>['cell']>;\n    try {\n      cell = api.cell(td);\n      index = cell.index() as { row: number; column: number } | undefined;\n    } catch {\n      return; // not a data cell (header/footer/child row)\n    }\n    if (!index) {\n      return;\n    }\n    const colIndex = index.column;\n    const rowIndex = index.row;\n    const config = this.editorFor(colIndex);\n    if (!config) {\n      return; // read-only column\n    }\n    const ctx = this.buildContext(api, cell, rowIndex, colIndex, td);\n    if (config.disabled?.(ctx)) {\n      return;\n    }\n    // Finalize any currently-open editor before opening another.\n    if (this.active && !this.finalizeActive()) {\n      return; // current editor refused to close (e.g. failed validation or an in-flight save)\n    }\n    this.openEditor(td, cell, config, ctx);\n  }\n\n  private buildContext(\n    api: Api<T>,\n    cell: ReturnType<Api<T>['cell']>,\n    rowIndex: number,\n    colIndex: number,\n    td: HTMLTableCellElement,\n  ): DtEditContext<T> {\n    return {\n      api,\n      row: api.row(rowIndex).data() as T,\n      rowIndex,\n      colIndex,\n      columnKey: this.columnKey(colIndex),\n      value: cell.data(),\n      cell: td,\n    };\n  }\n\n  /** Open the editor for an explicit (rowIndex, colIndex) — used by Tab navigation. */\n  private openCellByIndex(api: Api<T>, rowIndex: number, colIndex: number): void {\n    const config = this.editorFor(colIndex);\n    if (!config) {\n      return;\n    }\n    const cell = api.cell(rowIndex, colIndex);\n    const td = (cell.node?.() as HTMLTableCellElement | null) ?? null;\n    if (!td) {\n      return; // cell not on the current page\n    }\n    const ctx = this.buildContext(api, cell, rowIndex, colIndex, td);\n    if (config.disabled?.(ctx)) {\n      return;\n    }\n    this.openEditor(td, cell, config, ctx);\n  }\n\n  /**\n   * Tab / Shift+Tab: commit the current cell, then open the next/previous editable cell in the SAME\n   * row. Cross-row movement is intentionally not performed (it would be ambiguous under paging and\n   * sorting); Tab from the last editable cell simply commits and lets focus leave the table.\n   */\n  private handleTab(direction: 1 | -1): void {\n    const a = this.active;\n    if (!a || a.saving) {\n      return;\n    }\n    const api = a.ctx.api;\n    const rowIndex = a.ctx.rowIndex;\n    const fromCol = a.ctx.colIndex;\n    this.requestCommit('explicit');\n    if (this.active) {\n      // Commit blocked (validation failed) or deferred (async save). Queue the move for after an\n      // async save commits; for a validation block we stay put.\n      if (this.active.saving) {\n        this.pendingAdvance = { rowIndex, fromCol, direction };\n      }\n      return;\n    }\n    this.advanceTo(api, rowIndex, fromCol, direction);\n  }\n\n  /** Open the next/previous editable cell in the row, if any. */\n  private advanceTo(api: Api<T>, rowIndex: number, fromCol: number, direction: 1 | -1): void {\n    const nextCol = this.findEditableColumn(api, rowIndex, fromCol, direction);\n    if (nextCol != null) {\n      this.openCellByIndex(api, rowIndex, nextCol);\n    }\n  }\n\n  private findEditableColumn(\n    api: Api<T>,\n    rowIndex: number,\n    fromCol: number,\n    direction: 1 | -1,\n  ): number | null {\n    const cols = this.resolvedColumns();\n    if (!cols) {\n      return null;\n    }\n    for (let c = fromCol + direction; c >= 0 && c < cols.length; c += direction) {\n      const editor = cols[c]?.editor;\n      if (!editor) {\n        continue;\n      }\n      const cell = api.cell(rowIndex, c);\n      const td = (cell.node?.() as HTMLTableCellElement | null) ?? null;\n      if (!td) {\n        continue;\n      }\n      if (editor.disabled && editor.disabled(this.buildContext(api, cell, rowIndex, c, td))) {\n        continue;\n      }\n      return c;\n    }\n    return null;\n  }\n\n  private openEditor(\n    td: HTMLTableCellElement,\n    cell: ReturnType<Api<T>['cell']>,\n    config: DtEditorConfig<T>,\n    ctx: DtEditContext<T>,\n  ): void {\n    const savedNodes = Array.from(td.childNodes);\n    const control = this.buildControl(config, ctx);\n    const wrapper = document.createElement('div');\n    wrapper.className = 'ngxdt-editor';\n    wrapper.appendChild(control.root);\n    td.replaceChildren(wrapper);\n    td.classList.add('ngxdt-editing');\n\n    this.active = {\n      td,\n      cell,\n      config,\n      ctx,\n      savedNodes,\n      control,\n      wrapper,\n      saving: false,\n      errorEl: null,\n      saveToken: 0,\n      saveCleanup: null,\n    };\n    control.focus();\n    this.emitInZone(() => this.editStart.emit(ctx));\n  }\n\n  // ---- Commit / cancel ----------------------------------------------------------------------\n  /** Native commit trigger (Enter / blur / Tab): read the control and commit. */\n  private requestCommit(trigger: 'explicit' | 'blur'): void {\n    const a = this.active;\n    if (!a || this.finishing || a.saving) {\n      return;\n    }\n    this.doCommit(a.control.read(), trigger);\n  }\n\n  private doCommit(newValue: unknown, trigger: 'explicit' | 'blur'): void {\n    const a = this.active;\n    if (!a || this.finishing || a.saving) {\n      return;\n    }\n    const oldValue = a.ctx.value;\n    if (this.valuesEqual(oldValue, newValue)) {\n      this.cancel('unchanged');\n      return;\n    }\n    // Synchronous validation gate.\n    const error = a.config.validate?.(newValue, a.ctx.row);\n    if (error) {\n      if (trigger === 'blur') {\n        // Don't trap focus on blur: discard the invalid value and revert.\n        this.cancel('invalid');\n      } else {\n        this.showError(a, error);\n        this.refocusCell = false; // editor stays open; keep focus in the control\n        a.control.focus();\n      }\n      return;\n    }\n    this.clearError(a);\n    const commit: DtCellEditCommit<T> = { ...a.ctx, oldValue, newValue };\n    const save = this.save();\n    if (!save) {\n      this.write(a, commit);\n      return;\n    }\n\n    // Run the (possibly async) save before writing — pessimistic.\n    let result: ReturnType<DtCellSaveHandler<T>>;\n    try {\n      result = save(commit);\n    } catch (error) {\n      this.handleSaveError(a, commit, error);\n      return;\n    }\n    if (!this.isAsync(result)) {\n      this.write(a, commit);\n      return;\n    }\n    const token = ++a.saveToken;\n    this.beginSaving(a);\n    this.toPromise(result, a).then(\n      () =>\n        this.zone.run(() => {\n          a.saveCleanup = null;\n          if (!this.destroyed && this.active === a && a.saveToken === token) {\n            a.saving = false;\n            this.write(a, commit);\n          }\n        }),\n      (error: unknown) =>\n        this.zone.run(() => {\n          a.saveCleanup = null;\n          if (!this.destroyed && this.active === a && a.saveToken === token) {\n            a.saving = false;\n            this.handleSaveError(a, commit, error);\n          }\n        }),\n    );\n  }\n\n  /** Write the committed value through the Api, close the editor, and emit `dtCellEdit`. */\n  private write(a: ActiveEdit<T>, commit: DtCellEditCommit<T>): void {\n    this.finishing = true;\n    // Tear the editor down BEFORE the redraw: detach/destroy our view and drop listeners while the\n    // cell DOM is still ours, so the `draw(false)` below re-renders a clean cell (and the host\n    // directive's cell-template rebuild never races a half-destroyed control).\n    this.teardownControl(a);\n    const api = a.ctx.api;\n    this.zone.runOutsideAngular(() => {\n      a.cell.data(commit.newValue as never);\n      api.draw(false); // re-renders the cell from data; keeps the current page\n    });\n    a.td.classList.remove('ngxdt-editing');\n    this.active = null;\n    this.finishing = false;\n    this.maybeRefocus(a.td);\n    this.emitInZone(() => this.edit.emit(commit));\n    // A Tab move that was queued behind an async save: advance now that the cell has committed.\n    if (this.pendingAdvance) {\n      const adv = this.pendingAdvance;\n      this.pendingAdvance = null;\n      this.advanceTo(api, adv.rowIndex, adv.fromCol, adv.direction);\n    }\n  }\n\n  /** A save handler failed: keep the cell unchanged, show the error, and leave the editor open. */\n  private handleSaveError(a: ActiveEdit<T>, commit: DtCellEditCommit<T>, error: unknown): void {\n    this.pendingAdvance = null; // a failed save cancels any queued Tab advance\n    this.endSaving(a);\n    this.showError(a, this.errorMessage(error));\n    a.control.focus();\n    const evt: DtCellEditError<T> = { ...commit, error };\n    this.emitInZone(() => this.editError.emit(evt));\n  }\n\n  private cancel(reason: DtCellEditCancelReason): void {\n    const a = this.active;\n    if (!a || this.finishing || a.saving) {\n      return; // ignore cancel while a save is in flight\n    }\n    this.finishing = true;\n    // Put the original cell nodes back (preserves any live cell-template view). When a redraw is\n    // imminent (preDraw), this restores the cell to its pre-edit state so the redraw re-renders it\n    // cleanly rather than over a dangling editor control.\n    a.td.replaceChildren(...a.savedNodes);\n    a.td.classList.remove('ngxdt-editing');\n    this.teardownControl(a);\n    this.active = null;\n    this.finishing = false;\n    this.maybeRefocus(a.td);\n    const evt: DtCellEditCancel<T> = { ...a.ctx, reason };\n    this.emitInZone(() => this.editCancel.emit(evt));\n  }\n\n  /** Close any open editor on destroy WITHOUT emitting (the component is going away). */\n  private discardActive(): void {\n    const a = this.active;\n    if (!a) {\n      return;\n    }\n    this.finishing = true;\n    this.pendingAdvance = null;\n    a.td.replaceChildren(...a.savedNodes);\n    this.teardownControl(a);\n    this.active = null;\n    this.finishing = false;\n  }\n\n  /** Commit the active editor (used before opening another). Returns true if it closed. */\n  private finalizeActive(): boolean {\n    const a = this.active;\n    if (!a) {\n      return true;\n    }\n    if (a.config.type === 'custom') {\n      this.cancel('programmatic');\n      return this.active === null;\n    }\n    this.doCommit(a.control.read(), 'explicit');\n    return this.active === null;\n  }\n\n  private teardownControl(a: ActiveEdit<T>): void {\n    a.saveCleanup?.(); // unsubscribe an in-flight Observable save, if any\n    a.saveCleanup = null;\n    a.control.destroy();\n    const view = a.control.view;\n    if (view) {\n      this.appRef.detachView(view);\n      view.destroy();\n    }\n  }\n\n  // ---- Async save plumbing ------------------------------------------------------------------\n  private isAsync(result: unknown): result is Promise<unknown> | Observable<unknown> {\n    return (\n      !!result &&\n      (typeof (result as { then?: unknown }).then === 'function' || isObservable(result))\n    );\n  }\n\n  /**\n   * Normalize a Promise/Observable save result to a Promise that resolves on first value/complete.\n   * For an Observable, registers `a.saveCleanup` so an in-flight subscription is torn down if the\n   * editor closes or the directive is destroyed before it settles (no leaked subscriptions).\n   */\n  private toPromise(\n    result: Promise<unknown> | Observable<unknown>,\n    a: ActiveEdit<T>,\n  ): Promise<void> {\n    if (isObservable(result)) {\n      return new Promise<void>((resolve, reject) => {\n        let settled = false;\n        const sub = result.subscribe({\n          next: () => {\n            if (!settled) {\n              settled = true;\n              resolve();\n              // Defer: for a synchronous Observable `sub` is not assigned yet when `next` fires.\n              queueMicrotask(() => sub.unsubscribe());\n            }\n          },\n          error: (err) => {\n            if (!settled) {\n              settled = true;\n              reject(err);\n            }\n          },\n          complete: () => {\n            if (!settled) {\n              settled = true;\n              resolve();\n            }\n          },\n        });\n        a.saveCleanup = () => sub.unsubscribe();\n      });\n    }\n    return Promise.resolve(result).then(() => undefined);\n  }\n\n  private beginSaving(a: ActiveEdit<T>): void {\n    a.saving = true;\n    a.td.classList.add('ngxdt-editing--busy');\n    a.control.setBusy(true);\n  }\n\n  private endSaving(a: ActiveEdit<T>): void {\n    a.saving = false;\n    a.td.classList.remove('ngxdt-editing--busy');\n    a.control.setBusy(false);\n  }\n\n  private showError(a: ActiveEdit<T>, message: string): void {\n    if (!a.errorEl) {\n      const el = document.createElement('div');\n      el.className = 'ngxdt-editor__error';\n      el.setAttribute('role', 'alert');\n      // Minimal inline styling so the message is legible without any consumer CSS; everything is\n      // overridable via the `.ngxdt-editor__error` class.\n      el.style.color = '#b00020';\n      el.style.fontSize = '0.8em';\n      el.style.lineHeight = '1.3';\n      el.style.marginTop = '2px';\n      a.wrapper.appendChild(el);\n      a.errorEl = el;\n    }\n    a.errorEl.textContent = message;\n  }\n\n  private clearError(a: ActiveEdit<T>): void {\n    if (a.errorEl) {\n      a.errorEl.remove();\n      a.errorEl = null;\n    }\n  }\n\n  private errorMessage(error: unknown): string {\n    if (typeof error === 'string' && error.trim()) {\n      return error;\n    }\n    if (error instanceof Error && error.message) {\n      return error.message;\n    }\n    return 'Save failed';\n  }\n\n  // ---- Control factories --------------------------------------------------------------------\n  private buildControl(config: DtEditorConfig<T>, ctx: DtEditContext<T>): EditorControl {\n    switch (config.type) {\n      case 'text':\n        return this.inputControl(config, ctx, 'text');\n      case 'number':\n        return this.inputControl(config, ctx, 'number');\n      case 'date':\n        return this.inputControl(config, ctx, 'date');\n      case 'textarea':\n        return this.textareaControl(config, ctx);\n      case 'checkbox':\n        return this.checkboxControl(config, ctx);\n      case 'select':\n        return this.selectControl(config, ctx, false);\n      case 'multiselect':\n        return this.selectControl(config, ctx, true);\n      case 'custom':\n        return this.customControl(config, ctx);\n    }\n  }\n\n  private inputControl(\n    config: Extract<DtEditorConfig<T>, { type: 'text' | 'number' | 'date' }>,\n    ctx: DtEditContext<T>,\n    domType: 'text' | 'number' | 'date',\n  ): EditorControl {\n    const input = document.createElement('input');\n    input.type = domType;\n    input.className = `ngxdt-editor__input ngxdt-editor__input--${domType}`;\n    this.styleFill(input);\n    input.value = ctx.value == null ? '' : String(ctx.value);\n    this.applyAria(input, config, ctx);\n    if ('placeholder' in config && config.placeholder) {\n      input.placeholder = config.placeholder;\n    }\n    if (config.type === 'text' && config.maxLength != null) {\n      input.maxLength = config.maxLength;\n    }\n    if (config.type === 'number') {\n      if (config.min != null) input.min = String(config.min);\n      if (config.max != null) input.max = String(config.max);\n      if (config.step != null) input.step = String(config.step);\n    }\n    if (config.type === 'date') {\n      if (config.min) input.min = config.min;\n      if (config.max) input.max = config.max;\n    }\n\n    const read = (): unknown => {\n      const raw = input.value;\n      if (domType === 'number') {\n        if (raw.trim() === '') return null;\n        const n = Number(raw);\n        return Number.isNaN(n) ? null : n;\n      }\n      if (domType === 'date') {\n        return raw === '' ? null : raw;\n      }\n      return raw;\n    };\n    return this.wireControl(input, read);\n  }\n\n  private textareaControl(\n    config: Extract<DtEditorConfig<T>, { type: 'textarea' }>,\n    ctx: DtEditContext<T>,\n  ): EditorControl {\n    const ta = document.createElement('textarea');\n    ta.className = 'ngxdt-editor__input ngxdt-editor__input--textarea';\n    this.styleFill(ta);\n    ta.rows = config.rows ?? 3;\n    ta.value = ctx.value == null ? '' : String(ctx.value);\n    this.applyAria(ta, config, ctx);\n    if (config.placeholder) ta.placeholder = config.placeholder;\n    if (config.maxLength != null) ta.maxLength = config.maxLength;\n    // In a textarea plain Enter inserts a newline; commit on Ctrl/Cmd+Enter (and blur).\n    return this.wireControl(ta, () => ta.value, { commitOnPlainEnter: false });\n  }\n\n  private checkboxControl(\n    config: Extract<DtEditorConfig<T>, { type: 'checkbox' }>,\n    ctx: DtEditContext<T>,\n  ): EditorControl {\n    const box = document.createElement('input');\n    box.type = 'checkbox';\n    box.className = 'ngxdt-editor__input ngxdt-editor__input--checkbox';\n    box.checked = ctx.value === true || ctx.value === 'true' || ctx.value === 1;\n    this.applyAria(box, config, ctx);\n    return this.wireControl(box, () => box.checked);\n  }\n\n  private selectControl(\n    config: Extract<DtEditorConfig<T>, { type: 'select' | 'multiselect' }>,\n    ctx: DtEditContext<T>,\n    multiple: boolean,\n  ): EditorControl {\n    const select = document.createElement('select');\n    select.className = `ngxdt-editor__input ngxdt-editor__input--${config.type}`;\n    this.styleFill(select);\n    select.multiple = multiple;\n    this.applyAria(select, config, ctx);\n\n    const options: readonly DtEditorOption[] =\n      typeof config.options === 'function' ? config.options(ctx) : config.options;\n\n    const currentArray: unknown[] = multiple\n      ? Array.isArray(ctx.value)\n        ? (ctx.value as unknown[])\n        : []\n      : [];\n\n    if (!multiple && 'placeholder' in config && config.placeholder) {\n      const ph = document.createElement('option');\n      ph.value = '';\n      ph.textContent = config.placeholder;\n      if (ctx.value == null) ph.selected = true;\n      select.appendChild(ph);\n    }\n\n    options.forEach((opt, i) => {\n      const o = document.createElement('option');\n      o.value = String(i);\n      o.textContent = opt.label;\n      if (opt.disabled) o.disabled = true;\n      if (multiple) {\n        o.selected = currentArray.some((v) => v === opt.value);\n      } else {\n        o.selected = ctx.value === opt.value;\n      }\n      select.appendChild(o);\n    });\n\n    const read = (): unknown => {\n      if (multiple) {\n        return Array.from(select.selectedOptions)\n          .filter((o) => o.value !== '')\n          .map((o) => options[Number(o.value)]?.value)\n          .filter((v) => v !== undefined);\n      }\n      const sel = select.selectedOptions[0];\n      if (!sel || sel.value === '') return null;\n      return options[Number(sel.value)]?.value ?? null;\n    };\n    return this.wireControl(select, read);\n  }\n\n  private customControl(\n    config: Extract<DtEditorConfig<T>, { type: 'custom' }>,\n    ctx: DtEditContext<T>,\n  ): EditorControl {\n    const view = config.template.createEmbeddedView({\n      $implicit: ctx.value,\n      value: ctx.value,\n      row: ctx.row,\n      rowIndex: ctx.rowIndex,\n      colIndex: ctx.colIndex,\n      commit: (v: unknown) => this.zone.run(() => this.doCommit(v, 'explicit')),\n      cancel: () => this.zone.run(() => this.cancel('programmatic')),\n    }) as EmbeddedViewRef<DtEditorTemplateContext<unknown>>;\n    this.appRef.attachView(view);\n    view.detectChanges();\n    const root = document.createElement('div');\n    root.className = 'ngxdt-editor__custom';\n    root.append(...(view.rootNodes as Node[]));\n    return {\n      root,\n      read: () => ctx.value,\n      focus: () => this.focusFirst(root),\n      setBusy: (busy: boolean) => root.classList.toggle('ngxdt-editor__custom--busy', busy),\n      destroy: () => {},\n      view,\n    };\n  }\n\n  /** Attach Enter/Escape/blur handling shared by every native control. */\n  private wireControl(\n    el: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement,\n    read: () => unknown,\n    opts: { commitOnPlainEnter?: boolean } = {},\n  ): EditorControl {\n    const commitOnPlainEnter = opts.commitOnPlainEnter ?? true;\n    const onKeydown = (event: KeyboardEvent) => {\n      if (event.key === 'Escape') {\n        event.preventDefault();\n        this.refocusCell = true;\n        this.zone.run(() => this.cancel('escape'));\n        return;\n      }\n      if (event.key === 'Tab') {\n        event.preventDefault();\n        this.refocusCell = false;\n        this.zone.run(() => this.handleTab(event.shiftKey ? -1 : 1));\n        return;\n      }\n      if (event.key === 'Enter') {\n        const withMod = event.ctrlKey || event.metaKey;\n        if (commitOnPlainEnter || withMod) {\n          event.preventDefault();\n          this.refocusCell = true;\n          this.zone.run(() => this.requestCommit('explicit'));\n        }\n      }\n    };\n    const onBlur = () => {\n      // Commit on blur, unless we're already tearing down (avoids re-entrancy on DOM removal).\n      if (!this.finishing && this.active && !this.active.saving) {\n        this.zone.run(() => this.requestCommit('blur'));\n      }\n    };\n    el.addEventListener('keydown', onKeydown as EventListener);\n    el.addEventListener('blur', onBlur);\n    return {\n      root: el,\n      read,\n      focus: () => {\n        el.focus();\n        if (el instanceof HTMLInputElement && (el.type === 'text' || el.type === 'number')) {\n          el.select();\n        }\n      },\n      setBusy: (busy: boolean) => {\n        el.disabled = busy;\n      },\n      destroy: () => {\n        el.removeEventListener('keydown', onKeydown as EventListener);\n        el.removeEventListener('blur', onBlur);\n      },\n    };\n  }\n\n  // ---- Helpers ------------------------------------------------------------------------------\n  private editorFor(colIndex: number): DtEditorConfig<T> | undefined {\n    return this.resolvedColumns()?.[colIndex]?.editor;\n  }\n\n  private resolvedColumns(): DtColumn<T>[] | undefined {\n    const cols = this.host.columns();\n    if (cols) {\n      return cols;\n    }\n    return this.host.options().columns as DtColumn<T>[] | undefined;\n  }\n\n  private columnKey(colIndex: number): string | number | null {\n    const data = this.resolvedColumns()?.[colIndex]?.data;\n    return typeof data === 'string' || typeof data === 'number' ? data : null;\n  }\n\n  private valuesEqual(a: unknown, b: unknown): boolean {\n    if (a === b) {\n      return true;\n    }\n    if (Array.isArray(a) && Array.isArray(b)) {\n      if (a.length !== b.length) return false;\n      const sa = [...a].map((x) => JSON.stringify(x)).sort();\n      const sb = [...b].map((x) => JSON.stringify(x)).sort();\n      return sa.every((x, i) => x === sb[i]);\n    }\n    return false;\n  }\n\n  private applyAria(el: HTMLElement, config: DtEditorConfig<T>, ctx: DtEditContext<T>): void {\n    const label = config.ariaLabel ?? this.columnTitle(ctx.colIndex);\n    if (label) {\n      el.setAttribute('aria-label', label);\n    }\n  }\n\n  private columnTitle(colIndex: number): string | undefined {\n    const title = this.resolvedColumns()?.[colIndex]?.title;\n    return typeof title === 'string' ? title : undefined;\n  }\n\n  private styleFill(el: HTMLElement): void {\n    el.style.width = '100%';\n    el.style.boxSizing = 'border-box';\n  }\n\n  private focusFirst(root: HTMLElement): void {\n    const focusable = root.querySelector<HTMLElement>(\n      'input, textarea, select, button, [tabindex]',\n    );\n    focusable?.focus();\n  }\n\n  /** Return focus to the edited cell after a keyboard-initiated close, for keyboard continuity. */\n  private maybeRefocus(td: HTMLTableCellElement): void {\n    if (!this.refocusCell) {\n      return;\n    }\n    this.refocusCell = false;\n    if (!td.isConnected) {\n      return;\n    }\n    if (!td.hasAttribute('tabindex')) {\n      td.setAttribute('tabindex', '-1'); // focusable programmatically, but not in the tab order\n    }\n    td.focus();\n  }\n\n  private emitInZone(fn: () => void): void {\n    this.zone.run(() => {\n      fn();\n      this.cdr.markForCheck();\n    });\n  }\n}\n","import { EnvironmentProviders, makeEnvironmentProviders, Provider } from '@angular/core';\nimport type { Config } from 'datatables.net';\nimport { DT_DEFAULT_OPTIONS, DT_ESCAPE_DEFAULTS } from './datatables.tokens';\n\n/**\n * A composable unit of DataTables configuration. Styling adapters\n * (`ngx-datatables-net/dt`, `/bs5`, `/tailwind`, `/material`) each export a `with*()` feature\n * returning one of these.\n */\nexport interface DataTablesFeature {\n  readonly providers: Provider[];\n}\n\n/**\n * Configure ngx-datatables-net at the application (or route/component) level.\n *\n * @example\n * // app.config.ts\n * providers: [provideDataTables(withDefaultStyling(), withOptions({ pageLength: 25 }))]\n */\nexport function provideDataTables(...features: DataTablesFeature[]): EnvironmentProviders {\n  return makeEnvironmentProviders(features.flatMap((feature) => feature.providers));\n}\n\n/**\n * Set application-wide default DataTables options, merged *under* each table's own `dtOptions`.\n */\nexport function withOptions(defaults: Config): DataTablesFeature {\n  return { providers: [{ provide: DT_DEFAULT_OPTIONS, useValue: defaults }] };\n}\n\n/**\n * Escape every column that has no explicit `render`, overriding DataTables' unsafe\n * HTML-by-default behavior. Strongly recommended whenever a table can display untrusted data.\n * Columns with their own `render` (including the sanitized-HTML renderer) are left untouched.\n *\n * @example\n * provideDataTables(withDefaultStyling(), withSafeDefaults())\n */\nexport function withSafeDefaults(): DataTablesFeature {\n  return { providers: [{ provide: DT_ESCAPE_DEFAULTS, useValue: true }] };\n}\n","/*\n * Public API surface of ngx-datatables-net.\n *\n * Only what is exported here is part of the package's supported surface. Styling adapters live in\n * their own secondary entry points (`ngx-datatables-net/dt`, `/bs5`, `/tailwind`, `/material`).\n */\nexport * from './lib/datatables.types';\nexport * from './lib/datatables.tokens';\nexport * from './lib/dt-cell-template';\nexport * from './lib/dt-editable.types';\nexport * from './lib/dt-editable.directive';\nexport * from './lib/dt-events';\nexport * from './lib/dt-render';\nexport * from './lib/dt-table.directive';\nexport * from './lib/provide-datatables';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAcA;;;;;;AAM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