-
-
Notifications
You must be signed in to change notification settings - Fork 648
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(docs-ui): refactor doc rendering to render unit fix: fix error emitted refactor: refactor zoom controller refactor: refactor back scroll render controller refactor: move doc skeleton manager into render unit refactor: refactor doc drawing refactor: refactor editor related modules fix: fix type error WIP refactor: refactor doc view model test: fix docs test fix: fix import error test: fix facade test fix: fix e2e test chore: change editor unit name chore: update code style fix: fix formula editor cannot be activated fix: fix render blinking fix: fix sheet editor cannot be updated fix: button style (#2541) * fix(sheet): style issue * chore: range modal delete button style chore: update dependencies & limit maximum concurrency for turbo execution (#2543) fix(sheets-ui): fix unhide render controller RENDER_COMMANDS (#2516) fix(sheets): hide rows cols should skip over already hidden ranges (#2517) fix: use @univerjs/ui useObservable (#2456) fix(design): fix popup position (#2510) fix(sheets-drawing-ui): error delete cache when float-dom hide (#2540) feat: everything feels very lag when there is a long range dashrect(cliparea) (#2472) * fix: moving getCell lower * fix: try to draw dashrect in visible area * chore: rm useless * fix: do not use startXY as IRect props to get viewport pos fix(sheets): fix some bugs (#2545) * fix(sheets): fix some bugs * chore: change test * fix: bugfix chore(ci): fix sync:cnpm (#2525) feat: init uni mode ui layout fix: fix scroll problems fix: fix sheet bar tabs feat: add focus style fix: all workbooks need to initialized fix: fix zoom slider chore: clean code fix: fix editor position
- Loading branch information
Showing
59 changed files
with
1,027 additions
and
232 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
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,3 @@ | ||
# Experimental Packages | ||
|
||
Experimental packages in development. These packages are not meant to be published to npm or used in production. |
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,16 @@ | ||
# @univerjs/uniui | ||
|
||
[![npm version](https://img.shields.io/npm/v/@univerjs/uniui)](https://npmjs.org/packages/@univerjs/uniui) | ||
[![license](https://img.shields.io/npm/l/@univerjs/uniui)](https://img.shields.io/npm/l/@univerjs/uniui) | ||
|
||
## Introduction | ||
|
||
> TODO: Introduction | ||
## Usage | ||
|
||
### Installation | ||
|
||
```shell | ||
npm i @univerjs/uniui | ||
``` |
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 @@ | ||
{ | ||
"name": "@univerjs/uniui", | ||
"version": "0.0.1", | ||
"private": true, | ||
"description": "", | ||
"author": "DreamNum <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": [], | ||
"sideEffects": [ | ||
"**/*.css" | ||
], | ||
"exports": { | ||
".": "./src/index.ts", | ||
"./*": "./src/*" | ||
}, | ||
"main": "./lib/cjs/index.js", | ||
"module": "./lib/es/index.js", | ||
"types": "./lib/types/index.d.ts", | ||
"publishConfig": { | ||
"access": "public", | ||
"main": "./lib/cjs/index.js", | ||
"module": "./lib/es/index.js", | ||
"exports": { | ||
".": { | ||
"import": "./lib/es/index.js", | ||
"require": "./lib/cjs/index.js", | ||
"types": "./lib/types/index.d.ts" | ||
}, | ||
"./*": { | ||
"import": "./lib/es/*", | ||
"require": "./lib/cjs/*", | ||
"types": "./lib/types/index.d.ts" | ||
}, | ||
"./lib/*": "./lib/*" | ||
} | ||
}, | ||
"directories": { | ||
"lib": "lib" | ||
}, | ||
"files": [ | ||
"lib" | ||
], | ||
"scripts": { | ||
"test": "vitest run", | ||
"test:watch": "vitest", | ||
"coverage": "vitest run --coverage", | ||
"lint:types": "tsc --noEmit", | ||
"build": "tsc && vite build" | ||
}, | ||
"peerDependencies": { | ||
"@univerjs/core": "workspace:*", | ||
"@univerjs/design": "workspace:*", | ||
"@univerjs/engine-render": "workspace:*", | ||
"@univerjs/ui": "workspace:*", | ||
"@wendellhu/redi": ">=0.12.13", | ||
"clsx": ">=2.0.0", | ||
"react": ">=16.9.0", | ||
"rxjs": ">=7.0.0" | ||
}, | ||
"dependencies": { | ||
"@univerjs/icons": "^0.1.46", | ||
"rc-util": "^5.43.0" | ||
}, | ||
"devDependencies": { | ||
"@univerjs/core": "workspace:*", | ||
"@univerjs/design": "workspace:*", | ||
"@univerjs/engine-render": "workspace:*", | ||
"@univerjs/shared": "workspace:*", | ||
"@univerjs/ui": "workspace:*", | ||
"@wendellhu/redi": "^0.15.2", | ||
"clsx": "^2.1.1", | ||
"less": "^4.2.0", | ||
"react": "18.3.1", | ||
"rxjs": "^7.8.1", | ||
"typescript": "^5.4.5", | ||
"vite": "^5.2.11", | ||
"vitest": "^1.6.0" | ||
} | ||
} |
107 changes: 107 additions & 0 deletions
107
packages-experimental/uniui/src/controllers/uniui-desktop.controller.tsx
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,107 @@ | ||
/** | ||
* 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 { Disposable, LifecycleService, LifecycleStages, toDisposable } from '@univerjs/core'; | ||
import type { IWorkbenchOptions } from '@univerjs/ui'; | ||
import { BuiltInUIPart, CanvasPopup, FloatDom, IUIPartsService } from '@univerjs/ui'; | ||
import type { IDisposable } from '@wendellhu/redi'; | ||
import { Inject, Injector } from '@wendellhu/redi'; | ||
import { connectInjector } from '@wendellhu/redi/react-bindings'; | ||
import React from 'react'; | ||
import { delay, filter, take } from 'rxjs'; | ||
import { render as createRoot, unmount } from 'rc-util/lib/React/render'; | ||
|
||
import { UniWorkbench } from '../views/workbench/UniWorkbench'; | ||
|
||
const STEADY_TIMEOUT = 3000; | ||
|
||
export class UniverUniUIController extends Disposable { | ||
constructor( | ||
@Inject(Injector) private readonly _injector: Injector, | ||
@Inject(LifecycleService) private readonly _lifecycleService: LifecycleService, | ||
@IUIPartsService private readonly _uiPartsService: IUIPartsService | ||
) { | ||
super(); | ||
this._initBuiltinComponents(); | ||
} | ||
|
||
bootstrapWorkbench(options: IWorkbenchOptions): void { | ||
this.disposeWithMe( | ||
bootstrap(this._injector, options, () => { | ||
this._lifecycleService.lifecycle$.pipe( | ||
filter((lifecycle) => lifecycle === LifecycleStages.Ready), | ||
delay(300), | ||
take(1) | ||
).subscribe(() => { | ||
this._lifecycleService.stage = LifecycleStages.Rendered; | ||
setTimeout(() => this._lifecycleService.stage = LifecycleStages.Steady, STEADY_TIMEOUT); | ||
}); | ||
}) | ||
); | ||
} | ||
|
||
private _initBuiltinComponents() { | ||
this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.CONTENT, () => connectInjector(CanvasPopup, this._injector))); | ||
this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.CONTENT, () => connectInjector(FloatDom, this._injector))); | ||
} | ||
} | ||
|
||
function bootstrap( | ||
injector: Injector, | ||
options: IWorkbenchOptions, | ||
callback: () => void | ||
): IDisposable { | ||
let mountContainer: HTMLElement; | ||
|
||
const container = options.container; | ||
if (typeof container === 'string') { | ||
const containerElement = document.getElementById(container); | ||
if (!containerElement) { | ||
mountContainer = createContainer(container); | ||
} else { | ||
mountContainer = containerElement; | ||
} | ||
} else if (container instanceof HTMLElement) { | ||
mountContainer = container; | ||
} else { | ||
mountContainer = createContainer('univer'); | ||
} | ||
|
||
const ConnectedApp = connectInjector(UniWorkbench, injector); | ||
function render() { | ||
createRoot( | ||
<ConnectedApp | ||
{...options} | ||
mountContainer={mountContainer} | ||
onRendered={callback} | ||
/>, | ||
mountContainer | ||
); | ||
} | ||
|
||
render(); | ||
|
||
return toDisposable(() => { | ||
unmount(mountContainer); | ||
}); | ||
} | ||
|
||
function createContainer(id: string): HTMLElement { | ||
const element = document.createElement('div'); | ||
element.id = id; | ||
// FIXME: the element is not append to the DOM tree. So it won't be rendered. | ||
return element; | ||
} |
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.