From 8e3718ff6fd853ac23a59b081b0f6fbcd2b74e8b Mon Sep 17 00:00:00 2001 From: GermanVor Date: Thu, 18 Jan 2024 18:45:39 +0100 Subject: [PATCH] chore: isRowDisabled --- .../Table/hoc/withTableActions/withTableActions.tsx | 5 +++-- .../Table/hoc/withTableSelection/withTableSelection.tsx | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/Table/hoc/withTableActions/withTableActions.tsx b/src/components/Table/hoc/withTableActions/withTableActions.tsx index 7e1f390594..acb073bd87 100644 --- a/src/components/Table/hoc/withTableActions/withTableActions.tsx +++ b/src/components/Table/hoc/withTableActions/withTableActions.tsx @@ -115,14 +115,15 @@ export function withTableActions( } private renderBodyCell = (item: I, index: number) => { - const {isRowDisabled, getRowActions, rowActionsSize} = this.props; + const {isRowDisabled, getRowActions, rowActionsSize, getRowDescriptor} = this.props; const actions = getRowActions(item, index); if (actions.length === 0) { return null; } - const disabled = isRowDisabled ? isRowDisabled(item, index) : false; + const disabled = + getRowDescriptor?.(item, index).disabled || isRowDisabled?.(item, index) || false; return (
diff --git a/src/components/Table/hoc/withTableSelection/withTableSelection.tsx b/src/components/Table/hoc/withTableSelection/withTableSelection.tsx index a0d58f0991..8d174c982b 100644 --- a/src/components/Table/hoc/withTableSelection/withTableSelection.tsx +++ b/src/components/Table/hoc/withTableSelection/withTableSelection.tsx @@ -239,11 +239,13 @@ export function withTableSelection( ); private isDisabled = (item: I, index: number) => { - const {isRowDisabled, isRowSelectionDisabled} = this.props; + const {isRowDisabled, isRowSelectionDisabled, getRowDescriptor} = this.props; if (isRowSelectionDisabled && isRowSelectionDisabled(item, index)) { return true; } - return isRowDisabled ? isRowDisabled(item, index) : false; + return ( + getRowDescriptor?.(item, index).disabled || isRowDisabled?.(item, index) || false + ); }; }; }