Skip to content

Commit

Permalink
šŸ› fix(ims-view-pc): simple form item onChange is not trigger in EditTā€¦
Browse files Browse the repository at this point in the history
ā€¦able
  • Loading branch information
eternallycyf authored and eternallycyf committed Mar 5, 2024
1 parent 892f3a1 commit 1704da4
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/ims-view-pc/src/components/CustomForm/FormItem/simple.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { DatePickerProps } from 'antd/lib';
import dayjs, { Dayjs } from 'dayjs';
import 'dayjs/locale/zh-cn';
import { AnyObject, DeepPartial, IBaseControlProps, IBaseCustomFormItemProps } from 'ims-view-pc';
import _ from 'lodash';
import React, { useImperativeHandle } from 'react';
const RadioGroup = Radio.Group;
const CheckboxGroup: any = Checkbox.Group;
Expand Down Expand Up @@ -105,7 +106,9 @@ const SimpleControl = React.forwardRef<any, ISimpleControlProps>((props, ref) =>
checked = false,
controlProps: defaultControlProps = {},
itemProps,
...restProps
onChange,
record,
value,
} = props;

const _getPlaceholder = () => {
Expand Down Expand Up @@ -146,7 +149,15 @@ const SimpleControl = React.forwardRef<any, ISimpleControlProps>((props, ref) =>
...defaultVal[type],
placeholder: _getPlaceholder(),
...defaultControlProps,
...restProps,
onChange: (...arg) => {
//@ts-ignore
onChange && onChange(...arg);
if (defaultControlProps?.onChange) {
defaultControlProps?.onChange(...arg);
}
},
record,
value,
};

useImperativeHandle(ref, () => ({}));
Expand Down

0 comments on commit 1704da4

Please sign in to comment.