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.

chore(umd): fix numfmt in umd build (#2817)

#FF0000cede9f4f96d8
diff --git a/packages/engine-numfmt/src/index.ts b/packages/engine-numfmt/src/index.ts
index 02c2ec5f84..5a0c0021c4 100644
--- a/packages/engine-numfmt/src/index.ts
+++ b/packages/engine-numfmt/src/index.ts
@@ -17,8 +17,6 @@
// @ts-ignore
import numfmt from 'numfmt';
-import type { Numfmt } from './type';
-
export { DEFAULT_TEXT_FORMAT } from './const';
-export default numfmt as Numfmt;
+export { numfmt };
diff --git a/packages/engine-numfmt/src/types/index.d.ts b/packages/engine-numfmt/src/types/index.d.ts
index 128337c191..3546733aa2 100644
--- a/packages/engine-numfmt/src/types/index.d.ts
+++ b/packages/engine-numfmt/src/types/index.d.ts
@@ -14,4 +14,8 @@
* limitations under the License.
*/
-declare module 'numfmt' {}
+declare module 'numfmt' {
+ import type { Numfmt } from '../type';
+
+ export default Numfmt;
+}
diff --git a/packages/sheets-data-validation/src/validators/list-validator.ts b/packages/sheets-data-validation/src/validators/list-validator.ts
index cf1d3e9f51..74321da65b 100644
--- a/packages/sheets-data-validation/src/validators/list-validator.ts
+++ b/packages/sheets-data-validation/src/validators/list-validator.ts
@@ -19,7 +19,7 @@ import type { CellValue, DataValidationOperator, ICellData, IDataValidationRule,
import type { IBaseDataValidationWidget, IFormulaResult, IFormulaValidResult, IValidatorCellInfo } from '@univerjs/data-validation';
import { BaseDataValidator } from '@univerjs/data-validation';
import { deserializeRangeWithSheet, isReferenceString, LexerTreeBuilder, sequenceNodeType } from '@univerjs/engine-formula';
-import numfmt from '@univerjs/engine-numfmt';
+import { numfmt } from '@univerjs/engine-numfmt';
import { LIST_FORMULA_INPUT_NAME } from '../views/formula-input';
import { LIST_DROPDOWN_KEY } from '../views';
import { DropdownWidget } from '../widgets/dropdown-widget';
diff --git a/packages/sheets-numfmt/src/__tests__/date.test.ts b/packages/sheets-numfmt/src/__tests__/date.test.ts
index f894c652ae..782a9223b0 100644
--- a/packages/sheets-numfmt/src/__tests__/date.test.ts
+++ b/packages/sheets-numfmt/src/__tests__/date.test.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import numfmt from '@univerjs/engine-numfmt';
+import { numfmt } from '@univerjs/engine-numfmt';
import { describe, expect, it } from 'vitest';
describe('test numfmt date', () => {
diff --git a/packages/sheets-numfmt/src/components/date/index.tsx b/packages/sheets-numfmt/src/components/date/index.tsx
index 0d2703a248..ef037d86a9 100644
--- a/packages/sheets-numfmt/src/components/date/index.tsx
+++ b/packages/sheets-numfmt/src/components/date/index.tsx
@@ -16,7 +16,7 @@
import { LocaleService } from '@univerjs/core';
import { SelectList } from '@univerjs/design';
-import numfmt from '@univerjs/engine-numfmt';
+import { numfmt } from '@univerjs/engine-numfmt';
import { useDependency } from '@wendellhu/redi/react-bindings';
import type { FC } from 'react';
import React, { useMemo, useState } from 'react';
diff --git a/packages/sheets-numfmt/src/controllers/numfmt.editor.controller.ts b/packages/sheets-numfmt/src/controllers/numfmt.editor.controller.ts
index ec283d5205..9375e0c8c5 100644
--- a/packages/sheets-numfmt/src/controllers/numfmt.editor.controller.ts
+++ b/packages/sheets-numfmt/src/controllers/numfmt.editor.controller.ts
@@ -24,7 +24,7 @@ import {
toDisposable,
UniverInstanceType,
} from '@univerjs/core';
-import numfmt from '@univerjs/engine-numfmt';
+import { numfmt } from '@univerjs/engine-numfmt';
import type {
INumfmtItemWithCache,
IRemoveNumfmtMutationParams,
diff --git a/packages/sheets-numfmt/src/utils/decimal.ts b/packages/sheets-numfmt/src/utils/decimal.ts
index 9859af7e63..2c0b1141b3 100644
--- a/packages/sheets-numfmt/src/utils/decimal.ts
+++ b/packages/sheets-numfmt/src/utils/decimal.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import numfmt from '@univerjs/engine-numfmt';
+import { numfmt } from '@univerjs/engine-numfmt';
/**
* the function decimal just use positive,negative configuration ignored
diff --git a/packages/sheets-numfmt/src/utils/pattern.ts b/packages/sheets-numfmt/src/utils/pattern.ts
index 5b2a734ad1..c40fc8a058 100644
--- a/packages/sheets-numfmt/src/utils/pattern.ts
+++ b/packages/sheets-numfmt/src/utils/pattern.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import numfmt from '@univerjs/engine-numfmt';
+import { numfmt } from '@univerjs/engine-numfmt';
import { LocaleType } from '@univerjs/core';
import type { FormatType } from '@univerjs/sheets';
diff --git a/packages/sheets-ui/src/controllers/clipboard/utils.ts b/packages/sheets-ui/src/controllers/clipboard/utils.ts
index e9b40ec971..f76e4725a6 100644
--- a/packages/sheets-ui/src/controllers/clipboard/utils.ts
+++ b/packages/sheets-ui/src/controllers/clipboard/utils.ts
@@ -38,7 +38,7 @@ import {
} from '@univerjs/sheets';
import type { IAccessor } from '@wendellhu/redi';
-import numfmt from '@univerjs/engine-numfmt';
+import { numfmt } from '@univerjs/engine-numfmt';
import { DEFAULT_PADDING_DATA } from '@univerjs/engine-render';
import type { ICellDataWithSpanInfo, ICopyPastePayload, ISheetDiscreteRangeLocation } from '../../services/clipboard/type';
import { COPY_TYPE } from '../../services/clipboard/type';
diff --git a/packages/sheets-ui/src/services/auto-fill/rules.ts b/packages/sheets-ui/src/services/auto-fill/rules.ts
index ac567e1f5e..e017e017ea 100644
--- a/packages/sheets-ui/src/services/auto-fill/rules.ts
+++ b/packages/sheets-ui/src/services/auto-fill/rules.ts
@@ -16,7 +16,7 @@
import type { Workbook } from '@univerjs/core';
import { CellValueType, Direction, IUniverInstanceService } from '@univerjs/core';
-import numfmt from '@univerjs/engine-numfmt';
+import { numfmt } from '@univerjs/engine-numfmt';
import {
chineseToNumber,
diff --git a/packages/sheets-ui/src/views/status-bar/CopyableStatisticItem.tsx b/packages/sheets-ui/src/views/status-bar/CopyableStatisticItem.tsx
index aaaf601ac5..5484990825 100644
--- a/packages/sheets-ui/src/views/status-bar/CopyableStatisticItem.tsx
+++ b/packages/sheets-ui/src/views/status-bar/CopyableStatisticItem.tsx
@@ -18,7 +18,7 @@ import { LocaleService } from '@univerjs/core';
import { MessageType, Tooltip } from '@univerjs/design';
import type { IFunctionNames } from '@univerjs/engine-formula';
import { FUNCTION_NAMES_MATH, FUNCTION_NAMES_STATISTICAL, FUNCTION_NAMES_TEXT } from '@univerjs/engine-formula';
-import numfmt from '@univerjs/engine-numfmt';
+import { numfmt } from '@univerjs/engine-numfmt';
import { IClipboardInterfaceService, IMessageService } from '@univerjs/ui';
import { useDependency } from '@wendellhu/redi/react-bindings';
import React from 'react';