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(sheet): unhide row button will update when skeleton change & auto-fill will check empty

YuHong4598c91f2497
diff --git a/packages/sheets-ui/src/controllers/render-controllers/header-unhide.render-controller.ts b/packages/sheets-ui/src/controllers/render-controllers/header-unhide.render-controller.ts
index 71e7cc63fa..55ef3b54fc 100644
--- a/packages/sheets-ui/src/controllers/render-controllers/header-unhide.render-controller.ts
+++ b/packages/sheets-ui/src/controllers/render-controllers/header-unhide.render-controller.ts
@@ -21,7 +21,7 @@ import {
RxDisposable,
} from '@univerjs/core';
import type { IRenderContext } from '@univerjs/engine-render';
-import type { ISetSpecificColsVisibleCommandParams, ISetSpecificRowsVisibleCommandParams, ISheetCommandSharedParams } from '@univerjs/sheets';
+import type { ISetSpecificColsVisibleCommandParams, ISetSpecificRowsVisibleCommandParams } from '@univerjs/sheets';
import {
InsertColMutation,
InsertRowMutation,
@@ -100,21 +100,19 @@ export class HeaderUnhideRenderController extends RxDisposable {
this._update(this._workbook, worksheet);
});
- // Re-render hidden rows / cols when specific commands are executed.
- this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
- if (!RENDER_COMMANDS.includes(command.id) ||
- !command.params ||
- !(command.params as ISheetCommandSharedParams).unitId ||
- (command.params as ISheetCommandSharedParams).subUnitId !== activeSheetId) {
- return;
- }
-
- const workbook = this._workbook;
- const worksheet = workbook.getSheetBySheetId((command.params as ISheetCommandSharedParams).subUnitId);
- if (worksheet) {
- this._update(workbook, worksheet);
- }
- }));
+ this.disposeWithMe(
+ this._sheetSkeletonManagerService.currentSkeleton$.subscribe((param) => {
+ if (param) {
+ const { unitId, sheetId } = param;
+ if (unitId === this._workbook.getUnitId() && sheetId === activeSheetId) {
+ const worksheet = this._workbook.getSheetBySheetId(sheetId);
+ if (worksheet) {
+ this._update(this._workbook, worksheet);
+ }
+ }
+ }
+ })
+ );
}
private _update(workbook: Workbook, worksheet: Worksheet): void {
diff --git a/packages/sheets-ui/src/services/auto-fill/auto-fill.service.ts b/packages/sheets-ui/src/services/auto-fill/auto-fill.service.ts
index ccf3377207..df2f39d471 100644
--- a/packages/sheets-ui/src/services/auto-fill/auto-fill.service.ts
+++ b/packages/sheets-ui/src/services/auto-fill/auto-fill.service.ts
@@ -280,7 +280,9 @@ export class AutoFillService extends Disposable implements IAutoFillService {
subUnitId = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet()?.getSheetId(),
} = this.autoFillLocation || {};
const direction = this.direction;
- if (!source || !target || unitId !== triggerUnitId || subUnitId !== triggerSubUnitId) {
+ if (!source || !source.cols.length || !source.rows.length
+ || !target || !target.cols.length || !target.rows.length
+ || unitId !== triggerUnitId || subUnitId !== triggerSubUnitId) {
return false;
}