@univerjs/ui 0.1.1 → 0.1.3
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/README.md +21 -2
- package/lib/cjs/index.js +29 -12
- package/lib/es/index.js +4039 -6500
- package/lib/index.css +1 -1
- package/lib/types/common/component-manager.d.ts +25 -7
- package/lib/types/components/editor/TextEditor.d.ts +15 -3
- package/lib/types/components/hooks/observable.d.ts +3 -0
- package/lib/types/components/range-selector/RangeSelector.d.ts +32 -0
- package/lib/types/controllers/shared-shortcut.controller.d.ts +5 -4
- package/lib/types/controllers/shortcut-display/shortcut-panel.controller.d.ts +2 -2
- package/lib/types/controllers/ui/ui-desktop.controller.d.ts +2 -2
- package/lib/types/index.d.ts +6 -2
- package/lib/types/locale/zh-CN.d.ts +14 -0
- package/lib/types/services/editor/editor.service.d.ts +77 -18
- package/lib/types/services/range-selector/range-selector.service.d.ts +42 -0
- package/lib/types/services/shortcut/keycode.d.ts +9 -6
- package/lib/types/views/hooks/active.d.ts +24 -0
- package/lib/umd/index.js +29 -12
- package/package.json +20 -17
package/lib/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.univer-ui-plugin-sheets-font-family{overflow:hidden;width:120px;font-size:var(--font-size-xs);text-overflow:ellipsis;white-space:nowrap}.univer-ui-plugin-sheets-font-family-item{font-size:var(--font-size-xs)}.univer-ui-plugin-sheets-font-size{width:28px;height:24px;font-size:var(--font-size-xs)}.univer-ui-plugin-sheets-font-size-input{height:24px;line-height:24px;background-color:transparent;border:none}.univer-ui-plugin-sheets-font-size-input input{font-size:var(--font-size-xs);background-color:transparent}.univer-menu-item-no-hover{background:none}.univer-menu-item-content{display:inline-flex;gap:var(--margin-xs);align-items:center}.univer-menu-item-selectable{position:relative;padding-left:var(--padding-xl)}.univer-menu-item-selectable-icon{position:absolute;left:0;display:inline-flex;align-items:center;font-size:var(--font-size-lg)}.univer-menu-item-more-icon{font-size:var(--font-size-sm);color:rgb(var(--text-color))}.univer-app-layout{display:flex;flex-direction:column;height:100%;background-color:rgb(var(--bg-color))}.univer-app-container{position:relative;display:flex;flex:1;flex-direction:column}.univer-app-container-header{position:relative;z-index:10;width:100%}.univer-app-container-wrapper{display:grid;grid-template-columns:1fr auto;height:100%;overflow:hidden}.univer-app-container-content{position:relative;overflow:hidden;display:grid;grid-template-rows:auto 1fr;flex:1;background-color:rgb(var(--bg-color-secondary));border-bottom:1px solid rgb(var(--border-color))}.univer-app-container-canvas{position:relative}.univer-app-container-sidebar{height:100%}.univer-toolbar-btn{cursor:pointer;display:flex;align-items:center;justify-content:center;min-width:24px;height:24px;padding:0;font-size:var(--font-size-lg);color:rgb(var(--text-color));background-color:transparent;border:none;border-radius:var(--border-radius-base);outline:none}.univer-toolbar-btn:not([disabled]):hover{background-color:rgb(var(--grey-100))}.univer-toolbar-btn[disabled]{cursor:not-allowed;color:rgb(var(--grey-200))}.univer-toolbar-btn-active{background-color:rgb(var(--grey-100))}.univer-headerbar{user-select:none;position:relative}.univer-headerbar>.univer-header-menu{position:absolute;top:0;right:0;display:flex;box-sizing:border-box;height:100%}.univer-headerbar>.univer-header-menu>div{user-select:none;display:inline-flex;align-items:center;height:28px;margin-left:4px;padding:2px 4px;text-align:center;border-radius:4px}.univer-headerbar>.univer-header-menu>div:hover{background-color:rgb(var(--grey-300))}.univer-menubar{display:flex;gap:var(--margin-xs);align-items:center;justify-content:center;height:32px}.univer-menubar-item{cursor:pointer;display:block;padding:var(--padding-xs) var(--padding-sm);font-size:var(--font-size-xs);font-weight:400;border-radius:var(--border-radius-base);transition:all .1s ease-in-out}.univer-menubar-item:hover:not(.univer-menubar-item-active){background:rgb(var(--grey-300))}.univer-menubar-item-active{color:rgb(var(--color-white));background:rgb(var(--primary-color))}.univer-toolbar{user-select:none;position:relative;display:flex;align-items:center;box-sizing:border-box;height:32px;font-size:var(--font-size-base);color:rgb(var(--text-color));background-color:rgb(var(--bg-color-secondary));border-bottom:1px solid rgb(var(--border-color))}.univer-toolbar-container{display:flex;gap:var(--margin-xs);align-items:center;justify-content:center;box-sizing:border-box;height:100%;margin:0 auto}.univer-toolbar-more{max-width:80%}.univer-toolbar-more-container{display:grid;gap:var(--margin-xs) 0;box-sizing:border-box;padding:var(--padding-sm);background-color:rgb(var(--bg-color-secondary));border-radius:var(--border-radius-base);box-shadow:var(--box-shadow-base)}.univer-toolbar-more-container .univer-toolbar-group{flex-wrap:wrap}.univer-toolbar-more-container .univer-toolbar-group:not(:last-child):after{content:initial}.univer-toolbar-group{display:flex;gap:var(--margin-xs);align-items:center}.univer-toolbar-group:not(:last-child,:empty):after{content:"";display:block;width:1px;height:20px;background-color:rgb(var(--border-color))}.univer-toolbar-item-select-button{cursor:pointer;position:relative;overflow:hidden;display:flex;gap:var(--margin-xs);align-items:center;height:24px;padding-right:18px;font-size:var(--font-size-lg);border-radius:var(--border-radius-base)}.univer-toolbar-item-select-button-disabled{cursor:not-allowed;color:rgb(var(--grey-200))}.univer-toolbar-item-select-button:hover,.univer-toolbar-item-select-button:hover .univer-toolbar-item-select-button-label{background-color:rgb(var(--grey-100))}.univer-toolbar-item-select-button-label{position:relative;z-index:1;display:flex;align-items:center;height:100%;padding:0 var(--padding-xs)}.univer-toolbar-item-select-button-label:hover{background-color:rgb(var(--grey-300))!important}.univer-toolbar-item-select-button-arrow{position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:flex-end;box-sizing:border-box;width:100%;height:100%;padding-right:var(--padding-xs);font-size:10px;color:rgb(var(--grey-400))}.univer-toolbar-item-select-button-arrow:hover{background-color:rgb(var(--grey-300))}.univer-toolbar-item-select{cursor:pointer;position:relative;display:flex;gap:var(--margin-xs);align-items:center;height:24px;padding:0 var(--padding-xs);font-size:var(--font-size-lg);border-radius:var(--border-radius-base)}.univer-toolbar-item-select-disabled{cursor:not-allowed;color:rgb(var(--grey-200))}.univer-toolbar-item-select:hover{background-color:rgb(var(--grey-100));border-radius:var(--border-radius-base)}.univer-toolbar-item-select-arrow{display:flex;align-items:center;height:100%;font-size:10px;color:rgb(var(--grey-400))}.univer-toolbar-item-select-arrow-disabled{cursor:not-allowed;color:rgb(var(--grey-200))}.univer-sidebar{position:relative;transform:translate(100%);box-sizing:border-box;width:0;height:100%;color:rgb(var(--text-color));transition:all .15s}.univer-sidebar.univer-sidebar-open{transform:translate(0);width:380px}.univer-sidebar-container{overflow-y:auto;display:grid;grid-template-rows:auto 1fr auto;box-sizing:border-box;width:100%;height:0;min-height:100%;margin:auto;background-color:rgb(var(--bg-color-secondary));border-bottom:1px solid rgb(var(--border-color));border-left:1px solid rgb(var(--border-color))}.univer-sidebar-header{position:sticky;top:0;display:flex;align-items:center;justify-content:space-between;height:44px;padding:var(--padding-xl) var(--padding-xl) 0;font-size:var(--font-size-lg);font-weight:500;background:rgb(var(--bg-color-secondary))}.univer-sidebar-header-close{cursor:pointer;color:rgb(var(--text-color-secondary))}.univer-sidebar-body{padding:0 var(--padding-xl)}.univer-sidebar-footer{position:sticky;bottom:0;padding:var(--padding-xl);background:rgb(var(--bg-color-secondary))}.univer-zen-zone{position:absolute;display:none}.univer-zen-zone-open{z-index:100;top:0;left:0;display:block;width:100%;height:100%;background:rgb(var(--bg-color))}.univer-zen-zone-close{display:none}.univer-notification{position:fixed;z-index:1000;display:flex;flex-direction:column;align-items:flex-end;justify-content:center;box-sizing:border-box;margin:var(--margin-xs) 0}.univer-notification-notice{display:flex;gap:var(--margin-xs);justify-content:space-between;width:280px;padding:var(--padding-lg);font-size:var(--font-size-lg);background-color:rgb(var(--color-white));border-radius:var(--border-radius-base);box-shadow:var(--box-shadow-lg)}.univer-notification-notice-wrapper{margin:var(--margin-xs) var(--margin-base)}.univer-notification-notice-content{display:inline-flex;gap:var(--margin-xs);align-items:center;align-items:flex-start}.univer-notification-notice-close{cursor:pointer;display:flex;align-items:center;justify-content:center;width:fit-content;height:fit-content;padding:var(--padding-xs);color:rgb(var(--text-color-secondary));border-radius:var(--border-radius-base);outline:none;transition:background-color .2s}.univer-notification-notice-close:hover{background-color:rgb(var(--bg-color-hover))}.univer-notification-icon{padding:var(--padding-xs)}.univer-notification-icon-success{color:rgb(var(--success-color))}.univer-notification-icon-info{color:rgb(var(--info-color))}.univer-notification-icon-warning{color:rgb(var(--warning-color))}.univer-notification-icon-error{color:rgb(var(--error-color))}.univer-notification-content-container{display:inline-flex;flex-direction:column;gap:var(--margin-xs);align-items:flex-start;padding-top:var(--padding-xs)}.univer-notification-title{color:rgb(var(--text-color))}.univer-notification-content{color:rgb(var(--text-color-secondary))}.univer-notification-content-ellipsis{overflow:hidden;display:-webkit-box;text-overflow:ellipsis;-webkit-box-orient:vertical}.univer-notification-top,.univer-notification-topLeft,.univer-notification-topRight{top:0}.univer-notification-bottom,.univer-notification-bottomRight,.univer-notification-bottomLeft{bottom:0}.univer-notification-bottomRight,.univer-notification-topRight{right:0}.univer-notification-fade{overflow:hidden;transition:all .3s}.univer-notification-fade-appear-prepare{opacity:0}.univer-notification-fade-appear-start{transform:translate(100%);opacity:0}.univer-notification-fade-appear-active{transform:translate(0);opacity:1}.univer-notification-fade-appear,.univer-notification-fade-enter{opacity:0;animation-play-state:paused;animation-duration:.3s;animation-timing-function:cubic-bezier(.55,0,.55,.2);animation-fill-mode:both}.univer-notification-fade-leave{animation-duration:.3s;animation-timing-function:cubic-bezier(.55,0,.55,.2);animation-fill-mode:both;animation-play-state:paused}.univer-notification-fade-appear.univer-notification-fade-appear-active,.univer-notification-fade-enter.univer-notification-fade-enter-active{animation-name:univer-notification-fade-in;animation-play-state:running}.univer-notification-fade-leave.univer-notification-fade-leave-active{animation-name:univer-notification-fade-out;animation-play-state:running}@keyframes univer-notification-fade-in{0%{opacity:0}to{opacity:1}}@keyframes univer-notification-fade-out{0%{opacity:1}to{opacity:0}}.univer-global-zone{position:absolute;display:none}.univer-global-zone-open{z-index:100;top:0;left:0;display:block;width:100%;height:100%;background:rgb(var(--bg-color))}.univer-global-zone-close{display:none}.univer-shortcut-panel-group-title{height:40px;font-size:13px;font-weight:700;line-height:40px}.univer-shortcut-panel-item{display:flex;justify-content:space-between;height:40px;font-size:13px;line-height:40px}.univer-shortcut-panel-item-title{overflow:hidden;flex-grow:1;flex-shrink:1;max-width:200px;text-overflow:ellipsis;text-wrap:nowrap}.univer-shortcut-panel-item-shortcut{flex-grow:0;flex-shrink:0}.univer-shortcut-panel-item:not(:last-of-type){border-bottom:1px solid rgb(var(--grey-200))}
|
|
1
|
+
.univer-ui-plugin-sheets-font-family{overflow:hidden;width:120px;font-size:var(--font-size-xs);text-overflow:ellipsis;white-space:nowrap}.univer-ui-plugin-sheets-font-family-item{font-size:var(--font-size-xs)}.univer-ui-plugin-sheets-font-size{width:28px;height:24px;font-size:var(--font-size-xs)}.univer-ui-plugin-sheets-font-size-input{height:24px;line-height:24px;background-color:transparent;border:none}.univer-ui-plugin-sheets-font-size-input input{font-size:var(--font-size-xs);background-color:transparent}.univer-menu-item-no-hover{background:none}.univer-menu-item-content{display:inline-flex;gap:var(--margin-xs);align-items:center}.univer-menu-item-selectable{position:relative;padding-left:var(--padding-xl)}.univer-menu-item-selectable-icon{position:absolute;left:0;display:inline-flex;align-items:center;font-size:var(--font-size-lg)}.univer-menu-item-more-icon{font-size:var(--font-size-sm);color:rgb(var(--text-color))}.univer-app-layout{display:flex;flex-direction:column;height:100%;background-color:rgb(var(--bg-color))}.univer-app-container{position:relative;display:flex;flex:1;flex-direction:column}.univer-app-container-header{position:relative;z-index:10;width:100%}.univer-app-container-wrapper{display:grid;grid-template-columns:1fr auto;height:100%;overflow:hidden}.univer-app-container-content{position:relative;overflow:hidden;display:grid;grid-template-rows:auto 1fr;flex:1;background-color:rgb(var(--bg-color-secondary));border-bottom:1px solid rgb(var(--border-color))}.univer-app-container-canvas{position:relative}.univer-app-container-sidebar{height:100%}.univer-toolbar-btn{cursor:pointer;display:flex;align-items:center;justify-content:center;min-width:24px;height:24px;padding:0;font-size:var(--font-size-lg);color:rgb(var(--text-color));background-color:transparent;border:none;border-radius:var(--border-radius-base);outline:none}.univer-toolbar-btn:not([disabled]):hover{background-color:rgb(var(--grey-100))}.univer-toolbar-btn[disabled]{cursor:not-allowed;color:rgb(var(--grey-200))}.univer-toolbar-btn-active{background-color:rgb(var(--grey-100))}.univer-headerbar{user-select:none;position:relative}.univer-headerbar>.univer-header-menu{position:absolute;top:0;right:0;display:flex;box-sizing:border-box;height:100%}.univer-headerbar>.univer-header-menu>div{user-select:none;display:inline-flex;align-items:center;height:28px;margin-left:4px;padding:2px 4px;text-align:center;border-radius:4px}.univer-headerbar>.univer-header-menu>div:hover{background-color:rgb(var(--grey-300))}.univer-menubar{display:flex;gap:var(--margin-xs);align-items:center;justify-content:center;height:32px}.univer-menubar-item{cursor:pointer;display:block;padding:var(--padding-xs) var(--padding-sm);font-size:var(--font-size-xs);font-weight:400;border-radius:var(--border-radius-base);transition:all .1s ease-in-out}.univer-menubar-item:hover:not(.univer-menubar-item-active){background:rgb(var(--grey-300))}.univer-menubar-item-active{color:rgb(var(--color-white));background:rgb(var(--primary-color))}.univer-toolbar{user-select:none;position:relative;display:flex;align-items:center;box-sizing:border-box;height:32px;font-size:var(--font-size-base);color:rgb(var(--text-color));background-color:rgb(var(--bg-color-secondary));border-bottom:1px solid rgb(var(--border-color))}.univer-toolbar-container{display:flex;gap:var(--margin-xs);align-items:center;justify-content:center;box-sizing:border-box;height:100%;margin:0 auto}.univer-toolbar-more{max-width:80%}.univer-toolbar-more-container{display:grid;gap:var(--margin-xs) 0;box-sizing:border-box;padding:var(--padding-sm);background-color:rgb(var(--bg-color-secondary));border-radius:var(--border-radius-base);box-shadow:var(--box-shadow-base)}.univer-toolbar-more-container .univer-toolbar-group{flex-wrap:wrap}.univer-toolbar-more-container .univer-toolbar-group:not(:last-child):after{content:initial}.univer-toolbar-group{display:flex;gap:var(--margin-xs);align-items:center}.univer-toolbar-group:not(:last-child,:empty):after{content:"";display:block;width:1px;height:20px;background-color:rgb(var(--border-color))}.univer-toolbar-item-select-button{cursor:pointer;position:relative;overflow:hidden;display:flex;gap:var(--margin-xs);align-items:center;height:24px;padding-right:18px;font-size:var(--font-size-lg);border-radius:var(--border-radius-base)}.univer-toolbar-item-select-button-disabled{cursor:not-allowed;color:rgb(var(--grey-200))}.univer-toolbar-item-select-button:hover,.univer-toolbar-item-select-button:hover .univer-toolbar-item-select-button-label{background-color:rgb(var(--grey-100))}.univer-toolbar-item-select-button-label{position:relative;z-index:1;display:flex;align-items:center;height:100%;padding:0 var(--padding-xs)}.univer-toolbar-item-select-button-label:hover{background-color:rgb(var(--grey-300))!important}.univer-toolbar-item-select-button-arrow{position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:flex-end;box-sizing:border-box;width:100%;height:100%;padding-right:var(--padding-xs);font-size:10px;color:rgb(var(--grey-400))}.univer-toolbar-item-select-button-arrow:hover{background-color:rgb(var(--grey-300))}.univer-toolbar-item-select{cursor:pointer;position:relative;display:flex;gap:var(--margin-xs);align-items:center;height:24px;padding:0 var(--padding-xs);font-size:var(--font-size-lg);border-radius:var(--border-radius-base)}.univer-toolbar-item-select-disabled{cursor:not-allowed;color:rgb(var(--grey-200))}.univer-toolbar-item-select:hover{background-color:rgb(var(--grey-100));border-radius:var(--border-radius-base)}.univer-toolbar-item-select-arrow{display:flex;align-items:center;height:100%;font-size:10px;color:rgb(var(--grey-400))}.univer-toolbar-item-select-arrow-disabled{cursor:not-allowed;color:rgb(var(--grey-200))}.univer-sidebar{position:relative;transform:translate(100%);box-sizing:border-box;width:0;height:100%;color:rgb(var(--text-color));transition:all .15s}.univer-sidebar.univer-sidebar-open{transform:translate(0);width:380px}.univer-sidebar-container{overflow-y:auto;display:grid;grid-template-rows:auto 1fr auto;box-sizing:border-box;width:100%;height:0;min-height:100%;margin:auto;background-color:rgb(var(--bg-color-secondary));border-bottom:1px solid rgb(var(--border-color));border-left:1px solid rgb(var(--border-color))}.univer-sidebar-header{position:sticky;top:0;display:flex;align-items:center;justify-content:space-between;height:44px;padding:var(--padding-xl) var(--padding-xl) 0;font-size:var(--font-size-lg);font-weight:500;background:rgb(var(--bg-color-secondary))}.univer-sidebar-header-close{cursor:pointer;color:rgb(var(--text-color-secondary))}.univer-sidebar-body{padding:0 var(--padding-xl)}.univer-sidebar-footer{position:sticky;bottom:0;padding:var(--padding-xl);background:rgb(var(--bg-color-secondary))}.univer-zen-zone{position:absolute;display:none}.univer-zen-zone-open{z-index:100;top:0;left:0;display:block;width:100%;height:100%;background:rgb(var(--bg-color))}.univer-zen-zone-close{display:none}.univer-notification{position:fixed;z-index:1000;display:flex;flex-direction:column;align-items:flex-end;justify-content:center;box-sizing:border-box;margin:var(--margin-xs) 0}.univer-notification-notice{display:flex;gap:var(--margin-xs);justify-content:space-between;width:280px;padding:var(--padding-lg);font-size:var(--font-size-lg);background-color:rgb(var(--color-white));border-radius:var(--border-radius-base);box-shadow:var(--box-shadow-lg)}.univer-notification-notice-wrapper{margin:var(--margin-xs) var(--margin-base)}.univer-notification-notice-content{display:inline-flex;gap:var(--margin-xs);align-items:center;align-items:flex-start}.univer-notification-notice-close{cursor:pointer;display:flex;align-items:center;justify-content:center;width:fit-content;height:fit-content;padding:var(--padding-xs);color:rgb(var(--text-color-secondary));border-radius:var(--border-radius-base);outline:none;transition:background-color .2s}.univer-notification-notice-close:hover{background-color:rgb(var(--bg-color-hover))}.univer-notification-icon{padding:var(--padding-xs)}.univer-notification-icon-success{color:rgb(var(--success-color))}.univer-notification-icon-info{color:rgb(var(--info-color))}.univer-notification-icon-warning{color:rgb(var(--warning-color))}.univer-notification-icon-error{color:rgb(var(--error-color))}.univer-notification-content-container{display:inline-flex;flex-direction:column;gap:var(--margin-xs);align-items:flex-start;padding-top:var(--padding-xs)}.univer-notification-title{color:rgb(var(--text-color))}.univer-notification-content{color:rgb(var(--text-color-secondary))}.univer-notification-content-ellipsis{overflow:hidden;display:-webkit-box;text-overflow:ellipsis;-webkit-box-orient:vertical}.univer-notification-top,.univer-notification-topLeft,.univer-notification-topRight{top:0}.univer-notification-bottom,.univer-notification-bottomRight,.univer-notification-bottomLeft{bottom:0}.univer-notification-bottomRight,.univer-notification-topRight{right:0}.univer-notification-fade{overflow:hidden;transition:all .3s}.univer-notification-fade-appear-prepare{opacity:0}.univer-notification-fade-appear-start{transform:translate(100%);opacity:0}.univer-notification-fade-appear-active{transform:translate(0);opacity:1}.univer-notification-fade-appear,.univer-notification-fade-enter{opacity:0;animation-play-state:paused;animation-duration:.3s;animation-timing-function:cubic-bezier(.55,0,.55,.2);animation-fill-mode:both}.univer-notification-fade-leave{animation-duration:.3s;animation-timing-function:cubic-bezier(.55,0,.55,.2);animation-fill-mode:both;animation-play-state:paused}.univer-notification-fade-appear.univer-notification-fade-appear-active,.univer-notification-fade-enter.univer-notification-fade-enter-active{animation-name:univer-notification-fade-in;animation-play-state:running}.univer-notification-fade-leave.univer-notification-fade-leave-active{animation-name:univer-notification-fade-out;animation-play-state:running}@keyframes univer-notification-fade-in{0%{opacity:0}to{opacity:1}}@keyframes univer-notification-fade-out{0%{opacity:1}to{opacity:0}}.univer-global-zone{position:absolute;display:none}.univer-global-zone-open{z-index:100;top:0;left:0;display:block;width:100%;height:100%;background:rgb(var(--bg-color))}.univer-global-zone-close{display:none}.univer-shortcut-panel-group-title{height:40px;font-size:13px;font-weight:700;line-height:40px}.univer-shortcut-panel-item{display:flex;justify-content:space-between;height:40px;font-size:13px;line-height:40px}.univer-shortcut-panel-item-title{overflow:hidden;flex-grow:1;flex-shrink:1;max-width:200px;text-overflow:ellipsis;text-wrap:nowrap}.univer-shortcut-panel-item-shortcut{flex-grow:0;flex-shrink:0}.univer-shortcut-panel-item:not(:last-of-type){border-bottom:1px solid rgb(var(--grey-200))}.univer-text-editor-container{position:relative;width:100%;height:30px;user-select:none;border:1px solid rgb(var(--border-color));transition:all .15s;border-radius:var(--border-radius-base)}.univer-text-editor-container:hover,.univer-text-editor-container:active,.univer-text-editor-container-active,.univer-text-editor-container-active:hover{border:1px solid rgb(var(--hyacinth-500))}.univer-text-editor-container-error,.univer-text-editor-container-error:hover{border:1px solid rgb(var(--red-400))}.univer-text-editor-container-disabled,.univer-text-editor-container-disabled:hover{border-color:rgb(var(--grey-100))}.univer-text-editor-container-placeholder{position:absolute;top:49%;left:5px;transform:translateY(-50%);color:rgb(var(--grey-400));font-size:var(--font-size-xs);pointer-events:none}.univer-text-editor-validation-error{font-size:10px;color:rgb(var(--red-400))}.univer-range-selector{overflow:hidden;display:flex;align-items:center;justify-content:space-between;color:rgb(var(--grey-600));border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-base);width:220px;height:32px}.univer-range-selector-editor{position:relative;user-select:none;width:100%;height:100%;border:0;outline:0}.univer-range-selector-icon{cursor:pointer;display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;margin-right:4px;font-size:var(--font-size-lg);color:rgb(var(--text-color));background-color:transparent;border:none;border-radius:var(--border-radius-base);outline:none}.univer-range-selector-icon:not([disabled]):hover{background-color:rgb(var(--grey-100))}.univer-range-selector-icon[disabled]{cursor:not-allowed;color:rgb(var(--grey-200))}.univer-range-selector:hover,.univer-range-selector-active{border-color:rgb(var(--hyacinth-500))}.univer-range-selector-active .univer-range-selector-icon{color:rgb(var(--hyacinth-500))}.univer-range-selector-error{border-color:rgb(var(--red-400))}.univer-range-selector-error .univer-range-selector-icon{color:rgb(var(--red-400))}.univer-range-selector-error:hover{border-color:rgb(var(--red-400))}.univer-range-selector-disabled{border-color:rgb(var(--grey-100))}.univer-range-selector-disabled .univer-range-selector-icon{color:rgb(var(--grey-100))}.univer-range-selector-disabled:hover{border-color:rgb(var(--grey-100))}.univer-range-selector-modal{position:relative;max-height:500px;overflow:hidden;overflow-y:auto}.univer-range-selector-modal-container{display:flex;flex-direction:row;align-items:center;margin-bottom:10px}.univer-range-selector-modal-container-input{display:inline-block;width:280px}.univer-range-selector-modal-container-input-active{border-color:rgb(var(--hyacinth-500))}.univer-range-selector-modal-container-button{display:inline-block;text-align:center;width:28px}.univer-range-selector-modal-container-button:hover{cursor:pointer;color:rgb(var(--hyacinth-500))}.univer-range-selector-modal-add{position:relative;width:300px;margin-top:5px;text-align:left;color:rgb(var(--hyacinth-500));font-size:var(--font-size-xs)}.univer-range-selector-modal-add-button{display:flex;align-items:center;justify-content:center}.univer-range-selector-modal-add-button:hover{cursor:pointer;background-color:rgb(var(--hyacinth-500),.05)}
|
|
@@ -13,17 +13,35 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
/// <reference types="react" />
|
|
17
16
|
import type { IDisposable } from '@wendellhu/redi';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
import type { defineComponent } from 'vue';
|
|
18
|
+
import type React from 'react';
|
|
19
|
+
type ComponentFramework = 'vue3' | 'react';
|
|
20
|
+
interface IComponentOptions {
|
|
21
|
+
framework?: ComponentFramework;
|
|
21
22
|
}
|
|
22
|
-
export
|
|
23
|
+
export interface IVue3Component {
|
|
24
|
+
framework: 'vue3';
|
|
25
|
+
component: ReturnType<typeof defineComponent>;
|
|
26
|
+
}
|
|
27
|
+
export interface IReactComponent {
|
|
28
|
+
framework: 'react';
|
|
29
|
+
component: React.ForwardRefExoticComponent<any>;
|
|
30
|
+
}
|
|
31
|
+
export type ComponentType = React.ForwardRefExoticComponent<any> | ReturnType<typeof defineComponent>;
|
|
32
|
+
export type ComponentList = Map<string, IVue3Component | IReactComponent>;
|
|
23
33
|
export declare class ComponentManager {
|
|
24
34
|
private _components;
|
|
25
35
|
constructor();
|
|
26
|
-
register(name: string, component:
|
|
27
|
-
get(name: string):
|
|
36
|
+
register(name: string, component: ComponentType, options?: IComponentOptions): IDisposable;
|
|
37
|
+
get(name: string): React.ForwardRefExoticComponent<any> | ((props: any) => React.FunctionComponentElement<{
|
|
38
|
+
component: any;
|
|
39
|
+
props: Record<string, any>;
|
|
40
|
+
}>) | undefined;
|
|
28
41
|
delete(name: string): void;
|
|
29
42
|
}
|
|
43
|
+
export declare function VueComponentWrapper(options: {
|
|
44
|
+
component: ReturnType<typeof defineComponent>;
|
|
45
|
+
props: Record<string, any>;
|
|
46
|
+
}): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
47
|
+
export {};
|
|
@@ -13,23 +13,35 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type
|
|
16
|
+
import { type IDocumentData, type Nullable } from '@univerjs/core';
|
|
17
17
|
import React from 'react';
|
|
18
18
|
import type { IEditorCanvasStyle } from '../../services/editor/editor.service';
|
|
19
19
|
type MyComponentProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
20
20
|
export interface ITextEditorProps {
|
|
21
21
|
id: string;
|
|
22
|
+
className?: string;
|
|
22
23
|
snapshot?: IDocumentData;
|
|
23
24
|
resizeCallBack?: (editor: Nullable<HTMLDivElement>) => void;
|
|
24
25
|
cancelDefaultResizeListener?: boolean;
|
|
25
26
|
isSheetEditor?: boolean;
|
|
26
27
|
canvasStyle?: IEditorCanvasStyle;
|
|
27
28
|
value?: string;
|
|
29
|
+
isSingle?: boolean;
|
|
30
|
+
isReadonly?: boolean;
|
|
31
|
+
onlyInputFormula?: boolean;
|
|
32
|
+
onlyInputRange?: boolean;
|
|
33
|
+
onlyInputContent?: boolean;
|
|
34
|
+
isSingleChoice?: boolean;
|
|
35
|
+
openForSheetUnitId?: Nullable<string>;
|
|
36
|
+
openForSheetSubUnitId?: Nullable<string>;
|
|
37
|
+
onChange?: (value: Nullable<string>) => void;
|
|
38
|
+
onActive?: (state: boolean) => void;
|
|
39
|
+
onValid?: (state: boolean) => void;
|
|
40
|
+
placeholder?: string;
|
|
28
41
|
}
|
|
29
42
|
/**
|
|
30
43
|
* The component to render toolbar item label and menu item label.
|
|
31
44
|
* @param props
|
|
32
|
-
* @returns
|
|
33
45
|
*/
|
|
34
|
-
export declare function TextEditor(props: ITextEditorProps & MyComponentProps): JSX.Element | null;
|
|
46
|
+
export declare function TextEditor(props: ITextEditorProps & Omit<MyComponentProps, 'onChange' | 'onActive'>): JSX.Element | null;
|
|
35
47
|
export {};
|
|
@@ -14,5 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { Observable } from 'rxjs';
|
|
17
|
+
type ObservableOrFn<T> = Observable<T> | (() => Observable<T>);
|
|
17
18
|
export declare function useObservable<T>(observable: Observable<T>, defaultValue?: T): T | undefined;
|
|
18
19
|
export declare function useObservable<T>(observable: Observable<T>, defaultValue?: T, shouldHaveSyncValue?: true): T;
|
|
20
|
+
export declare function useObservable<T>(observable: ObservableOrFn<T>, defaultValue?: T, shouldHaveSyncValue?: false, deps?: any[]): T | undefined;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IUnitRange, Nullable } from '@univerjs/core';
|
|
17
|
+
import React from 'react';
|
|
18
|
+
export interface IRangeSelectorProps {
|
|
19
|
+
id: string;
|
|
20
|
+
value?: string;
|
|
21
|
+
onChange?: (ranges: IUnitRange[]) => void;
|
|
22
|
+
onActive?: (state: boolean) => void;
|
|
23
|
+
onValid?: (state: boolean) => void;
|
|
24
|
+
isSingleChoice?: boolean;
|
|
25
|
+
isReadonly?: boolean;
|
|
26
|
+
openForSheetUnitId?: Nullable<string>;
|
|
27
|
+
openForSheetSubUnitId?: Nullable<string>;
|
|
28
|
+
width?: number;
|
|
29
|
+
size?: 'mini' | 'small' | 'middle' | 'large';
|
|
30
|
+
placeholder?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare function RangeSelector(props: IRangeSelectorProps): React.JSX.Element;
|
|
@@ -18,10 +18,12 @@ import { Injector } from '@wendellhu/redi';
|
|
|
18
18
|
import { IMenuService } from '../services/menu/menu.service';
|
|
19
19
|
import type { IShortcutItem } from '../services/shortcut/shortcut.service';
|
|
20
20
|
import { IShortcutService } from '../services/shortcut/shortcut.service';
|
|
21
|
-
import { IClipboardInterfaceService } from '../services/clipboard/clipboard-interface.service';
|
|
22
21
|
export declare const CopyShortcutItem: IShortcutItem;
|
|
23
22
|
export declare const CutShortcutItem: IShortcutItem;
|
|
24
|
-
|
|
23
|
+
/**
|
|
24
|
+
* This shortcut item is just for displaying shortcut info, do not use it.
|
|
25
|
+
*/
|
|
26
|
+
export declare const OnlyDisplayPasteShortcutItem: IShortcutItem;
|
|
25
27
|
export declare const UndoShortcutItem: IShortcutItem;
|
|
26
28
|
export declare const RedoShortcutItem: IShortcutItem;
|
|
27
29
|
/**
|
|
@@ -32,8 +34,7 @@ export declare class SharedController extends Disposable {
|
|
|
32
34
|
private readonly _menuService;
|
|
33
35
|
private readonly _shortcutService;
|
|
34
36
|
private readonly _commandService;
|
|
35
|
-
|
|
36
|
-
constructor(_injector: Injector, _menuService: IMenuService, _shortcutService: IShortcutService, _commandService: ICommandService, _interfaceService: IClipboardInterfaceService);
|
|
37
|
+
constructor(_injector: Injector, _menuService: IMenuService, _shortcutService: IShortcutService, _commandService: ICommandService);
|
|
37
38
|
initialize(): void;
|
|
38
39
|
private _registerMenus;
|
|
39
40
|
private _registerCommands;
|
|
@@ -17,10 +17,10 @@ import { Disposable, ICommandService } from '@univerjs/core';
|
|
|
17
17
|
import { Injector } from '@wendellhu/redi';
|
|
18
18
|
import { ComponentManager } from '../../common/component-manager';
|
|
19
19
|
import { IMenuService } from '../../services/menu/menu.service';
|
|
20
|
+
import { IShortcutService } from '../../services/shortcut/shortcut.service';
|
|
20
21
|
/**
|
|
21
22
|
* This controller add a side panel to the application to display the shortcuts.
|
|
22
23
|
*/
|
|
23
24
|
export declare class ShortcutPanelController extends Disposable {
|
|
24
|
-
|
|
25
|
-
constructor(_injector: Injector, menuService: IMenuService, commandService: ICommandService, componentManager: ComponentManager);
|
|
25
|
+
constructor(injector: Injector, componentManager: ComponentManager, shortcutService: IShortcutService, menuService: IMenuService, commandService: ICommandService);
|
|
26
26
|
}
|
|
@@ -47,14 +47,14 @@ export declare class DesktopUIController extends Disposable implements IDesktopU
|
|
|
47
47
|
private readonly _injector;
|
|
48
48
|
private readonly _lifecycleService;
|
|
49
49
|
private readonly _renderManagerService;
|
|
50
|
-
private readonly _layoutService
|
|
50
|
+
private readonly _layoutService?;
|
|
51
51
|
private _headerComponents;
|
|
52
52
|
private _headerMenuComponents;
|
|
53
53
|
private _contentComponents;
|
|
54
54
|
private _footerComponents;
|
|
55
55
|
private _componentRegistered$;
|
|
56
56
|
componentRegistered$: Observable<void>;
|
|
57
|
-
constructor(_injector: Injector, _lifecycleService: LifecycleService, _renderManagerService: IRenderManagerService, _layoutService
|
|
57
|
+
constructor(_injector: Injector, _lifecycleService: LifecycleService, _renderManagerService: IRenderManagerService, _layoutService?: ILayoutService | undefined);
|
|
58
58
|
bootstrapWorkbench(options: IWorkbenchOptions): void;
|
|
59
59
|
private _initializeEngine;
|
|
60
60
|
registerComponent(part: DesktopUIPart, component: () => React.ComponentType): IDisposable;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export { getMenuHiddenObservable } from './common/menu-hidden-observable';
|
|
|
18
18
|
export * from './components';
|
|
19
19
|
export { t } from './components/hooks/locale';
|
|
20
20
|
export { useObservable } from './components/hooks/observable';
|
|
21
|
-
export { CopyShortcutItem, CutShortcutItem,
|
|
21
|
+
export { CopyShortcutItem, CutShortcutItem, RedoShortcutItem, SharedController, UndoShortcutItem, } from './controllers/shared-shortcut.controller';
|
|
22
22
|
export { IUIController } from './controllers/ui/ui.controller';
|
|
23
23
|
export { DesktopUIPart, type IDesktopUIController } from './controllers/ui/ui-desktop.controller';
|
|
24
24
|
export { enUS, zhCN } from './locale';
|
|
@@ -30,7 +30,7 @@ export { DesktopConfirmService } from './services/confirm/desktop-confirm.servic
|
|
|
30
30
|
export { DesktopContextMenuService, type IContextMenuHandler, IContextMenuService, } from './services/contextmenu/contextmenu.service';
|
|
31
31
|
export { DesktopDialogService } from './services/dialog/desktop-dialog.service';
|
|
32
32
|
export { IDialogService } from './services/dialog/dialog.service';
|
|
33
|
-
export { ILayoutService } from './services/layout/layout.service';
|
|
33
|
+
export { ILayoutService, DesktopLayoutService } from './services/layout/layout.service';
|
|
34
34
|
export { type ICustomComponentProps, type IDisplayMenuItem, type IMenuButtonItem, type IMenuItem, type IMenuItemFactory, type IMenuSelectorItem, type IValueOption, MenuGroup, MenuItemType, MenuPosition, } from './services/menu/menu';
|
|
35
35
|
export { DesktopMenuService, IMenuService } from './services/menu/menu.service';
|
|
36
36
|
export { DesktopMessageService } from './services/message/desktop-message.service';
|
|
@@ -51,3 +51,7 @@ export { type IConfirmPartMethodOptions } from './views/components/confirm-part/
|
|
|
51
51
|
export { IEditorService, EditorService } from './services/editor/editor.service';
|
|
52
52
|
export { TextEditor } from './components/editor/TextEditor';
|
|
53
53
|
export { SetEditorResizeOperation } from './commands/operations/editor/set-editor-resize.operation';
|
|
54
|
+
export { RangeSelector } from './components/range-selector/RangeSelector';
|
|
55
|
+
export { IRangeSelectorService } from './services/range-selector/range-selector.service';
|
|
56
|
+
export { DesktopLocalStorageService } from './services/local-storage/local-storage.service';
|
|
57
|
+
export { useActiveWorkbook, useActiveWorksheet } from './views/hooks/active';
|
|
@@ -49,6 +49,7 @@ declare const locale: {
|
|
|
49
49
|
cut: string;
|
|
50
50
|
copy: string;
|
|
51
51
|
paste: string;
|
|
52
|
+
'shortcut-panel': string;
|
|
52
53
|
};
|
|
53
54
|
'common-edit': string;
|
|
54
55
|
'toggle-shortcut-panel': string;
|
|
@@ -58,5 +59,18 @@ declare const locale: {
|
|
|
58
59
|
content: string;
|
|
59
60
|
};
|
|
60
61
|
};
|
|
62
|
+
textEditor: {
|
|
63
|
+
formulaError: string;
|
|
64
|
+
rangeError: string;
|
|
65
|
+
};
|
|
66
|
+
rangeSelector: {
|
|
67
|
+
title: string;
|
|
68
|
+
addAnotherRange: string;
|
|
69
|
+
buttonTooltip: string;
|
|
70
|
+
placeHolder: string;
|
|
71
|
+
confirm: string;
|
|
72
|
+
cancel: string;
|
|
73
|
+
};
|
|
74
|
+
'global-shortcut': string;
|
|
61
75
|
};
|
|
62
76
|
export default locale;
|
|
@@ -14,11 +14,12 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { DocumentDataModel, IDocumentBody, IDocumentData, IPosition, Nullable } from '@univerjs/core';
|
|
17
|
-
import { Disposable, IUniverInstanceService } from '@univerjs/core';
|
|
17
|
+
import { Disposable, IContextService, IUniverInstanceService } from '@univerjs/core';
|
|
18
18
|
import type { IDisposable } from '@wendellhu/redi';
|
|
19
19
|
import type { Observable } from 'rxjs';
|
|
20
20
|
import type { IRender, ISuccinctTextRangeParam } from '@univerjs/engine-render';
|
|
21
21
|
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
22
|
+
import { LexerTreeBuilder } from '@univerjs/engine-formula';
|
|
22
23
|
export interface IEditorStateParam extends Partial<IPosition> {
|
|
23
24
|
visible?: boolean;
|
|
24
25
|
}
|
|
@@ -30,8 +31,15 @@ export interface IEditorConfigParam {
|
|
|
30
31
|
initialSnapshot?: IDocumentData;
|
|
31
32
|
cancelDefaultResizeListener?: boolean;
|
|
32
33
|
canvasStyle?: IEditorCanvasStyle;
|
|
33
|
-
isSingle?: boolean;
|
|
34
34
|
isSheetEditor: boolean;
|
|
35
|
+
isSingle: boolean;
|
|
36
|
+
isReadonly: boolean;
|
|
37
|
+
onlyInputFormula: boolean;
|
|
38
|
+
onlyInputRange: boolean;
|
|
39
|
+
onlyInputContent: boolean;
|
|
40
|
+
isSingleChoice: boolean;
|
|
41
|
+
openForSheetUnitId: Nullable<string>;
|
|
42
|
+
openForSheetSubUnitId: Nullable<string>;
|
|
35
43
|
}
|
|
36
44
|
export interface IEditorSetParam extends IEditorConfigParam, IEditorStateParam {
|
|
37
45
|
render: IRender;
|
|
@@ -46,42 +54,65 @@ export interface IEditorInputFormulaParam {
|
|
|
46
54
|
editorUnitId: string;
|
|
47
55
|
formulaString: string;
|
|
48
56
|
}
|
|
49
|
-
declare class Editor {
|
|
57
|
+
export declare class Editor {
|
|
50
58
|
private _param;
|
|
59
|
+
private _focus;
|
|
60
|
+
private _valueLegality;
|
|
61
|
+
private _openForSheetUnitId;
|
|
62
|
+
private _openForSheetSubUnitId;
|
|
51
63
|
constructor(_param: IEditorSetParam);
|
|
52
64
|
get documentDataModel(): DocumentDataModel;
|
|
53
65
|
get editorUnitId(): string;
|
|
54
66
|
get cancelDefaultResizeListener(): boolean | undefined;
|
|
55
67
|
get render(): IRender;
|
|
56
|
-
|
|
68
|
+
isSingleChoice(): boolean;
|
|
69
|
+
setOpenForSheetUnitId(unitId: Nullable<string>): void;
|
|
70
|
+
getOpenForSheetUnitId(): Nullable<string>;
|
|
71
|
+
setOpenForSheetSubUnitId(subUnitId: Nullable<string>): void;
|
|
72
|
+
getOpenForSheetSubUnitId(): Nullable<string>;
|
|
73
|
+
isValueLegality(): boolean;
|
|
74
|
+
setValueLegality(state?: boolean): void;
|
|
75
|
+
isFocus(): boolean;
|
|
76
|
+
setFocus(state?: boolean): void;
|
|
77
|
+
isSingle(): boolean;
|
|
78
|
+
isReadOnly(): boolean;
|
|
79
|
+
onlyInputContent(): boolean;
|
|
80
|
+
onlyInputFormula(): boolean;
|
|
81
|
+
onlyInputRange(): boolean;
|
|
57
82
|
getBoundingClientRect(): DOMRect;
|
|
58
83
|
isVisible(): boolean | undefined;
|
|
59
84
|
isSheetEditor(): boolean;
|
|
60
85
|
getValue(): string;
|
|
61
86
|
getBody(): IDocumentBody | undefined;
|
|
62
|
-
update(param:
|
|
87
|
+
update(param: Partial<IEditorSetParam>): void;
|
|
63
88
|
verticalAlign(): void;
|
|
64
89
|
updateCanvasStyle(): void;
|
|
65
90
|
}
|
|
66
91
|
export interface IEditorService {
|
|
67
92
|
getEditor(id?: string): Readonly<Nullable<Editor>>;
|
|
68
|
-
setState(param: IEditorStateParam, id: string): void;
|
|
69
93
|
register(config: IEditorConfigParam, container: HTMLDivElement): IDisposable;
|
|
70
|
-
unRegister(editorUnitId: string): void;
|
|
71
94
|
isVisible(id: string): Nullable<boolean>;
|
|
72
95
|
inputFormula$: Observable<IEditorInputFormulaParam>;
|
|
73
96
|
setFormula(formulaString: string): void;
|
|
74
97
|
resize$: Observable<string>;
|
|
75
98
|
resize(id: string): void;
|
|
76
99
|
getAllEditor(): Map<string, Editor>;
|
|
100
|
+
/**
|
|
101
|
+
* The sheet currently being operated on will determine
|
|
102
|
+
* whether to include unitId information in the ref.
|
|
103
|
+
*/
|
|
77
104
|
setOperationSheetUnitId(unitId: Nullable<string>): void;
|
|
78
105
|
getOperationSheetUnitId(): Nullable<string>;
|
|
106
|
+
/**
|
|
107
|
+
* The sub-table within the sheet currently being operated on
|
|
108
|
+
* will determine whether to include subUnitId information in the ref.
|
|
109
|
+
*/
|
|
79
110
|
setOperationSheetSubUnitId(sheetId: Nullable<string>): void;
|
|
80
111
|
getOperationSheetSubUnitId(): Nullable<string>;
|
|
81
112
|
isEditor(editorUnitId: string): boolean;
|
|
82
113
|
isSheetEditor(editorUnitId: string): boolean;
|
|
83
|
-
|
|
84
|
-
|
|
114
|
+
closeRangePrompt$: Observable<unknown>;
|
|
115
|
+
closeRangePrompt(): void;
|
|
85
116
|
blur$: Observable<unknown>;
|
|
86
117
|
blur(): void;
|
|
87
118
|
focus$: Observable<ISuccinctTextRangeParam>;
|
|
@@ -91,11 +122,27 @@ export interface IEditorService {
|
|
|
91
122
|
setValue(val: string, editorUnitId?: string): void;
|
|
92
123
|
setRichValue(body: IDocumentBody, editorUnitId?: string): void;
|
|
93
124
|
getFirstEditor(): Editor;
|
|
125
|
+
focusStyle$: Observable<Nullable<string>>;
|
|
126
|
+
focusStyle(editorUnitId: Nullable<string>): void;
|
|
127
|
+
refreshValueChange(editorId: string): void;
|
|
128
|
+
checkValueLegality(editorId: string): boolean;
|
|
129
|
+
getValue(id: string): Nullable<string>;
|
|
130
|
+
getRichValue(id: string): Nullable<IDocumentBody>;
|
|
131
|
+
changeSpreadsheetFocusState(state: boolean): void;
|
|
132
|
+
getSpreadsheetFocusState(): boolean;
|
|
133
|
+
selectionChangingState(): boolean;
|
|
134
|
+
singleSelection$: Observable<boolean>;
|
|
135
|
+
singleSelection(state: boolean): void;
|
|
136
|
+
setFocusId(id: Nullable<string>): void;
|
|
137
|
+
getFocusId(): Nullable<string>;
|
|
94
138
|
}
|
|
95
139
|
export declare class EditorService extends Disposable implements IEditorService, IDisposable {
|
|
96
140
|
private readonly _currentUniverService;
|
|
97
141
|
private readonly _renderManagerService;
|
|
142
|
+
private readonly _lexerTreeBuilder;
|
|
143
|
+
private readonly _contextService;
|
|
98
144
|
private _editors;
|
|
145
|
+
private _focusEditorUnitId;
|
|
99
146
|
private readonly _state$;
|
|
100
147
|
readonly state$: Observable<Nullable<IEditorStateParam>>;
|
|
101
148
|
private _currentSheetUnitId;
|
|
@@ -104,8 +151,8 @@ export declare class EditorService extends Disposable implements IEditorService,
|
|
|
104
151
|
readonly inputFormula$: Observable<IEditorInputFormulaParam>;
|
|
105
152
|
private readonly _resize$;
|
|
106
153
|
readonly resize$: Observable<string>;
|
|
107
|
-
private readonly
|
|
108
|
-
readonly
|
|
154
|
+
private readonly _closeRangePrompt$;
|
|
155
|
+
readonly closeRangePrompt$: Observable<unknown>;
|
|
109
156
|
private readonly _blur$;
|
|
110
157
|
readonly blur$: Observable<unknown>;
|
|
111
158
|
private readonly _focus$;
|
|
@@ -114,34 +161,46 @@ export declare class EditorService extends Disposable implements IEditorService,
|
|
|
114
161
|
readonly setValue$: Observable<IEditorSetValueParam>;
|
|
115
162
|
private readonly _valueChange$;
|
|
116
163
|
readonly valueChange$: Observable<Readonly<Editor>>;
|
|
117
|
-
|
|
164
|
+
private readonly _focusStyle$;
|
|
165
|
+
readonly focusStyle$: Observable<Nullable<string>>;
|
|
166
|
+
private readonly _singleSelection$;
|
|
167
|
+
readonly singleSelection$: Observable<boolean>;
|
|
168
|
+
private _spreadsheetFocusState;
|
|
169
|
+
constructor(_currentUniverService: IUniverInstanceService, _renderManagerService: IRenderManagerService, _lexerTreeBuilder: LexerTreeBuilder, _contextService: IContextService);
|
|
170
|
+
setFocusId(id: Nullable<string>): void;
|
|
171
|
+
getFocusId(): Nullable<string>;
|
|
118
172
|
isEditor(editorUnitId: string): boolean;
|
|
119
173
|
isSheetEditor(editorUnitId: string): boolean;
|
|
120
|
-
|
|
174
|
+
closeRangePrompt(): void;
|
|
175
|
+
changeSpreadsheetFocusState(state: boolean): void;
|
|
176
|
+
getSpreadsheetFocusState(): boolean;
|
|
177
|
+
focusStyle(editorUnitId: string): false | undefined;
|
|
178
|
+
singleSelection(state: boolean): void;
|
|
179
|
+
selectionChangingState(): boolean;
|
|
121
180
|
blur(): void;
|
|
122
181
|
focus(editorUnitId?: string): void;
|
|
123
182
|
setFormula(formulaString: string, editorUnitId?: string): void;
|
|
124
183
|
setValue(val: string, editorUnitId?: string): void;
|
|
125
|
-
getValue(id
|
|
184
|
+
getValue(id: string): string | undefined;
|
|
126
185
|
setRichValue(body: IDocumentBody, editorUnitId?: string): void;
|
|
127
|
-
getRichValue(id
|
|
186
|
+
getRichValue(id: string): IDocumentBody | undefined;
|
|
128
187
|
dispose(): void;
|
|
129
188
|
getEditor(id?: string): Readonly<Nullable<Editor>>;
|
|
130
189
|
getAllEditor(): Map<string, Editor>;
|
|
131
190
|
getFirstEditor(): Editor;
|
|
132
191
|
resize(unitId: string): void;
|
|
133
|
-
setState(param: IEditorStateParam, id: string): void;
|
|
134
192
|
isVisible(id: string): boolean | undefined;
|
|
135
193
|
setOperationSheetUnitId(unitId: Nullable<string>): void;
|
|
136
194
|
getOperationSheetUnitId(): Nullable<string>;
|
|
137
195
|
setOperationSheetSubUnitId(sheetId: Nullable<string>): void;
|
|
138
196
|
getOperationSheetSubUnitId(): Nullable<string>;
|
|
139
197
|
register(config: IEditorConfigParam, container: HTMLDivElement): IDisposable;
|
|
140
|
-
|
|
198
|
+
private _unRegister;
|
|
199
|
+
refreshValueChange(editorUnitId: string): void;
|
|
200
|
+
checkValueLegality(editorUnitId: string): boolean;
|
|
141
201
|
private _refreshValueChange;
|
|
142
202
|
private _getCurrentEditorUnitId;
|
|
143
203
|
private _refresh;
|
|
144
204
|
private _getBlank;
|
|
145
205
|
}
|
|
146
206
|
export declare const IEditorService: import("@wendellhu/redi").IdentifierDecorator<IEditorService>;
|
|
147
|
-
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IUnitRange, Nullable } from '@univerjs/core';
|
|
17
|
+
import { Disposable } from '@univerjs/core';
|
|
18
|
+
import type { IDisposable } from '@wendellhu/redi';
|
|
19
|
+
import type { Observable } from 'rxjs';
|
|
20
|
+
export interface IRangeSelectorRange extends IUnitRange {
|
|
21
|
+
sheetName: string;
|
|
22
|
+
}
|
|
23
|
+
export interface IRangeSelectorService {
|
|
24
|
+
selectionChange$: Observable<IRangeSelectorRange[]>;
|
|
25
|
+
selectionChange(ranges: IRangeSelectorRange[]): void;
|
|
26
|
+
setCurrentSelectorId(id: Nullable<string>): void;
|
|
27
|
+
getCurrentSelectorId(): Nullable<string>;
|
|
28
|
+
openSelector$: Observable<unknown>;
|
|
29
|
+
openSelector(): void;
|
|
30
|
+
}
|
|
31
|
+
export declare class RangeSelectorService extends Disposable implements IRangeSelectorService, IDisposable {
|
|
32
|
+
private _currentSelectorId;
|
|
33
|
+
private readonly _selectionChange$;
|
|
34
|
+
readonly selectionChange$: Observable<IRangeSelectorRange[]>;
|
|
35
|
+
private readonly _openSelector$;
|
|
36
|
+
readonly openSelector$: Observable<unknown>;
|
|
37
|
+
setCurrentSelectorId(id: Nullable<string>): void;
|
|
38
|
+
getCurrentSelectorId(): Nullable<string>;
|
|
39
|
+
selectionChange(range: IRangeSelectorRange[]): void;
|
|
40
|
+
openSelector(): void;
|
|
41
|
+
}
|
|
42
|
+
export declare const IRangeSelectorService: import("@wendellhu/redi").IdentifierDecorator<IRangeSelectorService>;
|
|
@@ -13,11 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export declare const KeyCodeToChar: {
|
|
17
|
-
[key: number]: string;
|
|
18
|
-
};
|
|
19
16
|
/** KeyCode that maps to browser standard keycode. */
|
|
20
|
-
export declare
|
|
17
|
+
export declare enum KeyCode {
|
|
21
18
|
UNKNOWN = 0,
|
|
22
19
|
BACKSPACE = 8,
|
|
23
20
|
TAB = 9,
|
|
@@ -81,13 +78,19 @@ export declare const enum KeyCode {
|
|
|
81
78
|
NUM_LOCK = 144,
|
|
82
79
|
SCROLL_LOCK = 145,
|
|
83
80
|
MINUS = 189,
|
|
84
|
-
EQUAL = 187
|
|
81
|
+
EQUAL = 187,
|
|
82
|
+
BACK_SLASH = 220
|
|
85
83
|
}
|
|
86
|
-
export declare const
|
|
84
|
+
export declare const KeyCodeToChar: {
|
|
85
|
+
[key: number]: string;
|
|
86
|
+
};
|
|
87
|
+
/** Define meta key numbers. */
|
|
88
|
+
export declare enum MetaKeys {
|
|
87
89
|
SHIFT = 1024,
|
|
88
90
|
/** Option key on MacOS. Alt key on other systems. */
|
|
89
91
|
ALT = 2048,
|
|
90
92
|
/** Command key on MacOS. Ctrl key on other systems. */
|
|
91
93
|
CTRL_COMMAND = 4096,
|
|
94
|
+
/** Ctrl key for MacOS. Not valid on other systems. */
|
|
92
95
|
MAC_CTRL = 8192
|
|
93
96
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { Nullable, Workbook, Worksheet } from '@univerjs/core';
|
|
17
|
+
/**
|
|
18
|
+
* A react hooks to get the active workbook.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useActiveWorkbook(): Nullable<Workbook>;
|
|
21
|
+
/**
|
|
22
|
+
* A react hooks to get the active worksheet.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useActiveWorksheet(): Nullable<Worksheet>;
|