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(sheets-data-validation-ui): set default color for dropdown options when color is not provided (#5566)

白熱095759b3f6b5
diff --git a/packages/sheets-data-validation-ui/src/services/dropdown-manager.service.ts b/packages/sheets-data-validation-ui/src/services/dropdown-manager.service.ts
index b6be4078dd..e18157fcda 100644
--- a/packages/sheets-data-validation-ui/src/services/dropdown-manager.service.ts
+++ b/packages/sheets-data-validation-ui/src/services/dropdown-manager.service.ts
@@ -29,6 +29,7 @@ import { IEditorBridgeService, ISheetCellDropdownManagerService, SetCellEditVisi
import { IZenZoneService, KeyCode } from '@univerjs/ui';
import { Subject } from 'rxjs';
import { OpenValidationPanelOperation } from '../commands/operations/data-validation.operation';
+import { DROP_DOWN_DEFAULT_COLOR } from '../const';
import { SHEETS_DATA_VALIDATION_UI_PLUGIN_CONFIG_KEY } from '../controllers/config.schema';
import { DataValidationRejectInputController } from '../controllers/dv-reject-input.controller';
@@ -346,7 +347,7 @@ export class DataValidationDropdownManagerService extends Disposable {
const options = list.map((item) => ({
label: item.label,
value: item.label,
- color: (showColor || item.color) ? item.color : 'transparent',
+ color: (showColor || item.color) ? (item.color || DROP_DOWN_DEFAULT_COLOR) : 'transparent',
}));
dropdownParam = {