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.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
fix: cell link postion should clear primary (#4241)
lumix7fe6a768fe7b
diff --git a/examples/esbuild.config.ts b/examples/esbuild.config.tsindex fa20a3473e..9fdb29ee03 100644--- a/examples/esbuild.config.ts+++ b/examples/esbuild.config.ts@@ -32,7 +32,7 @@ const nodeModules = path.resolve(process.cwd(), './node_modules');const args = minimist(process.argv.slice(2));const isE2E = !!args.e2e;-// User should also config their bunlder to build monaco editor's resources for web worker.+// User should also config their bundler to build monaco editor's resources for web worker.const monacoEditorEntryPoints = ['vs/language/json/json.worker.js','vs/language/css/css.worker.js',diff --git a/packages/sheets-hyper-link-ui/src/services/resolver.service.ts b/packages/sheets-hyper-link-ui/src/services/resolver.service.tsindex 7f158261a7..c2986bd661 100644--- a/packages/sheets-hyper-link-ui/src/services/resolver.service.ts+++ b/packages/sheets-hyper-link-ui/src/services/resolver.service.ts@@ -141,6 +141,7 @@ export class SheetsHyperLinkResolverService {selections: [{range: realRange,+ primary: null,}],} as ISetSelectionsOperationParams);diff --git a/packages/sheets-ui/src/services/selection/selection-control.ts b/packages/sheets-ui/src/services/selection/selection-control.tsindex ded5dc32d6..db3485a8cd 100644--- a/packages/sheets-ui/src/services/selection/selection-control.ts+++ b/packages/sheets-ui/src/services/selection/selection-control.ts@@ -515,7 +515,6 @@ export class SelectionControl extends Disposable {* Update Control Style And Position of SelectionControl* @param selectionStyle*/-protected _updateLayoutOfSelectionControl(selectionStyle?: Nullable<Partial<ISelectionStyle>>): void {if (selectionStyle) {this.currentStyle = Object.assign({}, this._defaultStyle, selectionStyle);@@ -662,25 +661,29 @@ export class SelectionControl extends Disposable {}/**- * Update range, primary may be null, especially for moving handler.- * @param range- * @param primaryCell+ * Update range and primary range.+ *+ * highlight cell would update if primaryWithCoord has value.+ * highlight cell would be cleared if primaryWithCoord is null.+ * highlight would keep prev value if primaryWithCoord is undefined.+ * @param rangeWithCoord+ * @param primaryWithCoord*/- updateRange(range: IRangeWithCoord, primaryCell: Nullable<ICellWithCoord>): void {- this._selectionRenderModel.setValue(range, primaryCell);- this._showAutoFill = primaryCell !== null;+ updateRange(rangeWithCoord: IRangeWithCoord, primaryWithCoord: Nullable<ICellWithCoord>): void {+ this._selectionRenderModel.setValue(rangeWithCoord, primaryWithCoord);+ this._showAutoFill = primaryWithCoord !== null;this._updateLayoutOfSelectionControl();this._updateControlCoord();}+ /**+ * Update range and primary range and style.+ * @param selectionWthCoord+ */updateRangeBySelectionWithCoord(selectionWthCoord: ISelectionWithCoord) {this._selectionRenderModel.setValue(selectionWthCoord.rangeWithCoord, selectionWthCoord.primaryWithCoord);- // if undefined, then keeps the previous value- if (selectionWthCoord.primaryWithCoord === null) {- this._showAutoFill = false;- } else {- this._showAutoFill = true;- }+ // if primaryWithCoord is undefined, that means keeps the previous value.+ this._showAutoFill = selectionWthCoord.primaryWithCoord !== null;this._updateLayoutOfSelectionControl(selectionWthCoord.style);this._updateControlCoord();}@@ -716,9 +719,15 @@ export class SelectionControl extends Disposable {}/**- * update primary range+ * Update primary range.+ * highlight cell would update if primary cell has value.+ * highlight cell would be cleared if primary cell is null.+ * highlight would keep prev value if primary cell is undefined.+ ** @param primaryCell model.current (aka: highlight)*/+ // @TODO lumixraku there are 3 concepts for same thing, primary and current and highlight+ // highlight is best. primary sometimes means the actual cell(actual means ignore merge)updateCurrCell(primaryCell: Nullable<ICellWithCoord>): void {// in multiple selection shape, only shape with highlight has auto fill.this._showAutoFill = primaryCell !== null;diff --git a/packages/sheets-ui/src/services/selection/selection-render-model.ts b/packages/sheets-ui/src/services/selection/selection-render-model.tsindex 6fdbbd9d23..dca81ef9b3 100644--- a/packages/sheets-ui/src/services/selection/selection-render-model.ts+++ b/packages/sheets-ui/src/services/selection/selection-render-model.ts@@ -167,15 +167,12 @@ export class SelectionRenderModel implements IRangeWithCoord {/*** Set primary cell.- ** @TODO lumixraku there are 3 concepts for same thing, primary and current and highlight* highlight is best. primary sometimes means the actual cell(actual means ignore merge)* @param currentCell*/setCurrentCell(currentCell: Nullable<ICellWithCoord>) {- if (currentCell) {- this._primary = currentCell;- }+ this._primary = currentCell;}clearCurrentCell() {diff --git a/packages/sheets-ui/src/services/selection/util.ts b/packages/sheets-ui/src/services/selection/util.tsindex 208cf03410..969201bbd3 100644--- a/packages/sheets-ui/src/services/selection/util.ts+++ b/packages/sheets-ui/src/services/selection/util.ts@@ -61,7 +61,7 @@ export function attachRangeWithCoord(skeleton: SpreadsheetSkeleton, range: IRangexport function attachSelectionWithCoord(selection: ISelectionWithStyle, skeleton: SpreadsheetSkeleton): ISelectionWithCoord {const { range, primary, style } = selection;const rangeWithCoord = attachRangeWithCoord(skeleton, range);- const primaryWithCoord = primary ? attachPrimaryWithCoord(skeleton, primary) : undefined;+ const primaryWithCoord = primary ? attachPrimaryWithCoord(skeleton, primary) : primary;return {rangeWithCoord,primaryWithCoord,