Successfully migrated simple @Input() decorators to input() signals in ngx-extended-pdf-viewer.component.ts.
- 89 simple @Input properties migrated to
input()signals - Imports updated: Added
inputto Angular core imports (model, output, viewChild will be added in future phases)
- 16 @Input properties with setters (NOT migrated in Phase 1 - requires effect() conversion)
- 37 @Output properties (to be migrated to
output()in Phase 2) - 5 @ViewChild properties (to be migrated to
viewChild()in Phase 3)
// Before:
@Input()
public customFindbarInputArea: TemplateRef<any> | undefined;
// After:
public customFindbarInputArea = input<TemplateRef<any>>();// Before:
@Input()
public showFreeFloatingBar = true;
// After:
public showFreeFloatingBar = input(true);// Before:
@Input()
public showCommentEditor: ResponsiveVisibility = pdfDefaultOptions.enableComment ? 'xxl' : false;
// After:
public showCommentEditor = input<ResponsiveVisibility>(pdfDefaultOptions.enableComment ? 'xxl' : false);// Before:
@Input()
public rotation!: 0 | 90 | 180 | 270;
// After:
public rotation = input.required<0 | 90 | 180 | 270>();These 16 properties require effect() conversion and will be handled in Phase 2:
formData(line 165) - with getter/setterpageViewMode(line 187) - complex setter logicscrollMode(line 315) - with getter/setterenablePrintAutoRotate(line 357) - with getter/setterminifiedJSLibraries(line 398) - with getter/settersrc(line 434) - complex async setterbase64Src(line 490) - complex async setterheight(line 520) - with getter/settershowSidebarButton(line 621) - with getter/settersidebarVisible(line 646) - with getter/settershowRotateButton(line 730) - setter that modifies other propertieshandTool(line 742) - with getter/settershowScrollingButtons(line 770) - setter that modifies other propertiespage(line 790) - with getter/setterzoomLevels(line 865) - with getter/settermobileFriendlyZoom(line 933) - complex setter logic
The component will NOT compile yet because:
-
Setter methods trying to assign to signals: Properties like
showScrollingButtonshave setters that try to assign values to the now-readonly input signals:// This will error because showVerticalScrollButton is now an InputSignal this.showVerticalScrollButton = show;
-
Interface compatibility:
NgxHasHeightinterface expectsminHeight: stringbut we now haveminHeight: InputSignal<string | undefined> -
Compile errors are expected: These will be fixed in Phase 2 when setters are converted to effects
These issues are EXPECTED and will be resolved in subsequent phases when:
- Phase 2: Convert @Input setters to effect() and migrate @Output to output()
- Phase 3: Migrate @ViewChild to viewChild()
- Phase 4: Update interface implementations
/workspace/ngx-extended-pdf-viewer/projects/ngx-extended-pdf-viewer/src/lib/ngx-extended-pdf-viewer.component.ts- Imports updated (lines 1-25)
- 89 simple @Input properties converted to input() signals
A backup of the original file was created at:
projects/ngx-extended-pdf-viewer/src/lib/ngx-extended-pdf-viewer.component.ts.backup
- Identify all
@Input() setpatterns - Convert each setter to:
- An input signal:
public prop = input<Type>(defaultValue); - An effect:
effect(() => { /* setter logic using this.prop() */ });
- An input signal:
- Update any code that directly assigns to these properties to use
prop.set(value)or handle via effect
To verify the migration:
# Count migrated input signals
grep -E "public \w+ = input" projects/ngx-extended-pdf-viewer/src/lib/ngx-extended-pdf-viewer.component.ts | wc -l
# Output: 89
# Count remaining @Input decorators
grep -c "^\s*@Input()" projects/ngx-extended-pdf-viewer/src/lib/ngx-extended-pdf-viewer.component.ts
# Output: 16
# Count @Output decorators
grep -c "^\s*@Output()" projects/ngx-extended-pdf-viewer/src/lib/ngx-extended-pdf-viewer.component.ts
# Output: 37
# Count @ViewChild decorators
grep -c "^\s*@ViewChild" projects/ngx-extended-pdf-viewer/src/lib/ngx-extended-pdf-viewer.component.ts
# Output: 5