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

DynamicFormControlCondition - improvement on DynamicFormRelationService matchesCondition #1182

Open
Wchua opened this issue Jan 25, 2024 · 0 comments

Comments

@Wchua
Copy link

Wchua commented Jan 25, 2024

I'm submitting a


[ ] Bug / Regression
[X] Feature Request / Proposal

I'm using


NG Dynamic Forms Version: `18.0.0`

[ ] Basic UI
[ ] Bootstrap UI  
[ ] Foundation UI
[ ] Ionic UI
[ ] Material  
[ ] NG Bootstrap
[X ] Prime NG

Description

Use case

I want to show/hide some fields based on the value of other fields (selectModel) which has custom object as options/values.

Problem

The DynamicFormRelationService does the relations match on the matchesCondition function using strict equality which when comparing objects returns false.

Proposed Solution

Add an optional function called matched to the DynamicFormControlCondition which, in case it is defined, it will take precedence over the current value property.

export interface DynamicFormControlCondition {
    id?: string;
    rootPath?: string;
    status?: string;
    value?: any;
    matched?: (relatedFormControlValue: any) => boolean; // Has precedence over value
}

This way we can match the value correctly.

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

No branches or pull requests

1 participant