Skip to content

Commit

Permalink
Related #4432, #4602 - For DataTable
Browse files Browse the repository at this point in the history
  • Loading branch information
habubey committed Aug 29, 2023
1 parent bc5f464 commit 2f80e87
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion components/lib/componentbase/ComponentBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ export const ComponentBase = {
const getOptionValue = (obj = {}, key = '', params = {}) => {
const fKeys = String(ObjectUtils.toFlatCase(key)).split('.');
const fKey = fKeys.shift();
const matchedPTOption = Object.keys(obj).find((k) => ObjectUtils.toFlatCase(k) === fKey) || '';
const matchedPTOption = ObjectUtils.isNotEmpty(obj) ? Object.keys(obj).find((k) => ObjectUtils.toFlatCase(k) === fKey) : '';

return fKey ? (ObjectUtils.isObject(obj) ? getOptionValue(ObjectUtils.getJSXElement(obj[matchedPTOption], params), fKeys.join('.'), params) : undefined) : ObjectUtils.getJSXElement(obj, params);
};
Expand Down
12 changes: 6 additions & 6 deletions components/lib/datatable/BodyCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ export const BodyCell = React.memo((props) => {
{
className: cx('columnTitle')
},
getColumnProp('columnTitle')
getColumnPTOptions('columnTitle')
);

const title = props.responsiveLayout === 'stack' && <span {...columnTitleProps}>{ObjectUtils.getJSXElement(header, { props: props.tableProps })}</span>;
Expand Down Expand Up @@ -623,7 +623,7 @@ export const BodyCell = React.memo((props) => {
{
className: cx('rowReorderIcon')
},
getColumnProp('rowReorderIcon')
getColumnPTOptions('rowReorderIcon')
);
const rowReorderIcon = getColumnProp('rowReorderIcon') || <BarsIcon {...rowReorderIconProps} />;

Expand All @@ -634,7 +634,7 @@ export const BodyCell = React.memo((props) => {
className: cx('rowTogglerIcon'),
'aria-hidden': true
},
getColumnProp('rowTogglerIcon')
getColumnPTOptions('rowTogglerIcon')
);
const icon = props.expanded ? props.expandedRowIcon || <ChevronDownIcon {...rowTogglerIconProps} /> : props.collapsedRowIcon || <ChevronRightIcon {...rowTogglerIconProps} />;
const togglerIcon = IconUtils.getJSXIcon(icon, { ...rowTogglerIconProps }, { props });
Expand Down Expand Up @@ -671,9 +671,9 @@ export const BodyCell = React.memo((props) => {
}
} else if (isRowEditor && rowEditor) {
let rowEditorProps = {};
const rowEditorSaveIconProps = mergeProps({ className: cx('rowEditorSaveIcon') }, getColumnProp('rowEditorSaveIconProps'));
const rowEditorCancelIconProps = mergeProps({ className: cx('rowEditorCancelIcon') }, getColumnProp('rowEditorCancelIconProps'));
const rowEditorInitIconProps = mergeProps({ className: cx('rowEditorInitIcon') }, getColumnProp('rowEditorInitIconProps'));
const rowEditorSaveIconProps = mergeProps({ className: cx('rowEditorSaveIcon') }, getColumnPTOptions('rowEditorSaveIcon'));
const rowEditorCancelIconProps = mergeProps({ className: cx('rowEditorCancelIcon') }, getColumnPTOptions('rowEditorCancelIcon'));
const rowEditorInitIconProps = mergeProps({ className: cx('rowEditorInitIcon') }, getColumnPTOptions('rowEditorInitIcon'));
const rowEditorSaveIcon = IconUtils.getJSXIcon(props.rowEditorSaveIcon || <CheckIcon {...rowEditorSaveIconProps} />, { ...rowEditorSaveIconProps }, { props });
const rowEditorCancelIcon = IconUtils.getJSXIcon(props.rowEditorCancelIcon || <TimesIcon {...rowEditorCancelIconProps} />, { ...rowEditorCancelIconProps }, { props });
const rowEditorInitIcon = IconUtils.getJSXIcon(props.rowEditorInitIcon || <PencilIcon {...rowEditorInitIconProps} />, { ...rowEditorInitIconProps }, { props });
Expand Down

0 comments on commit 2f80e87

Please sign in to comment.