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

The ptOptions property is not working with nested components #4400

Closed
adiramardiani opened this issue Sep 6, 2023 · 1 comment
Closed

The ptOptions property is not working with nested components #4400

adiramardiani opened this issue Sep 6, 2023 · 1 comment
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@adiramardiani
Copy link

Describe the bug

Hi @mertsincan @tugcekucukoglu
Yes I now on 3.34 has BC about mergeProps, but is the mergeProps option recursive to another sub class component ?
I write like this

<Menubar
      :pt-options="{ mergeProps: true }"
      :pt="{
        root: { class: 'some-class' },
        label: { class: 'some-class' },
        menu: {
          class: 'menu-for-ul-class' //my expectation this will  merge with default tailwind class
        }
      }"
    >

But the render like this, not merge

<ul class="menu-for-ul-class" data-pc-section="menu" role="menubar" tabindex="0" >...</ul>

I write like this, but the render is same

<Menubar
      :pt-options="{ mergeProps: true }"
      :pt="{
        root: { class: 'some-class' },
        label: { class: 'some-class' },
        menu: {
          class: 'menu-for-ul-class',
          ptOptions: {
            mergeProps: true
          }
        }
      }"
    >

About menu pt in menubar I refer on this documentation MenuBar

Reproducer

https://codesandbox.io/s/primevue-create-vue-issue-template-kw9g6i

PrimeVue version

3.34

Vue version

3.x

Language

ALL

Build / Runtime

Nuxt

Browser(s)

No response

Steps to reproduce the behavior

I write like this

<Menubar
      :pt-options="{ mergeProps: true }"
      :pt="{
        root: { class: 'some-class' },
        label: { class: 'some-class' },
        menu: {
          class: 'menu-for-ul-class'
        }
      }"
    >

But the render like this, not merge

<ul class="menu-for-ul-class" data-pc-section="menu" role="menubar" tabindex="0" >...</ul>

Expected behavior

My expectation ul class (ul) is combination this pt and tailwind default pt class
About menu pt in menubar I refer on this documentation MenuBar

@adiramardiani adiramardiani added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Sep 6, 2023
@awkoy
Copy link

awkoy commented Sep 6, 2023

Has the same issue

const Tailwind_PT: PrimeVuePTOptions = {
  button: {
    root: {
      class:
        'text-appBlack bg-appPrimary border-appPrimary hover:bg-appSecondary hover:border-appSecondary focus:shadow-n'
    }
  }
}

export const CustomTailwind = usePassThrough(Tailwind, Tailwind_PT, {
  mergeSections: true,
  mergeProps: true,
})

app.use(PrimeVue, { unstyled: true, pt: CustomTailwind })

renders
image

I've expected, that it should merge my classes list with an existed one from PrimeVue

if (matched) {
    to[key] = getValue(
        useMergeProps
              ? mergeProps(getPTClassValue(to[key]), getPTClassValue(from[key]))
              : { ...getPTClassValue(to[key]), ...getPTClassValue(from[key]) }
     )
}

getPTClassValue(to[key]) - this method returns function({props, context})

@mertsincan mertsincan self-assigned this Sep 7, 2023
@mertsincan mertsincan added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Sep 7, 2023
@mertsincan mertsincan added this to the 3.34.1 milestone Sep 7, 2023
@mertsincan mertsincan changed the title Is mergeProps recursive to another sub component on unstyled class passthrough ? The ptOptions property is not working with nested components Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

3 participants