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.

feat(pivot): support custom sort (#4889)

ybzky4e4ac707440c
diff --git a/packages/sheets-ui/src/services/selection/selection-control.ts b/packages/sheets-ui/src/services/selection/selection-control.ts
index 6f5e732799..ca7128e21d 100644
--- a/packages/sheets-ui/src/services/selection/selection-control.ts
+++ b/packages/sheets-ui/src/services/selection/selection-control.ts
@@ -505,6 +505,12 @@ export class SelectionControl extends Disposable {
this._controlExtension = new SelectionShapeExtension(this, options);
}
+ setControlExtensionDisable(disable: boolean) {
+ if (this._controlExtension) {
+ this._controlExtension.setDisabled(disable);
+ }
+ }
+
setEvent(state: boolean): void {
this.leftControl.evented = state;
this.rightControl.evented = state;
diff --git a/packages/sheets-ui/src/services/selection/selection-shape-extension.ts b/packages/sheets-ui/src/services/selection/selection-shape-extension.ts
index 00dc4bcc5e..fa601f3383 100644
--- a/packages/sheets-ui/src/services/selection/selection-shape-extension.ts
+++ b/packages/sheets-ui/src/services/selection/selection-shape-extension.ts
@@ -65,6 +65,8 @@ export class SelectionShapeExtension {
private _scenePointerUpSub: Nullable<Subscription>;
+ private _disabled: boolean = false;
+
/**
* The shadow selection under cursor when move whole selection control(for moving normal selection)
*/
@@ -125,6 +127,10 @@ export class SelectionShapeExtension {
this._helperSelection?.dispose();
}
+ setDisabled(disabled: boolean) {
+ this._disabled = disabled;
+ }
+
private _getFreeze() {
const freeze = withCurrentTypeOfRenderer(
UniverInstanceType.UNIVER_SHEET,
@@ -348,6 +354,9 @@ export class SelectionShapeExtension {
scene.disableObjectsEvent();
this._scenePointerMoveSub = scene.onPointerMove$.subscribeEvent((moveEvt: IPointerEvent | IMouseEvent) => {
+ if (this._disabled) {
+ return;
+ }
const { offsetX: moveOffsetX, offsetY: moveOffsetY } = moveEvt;
const permissionCheck = this._injector.get(ISheetSelectionRenderService, Quantity.OPTIONAL)