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 41ab92a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions components/lib/componentbase/ComponentBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,13 +497,16 @@ export const ComponentBase = {
obj = obj.pt;
}

let flatkey = 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(flatkey) && !!params[flatkey.split('.')[0]];
const isTransition = fkey === 'transition' || (/./g.test(flatkey) && !!(flatkey.split('.')[1] === 'transition'));

const datasetPrefix = 'data-pc-';
const fkey = isNestedParam ? ObjectUtils.toFlatCase(key.split('.')[1]) : ObjectUtils.toFlatCase(key);

const fkey = isNestedParam ? ObjectUtils.toFlatCase(flatkey.split('.')[1]) : flatkey;

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 +526,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, flatkey, params) : _useDefaultPT(getPTClassValue, flatkey, params)) : undefined;
const self = isNestedParam ? undefined : _usePT(_getPT(obj, componentName), getPTClassValue, flatkey, 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 41ab92a

Please sign in to comment.