diff --git a/shell/app/common/__tests__/components/edit-field.test.tsx b/shell/app/common/__tests__/components/edit-field.test.tsx index a039560ebb..755d3dd1a0 100644 --- a/shell/app/common/__tests__/components/edit-field.test.tsx +++ b/shell/app/common/__tests__/components/edit-field.test.tsx @@ -64,7 +64,6 @@ describe('EditField', () => { expect(changeFn).toHaveBeenCalledTimes(1); wrapper.find('input').simulate('blur'); expect(changeCbFn).toHaveBeenLastCalledWith({ name: 'erda cloud' }); - expect(wrapper.find('.edit-comp-text')).toExist(); // wrapper.find('.edit-comp-text').simulate('click'); // wrapper.update(); // console.log(wrapper.find('.common-edit-field').html()); diff --git a/shell/app/common/components/edit-field.tsx b/shell/app/common/components/edit-field.tsx index 2efec4fd59..fff6632788 100644 --- a/shell/app/common/components/edit-field.tsx +++ b/shell/app/common/components/edit-field.tsx @@ -140,10 +140,9 @@ export const EditField = React.forwardRef((props: IProps, _compRef) => { }); const [state, updater] = useUpdate({ - editMode: false, editValue: undefined as unknown as string, }); - const { editMode, editValue } = state; + const { editValue } = state; React.useEffect(() => { updater.editValue(value || get(data, name)); @@ -164,7 +163,6 @@ export const EditField = React.forwardRef((props: IProps, _compRef) => { if (onChangeCb) { onChangeCb(set({}, name, v)); } - updater.editMode(true); }; const onBlur = (v?: string, fieldType?: string) => { @@ -176,7 +174,6 @@ export const EditField = React.forwardRef((props: IProps, _compRef) => { onChangeCb(set({}, name, v), fieldType); } } - updater.editMode(true); }; switch (type) { case 'select': { @@ -271,12 +268,6 @@ export const EditField = React.forwardRef((props: IProps, _compRef) => { break; } - const onClick = () => { - if (!editMode && ((type && !['dateReadonly', 'readonly'].includes(type)) || !type)) { - updater.editMode(false); - } - }; - return (
{label && ( @@ -291,7 +282,7 @@ export const EditField = React.forwardRef((props: IProps, _compRef) => { {label}
)} -
+
{Comp} {suffix}