@univerjs/ui 1.0.0-alpha.8 → 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/index.js +383 -385
- package/lib/es/index.js +386 -388
- package/lib/index.css +1 -8
- package/lib/index.js +386 -388
- package/lib/types/index.d.ts +2 -2
- package/lib/types/services/dom/canvas-dom-layer.service.d.ts +3 -0
- package/lib/types/views/components/context-menu/ContextMenuPanel.d.ts +2 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +15 -15
- package/package.json +8 -8
package/lib/types/index.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export type { IContextMenuHandler } from './services/contextmenu/contextmenu.ser
|
|
|
43
43
|
export { DesktopDialogService } from './services/dialog/desktop-dialog.service';
|
|
44
44
|
export { IDialogService } from './services/dialog/dialog.service';
|
|
45
45
|
export { CanvasFloatDomPreviewService, CanvasFloatDomService } from './services/dom/canvas-dom-layer.service';
|
|
46
|
-
export type { ICanvasFloatDomPreview, ICanvasFloatDomPreviewRequest, IFloatDom, IFloatDomLayout } from './services/dom/canvas-dom-layer.service';
|
|
46
|
+
export type { ICanvasFloatDomPreview, ICanvasFloatDomPreviewRequest, IFloatDom, IFloatDomLayout, } from './services/dom/canvas-dom-layer.service';
|
|
47
47
|
export { FontService, IFontService } from './services/font.service';
|
|
48
48
|
export type { IFontConfig } from './services/font.service';
|
|
49
49
|
export { DesktopGalleryService } from './services/gallery/desktop-gallery.service';
|
|
@@ -74,7 +74,7 @@ export { IUIRuntimeScopeService, UIRuntimeScopeService } from './services/runtim
|
|
|
74
74
|
export type { IUIRuntimeScope } from './services/runtime-scope/ui-runtime-scope.service';
|
|
75
75
|
export { KeyCode, MetaKeys } from './services/shortcut/keycode';
|
|
76
76
|
export { ShortcutPanelService } from './services/shortcut/shortcut-panel.service';
|
|
77
|
-
export { IShortcutService, NativeTextEditorShortcutBehavior, ShortcutService } from './services/shortcut/shortcut.service';
|
|
77
|
+
export { IShortcutService, NativeTextEditorShortcutBehavior, ShortcutService, } from './services/shortcut/shortcut.service';
|
|
78
78
|
export type { IShortcutItem } from './services/shortcut/shortcut.service';
|
|
79
79
|
export { DesktopSidebarService } from './services/sidebar/desktop-sidebar.service';
|
|
80
80
|
export { useSidebarClick } from './services/sidebar/hooks/use-sidebar-click';
|
|
@@ -67,12 +67,15 @@ export declare function shouldForwardFloatDomEvents(layer: Pick<IFloatDom, 'even
|
|
|
67
67
|
export declare function shouldRenderFloatDomLayer(layer: Pick<IFloatDom, 'unitId' | 'preserveOnFocusChange'>, currentUnitId: string | null | undefined): boolean;
|
|
68
68
|
export declare class CanvasFloatDomService extends Disposable {
|
|
69
69
|
private _domLayerMap;
|
|
70
|
+
private _scopedRenderRootCount;
|
|
70
71
|
private _domLayers$;
|
|
71
72
|
domLayers$: Observable<[string, IFloatDom][]>;
|
|
72
73
|
get domLayers(): [string, IFloatDom][];
|
|
73
74
|
private _notice;
|
|
74
75
|
updateFloatDom(id: string, item: Partial<IFloatDom>): void;
|
|
75
76
|
addFloatDom(item: IFloatDom): void;
|
|
77
|
+
hasScopedRenderRoot(unitId: string): boolean;
|
|
78
|
+
registerScopedRenderRoot(unitId: string): import("@wendellhu/redi").IDisposable;
|
|
76
79
|
removeFloatDom(id: string): void;
|
|
77
80
|
removeAll(): void;
|
|
78
81
|
dispose(): void;
|
|
@@ -27,6 +27,7 @@ interface IContextMenuPanelProps {
|
|
|
27
27
|
className?: string;
|
|
28
28
|
activeItemIds?: string[];
|
|
29
29
|
hiddenItemIds?: string[];
|
|
30
|
+
flowQuickGroups?: boolean;
|
|
30
31
|
sizeVariant?: ContextMenuSizeVariant;
|
|
31
32
|
autoFocus?: boolean;
|
|
32
33
|
autoFocusTarget?: ContextMenuAutoFocusTarget;
|
|
@@ -47,6 +48,6 @@ export declare function hasRenderableContextMenuSchema(menuSchema: IMenuSchema):
|
|
|
47
48
|
export declare function shouldShowContextMenuGroupSeparator(visibleSchemas: IMenuSchema[], index: number): boolean;
|
|
48
49
|
export declare function getContextMenuQuickGroupColumns(menuSchema: IMenuSchema): number | undefined;
|
|
49
50
|
export declare function getNextMenuButtonByDirection(buttons: HTMLButtonElement[], activeIndex: number, key: string): HTMLButtonElement;
|
|
50
|
-
export declare function getContextMenuSchemaRenderGroups(visibleSchemas: IMenuSchema[],
|
|
51
|
+
export declare function getContextMenuSchemaRenderGroups(visibleSchemas: IMenuSchema[], flowQuickGroups?: boolean): IContextMenuSchemaRenderGroup[];
|
|
51
52
|
export declare function ContextMenuPanel(props: IContextMenuPanelProps): import("react").JSX.Element | null;
|
|
52
53
|
export {};
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(require("@univerjs/core/facade"),require("@univerjs/engine-render"),require("@univerjs/ui"),require("@univerjs/core")):typeof define==`function`&&define.amd?define([`@univerjs/core/facade`,`@univerjs/engine-render`,`@univerjs/ui`,`@univerjs/core`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverCoreFacade,e.UniverEngineRender,e.UniverUi,e.UniverCore))})(this,function(e,t,n,r){function i(e){"@babel/helpers - typeof";return i=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},i(e)}function a(e,t){if(i(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(i(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function o(e){var t=a(e,`string`);return i(t)==`symbol`?t:t+``}function s(e,t,n){return(t=o(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){return function(n,r){t(n,r,e)}}function l(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var u=class extends e.FBase{appendTo(e){let t=typeof e==`string`?e.split(`|`):e,n=t.length,r={},i=r,a=this.__getSchema();t.forEach((e,t)=>{t===n-1?i[e]=a:i[e]={},i=i[e]}),this._menuManagerService.mergeMenu(r)}};let d=class extends u{constructor(e,t,i,a){super(),this._item=e,this._injector=t,this._commandService=i,this._menuManagerService=a,s(this,`_commandToRegister`,new Map),s(this,`_buildingSchema`,void 0);let o=typeof e.action==`string`?e.action:(0,r.generateRandomId)(12);o!==e.action&&this._commandToRegister.set(o,e.action),this._buildingSchema={menuItemFactory:()=>({id:e.id,type:n.MenuItemType.BUTTON,icon:e.icon,title:e.title,tooltip:e.tooltip,commandId:o})},e.order!==void 0&&(this._buildingSchema.order=e.order)}__getSchema(){return this._commandToRegister.forEach((e,t)=>{this._commandService.hasCommand(t)||this._commandService.registerCommand({id:t,type:r.CommandType.COMMAND,handler:e})}),{[this._item.id]:this._buildingSchema}}};s(d,`RibbonStartGroup`,n.RibbonStartGroup),s(d,`RibbonPosition`,n.RibbonPosition),s(d,`MenuManagerPosition`,n.MenuManagerPosition),d=l([c(1,(0,r.Inject)(r.Injector)),c(2,r.ICommandService),c(3,n.IMenuManagerService)],d);let f=class extends u{constructor(e,t,r){super(),this._item=e,this._injector=t,this._menuManagerService=r,s(this,`_menuByGroups`,[]),s(this,`_submenus`,[]),s(this,`_buildingSchema`,void 0),this._buildingSchema={menuItemFactory:()=>({id:e.id,type:n.MenuItemType.SUBITEMS,icon:e.icon,title:e.title,tooltip:e.tooltip})},e.order!==void 0&&(this._buildingSchema.order=e.order)}addSubmenu(e){return this._submenus.push(e),this}addSeparator(){return this._menuByGroups.push(this._submenus),this._submenus=[],this}__getSchema(){let e={};return this.addSeparator(),this._menuByGroups.forEach((t,n)=>{let r={};t.forEach(e=>{Object.assign(r,e.__getSchema())}),e[`${this._item.id}-group-${n}`]=r}),{[this._item.id]:Object.assign(this._buildingSchema,e)}}};f=l([c(1,(0,r.Inject)(r.Injector)),c(2,n.IMenuManagerService)],f);let p=class extends e.FBase{constructor(e,t,n,r){super(),this._injector=e,this._renderManagerService=t,this._univerInstanceService=n,this._shortcutService=r,s(this,`_forceDisableDisposable`,null)}enableShortcut(){var e;return(e=this._forceDisableDisposable)==null||e.dispose(),this._forceDisableDisposable=null,this}disableShortcut(){return this._forceDisableDisposable
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(require("@univerjs/core/facade"),require("@univerjs/engine-render"),require("@univerjs/ui"),require("@univerjs/core")):typeof define==`function`&&define.amd?define([`@univerjs/core/facade`,`@univerjs/engine-render`,`@univerjs/ui`,`@univerjs/core`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverCoreFacade,e.UniverEngineRender,e.UniverUi,e.UniverCore))})(this,function(e,t,n,r){function i(e){"@babel/helpers - typeof";return i=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},i(e)}function a(e,t){if(i(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(i(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function o(e){var t=a(e,`string`);return i(t)==`symbol`?t:t+``}function s(e,t,n){return(t=o(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){return function(n,r){t(n,r,e)}}function l(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var u=class extends e.FBase{appendTo(e){let t=typeof e==`string`?e.split(`|`):e,n=t.length,r={},i=r,a=this.__getSchema();t.forEach((e,t)=>{t===n-1?i[e]=a:i[e]={},i=i[e]}),this._menuManagerService.mergeMenu(r)}};let d=class extends u{constructor(e,t,i,a){super(),this._item=e,this._injector=t,this._commandService=i,this._menuManagerService=a,s(this,`_commandToRegister`,new Map),s(this,`_buildingSchema`,void 0);let o=typeof e.action==`string`?e.action:(0,r.generateRandomId)(12);o!==e.action&&this._commandToRegister.set(o,e.action),this._buildingSchema={menuItemFactory:()=>({id:e.id,type:n.MenuItemType.BUTTON,icon:e.icon,title:e.title,tooltip:e.tooltip,commandId:o})},e.order!==void 0&&(this._buildingSchema.order=e.order)}__getSchema(){return this._commandToRegister.forEach((e,t)=>{this._commandService.hasCommand(t)||this._commandService.registerCommand({id:t,type:r.CommandType.COMMAND,handler:e})}),{[this._item.id]:this._buildingSchema}}};s(d,`RibbonStartGroup`,n.RibbonStartGroup),s(d,`RibbonPosition`,n.RibbonPosition),s(d,`MenuManagerPosition`,n.MenuManagerPosition),d=l([c(1,(0,r.Inject)(r.Injector)),c(2,r.ICommandService),c(3,n.IMenuManagerService)],d);let f=class extends u{constructor(e,t,r){super(),this._item=e,this._injector=t,this._menuManagerService=r,s(this,`_menuByGroups`,[]),s(this,`_submenus`,[]),s(this,`_buildingSchema`,void 0),this._buildingSchema={menuItemFactory:()=>({id:e.id,type:n.MenuItemType.SUBITEMS,icon:e.icon,title:e.title,tooltip:e.tooltip})},e.order!==void 0&&(this._buildingSchema.order=e.order)}addSubmenu(e){return this._submenus.push(e),this}addSeparator(){return this._menuByGroups.push(this._submenus),this._submenus=[],this}__getSchema(){let e={};return this.addSeparator(),this._menuByGroups.forEach((t,n)=>{let r={};t.forEach(e=>{Object.assign(r,e.__getSchema())}),e[`${this._item.id}-group-${n}`]=r}),{[this._item.id]:Object.assign(this._buildingSchema,e)}}};f=l([c(1,(0,r.Inject)(r.Injector)),c(2,n.IMenuManagerService)],f);let p=class extends e.FBase{constructor(e,t,n,r){super(),this._injector=e,this._renderManagerService=t,this._univerInstanceService=n,this._shortcutService=r,s(this,`_forceDisableDisposable`,null)}enableShortcut(){var e;return(e=this._forceDisableDisposable)==null||e.dispose(),this._forceDisableDisposable=null,this}disableShortcut(){return this._forceDisableDisposable||=this._shortcutService.forceDisable(),this}triggerShortcut(e){let t=this._univerInstanceService.getCurrentUnitOfType(r.UniverInstanceType.UNIVER_SHEET);if(!t)return;let n=this._renderManagerService.getRenderUnitById(t.getUnitId());if(n)return n.engine.getCanvasElement().dispatchEvent(e),this._shortcutService.dispatch(e)}dispatchShortcutEvent(e){return this._shortcutService.dispatch(e)}};p=l([c(0,(0,r.Inject)(r.Injector)),c(1,(0,r.Inject)(t.IRenderManagerService)),c(2,r.IUniverInstanceService),c(3,n.IShortcutService)],p);var m=class extends e.FUniver{getURL(){return new URL(window.location.href)}getShortcut(){return this._injector.createInstance(p)}copy(){return this._commandService.executeCommand(n.CopyCommand.id)}paste(){return this._commandService.executeCommand(n.PasteCommand.id)}createMenu(e){return this._injector.createInstance(d,e)}createSubmenu(e){return this._injector.createInstance(f,e)}openSidebar(e){return this._injector.get(n.ISidebarService).open(e)}openDialog(e){let t=this._injector.get(n.IDialogService).open({...e,onClose:()=>{t.dispose()}});return t}getComponentManager(){return this._injector.get(n.ComponentManager)}showMessage(e){return this._injector.get(n.IMessageService).show(e),this}setUIVisible(e,t){return this._injector.get(n.IUIPartsService).setUIVisible(e,t),this}isUIVisible(e){return this._injector.get(n.IUIPartsService).isUIVisible(e)}registerUIPart(e,t){return this._injector.get(n.IUIPartsService).registerComponent(e,()=>(0,n.connectInjector)(t,this._injector))}registerComponent(e,t,r){let i=this._injector.get(n.ComponentManager);return this.disposeWithMe(i.register(e,t,r))}setCurrent(e){if(!this._injector.get(t.IRenderManagerService).getRenderUnitById(e))throw Error(`Unit not found`);this._univerInstanceService.setCurrentUnitForType(e)}addFonts(e){let t=this._injector.get(n.IFontService);e.forEach(e=>{t.addFont(e)})}};e.FUniver.extend(m);var h=class extends e.FEnum{get BuiltInUIPart(){return n.BuiltInUIPart}get KeyCode(){return n.KeyCode}};e.FEnum.extend(h)});
|