snapshot of https://github.com/dream-num/univer.git (dev, 2026-09-16; blobs > 131072B omitted)
Some checks failed
📦 Build / build (push) Has been cancelled
🧪 CI Test / test shard (1/4) (push) Has been cancelled
🧪 CI Test / test shard (2/4) (push) Has been cancelled
🧪 CI Test / test shard (3/4) (push) Has been cancelled
🧪 CI Test / test shard (4/4) (push) Has been cancelled
🧪 CI Test / test (push) Has been cancelled
🧪 CI Test / eslint (push) Has been cancelled
🧪 CI Test / typecheck (push) Has been cancelled
🔫 Sync to Pro / dispatch-sync (push) Has been cancelled
🔮 Sync Mirror / sync (push) Has been cancelled

This commit is contained in:
upstream-mirror
2026-09-16 05:09:45 +05:00
commit bcf6ef63ad
7118 changed files with 1236854 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
# @univerjs/preset-sheets-core
[![npm version](https://img.shields.io/npm/v/@univerjs/preset-sheets-core?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-core)
[![license](https://img.shields.io/npm/l/@univerjs/preset-sheets-core?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-core)
[![downloads](https://img.shields.io/npm/dm/@univerjs/preset-sheets-core?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-core)
`@univerjs/preset-sheets-core` provides a preset for core Univer Sheets spreadsheet features.
## Package Overview
| Package | CSS | Locales | Facade entry |
| ------------------------------ | :-: | :-----: | :----------: |
| `@univerjs/preset-sheets-core` | Yes | Yes | Yes |
## Installation
```sh
pnpm add @univerjs/preset-sheets-core
# or
npm install @univerjs/preset-sheets-core
```
Keep all `@univerjs/*` packages on the same version.
## Usage
```ts
import { UniverSheetsCorePreset } from '@univerjs/preset-sheets-core';
// Use with createUniver:
// createUniver({ presets: [UniverSheetsCorePreset()] });
```
## Resources
- [Documentation](https://docs.univer.ai)
- [NPM package](https://npmjs.com/package/@univerjs/preset-sheets-core)
- [GitHub repository](https://github.com/dream-num/univer)

View File

@@ -0,0 +1,103 @@
{
"name": "@univerjs/preset-sheets-core",
"version": "1.0.0-rc.0",
"private": false,
"description": "Preset for core Univer Sheets spreadsheet features.",
"author": "DreamNum Co., Ltd. <developer@univer.ai>",
"license": "Apache-2.0",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/univer"
},
"homepage": "https://univer.ai",
"repository": {
"type": "git",
"url": "https://github.com/dream-num/univer"
},
"bugs": {
"url": "https://github.com/dream-num/univer/issues"
},
"keywords": [
"univer",
"univer-preset",
"sheets",
"core"
],
"sideEffects": [
"*.css"
],
"exports": {
".": "./src/index.ts",
"./worker": "./src/worker.ts",
"./locales/*": "./src/locales/*.ts",
"./lib/*": "./lib/*"
},
"publishConfig": {
"access": "public",
"main": "./lib/es/index.js",
"module": "./lib/es/index.js",
"exports": {
".": {
"import": "./lib/es/index.js",
"require": "./lib/cjs/index.js",
"types": "./lib/types/index.d.ts"
},
"./worker": {
"import": "./lib/es/worker.js",
"require": "./lib/cjs/worker.js",
"types": "./lib/types/worker.d.ts"
},
"./locales/*": {
"import": "./lib/es/locales/*.js",
"require": "./lib/cjs/locales/*.js",
"types": "./lib/types/locales/*.d.ts"
},
"./lib/*": "./lib/*"
}
},
"main": "./src/index.ts",
"directories": {
"lib": "lib"
},
"types": "./lib/types/index.d.ts",
"files": [
"lib"
],
"scripts": {
"prepare": "univer-cli preset prepare",
"build:bundle": "univer-cli preset build --cleanup",
"build:types": "tsc -p tsconfig.node.json",
"build": "pnpm run build:bundle && pnpm run build:types",
"typecheck": "tsc --noEmit"
},
"peerDependencies": {
"react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
"react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
"rxjs": ">=7.0.0"
},
"dependencies": {
"@univerjs/design": "workspace:*",
"@univerjs/docs": "workspace:*",
"@univerjs/docs-ui": "workspace:*",
"@univerjs/engine-formula": "workspace:*",
"@univerjs/engine-render": "workspace:*",
"@univerjs/network": "workspace:*",
"@univerjs/rpc": "workspace:*",
"@univerjs/sheets": "workspace:*",
"@univerjs/sheets-formula": "workspace:*",
"@univerjs/sheets-formula-ui": "workspace:*",
"@univerjs/sheets-numfmt": "workspace:*",
"@univerjs/sheets-numfmt-ui": "workspace:*",
"@univerjs/sheets-ui": "workspace:*",
"@univerjs/ui": "workspace:*"
},
"devDependencies": {
"@univerjs-infra/shared": "workspace:*",
"@univerjs/core": "workspace:*",
"@univerjs/presets": "workspace:*",
"react": "18.3.1",
"react-dom": "18.3.1",
"rxjs": "^7.8.2",
"typescript": "^6.0.3"
}
}

View File

@@ -0,0 +1,17 @@
/**
* Copyright 2023-present DreamNum Co., Ltd.
*
* 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 { default } from '@univerjs-infra/shared/postcss';

View File

@@ -0,0 +1,31 @@
/**
* Copyright 2023-present DreamNum Co., Ltd.
*
* 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 * from './preset';
export * from '@univerjs/design';
export * from '@univerjs/docs';
export * from '@univerjs/docs-ui';
export * from '@univerjs/engine-formula';
export * from '@univerjs/engine-render';
export * from '@univerjs/network';
export * from '@univerjs/rpc';
export * from '@univerjs/sheets';
export * from '@univerjs/sheets-formula';
export * from '@univerjs/sheets-formula-ui';
export * from '@univerjs/sheets-numfmt';
export * from '@univerjs/sheets-numfmt-ui';
export * from '@univerjs/sheets-ui';
export * from '@univerjs/ui';

View File

@@ -0,0 +1,167 @@
/**
* Copyright 2023-present DreamNum Co., Ltd.
*
* 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.
*/
import type { IPreset } from '@univerjs/presets';
import type { IUniverRPCMainThreadConfig } from '@univerjs/rpc';
import type { IUniverSheetsNumfmtConfig } from '@univerjs/sheets-numfmt';
import type { IUniverSheetsUIConfig } from '@univerjs/sheets-ui';
import type { IUniverUIConfig } from '@univerjs/ui';
import type { IUniverDocsPresetConfig, IUniverFormulaConfig, IUniverSheetsPresetConfig } from './types';
import { UniverDocsPlugin } from '@univerjs/docs';
import { UniverDocsUIPlugin } from '@univerjs/docs-ui';
import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
import { UniverRenderEnginePlugin } from '@univerjs/engine-render';
import { UniverNetworkPlugin } from '@univerjs/network';
import { UniverRPCMainThreadPlugin } from '@univerjs/rpc';
import { UniverSheetsPlugin } from '@univerjs/sheets';
import { UniverSheetsFormulaPlugin } from '@univerjs/sheets-formula';
import { UniverSheetsFormulaUIPlugin } from '@univerjs/sheets-formula-ui';
import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt';
import { UniverSheetsNumfmtUIPlugin } from '@univerjs/sheets-numfmt-ui';
import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';
import { UniverUIPlugin } from '@univerjs/ui';
// NOTE: here we copy code from everything.ts. That file (along with the package itself) would be removed in the future.
import '@univerjs/network/facade';
import '@univerjs/sheets/facade';
import '@univerjs/ui/facade';
import '@univerjs/docs-ui/facade';
import '@univerjs/sheets-ui/facade';
import '@univerjs/engine-formula/facade';
import '@univerjs/sheets-formula/facade';
import '@univerjs/sheets-numfmt/facade';
import '@univerjs/sheets-formula-ui/facade';
export type * from '@univerjs/docs-ui/facade';
export type * from '@univerjs/engine-formula/facade';
export type * from '@univerjs/network/facade';
export type * from '@univerjs/sheets-formula-ui/facade';
export type * from '@univerjs/sheets-formula/facade';
export type * from '@univerjs/sheets-numfmt/facade';
export type * from '@univerjs/sheets-ui/facade';
export type * from '@univerjs/sheets/facade';
export type * from '@univerjs/ui/facade';
export interface IUniverSheetsCorePresetConfig extends
Pick<IUniverUIConfig, 'container' | 'header' | 'toolbar' | 'ribbonType' | 'menu' | 'contextMenu' | 'disableAutoFocus' | 'customFontFamily'>,
Pick<IUniverSheetsUIConfig, 'formulaBar' | 'footer'>,
IUniverSheetsNumfmtConfig {
/**
* The docs related configuration.
*/
docs?: IUniverDocsPresetConfig;
/**
* The sheets related configuration.
*/
sheets?: IUniverSheetsPresetConfig;
/**
* The formula related configuration.
*/
formula?: IUniverFormulaConfig;
/**
* The URL of the worker script.
*/
workerURL: IUniverRPCMainThreadConfig['workerURL'];
}
/**
* This presets helps you to create a Univer sheet with open sourced features.
*/
export function UniverSheetsCorePreset(config: Partial<IUniverSheetsCorePresetConfig> = {}): IPreset {
const {
container = 'app',
workerURL: workerSrc,
header,
footer,
toolbar,
ribbonType,
formulaBar,
menu,
contextMenu,
disableAutoFocus,
customFontFamily,
docs,
sheets,
formula,
disableTextFormatAlert,
disableTextFormatMark,
} = config;
const useWorker = !!workerSrc;
return {
plugins: [
UniverNetworkPlugin,
[UniverDocsPlugin, {
hasScroll: docs?.hasScroll,
}],
UniverRenderEnginePlugin,
[UniverUIPlugin, {
container,
header,
toolbar,
ribbonType,
menu,
contextMenu,
disableAutoFocus,
customFontFamily,
}],
UniverDocsUIPlugin,
useWorker
? [UniverRPCMainThreadPlugin, { workerURL: workerSrc }]
: null,
[UniverFormulaEnginePlugin, {
notExecuteFormula: useWorker,
function: formula?.function,
}],
[UniverSheetsPlugin, {
notExecuteFormula: useWorker,
onlyRegisterFormulaRelatedMutations: false,
isRowStylePrecedeColumnStyle: sheets?.isRowStylePrecedeColumnStyle,
autoHeightForMergedCells: sheets?.autoHeightForMergedCells,
freezeSync: sheets?.freezeSync,
}],
[UniverSheetsUIPlugin, {
formulaBar,
footer,
maxAutoHeightCount: sheets?.maxAutoHeightCount,
clipboardConfig: sheets?.clipboardConfig,
scrollConfig: sheets?.scrollConfig,
protectedRangeShadow: sheets?.protectedRangeShadow ?? true,
protectedRangeUserSelector: sheets?.protectedRangeUserSelector,
disableForceStringAlert: sheets?.disableForceStringAlert,
disableForceStringMark: sheets?.disableForceStringMark,
}],
[UniverSheetsNumfmtPlugin, {
disableTextFormatAlert,
disableTextFormatMark,
}],
UniverSheetsNumfmtUIPlugin,
[UniverSheetsFormulaPlugin, {
notExecuteFormula: useWorker,
description: formula?.description,
initialFormulaComputing: formula?.initialFormulaComputing,
}],
[UniverSheetsFormulaUIPlugin, {
functionScreenTips: formula?.functionScreenTips,
}],
].filter((v) => !!v) as IPreset['plugins'],
};
};

View File

@@ -0,0 +1,41 @@
/**
* Copyright 2023-present DreamNum Co., Ltd.
*
* 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.
*/
import type { IUniverDocsConfig } from '@univerjs/docs';
import type { IUniverEngineFormulaConfig } from '@univerjs/engine-formula';
import type { IUniverSheetsConfig } from '@univerjs/sheets';
import type { IUniverSheetsFormulaBaseConfig } from '@univerjs/sheets-formula';
import type { IUniverSheetsFormulaUIConfig } from '@univerjs/sheets-formula-ui';
import type { IUniverSheetsUIConfig } from '@univerjs/sheets-ui';
export interface IUniverFormulaConfig extends
Pick<IUniverEngineFormulaConfig, 'function'>,
Pick<IUniverSheetsFormulaBaseConfig, 'description' | 'initialFormulaComputing'>,
Pick<IUniverSheetsFormulaUIConfig, 'functionScreenTips'> {
}
export interface IUniverFormulaWorkerConfig extends
Pick<IUniverEngineFormulaConfig, 'function'> {
}
export interface IUniverDocsPresetConfig extends
IUniverDocsConfig {
}
export interface IUniverSheetsPresetConfig extends
Pick<IUniverSheetsConfig, 'isRowStylePrecedeColumnStyle' | 'autoHeightForMergedCells' | 'freezeSync'>,
Pick<IUniverSheetsUIConfig, 'maxAutoHeightCount' | 'clipboardConfig' | 'scrollConfig' | 'protectedRangeShadow' | 'protectedRangeUserSelector' | 'disableForceStringAlert' | 'disableForceStringMark'> {
}

View File

@@ -0,0 +1,43 @@
/**
* Copyright 2023-present DreamNum Co., Ltd.
*
* 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.
*/
import type { IPreset } from '@univerjs/presets';
import type { IUniverFormulaWorkerConfig } from './types';
import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
import { UniverRPCWorkerThreadPlugin } from '@univerjs/rpc';
import { UniverSheetsPlugin } from '@univerjs/sheets';
import { UniverRemoteSheetsFormulaPlugin } from '@univerjs/sheets-formula';
export interface IUniverSheetsCoreWorkerPresetConfig {
/**
* The formula worker config.
*/
formula?: IUniverFormulaWorkerConfig;
}
export function UniverSheetsCoreWorkerPreset(config: Partial<IUniverSheetsCoreWorkerPresetConfig> = {}): IPreset {
const {
formula,
} = config;
return {
plugins: [
[UniverSheetsPlugin, { onlyRegisterFormulaRelatedMutations: true }],
[UniverFormulaEnginePlugin, { function: formula?.function }],
UniverRPCWorkerThreadPlugin,
UniverRemoteSheetsFormulaPlugin,
],
};
}

View File

@@ -0,0 +1,27 @@
/**
* Copyright 2023-present DreamNum Co., Ltd.
*
* 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.
*/
import type { Config } from 'tailwindcss';
import preset, { createTailwindContent } from '@univerjs-infra/shared/tailwind';
const config: Config = {
presets: [preset],
content: createTailwindContent(import.meta.url, {
includeStyleDependencies: true,
}),
};
export default config;

View File

@@ -0,0 +1,8 @@
{
"extends": "@univerjs-infra/shared/tsconfigs/base",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib/types"
},
"include": ["src", "../../common/shared/types/global.d.ts"]
}

View File

@@ -0,0 +1,18 @@
{
"extends": "@univerjs-infra/shared/tsconfigs/node",
"compilerOptions": {
"rootDir": "src",
"declaration": true,
"emitDeclarationOnly": true,
"noEmit": false,
"outDir": "lib/types"
},
"include": [
"src"
],
"exclude": [
"src/**/__tests__/**",
"src/**/*.spec.ts",
"src/**/*.test.ts"
]
}