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.

fix: array formula border deps (#3654)

lumix8d9b1aa31490
diff --git a/packages/sheets-formula/package.json b/packages/sheets-formula/package.json
index 8cf8106f8b..ddeb4e1772 100644
--- a/packages/sheets-formula/package.json
+++ b/packages/sheets-formula/package.json
@@ -83,7 +83,6 @@
"@univerjs/icons": "^0.1.78",
"@univerjs/rpc": "workspace:*",
"@univerjs/sheets": "workspace:*",
- "@univerjs/sheets-filter": "workspace:*",
"@univerjs/sheets-numfmt": "workspace:*",
"@univerjs/sheets-ui": "workspace:*",
"@univerjs/ui": "workspace:*"
diff --git a/packages/sheets-formula/src/controllers/formula-editor-show.controller.ts b/packages/sheets-formula/src/controllers/formula-editor-show.controller.ts
index 2882662661..9bd25d750e 100644
--- a/packages/sheets-formula/src/controllers/formula-editor-show.controller.ts
+++ b/packages/sheets-formula/src/controllers/formula-editor-show.controller.ts
@@ -14,6 +14,9 @@
* limitations under the License.
*/
+import type { ICellDataForSheetInterceptor, ICommandInfo, IObjectMatrixPrimitiveType, IRange, IRowAutoHeightInfo, Nullable, Workbook, Worksheet } from '@univerjs/core';
+import type { IRenderContext, IRenderModule, SpreadsheetSkeleton } from '@univerjs/engine-render';
+import type { ISetWorksheetRowAutoHeightMutationParams } from '@univerjs/sheets';
import {
ColorKit, Disposable,
ICommandService,
@@ -30,8 +33,7 @@ import {
SetFormulaCalculationResultMutation,
} from '@univerjs/engine-formula';
import { IRenderManagerService } from '@univerjs/engine-render';
-import { SetColHiddenMutation, SetColVisibleMutation, SetRowHiddenMutation, SetRowVisibleMutation, SetWorksheetColWidthMutation, SetWorksheetRowAutoHeightMutation, SetWorksheetRowHeightMutation } from '@univerjs/sheets';
-import { ReCalcSheetsFilterMutation, RemoveSheetsFilterMutation, SetSheetsFilterCriteriaMutation, SetSheetsFilterRangeMutation } from '@univerjs/sheets-filter';
+import { SetWorksheetRowAutoHeightMutation } from '@univerjs/sheets';
import {
IEditorBridgeService,
ISheetSelectionRenderService,
@@ -39,22 +41,6 @@ import {
SelectionShape,
SheetSkeletonManagerService,
} from '@univerjs/sheets-ui';
-import type { ICellDataForSheetInterceptor, ICommandInfo, IObjectMatrixPrimitiveType, IRange, IRowAutoHeightInfo, Nullable, Workbook, Worksheet } from '@univerjs/core';
-import type { IRenderContext, IRenderModule, SpreadsheetSkeleton } from '@univerjs/engine-render';
-import type { ISetColHiddenMutationParams, ISetColVisibleMutationParams, ISetRowHiddenMutationParams, ISetRowVisibleMutationParams, ISetWorksheetColWidthMutationParams, ISetWorksheetRowAutoHeightMutationParams, ISetWorksheetRowHeightMutationParams } from '@univerjs/sheets';
-
-const REFRESH_ARRAY_SHAPE_MUTATIONS = [
- SetWorksheetRowHeightMutation.id,
- SetWorksheetColWidthMutation.id,
- SetColHiddenMutation.id,
- SetColVisibleMutation.id,
- SetRowHiddenMutation.id,
- SetRowVisibleMutation.id,
- SetSheetsFilterRangeMutation.id,
- SetSheetsFilterCriteriaMutation.id,
- RemoveSheetsFilterMutation.id,
- ReCalcSheetsFilterMutation.id,
-];
export class FormulaEditorShowController extends Disposable implements IRenderModule {
private _previousShape: Nullable<SelectionShape>;
@@ -91,6 +77,9 @@ export class FormulaEditorShowController extends Disposable implements IRenderMo
// change to another sheet
if (prevSheetId !== skeleton.worksheet.getSheetId()) {
this._removeArrayFormulaRangeShape();
+ } else {
+ const { unitId, sheetId } = param;
+ this._updateArrayFormulaRangeShape(unitId, sheetId);
}
}
})
@@ -180,14 +169,6 @@ export class FormulaEditorShowController extends Disposable implements IRenderMo
this._refreshArrayFormulaRangeShapeByRow(unitId, subUnitId, rowsAutoHeightInfo);
});
}
-
- if (REFRESH_ARRAY_SHAPE_MUTATIONS.includes(command.id)) {
- requestIdleCallback(() => {
- const params = command.params as ISetRowVisibleMutationParams | ISetColHiddenMutationParams | ISetWorksheetRowHeightMutationParams | ISetWorksheetColWidthMutationParams | ISetRowHiddenMutationParams | ISetColVisibleMutationParams;
- const { unitId, subUnitId, ranges } = params;
- this._refreshArrayFormulaRangeShapeByRanges(unitId, subUnitId, ranges);
- });
- }
})
);
}
@@ -300,7 +281,7 @@ export class FormulaEditorShowController extends Disposable implements IRenderMo
return false;
}
- private _refreshArrayFormulaRangeShapeByRanges(unitId: string, subUnitId: string, ranges?: IRange[]): void {
+ private _updateArrayFormulaRangeShape(unitId: string, subUnitId: string): void {
if (!this._checkCurrentSheet(unitId, subUnitId)) return;
if (!this._previousShape) return;
this._refreshArrayFormulaRangeShape(unitId);
diff --git a/packages/sheets-ui/src/services/sheet-skeleton-manager.service.ts b/packages/sheets-ui/src/services/sheet-skeleton-manager.service.ts
index 9503e75e9b..1c0835a2e7 100644
--- a/packages/sheets-ui/src/services/sheet-skeleton-manager.service.ts
+++ b/packages/sheets-ui/src/services/sheet-skeleton-manager.service.ts
@@ -15,13 +15,13 @@
*/
import type { IRange, IRangeWithCoord, Nullable, Workbook, Worksheet } from '@univerjs/core';
-import { Disposable, Inject, Injector } from '@univerjs/core';
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
+import { Disposable, Inject, Injector } from '@univerjs/core';
import { SpreadsheetSkeleton } from '@univerjs/engine-render';
import { BehaviorSubject } from 'rxjs';
export interface ISheetSkeletonManagerParam {
- unitId?: string;
+ unitId: string;
sheetId: string;
skeleton: SpreadsheetSkeleton;
dirty: boolean;
@@ -112,6 +112,7 @@ export class SheetSkeletonManagerService extends Disposable implements IRenderMo
private _setCurrent(searchParam: ISheetSkeletonManagerSearch): Nullable<ISheetSkeletonManagerParam> {
const param = this._getSkeleton(searchParam);
+ const unitId = this._context.unitId;
if (param != null) {
this._reCalculate(param);
} else {
@@ -124,6 +125,7 @@ export class SheetSkeletonManagerService extends Disposable implements IRenderMo
const skeleton = this._buildSkeleton(worksheet);
this._sheetSkeletonParam.push({
+ unitId,
sheetId,
skeleton,
dirty: false,
@@ -131,7 +133,6 @@ export class SheetSkeletonManagerService extends Disposable implements IRenderMo
}
this._currentSkeletonSearchParam = searchParam;
- const unitId = this._context.unitId;
const sheetId = this._currentSkeletonSearchParam.sheetId;
const sheetSkeletonManagerParam = this.getUnitSkeleton(unitId, sheetId);
this._currentSkeletonBefore$.next(sheetSkeletonManagerParam);
@@ -176,6 +177,7 @@ export class SheetSkeletonManagerService extends Disposable implements IRenderMo
const newSkeleton = this._buildSkeleton(worksheet);
this._sheetSkeletonParam.push({
+ unitId: this._context.unitId,
sheetId: searchParam.sheetId,
skeleton: newSkeleton,
dirty: false,
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 5081f02178..f78e539bc0 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -2208,9 +2208,6 @@ importers:
'@univerjs/sheets':
specifier: workspace:*
version: link:../sheets
- '@univerjs/sheets-filter':
- specifier: workspace:*
- version: link:../sheets-filter
'@univerjs/sheets-numfmt':
specifier: workspace:*
version: link:../sheets-numfmt