fix: check compatiblity after delete selecor

This commit is contained in:
jialin
2025-04-05 10:42:24 +08:00
parent a23f9881ee
commit 9f24e765be
6 changed files with 34 additions and 11 deletions
+3
View File
@@ -10,12 +10,14 @@ interface LabelSelectorProps {
description?: React.ReactNode;
onChange?: (labels: Record<string, any>) => void;
onBlur?: (e: any, type: string, index: number) => void;
onDelete?: (index: number) => void;
}
const LabelSelector: React.FC<LabelSelectorProps> = ({
labels,
onChange,
onBlur,
onDelete,
label,
btnText,
description
@@ -90,6 +92,7 @@ const LabelSelector: React.FC<LabelSelectorProps> = ({
onLabelListChange={handleLabelListChange}
onPaste={handleOnPaste}
onBlur={onBlur}
onDelete={onDelete}
/>
);
};
+3
View File
@@ -14,6 +14,7 @@ interface LabelSelectorProps {
onChange?: (labels: Record<string, any>) => void;
onPaste?: (e: any, index: number) => void;
onBlur?: (e: any, type: string, index: number) => void;
onDelete?: (index: number) => void;
description?: React.ReactNode;
}
@@ -24,6 +25,7 @@ const Inner: React.FC<LabelSelectorProps> = ({
onLabelListChange,
onPaste,
onBlur,
onDelete,
label,
btnText,
description
@@ -69,6 +71,7 @@ const Inner: React.FC<LabelSelectorProps> = ({
list.splice(index, 1);
onLabelListChange(list);
updateLabels(list);
onDelete?.(index);
};
return (
+3
View File
@@ -16,6 +16,7 @@ interface ListInputProps {
labelExtra?: React.ReactNode;
onChange: (data: string[]) => void;
onBlur?: (e: any, index: number) => void;
onDelete?: (index: number) => void;
}
const ListInput: React.FC<ListInputProps> = (props) => {
@@ -26,6 +27,7 @@ const ListInput: React.FC<ListInputProps> = (props) => {
description,
onChange,
onBlur,
onDelete,
btnText,
options,
labelExtra
@@ -44,6 +46,7 @@ const ListInput: React.FC<ListInputProps> = (props) => {
const valueList = _.map(values, 'value').filter((val: string) => !!val);
setList(values);
onChange(valueList);
onDelete?.(index);
};
const handleOnChange = (value: string, index: number) => {