- removed multi node
- updated tag updater
This commit is contained in:
1 parent
72afaee719
commit
a8229eb7bd
20 files changed
+337
-550
No files matched your search
@@ -28,6 +28,8 @@ export type InputAutoCompletePropsBase = {
|
||||
onlyShowLabel?: boolean;
|
||||
helperText?: ReactNode;
|
||||
endAdornment?: ReactNode;
|
||||
onEnter?: () => void;
|
||||
disableChips?: boolean;
|
||||
} & (
|
||||
| {
|
||||
value: string | null;
|
||||
@@ -203,12 +205,20 @@ export function InputAutoComplete<T extends Option>(
|
||||
...params.InputProps,
|
||||
endAdornment: props.endAdornment ?? params.InputProps.endAdornment,
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter" && props.onEnter) {
|
||||
props.onEnter();
|
||||
}
|
||||
}}
|
||||
variant="filled"
|
||||
required={props.required}
|
||||
label={props.label ?? "Entity ID"}
|
||||
helperText={helperText}
|
||||
disabled={props.disabled}
|
||||
error={error}
|
||||
placeholder={
|
||||
props.disableChips && !props.multiple ? props.value ?? "" : ""
|
||||
}
|
||||
/>
|
||||
)}
|
||||
renderTags={(tagValue, getTagProps) => {
|
||||
@@ -241,6 +251,9 @@ export function InputAutoComplete<T extends Option>(
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
if (props.disableChips) {
|
||||
return <></>;
|
||||
}
|
||||
if (props.multiple) {
|
||||
return (
|
||||
<Badge badgeContent={tagValue.length} color="info">
|
||||
|
||||
@@ -11,12 +11,14 @@ export interface InputAutoTextProps {
|
||||
required?: boolean;
|
||||
endAdornment?: ReactNode;
|
||||
onChange: (v: string) => void;
|
||||
onEnter?: () => void;
|
||||
}
|
||||
export default function InputAutoText({
|
||||
value = "",
|
||||
label,
|
||||
options = [],
|
||||
onChange,
|
||||
onEnter = () => {},
|
||||
className,
|
||||
required,
|
||||
endAdornment,
|
||||
@@ -41,6 +43,11 @@ export default function InputAutoText({
|
||||
InputProps={{
|
||||
endAdornment,
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") {
|
||||
onEnter();
|
||||
}
|
||||
}}
|
||||
onChange={(e) => {
|
||||
e.preventDefault();
|
||||
onChange(e.target.value);
|
||||
|
||||
Reference in new issue
Block a user