Shared:Selectors:Group Fixed disabling the button
This commit is contained in:
parent
77729284e7
commit
4d341eeb3c
@ -54,6 +54,8 @@ const GroupsSelector = (props: GroupsSelectorProps) => {
|
||||
const [hasNextPage, setHasNextPage] = useState(false);
|
||||
const [isNextPageLoading, setIsNextPageLoading] = useState(false);
|
||||
const [itemsList, setItemsList] = useState<TSelectorItem[]>([]);
|
||||
const [selectedItem, setSelectedItem] = useState<TSelectorItem | null>(null);
|
||||
|
||||
const isFirstLoad = useRef(true);
|
||||
const afterSearch = useRef(false);
|
||||
const totalRef = useRef(0);
|
||||
@ -67,6 +69,12 @@ const GroupsSelector = (props: GroupsSelectorProps) => {
|
||||
isDoubleClick: boolean,
|
||||
doubleClickCallback: () => void,
|
||||
) => {
|
||||
setSelectedItem((el) => {
|
||||
if (el?.id === item.id) return null;
|
||||
|
||||
return item;
|
||||
});
|
||||
|
||||
if (isDoubleClick) {
|
||||
doubleClickCallback();
|
||||
}
|
||||
@ -145,13 +153,14 @@ const GroupsSelector = (props: GroupsSelectorProps) => {
|
||||
...headerProps,
|
||||
headerLabel: headerProps?.headerLabel || t("Common:Groups"),
|
||||
}}
|
||||
alwaysShowFooter
|
||||
withSearch
|
||||
searchPlaceholder={t("Common:Search")}
|
||||
onSearch={onSearch}
|
||||
searchValue={searchValue}
|
||||
onClearSearch={onClearSearch}
|
||||
isSearchLoading={false}
|
||||
disableSubmitButton={false}
|
||||
disableSubmitButton={!selectedItem}
|
||||
isMultiSelect={false}
|
||||
items={itemsList}
|
||||
submitButtonLabel={t("Common:SelectAction")}
|
||||
|
Loading…
Reference in New Issue
Block a user