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(formula): use onlyLocal, CustomLabel check color value (#796)

Dushusirbcdc64fbb2a7
diff --git a/packages/engine-formula/src/models/formula-data.model.ts b/packages/engine-formula/src/models/formula-data.model.ts
index 78d0f6cd4f..68ed94da34 100644
--- a/packages/engine-formula/src/models/formula-data.model.ts
+++ b/packages/engine-formula/src/models/formula-data.model.ts
@@ -402,8 +402,8 @@ export class FormulaDataModel extends Disposable {
sheetFormulaDataMatrix.forValue((r, c, cell) => {
const formulaString = cell?.f || '';
const formulaId = cell?.si || '';
- const x = cell.x || 0;
- const y = cell.y || 0;
+ const x = cell?.x || 0;
+ const y = cell?.y || 0;
if (isFormulaString(formulaString) && isFormulaId(formulaId) && x === 0 && y === 0) {
formulaIdMap.set(formulaId, { f: formulaString, r, c });
diff --git a/packages/sheets-formula/src/controllers/trigger-calculation.controller.ts b/packages/sheets-formula/src/controllers/trigger-calculation.controller.ts
index 93227aff3b..b8606a7be0 100644
--- a/packages/sheets-formula/src/controllers/trigger-calculation.controller.ts
+++ b/packages/sheets-formula/src/controllers/trigger-calculation.controller.ts
@@ -83,7 +83,7 @@ export class TriggerCalculationController extends Disposable {
const params = command.params as ISetRangeValuesMutationParams;
if (
- (options && options.local === true) ||
+ (options && options.onlyLocal === true) ||
params.trigger === SetStyleCommand.id ||
params.trigger === SetBorderCommand.id
) {
diff --git a/packages/sheets-formula/src/controllers/update-formula.controller.ts b/packages/sheets-formula/src/controllers/update-formula.controller.ts
index 74a900dc2d..ab87eb8f40 100644
--- a/packages/sheets-formula/src/controllers/update-formula.controller.ts
+++ b/packages/sheets-formula/src/controllers/update-formula.controller.ts
@@ -158,13 +158,13 @@ export class UpdateFormulaController extends Disposable {
);
this.disposeWithMe(
- this._commandService.onCommandExecuted((command: ICommandInfo, options) => {
+ this._commandService.onCommandExecuted((command: ICommandInfo, options?: IExecutionOptions) => {
if (!command.params) return;
if (command.id === SetRangeValuesMutation.id) {
const params = command.params as ISetRangeValuesMutationParams;
if (
- (options && options.local === true) ||
+ (options && options.onlyLocal === true) ||
params.trigger === SetStyleCommand.id ||
params.trigger === SetBorderCommand.id
) {
@@ -183,7 +183,7 @@ export class UpdateFormulaController extends Disposable {
private _handleSetRangeValuesMutation(params: ISetRangeValuesMutationParams, options?: IExecutionOptions) {
const { subUnitId: sheetId, unitId, cellValue } = params;
- if ((options && options.local === true) || cellValue == null) {
+ if ((options && options.onlyLocal === true) || cellValue == null) {
return;
}
diff --git a/packages/ui/src/components/custom-label/CustomLabel.tsx b/packages/ui/src/components/custom-label/CustomLabel.tsx
index 52622453ab..2072c35b3f 100644
--- a/packages/ui/src/components/custom-label/CustomLabel.tsx
+++ b/packages/ui/src/components/custom-label/CustomLabel.tsx
@@ -58,7 +58,10 @@ export function CustomLabel(props: ICustomLabelProps): JSX.Element | null {
}
// if value is not valid, use primary color
- const { isValid } = new ColorKit(realValue?.toString());
+ let isValid = false;
+ if (realValue && typeof realValue === 'string') {
+ isValid = new ColorKit(realValue).isValid;
+ }
if (icon) {
const Icon = componentManager.get(realIcon ?? '');