{"version":3,"file":"ngx-t-forms-record-list-manager.component-CfZdqKhY.mjs","sources":["../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/record-list-manager/record-list-manager.component.ts","../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/record-list-manager/record-list-manager.component.html"],"sourcesContent":["import { CdkPortalOutletAttachedRef, ComponentPortal, PortalModule } from '@angular/cdk/portal';\r\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\r\nimport {\r\n  ChangeDetectionStrategy,\r\n  Component,\r\n  ComponentRef,\r\n  DestroyRef,\r\n  ElementRef,\r\n  Input,\r\n  ViewEncapsulation,\r\n  computed,\r\n  effect,\r\n  inject,\r\n  input,\r\n  output,\r\n  signal,\r\n} from '@angular/core';\r\nimport { outputToObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\nimport { NgControl } from '@angular/forms';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatCardModule } from '@angular/material/card';\r\nimport { MatDividerModule } from '@angular/material/divider';\r\nimport { MatExpansionModule } from '@angular/material/expansion';\r\nimport { MatFormFieldControl } from '@angular/material/form-field';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\r\nimport { MatTableDataSource, MatTableModule } from '@angular/material/table';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport type {\r\n  ElementEditorConfigSectionInterface,\r\n  ElementEditorInnerSectionElementInterface,\r\n  FormColumnInputs,\r\n} from 'ngx-t-forms-types';\r\nimport { Subject, Subscription } from 'rxjs';\r\nimport { _isEqual } from '../../../../shared/functions/isEqual';\r\nimport { assignDeepPropertyToObject } from '../../../../shared/functions/assignDeepPropertyToObject';\r\nimport { safeReturnDeepProperty } from '../../../../shared/functions/getDeepObject';\r\nimport { EmptyStateComponent } from '../_shared/empty-state/empty-state.component';\r\nimport type { IConfigElementError } from '../../t-dynamic-data-edit.component';\r\nimport type { TDynamicDataEditComponent } from '../../t-dynamic-data-edit.component';\r\nimport { NESTED_EDITOR_COMPONENT } from '../../nested-editor.token';\r\nimport { testAgainstItem } from '../../functions/testData';\r\n\r\n/** Row shape held by the record list. Heterogeneous wrapper-defined records. */\r\ntype RecordListRow = Record<string, unknown> & { id?: string };\r\n\r\n/** Table column descriptor (label header + the row key it renders). */\r\ninterface RecordColumn {\r\n  readonly label: string;\r\n  readonly value: string;\r\n}\r\n\r\n/** Synthetic column key for the per-row edit/delete action cell. */\r\nconst ACTIONS_COLUMN = 'actions';\r\n\r\n/**\r\n * Internal record-list manager. Implements `MatFormFieldControl<unknown[]>` and is\r\n * embedded by `t-dynamic-data-edit` for `RecordListManager` editor types.\r\n *\r\n * Owns only its content (table + edit panel). The parent `mat-form-field` renders\r\n * the label, hint, and validation errors, so this component adds neither a header\r\n * nor an inline error list.\r\n *\r\n * Per-record editing is delegated to a dynamically-attached `TDynamicDataEditComponent`\r\n * portal per inner-section element; the portal's `valueChange` output is patched back\r\n * into the in-edit buffer via the element's `deepBind` path.\r\n *\r\n * NOTE: `MatFormFieldControl<T>` mandates plain mutable `value` / `disabled` /\r\n * `required` / `placeholder` / `id` members, `@Input()` decorators, the\r\n * `focused` / `touched` / `stateChanges` members, and the `useExisting` provider.\r\n * These are framework wiring, not defects — the CLAUDE.md bans on `@Input()` /\r\n * `useExisting` do not apply to MatFormFieldControl integration.\r\n *\r\n * @internal Not exported via public-api.ts.\r\n */\r\n@Component({\r\n  selector: 'lib-record-list-manager',\r\n  templateUrl: './record-list-manager.component.html',\r\n  styleUrl: './record-list-manager.component.scss',\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  encapsulation: ViewEncapsulation.Emulated,\r\n  imports: [\r\n    MatButtonModule,\r\n    MatCardModule,\r\n    MatDividerModule,\r\n    MatExpansionModule,\r\n    MatIconModule,\r\n    MatProgressSpinnerModule,\r\n    MatTableModule,\r\n    MatTooltipModule,\r\n    PortalModule,\r\n    EmptyStateComponent,\r\n  ],\r\n  providers: [{ provide: MatFormFieldControl, useExisting: RecordListManagerComponent }],\r\n  host: {\r\n    'class': 'lib-record-list-manager',\r\n    '[id]': 'id',\r\n    '[attr.aria-describedby]': 'describedBy',\r\n    '[class.lib-record-list-manager--floating]': 'shouldLabelFloat',\r\n  },\r\n})\r\nexport class RecordListManagerComponent implements MatFormFieldControl<unknown[]> {\r\n  static nextId = 0;\r\n\r\n  // --- MatFormFieldControl wiring (plain mutable members, framework-mandated) ---\r\n  readonly stateChanges = new Subject<void>();\r\n  readonly controlType = 'lib-record-list-manager';\r\n\r\n  focused = false;\r\n  touched = false;\r\n  autofilled = false;\r\n  id = `lib-record-list-manager-${RecordListManagerComponent.nextId++}`;\r\n  describedBy = '';\r\n\r\n  /** Optional wrapper-supplied mapping payload (shape determined by wrapper). */\r\n  @Input() mapToData: unknown;\r\n\r\n  /** Validation errors surfaced by the parent for error-state derivation. */\r\n  @Input() errors: IConfigElementError[] | undefined = [];\r\n\r\n  #disabled = false;\r\n  @Input()\r\n  get disabled(): boolean {\r\n    return this.#disabled;\r\n  }\r\n  set disabled(value: boolean) {\r\n    this.#disabled = coerceBooleanProperty(value);\r\n    this.stateChanges.next();\r\n  }\r\n\r\n  #required = false;\r\n  @Input()\r\n  get required(): boolean {\r\n    return this.#required;\r\n  }\r\n  set required(value: boolean) {\r\n    this.#required = coerceBooleanProperty(value);\r\n    this.stateChanges.next();\r\n  }\r\n\r\n  #placeholder = '';\r\n  @Input()\r\n  get placeholder(): string {\r\n    return this.#placeholder;\r\n  }\r\n  set placeholder(value: string) {\r\n    this.#placeholder = value;\r\n    this.stateChanges.next();\r\n  }\r\n\r\n  /**\r\n   * Record rows held by the table. Parent passes heterogeneous payloads\r\n   * (`{}` initial / arrays / null); non-array writes coerce to an empty list.\r\n   */\r\n  @Input()\r\n  get value(): RecordListRow[] {\r\n    return this.#rows();\r\n  }\r\n  set value(val: unknown) {\r\n    const next = Array.isArray(val) ? (val as RecordListRow[]) : [];\r\n    this.#rows.set(next);\r\n    this.onChange(next);\r\n    this.stateChanges.next();\r\n  }\r\n\r\n  get shouldLabelFloat(): boolean {\r\n    return this.focused || !this.empty;\r\n  }\r\n\r\n  get empty(): boolean {\r\n    return this.#rows().length === 0;\r\n  }\r\n\r\n  get errorState(): boolean {\r\n    const requiredUnset = this.empty && this.#required && this.touched;\r\n    const ngControlError = this.ngControl?.errors != null;\r\n    const externalError = (this.errors?.length ?? 0) > 0;\r\n    return requiredUnset || ngControlError || externalError;\r\n  }\r\n\r\n  // --- DI ---\r\n  readonly ngControl = inject(NgControl, { self: true, optional: true });\r\n  readonly #elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\r\n  readonly #destroyRef = inject(DestroyRef);\r\n  /** The component portalled per record — injected to avoid a circular import. */\r\n  readonly #nestedEditor = inject(NESTED_EDITOR_COMPONENT);\r\n\r\n  constructor() {\r\n    if (this.ngControl != null) {\r\n      this.ngControl.valueAccessor = this;\r\n    }\r\n    this.#destroyRef.onDestroy(() => {\r\n      this.stateChanges.complete();\r\n      this.#teardownPortalSubscriptions();\r\n    });\r\n  }\r\n\r\n  // --- ControlValueAccessor ---\r\n  onChange: (_: unknown) => void = () => {\r\n    /* noop until registered */\r\n  };\r\n  onTouched: () => void = () => {\r\n    /* noop until registered */\r\n  };\r\n\r\n  writeValue(value: unknown): void {\r\n    this.#rows.set(Array.isArray(value) ? (value as RecordListRow[]) : []);\r\n    this.stateChanges.next();\r\n  }\r\n\r\n  registerOnChange(fn: (_: unknown) => void): void {\r\n    this.onChange = fn;\r\n  }\r\n\r\n  registerOnTouched(fn: () => void): void {\r\n    this.onTouched = fn;\r\n  }\r\n\r\n  setDisabledState(isDisabled: boolean): void {\r\n    this.disabled = isDisabled;\r\n  }\r\n\r\n  setDescribedByIds(ids: string[]): void {\r\n    this.describedBy = ids.join(' ');\r\n    this.#elementRef.nativeElement.setAttribute('aria-describedby', this.describedBy);\r\n    this.stateChanges.next();\r\n  }\r\n\r\n  onContainerClick(): void {\r\n    this.markAsTouched();\r\n    if (!this.focused) {\r\n      this.focused = true;\r\n      this.stateChanges.next();\r\n    }\r\n  }\r\n\r\n  markAsTouched(): void {\r\n    if (!this.touched) {\r\n      this.touched = true;\r\n      this.onTouched();\r\n      this.stateChanges.next();\r\n    }\r\n  }\r\n\r\n  // --- Internal reactive state (signal-first) ---\r\n\r\n  /** Backing rows; the `MatTableDataSource` is kept in sync via an effect. */\r\n  readonly #rows = signal<RecordListRow[]>([]);\r\n\r\n  /** Table data source whose `.data` mirrors `#rows()`. */\r\n  readonly dataSource = new MatTableDataSource<RecordListRow>([]);\r\n\r\n  /** Row currently being edited, or `null` when no edit is in progress. */\r\n  readonly #inEdit = signal<RecordListRow | null>(null);\r\n\r\n  /** Inner editor sections derived from the active editor config. */\r\n  readonly #sections = signal<readonly ElementEditorConfigSectionInterface[]>([]);\r\n\r\n  /** Lazily-built portals keyed by inner-section element id. */\r\n  readonly #portals = signal<Readonly<Record<string, ComponentPortal<TDynamicDataEditComponent>>>>(\r\n    {},\r\n  );\r\n\r\n  /** Active per-element portal output subscriptions, keyed by element id. */\r\n  readonly #portalSubscriptions = new Map<string, Subscription>();\r\n\r\n  /** Form input definitions forwarded into the dynamic editor portals. */\r\n  readonly formInputs = input<Array<FormColumnInputs>>([]);\r\n\r\n  /** Editor configuration for this record-list element. */\r\n  readonly editorConfig = input<ElementEditorInnerSectionElementInterface | undefined>(undefined);\r\n\r\n  /** Emits whenever the record list value changes. */\r\n  readonly valueChange = output<RecordListRow[]>();\r\n\r\n  // --- Template-facing derived state ---\r\n\r\n  protected readonly inEditRow = this.#inEdit.asReadonly();\r\n  protected readonly portals = this.#portals.asReadonly();\r\n\r\n  /**\r\n   * Inner sections with each element list narrowed to the elements whose\r\n   * `additionalTest` entries ALL pass against the record being edited — the same\r\n   * rule `isElementApplicable` applies to top-level editor elements.\r\n   *\r\n   * An element without `additionalTest` always shows. When a section hides nothing,\r\n   * the original section object is returned, and when no section hides anything the\r\n   * original array is returned, so consumers that never configured a test (the\r\n   * reports / dashboard chart config, for one) get object-identical output and\r\n   * behave exactly as before.\r\n   */\r\n  protected readonly visibleSections = computed<readonly ElementEditorConfigSectionInterface[]>(\r\n    () => {\r\n      const record = this.#inEdit();\r\n      const sections = this.#sections();\r\n      let narrowed = false;\r\n      const next = sections.map((section) => {\r\n        const elements = section.elements.filter((element) =>\r\n          (element.additionalTest ?? []).every((test) => testAgainstItem(test, record)),\r\n        );\r\n        if (elements.length === section.elements.length) {\r\n          return section;\r\n        }\r\n        narrowed = true;\r\n        return { ...section, elements };\r\n      });\r\n      return narrowed ? next : sections;\r\n    },\r\n  );\r\n\r\n  protected readonly tableColumns = computed<readonly RecordColumn[]>(() => [\r\n    ...(this.editorConfig()?.options ?? []).map((opt) => ({\r\n      label: String(opt.label),\r\n      value: String(opt.value),\r\n    })),\r\n    { label: ' ', value: ACTIONS_COLUMN },\r\n  ]);\r\n\r\n  protected readonly displayedColumns = computed<readonly string[]>(() =>\r\n    this.tableColumns().map((c) => c.value),\r\n  );\r\n\r\n  protected readonly rowCount = computed<number>(() => this.#rows().length);\r\n\r\n  protected readonly isActionsColumn = (column: string): boolean => column === ACTIONS_COLUMN;\r\n\r\n  /**\r\n   * A cell's text. Rows are heterogeneous wrapper-defined records, so a column may\r\n   * hold anything; this renders it as one line and an absent value as an empty cell\r\n   * rather than the string `undefined`.\r\n   *\r\n   * Also the `title` for the cell, which is what makes truncation safe — the full\r\n   * value stays readable on hover instead of being lost to the ellipsis.\r\n   *\r\n   * @param row - The record being rendered.\r\n   * @param column - The row key this column shows.\r\n   * @returns The cell's display text, or `''` when the record has no such value.\r\n   */\r\n  protected cellText(row: RecordListRow, column: string): string {\r\n    const value = row[column];\r\n    return value == null ? '' : String(value);\r\n  }\r\n\r\n  /**\r\n   * Whether the in-edit record may be saved: every `required` inner element must\r\n   * resolve to a non-empty value via its `deepBind` path.\r\n   *\r\n   * Only currently-visible elements are considered — a `required` element hidden by\r\n   * its own `additionalTest` cannot be filled in, so counting it would leave the\r\n   * save button permanently disabled.\r\n   */\r\n  protected readonly canSaveRecord = computed<boolean>(() => {\r\n    const editing = this.#inEdit();\r\n    if (!editing || !this.editorConfig()) {\r\n      return false;\r\n    }\r\n    for (const section of this.visibleSections()) {\r\n      for (const element of section.elements) {\r\n        if (!element.required) {\r\n          continue;\r\n        }\r\n        const { value } = safeReturnDeepProperty(editing, element.deepBind ?? []);\r\n        if (value == null || value === '') {\r\n          return false;\r\n        }\r\n      }\r\n    }\r\n    return true;\r\n  });\r\n\r\n  // --- Effects (framework-state sync, not signal writes within) ---\r\n\r\n  /** Mirror the rows signal into the Material table data source. */\r\n  protected readonly tableSync = effect(() => {\r\n    this.dataSource.data = this.#rows();\r\n  });\r\n\r\n  /**\r\n   * Rebuild the inner-section list and portal map whenever the editor config\r\n   * changes. Portals are recreated per config so a stale `ComponentPortal`\r\n   * (already attached) is never re-used.\r\n   */\r\n  protected readonly configSync = effect(() => {\r\n    const next = this.editorConfig()?.secondaryElementEditorConfig ?? [];\r\n    if (_isEqual(this.#sections(), next)) {\r\n      return;\r\n    }\r\n    this.#teardownPortalSubscriptions();\r\n    this.#sections.set(next);\r\n    const portals: Record<string, ComponentPortal<TDynamicDataEditComponent>> = {};\r\n    for (const section of next) {\r\n      for (const element of section.elements) {\r\n        portals[element.id] = new ComponentPortal(this.#nestedEditor);\r\n      }\r\n    }\r\n    this.#portals.set(portals);\r\n  });\r\n\r\n  // --- Record actions ---\r\n\r\n  addNewItem(): void {\r\n    this.#inEdit.set({});\r\n  }\r\n\r\n  editItem(row: RecordListRow): void {\r\n    this.#inEdit.set(row);\r\n  }\r\n\r\n  cancelEdit(): void {\r\n    this.#inEdit.set(null);\r\n  }\r\n\r\n  saveRecord(): void {\r\n    const editing = this.#inEdit();\r\n    if (!editing) {\r\n      return;\r\n    }\r\n    let next: RecordListRow[];\r\n    if (editing.id != null) {\r\n      next = this.value.map((item) => (item.id === editing.id ? editing : item));\r\n    } else {\r\n      next = [...this.value, { ...editing, id: crypto.randomUUID() }];\r\n    }\r\n    this.value = next;\r\n    this.#inEdit.set(null);\r\n    this.valueChange.emit(this.value);\r\n  }\r\n\r\n  removeItem(item: RecordListRow): void {\r\n    this.value = this.value.filter((row) => row.id !== item.id);\r\n    if (this.#inEdit()?.id === item.id) {\r\n      this.#inEdit.set(null);\r\n    }\r\n    this.valueChange.emit(this.value);\r\n  }\r\n\r\n  /**\r\n   * Wire a freshly-attached per-record editor portal: push the current inputs in,\r\n   * and patch the in-edit buffer whenever the inner editor emits a value. The\r\n   * subscription is keyed by element id and torn down on config change / destroy.\r\n   *\r\n   * This also runs on RE-attach, because an element hidden by `additionalTest` has\r\n   * its portal outlet destroyed and a brand-new one created when it comes back:\r\n   *\r\n   * - Double-attach cannot happen. `CdkPortalOutlet.ngOnDestroy` disposes the outlet,\r\n   *   which detaches the portal and nulls its `_attachedHost`, so the same\r\n   *   `ComponentPortal` instance is legitimately re-attachable to the new outlet.\r\n   *   Only the outlet is marked disposed, and that one is gone.\r\n   * - Double-subscribe cannot happen either. The previous subscription for this\r\n   *   element id is unsubscribed below before the new one replaces it, and it would\r\n   *   in any case have completed already: `outputToObservable` completes when the\r\n   *   emitting component is destroyed, which also unregisters the\r\n   *   `takeUntilDestroyed` hook rather than accumulating one per attach.\r\n   */\r\n  onPortalAttached(\r\n    portalRef: CdkPortalOutletAttachedRef,\r\n    element: ElementEditorInnerSectionElementInterface,\r\n  ): void {\r\n    const componentRef = portalRef as ComponentRef<TDynamicDataEditComponent>;\r\n    componentRef.setInput('formInputs', this.formInputs());\r\n    componentRef.setInput('editorConfig', element);\r\n    componentRef.setInput('data', this.#inEdit());\r\n\r\n    this.#portalSubscriptions.get(element.id)?.unsubscribe();\r\n    const sub = outputToObservable(componentRef.instance.valueChange)\r\n      .pipe(takeUntilDestroyed(this.#destroyRef))\r\n      .subscribe((event: unknown) => {\r\n        const current = this.#inEdit();\r\n        const draft = (current ? structuredClone(current) : {}) as RecordListRow;\r\n        this.#applyClearOnChange(draft, element, current, event);\r\n        const patched = assignDeepPropertyToObject(\r\n          draft,\r\n          element.deepBind ?? [],\r\n          event,\r\n        ) as RecordListRow;\r\n        this.#inEdit.set(patched);\r\n        componentRef.setInput('data', patched);\r\n        componentRef.changeDetectorRef.markForCheck();\r\n      });\r\n    this.#portalSubscriptions.set(element.id, sub);\r\n  }\r\n\r\n  /**\r\n   * Blanks the paths an element declares in `clearOnChange`, so choosing one of a\r\n   * pair of mutually exclusive settings drops the other one.\r\n   *\r\n   * Guarded, unlike the top-level editors: it fires only when the element's own\r\n   * bound value moves AWAY from a value the record already carried. The nested\r\n   * editor emits once shortly after every attach — replaying the stored value, or\r\n   * `defaultValue` when the bound key is absent — so an unguarded clear would wipe\r\n   * sibling fields merely because an administrator opened an existing record, and\r\n   * again every time a hidden element was re-shown. Elements without\r\n   * `clearOnChange` are untouched.\r\n   */\r\n  #applyClearOnChange(\r\n    draft: RecordListRow,\r\n    element: ElementEditorInnerSectionElementInterface,\r\n    current: RecordListRow | null,\r\n    nextValue: unknown,\r\n  ): void {\r\n    const paths = element.clearOnChange;\r\n    if (!paths || paths.length === 0) {\r\n      return;\r\n    }\r\n    const { value: previousValue } = safeReturnDeepProperty(current, element.deepBind ?? []);\r\n    // Never set before: this is the first explicit choice, not a change away from\r\n    // something, so there is nothing the administrator asked to discard.\r\n    if (previousValue === undefined || previousValue === '') {\r\n      return;\r\n    }\r\n    if (_isEqual(previousValue, nextValue)) {\r\n      return;\r\n    }\r\n    for (const path of paths) {\r\n      assignDeepPropertyToObject(draft, path, undefined);\r\n    }\r\n  }\r\n\r\n  #teardownPortalSubscriptions(): void {\r\n    this.#portalSubscriptions.forEach((sub) => sub.unsubscribe());\r\n    this.#portalSubscriptions.clear();\r\n  }\r\n}\r\n","<!--\r\n  The card clips to its radius; the inner element is the ONLY scroll region. Without\r\n  that split a table wider than the editor panel was simply cut off, taking the row\r\n  actions with it — unreachable, with nothing to indicate they were there.\r\n-->\r\n<div class=\"lib-record-list-manager__table\">\r\n  <div class=\"lib-record-list-manager__scroll\">\r\n    <table mat-table [dataSource]=\"dataSource\" class=\"lib-record-list-manager__grid\">\r\n      @for (col of tableColumns(); track col.value) {\r\n        <!--\r\n          `stickyEnd` pins the actions column to the right edge, so edit and delete\r\n          stay reachable however far the table is scrolled. Material's own mechanism\r\n          rather than hand-rolled `position: sticky`, which it already handles\r\n          correctly across the table's collapsed borders.\r\n        -->\r\n        <ng-container [matColumnDef]=\"col.value\" [stickyEnd]=\"isActionsColumn(col.value)\">\r\n          <th mat-header-cell *matHeaderCellDef scope=\"col\">{{ col.label }}</th>\r\n          <td mat-cell *matCellDef=\"let row\" class=\"lib-record-list-manager__cell\">\r\n            @if (isActionsColumn(col.value)) {\r\n              <button\r\n                type=\"button\"\r\n                mat-icon-button\r\n                class=\"lib-record-list-manager__action\"\r\n                matTooltip=\"Edit\"\r\n                aria-label=\"Edit record\"\r\n                [disabled]=\"disabled\"\r\n                (click)=\"editItem(row)\"\r\n              >\r\n                <mat-icon>edit</mat-icon>\r\n              </button>\r\n              <button\r\n                type=\"button\"\r\n                mat-icon-button\r\n                color=\"warn\"\r\n                class=\"lib-record-list-manager__action\"\r\n                matTooltip=\"Delete\"\r\n                aria-label=\"Delete record\"\r\n                [disabled]=\"disabled\"\r\n                (click)=\"removeItem(row)\"\r\n              >\r\n                <mat-icon>delete</mat-icon>\r\n              </button>\r\n            } @else {\r\n              <!--\r\n                Truncated rather than allowed to widen the column: one long value in\r\n                one row should not push every other column out of view. The full text\r\n                stays reachable on hover and to assistive tech.\r\n              -->\r\n              <span class=\"lib-record-list-manager__cell-text\" [title]=\"cellText(row, col.value)\">\r\n                {{ cellText(row, col.value) }}\r\n              </span>\r\n            }\r\n          </td>\r\n        </ng-container>\r\n      }\r\n      <tr mat-header-row *matHeaderRowDef=\"displayedColumns()\"></tr>\r\n      <tr\r\n        mat-row\r\n        *matRowDef=\"let row; columns: displayedColumns()\"\r\n        class=\"lib-record-list-manager__row\"\r\n      ></tr>\r\n    </table>\r\n  </div>\r\n\r\n  @if (rowCount() === 0) {\r\n    <lib-empty-state\r\n      icon=\"inbox\"\r\n      message=\"No records yet. Use Add Record to get started.\"\r\n    ></lib-empty-state>\r\n  }\r\n</div>\r\n\r\n@if (inEditRow(); as editing) {\r\n  <div class=\"lib-record-list-manager__editor\">\r\n    <mat-accordion class=\"lib-record-list-manager__sections\" togglePosition=\"after\">\r\n      @for (section of visibleSections(); track section.id) {\r\n        <mat-expansion-panel>\r\n          <mat-expansion-panel-header>\r\n            <mat-panel-title class=\"lib-record-list-manager__section-title\">\r\n              <span>{{ section.label }}</span>\r\n              @if (section.showItemValue && editing[section.showItemValue] != null) {\r\n                <span class=\"lib-record-list-manager__section-value\">\r\n                  {{ editing[section.showItemValue] }}\r\n                </span>\r\n              }\r\n            </mat-panel-title>\r\n          </mat-expansion-panel-header>\r\n\r\n          @for (element of section.elements; track element.id) {\r\n            <div class=\"lib-record-list-manager__field\">\r\n              @defer (on viewport) {\r\n                <ng-template\r\n                  [cdkPortalOutlet]=\"portals()[element.id]\"\r\n                  (attached)=\"onPortalAttached($event, element)\"\r\n                ></ng-template>\r\n              } @placeholder {\r\n                <div class=\"lib-record-list-manager__loading\">\r\n                  <mat-spinner diameter=\"18\"></mat-spinner>\r\n                </div>\r\n              }\r\n            </div>\r\n          }\r\n        </mat-expansion-panel>\r\n      }\r\n    </mat-accordion>\r\n\r\n    <div class=\"lib-record-list-manager__actions\">\r\n      <button type=\"button\" mat-button color=\"primary\" (click)=\"cancelEdit()\">Cancel</button>\r\n      <button\r\n        type=\"button\"\r\n        mat-stroked-button\r\n        color=\"primary\"\r\n        [disabled]=\"!canSaveRecord()\"\r\n        (click)=\"saveRecord()\"\r\n      >\r\n        {{ editing.id ? 'Update' : 'Save new' }} record\r\n        <mat-icon>save</mat-icon>\r\n      </button>\r\n    </div>\r\n  </div>\r\n} @else {\r\n  <div class=\"lib-record-list-manager__actions lib-record-list-manager__actions--list\">\r\n    <span class=\"lib-record-list-manager__count\">Records ({{ rowCount() }})</span>\r\n    <button\r\n      type=\"button\"\r\n      mat-stroked-button\r\n      color=\"primary\"\r\n      matTooltip=\"Add a new record\"\r\n      aria-label=\"Add a new record\"\r\n      [disabled]=\"disabled\"\r\n      (click)=\"addNewItem()\"\r\n    >\r\n      <mat-icon>add</mat-icon>\r\n      Add Record\r\n    </button>\r\n  </div>\r\n}\r\n"],"names":["i1","i4","i5","i6","i7"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAoDA;AACA,MAAM,cAAc,GAAG,SAAS;AAEhC;;;;;;;;;;;;;;;;;;;AAmBG;MA2BU,0BAA0B,CAAA;aAC9B,IAAA,CAAA,MAAM,GAAG,CAAH,CAAK;AAkBlB,IAAA,SAAS;AACT,IAAA,IACI,QAAQ,GAAA;QACV,OAAO,IAAI,CAAC,SAAS;IACvB;IACA,IAAI,QAAQ,CAAC,KAAc,EAAA;AACzB,QAAA,IAAI,CAAC,SAAS,GAAG,qBAAqB,CAAC,KAAK,CAAC;AAC7C,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE;IAC1B;AAEA,IAAA,SAAS;AACT,IAAA,IACI,QAAQ,GAAA;QACV,OAAO,IAAI,CAAC,SAAS;IACvB;IACA,IAAI,QAAQ,CAAC,KAAc,EAAA;AACzB,QAAA,IAAI,CAAC,SAAS,GAAG,qBAAqB,CAAC,KAAK,CAAC;AAC7C,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE;IAC1B;AAEA,IAAA,YAAY;AACZ,IAAA,IACI,WAAW,GAAA;QACb,OAAO,IAAI,CAAC,YAAY;IAC1B;IACA,IAAI,WAAW,CAAC,KAAa,EAAA;AAC3B,QAAA,IAAI,CAAC,YAAY,GAAG,KAAK;AACzB,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE;IAC1B;AAEA;;;AAGG;AACH,IAAA,IACI,KAAK,GAAA;AACP,QAAA,OAAO,IAAI,CAAC,KAAK,EAAE;IACrB;IACA,IAAI,KAAK,CAAC,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