Skip to content

refactor(signals): migrate simple components to signal APIs#53

Merged
saithis merged 15 commits intomasterfrom
refactor/signals-migration
Mar 30, 2026
Merged

refactor(signals): migrate simple components to signal APIs#53
saithis merged 15 commits intomasterfrom
refactor/signals-migration

Conversation

@saithis
Copy link
Copy Markdown
Collaborator

@saithis saithis commented Mar 27, 2026

Migrate ZvHeader, ZvFlipContainer, ZvView, ZvForm to Angular signal
inputs/queries. ZvDialogWrapper keeps setter pattern (eslint-disable)
because subscription teardown must be synchronous.

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

claude added 15 commits March 27, 2026 09:08
Migrate ZvHeader, ZvFlipContainer, ZvView, ZvForm to Angular signal
inputs/queries. ZvDialogWrapper keeps setter pattern (eslint-disable)
because subscription teardown must be synchronous.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… APIs

Co-committed: table directives + all consuming components because
directive signal inputs break all downstream template/TS access.

- ZvTableColumn: 7 @input → input(), 2 @ContentChild → contentChild()
- ZvTableRowDetail directive: 2 @input → input(), 1 @ContentChild → contentChild()
- Fix isExpanded() to read signal value with ()
- ZvTableHeader: 10 @input → input(), 2 @output → output(), @HostBinding → computed()+host
- ZvTableSettings: 5 @input → input(), 2 @output → output()
- ZvTableData: 11 @input → input(), 3 @output → output(), OnChanges → effect()
- Cascade: all template/TS references to directive properties updated with ()

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- ZvFormField: 5 @input → input(), @ViewChild → viewChild.required(),
  3 @ContentChild → contentChild(), 2 @ContentChildren → contentChildren(),
  @HostBinding → computed()+host, OnChanges → effect()
- ZvTable: 12 @input → input(), @output → output(), @ViewChild → viewChild.required(),
  3 @ContentChild → contentChild(), @ContentChildren → contentChildren(),
  2 @HostBinding → host metadata, OnChanges+AfterContentInit → single consolidated effect()
  with previous dataSource tracking

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Migrate signal-compatible properties to input()/output()/viewChild()/
contentChild(). MatFormFieldControl interface properties kept as
getter/setters per design decision D2.

- ZvFileInput: accept → input(), @output → output(), @ViewChild → viewChild()
  Remove eslint-disable no-conflicting-lifecycle, remove OnChanges
- ZvNumberInput: min/max/decimals/tabindex → input(), stepSize → input()+computed()
  @output → output(), @ViewChild → viewChild()
  Remove eslint-disable no-conflicting-lifecycle, remove OnChanges
- ZvDateTimeInput: matDatepicker → input.required(), @output → output()
  4 @ViewChild → viewChild(), disabled → getter/setter pair
  Remove eslint-disable no-conflicting-lifecycle, remove OnChanges
- ZvSelect: clearable/showToggleAll/multiple/panelClass/selectedLabel → input()
  3 @output → output(), @ViewChild → viewChild.required()+afterNextRender()
  2 @ContentChild → contentChild(), @HostBinding → host metadata
- ZvTimeInput: 2 @output → output(), remove OnChanges

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Turn off prefer-signals for spec files (test hosts keep @ViewChild
  decorators per established convention)
- Add eslint-disable prefer-signals to CVA source files where @input
  decorators are kept for MatFormFieldControl interface compatibility
- Result: 0 prefer-signals warnings, 0 errors

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix contentChild() undefined→null coercion in header/flip-container
  templates (ngTemplateOutlet expects null, not undefined)
- Replace non-null assertions (!) with optional chaining (?.) on
  viewChild() signals in date-time-input
- Fix _matSelect null in ngOnInit by reading viewChild signal directly
  instead of relying on afterNextRender mutable field
- Add stateChanges.next() effect for number-input signal inputs
  (replaces removed ngOnChanges notification)
- Simplify date-time-input empty getter logic

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix all 118 test compilation errors caused by signals migration:
- Replace direct signal input assignments with fixture.componentRef.setInput()
- Add () to unwrap signal values before accessing properties
- Replace removed APIs (columnDefsSetter, ngOnChanges, ngAfterContentInit)
- Fix template errors (self-closing div, missing required inputs)
- Add writable signal replacements for imperative test setups

Verified: tsc --noEmit passes with 0 errors on spec tsconfig.
Browser-based test runner cannot execute in this container (chromium
binary crashes), but compilation is confirmed clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- table.component.spec: wrap createColDef() in runInInjectionContext
  (input() requires DI context, new ZvTableColumn() outside DI fails)
- select.component: assign _matSelect early in ngOnInit before
  _switchDataSource, add null guard for _matSelect.panelOpen
- select.component.spec: read signal inputs with (), rewrite close()
  monkey-patch test
- view.component: add guard in effect for undefined dataSource
  (test host initializes signal with undefined)
- form-field.component.spec: read floatLabel signal with ()
- table-header.component.spec: read paddingTop computed with ()

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The consolidated effect doesn't run in isolated tests (no CD/fixture).
Explicitly call updateTableState() after setting columnDefs and
_rowDetail to build displayedColumns before assertions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The consolidated effect reads columnDefsQuery/rowDetailQuery and
overwrites columnDefs/rowDetail. In isolated tests, override these
signal queries so the effect populates the correct values instead
of resetting to empty.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@saithis saithis enabled auto-merge (squash) March 27, 2026 17:05
@saithis saithis merged commit 43ba2dc into master Mar 30, 2026
1 check passed
@saithis saithis deleted the refactor/signals-migration branch March 30, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants