Skip to content

Commit

Permalink
fix: individualGroupable request #967
Browse files Browse the repository at this point in the history
  • Loading branch information
daybrush committed Jul 2, 2023
1 parent 6577ee9 commit daf6008
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/react-moveable/src/MoveableIndividualGroup.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ref, refs } from "framework-utils";
import * as React from "react";
import MoveableManager from "./MoveableManager";
import { GroupableProps, IndividualGroupableProps, MoveableManagerInterface, RectInfo } from "./types";
import { GroupableProps, IndividualGroupableProps, MoveableManagerInterface, RectInfo, Requester } from "./types";
import { prefix } from "./utils";
import { setStoreCache } from "./store/Store";

Expand Down Expand Up @@ -68,15 +68,24 @@ class MoveableIndividualGroup extends MoveableManager<GroupableProps & Individua
children: this.moveables.map(child => child.getRect()),
};
}
public request() {
return {
request() {
public request(
ableName: string,
param: Record<string, any> = {},
isInstant?: boolean,
): Requester {
const results = this.moveables.map(m => m.request(ableName, {...param, isInstant: false }, false));
const requestInstant = isInstant || param.isInstant;
const requester: Requester = {
request(ableParam: Record<string, any>) {
results.forEach(r => r.request(ableParam));
return this;
},
requestEnd() {
results.forEach(r => r.requestEnd());
return this;
},
};
return requestInstant ? requester.request(param).requestEnd() : requester;
}
public dragStart() {
return this;
Expand Down

0 comments on commit daf6008

Please sign in to comment.