diff --git a/LookdownComponent/Lookdown/components/LookdownControlClassic.tsx b/LookdownComponent/Lookdown/components/LookdownControlClassic.tsx index 77dae1a..fc2fa3c 100644 --- a/LookdownComponent/Lookdown/components/LookdownControlClassic.tsx +++ b/LookdownComponent/Lookdown/components/LookdownControlClassic.tsx @@ -367,7 +367,9 @@ export default function LookdownControlClassic({ /> - {selectedId ? onChange?.(null)} /> : null} + {selectedId && !disabled && !isError ? ( + onChange?.(null)} /> + ) : null} {hasCommand ? null} /> : null} diff --git a/LookdownComponent/Lookdown/components/LookdownControlNewLook.tsx b/LookdownComponent/Lookdown/components/LookdownControlNewLook.tsx index 42b6c5b..cc4a0a5 100644 --- a/LookdownComponent/Lookdown/components/LookdownControlNewLook.tsx +++ b/LookdownComponent/Lookdown/components/LookdownControlNewLook.tsx @@ -53,6 +53,17 @@ const useStyle = makeStyles({ breakWord: { wordBreak: "break-word", }, + disabled: { + backgroundColor: tokens.colorNeutralBackground3, + ...shorthands.borderColor(tokens.colorTransparentStroke), + "&>button": { + color: tokens.colorNeutralForeground1, + cursor: "default", + }, + }, + hidden: { + display: "none", + }, }); export default function LookdownControlNewLook({ @@ -78,8 +89,6 @@ export default function LookdownControlNewLook({ const queryClient = useQueryClient(); const styles = useStyle(); - const dropdownStyles = mergeClasses(styles.dropdown, styles.flexFill); - const [selectedDisplayText, setSelectedDisplayText] = useState(selectedText ?? ""); const [selectedValues, setSelectedValues] = useState(selectedId ? [selectedId] : []); @@ -106,6 +115,8 @@ export default function LookdownControlNewLook({ const isError = isErrorLanguagePack || isErrorMetadata || isErrorEntityOptions; + const dropdownStyles = mergeClasses(styles.dropdown, styles.flexFill, (disabled || isError) && styles.disabled); + useEffect(() => { if (selectedId && entityOptions) { const selectionItem = entityOptions.find((item) => item.id === selectedId); @@ -281,11 +292,13 @@ export default function LookdownControlNewLook({ {renderOptions()} @@ -304,12 +317,12 @@ export default function LookdownControlNewLook({ {languagePack.OpenRecordLabel} ) : null} - {allowQuickCreate ? ( + {allowQuickCreate && !disabled && !isError ? ( } onClick={handleQuickCreateMenuClick}> {languagePack.QuickCreateLabel} ) : null} - {allowLookupPanel ? ( + {allowLookupPanel && !disabled && !isError ? ( } onClick={handleLookupPanelMenuClick}> {languagePack.LookupPanelLabel}