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(sheets-data-validation-ui): reorder `SetCellEditVisibleOperation` command execution (#5541)
白熱bbef1553a0ce
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.tsindex ecf3da5dba..b6be4078dd 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@@ -206,12 +206,6 @@ export class DataValidationDropdownManagerService extends Disposable {t: CellValueType.NUMBER,}, rule))) {- await this._commandService.executeCommand(SetCellEditVisibleOperation.id, {- visible: false,- eventType: DeviceInputEventType.Keyboard,- unitId,- keycode: KeyCode.ESC,- } as IEditorBridgeServiceVisibleParam);await this._commandService.executeCommand(SetRangeValuesCommand.id, {unitId,subUnitId,@@ -234,6 +228,12 @@ export class DataValidationDropdownManagerService extends Disposable {},},});+ await this._commandService.executeCommand(SetCellEditVisibleOperation.id, {+ visible: false,+ eventType: DeviceInputEventType.Keyboard,+ unitId,+ keycode: KeyCode.ESC,+ } as IEditorBridgeServiceVisibleParam);return true;} else {if (this._injector.has(DataValidationRejectInputController)) {@@ -316,6 +316,7 @@ export class DataValidationDropdownManagerService extends Disposable {},};+ this._commandService.executeCommand(SetRangeValuesCommand.id, params);if (this._editorBridgeService.isVisible().visible) {await this._commandService.executeCommand(SetCellEditVisibleOperation.id, {visible: false,@@ -324,7 +325,6 @@ export class DataValidationDropdownManagerService extends Disposable {keycode: KeyCode.ESC,} as IEditorBridgeServiceVisibleParam);}- this._commandService.executeCommand(SetRangeValuesCommand.id, params);if (multiple) {return false;@@ -382,6 +382,7 @@ export class DataValidationDropdownManagerService extends Disposable {},};+ this._commandService.syncExecuteCommand(SetRangeValuesCommand.id, params);if (this._editorBridgeService.isVisible().visible) {this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {visible: false,@@ -390,7 +391,6 @@ export class DataValidationDropdownManagerService extends Disposable {keycode: KeyCode.ESC,} as IEditorBridgeServiceVisibleParam);}- this._commandService.syncExecuteCommand(SetRangeValuesCommand.id, params);return true;};@@ -425,6 +425,7 @@ export class DataValidationDropdownManagerService extends Disposable {},};+ this._commandService.syncExecuteCommand(SetRangeValuesCommand.id, params);if (this._editorBridgeService.isVisible().visible) {this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {visible: false,@@ -433,7 +434,6 @@ export class DataValidationDropdownManagerService extends Disposable {keycode: KeyCode.ESC,} as IEditorBridgeServiceVisibleParam);}- this._commandService.syncExecuteCommand(SetRangeValuesCommand.id, params);return true;};diff --git a/packages/sheets-ui/src/views/dropdown/date-dropdown/index.tsx b/packages/sheets-ui/src/views/dropdown/date-dropdown/index.tsxindex 17b2c38cd9..c3a720c3c4 100644--- a/packages/sheets-ui/src/views/dropdown/date-dropdown/index.tsx+++ b/packages/sheets-ui/src/views/dropdown/date-dropdown/index.tsx@@ -36,11 +36,11 @@ export function DateDropdown(props: { popup: IPopup<IDateDropdownProps & IBaseDrconst defaultDate = useMemo(() => patternType !== 'time' ? dayjs() : dayjs('1900-01-01 00:00:00'), []);const date = localDate && localDate.isValid() ? localDate : defaultDate;const localeService = useDependency(LocaleService);+const handleSave = async () => {- if (!date) {- return;- }- if ((await onChange?.(date)) !== false) {+ if (!date) return;+ const result = await onChange?.(date);+ if (result) {hideFn();}};