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

usePassThrough: Components with function as their value doesn't seem to work properly #4278

Closed
firlottea opened this issue Aug 16, 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

@firlottea
Copy link

Describe the bug

const CustomTailwindTheme = usePassThrough(
  Tailwind,
  {
    datatable: {
      column: {
        //  Attempt 1:
        // headercell: ({ context, props }) => ({
        //   class: ['!px-4 !pt-2 !pb-0 bg-pink-500'],
        // }),
        //  Attempt 2:
        // headercell: ({ context, props }) => ({
        //   class: '!px-4 !pt-2 !pb-0 bg-pink-500',
        // }),
        //  Attempt 3:
        // headercell: {
        //   class: ['!px-4 !pt-2 !pb-0 bg-pink-500'],
        // },
        //  Attempt 4:
        headercell: {
          class: '!px-4 !pt-2 !pb-0 bg-pink-500',
        },
        columnfilter: {
          class: ['!pb-2 bg-pink-500'],
        },
      },
    },
    paginator: {
      rowperpagedropdown: {
        root: {
          class: ['md:!w-24'],
        },
      },
    },
  },
  { merge: true, useMergeProps: true }
);

When trying to have global PassThrough on component which have a function as their value
EX :

headercell: function headercell(_ref162) {

Seems like there is no way to merge the Global classes and the ones provided by the Tailwind PassThrough class.

Attempt 1 :
The class property is empty

Attempt 2 :
The class property is empty

Attempt 3 :
The class property is overwritten by the pt2 value

Attempt 4 :
The class property is overwritten by the pt2 value

I tried with useMergeProps at true and false.

Reproducer

https://stackblitz.com/edit/t2cmve?file=src%2Fmain.js

PrimeVue version

3.32

Vue version

3.x

Language

ES6

Build / Runtime

Vite

Browser(s)

Firefox Developper Edition

Steps to reproduce the behavior

  1. Open the provided Stackblitz link
  2. Inspect the class property of the "headercell"
  3. Comment or uncomment each headercell attempt in the main.js file
  4. Inspect the class property of the "headercell"

Expected behavior

Classes from usePassThrough should be merged and not overwritten. Also the syntaxed shown in the panel.header section here
https://primevue.org/tailwind/#customization
doesn't seem like it's working for this Component. (Haven't tried many other components)

@firlottea firlottea added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Aug 16, 2023
@mertsincan mertsincan self-assigned this Aug 17, 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 Aug 17, 2023
@mertsincan mertsincan added this to the 3.32.1 milestone Aug 17, 2023
@mertsincan
Copy link
Member

Thanks a lot for the report! Fixed in #4289
You can use all of the examples you commented on above.

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

2 participants