@difizen/libro-core 0.0.0-snapshot-20241017072317
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/LICENSE +21 -0
- package/README.md +280 -0
- package/es/add-cell/index.d.ts +4 -0
- package/es/add-cell/index.d.ts.map +1 -0
- package/es/add-cell/index.js +3 -0
- package/es/add-cell/index.less +38 -0
- package/es/add-cell/libro-add-cell-module.d.ts +3 -0
- package/es/add-cell/libro-add-cell-module.d.ts.map +1 -0
- package/es/add-cell/libro-add-cell-module.js +4 -0
- package/es/add-cell/libro-add-cell-slot-contribution.d.ts +11 -0
- package/es/add-cell/libro-add-cell-slot-contribution.d.ts.map +1 -0
- package/es/add-cell/libro-add-cell-slot-contribution.js +59 -0
- package/es/add-cell/libro-add-cell-view.d.ts +21 -0
- package/es/add-cell/libro-add-cell-view.d.ts.map +1 -0
- package/es/add-cell/libro-add-cell-view.js +121 -0
- package/es/cell/index.d.ts +10 -0
- package/es/cell/index.d.ts.map +1 -0
- package/es/cell/index.js +9 -0
- package/es/cell/libro-cell-contribution.d.ts +12 -0
- package/es/cell/libro-cell-contribution.d.ts.map +1 -0
- package/es/cell/libro-cell-contribution.js +47 -0
- package/es/cell/libro-cell-model.d.ts +29 -0
- package/es/cell/libro-cell-model.d.ts.map +1 -0
- package/es/cell/libro-cell-model.js +130 -0
- package/es/cell/libro-cell-module.d.ts +10 -0
- package/es/cell/libro-cell-module.d.ts.map +1 -0
- package/es/cell/libro-cell-module.js +30 -0
- package/es/cell/libro-cell-protocol.d.ts +44 -0
- package/es/cell/libro-cell-protocol.d.ts.map +1 -0
- package/es/cell/libro-cell-protocol.js +11 -0
- package/es/cell/libro-cell-service.d.ts +28 -0
- package/es/cell/libro-cell-service.d.ts.map +1 -0
- package/es/cell/libro-cell-service.js +245 -0
- package/es/cell/libro-cell-view.d.ts +74 -0
- package/es/cell/libro-cell-view.d.ts.map +1 -0
- package/es/cell/libro-cell-view.js +239 -0
- package/es/cell/libro-edit-cell-view.d.ts +44 -0
- package/es/cell/libro-edit-cell-view.d.ts.map +1 -0
- package/es/cell/libro-edit-cell-view.js +256 -0
- package/es/cell/libro-executable-cell-model.d.ts +14 -0
- package/es/cell/libro-executable-cell-model.d.ts.map +1 -0
- package/es/cell/libro-executable-cell-model.js +7 -0
- package/es/cell/libro-executable-cell-view.d.ts +34 -0
- package/es/cell/libro-executable-cell-view.d.ts.map +1 -0
- package/es/cell/libro-executable-cell-view.js +74 -0
- package/es/cell/libro-markdown-cell-model.d.ts +9 -0
- package/es/cell/libro-markdown-cell-model.d.ts.map +1 -0
- package/es/cell/libro-markdown-cell-model.js +7 -0
- package/es/collapse-service.d.ts +36 -0
- package/es/collapse-service.d.ts.map +1 -0
- package/es/collapse-service.js +55 -0
- package/es/command/document-commands.d.ts +5 -0
- package/es/command/document-commands.d.ts.map +1 -0
- package/es/command/document-commands.js +21 -0
- package/es/command/index.d.ts +7 -0
- package/es/command/index.d.ts.map +1 -0
- package/es/command/index.js +6 -0
- package/es/command/kernel-command.d.ts +5 -0
- package/es/command/kernel-command.d.ts.map +1 -0
- package/es/command/kernel-command.js +40 -0
- package/es/command/libro-command-contribution.d.ts +13 -0
- package/es/command/libro-command-contribution.d.ts.map +1 -0
- package/es/command/libro-command-contribution.js +1842 -0
- package/es/command/libro-command-register.d.ts +21 -0
- package/es/command/libro-command-register.d.ts.map +1 -0
- package/es/command/libro-command-register.js +111 -0
- package/es/command/module.d.ts +3 -0
- package/es/command/module.d.ts.map +1 -0
- package/es/command/module.js +4 -0
- package/es/command/notebook-commands.d.ts +6 -0
- package/es/command/notebook-commands.d.ts.map +1 -0
- package/es/command/notebook-commands.js +472 -0
- package/es/components/cell-protocol.d.ts +20 -0
- package/es/components/cell-protocol.d.ts.map +1 -0
- package/es/components/cell-protocol.js +4 -0
- package/es/components/dnd-cell-item-render.d.ts +16 -0
- package/es/components/dnd-cell-item-render.d.ts.map +1 -0
- package/es/components/dnd-cell-item-render.js +364 -0
- package/es/components/dnd-component/custom-drag-layer.d.ts +9 -0
- package/es/components/dnd-component/custom-drag-layer.d.ts.map +1 -0
- package/es/components/dnd-component/custom-drag-layer.js +140 -0
- package/es/components/dnd-component/default-dnd-content.d.ts +11 -0
- package/es/components/dnd-component/default-dnd-content.d.ts.map +1 -0
- package/es/components/dnd-component/default-dnd-content.js +292 -0
- package/es/components/dnd-component/dnd-context.d.ts +3 -0
- package/es/components/dnd-component/dnd-context.d.ts.map +1 -0
- package/es/components/dnd-component/dnd-context.js +20 -0
- package/es/components/dnd-component/dnd-list.d.ts +14 -0
- package/es/components/dnd-component/dnd-list.d.ts.map +1 -0
- package/es/components/dnd-component/dnd-list.js +182 -0
- package/es/components/dnd-component/index.d.ts +5 -0
- package/es/components/dnd-component/index.d.ts.map +1 -0
- package/es/components/dnd-component/index.js +4 -0
- package/es/components/dnd-component/index.less +8 -0
- package/es/components/dnd-component/overscanIndices-getter.d.ts +22 -0
- package/es/components/dnd-component/overscanIndices-getter.d.ts.map +1 -0
- package/es/components/dnd-component/overscanIndices-getter.js +58 -0
- package/es/components/dnd-component/virtualized-manager.d.ts +19 -0
- package/es/components/dnd-component/virtualized-manager.d.ts.map +1 -0
- package/es/components/dnd-component/virtualized-manager.js +60 -0
- package/es/components/index.d.ts +6 -0
- package/es/components/index.d.ts.map +1 -0
- package/es/components/index.js +5 -0
- package/es/components/libro-component.d.ts +5 -0
- package/es/components/libro-component.d.ts.map +1 -0
- package/es/components/libro-component.js +35 -0
- package/es/components/libro-side-toolbar-menu.d.ts +21 -0
- package/es/components/libro-side-toolbar-menu.d.ts.map +1 -0
- package/es/components/libro-side-toolbar-menu.js +58 -0
- package/es/components/libro-view-header.d.ts +3 -0
- package/es/components/libro-view-header.d.ts.map +1 -0
- package/es/components/libro-view-header.js +37 -0
- package/es/components/libro-virtualized-render.d.ts +15 -0
- package/es/components/libro-virtualized-render.d.ts.map +1 -0
- package/es/components/libro-virtualized-render.js +174 -0
- package/es/content/index.d.ts +6 -0
- package/es/content/index.d.ts.map +1 -0
- package/es/content/index.js +5 -0
- package/es/content/libro-content-contribution.d.ts +11 -0
- package/es/content/libro-content-contribution.d.ts.map +1 -0
- package/es/content/libro-content-contribution.js +31 -0
- package/es/content/libro-content-module.d.ts +3 -0
- package/es/content/libro-content-module.d.ts.map +1 -0
- package/es/content/libro-content-module.js +6 -0
- package/es/content/libro-content-protocol.d.ts +13 -0
- package/es/content/libro-content-protocol.d.ts.map +1 -0
- package/es/content/libro-content-protocol.js +3 -0
- package/es/content/libro-content-service.d.ts +11 -0
- package/es/content/libro-content-service.d.ts.map +1 -0
- package/es/content/libro-content-service.js +63 -0
- package/es/content/libro-save-content-contribution.d.ts +6 -0
- package/es/content/libro-save-content-contribution.d.ts.map +1 -0
- package/es/content/libro-save-content-contribution.js +27 -0
- package/es/formatter/index.d.ts +6 -0
- package/es/formatter/index.d.ts.map +1 -0
- package/es/formatter/index.js +5 -0
- package/es/formatter/libro-formatter-json-contribution.d.ts +18 -0
- package/es/formatter/libro-formatter-json-contribution.d.ts.map +1 -0
- package/es/formatter/libro-formatter-json-contribution.js +41 -0
- package/es/formatter/libro-formatter-manager.d.ts +16 -0
- package/es/formatter/libro-formatter-manager.d.ts.map +1 -0
- package/es/formatter/libro-formatter-manager.js +86 -0
- package/es/formatter/libro-formatter-module.d.ts +3 -0
- package/es/formatter/libro-formatter-module.d.ts.map +1 -0
- package/es/formatter/libro-formatter-module.js +7 -0
- package/es/formatter/libro-formatter-protocol.d.ts +37 -0
- package/es/formatter/libro-formatter-protocol.d.ts.map +1 -0
- package/es/formatter/libro-formatter-protocol.js +18 -0
- package/es/formatter/libro-formatter-string-contribution.d.ts +18 -0
- package/es/formatter/libro-formatter-string-contribution.d.ts.map +1 -0
- package/es/formatter/libro-formatter-string-contribution.js +41 -0
- package/es/formatter/libro-formatter-trans-default-contribution.d.ts +7 -0
- package/es/formatter/libro-formatter-trans-default-contribution.d.ts.map +1 -0
- package/es/formatter/libro-formatter-trans-default-contribution.js +19 -0
- package/es/index.d.ts +26 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +25 -0
- package/es/index.less +781 -0
- package/es/libro-context-key.d.ts +26 -0
- package/es/libro-context-key.d.ts.map +1 -0
- package/es/libro-context-key.js +84 -0
- package/es/libro-keybind-registry.d.ts +5 -0
- package/es/libro-keybind-registry.d.ts.map +1 -0
- package/es/libro-keybind-registry.js +68 -0
- package/es/libro-model.d.ts +145 -0
- package/es/libro-model.d.ts.map +1 -0
- package/es/libro-model.js +921 -0
- package/es/libro-protocol.d.ts +315 -0
- package/es/libro-protocol.d.ts.map +1 -0
- package/es/libro-protocol.js +47 -0
- package/es/libro-service.d.ts +69 -0
- package/es/libro-service.d.ts.map +1 -0
- package/es/libro-service.js +303 -0
- package/es/libro-setting-contribution.d.ts +5 -0
- package/es/libro-setting-contribution.d.ts.map +1 -0
- package/es/libro-setting-contribution.js +23 -0
- package/es/libro-setting.d.ts +12 -0
- package/es/libro-setting.d.ts.map +1 -0
- package/es/libro-setting.js +101 -0
- package/es/libro-view-tracker.d.ts +6 -0
- package/es/libro-view-tracker.d.ts.map +1 -0
- package/es/libro-view-tracker.js +13 -0
- package/es/libro-view.d.ts +170 -0
- package/es/libro-view.d.ts.map +1 -0
- package/es/libro-view.js +2077 -0
- package/es/libro-workspace-service.d.ts +17 -0
- package/es/libro-workspace-service.d.ts.map +1 -0
- package/es/libro-workspace-service.js +36 -0
- package/es/material-from-designer.d.ts +31 -0
- package/es/material-from-designer.d.ts.map +1 -0
- package/es/material-from-designer.js +697 -0
- package/es/module.d.ts +3 -0
- package/es/module.d.ts.map +1 -0
- package/es/module.js +71 -0
- package/es/output/index.d.ts +6 -0
- package/es/output/index.d.ts.map +1 -0
- package/es/output/index.js +5 -0
- package/es/output/output-area.d.ts +51 -0
- package/es/output/output-area.d.ts.map +1 -0
- package/es/output/output-area.js +399 -0
- package/es/output/output-contribution.d.ts +10 -0
- package/es/output/output-contribution.d.ts.map +1 -0
- package/es/output/output-contribution.js +36 -0
- package/es/output/output-model.d.ts +28 -0
- package/es/output/output-model.d.ts.map +1 -0
- package/es/output/output-model.js +105 -0
- package/es/output/output-module.d.ts +3 -0
- package/es/output/output-module.d.ts.map +1 -0
- package/es/output/output-module.js +6 -0
- package/es/output/output-protocol.d.ts +134 -0
- package/es/output/output-protocol.d.ts.map +1 -0
- package/es/output/output-protocol.js +16 -0
- package/es/settings/index.d.ts +5 -0
- package/es/settings/index.d.ts.map +1 -0
- package/es/settings/index.js +4 -0
- package/es/settings/index.less +3 -0
- package/es/settings/module.d.ts +3 -0
- package/es/settings/module.d.ts.map +1 -0
- package/es/settings/module.js +4 -0
- package/es/settings/setting-editor/configuration-panel-view.d.ts +13 -0
- package/es/settings/setting-editor/configuration-panel-view.d.ts.map +1 -0
- package/es/settings/setting-editor/configuration-panel-view.js +115 -0
- package/es/settings/setting-editor/configuration-render-contribution.d.ts +6 -0
- package/es/settings/setting-editor/configuration-render-contribution.d.ts.map +1 -0
- package/es/settings/setting-editor/configuration-render-contribution.js +77 -0
- package/es/settings/setting-editor/default-node-render.d.ts +9 -0
- package/es/settings/setting-editor/default-node-render.d.ts.map +1 -0
- package/es/settings/setting-editor/default-node-render.js +79 -0
- package/es/settings/setting-editor/index.d.ts +7 -0
- package/es/settings/setting-editor/index.d.ts.map +1 -0
- package/es/settings/setting-editor/index.js +6 -0
- package/es/settings/setting-editor/index.less +12 -0
- package/es/settings/setting-editor/module.d.ts +3 -0
- package/es/settings/setting-editor/module.d.ts.map +1 -0
- package/es/settings/setting-editor/module.js +11 -0
- package/es/settings/setting-editor/setting-editor-view.d.ts +15 -0
- package/es/settings/setting-editor/setting-editor-view.d.ts.map +1 -0
- package/es/settings/setting-editor/setting-editor-view.js +169 -0
- package/es/settings/setting-editor/setting-tree-service.d.ts +9 -0
- package/es/settings/setting-editor/setting-tree-service.d.ts.map +1 -0
- package/es/settings/setting-editor/setting-tree-service.js +118 -0
- package/es/settings/setting-editor/setting-tree-view.d.ts +19 -0
- package/es/settings/setting-editor/setting-tree-view.d.ts.map +1 -0
- package/es/settings/setting-editor/setting-tree-view.js +87 -0
- package/es/settings/settings-contribution.d.ts +7 -0
- package/es/settings/settings-contribution.d.ts.map +1 -0
- package/es/settings/settings-contribution.js +36 -0
- package/es/settings/settings-modal.d.ts +5 -0
- package/es/settings/settings-modal.d.ts.map +1 -0
- package/es/settings/settings-modal.js +53 -0
- package/es/settings/settings-modal.less +3 -0
- package/es/settings/settings-protocol.d.ts +4 -0
- package/es/settings/settings-protocol.d.ts.map +1 -0
- package/es/settings/settings-protocol.js +5 -0
- package/es/slot/index.d.ts +5 -0
- package/es/slot/index.d.ts.map +1 -0
- package/es/slot/index.js +4 -0
- package/es/slot/libro-slot-manager.d.ts +13 -0
- package/es/slot/libro-slot-manager.d.ts.map +1 -0
- package/es/slot/libro-slot-manager.js +66 -0
- package/es/slot/libro-slot-protocol.d.ts +19 -0
- package/es/slot/libro-slot-protocol.d.ts.map +1 -0
- package/es/slot/libro-slot-protocol.js +5 -0
- package/es/slot/libro-slot-view.d.ts +9 -0
- package/es/slot/libro-slot-view.d.ts.map +1 -0
- package/es/slot/libro-slot-view.js +81 -0
- package/es/slot/module.d.ts +3 -0
- package/es/slot/module.d.ts.map +1 -0
- package/es/slot/module.js +5 -0
- package/es/theme/libro-color-registry.d.ts +6 -0
- package/es/theme/libro-color-registry.d.ts.map +1 -0
- package/es/theme/libro-color-registry.js +515 -0
- package/es/toolbar/all-outputs-scroll-icon.d.ts +3 -0
- package/es/toolbar/all-outputs-scroll-icon.d.ts.map +1 -0
- package/es/toolbar/all-outputs-scroll-icon.js +10 -0
- package/es/toolbar/change-cell-to-selector.d.ts +5 -0
- package/es/toolbar/change-cell-to-selector.d.ts.map +1 -0
- package/es/toolbar/change-cell-to-selector.js +51 -0
- package/es/toolbar/hide-all-selector.d.ts +5 -0
- package/es/toolbar/hide-all-selector.d.ts.map +1 -0
- package/es/toolbar/hide-all-selector.js +99 -0
- package/es/toolbar/index.d.ts +4 -0
- package/es/toolbar/index.d.ts.map +1 -0
- package/es/toolbar/index.js +3 -0
- package/es/toolbar/index.less +59 -0
- package/es/toolbar/libro-toolbar-protocol.d.ts +4 -0
- package/es/toolbar/libro-toolbar-protocol.d.ts.map +1 -0
- package/es/toolbar/libro-toolbar-protocol.js +1 -0
- package/es/toolbar/libro-toolbar.d.ts +9 -0
- package/es/toolbar/libro-toolbar.d.ts.map +1 -0
- package/es/toolbar/libro-toolbar.js +275 -0
- package/es/toolbar/module.d.ts +3 -0
- package/es/toolbar/module.d.ts.map +1 -0
- package/es/toolbar/module.js +5 -0
- package/es/toolbar/restart-clear-outputs-contribution.d.ts +5 -0
- package/es/toolbar/restart-clear-outputs-contribution.d.ts.map +1 -0
- package/es/toolbar/restart-clear-outputs-contribution.js +23 -0
- package/es/toolbar/restart-clear-outputs-modal.d.ts +5 -0
- package/es/toolbar/restart-clear-outputs-modal.d.ts.map +1 -0
- package/es/toolbar/restart-clear-outputs-modal.js +30 -0
- package/es/toolbar/save-icon.d.ts +3 -0
- package/es/toolbar/save-icon.d.ts.map +1 -0
- package/es/toolbar/save-icon.js +54 -0
- package/es/toolbar/shutdown-contribution.d.ts +5 -0
- package/es/toolbar/shutdown-contribution.d.ts.map +1 -0
- package/es/toolbar/shutdown-contribution.js +23 -0
- package/es/toolbar/shutdown-modal.d.ts +5 -0
- package/es/toolbar/shutdown-modal.d.ts.map +1 -0
- package/es/toolbar/shutdown-modal.js +30 -0
- package/es/toolbar/side-toolar-more-select.d.ts +4 -0
- package/es/toolbar/side-toolar-more-select.d.ts.map +1 -0
- package/es/toolbar/side-toolar-more-select.js +161 -0
- package/es/typings/index.d.ts +1 -0
- package/es/virtualized-manager-helper.d.ts +11 -0
- package/es/virtualized-manager-helper.d.ts.map +1 -0
- package/es/virtualized-manager-helper.js +51 -0
- package/es/virtualized-manager.d.ts +23 -0
- package/es/virtualized-manager.d.ts.map +1 -0
- package/es/virtualized-manager.js +65 -0
- package/package.json +73 -0
- package/src/add-cell/index.less +38 -0
- package/src/add-cell/index.ts +3 -0
- package/src/add-cell/libro-add-cell-module.ts +9 -0
- package/src/add-cell/libro-add-cell-slot-contribution.ts +28 -0
- package/src/add-cell/libro-add-cell-view.tsx +99 -0
- package/src/cell/README.md +14 -0
- package/src/cell/index.ts +9 -0
- package/src/cell/libro-cell-contribution.ts +34 -0
- package/src/cell/libro-cell-model.ts +119 -0
- package/src/cell/libro-cell-module.ts +40 -0
- package/src/cell/libro-cell-protocol.ts +55 -0
- package/src/cell/libro-cell-service.ts +158 -0
- package/src/cell/libro-cell-view.tsx +156 -0
- package/src/cell/libro-edit-cell-view.tsx +205 -0
- package/src/cell/libro-executable-cell-model.ts +32 -0
- package/src/cell/libro-executable-cell-view.ts +86 -0
- package/src/cell/libro-markdown-cell-model.ts +20 -0
- package/src/collapse-service.ts +69 -0
- package/src/command/document-commands.ts +24 -0
- package/src/command/index.ts +6 -0
- package/src/command/kernel-command.ts +42 -0
- package/src/command/libro-command-contribution.ts +1346 -0
- package/src/command/libro-command-register.ts +168 -0
- package/src/command/module.ts +9 -0
- package/src/command/notebook-commands.ts +502 -0
- package/src/components/cell-protocol.ts +26 -0
- package/src/components/dnd-cell-item-render.tsx +465 -0
- package/src/components/dnd-component/custom-drag-layer.tsx +144 -0
- package/src/components/dnd-component/default-dnd-content.tsx +330 -0
- package/src/components/dnd-component/dnd-context.tsx +28 -0
- package/src/components/dnd-component/dnd-list.tsx +211 -0
- package/src/components/dnd-component/index.less +12 -0
- package/src/components/dnd-component/index.tsx +4 -0
- package/src/components/dnd-component/overscanIndices-getter.ts +92 -0
- package/src/components/dnd-component/virtualized-manager.ts +34 -0
- package/src/components/index.ts +5 -0
- package/src/components/libro-component.tsx +30 -0
- package/src/components/libro-side-toolbar-menu.tsx +82 -0
- package/src/components/libro-view-header.tsx +33 -0
- package/src/components/libro-virtualized-render.tsx +178 -0
- package/src/content/index.ts +5 -0
- package/src/content/libro-content-contribution.ts +16 -0
- package/src/content/libro-content-module.ts +17 -0
- package/src/content/libro-content-protocol.ts +14 -0
- package/src/content/libro-content-service.ts +48 -0
- package/src/content/libro-save-content-contribution.ts +12 -0
- package/src/formatter/index.ts +5 -0
- package/src/formatter/libro-formatter-json-contribution.ts +42 -0
- package/src/formatter/libro-formatter-manager.ts +85 -0
- package/src/formatter/libro-formatter-module.ts +19 -0
- package/src/formatter/libro-formatter-protocol.ts +63 -0
- package/src/formatter/libro-formatter-string-contribution.ts +41 -0
- package/src/formatter/libro-formatter-trans-default-contribution.ts +15 -0
- package/src/index.less +789 -0
- package/src/index.spec.ts +12 -0
- package/src/index.tsx +25 -0
- package/src/libro-context-key.ts +84 -0
- package/src/libro-keybind-registry.ts +43 -0
- package/src/libro-model.ts +710 -0
- package/src/libro-protocol.ts +435 -0
- package/src/libro-service.ts +234 -0
- package/src/libro-setting-contribution.ts +28 -0
- package/src/libro-setting.ts +110 -0
- package/src/libro-view-tracker.ts +9 -0
- package/src/libro-view.tsx +1532 -0
- package/src/libro-workspace-service.ts +28 -0
- package/src/material-from-designer.tsx +579 -0
- package/src/module.ts +121 -0
- package/src/output/index.ts +5 -0
- package/src/output/output-area.tsx +286 -0
- package/src/output/output-contribution.ts +14 -0
- package/src/output/output-model.tsx +70 -0
- package/src/output/output-module.ts +10 -0
- package/src/output/output-protocol.ts +168 -0
- package/src/settings/index.less +3 -0
- package/src/settings/index.ts +4 -0
- package/src/settings/module.ts +8 -0
- package/src/settings/setting-editor/configuration-panel-view.tsx +89 -0
- package/src/settings/setting-editor/configuration-render-contribution.ts +81 -0
- package/src/settings/setting-editor/default-node-render.tsx +65 -0
- package/src/settings/setting-editor/index.less +12 -0
- package/src/settings/setting-editor/index.ts +6 -0
- package/src/settings/setting-editor/module.ts +17 -0
- package/src/settings/setting-editor/setting-editor-view.tsx +93 -0
- package/src/settings/setting-editor/setting-tree-service.ts +82 -0
- package/src/settings/setting-editor/setting-tree-view.tsx +95 -0
- package/src/settings/settings-contribution.tsx +24 -0
- package/src/settings/settings-modal.less +3 -0
- package/src/settings/settings-modal.tsx +51 -0
- package/src/settings/settings-protocol.ts +7 -0
- package/src/slot/index.ts +4 -0
- package/src/slot/libro-slot-manager.ts +38 -0
- package/src/slot/libro-slot-protocol.ts +28 -0
- package/src/slot/libro-slot-view.tsx +48 -0
- package/src/slot/module.ts +9 -0
- package/src/theme/libro-color-registry.ts +386 -0
- package/src/toolbar/all-outputs-scroll-icon.tsx +19 -0
- package/src/toolbar/change-cell-to-selector.tsx +67 -0
- package/src/toolbar/hide-all-selector.tsx +126 -0
- package/src/toolbar/index.less +59 -0
- package/src/toolbar/index.ts +3 -0
- package/src/toolbar/libro-toolbar-protocol.ts +4 -0
- package/src/toolbar/libro-toolbar.tsx +231 -0
- package/src/toolbar/module.ts +11 -0
- package/src/toolbar/restart-clear-outputs-contribution.tsx +10 -0
- package/src/toolbar/restart-clear-outputs-modal.tsx +37 -0
- package/src/toolbar/save-icon.tsx +47 -0
- package/src/toolbar/shutdown-contribution.tsx +10 -0
- package/src/toolbar/shutdown-modal.tsx +37 -0
- package/src/toolbar/side-toolar-more-select.tsx +177 -0
- package/src/typings/index.d.ts +1 -0
- package/src/virtualized-manager-helper.ts +29 -0
- package/src/virtualized-manager.ts +47 -0
|
@@ -0,0 +1,921 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _dec19, _dec20, _dec21, _dec22, _dec23, _dec24, _dec25, _dec26, _dec27, _dec28, _dec29, _dec30, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14, _descriptor15, _descriptor16, _descriptor17, _descriptor18, _descriptor19, _descriptor20, _descriptor21, _descriptor22, _descriptor23, _descriptor24, _descriptor25, _descriptor26, _descriptor27, _descriptor28, _descriptor29;
|
|
3
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
4
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
5
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
6
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
7
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
10
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
11
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
12
|
+
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
|
|
13
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
14
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
15
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
17
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
|
+
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
|
|
19
|
+
function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
|
|
20
|
+
/* eslint-disable @typescript-eslint/unified-signatures */
|
|
21
|
+
|
|
22
|
+
import { createMutex, YNotebook } from '@difizen/libro-shared-model';
|
|
23
|
+
import { getOrigin, ConfigurationService } from '@difizen/mana-app';
|
|
24
|
+
import { Emitter } from '@difizen/mana-app';
|
|
25
|
+
import { prop } from '@difizen/mana-app';
|
|
26
|
+
import { inject, transient } from '@difizen/mana-app';
|
|
27
|
+
import { v4 } from 'uuid';
|
|
28
|
+
import { LibroContentService } from "./content/index.js";
|
|
29
|
+
import { isCellView, NotebookOption } from "./libro-protocol.js";
|
|
30
|
+
import { EnterEditModeWhenAddCell } from "./libro-setting.js";
|
|
31
|
+
import { VirtualizedManagerHelper } from "./virtualized-manager-helper.js";
|
|
32
|
+
export var LibroModel = (_dec = transient(), _dec2 = inject(NotebookOption), _dec3 = inject(LibroContentService), _dec4 = inject(VirtualizedManagerHelper), _dec5 = inject(ConfigurationService), _dec6 = prop(), _dec7 = prop(), _dec8 = prop(), _dec9 = prop(), _dec10 = prop(), _dec11 = prop(), _dec12 = prop(), _dec13 = prop(), _dec14 = prop(), _dec15 = prop(), _dec16 = prop(), _dec17 = prop(), _dec18 = prop(), _dec19 = prop(), _dec20 = prop(), _dec21 = prop(), _dec22 = prop(), _dec23 = prop(), _dec24 = prop(), _dec25 = prop(), _dec26 = prop(), _dec27 = prop(), _dec28 = prop(), _dec29 = prop(), _dec30 = prop(), _dec(_class = (_class2 = /*#__PURE__*/function () {
|
|
33
|
+
function LibroModel() {
|
|
34
|
+
var _this = this;
|
|
35
|
+
_classCallCheck(this, LibroModel);
|
|
36
|
+
_initializerDefineProperty(this, "options", _descriptor, this);
|
|
37
|
+
_initializerDefineProperty(this, "libroContentService", _descriptor2, this);
|
|
38
|
+
_initializerDefineProperty(this, "virtualizedManagerHelper", _descriptor3, this);
|
|
39
|
+
_initializerDefineProperty(this, "configurationService", _descriptor4, this);
|
|
40
|
+
this.scrollToCellViewEmitter = void 0;
|
|
41
|
+
this.cellViewChangeEmitter = new Emitter();
|
|
42
|
+
this.onCommandModeChangedEmitter = new Emitter();
|
|
43
|
+
this.onChangedEmitter = new Emitter();
|
|
44
|
+
this.onSourceChangedEmitter = new Emitter();
|
|
45
|
+
this.onCellContentChangedEmitter = new Emitter();
|
|
46
|
+
this.id = void 0;
|
|
47
|
+
this.version = 0;
|
|
48
|
+
/**
|
|
49
|
+
* The shared notebook model.
|
|
50
|
+
*/
|
|
51
|
+
this.sharedModel = void 0;
|
|
52
|
+
/**
|
|
53
|
+
* A mutex to update the shared model.
|
|
54
|
+
*/
|
|
55
|
+
this._modelDBMutex = createMutex();
|
|
56
|
+
_initializerDefineProperty(this, "lastClipboardInteraction", _descriptor5, this);
|
|
57
|
+
this.clipboard = void 0;
|
|
58
|
+
_initializerDefineProperty(this, "inputEditable", _descriptor6, this);
|
|
59
|
+
_initializerDefineProperty(this, "outputEditable", _descriptor7, this);
|
|
60
|
+
_initializerDefineProperty(this, "cellsEditable", _descriptor8, this);
|
|
61
|
+
_initializerDefineProperty(this, "savable", _descriptor9, this);
|
|
62
|
+
_initializerDefineProperty(this, "runnable", _descriptor10, this);
|
|
63
|
+
_initializerDefineProperty(this, "commandMode", _descriptor11, this);
|
|
64
|
+
_initializerDefineProperty(this, "isEditMode", _descriptor12, this);
|
|
65
|
+
_initializerDefineProperty(this, "dndAreaNullEnable", _descriptor13, this);
|
|
66
|
+
_initializerDefineProperty(this, "dirty", _descriptor14, this);
|
|
67
|
+
_initializerDefineProperty(this, "cells", _descriptor15, this);
|
|
68
|
+
_initializerDefineProperty(this, "active", _descriptor16, this);
|
|
69
|
+
_initializerDefineProperty(this, "activeIndex", _descriptor17, this);
|
|
70
|
+
_initializerDefineProperty(this, "hover", _descriptor18, this);
|
|
71
|
+
_initializerDefineProperty(this, "isInitialized", _descriptor19, this);
|
|
72
|
+
_initializerDefineProperty(this, "executeCount", _descriptor20, this);
|
|
73
|
+
_initializerDefineProperty(this, "mouseMode", _descriptor21, this);
|
|
74
|
+
_initializerDefineProperty(this, "selections", _descriptor22, this);
|
|
75
|
+
this.deletedCells = [];
|
|
76
|
+
this.metadata = {};
|
|
77
|
+
_initializerDefineProperty(this, "customParams", _descriptor23, this);
|
|
78
|
+
_initializerDefineProperty(this, "libroViewClass", _descriptor24, this);
|
|
79
|
+
_initializerDefineProperty(this, "canUndo", _descriptor25, this);
|
|
80
|
+
_initializerDefineProperty(this, "canRedo", _descriptor26, this);
|
|
81
|
+
/**
|
|
82
|
+
* 默认为true,可以在metadata修改
|
|
83
|
+
*/
|
|
84
|
+
_initializerDefineProperty(this, "trusted", _descriptor27, this);
|
|
85
|
+
// 字体大小
|
|
86
|
+
_initializerDefineProperty(this, "fontSize", _descriptor28, this);
|
|
87
|
+
// 主题
|
|
88
|
+
_initializerDefineProperty(this, "theme", _descriptor29, this);
|
|
89
|
+
this.cellViewCache = new Map();
|
|
90
|
+
this.nbformat_minor = 4;
|
|
91
|
+
this.nbformat = 4;
|
|
92
|
+
this.cellTypeAdaptor = void 0;
|
|
93
|
+
this.onSharedModelChanged = function (change) {
|
|
94
|
+
var _change$cellsChange;
|
|
95
|
+
var currpos = 0;
|
|
96
|
+
(_change$cellsChange = change.cellsChange) === null || _change$cellsChange === void 0 || _change$cellsChange.forEach(function (delta) {
|
|
97
|
+
if (delta.insert !== null && delta.insert !== undefined) {
|
|
98
|
+
var cellViews = delta.insert.map(function (cell) {
|
|
99
|
+
var view = _this.cellViewCache.get(cell.id);
|
|
100
|
+
return view;
|
|
101
|
+
});
|
|
102
|
+
_this.insertCellsView(cellViews, currpos);
|
|
103
|
+
currpos += delta.insert.length;
|
|
104
|
+
_this.cellViewChangeEmitter.fire({
|
|
105
|
+
insert: {
|
|
106
|
+
index: currpos,
|
|
107
|
+
cells: cellViews
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
} else if (delta.delete !== null && delta.delete !== undefined) {
|
|
111
|
+
var _cellViews = _this.cells.slice(currpos, currpos + delta.delete);
|
|
112
|
+
_this.removeRange(currpos, currpos + delta.delete);
|
|
113
|
+
_this.cellViewChangeEmitter.fire({
|
|
114
|
+
delete: {
|
|
115
|
+
index: currpos,
|
|
116
|
+
number: delta.delete,
|
|
117
|
+
cells: _cellViews
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
} else if (delta.retain !== null && delta.retain !== undefined) {
|
|
121
|
+
currpos += delta.retain;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
if ((!_this.inputEditable || !_this.outputEditable || !_this.cellsEditable) && !_this.runnable && !_this.isInitialized) {
|
|
125
|
+
_this.selectCell(undefined);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
_this.selectCell(_this.cells[_this.activeIndex]);
|
|
129
|
+
_this.configurationService.get(EnterEditModeWhenAddCell).then(function (value) {
|
|
130
|
+
if (value) {
|
|
131
|
+
if (_this.isEditMode) {
|
|
132
|
+
_this.enterEditMode();
|
|
133
|
+
} else {
|
|
134
|
+
_this.enterCommandMode();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return;
|
|
138
|
+
}).catch(function () {
|
|
139
|
+
//
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
this.toString = void 0;
|
|
143
|
+
this.fromString = void 0;
|
|
144
|
+
this.selectCell = function (cell) {
|
|
145
|
+
var _this$active;
|
|
146
|
+
if (!cell || ((_this$active = _this.active) === null || _this$active === void 0 ? void 0 : _this$active.id) === cell.id) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
_this.active = cell;
|
|
150
|
+
cell.focus(false);
|
|
151
|
+
var index = _this.cells.findIndex(function (_cell) {
|
|
152
|
+
return _cell.id === cell.id;
|
|
153
|
+
});
|
|
154
|
+
if (index > -1) {
|
|
155
|
+
_this.activeIndex = index;
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
this.hoverCell = function (cell) {
|
|
159
|
+
_this.hover = cell;
|
|
160
|
+
};
|
|
161
|
+
this.addCell = function (cell, position, mode) {
|
|
162
|
+
_this.insertCells([cell], position, mode);
|
|
163
|
+
};
|
|
164
|
+
this.insertCells = function (cells, position, mode) {
|
|
165
|
+
// 非初始化阶段才需要自动滚动
|
|
166
|
+
if (!_this.isInitialized) {
|
|
167
|
+
_this.activeIndex = 0;
|
|
168
|
+
} else if (mode === 'above' && position !== undefined) {
|
|
169
|
+
_this.activeIndex = position;
|
|
170
|
+
} else {
|
|
171
|
+
if (position === _this.cells.length) {
|
|
172
|
+
_this.activeIndex = position;
|
|
173
|
+
} else {
|
|
174
|
+
_this.activeIndex = _this.activeIndex + cells.length;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
_this.isEditMode = true;
|
|
178
|
+
var cellData = cells.map(function (cell) {
|
|
179
|
+
_this.cellViewCache.set(cell.model.id, cell);
|
|
180
|
+
return cell.toJSON();
|
|
181
|
+
});
|
|
182
|
+
getOrigin(_this.sharedModel).transact(function () {
|
|
183
|
+
var insertIndex = position !== null && position !== void 0 ? position : _this.sharedModel.cells.length;
|
|
184
|
+
getOrigin(_this.sharedModel).insertCells(insertIndex, cellData);
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
this.invertCell = function (toAddcell, position) {
|
|
188
|
+
if (_this.activeIndex !== position) {
|
|
189
|
+
_this.activeIndex = position;
|
|
190
|
+
}
|
|
191
|
+
var cellData = [toAddcell].map(function (_cell) {
|
|
192
|
+
_this.cellViewCache.set(_cell.model.id, _cell);
|
|
193
|
+
return _cell.toJSON();
|
|
194
|
+
});
|
|
195
|
+
_this.isEditMode = true;
|
|
196
|
+
getOrigin(_this.sharedModel).transact(function () {
|
|
197
|
+
var invertIndex = position !== null && position !== void 0 ? position : _this.sharedModel.cells.length;
|
|
198
|
+
getOrigin(_this.sharedModel).deleteCell(invertIndex);
|
|
199
|
+
getOrigin(_this.sharedModel).insertCells(invertIndex, cellData);
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
this.splitCell = function (newCells, position) {
|
|
203
|
+
var newActiveIndex = position + newCells.length - 1;
|
|
204
|
+
if (_this.activeIndex !== newActiveIndex) {
|
|
205
|
+
_this.activeIndex = newActiveIndex;
|
|
206
|
+
}
|
|
207
|
+
var cellData = newCells.map(function (_cell) {
|
|
208
|
+
_this.cellViewCache.set(_cell.model.id, _cell);
|
|
209
|
+
return _cell.toJSON();
|
|
210
|
+
});
|
|
211
|
+
getOrigin(_this.sharedModel).transact(function () {
|
|
212
|
+
getOrigin(_this.sharedModel).deleteCell(position);
|
|
213
|
+
getOrigin(_this.sharedModel).insertCells(position, cellData);
|
|
214
|
+
});
|
|
215
|
+
//切分cell操作结束后进入编辑态
|
|
216
|
+
_this.enterEditMode();
|
|
217
|
+
};
|
|
218
|
+
this.insertCellsView = function (cell, position) {
|
|
219
|
+
if (position === 0) {
|
|
220
|
+
// unshift 存在性能问题
|
|
221
|
+
// this.cells.unshift(...cell);
|
|
222
|
+
|
|
223
|
+
var arr = _toConsumableArray(_this.cells);
|
|
224
|
+
arr.splice.apply(arr, [0, 0].concat(_toConsumableArray(cell)));
|
|
225
|
+
_this.cells = arr;
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if (position !== undefined) {
|
|
229
|
+
var _cells = [];
|
|
230
|
+
_this.getCells().forEach(function (_cell, index) {
|
|
231
|
+
_cells.push(_cell);
|
|
232
|
+
_cell.isAttached = true;
|
|
233
|
+
if (index + 1 === position) {
|
|
234
|
+
_cells.push.apply(_cells, _toConsumableArray(cell));
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
_this.cells = _cells;
|
|
238
|
+
} else {
|
|
239
|
+
var _this$cells;
|
|
240
|
+
(_this$cells = _this.cells).push.apply(_this$cells, _toConsumableArray(cell));
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
this.doDeleteCell = function (arg) {
|
|
244
|
+
var index = _this.toCellIndex(arg);
|
|
245
|
+
if (index !== undefined) {
|
|
246
|
+
var _cells = [];
|
|
247
|
+
_this.getCells().forEach(function (item, _index) {
|
|
248
|
+
if (index !== _index) {
|
|
249
|
+
_cells.push(item);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
_this.cells = _cells;
|
|
253
|
+
if (index !== _this.cells.length) {
|
|
254
|
+
_this.selectCell(_this.cells[index]);
|
|
255
|
+
} else {
|
|
256
|
+
_this.selectCell(_this.cells[index - 1]);
|
|
257
|
+
}
|
|
258
|
+
return true;
|
|
259
|
+
}
|
|
260
|
+
return false;
|
|
261
|
+
};
|
|
262
|
+
this.id = v4();
|
|
263
|
+
this.sharedModel = YNotebook.create({
|
|
264
|
+
disableDocumentWideUndoRedo: false,
|
|
265
|
+
cellTypeAdaptor: this.cellTypeAdaptor
|
|
266
|
+
});
|
|
267
|
+
this.scrollToCellViewEmitter = new Emitter();
|
|
268
|
+
this.sharedModel.changed(this.onSharedModelChanged);
|
|
269
|
+
this.sharedModel.undoChanged(function (value) {
|
|
270
|
+
if (value !== _this.canUndo) {
|
|
271
|
+
_this.canUndo = value;
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
this.sharedModel.redoChanged(function (value) {
|
|
275
|
+
if (value !== _this.canRedo) {
|
|
276
|
+
_this.canRedo = value;
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
_createClass(LibroModel, [{
|
|
281
|
+
key: "onScrollToCellView",
|
|
282
|
+
get: function get() {
|
|
283
|
+
return this.scrollToCellViewEmitter.event;
|
|
284
|
+
}
|
|
285
|
+
}, {
|
|
286
|
+
key: "onCellViewChanged",
|
|
287
|
+
get: function get() {
|
|
288
|
+
return this.cellViewChangeEmitter.event;
|
|
289
|
+
}
|
|
290
|
+
}, {
|
|
291
|
+
key: "disposeScrollToCellViewEmitter",
|
|
292
|
+
value: function disposeScrollToCellViewEmitter() {
|
|
293
|
+
this.scrollToCellViewEmitter.dispose();
|
|
294
|
+
}
|
|
295
|
+
}, {
|
|
296
|
+
key: "onCommandModeChanged",
|
|
297
|
+
get: function get() {
|
|
298
|
+
return this.onCommandModeChangedEmitter.event;
|
|
299
|
+
}
|
|
300
|
+
}, {
|
|
301
|
+
key: "onChanged",
|
|
302
|
+
get: function get() {
|
|
303
|
+
return this.onChangedEmitter.event;
|
|
304
|
+
}
|
|
305
|
+
}, {
|
|
306
|
+
key: "onSourceChanged",
|
|
307
|
+
get: function get() {
|
|
308
|
+
return this.onSourceChangedEmitter.event;
|
|
309
|
+
}
|
|
310
|
+
}, {
|
|
311
|
+
key: "onCellContentChanged",
|
|
312
|
+
get: function get() {
|
|
313
|
+
return this.onCellContentChangedEmitter.event;
|
|
314
|
+
}
|
|
315
|
+
}, {
|
|
316
|
+
key: "onCellContentChange",
|
|
317
|
+
value: function onCellContentChange(change) {
|
|
318
|
+
this.onCellContentChangedEmitter.fire(change);
|
|
319
|
+
}
|
|
320
|
+
}, {
|
|
321
|
+
key: "executable",
|
|
322
|
+
get: function get() {
|
|
323
|
+
return this.outputEditable && this.runnable;
|
|
324
|
+
},
|
|
325
|
+
set: function set(value) {
|
|
326
|
+
this.runnable = value;
|
|
327
|
+
}
|
|
328
|
+
}, {
|
|
329
|
+
key: "getCells",
|
|
330
|
+
value: function getCells() {
|
|
331
|
+
return this.cells.filter(function (cell) {
|
|
332
|
+
return !!cell;
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
}, {
|
|
336
|
+
key: "canRun",
|
|
337
|
+
value: function canRun() {
|
|
338
|
+
return true;
|
|
339
|
+
}
|
|
340
|
+
}, {
|
|
341
|
+
key: "getCustomKey",
|
|
342
|
+
value: function getCustomKey(key) {
|
|
343
|
+
return this.customParams[key];
|
|
344
|
+
}
|
|
345
|
+
}, {
|
|
346
|
+
key: "setCustomKey",
|
|
347
|
+
value: function setCustomKey(key, val) {
|
|
348
|
+
this.customParams[key] = val;
|
|
349
|
+
// 备份到metadata
|
|
350
|
+
// 备份到metadata
|
|
351
|
+
this.metadata['customParams'] = this.customParams;
|
|
352
|
+
}
|
|
353
|
+
}, {
|
|
354
|
+
key: "toJSON",
|
|
355
|
+
value:
|
|
356
|
+
/**
|
|
357
|
+
* Serialize the model to JSON.
|
|
358
|
+
*/
|
|
359
|
+
function toJSON() {
|
|
360
|
+
return {
|
|
361
|
+
metadata: this.metadata,
|
|
362
|
+
nbformat_minor: this.nbformat_minor,
|
|
363
|
+
nbformat: this.nbformat,
|
|
364
|
+
cells: this.getCells().map(function (item) {
|
|
365
|
+
return item.toJSON();
|
|
366
|
+
})
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Deserialize the model from JSON.
|
|
372
|
+
*
|
|
373
|
+
* #### Notes
|
|
374
|
+
* Should emit a [contentChanged] signal.
|
|
375
|
+
*/
|
|
376
|
+
}, {
|
|
377
|
+
key: "fromJSON",
|
|
378
|
+
value: function fromJSON(value) {
|
|
379
|
+
var _this2 = this;
|
|
380
|
+
this.sharedModel.transact(function () {
|
|
381
|
+
var useId = value.nbformat === 4 && value.nbformat_minor >= 5;
|
|
382
|
+
var ycells = value.cells.map(function (cell) {
|
|
383
|
+
if (!useId) {
|
|
384
|
+
delete cell.id;
|
|
385
|
+
}
|
|
386
|
+
return cell;
|
|
387
|
+
});
|
|
388
|
+
if (!ycells.length) {
|
|
389
|
+
// Create cell when notebook is empty
|
|
390
|
+
// (non collaborative)
|
|
391
|
+
ycells.push({
|
|
392
|
+
cell_type: 'code'
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
_this2.sharedModel.insertCells(_this2.sharedModel.cells.length, ycells);
|
|
396
|
+
_this2.sharedModel.deleteCellRange(0, _this2.sharedModel.cells.length);
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
}, {
|
|
400
|
+
key: "onChange",
|
|
401
|
+
value: function onChange() {
|
|
402
|
+
this.version++;
|
|
403
|
+
this.dirty = true;
|
|
404
|
+
this.onChangedEmitter.fire(true);
|
|
405
|
+
}
|
|
406
|
+
}, {
|
|
407
|
+
key: "onSourceChange",
|
|
408
|
+
value: function onSourceChange() {
|
|
409
|
+
this.dirty = true;
|
|
410
|
+
this.onSourceChangedEmitter.fire(true);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* override this method to load notebook from server
|
|
415
|
+
* @returns
|
|
416
|
+
*/
|
|
417
|
+
}, {
|
|
418
|
+
key: "loadNotebookContent",
|
|
419
|
+
value: (function () {
|
|
420
|
+
var _loadNotebookContent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
421
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
422
|
+
while (1) switch (_context.prev = _context.next) {
|
|
423
|
+
case 0:
|
|
424
|
+
return _context.abrupt("return", this.libroContentService.loadLibroContent(this.options, this));
|
|
425
|
+
case 1:
|
|
426
|
+
case "end":
|
|
427
|
+
return _context.stop();
|
|
428
|
+
}
|
|
429
|
+
}, _callee, this);
|
|
430
|
+
}));
|
|
431
|
+
function loadNotebookContent() {
|
|
432
|
+
return _loadNotebookContent.apply(this, arguments);
|
|
433
|
+
}
|
|
434
|
+
return loadNotebookContent;
|
|
435
|
+
}())
|
|
436
|
+
}, {
|
|
437
|
+
key: "saveNotebookContent",
|
|
438
|
+
value: function () {
|
|
439
|
+
var _saveNotebookContent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
440
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
441
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
442
|
+
case 0:
|
|
443
|
+
return _context2.abrupt("return", this.libroContentService.saveLibroContent(this.options, this));
|
|
444
|
+
case 1:
|
|
445
|
+
case "end":
|
|
446
|
+
return _context2.stop();
|
|
447
|
+
}
|
|
448
|
+
}, _callee2, this);
|
|
449
|
+
}));
|
|
450
|
+
function saveNotebookContent() {
|
|
451
|
+
return _saveNotebookContent.apply(this, arguments);
|
|
452
|
+
}
|
|
453
|
+
return saveNotebookContent;
|
|
454
|
+
}()
|
|
455
|
+
}, {
|
|
456
|
+
key: "initialize",
|
|
457
|
+
value: function () {
|
|
458
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
459
|
+
var _this3 = this,
|
|
460
|
+
_this$metadata,
|
|
461
|
+
_this$metadata3;
|
|
462
|
+
var content, _this$metadata2, _this$metadata4;
|
|
463
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
464
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
465
|
+
case 0:
|
|
466
|
+
this.cells = [];
|
|
467
|
+
getOrigin(this.sharedModel).transact(function () {
|
|
468
|
+
_this3.sharedModel.deleteCellRange(0, _this3.sharedModel.cells.length);
|
|
469
|
+
});
|
|
470
|
+
_context3.next = 4;
|
|
471
|
+
return this.loadNotebookContent();
|
|
472
|
+
case 4:
|
|
473
|
+
content = _context3.sent;
|
|
474
|
+
this.metadata = content.metadata;
|
|
475
|
+
if ((_this$metadata = this.metadata) !== null && _this$metadata !== void 0 && _this$metadata['customParams']) {
|
|
476
|
+
this.customParams = (_this$metadata2 = this.metadata) === null || _this$metadata2 === void 0 ? void 0 : _this$metadata2['customParams'];
|
|
477
|
+
}
|
|
478
|
+
if ((_this$metadata3 = this.metadata) !== null && _this$metadata3 !== void 0 && _this$metadata3['trusted']) {
|
|
479
|
+
this.trusted = (_this$metadata4 = this.metadata) === null || _this$metadata4 === void 0 ? void 0 : _this$metadata4['trusted'];
|
|
480
|
+
}
|
|
481
|
+
this.nbformat = content.nbformat;
|
|
482
|
+
this.nbformat_minor = content.nbformat_minor;
|
|
483
|
+
return _context3.abrupt("return", content.cells.map(function (cell) {
|
|
484
|
+
return {
|
|
485
|
+
cell: cell
|
|
486
|
+
};
|
|
487
|
+
}));
|
|
488
|
+
case 11:
|
|
489
|
+
case "end":
|
|
490
|
+
return _context3.stop();
|
|
491
|
+
}
|
|
492
|
+
}, _callee3, this);
|
|
493
|
+
}));
|
|
494
|
+
function initialize() {
|
|
495
|
+
return _initialize.apply(this, arguments);
|
|
496
|
+
}
|
|
497
|
+
return initialize;
|
|
498
|
+
}()
|
|
499
|
+
}, {
|
|
500
|
+
key: "toCellIndex",
|
|
501
|
+
value: function toCellIndex(arg) {
|
|
502
|
+
var index = undefined;
|
|
503
|
+
if (typeof arg === 'number') {
|
|
504
|
+
index = arg;
|
|
505
|
+
} else if (typeof arg === 'string') {
|
|
506
|
+
index = this.cells.findIndex(function (cell) {
|
|
507
|
+
return cell.id === arg;
|
|
508
|
+
});
|
|
509
|
+
} else if (isCellView(arg)) {
|
|
510
|
+
index = this.cells.findIndex(function (cell) {
|
|
511
|
+
return cell.id === arg.id;
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
return index;
|
|
515
|
+
}
|
|
516
|
+
}, {
|
|
517
|
+
key: "scrollToView",
|
|
518
|
+
value:
|
|
519
|
+
/**
|
|
520
|
+
* 自动滚动到可视范围内
|
|
521
|
+
*/
|
|
522
|
+
function scrollToView(cell) {
|
|
523
|
+
var _target, _target2, _target7;
|
|
524
|
+
var cellOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
525
|
+
var virtualizedManager = this.virtualizedManagerHelper.getOrCreate(this);
|
|
526
|
+
if (virtualizedManager.isVirtualized) {
|
|
527
|
+
var cellIndex = this.cells.findIndex(function (_cell) {
|
|
528
|
+
return _cell.id === cell.id;
|
|
529
|
+
});
|
|
530
|
+
this.scrollToCellViewEmitter.fire({
|
|
531
|
+
cellIndex: cellIndex,
|
|
532
|
+
cellOffset: cellOffset
|
|
533
|
+
});
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
var target = document.getElementById(cell.id);
|
|
537
|
+
if (!target) {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
var _targetheight = ((_target = target) === null || _target === void 0 ? void 0 : _target.offsetHeight) || 0;
|
|
541
|
+
var offsetTop = (((_target2 = target) === null || _target2 === void 0 ? void 0 : _target2.offsetTop) || 0) + cellOffset;
|
|
542
|
+
while ((_target3 = target) !== null && _target3 !== void 0 && _target3.offsetParent && !((_target4 = target) !== null && _target4 !== void 0 && (_target4 = _target4.offsetParent) !== null && _target4 !== void 0 && (_target4 = _target4.className) !== null && _target4 !== void 0 && _target4.includes('libro-view-content-left'))) {
|
|
543
|
+
var _target3, _target4, _target5, _target6;
|
|
544
|
+
target = (_target5 = target) === null || _target5 === void 0 ? void 0 : _target5.offsetParent;
|
|
545
|
+
offsetTop += ((_target6 = target) === null || _target6 === void 0 ? void 0 : _target6.offsetTop) || 0;
|
|
546
|
+
}
|
|
547
|
+
if ((_target7 = target) !== null && _target7 !== void 0 && (_target7 = _target7.offsetParent) !== null && _target7 !== void 0 && _target7.parentElement && _targetheight) {
|
|
548
|
+
var _height = target.offsetParent.parentElement.clientHeight;
|
|
549
|
+
var _scrollTop = target.offsetParent.parentElement.scrollTop;
|
|
550
|
+
if (offsetTop > _scrollTop && offsetTop + _targetheight < _height + _scrollTop) {
|
|
551
|
+
// 在可视范围内就不需要滚动
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
if (offsetTop < _scrollTop) {
|
|
555
|
+
target.offsetParent.parentElement.scrollTop = offsetTop;
|
|
556
|
+
} else {
|
|
557
|
+
//目标cell的高度大于屏幕的高度
|
|
558
|
+
if (_targetheight >= _height) {
|
|
559
|
+
target.offsetParent.parentElement.scrollTop = offsetTop - _height / 2;
|
|
560
|
+
} else {
|
|
561
|
+
target.offsetParent.parentElement.scrollTop = offsetTop + _targetheight - _height + 30; // 加缓冲向上不贴底部
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}, {
|
|
567
|
+
key: "removeRange",
|
|
568
|
+
value: function removeRange(start, end) {
|
|
569
|
+
// this.cells.splice(start, end - start);
|
|
570
|
+
// 不使用splice的写法,除非设置了 ObservableConfig.async = true
|
|
571
|
+
var arr = _toConsumableArray(this.cells);
|
|
572
|
+
arr.splice(start, end - start);
|
|
573
|
+
this.cells = arr;
|
|
574
|
+
}
|
|
575
|
+
}, {
|
|
576
|
+
key: "deleteCell",
|
|
577
|
+
value: function deleteCell(arg) {
|
|
578
|
+
var _this4 = this;
|
|
579
|
+
var index = this.toCellIndex(arg);
|
|
580
|
+
if (index === undefined) {
|
|
581
|
+
return false;
|
|
582
|
+
}
|
|
583
|
+
if (this.activeIndex === this.cells.length - 1) {
|
|
584
|
+
this.activeIndex = this.cells.length - 2;
|
|
585
|
+
} else {
|
|
586
|
+
this.activeIndex = index;
|
|
587
|
+
}
|
|
588
|
+
this.isEditMode = false;
|
|
589
|
+
getOrigin(this.sharedModel).transact(function () {
|
|
590
|
+
getOrigin(_this4.sharedModel).deleteCell(index);
|
|
591
|
+
});
|
|
592
|
+
return true;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* 删除 cell 节点
|
|
597
|
+
* @param arg id、index、cell
|
|
598
|
+
* @returns
|
|
599
|
+
*/
|
|
600
|
+
}, {
|
|
601
|
+
key: "deleteCellView",
|
|
602
|
+
value: function deleteCellView(arg) {
|
|
603
|
+
var _this$active2;
|
|
604
|
+
if (arg === ((_this$active2 = this.active) === null || _this$active2 === void 0 ? void 0 : _this$active2.id)) {
|
|
605
|
+
// 如果删除项正好是选中项,则清空active
|
|
606
|
+
this.active = undefined;
|
|
607
|
+
}
|
|
608
|
+
return this.doDeleteCell(arg);
|
|
609
|
+
}
|
|
610
|
+
}, {
|
|
611
|
+
key: "exchangeCell",
|
|
612
|
+
value: function exchangeCell(source, target) {
|
|
613
|
+
var _this5 = this;
|
|
614
|
+
var sourceIndex = this.toCellIndex(source);
|
|
615
|
+
var targetIndex = this.toCellIndex(target);
|
|
616
|
+
if (sourceIndex === undefined || targetIndex === undefined) {
|
|
617
|
+
return false;
|
|
618
|
+
}
|
|
619
|
+
this.activeIndex = targetIndex;
|
|
620
|
+
this.isEditMode = false;
|
|
621
|
+
getOrigin(this.sharedModel).transact(function () {
|
|
622
|
+
getOrigin(_this5.sharedModel).moveCell(sourceIndex, targetIndex);
|
|
623
|
+
});
|
|
624
|
+
this.activeIndex = targetIndex;
|
|
625
|
+
return true;
|
|
626
|
+
}
|
|
627
|
+
}, {
|
|
628
|
+
key: "exchangeCells",
|
|
629
|
+
value: function exchangeCells(source, targetIndex) {
|
|
630
|
+
var _this6 = this;
|
|
631
|
+
var startIndex = this.toCellIndex(source[0]);
|
|
632
|
+
var endIndex = this.toCellIndex(source[source.length - 1]);
|
|
633
|
+
if (startIndex === undefined || endIndex === undefined) {
|
|
634
|
+
return false;
|
|
635
|
+
}
|
|
636
|
+
this.isEditMode = false;
|
|
637
|
+
var cellData = source.map(function (cell) {
|
|
638
|
+
_this6.cellViewCache.set(cell.model.id, cell);
|
|
639
|
+
return cell.toJSON();
|
|
640
|
+
});
|
|
641
|
+
getOrigin(this.sharedModel).transact(function () {
|
|
642
|
+
if (targetIndex > endIndex) {
|
|
643
|
+
//往下交换cell
|
|
644
|
+
if (startIndex === _this6.activeIndex) {
|
|
645
|
+
//active在头
|
|
646
|
+
_this6.activeIndex = targetIndex - source.length;
|
|
647
|
+
} else {
|
|
648
|
+
//active在头尾
|
|
649
|
+
_this6.activeIndex = targetIndex - 1;
|
|
650
|
+
}
|
|
651
|
+
getOrigin(_this6.sharedModel).deleteCellRange(startIndex, endIndex + 1);
|
|
652
|
+
getOrigin(_this6.sharedModel).insertCells(targetIndex - source.length, cellData);
|
|
653
|
+
} else {
|
|
654
|
+
//往上交换cell
|
|
655
|
+
if (startIndex === _this6.activeIndex) {
|
|
656
|
+
//active在头
|
|
657
|
+
_this6.activeIndex = targetIndex - source.length;
|
|
658
|
+
} else {
|
|
659
|
+
//active在尾
|
|
660
|
+
_this6.activeIndex = targetIndex + 1;
|
|
661
|
+
}
|
|
662
|
+
getOrigin(_this6.sharedModel).deleteCellRange(startIndex, endIndex + 1);
|
|
663
|
+
getOrigin(_this6.sharedModel).insertCells(targetIndex, cellData);
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
return true;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* 交换 cell 节点位置
|
|
671
|
+
* @param source id、index、cell
|
|
672
|
+
* @param target id、index、cell
|
|
673
|
+
* @returns
|
|
674
|
+
*/
|
|
675
|
+
}, {
|
|
676
|
+
key: "exchangeCellView",
|
|
677
|
+
value: function exchangeCellView(source, target) {
|
|
678
|
+
var _this7 = this;
|
|
679
|
+
var sourceIndex = this.toCellIndex(source);
|
|
680
|
+
var targetIndex = this.toCellIndex(target);
|
|
681
|
+
if (sourceIndex !== undefined && targetIndex !== undefined) {
|
|
682
|
+
// 交换位置
|
|
683
|
+
var sourceItem = this.cells[sourceIndex];
|
|
684
|
+
var cells = _toConsumableArray(this.cells);
|
|
685
|
+
cells.splice(sourceIndex, 1);
|
|
686
|
+
cells.splice(targetIndex, 0, sourceItem);
|
|
687
|
+
this.cells = cells;
|
|
688
|
+
setTimeout(function () {
|
|
689
|
+
// 上下移动也需要调整可视区域范围
|
|
690
|
+
_this7.scrollToView(sourceItem);
|
|
691
|
+
}, 300);
|
|
692
|
+
return true;
|
|
693
|
+
}
|
|
694
|
+
return false;
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* 进入命令模式
|
|
698
|
+
*/
|
|
699
|
+
}, {
|
|
700
|
+
key: "enterCommandMode",
|
|
701
|
+
value: function enterCommandMode() {
|
|
702
|
+
if (this.active) {
|
|
703
|
+
this.commandMode = true;
|
|
704
|
+
this.onCommandModeChangedEmitter.fire(true);
|
|
705
|
+
this.active.blur();
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
}, {
|
|
709
|
+
key: "enterEditMode",
|
|
710
|
+
value: function enterEditMode() {
|
|
711
|
+
if (this.active) {
|
|
712
|
+
if (this.selections.length !== 0) {
|
|
713
|
+
this.selections = [];
|
|
714
|
+
}
|
|
715
|
+
this.commandMode = false;
|
|
716
|
+
this.onCommandModeChangedEmitter.fire(false);
|
|
717
|
+
this.active.focus(true);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
}, {
|
|
721
|
+
key: "undo",
|
|
722
|
+
value: function undo() {
|
|
723
|
+
getOrigin(this.sharedModel).undo();
|
|
724
|
+
}
|
|
725
|
+
}, {
|
|
726
|
+
key: "redo",
|
|
727
|
+
value: function redo() {
|
|
728
|
+
getOrigin(this.sharedModel).redo();
|
|
729
|
+
}
|
|
730
|
+
}]);
|
|
731
|
+
return LibroModel;
|
|
732
|
+
}(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "options", [_dec2], {
|
|
733
|
+
configurable: true,
|
|
734
|
+
enumerable: true,
|
|
735
|
+
writable: true,
|
|
736
|
+
initializer: null
|
|
737
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "libroContentService", [_dec3], {
|
|
738
|
+
configurable: true,
|
|
739
|
+
enumerable: true,
|
|
740
|
+
writable: true,
|
|
741
|
+
initializer: null
|
|
742
|
+
}), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "virtualizedManagerHelper", [_dec4], {
|
|
743
|
+
configurable: true,
|
|
744
|
+
enumerable: true,
|
|
745
|
+
writable: true,
|
|
746
|
+
initializer: null
|
|
747
|
+
}), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "configurationService", [_dec5], {
|
|
748
|
+
configurable: true,
|
|
749
|
+
enumerable: true,
|
|
750
|
+
writable: true,
|
|
751
|
+
initializer: null
|
|
752
|
+
}), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "lastClipboardInteraction", [_dec6], {
|
|
753
|
+
configurable: true,
|
|
754
|
+
enumerable: true,
|
|
755
|
+
writable: true,
|
|
756
|
+
initializer: null
|
|
757
|
+
}), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "inputEditable", [_dec7], {
|
|
758
|
+
configurable: true,
|
|
759
|
+
enumerable: true,
|
|
760
|
+
writable: true,
|
|
761
|
+
initializer: function initializer() {
|
|
762
|
+
return true;
|
|
763
|
+
}
|
|
764
|
+
}), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "outputEditable", [_dec8], {
|
|
765
|
+
configurable: true,
|
|
766
|
+
enumerable: true,
|
|
767
|
+
writable: true,
|
|
768
|
+
initializer: function initializer() {
|
|
769
|
+
return true;
|
|
770
|
+
}
|
|
771
|
+
}), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "cellsEditable", [_dec9], {
|
|
772
|
+
configurable: true,
|
|
773
|
+
enumerable: true,
|
|
774
|
+
writable: true,
|
|
775
|
+
initializer: function initializer() {
|
|
776
|
+
return true;
|
|
777
|
+
}
|
|
778
|
+
}), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, "savable", [_dec10], {
|
|
779
|
+
configurable: true,
|
|
780
|
+
enumerable: true,
|
|
781
|
+
writable: true,
|
|
782
|
+
initializer: function initializer() {
|
|
783
|
+
return true;
|
|
784
|
+
}
|
|
785
|
+
}), _descriptor10 = _applyDecoratedDescriptor(_class2.prototype, "runnable", [_dec11], {
|
|
786
|
+
configurable: true,
|
|
787
|
+
enumerable: true,
|
|
788
|
+
writable: true,
|
|
789
|
+
initializer: function initializer() {
|
|
790
|
+
return true;
|
|
791
|
+
}
|
|
792
|
+
}), _descriptor11 = _applyDecoratedDescriptor(_class2.prototype, "commandMode", [_dec12], {
|
|
793
|
+
configurable: true,
|
|
794
|
+
enumerable: true,
|
|
795
|
+
writable: true,
|
|
796
|
+
initializer: function initializer() {
|
|
797
|
+
return true;
|
|
798
|
+
}
|
|
799
|
+
}), _descriptor12 = _applyDecoratedDescriptor(_class2.prototype, "isEditMode", [_dec13], {
|
|
800
|
+
configurable: true,
|
|
801
|
+
enumerable: true,
|
|
802
|
+
writable: true,
|
|
803
|
+
initializer: function initializer() {
|
|
804
|
+
return true;
|
|
805
|
+
}
|
|
806
|
+
}), _descriptor13 = _applyDecoratedDescriptor(_class2.prototype, "dndAreaNullEnable", [_dec14], {
|
|
807
|
+
configurable: true,
|
|
808
|
+
enumerable: true,
|
|
809
|
+
writable: true,
|
|
810
|
+
initializer: function initializer() {
|
|
811
|
+
return false;
|
|
812
|
+
}
|
|
813
|
+
}), _descriptor14 = _applyDecoratedDescriptor(_class2.prototype, "dirty", [_dec15], {
|
|
814
|
+
configurable: true,
|
|
815
|
+
enumerable: true,
|
|
816
|
+
writable: true,
|
|
817
|
+
initializer: function initializer() {
|
|
818
|
+
return false;
|
|
819
|
+
}
|
|
820
|
+
}), _descriptor15 = _applyDecoratedDescriptor(_class2.prototype, "cells", [_dec16], {
|
|
821
|
+
configurable: true,
|
|
822
|
+
enumerable: true,
|
|
823
|
+
writable: true,
|
|
824
|
+
initializer: function initializer() {
|
|
825
|
+
return [];
|
|
826
|
+
}
|
|
827
|
+
}), _descriptor16 = _applyDecoratedDescriptor(_class2.prototype, "active", [_dec17], {
|
|
828
|
+
configurable: true,
|
|
829
|
+
enumerable: true,
|
|
830
|
+
writable: true,
|
|
831
|
+
initializer: null
|
|
832
|
+
}), _descriptor17 = _applyDecoratedDescriptor(_class2.prototype, "activeIndex", [_dec18], {
|
|
833
|
+
configurable: true,
|
|
834
|
+
enumerable: true,
|
|
835
|
+
writable: true,
|
|
836
|
+
initializer: function initializer() {
|
|
837
|
+
return 0;
|
|
838
|
+
}
|
|
839
|
+
}), _descriptor18 = _applyDecoratedDescriptor(_class2.prototype, "hover", [_dec19], {
|
|
840
|
+
configurable: true,
|
|
841
|
+
enumerable: true,
|
|
842
|
+
writable: true,
|
|
843
|
+
initializer: function initializer() {
|
|
844
|
+
return undefined;
|
|
845
|
+
}
|
|
846
|
+
}), _descriptor19 = _applyDecoratedDescriptor(_class2.prototype, "isInitialized", [_dec20], {
|
|
847
|
+
configurable: true,
|
|
848
|
+
enumerable: true,
|
|
849
|
+
writable: true,
|
|
850
|
+
initializer: function initializer() {
|
|
851
|
+
return false;
|
|
852
|
+
}
|
|
853
|
+
}), _descriptor20 = _applyDecoratedDescriptor(_class2.prototype, "executeCount", [_dec21], {
|
|
854
|
+
configurable: true,
|
|
855
|
+
enumerable: true,
|
|
856
|
+
writable: true,
|
|
857
|
+
initializer: function initializer() {
|
|
858
|
+
return 0;
|
|
859
|
+
}
|
|
860
|
+
}), _descriptor21 = _applyDecoratedDescriptor(_class2.prototype, "mouseMode", [_dec22], {
|
|
861
|
+
configurable: true,
|
|
862
|
+
enumerable: true,
|
|
863
|
+
writable: true,
|
|
864
|
+
initializer: null
|
|
865
|
+
}), _descriptor22 = _applyDecoratedDescriptor(_class2.prototype, "selections", [_dec23], {
|
|
866
|
+
configurable: true,
|
|
867
|
+
enumerable: true,
|
|
868
|
+
writable: true,
|
|
869
|
+
initializer: function initializer() {
|
|
870
|
+
return [];
|
|
871
|
+
}
|
|
872
|
+
}), _descriptor23 = _applyDecoratedDescriptor(_class2.prototype, "customParams", [_dec24], {
|
|
873
|
+
configurable: true,
|
|
874
|
+
enumerable: true,
|
|
875
|
+
writable: true,
|
|
876
|
+
initializer: function initializer() {
|
|
877
|
+
return {};
|
|
878
|
+
}
|
|
879
|
+
}), _descriptor24 = _applyDecoratedDescriptor(_class2.prototype, "libroViewClass", [_dec25], {
|
|
880
|
+
configurable: true,
|
|
881
|
+
enumerable: true,
|
|
882
|
+
writable: true,
|
|
883
|
+
initializer: function initializer() {
|
|
884
|
+
return '';
|
|
885
|
+
}
|
|
886
|
+
}), _descriptor25 = _applyDecoratedDescriptor(_class2.prototype, "canUndo", [_dec26], {
|
|
887
|
+
configurable: true,
|
|
888
|
+
enumerable: true,
|
|
889
|
+
writable: true,
|
|
890
|
+
initializer: function initializer() {
|
|
891
|
+
return false;
|
|
892
|
+
}
|
|
893
|
+
}), _descriptor26 = _applyDecoratedDescriptor(_class2.prototype, "canRedo", [_dec27], {
|
|
894
|
+
configurable: true,
|
|
895
|
+
enumerable: true,
|
|
896
|
+
writable: true,
|
|
897
|
+
initializer: function initializer() {
|
|
898
|
+
return false;
|
|
899
|
+
}
|
|
900
|
+
}), _descriptor27 = _applyDecoratedDescriptor(_class2.prototype, "trusted", [_dec28], {
|
|
901
|
+
configurable: true,
|
|
902
|
+
enumerable: true,
|
|
903
|
+
writable: true,
|
|
904
|
+
initializer: function initializer() {
|
|
905
|
+
return true;
|
|
906
|
+
}
|
|
907
|
+
}), _descriptor28 = _applyDecoratedDescriptor(_class2.prototype, "fontSize", [_dec29], {
|
|
908
|
+
configurable: true,
|
|
909
|
+
enumerable: true,
|
|
910
|
+
writable: true,
|
|
911
|
+
initializer: function initializer() {
|
|
912
|
+
return 12;
|
|
913
|
+
}
|
|
914
|
+
}), _descriptor29 = _applyDecoratedDescriptor(_class2.prototype, "theme", [_dec30], {
|
|
915
|
+
configurable: true,
|
|
916
|
+
enumerable: true,
|
|
917
|
+
writable: true,
|
|
918
|
+
initializer: function initializer() {
|
|
919
|
+
return '';
|
|
920
|
+
}
|
|
921
|
+
})), _class2)) || _class);
|