-
-
Notifications
You must be signed in to change notification settings - Fork 665
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mobile): init basic mobile features (#2443)
* feat: init basic mobile features
- Loading branch information
Showing
82 changed files
with
3,291 additions
and
896 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta content="width=device-width, initial-scale=1" name="viewport" /> | ||
<title>Univer Sheets</title> | ||
|
||
<link rel="icon" type="image/x-icon" href="../favicon.svg" /> | ||
<link rel="stylesheet" href="./main.css" /> | ||
<style> | ||
html, | ||
body { | ||
height: 100%; | ||
margin: 0; | ||
} | ||
</style> | ||
|
||
<script> | ||
new EventSource('/esbuild').addEventListener('change', () => { | ||
console.info('reload--'); | ||
location.reload(); | ||
}); | ||
</script> | ||
</head> | ||
|
||
<body style="overflow: hidden"> | ||
<div id="app" style="height: 100%"></div> | ||
|
||
<script src="./main.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
import { LocaleType, LogLevel, Univer, UniverInstanceType, UserManagerService } from '@univerjs/core'; | ||
import { defaultTheme } from '@univerjs/design'; | ||
import { UniverDocsPlugin } from '@univerjs/docs'; | ||
import { UniverDocsUIPlugin } from '@univerjs/docs-ui'; | ||
import { UniverRenderEnginePlugin } from '@univerjs/engine-render'; | ||
import { UniverSheetsPlugin } from '@univerjs/sheets'; | ||
import { UniverSheetsMobileUIPlugin } from '@univerjs/sheets-ui'; | ||
import { UniverMobileUIPlugin } from '@univerjs/ui'; | ||
import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula'; | ||
import type { FUniver } from '@univerjs/facade'; | ||
import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter'; | ||
import { UniverSheetsFilterMobileUIPlugin } from '@univerjs/sheets-filter-ui'; | ||
import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt'; | ||
import type { IUniverRPCMainThreadConfig } from '@univerjs/rpc'; | ||
import { UniverRPCMainThreadPlugin } from '@univerjs/rpc'; | ||
import { UniverSheetsFormulaMobilePlugin } from '@univerjs/sheets-formula'; | ||
import { UniverSheetsDataValidationMobilePlugin } from '@univerjs/sheets-data-validation'; | ||
import { UniverSheetsConditionalFormattingMobileUIPlugin } from '@univerjs/sheets-conditional-formatting-ui'; | ||
import { DEFAULT_WORKBOOK_DATA_DEMO } from '../data/sheets/demo/default-workbook-data-demo'; | ||
import { enUS } from '../locales'; | ||
|
||
// univer | ||
const univer = new Univer({ | ||
theme: defaultTheme, | ||
locale: LocaleType.EN_US, | ||
locales: { | ||
[LocaleType.EN_US]: enUS, | ||
}, | ||
logLevel: LogLevel.VERBOSE, | ||
}); | ||
|
||
univer.registerPlugin(UniverFormulaEnginePlugin); | ||
|
||
// core plugins | ||
univer.registerPlugin(UniverDocsPlugin, { | ||
hasScroll: false, | ||
}); | ||
univer.registerPlugin(UniverRenderEnginePlugin); | ||
univer.registerPlugin(UniverMobileUIPlugin, { container: 'app', contextMenu: true }); | ||
univer.registerPlugin(UniverRPCMainThreadPlugin, { | ||
workerURL: './worker.js', | ||
} as IUniverRPCMainThreadConfig); | ||
|
||
univer.registerPlugin(UniverDocsUIPlugin); | ||
univer.registerPlugin(UniverSheetsPlugin); | ||
|
||
univer.registerPlugin(UniverSheetsMobileUIPlugin); | ||
univer.registerPlugin(UniverSheetsFilterPlugin); | ||
univer.registerPlugin(UniverSheetsFilterMobileUIPlugin); | ||
univer.registerPlugin(UniverSheetsNumfmtPlugin); | ||
univer.registerPlugin(UniverSheetsFormulaMobilePlugin); | ||
univer.registerPlugin(UniverSheetsConditionalFormattingMobileUIPlugin); | ||
univer.registerPlugin(UniverSheetsDataValidationMobilePlugin); | ||
|
||
const mockUser = { | ||
userID: 'Owner_qxVnhPbQ', | ||
name: 'Owner', | ||
avatar: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAInSURBVHgBtZU9TxtBEIbfWRzFSIdkikhBSqRQkJqkCKTCFkqVInSUSaT0wC8w/gXxD4gU2nRJkXQWhAZowDUUWKIwEgWWbEEB3mVmx3dn4DA2nB/ppNuPeWd29mMIPXDr+RxwtgRHeW6+guNPRxogqnL7Dwz9psJ27S4NShaeZTH3kwXy6I81dlRKcmRui88swdq9AcSFL7Buz1Vmlns64MiLsCjzwnIYHLH57tbfFbs7KRaXyEU8FVZofqccOfA5l7Q8LPIkGrwnb2RPNEXWFVMUF3L+kDCk0btDDAMzOm5YfAHDwp4tG74wnzAsiOYMnJ3GoDybA7IT98/jm5+JNnfiIzAS6LlqHQBN/i6b2t/cV1Hh6BfwYlHnHP4AXi5q/8kmMMpOs8+BixZw/Fd6xUEHEbnkgclvQP2fGp7uShRKnQ3G32rkjV1th8JhIGG7tR/JyjGteSOZELwGMmNqIIigRCLRh2OZIE6BjItdd7pCW6Uhm1zzkUtungSxwEUzNpQ+GQumtH1ej1MqgmNT6vwmhCq5yuwq56EYTbgeQUz3yvrpV1b4ok3nYJ+eYhgYmjRUqErx2EDq0Fr8FhG++iqVGqxlUJI/70Ar0UgJaWHj6hYVHJrfKssAHot1JfqwE9WVWzXZVd5z2Ws/4PnmtEjkXeKJDvxUecLbWOXH/DP6QQ4J72NS0adedp1aseBfXP8odlZFfPvBF7SN/8hky1TYuPOAXAEipMx15u5ToAAAAABJRU5ErkJggg==', | ||
anonymous: false, | ||
canBindAnonymous: false, | ||
}; | ||
|
||
const injector = univer.__getInjector(); | ||
const userManagerService = injector.get(UserManagerService); | ||
userManagerService.setCurrentUser(mockUser); | ||
|
||
declare global { | ||
// eslint-disable-next-line ts/naming-convention | ||
interface Window { | ||
univer?: Univer; | ||
univerAPI?: ReturnType<typeof FUniver.newAPI>; | ||
} | ||
} | ||
|
||
univer.createUnit(UniverInstanceType.UNIVER_SHEET, DEFAULT_WORKBOOK_DATA_DEMO); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
import { LocaleType, LogLevel, Univer } from '@univerjs/core'; | ||
import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula'; | ||
import { UniverRPCWorkerThreadPlugin } from '@univerjs/rpc'; | ||
import { UniverSheetsPlugin } from '@univerjs/sheets'; | ||
|
||
// Univer web worker is also a univer application. | ||
const univer = new Univer({ | ||
locale: LocaleType.ZH_CN, | ||
logLevel: LogLevel.VERBOSE, | ||
}); | ||
|
||
univer.registerPlugin(UniverSheetsPlugin, { onlyRegisterFormulaRelatedMutations: true }); | ||
univer.registerPlugin(UniverFormulaEnginePlugin); | ||
univer.registerPlugin(UniverRPCWorkerThreadPlugin); | ||
|
||
declare let self: WorkerGlobalScope & typeof globalThis & { univer: Univer }; | ||
self.univer = univer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.