Skip to content

Commit

Permalink
Accept array as PT value (#5647)
Browse files Browse the repository at this point in the history
* Accept array as PT value

* Accept any possibility

* Save a line, does the same thing
  • Loading branch information
kyjus25 authored Dec 27, 2023
1 parent 66ddcfe commit 849287e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions components/lib/componentbase/ComponentBase.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PrimeReact from '../api/Api';
import { useMountEffect, useStyle, useUnmountEffect, useUpdateEffect } from '../hooks/Hooks';
import { mergeProps } from '../utils/MergeProps';
import { ObjectUtils } from '../utils/Utils';
import { ObjectUtils, classNames } from '../utils/Utils';

const baseStyle = `
.p-hidden-accessible {
Expand Down Expand Up @@ -519,8 +519,12 @@ export const ComponentBase = {

const getPTClassValue = (...args) => {
const value = getOptionValue(...args);

return ObjectUtils.isString(value) ? { className: value } : value;
if (Array.isArray(value)) return { className: classNames(...value) };
if (ObjectUtils.isString(value)) return { className: value };
if (value?.hasOwnProperty('className') && Array.isArray(value.className)) {
return { className: classNames(...value.className) };
}
return value;
};

const globalPT = searchInDefaultPT ? (isNestedParam ? _useGlobalPT(getPTClassValue, originalkey, params) : _useDefaultPT(getPTClassValue, originalkey, params)) : undefined;
Expand Down

0 comments on commit 849287e

Please sign in to comment.