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

fix:CascadeSelect missing some values in pt #5502

Closed
wants to merge 1 commit into from
Closed

fix:CascadeSelect missing some values in pt #5502

wants to merge 1 commit into from

Conversation

kl-nevermore
Copy link
Contributor

@kl-nevermore kl-nevermore commented Dec 2, 2023

Fix #5479

Copy link

vercel bot commented Dec 2, 2023

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

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
primereact ⬜️ Ignored (Inspect) Visit Preview Dec 2, 2023 3:42am
primereact-v9 ⬜️ Ignored (Inspect) Visit Preview Dec 2, 2023 3:42am

Copy link

github-actions bot commented Dec 2, 2023

Thanks a lot for your contribution! But, PR does not seem to be linked to any issues. Please manually link to an issue or mention it in the description using #<issue_id>.

2 similar comments
Copy link

github-actions bot commented Dec 2, 2023

Thanks a lot for your contribution! But, PR does not seem to be linked to any issues. Please manually link to an issue or mention it in the description using #<issue_id>.

Copy link

github-actions bot commented Dec 2, 2023

Thanks a lot for your contribution! But, PR does not seem to be linked to any issues. Please manually link to an issue or mention it in the description using #<issue_id>.

@melloware
Copy link
Member

@kl-nevermore @Dalorzo I think this is mixing up cx with ptm? PTM only receives the values passed to it through its context and state

export interface CascadeSelectPassThroughMethodOptions {
    props: CascadeSelectProps;
    state: CascadeSelectState;
}

/**
 * Defines current inline state in CascadeSelect component.
 */
export interface CascadeSelectState {
    /**
     * Current focused state as a boolean.
     * @defaultValue false
     */
    focused: boolean;
    /**
     * Current overlay visible state as a boolean.
     * @defaultValue false
     */
    overlayVisible: boolean;
    /**
     * Current overlay attributeSelector state as a string.
     */
    attributeSelector: string;
}

It looks like you are passing the same values that would go to cx to the ptm?

@kl-nevermore
Copy link
Contributor Author

I can't impl some styles in unstyled using pt if I can't get consistent values

example

// in classes can add style for active item,but pt can not 
  'p-cascadeselect-item-active p-highlight': activeOptionState === option

I referred to some comp like dropdown use ptm pass value to pt
Other components also have this problem
It should be necessary for ptm and cx to be consistent?
If this is correct, the types file should also be updated

@melloware
Copy link
Member

That is a good question. It seems CX and PTM are definitely treated differently I am not quite sure why. And yes the Types would have to be updated that is what @Dalorzo has been helping with.

@melloware
Copy link
Member

@kl-nevermore @Dalorzo see my PR fixing these issues:

#5507

So for PTM you always have 3 objects context, state, props

export interface CascadeSelectPassThroughMethodOptions {
    props: CascadeSelectProps;
    state: CascadeSelectState;
    context: CascadeSelectContext;
}

So for your examples above in passthrough you will use.

label - use context.label to get the labels

item - use state.grouped and state.active to determine if the item is active or in a group.

'list and sublist- now have the propercontextvalue which includes all API options like ripple andinputfilled` etc.

@melloware melloware closed this Dec 2, 2023
@kl-nevermore kl-nevermore deleted the fix-5479 branch December 5, 2023 01:54
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.

CascadeSelect: missing some values in pt
2 participants