From 63a81b8712291e121c38c1bf5a20d6301805df17 Mon Sep 17 00:00:00 2001 From: AlekseyManetov Date: Thu, 17 Oct 2024 17:06:16 +0200 Subject: [PATCH] [PickerInput]: hide clear button from footer in case props.disableClear === true. --- uui/components/pickers/DataPickerFooter.tsx | 25 ++++++++------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/uui/components/pickers/DataPickerFooter.tsx b/uui/components/pickers/DataPickerFooter.tsx index 698417b595..43019faaa8 100644 --- a/uui/components/pickers/DataPickerFooter.tsx +++ b/uui/components/pickers/DataPickerFooter.tsx @@ -31,7 +31,6 @@ function DataPickerFooterImpl(props: PropsWithChildren 0; const rowsCount = view.getListProps().rowsCount; - const isEmptyRowsAndHasNoSelection = (rowsCount === 0 && !hasSelection); const isSinglePicker = selectionMode === 'single'; @@ -39,9 +38,10 @@ function DataPickerFooterImpl(props: PropsWithChildren @@ -58,26 +58,19 @@ function DataPickerFooterImpl(props: PropsWithChildren - {view.selectAll && ( + {view.selectAll && !hasSelection && ( view.selectAll.onValueChange(true) } - rawProps={ { - 'aria-label': hasSelection ? clearAllText : selectAllText, - } } - isDisabled={ isEmptyRowsAndHasNoSelection } + caption={ selectAllText } + onClick={ () => view.selectAll.onValueChange(true) } /> )} - {!view.selectAll && ( + { showClear && ( )}