Skip to content

Commit

Permalink
Fix primefaces#5461: Passthrough case insensitve props
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Nov 30, 2023
1 parent ad61ccf commit d288169
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions components/lib/componentbase/ComponentBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,13 +497,13 @@ export const ComponentBase = {
obj = obj.pt;
}

const originalkey = ObjectUtils.toFlatCase(key);
const hostName = params.hostName && ObjectUtils.toFlatCase(params.hostName);
const componentName = hostName || (params.props && params.props.__TYPE && ObjectUtils.toFlatCase(params.props.__TYPE)) || '';
const isNestedParam = /./g.test(key) && !!params[key.split('.')[0]];
const isTransition = key === 'transition' || (/./g.test(key) && !!(key.split('.')[1] === 'transition'));

const isNestedParam = /./g.test(originalkey) && !!params[originalkey.split('.')[0]];
const isTransition = fkey === 'transition' || (/./g.test(originalkey) && !!(originalkey.split('.')[1] === 'transition'));
const datasetPrefix = 'data-pc-';
const fkey = isNestedParam ? ObjectUtils.toFlatCase(key.split('.')[1]) : ObjectUtils.toFlatCase(key);
const fkey = isNestedParam ? ObjectUtils.toFlatCase(originalkey.split('.')[1]) : originalkey;

const getHostInstance = (params) => {
return params?.props ? (params.hostName ? (params.props.__TYPE === params.hostName ? params.props : getHostInstance(params.parent)) : params.parent) : undefined;
Expand All @@ -523,8 +523,8 @@ export const ComponentBase = {
return ObjectUtils.isString(value) ? { className: value } : value;
};

const globalPT = searchInDefaultPT ? (isNestedParam ? _useGlobalPT(getPTClassValue, key, params) : _useDefaultPT(getPTClassValue, key, params)) : undefined;
const self = isNestedParam ? undefined : _usePT(_getPT(obj, componentName), getPTClassValue, key, params, componentName);
const globalPT = searchInDefaultPT ? (isNestedParam ? _useGlobalPT(getPTClassValue, originalkey, params) : _useDefaultPT(getPTClassValue, originalkey, params)) : undefined;
const self = isNestedParam ? undefined : _usePT(_getPT(obj, componentName), getPTClassValue, originalkey, params, componentName);

const datasetProps = !isTransition && {
...(fkey === 'root' && { [`${datasetPrefix}name`]: params.props && params.props.__parentMetadata ? ObjectUtils.toFlatCase(params.props.__TYPE) : componentName }),
Expand Down
2 changes: 1 addition & 1 deletion components/lib/passthrough/tailwind/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ const Tailwind = {
'cursor-default': props.readOnly
},
{
'outline-none outline-offset-0 shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:shadow-[0_0_0_0.2rem_rgba(147,197,253,0.5)]': context.focused
'outline-none outline-offset-0 shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:shadow-[0_0_0_0.2rem_rgba(147,197,253,0.5)]': context.active
}
)
}),
Expand Down

0 comments on commit d288169

Please sign in to comment.