@univerjs/ui 1.0.0-alpha.7 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +9 -41
- package/lib/cjs/index.js +744 -525
- package/lib/es/facade.js +11 -43
- package/lib/es/index.js +747 -531
- package/lib/facade.js +11 -43
- package/lib/index.css +49 -8
- package/lib/index.js +747 -531
- package/lib/types/facade/f-univer.d.ts +0 -8
- package/lib/types/facade/index.d.ts +0 -2
- package/lib/types/index.d.ts +3 -2
- package/lib/types/services/dom/canvas-dom-layer.service.d.ts +3 -0
- package/lib/types/services/parts/parts.service.d.ts +3 -0
- package/lib/types/services/shortcut/shortcut.service.d.ts +17 -0
- package/lib/types/services/workbench/workbench.service.d.ts +30 -0
- package/lib/types/views/components/context-menu/ContextMenuPanel.d.ts +2 -1
- package/lib/types/views/components/workbench-skeleton/WorkbenchSkeleton.d.ts +22 -0
- package/lib/types/views/emoji-picker/emoji-picker-utils.d.ts +1 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +17 -14
- package/package.json +8 -8
- package/lib/types/facade/f-hooks.d.ts +0 -63
package/lib/es/facade.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { FBase, FEnum,
|
|
1
|
+
import { FBase, FEnum, FUniver } from "@univerjs/core/facade";
|
|
2
2
|
import { IRenderManagerService } from "@univerjs/engine-render";
|
|
3
|
-
import { BuiltInUIPart, ComponentManager, CopyCommand, IDialogService, IFontService, IMenuManagerService, IMessageService, IShortcutService, ISidebarService, IUIPartsService, KeyCode, MenuItemType, MenuManagerPosition, PasteCommand, RibbonPosition, RibbonStartGroup,
|
|
3
|
+
import { BuiltInUIPart, ComponentManager, CopyCommand, IDialogService, IFontService, IMenuManagerService, IMessageService, IShortcutService, ISidebarService, IUIPartsService, KeyCode, MenuItemType, MenuManagerPosition, PasteCommand, RibbonPosition, RibbonStartGroup, connectInjector } from "@univerjs/ui";
|
|
4
4
|
import { CommandType, ICommandService, IUniverInstanceService, Inject, Injector, UniverInstanceType, generateRandomId } from "@univerjs/core";
|
|
5
5
|
|
|
6
|
-
//#region \0@oxc-project+runtime@0.
|
|
6
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
|
|
7
7
|
function _typeof(o) {
|
|
8
8
|
"@babel/helpers - typeof";
|
|
9
9
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -14,7 +14,7 @@ function _typeof(o) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
//#endregion
|
|
17
|
-
//#region \0@oxc-project+runtime@0.
|
|
17
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
|
|
18
18
|
function toPrimitive(t, r) {
|
|
19
19
|
if ("object" != _typeof(t) || !t) return t;
|
|
20
20
|
var e = t[Symbol.toPrimitive];
|
|
@@ -27,14 +27,14 @@ function toPrimitive(t, r) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
//#endregion
|
|
30
|
-
//#region \0@oxc-project+runtime@0.
|
|
30
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
|
|
31
31
|
function toPropertyKey(t) {
|
|
32
32
|
var i = toPrimitive(t, "string");
|
|
33
33
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
//#endregion
|
|
37
|
-
//#region \0@oxc-project+runtime@0.
|
|
37
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
|
|
38
38
|
function _defineProperty(e, r, t) {
|
|
39
39
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
40
40
|
value: t,
|
|
@@ -45,7 +45,7 @@ function _defineProperty(e, r, t) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
//#endregion
|
|
48
|
-
//#region \0@oxc-project+runtime@0.
|
|
48
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
|
|
49
49
|
function __decorateParam(paramIndex, decorator) {
|
|
50
50
|
return function(target, key) {
|
|
51
51
|
decorator(target, key, paramIndex);
|
|
@@ -53,7 +53,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
//#endregion
|
|
56
|
-
//#region \0@oxc-project+runtime@0.
|
|
56
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
|
|
57
57
|
function __decorate(decorators, target, key, desc) {
|
|
58
58
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
59
59
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -337,7 +337,7 @@ let FShortcut = class FShortcut extends FBase {
|
|
|
337
337
|
triggerShortcut(e) {
|
|
338
338
|
const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
339
339
|
if (!workbook) return;
|
|
340
|
-
const renderUnit = this._renderManagerService.
|
|
340
|
+
const renderUnit = this._renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
341
341
|
if (!renderUnit) return;
|
|
342
342
|
renderUnit.engine.getCanvasElement().dispatchEvent(e);
|
|
343
343
|
return this._shortcutService.dispatch(e);
|
|
@@ -393,11 +393,8 @@ var FUniverUIMixin = class extends FUniver {
|
|
|
393
393
|
createSubmenu(submenuItem) {
|
|
394
394
|
return this._injector.createInstance(FSubmenu, submenuItem);
|
|
395
395
|
}
|
|
396
|
-
openSiderbar(params) {
|
|
397
|
-
return this._injector.get(ISidebarService).open(params);
|
|
398
|
-
}
|
|
399
396
|
openSidebar(params) {
|
|
400
|
-
return this.
|
|
397
|
+
return this._injector.get(ISidebarService).open(params);
|
|
401
398
|
}
|
|
402
399
|
openDialog(dialog) {
|
|
403
400
|
const disposable = this._injector.get(IDialogService).open({
|
|
@@ -430,7 +427,7 @@ var FUniverUIMixin = class extends FUniver {
|
|
|
430
427
|
return this.disposeWithMe(componentManager.register(name, component, options));
|
|
431
428
|
}
|
|
432
429
|
setCurrent(unitId) {
|
|
433
|
-
if (!this._injector.get(IRenderManagerService).
|
|
430
|
+
if (!this._injector.get(IRenderManagerService).getRenderUnitById(unitId)) throw new Error("Unit not found");
|
|
434
431
|
this._univerInstanceService.setCurrentUnitForType(unitId);
|
|
435
432
|
}
|
|
436
433
|
addFonts(fonts) {
|
|
@@ -442,35 +439,6 @@ var FUniverUIMixin = class extends FUniver {
|
|
|
442
439
|
};
|
|
443
440
|
FUniver.extend(FUniverUIMixin);
|
|
444
441
|
|
|
445
|
-
//#endregion
|
|
446
|
-
//#region src/facade/f-hooks.ts
|
|
447
|
-
/**
|
|
448
|
-
* @ignore
|
|
449
|
-
*/
|
|
450
|
-
var FHooksSheetsMixin = class extends FHooks {
|
|
451
|
-
onBeforeCopy(callback) {
|
|
452
|
-
return this._injector.get(ICommandService).beforeCommandExecuted((command) => {
|
|
453
|
-
if (command.id === CopyCommand.id) callback();
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
onCopy(callback) {
|
|
457
|
-
return this._injector.get(ICommandService).onCommandExecuted((command) => {
|
|
458
|
-
if (command.id === CopyCommand.id) callback();
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
onBeforePaste(callback) {
|
|
462
|
-
return this._injector.get(ICommandService).beforeCommandExecuted((command) => {
|
|
463
|
-
if (command.id === PasteCommand.id) callback();
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
onPaste(callback) {
|
|
467
|
-
return this._injector.get(ICommandService).onCommandExecuted((command) => {
|
|
468
|
-
if (command.id === PasteCommand.id || command.id === SheetPasteShortKeyCommandName) callback();
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
};
|
|
472
|
-
FHooks.extend(FHooksSheetsMixin);
|
|
473
|
-
|
|
474
442
|
//#endregion
|
|
475
443
|
//#region src/facade/f-enum.ts
|
|
476
444
|
/**
|