Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

chore: get exclusive should check unitId & subUnitId (#3330)

ybzky965ca0298b91
diff --git a/packages/sheets/src/services/exclusive-range/exclusive-range-service.ts b/packages/sheets/src/services/exclusive-range/exclusive-range-service.ts
index c64459e0cc..39890666e4 100644
--- a/packages/sheets/src/services/exclusive-range/exclusive-range-service.ts
+++ b/packages/sheets/src/services/exclusive-range/exclusive-range-service.ts
@@ -117,28 +117,25 @@ export class ExclusiveRangeService extends Disposable implements IExclusiveRange
public getInterestGroupId(selections: ISelectionWithStyle[]): string[] {
const interestGroupId: string[] = [];
- for (const unitId of this._exclusiveRanges.keys()) {
- for (const sheetId of this._exclusiveRanges.get(unitId)!.keys()) {
- for (const feature of this._exclusiveRanges.get(unitId)!.get(sheetId)!.keys()) {
- const featureMapRanges = this.getExclusiveRanges(unitId, sheetId, feature);
- if (featureMapRanges) {
- for (const featureMapRange of featureMapRanges) {
- let isIntersect = false;
- for (const selection of selections) {
- if (Rectangle.intersects(selection.range, featureMapRange.range)) {
- interestGroupId.push(feature);
- isIntersect = true;
- break;
- }
- }
- if (isIntersect) {
- break;
- }
+ selections.forEach((selection) => {
+ const range = selection.range;
+ const { unitId, sheetId } = range;
+ if (!unitId || !sheetId) return;
+ const featureMap = this._exclusiveRanges.get(unitId)?.get(sheetId);
+ if (!featureMap) return;
+ for (const feature of featureMap.keys()) {
+ const featureMapRanges = featureMap.get(feature);
+ if (featureMapRanges) {
+ for (const featureMapRange of featureMapRanges) {
+ if (Rectangle.intersects(range, featureMapRange.range)) {
+ interestGroupId.push(feature);
+ break;
}
}
}
}
- }
+ });
+
return interestGroupId;
}
}