@difizen/libro-core 0.1.0 → 0.1.2
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/es/add-cell/index.less +1 -1
- package/es/add-cell/libro-add-cell-slot-contribution.d.ts +1 -2
- package/es/add-cell/libro-add-cell-slot-contribution.d.ts.map +1 -1
- package/es/add-cell/libro-add-cell-slot-contribution.js +12 -6
- package/es/add-cell/libro-add-cell-view.d.ts +4 -4
- package/es/add-cell/libro-add-cell-view.d.ts.map +1 -1
- package/es/add-cell/libro-add-cell-view.js +4 -6
- package/es/cell/libro-cell-contribution.d.ts +1 -2
- package/es/cell/libro-cell-contribution.d.ts.map +1 -1
- package/es/cell/libro-cell-contribution.js +14 -8
- package/es/cell/libro-cell-model.d.ts +9 -0
- package/es/cell/libro-cell-model.d.ts.map +1 -1
- package/es/cell/libro-cell-model.js +53 -11
- package/es/cell/libro-cell-protocol.d.ts +2 -0
- package/es/cell/libro-cell-protocol.d.ts.map +1 -1
- package/es/cell/libro-cell-view.d.ts +39 -3
- package/es/cell/libro-cell-view.d.ts.map +1 -1
- package/es/cell/libro-cell-view.js +54 -24
- package/es/cell/libro-edit-cell-view.d.ts +6 -12
- package/es/cell/libro-edit-cell-view.d.ts.map +1 -1
- package/es/cell/libro-edit-cell-view.js +9 -4
- package/es/cell/libro-executable-cell-view.d.ts +2 -0
- package/es/cell/libro-executable-cell-view.d.ts.map +1 -1
- package/es/cell/libro-executable-cell-view.js +4 -1
- package/es/collapse-service.d.ts +1 -1
- package/es/collapse-service.d.ts.map +1 -1
- package/es/collapse-service.js +1 -1
- 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 +3 -2
- 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 +3 -0
- package/es/command/libro-command-contribution.d.ts +0 -1
- package/es/command/libro-command-contribution.d.ts.map +1 -1
- package/es/command/libro-command-contribution.js +179 -129
- package/es/command/libro-command-register.d.ts +0 -1
- package/es/command/libro-command-register.d.ts.map +1 -1
- package/es/command/libro-command-register.js +13 -7
- 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 +17 -4
- package/es/components/cell-protocol.d.ts +5 -5
- package/es/components/cell-protocol.d.ts.map +1 -1
- package/es/components/dnd-cell-item-render.d.ts +6 -2
- package/es/components/dnd-cell-item-render.d.ts.map +1 -1
- package/es/components/dnd-cell-item-render.js +194 -89
- package/es/components/dnd-component/custom-drag-layer.d.ts +1 -1
- package/es/components/dnd-component/custom-drag-layer.d.ts.map +1 -1
- package/es/components/dnd-component/custom-drag-layer.js +3 -4
- package/es/components/dnd-component/default-dnd-content.d.ts +2 -1
- package/es/components/dnd-component/default-dnd-content.d.ts.map +1 -1
- package/es/components/dnd-component/default-dnd-content.js +100 -44
- package/es/components/dnd-component/dnd-context.js +1 -1
- package/es/components/dnd-component/dnd-list.d.ts +9 -5
- package/es/components/dnd-component/dnd-list.d.ts.map +1 -1
- package/es/components/dnd-component/dnd-list.js +93 -26
- package/es/components/dnd-component/index.d.ts +1 -1
- package/es/components/dnd-component/index.d.ts.map +1 -1
- package/es/components/dnd-component/index.js +2 -2
- 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 +2 -2
- package/es/components/index.d.ts.map +1 -1
- package/es/components/index.js +2 -2
- 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 +1 -0
- package/es/content/index.d.ts.map +1 -1
- package/es/content/index.js +2 -1
- package/es/content/libro-content-contribution.d.ts +2 -2
- package/es/content/libro-content-contribution.d.ts.map +1 -1
- package/es/content/libro-content-contribution.js +2 -3
- package/es/content/libro-content-module.d.ts.map +1 -1
- package/es/content/libro-content-module.js +3 -2
- package/es/content/libro-content-protocol.d.ts +5 -0
- package/es/content/libro-content-protocol.d.ts.map +1 -1
- package/es/content/libro-content-protocol.js +2 -1
- package/es/content/libro-content-service.d.ts +6 -4
- package/es/content/libro-content-service.d.ts.map +1 -1
- package/es/content/libro-content-service.js +36 -8
- 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 +5 -1
- package/es/index.d.ts.map +1 -1
- package/es/index.js +6 -2
- package/es/index.less +135 -58
- package/es/libro-context-key.d.ts.map +1 -1
- package/es/libro-keybind-registry.d.ts +5 -0
- package/es/libro-keybind-registry.d.ts.map +1 -0
- package/es/libro-model.d.ts +13 -2
- package/es/libro-model.d.ts.map +1 -1
- package/es/libro-model.js +149 -70
- package/es/libro-protocol.d.ts +44 -2
- package/es/libro-protocol.d.ts.map +1 -1
- package/es/libro-protocol.js +16 -3
- package/es/libro-service.d.ts +1 -1
- package/es/libro-service.d.ts.map +1 -1
- package/es/libro-service.js +29 -20
- package/es/libro-setting-contribution.d.ts +5 -0
- package/es/libro-setting-contribution.d.ts.map +1 -0
- package/es/{configuration/libro-configuration-contribution.js → libro-setting-contribution.js} +8 -9
- package/es/libro-setting.d.ts +11 -0
- package/es/libro-setting.d.ts.map +1 -0
- package/es/{configuration/libro-configuration.js → libro-setting.js} +17 -7
- package/es/libro-view.d.ts +21 -8
- package/es/libro-view.d.ts.map +1 -1
- package/es/libro-view.js +477 -338
- package/es/material-from-designer.d.ts +30 -0
- package/es/material-from-designer.d.ts.map +1 -0
- package/es/material-from-designer.js +112 -1
- package/es/module.d.ts.map +1 -1
- package/es/module.js +20 -5
- package/es/output/output-area.d.ts +3 -4
- package/es/output/output-area.d.ts.map +1 -1
- package/es/output/output-area.js +23 -16
- package/es/output/output-contribution.d.ts +0 -1
- package/es/output/output-contribution.d.ts.map +1 -1
- package/es/output/output-contribution.js +14 -9
- package/es/output/output-model.d.ts +2 -2
- package/es/output/output-model.d.ts.map +1 -1
- package/es/output/output-model.js +2 -2
- package/es/output/output-protocol.d.ts.map +1 -1
- package/es/output/output-protocol.js +0 -2
- 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 +7 -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 +88 -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/libro-slot-manager.d.ts +2 -2
- package/es/slot/libro-slot-manager.d.ts.map +1 -1
- package/es/slot/libro-slot-manager.js +14 -8
- package/es/slot/libro-slot-view.d.ts +3 -3
- package/es/slot/libro-slot-view.d.ts.map +1 -1
- package/es/slot/libro-slot-view.js +2 -2
- 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 +7 -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/libro-toolbar.d.ts +2 -1
- package/es/toolbar/libro-toolbar.d.ts.map +1 -1
- package/es/toolbar/libro-toolbar.js +44 -8
- package/es/toolbar/restart-clear-outputs-modal.d.ts +1 -2
- package/es/toolbar/restart-clear-outputs-modal.d.ts.map +1 -1
- package/es/toolbar/restart-clear-outputs-modal.js +2 -2
- package/es/toolbar/shutdown-modal.d.ts +1 -2
- package/es/toolbar/shutdown-modal.d.ts.map +1 -1
- package/es/toolbar/shutdown-modal.js +2 -2
- package/es/toolbar/side-toolar-more-select.d.ts.map +1 -1
- package/es/toolbar/side-toolar-more-select.js +2 -2
- 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 +19 -0
- package/es/virtualized-manager.d.ts.map +1 -0
- package/es/virtualized-manager.js +61 -0
- package/package.json +9 -6
- package/src/add-cell/index.less +1 -1
- package/src/add-cell/libro-add-cell-slot-contribution.ts +1 -4
- package/src/add-cell/libro-add-cell-view.tsx +13 -6
- package/src/cell/libro-cell-contribution.ts +2 -6
- package/src/cell/libro-cell-model.ts +57 -4
- package/src/cell/libro-cell-protocol.ts +2 -0
- package/src/cell/libro-cell-view.tsx +21 -9
- package/src/cell/libro-edit-cell-view.tsx +10 -9
- package/src/cell/libro-executable-cell-view.ts +6 -1
- package/src/collapse-service.ts +1 -1
- package/src/command/document-commands.ts +3 -5
- package/src/command/kernel-command.ts +3 -0
- package/src/command/libro-command-contribution.ts +107 -91
- package/src/command/libro-command-register.ts +1 -4
- package/src/command/notebook-commands.ts +16 -3
- package/src/components/cell-protocol.ts +5 -5
- package/src/components/dnd-cell-item-render.tsx +239 -92
- package/src/components/dnd-component/custom-drag-layer.tsx +5 -6
- package/src/components/dnd-component/default-dnd-content.tsx +113 -42
- package/src/components/dnd-component/dnd-context.tsx +1 -1
- package/src/components/dnd-component/dnd-list.tsx +135 -43
- package/src/components/dnd-component/index.less +8 -0
- package/src/components/dnd-component/index.tsx +1 -1
- 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 +2 -2
- package/src/components/libro-virtualized-render.tsx +178 -0
- package/src/content/index.ts +1 -0
- package/src/content/libro-content-contribution.ts +2 -3
- package/src/content/libro-content-module.ts +11 -3
- package/src/content/libro-content-protocol.ts +6 -0
- package/src/content/libro-content-service.ts +26 -8
- 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 +135 -58
- package/src/index.tsx +6 -1
- package/src/libro-context-key.ts +3 -3
- package/src/libro-model.ts +87 -23
- package/src/libro-protocol.ts +81 -4
- package/src/libro-service.ts +4 -13
- package/src/{configuration/libro-configuration-contribution.ts → libro-setting-contribution.ts} +7 -8
- package/src/{configuration/libro-configuration.ts → libro-setting.ts} +18 -7
- package/src/libro-view.tsx +273 -141
- package/src/material-from-designer.tsx +93 -1
- package/src/module.ts +29 -7
- package/src/output/output-area.tsx +18 -12
- package/src/output/output-contribution.ts +2 -6
- package/src/output/output-model.tsx +3 -3
- package/src/output/output-protocol.ts +0 -1
- 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 +50 -0
- package/src/settings/settings-protocol.ts +7 -0
- package/src/slot/libro-slot-manager.ts +1 -3
- package/src/slot/libro-slot-view.tsx +2 -5
- package/src/theme/libro-color-registry.ts +6 -0
- package/src/toolbar/all-outputs-scroll-icon.tsx +19 -0
- package/src/toolbar/libro-toolbar.tsx +30 -5
- package/src/toolbar/restart-clear-outputs-modal.tsx +3 -3
- package/src/toolbar/shutdown-modal.tsx +3 -3
- package/src/toolbar/side-toolar-more-select.tsx +2 -1
- package/src/virtualized-manager-helper.ts +29 -0
- package/src/virtualized-manager.ts +34 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import 'resize-observer-polyfill';
|
|
2
3
|
import type { CellView, DndContentProps } from '../../libro-protocol.js';
|
|
3
4
|
import { BetweenCellProvider } from '../cell-protocol.js';
|
|
4
5
|
export interface Dragparams {
|
|
5
6
|
cell: CellView;
|
|
6
7
|
index: number;
|
|
7
8
|
}
|
|
8
|
-
export declare const
|
|
9
|
+
export declare const DndCellContainer: React.FC<DndContentProps>;
|
|
9
10
|
export declare const LibroBetweenCellContent: BetweenCellProvider;
|
|
10
11
|
//# sourceMappingURL=default-dnd-content.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-dnd-content.d.ts","sourceRoot":"","sources":["../../../src/components/dnd-component/default-dnd-content.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"default-dnd-content.d.ts","sourceRoot":"","sources":["../../../src/components/dnd-component/default-dnd-content.tsx"],"names":[],"mappings":"AAIA,OAAO,KAQN,MAAM,OAAO,CAAC;AAGf,OAAO,0BAA0B,CAAC;AAMlC,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAKzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAkTtD,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,mBAIrC,CAAC"}
|
|
@@ -1,30 +1,32 @@
|
|
|
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
1
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
2
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
3
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
4
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
5
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
6
|
+
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); }
|
|
7
7
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
8
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
9
|
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); }
|
|
10
10
|
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; }
|
|
11
11
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
|
|
13
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
14
14
|
import { getOrigin, useInject, ViewInstance } from '@difizen/mana-app';
|
|
15
|
-
import
|
|
15
|
+
import { useConfigurationValue } from '@difizen/mana-app';
|
|
16
|
+
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, forwardRef } from 'react';
|
|
16
17
|
import { useDrag, useDragDropManager, useDrop } from 'react-dnd';
|
|
17
18
|
import { getEmptyImage } from 'react-dnd-html5-backend';
|
|
18
|
-
import
|
|
19
|
+
import 'resize-observer-polyfill';
|
|
20
|
+
import { LibroCellService } from "../../cell/index.js";
|
|
19
21
|
import { CellCollapsible } from "../../collapse-service.js";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
+
import { DragAreaKey, isCellView } from "../../libro-protocol.js";
|
|
23
|
+
import { MultiSelectionWhenShiftClick } from "../../libro-setting.js";
|
|
22
24
|
import { HolderOutlined, PlusOutlined } from "../../material-from-designer.js";
|
|
23
|
-
import {
|
|
25
|
+
import { VirtualizedManagerHelper } from "../../virtualized-manager-helper.js";
|
|
24
26
|
import { BetweenCellProvider } from "../cell-protocol.js";
|
|
25
27
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
28
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
|
-
export var
|
|
29
|
+
export var DndCellContainer = function DndCellContainer(_ref) {
|
|
28
30
|
var _instance$container;
|
|
29
31
|
var cell = _ref.cell,
|
|
30
32
|
index = _ref.index;
|
|
@@ -34,10 +36,39 @@ export var DefaultDndContent = function DefaultDndContent(_ref) {
|
|
|
34
36
|
_useConfigurationValu2 = _slicedToArray(_useConfigurationValu, 1),
|
|
35
37
|
multiSelectionWhenShiftClick = _useConfigurationValu2[0];
|
|
36
38
|
var BetweenCellContent = useInject(BetweenCellProvider);
|
|
37
|
-
var cellService = useInject(
|
|
39
|
+
var cellService = useInject(LibroCellService);
|
|
40
|
+
var virtualizedManagerHelper = useInject(VirtualizedManagerHelper);
|
|
41
|
+
var virtualizedManager = virtualizedManagerHelper.getOrCreate(cell.parent.model);
|
|
38
42
|
var dragDropManager = useDragDropManager();
|
|
39
43
|
var dragDropMonitor = dragDropManager.getMonitor();
|
|
40
44
|
var ItemRender = getOrigin(instance.dndItemRender);
|
|
45
|
+
useLayoutEffect(function () {
|
|
46
|
+
if (_typeof(ref) !== 'object') {
|
|
47
|
+
return function () {
|
|
48
|
+
//
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
var el = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
52
|
+
if (!el) {
|
|
53
|
+
return function () {
|
|
54
|
+
//
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
var resizeObserver = new ResizeObserver(function (entries) {
|
|
58
|
+
entries.forEach(function (entry) {
|
|
59
|
+
var isVisible = entry.contentRect.width !== 0 && entry.contentRect.height !== 0;
|
|
60
|
+
if (isVisible) {
|
|
61
|
+
var _ref$current;
|
|
62
|
+
cell.noEditorAreaHeight = ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.clientHeight) || 0;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
resizeObserver.observe(el);
|
|
67
|
+
return function () {
|
|
68
|
+
cell.noEditorAreaHeight = 0;
|
|
69
|
+
resizeObserver.disconnect();
|
|
70
|
+
};
|
|
71
|
+
}, [ref, cell]);
|
|
41
72
|
var handleFocus = useCallback(function (e) {
|
|
42
73
|
var className = e.target.className;
|
|
43
74
|
if (e.target.tagName === 'svg' || className && className && typeof className === 'string' && (className.includes('mana-toolbar-item') || className.includes('mana-toolbar'))) {
|
|
@@ -65,6 +96,8 @@ export var DefaultDndContent = function DefaultDndContent(_ref) {
|
|
|
65
96
|
instance.model.selectCell(cell);
|
|
66
97
|
instance.model.selections = [];
|
|
67
98
|
}, [instance, cell]);
|
|
99
|
+
var scrollTimer = useRef(null);
|
|
100
|
+
var unsubscribe = useRef(null);
|
|
68
101
|
var _useDrag = useDrag({
|
|
69
102
|
type: DragAreaKey,
|
|
70
103
|
item: {
|
|
@@ -78,41 +111,45 @@ export var DefaultDndContent = function DefaultDndContent(_ref) {
|
|
|
78
111
|
},
|
|
79
112
|
end: function end() {
|
|
80
113
|
instance.isDragging = false;
|
|
114
|
+
if (scrollTimer.current) {
|
|
115
|
+
clearInterval(scrollTimer.current);
|
|
116
|
+
}
|
|
81
117
|
}
|
|
82
118
|
}, [cell, index]),
|
|
83
119
|
_useDrag2 = _slicedToArray(_useDrag, 3),
|
|
84
120
|
isDrag = _useDrag2[0].isDrag,
|
|
85
121
|
drag = _useDrag2[1],
|
|
86
122
|
preview = _useDrag2[2];
|
|
87
|
-
dragDropMonitor.subscribeToStateChange(function () {
|
|
88
|
-
instance.isDragging = dragDropMonitor.isDragging();
|
|
89
|
-
});
|
|
90
123
|
var libroViewContent = (_instance$container = instance.container) === null || _instance$container === void 0 || (_instance$container = _instance$container.current) === null || _instance$container === void 0 ? void 0 : _instance$container.getElementsByClassName('libro-view-content')[0];
|
|
91
|
-
var scrollTimer = useRef(null);
|
|
92
124
|
useEffect(function () {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
var
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
125
|
+
unsubscribe.current = dragDropMonitor.subscribeToStateChange(function () {
|
|
126
|
+
instance.isDragging = dragDropMonitor.isDragging();
|
|
127
|
+
scrollTimer.current = setInterval(function () {
|
|
128
|
+
var currentOffset = dragDropMonitor.getClientOffset();
|
|
129
|
+
if (libroViewContent && instance.isDragging && currentOffset) {
|
|
130
|
+
var libroViewClientRect = libroViewContent.getBoundingClientRect();
|
|
131
|
+
var top = libroViewClientRect.top,
|
|
132
|
+
bottom = libroViewClientRect.bottom;
|
|
133
|
+
var y = currentOffset.y;
|
|
134
|
+
var topLimit = top + 30;
|
|
135
|
+
var bottomLimit = bottom - 50;
|
|
136
|
+
if (y < topLimit) {
|
|
137
|
+
libroViewContent.scrollTop -= 0.5;
|
|
138
|
+
} else if (y > bottomLimit) {
|
|
139
|
+
libroViewContent.scrollTop += 0.5;
|
|
140
|
+
}
|
|
106
141
|
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
142
|
+
}, 10);
|
|
143
|
+
return function () {
|
|
144
|
+
if (scrollTimer.current) {
|
|
145
|
+
clearInterval(scrollTimer.current);
|
|
146
|
+
}
|
|
147
|
+
if (unsubscribe.current) {
|
|
148
|
+
unsubscribe.current();
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
});
|
|
152
|
+
}, [dragDropMonitor]);
|
|
116
153
|
useEffect(function () {
|
|
117
154
|
// This gets called after every render, by default
|
|
118
155
|
// (the first one, and every one after that)
|
|
@@ -134,7 +171,7 @@ export var DefaultDndContent = function DefaultDndContent(_ref) {
|
|
|
134
171
|
}), item.cell.parent.id).then(function (view) {
|
|
135
172
|
view.dispose();
|
|
136
173
|
return;
|
|
137
|
-
}).catch(function () {
|
|
174
|
+
}).catch(function (e) {
|
|
138
175
|
//
|
|
139
176
|
});
|
|
140
177
|
if (isCellView(item.cell)) {
|
|
@@ -156,17 +193,35 @@ export var DefaultDndContent = function DefaultDndContent(_ref) {
|
|
|
156
193
|
}
|
|
157
194
|
if (isDragInSelections) {
|
|
158
195
|
instance.model.exchangeCells(instance.model.selections, dropIndex);
|
|
159
|
-
|
|
196
|
+
if (virtualizedManager.isVirtualized) {
|
|
197
|
+
instance.model.scrollToCellView({
|
|
198
|
+
cellIndex: dropIndex
|
|
199
|
+
});
|
|
200
|
+
} else {
|
|
201
|
+
instance.model.scrollToView(cell);
|
|
202
|
+
}
|
|
160
203
|
return;
|
|
161
204
|
}
|
|
162
205
|
}
|
|
163
206
|
if (dragIndex < dropIndex) {
|
|
164
207
|
instance.model.exchangeCell(dragIndex, dropIndex - 1);
|
|
165
|
-
|
|
208
|
+
if (virtualizedManager.isVirtualized) {
|
|
209
|
+
instance.model.scrollToCellView({
|
|
210
|
+
cellIndex: dropIndex
|
|
211
|
+
});
|
|
212
|
+
} else {
|
|
213
|
+
instance.model.scrollToView(cell);
|
|
214
|
+
}
|
|
166
215
|
}
|
|
167
216
|
if (dragIndex > dropIndex) {
|
|
168
217
|
instance.model.exchangeCell(dragIndex, dropIndex);
|
|
169
|
-
|
|
218
|
+
if (virtualizedManager.isVirtualized) {
|
|
219
|
+
instance.model.scrollToCellView({
|
|
220
|
+
cellIndex: dropIndex
|
|
221
|
+
});
|
|
222
|
+
} else {
|
|
223
|
+
instance.model.scrollToView(cell);
|
|
224
|
+
}
|
|
170
225
|
}
|
|
171
226
|
}
|
|
172
227
|
return;
|
|
@@ -191,17 +246,18 @@ export var DefaultDndContent = function DefaultDndContent(_ref) {
|
|
|
191
246
|
if (isDrag) {
|
|
192
247
|
instance.model.mouseMode = 'drag';
|
|
193
248
|
}
|
|
194
|
-
var
|
|
249
|
+
var isMultiSelected = instance.model.selections.length !== 0 && instance.isSelected(cell);
|
|
195
250
|
// let isMouseOver = false;
|
|
196
251
|
var _useState = useState(false),
|
|
197
252
|
_useState2 = _slicedToArray(_useState, 2),
|
|
198
253
|
isMouseOverDragArea = _useState2[0],
|
|
199
254
|
setIsMouseOverDragArea = _useState2[1];
|
|
200
|
-
var hasCellHidden =
|
|
201
|
-
|
|
255
|
+
var hasCellHidden = useMemo(function () {
|
|
256
|
+
return cell.hasCellHidden();
|
|
257
|
+
}, [cell]);
|
|
202
258
|
var isCollapsible = CellCollapsible.is(cell);
|
|
203
259
|
return /*#__PURE__*/_jsxs("div", {
|
|
204
|
-
className: "libro-dnd-cell-container ".concat(
|
|
260
|
+
className: "libro-dnd-cell-container ".concat(isMultiSelected ? 'multi-selected' : '', " ").concat(hasCellHidden ? 'hidden' : ''),
|
|
205
261
|
"data-handler-id": handlerId,
|
|
206
262
|
style: {
|
|
207
263
|
opacity: opacity
|
|
@@ -231,7 +287,7 @@ export var DefaultDndContent = function DefaultDndContent(_ref) {
|
|
|
231
287
|
onFocus: handleFocus
|
|
232
288
|
// onClick={e => e.preventDefault()}
|
|
233
289
|
,
|
|
234
|
-
className: "libro-dnd-cell-content
|
|
290
|
+
className: "libro-dnd-cell-content",
|
|
235
291
|
children: /*#__PURE__*/_jsx(ItemRender, {
|
|
236
292
|
isDragOver: !!isDragOver,
|
|
237
293
|
isDrag: !!isDrag,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ViewInstance } from '@difizen/mana-app';
|
|
2
1
|
import { getOrigin, useInject } from '@difizen/mana-app';
|
|
2
|
+
import { ViewInstance } from '@difizen/mana-app';
|
|
3
3
|
import { DndProvider } from 'react-dnd';
|
|
4
4
|
import { HTML5Backend } from 'react-dnd-html5-backend';
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import type { FC, ReactNode } from 'react';
|
|
2
|
+
import type { DndContentProps } from '../../libro-protocol.js';
|
|
2
3
|
import type { LibroView } from '../../libro-view.js';
|
|
3
|
-
|
|
4
|
+
import './index.less';
|
|
5
|
+
export declare const DndCellRender: FC<DndContentProps>;
|
|
6
|
+
export declare const DndCellsRender: import("react").ForwardRefExoticComponent<{
|
|
4
7
|
libroView: LibroView;
|
|
8
|
+
addCellButtons: ReactNode;
|
|
5
9
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
-
export declare
|
|
10
|
+
export declare const DndList: import("react").ForwardRefExoticComponent<{
|
|
7
11
|
libroView: LibroView;
|
|
8
|
-
children:
|
|
9
|
-
}
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
10
14
|
//# sourceMappingURL=dnd-list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dnd-list.d.ts","sourceRoot":"","sources":["../../../src/components/dnd-component/dnd-list.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dnd-list.d.ts","sourceRoot":"","sources":["../../../src/components/dnd-component/dnd-list.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAO3C,OAAO,KAAK,EAAY,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAEzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKrD,OAAO,cAAc,CAAC;AAEtB,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,eAAe,CAY5C,CAAC;AAaH,eAAO,MAAM,cAAc;eAEZ,SAAS;oBAAkB,SAAS;kDAsFjD,CAAC;AAEH,eAAO,MAAM,OAAO;eAEL,SAAS;cAAY,SAAS;kDA2E3C,CAAC"}
|
|
@@ -14,48 +14,113 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
14
14
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
15
15
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
16
16
|
import { getOrigin, useInject, useObserve, ViewInstance } from '@difizen/mana-app';
|
|
17
|
-
import
|
|
17
|
+
import classNames from 'classnames';
|
|
18
|
+
import { forwardRef, memo, useEffect, useState } from 'react';
|
|
18
19
|
import { useDrop } from 'react-dnd';
|
|
19
20
|
import { LibroCellService } from "../../cell/index.js";
|
|
20
21
|
import { DragAreaKey, isCellView } from "../../libro-protocol.js";
|
|
22
|
+
import { VirtualizedManagerHelper } from "../../virtualized-manager-helper.js";
|
|
23
|
+
import { LibroCellsOutputRender } from "../libro-virtualized-render.js";
|
|
24
|
+
import "./index.less";
|
|
21
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
22
27
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
-
var
|
|
28
|
+
export var DndCellRender = /*#__PURE__*/memo(function DndCellRender(_ref) {
|
|
24
29
|
var cell = _ref.cell,
|
|
25
30
|
index = _ref.index,
|
|
26
31
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
27
32
|
var observableCell = useObserve(cell);
|
|
28
33
|
var instance = useInject(ViewInstance);
|
|
29
|
-
var
|
|
30
|
-
return /*#__PURE__*/_jsx(
|
|
34
|
+
var DndCellContainer = instance.dndContentRender;
|
|
35
|
+
return /*#__PURE__*/_jsx(DndCellContainer, _objectSpread({
|
|
31
36
|
cell: observableCell,
|
|
32
37
|
index: index
|
|
33
38
|
}, props), cell.id);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// 定义一个函数用于渲染非虚拟列表时的单元格
|
|
42
|
+
var renderNonVirtualListCells = function renderNonVirtualListCells(cells) {
|
|
43
|
+
return /*#__PURE__*/_jsx("div", {
|
|
44
|
+
style: {
|
|
45
|
+
height: '100%',
|
|
46
|
+
overflow: 'visible'
|
|
47
|
+
},
|
|
48
|
+
children: cells.filter(function (cell) {
|
|
49
|
+
return !cell.collapsedHidden;
|
|
50
|
+
}).map(function (cell, index) {
|
|
51
|
+
return /*#__PURE__*/_jsx(DndCellRender, {
|
|
52
|
+
cell: cell,
|
|
53
|
+
index: index
|
|
54
|
+
}, cell.id);
|
|
55
|
+
})
|
|
56
|
+
});
|
|
34
57
|
};
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
|
|
58
|
+
export var DndCellsRender = /*#__PURE__*/forwardRef(function DndCellsRender(_ref2, ref) {
|
|
59
|
+
var libroView = _ref2.libroView,
|
|
60
|
+
addCellButtons = _ref2.addCellButtons;
|
|
38
61
|
var LoadingRender = getOrigin(libroView.loadingRender);
|
|
62
|
+
var virtualizedManagerHelper = useInject(VirtualizedManagerHelper);
|
|
63
|
+
var virtualizedManager = virtualizedManagerHelper.getOrCreate(libroView.model);
|
|
39
64
|
var cells = libroView.model.getCells().reduce(function (a, b) {
|
|
40
65
|
if (a.indexOf(b) < 0) {
|
|
41
66
|
a.push(b);
|
|
42
67
|
}
|
|
43
68
|
return a;
|
|
44
69
|
}, []);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
70
|
+
var _useState = useState(false),
|
|
71
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
72
|
+
isVirtualList = _useState2[0],
|
|
73
|
+
setIsVirtualList = _useState2[1];
|
|
74
|
+
var _useState3 = useState(true),
|
|
75
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
76
|
+
isJudging = _useState4[0],
|
|
77
|
+
setIsJudging = _useState4[1];
|
|
78
|
+
useEffect(function () {
|
|
79
|
+
if (!libroView.model.isInitialized) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
var size = undefined;
|
|
83
|
+
var path = undefined;
|
|
84
|
+
|
|
85
|
+
// TODO: 类型处理
|
|
86
|
+
var model = libroView.model;
|
|
87
|
+
if (model.currentFileContents && model.currentFileContents.size) {
|
|
88
|
+
size = parseFloat((model.currentFileContents.size / 1048576).toFixed(3)); // 单位MB
|
|
89
|
+
path = model.currentFileContents.path || '';
|
|
90
|
+
}
|
|
91
|
+
setIsJudging(true);
|
|
92
|
+
virtualizedManager.openVirtualized(cells.length, size, path).then(function (willOpen) {
|
|
93
|
+
setIsVirtualList(willOpen);
|
|
94
|
+
return;
|
|
95
|
+
}).catch(function () {
|
|
96
|
+
setIsVirtualList(false);
|
|
97
|
+
}).finally(function () {
|
|
98
|
+
setIsJudging(false);
|
|
99
|
+
}).catch(function (e) {
|
|
100
|
+
//
|
|
101
|
+
});
|
|
102
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
103
|
+
}, [virtualizedManager, libroView.model.isInitialized]);
|
|
104
|
+
var isInitialized = libroView.model.isInitialized;
|
|
105
|
+
var isLoading = !isInitialized || isJudging;
|
|
106
|
+
var shouldRenderCells = isInitialized && !isJudging;
|
|
107
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
108
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
109
|
+
className: classNames('libro-dnd-cells-container', isVirtualList && 'virtual_list_container'),
|
|
110
|
+
ref: ref,
|
|
111
|
+
children: [isLoading && /*#__PURE__*/_jsx(LoadingRender, {}), /*#__PURE__*/_jsx(_Fragment, {
|
|
112
|
+
children: shouldRenderCells && /*#__PURE__*/_jsx(_Fragment, {
|
|
113
|
+
children: isVirtualList ? /*#__PURE__*/_jsx(LibroCellsOutputRender, {
|
|
114
|
+
cells: cells,
|
|
115
|
+
libroView: libroView,
|
|
116
|
+
addCellButtons: addCellButtons
|
|
117
|
+
}) : renderNonVirtualListCells(cells)
|
|
118
|
+
})
|
|
119
|
+
})]
|
|
120
|
+
}), shouldRenderCells && !isVirtualList && addCellButtons]
|
|
56
121
|
});
|
|
57
122
|
});
|
|
58
|
-
export function DndList(_ref3) {
|
|
123
|
+
export var DndList = /*#__PURE__*/forwardRef(function DndList(_ref3, ref) {
|
|
59
124
|
var libroView = _ref3.libroView,
|
|
60
125
|
children = _ref3.children;
|
|
61
126
|
var cellService = useInject(LibroCellService);
|
|
@@ -67,8 +132,9 @@ export function DndList(_ref3) {
|
|
|
67
132
|
modelId: item.cell.model.id,
|
|
68
133
|
singleSelectionDragPreview: true
|
|
69
134
|
}), item.cell.parent.id).then(function (view) {
|
|
70
|
-
|
|
71
|
-
|
|
135
|
+
view.dispose();
|
|
136
|
+
return;
|
|
137
|
+
}).catch(function (e) {
|
|
72
138
|
//
|
|
73
139
|
});
|
|
74
140
|
if (isCellView(item.cell)) {
|
|
@@ -105,11 +171,12 @@ export function DndList(_ref3) {
|
|
|
105
171
|
}),
|
|
106
172
|
_useDrop2 = _slicedToArray(_useDrop, 2),
|
|
107
173
|
drop = _useDrop2[1];
|
|
108
|
-
return /*#__PURE__*/
|
|
174
|
+
return /*#__PURE__*/_jsx("div", {
|
|
109
175
|
className: "libro-dnd-list-container",
|
|
110
176
|
ref: drop,
|
|
111
|
-
children:
|
|
112
|
-
libroView: libroView
|
|
113
|
-
|
|
177
|
+
children: /*#__PURE__*/_jsx(DndCellsRender, {
|
|
178
|
+
libroView: libroView,
|
|
179
|
+
addCellButtons: children
|
|
180
|
+
})
|
|
114
181
|
});
|
|
115
|
-
}
|
|
182
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dnd-component/index.tsx"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dnd-component/index.tsx"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type OverscanIndicesGetterParams = {
|
|
2
|
+
direction: 'horizontal' | 'vertical';
|
|
3
|
+
scrollDirection: -1 | 1;
|
|
4
|
+
cellCount: number;
|
|
5
|
+
overscanCellsCount: number;
|
|
6
|
+
startIndex: number;
|
|
7
|
+
stopIndex: number;
|
|
8
|
+
};
|
|
9
|
+
export type OverscanIndices = {
|
|
10
|
+
overscanStartIndex: number;
|
|
11
|
+
overscanStopIndex: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const SCROLL_DIRECTION_BACKWARD = -1;
|
|
14
|
+
export declare const SCROLL_DIRECTION_FORWARD = 1;
|
|
15
|
+
export declare const SCROLL_DIRECTION_HORIZONTAL = "horizontal";
|
|
16
|
+
export declare const SCROLL_DIRECTION_VERTICAL = "vertical";
|
|
17
|
+
/**
|
|
18
|
+
* Calculates the number of cells to overscan before and after a specified range.
|
|
19
|
+
* This function ensures that overscanning doesn't exceed the available cells.
|
|
20
|
+
*/
|
|
21
|
+
export default function libroOverscanIndicesGetter({ cellCount, overscanCellsCount, scrollDirection, startIndex, stopIndex, }: OverscanIndicesGetterParams): OverscanIndices;
|
|
22
|
+
//# sourceMappingURL=overscanIndices-getter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overscanIndices-getter.d.ts","sourceRoot":"","sources":["../../../src/components/dnd-component/overscanIndices-getter.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,2BAA2B,GAAG;IAExC,SAAS,EAAE,YAAY,GAAG,UAAU,CAAC;IAGrC,eAAe,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;IAGxB,SAAS,EAAE,MAAM,CAAC;IAGlB,kBAAkB,EAAE,MAAM,CAAC;IAG3B,UAAU,EAAE,MAAM,CAAC;IAGnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAC5C,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C,eAAO,MAAM,2BAA2B,eAAe,CAAC;AACxD,eAAO,MAAM,yBAAyB,aAAa,CAAC;AAIpD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAAC,EACjD,SAAS,EACT,kBAAkB,EAClB,eAAe,EACf,UAAU,EACV,SAAS,GACV,EAAE,2BAA2B,GAAG,eAAe,CAgD/C"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export var SCROLL_DIRECTION_BACKWARD = -1;
|
|
2
|
+
export var SCROLL_DIRECTION_FORWARD = 1;
|
|
3
|
+
export var SCROLL_DIRECTION_HORIZONTAL = 'horizontal';
|
|
4
|
+
export var SCROLL_DIRECTION_VERTICAL = 'vertical';
|
|
5
|
+
var overscanIndicesCache = null;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Calculates the number of cells to overscan before and after a specified range.
|
|
9
|
+
* This function ensures that overscanning doesn't exceed the available cells.
|
|
10
|
+
*/
|
|
11
|
+
export default function libroOverscanIndicesGetter(_ref) {
|
|
12
|
+
var cellCount = _ref.cellCount,
|
|
13
|
+
overscanCellsCount = _ref.overscanCellsCount,
|
|
14
|
+
scrollDirection = _ref.scrollDirection,
|
|
15
|
+
startIndex = _ref.startIndex,
|
|
16
|
+
stopIndex = _ref.stopIndex;
|
|
17
|
+
// Make sure we render at least 1 cell extra before and after (except near boundaries)
|
|
18
|
+
// This is necessary in order to support keyboard navigation (TAB/SHIFT+TAB) in some cases
|
|
19
|
+
// For more info see issues #625
|
|
20
|
+
|
|
21
|
+
// 计算 overscanIndices 的函数
|
|
22
|
+
var calculateOverscanIndices = function calculateOverscanIndices() {
|
|
23
|
+
var _overscanCellsCount = Math.max(1, overscanCellsCount);
|
|
24
|
+
var overscanIndices = null;
|
|
25
|
+
if (scrollDirection === SCROLL_DIRECTION_FORWARD) {
|
|
26
|
+
overscanIndices = {
|
|
27
|
+
overscanStartIndex: Math.max(0, startIndex - 1),
|
|
28
|
+
overscanStopIndex: Math.min(cellCount - 1, stopIndex + _overscanCellsCount)
|
|
29
|
+
};
|
|
30
|
+
} else {
|
|
31
|
+
overscanIndices = {
|
|
32
|
+
overscanStartIndex: Math.max(0, startIndex - _overscanCellsCount),
|
|
33
|
+
overscanStopIndex: Math.min(cellCount - 1, stopIndex + 1)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return overscanIndices;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// 检查缓存和时间戳函数
|
|
40
|
+
var checkCacheAndTimestamp = function checkCacheAndTimestamp() {
|
|
41
|
+
if (cellCount === 1) {
|
|
42
|
+
// 'horizontal' 方向 不用缓存
|
|
43
|
+
var overscanIndices = calculateOverscanIndices();
|
|
44
|
+
return overscanIndices;
|
|
45
|
+
}
|
|
46
|
+
if (overscanIndicesCache && Date.now() - overscanIndicesCache.timestamp < 500) {
|
|
47
|
+
return overscanIndicesCache.value;
|
|
48
|
+
} else {
|
|
49
|
+
var _overscanIndices = calculateOverscanIndices();
|
|
50
|
+
overscanIndicesCache = {
|
|
51
|
+
value: _overscanIndices,
|
|
52
|
+
timestamp: Date.now()
|
|
53
|
+
};
|
|
54
|
+
return _overscanIndices;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
return checkCacheAndTimestamp();
|
|
58
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface IVirtualizedManager {
|
|
2
|
+
openVirtualized: (length: number, size?: number) => Promise<boolean>;
|
|
3
|
+
isVirtualized: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare class VirtualizedManager implements IVirtualizedManager {
|
|
6
|
+
/**
|
|
7
|
+
* 因为进行isVirtualized判断过后才会渲染list
|
|
8
|
+
* 所以它用于滚动到某个cell的判断依据是没有问题的。
|
|
9
|
+
*/
|
|
10
|
+
isVirtualized: boolean;
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param length cell个数
|
|
14
|
+
* @param size undefined 或者 单位 为B
|
|
15
|
+
* @returns 是否使用虚拟滚动
|
|
16
|
+
*/
|
|
17
|
+
openVirtualized: (length: number, size?: number) => Promise<boolean>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=virtualized-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtualized-manager.d.ts","sourceRoot":"","sources":["../../../src/components/dnd-component/virtualized-manager.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACrE,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,qBACa,kBAAmB,YAAW,mBAAmB;IAC5D;;;OAGG;IAEH,aAAa,UAAS;IAEtB;;;;;OAKG;IACH,eAAe,WAAkB,MAAM,SAAS,MAAM,sBAUpD;CACH"}
|