Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Add Dynamic Input Values Support to DynamicDialog #17037

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

nesgarbo
Copy link

Enhancement: Add Dynamic Input Values Support to DynamicDialog

Description

This PR enhances the DynamicDialog service in PrimeNG by introducing support for passing dynamic input values to the components loaded in the dialog.

Key Changes

  1. DynamicDialogConfig

    • Added a new optional field inputValues to allow specifying key-value pairs (Record<string, any>) that will be passed as inputs to the loaded component.
    • The existing data parameter remains unchanged and fully compatible.
  2. DialogService

    • Updated the open<T> method to accept inputValues in the configuration.
    • Automatically assigns the provided input values to the component instance.
  3. DynamicDialogComponent

    • Introduced a new inputValues property to store the dynamic inputs.
    • During component initialization, inputValues are assigned to the component's inputs using setInput.

Benefits

  • Adds flexibility for passing dynamic data directly into components loaded via DynamicDialog.
  • Improves component reusability, enabling them to adapt to different contexts dynamically without requiring additional setup.

Example Usage

this.dialogService.open(MyComponent, {
  header: 'Dialog Title',
  width: '70%',
  inputValues: {
    exampleKey: 'exampleValue',
    anotherKey: 123,
    additionalConfig: true
  }
});

Compatibility

This enhancement is fully backward-compatible. It introduces the optional inputValues property, which does not affect the existing data property or the current functionality of DynamicDialog.

Developers can continue using DynamicDialog as before without requiring any changes to their code. The new inputValues feature is additive, ensuring seamless integration with existing setups.

Extend functionality of dynamic dialog to have inputs
Extend functionality of dynamic dialog to have inputs
Extend functionality of dynamic dialog to have inputs
Copy link

vercel bot commented Dec 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
primeng-v17 ⬜️ Ignored (Inspect) Visit Preview Dec 12, 2024 3:22pm

Copy link

vercel bot commented Dec 12, 2024

@nesgarbo is attempting to deploy a commit to the primetek Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant