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): date validator error when errorStyle=STOP was set (#3102)

zhangwa5015c8f8436
diff --git a/examples/src/data/sheets/demo/default-workbook-data-demo.ts b/examples/src/data/sheets/demo/default-workbook-data-demo.ts
index 2b6473b361..484fab8a97 100644
--- a/examples/src/data/sheets/demo/default-workbook-data-demo.ts
+++ b/examples/src/data/sheets/demo/default-workbook-data-demo.ts
@@ -125,7 +125,7 @@ const dataValidation: IDataValidationRule[] = [
startColumn: 3,
endColumn: 5,
}],
- operator: DataValidationOperator.EQUAL,
+ operator: DataValidationOperator.LESS_THAN_OR_EQUAL,
formula1: '2024/04/10',
formula2: '2024/10/10',
// errorStyle: DataValidationErrorStyle.STOP,
diff --git a/packages/data-validation/src/models/data-validation-manager.ts b/packages/data-validation/src/models/data-validation-manager.ts
index ac8e9236ac..7527f0ff9e 100644
--- a/packages/data-validation/src/models/data-validation-manager.ts
+++ b/packages/data-validation/src/models/data-validation-manager.ts
@@ -14,13 +14,20 @@
* limitations under the License.
*/
-import type { CellValue, IDataValidationRule, Nullable } from '@univerjs/core';
+import type { ICellDataForSheetInterceptor, IDataValidationRule, Nullable } from '@univerjs/core';
import { DataValidationStatus, Disposable } from '@univerjs/core';
import { BehaviorSubject } from 'rxjs';
import type { IUpdateRulePayload } from '../types/interfaces/i-update-rule-payload';
import { UpdateRuleType } from '../types/enum/update-rule-type';
import { getRuleOptions, getRuleSetting } from '../common/util';
+export interface IDataValidationPos {
+ row: number;
+ col: number;
+ unitId: string;
+ subUnitId: string;
+}
+
export class DataValidationManager<T extends IDataValidationRule> extends Disposable {
private _dataValidations: T[] = [];
private _dataValidationMap = new Map<string, T>();
@@ -123,7 +130,7 @@ export class DataValidationManager<T extends IDataValidationRule> extends Dispos
return this._dataValidations;
}
- validator(_content: Nullable<CellValue>, _rule: IDataValidationRule, _pos: any, _onComplete: (status: DataValidationStatus, changed: boolean) => void) {
+ validator(_value: Nullable<ICellDataForSheetInterceptor>, _rule: IDataValidationRule, _pos: IDataValidationPos, _onComplete: (status: DataValidationStatus, changed: boolean) => void) {
return DataValidationStatus.VALID;
}
}
diff --git a/packages/data-validation/src/models/data-validation-model.ts b/packages/data-validation/src/models/data-validation-model.ts
index 90b26910f9..2c10fa5627 100644
--- a/packages/data-validation/src/models/data-validation-model.ts
+++ b/packages/data-validation/src/models/data-validation-model.ts
@@ -14,9 +14,11 @@
* limitations under the License.
*/
-import { type CellValue, type DataValidationStatus, Disposable, type IDataValidationRule, ILogService, type Nullable } from '@univerjs/core';
+import type { DataValidationStatus, ICellDataForSheetInterceptor, IDataValidationRule, Nullable } from '@univerjs/core';
+import { Disposable, ILogService } from '@univerjs/core';
import { debounceTime, Subject } from 'rxjs';
import type { IUpdateRulePayload } from '../types/interfaces/i-update-rule-payload';
+import type { IDataValidationPos } from './data-validation-manager';
import { DataValidationManager } from './data-validation-manager';
type ManagerCreator<T extends IDataValidationRule> = (unitId: string, subUnitId: string) => DataValidationManager<T>;
@@ -161,10 +163,10 @@ export class DataValidationModel<T extends IDataValidationRule = IDataValidation
return manager.getDataValidations();
}
- validator(content: Nullable<CellValue>, rule: T, pos: any) {
+ validator(rule: T, pos: IDataValidationPos, value: Nullable<ICellDataForSheetInterceptor>) {
const { unitId, subUnitId } = pos;
const manager = this.ensureManager(unitId, subUnitId);
- return manager.validator(content, rule, pos, (status, changed) => {
+ return manager.validator(value, rule, pos, (status, changed) => {
if (changed) {
this._validStatusChange$.next({
unitId,
diff --git a/packages/data-validation/src/validators/base-data-validator.ts b/packages/data-validation/src/validators/base-data-validator.ts
index cc9b90859d..6efbc5cfe1 100644
--- a/packages/data-validation/src/validators/base-data-validator.ts
+++ b/packages/data-validation/src/validators/base-data-validator.ts
@@ -16,6 +16,7 @@
import type { CellValue, IDataValidationRule, IDataValidationRuleBase, Nullable, Workbook, Worksheet } from '@univerjs/core';
import { DataValidationOperator, Inject, Injector, LocaleService, Tools } from '@univerjs/core';
+import type { CellValueType } from '@univerjs/protocol';
import { OperatorErrorTitleMap, OperatorTitleMap } from '../types/const/operator-text-map';
import type { IBaseDataValidationWidget } from './base-widget';
@@ -35,12 +36,14 @@ const operatorNameMap: Record<DataValidationOperator, string> = {
export interface IValidatorCellInfo<DataType = Nullable<CellValue>> {
value: DataType;
+ interceptValue: Nullable<CellValue>;
row: number;
column: number;
unitId: string;
subUnitId: string;
worksheet: Worksheet;
workbook: Workbook;
+ t: Nullable<CellValueType>;
}
export interface IFormulaResult<T = any> {
diff --git a/packages/sheets-data-validation/src/controllers/dv-reject-input.controller.ts b/packages/sheets-data-validation/src/controllers/dv-reject-input.controller.ts
index 8c2e2aff2a..8ca53c4c1d 100644
--- a/packages/sheets-data-validation/src/controllers/dv-reject-input.controller.ts
+++ b/packages/sheets-data-validation/src/controllers/dv-reject-input.controller.ts
@@ -58,12 +58,14 @@ export class DataValidationRejectInputController extends Disposable {
const success = await validator.validator(
{
value: getCellValueOrigin(cell),
+ interceptValue: getCellValueOrigin(cell),
row,
column: col,
unitId,
subUnitId,
worksheet,
workbook,
+ t: cell?.t,
}, rule
);
diff --git a/packages/sheets-data-validation/src/controllers/dv-render.controller.ts b/packages/sheets-data-validation/src/controllers/dv-render.controller.ts
index 80142fd186..e6e5bf5531 100644
--- a/packages/sheets-data-validation/src/controllers/dv-render.controller.ts
+++ b/packages/sheets-data-validation/src/controllers/dv-render.controller.ts
@@ -22,7 +22,7 @@ import { ComponentManager, IMenuService } from '@univerjs/ui';
import { AutoHeightController, IEditorBridgeService, SheetSkeletonManagerService } from '@univerjs/sheets-ui';
import type { Spreadsheet } from '@univerjs/engine-render';
import { IRenderManagerService } from '@univerjs/engine-render';
-import { INTERCEPTOR_POINT, SheetInterceptorService } from '@univerjs/sheets';
+import { InterceptCellContentPriority, INTERCEPTOR_POINT, SheetInterceptorService } from '@univerjs/sheets';
import { bufferTime, debounceTime, filter } from 'rxjs';
import { getCellValueOrigin } from '../utils/get-cell-data-origin';
import type { ListValidator } from '../validators';
@@ -183,7 +183,8 @@ export class SheetsDataValidationRenderController extends RxDisposable {
this._sheetInterceptorService.intercept(
INTERCEPTOR_POINT.CELL_CONTENT,
{
- priority: 200,
+ // must be after numfmt
+ priority: InterceptCellContentPriority.DATA_VALIDATION,
// eslint-disable-next-line max-lines-per-function, complexity
handler: (cell, pos, next) => {
const { row, col, unitId, subUnitId, workbook, worksheet } = pos;
@@ -210,8 +211,7 @@ export class SheetsDataValidationRenderController extends RxDisposable {
if (!rule) {
return next(cell);
}
- const cellRaw = worksheet.getCellRaw(pos.row, pos.col);
- const validStatus = this._dataValidationModel.validator(getCellValueOrigin(cellRaw), rule, pos);
+ const validStatus = this._dataValidationModel.validator(rule, pos, cell);
const validator = this._dataValidatorRegistryService.getValidatorItem(rule.type);
const cellValue = getCellValueOrigin(cell);
@@ -389,7 +389,7 @@ export class SheetsDataValidationMobileRenderController extends RxDisposable {
this._sheetInterceptorService.intercept(
INTERCEPTOR_POINT.CELL_CONTENT,
{
- priority: 200,
+ priority: InterceptCellContentPriority.DATA_VALIDATION,
// eslint-disable-next-line max-lines-per-function, complexity
handler: (cell, pos, next) => {
const { row, col, unitId, subUnitId, workbook, worksheet } = pos;
@@ -416,8 +416,7 @@ export class SheetsDataValidationMobileRenderController extends RxDisposable {
if (!rule) {
return next(cell);
}
- const cellRaw = pos.worksheet.getCellRaw(pos.row, pos.col);
- const validStatus = this._dataValidationModel.validator(getCellValueOrigin(cellRaw), rule, pos);
+ const validStatus = this._dataValidationModel.validator(rule, pos, cell);
const validator = this._dataValidatorRegistryService.getValidatorItem(rule.type);
const cellValue = getCellValueOrigin(cell);
diff --git a/packages/sheets-data-validation/src/models/sheet-data-validation-manager.ts b/packages/sheets-data-validation/src/models/sheet-data-validation-manager.ts
index 5b9065f82b..35738bb66e 100644
--- a/packages/sheets-data-validation/src/models/sheet-data-validation-manager.ts
+++ b/packages/sheets-data-validation/src/models/sheet-data-validation-manager.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import type { CellValue, Injector, ISheetDataValidationRule, Nullable, Workbook } from '@univerjs/core';
+import type { ICellDataForSheetInterceptor, Injector, ISheetDataValidationRule, Nullable, Workbook } from '@univerjs/core';
import { DataValidationManager, DataValidatorRegistryService, UpdateRuleType } from '@univerjs/data-validation';
import { DataValidationStatus, DataValidationType, IUniverInstanceService, ObjectMatrix, UniverInstanceType } from '@univerjs/core';
import type { IUpdateRulePayload } from '@univerjs/data-validation';
@@ -24,6 +24,7 @@ import type { IDataValidationResCache } from '../services/dv-cache.service';
import { DataValidationCacheService } from '../services/dv-cache.service';
import { DataValidationFormulaService } from '../services/dv-formula.service';
import { DataValidationCustomFormulaService } from '../services/dv-custom-formula.service';
+import { getCellValueOrigin } from '../utils/get-cell-data-origin';
import { RuleMatrix } from './rule-matrix';
export class SheetDataValidationManager extends DataValidationManager<ISheetDataValidationRule> {
@@ -128,15 +129,20 @@ export class SheetDataValidationManager extends DataValidationManager<ISheetData
return this.getRuleById(ruleId);
}
- override validator(cellValue: Nullable<CellValue>, rule: ISheetDataValidationRule, pos: ISheetLocation, onCompete: (status: DataValidationStatus, changed: boolean) => void): DataValidationStatus {
- const { col, row, unitId, subUnitId } = pos;
+ override validator(cell: Nullable<ICellDataForSheetInterceptor>, rule: ISheetDataValidationRule, pos: ISheetLocation, onCompete: (status: DataValidationStatus, changed: boolean) => void): DataValidationStatus {
+ const { col, row, unitId, subUnitId, worksheet } = pos;
const ruleId = rule.uid;
const validator = this.getValidator(rule.type);
+ const cellRaw = worksheet.getCellRaw(row, col);
+ const cellValue = getCellValueOrigin(cellRaw);
+ const interceptValue = getCellValueOrigin(cell);
+
if (validator) {
const current = this._cache.getValue(row, col);
- if (!current || current.value !== cellValue) {
+ if (!current || current.value !== cellValue || current.interceptValue !== interceptValue || current.ruleId !== ruleId) {
this._cache.setValue(row, col, {
value: cellValue,
+ interceptValue,
status: DataValidationStatus.VALIDATING,
ruleId,
});
@@ -149,6 +155,8 @@ export class SheetDataValidationManager extends DataValidationManager<ISheetData
column: col,
worksheet: pos.worksheet,
workbook: pos.workbook,
+ interceptValue: getCellValueOrigin(cell),
+ t: cellRaw?.t,
},
rule
).then((status) => {
@@ -157,6 +165,7 @@ export class SheetDataValidationManager extends DataValidationManager<ISheetData
value: cellValue,
status: realStatus,
ruleId,
+ interceptValue,
});
onCompete(realStatus, true);
});
diff --git a/packages/sheets-data-validation/src/services/dv-cache.service.ts b/packages/sheets-data-validation/src/services/dv-cache.service.ts
index 939440298f..121d514ca9 100644
--- a/packages/sheets-data-validation/src/services/dv-cache.service.ts
+++ b/packages/sheets-data-validation/src/services/dv-cache.service.ts
@@ -19,6 +19,7 @@ import type { CellValue, DataValidationStatus, IRange, ISheetDataValidationRule,
export interface IDataValidationResCache {
value: Nullable<CellValue>;
+ interceptValue: Nullable<CellValue>;
status: DataValidationStatus;
ruleId: string;
temp?: boolean;
diff --git a/packages/sheets-data-validation/src/services/dv-validator-service.ts b/packages/sheets-data-validation/src/services/dv-validator-service.ts
index e7ffadbc37..80e2b0d738 100644
--- a/packages/sheets-data-validation/src/services/dv-validator-service.ts
+++ b/packages/sheets-data-validation/src/services/dv-validator-service.ts
@@ -18,7 +18,6 @@ import type { IDataValidationRule, IRange, Nullable, ObjectMatrix, Workbook } fr
import { DataValidationStatus, Inject, IUniverInstanceService, Range, UniverInstanceType } from '@univerjs/core';
import { DataValidationModel } from '@univerjs/data-validation';
import type { SheetDataValidationManager } from '../models/sheet-data-validation-manager';
-import { getCellValueOrigin } from '../utils/get-cell-data-origin';
import type { IDataValidationResCache } from './dv-cache.service';
import { DataValidationCacheService } from './dv-cache.service';
@@ -42,15 +41,15 @@ export class SheetsDataValidationValidatorService {
throw new Error(`cannot find current worksheet, sheetId: ${subUnitId}`);
}
- const cellRaw = worksheet.getCellRaw(row, col);
const manager = this._dataValidationModel.ensureManager(unitId, subUnitId) as SheetDataValidationManager;
+ const cell = worksheet.getCell(row, col);
const rule = manager.getRuleByLocation(row, col);
if (!rule) {
return DataValidationStatus.VALID;
}
return new Promise<DataValidationStatus>((resolve) => {
- manager.validator(getCellValueOrigin(cellRaw), rule, { unitId, subUnitId, row, col, worksheet, workbook }, resolve);
+ manager.validator(cell, rule, { unitId, subUnitId, row, col, worksheet, workbook }, resolve);
});
}
diff --git a/packages/sheets-data-validation/src/utils/date.ts b/packages/sheets-data-validation/src/utils/date.ts
deleted file mode 100644
index d3f93bf9f3..0000000000
--- a/packages/sheets-data-validation/src/utils/date.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export function excelSerialToUnixTimestamp(excelSerial: number) {
- const date = new Date((excelSerial - 25569) * 86400);
- return date.getTime();
-}
-
-export const timestamp2SerialTime = (timestamp: number) => {
- return (timestamp / 86400) + 25569;
-};
diff --git a/packages/sheets-data-validation/src/validators/date-validator.ts b/packages/sheets-data-validation/src/validators/date-validator.ts
index 9103943788..2466553b10 100644
--- a/packages/sheets-data-validation/src/validators/date-validator.ts
+++ b/packages/sheets-data-validation/src/validators/date-validator.ts
@@ -14,20 +14,18 @@
* limitations under the License.
*/
-import { DataValidationOperator, DataValidationType, isFormulaString, Tools } from '@univerjs/core';
+import { DataValidationOperator, DataValidationType, isFormulaString, numfmt, Tools } from '@univerjs/core';
import type { CellValue, IDataValidationRule, IDataValidationRuleBase, Nullable } from '@univerjs/core';
import dayjs from 'dayjs';
import type { IFormulaResult, IFormulaValidResult, IValidatorCellInfo } from '@univerjs/data-validation';
import { BaseDataValidator } from '@univerjs/data-validation';
import { BASE_FORMULA_INPUT_NAME } from '../views/formula-input';
import { TWO_FORMULA_OPERATOR_COUNT } from '../types/const/two-formula-operators';
-import { timestamp2SerialTime } from '../utils/date';
import { DataValidationFormulaService } from '../services/dv-formula.service';
import { getFormulaResult } from '../utils/formula';
import { DATE_DROPDOWN_KEY } from '../views';
import { DateOperatorErrorTitleMap, DateOperatorNameMap, DateOperatorTitleMap } from '../common/date-text-map';
import { DateShowTimeOption } from '../views/show-time';
-import { getCellValueOrigin } from '../utils/get-cell-data-origin';
const FORMULA1 = '{FORMULA1}';
const FORMULA2 = '{FORMULA2}';
@@ -41,9 +39,9 @@ const transformDate2SerialNumber = (value: Nullable<CellValue>) => {
return +value;
}
- // transform date to utc
- const dateStr = `${dayjs(value).format('YYYY-MM-DD HH:mm:ss').split(' ').join('T')}Z`;
- return timestamp2SerialTime(dayjs(dateStr).unix());
+ // transform date string to serial number
+ const dateStr = `${dayjs(value).format('YYYY-MM-DD HH:mm:ss')}`;
+ return numfmt.parseDate(dateStr)?.v;
};
export class DateValidator extends BaseDataValidator<number> {
@@ -88,11 +86,9 @@ export class DateValidator extends BaseDataValidator<number> {
}
override async isValidType(info: IValidatorCellInfo): Promise<boolean> {
- const { value, worksheet, row, column } = info;
- const cell = worksheet.getCell(row, column);
- const interceptValue = getCellValueOrigin(cell);
- if (typeof interceptValue === 'string' && typeof value === 'number') {
- return dayjs(interceptValue).isValid();
+ const { interceptValue } = info;
+ if (typeof interceptValue === 'string') {
+ return Boolean(numfmt.parseDate(interceptValue));
}
return false;
@@ -206,7 +202,6 @@ export class DateValidator extends BaseDataValidator<number> {
if (Number.isNaN(formula1)) {
return true;
}
-
return cellInfo.value <= formula1;
}
diff --git a/packages/sheets-data-validation/src/views/date-dropdown/index.tsx b/packages/sheets-data-validation/src/views/date-dropdown/index.tsx
index f14d3756af..81ee0ff14f 100644
--- a/packages/sheets-data-validation/src/views/date-dropdown/index.tsx
+++ b/packages/sheets-data-validation/src/views/date-dropdown/index.tsx
@@ -16,7 +16,7 @@
import React, { useState } from 'react';
import type { CellValue, Nullable } from '@univerjs/core';
-import { DataValidationErrorStyle, ICommandService, LocaleService, useDependency } from '@univerjs/core';
+import { CellValueType, DataValidationErrorStyle, ICommandService, LocaleService, numfmt, useDependency } from '@univerjs/core';
import { Button, DatePanel } from '@univerjs/design';
import { SetRangeValuesCommand } from '@univerjs/sheets';
import dayjs from 'dayjs';
@@ -25,7 +25,6 @@ import type { IDropdownComponentProps } from '../../services/dropdown-manager.se
import type { DateValidator } from '../../validators';
import { getCellValueOrigin } from '../../utils/get-cell-data-origin';
import { DataValidationRejectInputController } from '../../controllers/dv-reject-input.controller';
-import { excelSerialToUnixTimestamp, timestamp2SerialTime } from '../../utils/date';
import styles from './index.module.less';
dayjs.extend(utc);
@@ -36,8 +35,7 @@ const transformDate = (value: Nullable<CellValue>) => {
}
if (typeof value === 'number' || !Number.isNaN(+value)) {
- const date = dayjs.unix(excelSerialToUnixTimestamp(+value)).utc().format().slice(0, -1);
- return dayjs(date);
+ return dayjs(numfmt.format('yyyy-MM-dd HH:mm:ss', value));
}
const date = dayjs(value);
@@ -61,7 +59,6 @@ export function DateDropdown(props: IDropdownComponentProps) {
const showTime = Boolean(rule?.bizInfo?.showTime);
const date = localDate && localDate.isValid() ? localDate : dayjs();
const localeService = useDependency(LocaleService);
-
if (!cellData || !rule || !validator) {
return;
}
@@ -72,8 +69,9 @@ export function DateDropdown(props: IDropdownComponentProps) {
}
const newValue = date;
// convert current date to utc date
- const dateStr = `${newValue.format(showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD 00:00:00').split(' ').join('T')}Z`;
- const serialTime = timestamp2SerialTime(dayjs(dateStr).unix());
+ const dateStr = newValue.format(showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD 00:00:00');
+ const serialTime = numfmt.parseDate(dateStr)?.v;
+
if (
rule.errorStyle !== DataValidationErrorStyle.STOP ||
(await validator.validator({
@@ -84,6 +82,8 @@ export function DateDropdown(props: IDropdownComponentProps) {
column: col,
worksheet,
workbook,
+ interceptValue: dateStr.replace('Z', '').replace('T', ' '),
+ t: CellValueType.NUMBER,
}, rule))
) {
commandService.executeCommand(SetRangeValuesCommand.id, {
@@ -106,7 +106,6 @@ export function DateDropdown(props: IDropdownComponentProps) {
pattern: showTime ? 'yyyy-MM-dd hh:mm:ss' : 'yyyy-MM-dd',
},
},
-
},
});
hideFn();
@@ -127,6 +126,7 @@ export function DateDropdown(props: IDropdownComponentProps) {
onPanelChange={(value) => {
setLocalDate(value);
}}
+ disabledDate={(current) => !numfmt.parseDate(current.format('YYYY-MM-DD'))}
/>
<div className={styles.dvDateDropdownBtns}>
<Button size="small" type="primary" onClick={handleSave} disabled={!date.isValid()}>
diff --git a/packages/sheets-numfmt/src/controllers/numfmt.cell-content.controller.ts b/packages/sheets-numfmt/src/controllers/numfmt.cell-content.controller.ts
index 9521e9c096..9138e9de88 100644
--- a/packages/sheets-numfmt/src/controllers/numfmt.cell-content.controller.ts
+++ b/packages/sheets-numfmt/src/controllers/numfmt.cell-content.controller.ts
@@ -34,7 +34,7 @@ import {
UniverInstanceType,
} from '@univerjs/core';
import type { ISetNumfmtMutationParams, ISetRangeValuesMutationParams } from '@univerjs/sheets';
-import { INTERCEPTOR_POINT, INumfmtService, SetNumfmtMutation, SetRangeValuesMutation, SheetInterceptorService } from '@univerjs/sheets';
+import { InterceptCellContentPriority, INTERCEPTOR_POINT, INumfmtService, SetNumfmtMutation, SetRangeValuesMutation, SheetInterceptorService } from '@univerjs/sheets';
import { of, skip, switchMap } from 'rxjs';
import { getPatternPreview } from '../utils/pattern';
@@ -113,7 +113,7 @@ export class SheetsNumfmtCellContentController extends Disposable {
return next({ ...cell, ...res });
},
- priority: 10,
+ priority: InterceptCellContentPriority.NUMFMT,
}));
this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
diff --git a/packages/sheets/src/index.ts b/packages/sheets/src/index.ts
index 33b18c7442..6586a21cf6 100644
--- a/packages/sheets/src/index.ts
+++ b/packages/sheets/src/index.ts
@@ -94,7 +94,7 @@ export {
handleDefaultRangeChangeWithEffectRefCommands,
handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests,
} from './services/ref-range/util';
-export { INTERCEPTOR_POINT } from './services/sheet-interceptor/interceptor-const';
+export { INTERCEPTOR_POINT, InterceptCellContentPriority } from './services/sheet-interceptor/interceptor-const';
export { SheetInterceptorService } from './services/sheet-interceptor/sheet-interceptor.service';
export type { ISheetLocation, ISheetLocationBase, ISheetRowLocation } from './services/sheet-interceptor/utils/interceptor';
export { MergeCellController, MERGE_CELL_INTERCEPTOR_CHECK } from './controllers/merge-cell.controller';
diff --git a/packages/sheets/src/services/sheet-interceptor/interceptor-const.ts b/packages/sheets/src/services/sheet-interceptor/interceptor-const.ts
index 78cd290667..0cb2ff09d1 100644
--- a/packages/sheets/src/services/sheet-interceptor/interceptor-const.ts
+++ b/packages/sheets/src/services/sheet-interceptor/interceptor-const.ts
@@ -26,3 +26,8 @@ export const INTERCEPTOR_POINT = {
CELL_CONTENT,
ROW_FILTERED,
};
+
+export enum InterceptCellContentPriority {
+ DATA_VALIDATION = 9,
+ NUMFMT = 10,
+}