Drawer 的 overlay false 的 closeOnOutside 整理

This commit is contained in:
2betop 2021-07-05 16:17:53 +08:00
parent e076a1285b
commit e7db3efe04
5 changed files with 10 additions and 5 deletions

View File

@ -821,6 +821,7 @@ test('Renderer:Page handleAction actionType=drawer mergeData', async () => {
);
fireEvent.click(getByText(/OpenDrawer/));
await wait(600);
expect(container).toMatchSnapshot();
fireEvent.click(getByText(/确认/));
@ -1196,7 +1197,7 @@ test('Renderer:Page initApi reload by Drawer action', async () => {
expect(container).toMatchSnapshot();
fireEvent.click(getByText(/OpenDialog/));
await wait(400);
await wait(500);
expect(container).toMatchSnapshot();
fireEvent.click(getByText(/确认/));

View File

@ -218,9 +218,12 @@ export function HocStoreFactory(renderer: {
// nextProps.data.__super !== props.data.__super) &&
} else if (
props.scope &&
isObjectShallowModified(props.scope, prevProps.scope, false) &&
props.data === props.store!.data &&
(shouldSync === true || prevProps.data !== props.data)
) {
// 只有父级数据变动的时候才应该进来,
// 目前看来这个 case 很少有情况下能进来
store.initData(
createObject(props.scope, {
// ...nextProps.data,

View File

@ -605,8 +605,7 @@ export default class Dialog extends React.Component<DialogProps> {
shouldSyncSuperStore: (store: IServiceStore, props: any, prevProps: any) =>
(store.dialogOpen || props.show) &&
(props.show !== prevProps.show ||
isObjectShallowModified(prevProps.data, props.data) ||
isObjectShallowModified(prevProps.data.__super, props.data.__super))
isObjectShallowModified(prevProps.data, props.data))
})
export class DialogRenderer extends Dialog {
static contextType = ScopedContext;

View File

@ -663,8 +663,7 @@ export default class Drawer extends React.Component<DrawerProps> {
shouldSyncSuperStore: (store: IServiceStore, props: any, prevProps: any) =>
(store.drawerOpen || props.show) &&
(props.show !== prevProps.show ||
isObjectShallowModified(prevProps.data, props.data) ||
isObjectShallowModified(prevProps.data.__super, props.data.__super))
isObjectShallowModified(prevProps.data, props.data))
})
export class DrawerRenderer extends Drawer {
static contextType = ScopedContext;
@ -748,6 +747,7 @@ export class DrawerRenderer extends Drawer {
action.actionType === 'confirm') &&
action.close !== false
) {
debugger;
onConfirm && onConfirm(values, rawAction || action, ctx, targets);
} else if (action.close) {
action.close === true

View File

@ -325,6 +325,8 @@ export default class Page extends React.Component<PageProps> {
handleDrawerConfirm(values: object[], action: Action, ...args: Array<any>) {
const {store} = this.props;
console.log('here');
if (action.mergeData && values.length === 1 && values[0]) {
store.updateData(values[0]);
}