@difizen/libro-core 0.3.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/add-cell/libro-add-cell-module.d.ts +1 -1
- package/es/add-cell/libro-add-cell-module.d.ts.map +1 -1
- package/es/add-cell/libro-add-cell-module.js +1 -1
- package/es/add-cell/libro-add-cell-slot-contribution.d.ts +1 -1
- package/es/add-cell/libro-add-cell-slot-contribution.d.ts.map +1 -1
- package/es/add-cell/libro-add-cell-slot-contribution.js +2 -2
- package/es/add-cell/libro-add-cell-view.d.ts +1 -1
- package/es/add-cell/libro-add-cell-view.d.ts.map +1 -1
- package/es/add-cell/libro-add-cell-view.js +1 -1
- package/es/cell/libro-cell-contribution.js +1 -1
- package/es/cell/libro-cell-model.d.ts +1 -1
- package/es/cell/libro-cell-model.d.ts.map +1 -1
- package/es/cell/libro-cell-model.js +2 -2
- package/es/cell/libro-cell-module.d.ts +1 -1
- package/es/cell/libro-cell-module.d.ts.map +1 -1
- package/es/cell/libro-cell-module.js +1 -1
- package/es/cell/libro-cell-protocol.d.ts +2 -2
- package/es/cell/libro-cell-protocol.d.ts.map +1 -1
- package/es/cell/libro-cell-protocol.js +1 -1
- package/es/cell/libro-cell-service.d.ts +2 -2
- package/es/cell/libro-cell-service.d.ts.map +1 -1
- package/es/cell/libro-cell-service.js +3 -3
- package/es/cell/libro-cell-view.d.ts +4 -4
- package/es/cell/libro-cell-view.d.ts.map +1 -1
- package/es/cell/libro-cell-view.js +6 -6
- package/es/cell/libro-edit-cell-view.d.ts +1 -1
- package/es/cell/libro-edit-cell-view.d.ts.map +1 -1
- package/es/cell/libro-edit-cell-view.js +1 -1
- package/es/cell/libro-executable-cell-model.d.ts +1 -1
- package/es/cell/libro-executable-cell-model.d.ts.map +1 -1
- package/es/cell/libro-executable-cell-view.js +3 -3
- package/es/collapse-service.js +1 -1
- package/es/command/document-commands.d.ts +1 -1
- package/es/command/document-commands.d.ts.map +1 -1
- package/es/command/kernel-command.d.ts +1 -1
- package/es/command/kernel-command.d.ts.map +1 -1
- package/es/command/kernel-command.js +1 -1
- package/es/command/libro-command-contribution.d.ts +2 -2
- package/es/command/libro-command-contribution.d.ts.map +1 -1
- package/es/command/libro-command-contribution.js +2 -2
- package/es/command/libro-command-register.d.ts +1 -1
- package/es/command/libro-command-register.d.ts.map +1 -1
- package/es/command/libro-command-register.js +1 -1
- package/es/command/module.d.ts +1 -1
- package/es/command/module.d.ts.map +1 -1
- package/es/command/module.js +1 -1
- package/es/command/notebook-commands.d.ts +1 -1
- package/es/command/notebook-commands.d.ts.map +1 -1
- package/es/command/notebook-commands.js +1 -1
- package/es/components/dnd-cell-item-render.js +2 -2
- package/es/components/dnd-component/default-dnd-content.d.ts.map +1 -1
- package/es/components/dnd-component/default-dnd-content.js +90 -167
- package/es/components/dnd-component/dnd-list.d.ts +12 -0
- package/es/components/dnd-component/dnd-list.d.ts.map +1 -1
- package/es/components/dnd-component/dnd-list.js +307 -63
- package/es/components/dnd-component/index.d.ts +0 -2
- package/es/components/dnd-component/index.d.ts.map +1 -1
- package/es/components/dnd-component/index.js +0 -2
- package/es/components/dnd-component/index.less +84 -0
- package/es/components/dnd-component/virtualized-manager.d.ts.map +1 -1
- package/es/components/dnd-component/virtualized-manager.js +3 -9
- package/es/components/libro-component.js +2 -2
- package/es/components/libro-side-toolbar-menu.js +2 -2
- package/es/components/libro-view-header.js +1 -1
- package/es/content/libro-content-contribution.js +1 -1
- package/es/content/libro-content-module.d.ts +1 -1
- package/es/content/libro-content-module.d.ts.map +1 -1
- package/es/content/libro-content-module.js +1 -1
- package/es/content/libro-content-protocol.d.ts +1 -1
- package/es/content/libro-content-protocol.d.ts.map +1 -1
- package/es/content/libro-content-protocol.js +1 -1
- package/es/content/libro-content-service.d.ts +1 -1
- package/es/content/libro-content-service.d.ts.map +1 -1
- package/es/content/libro-content-service.js +1 -1
- package/es/content/libro-save-content-contribution.js +1 -1
- package/es/formatter/libro-formatter-json-contribution.d.ts +1 -1
- package/es/formatter/libro-formatter-json-contribution.js +1 -1
- package/es/formatter/libro-formatter-manager.d.ts +1 -1
- package/es/formatter/libro-formatter-manager.d.ts.map +1 -1
- package/es/formatter/libro-formatter-manager.js +1 -1
- package/es/formatter/libro-formatter-module.d.ts +1 -1
- package/es/formatter/libro-formatter-module.d.ts.map +1 -1
- package/es/formatter/libro-formatter-module.js +1 -1
- package/es/formatter/libro-formatter-protocol.d.ts +1 -1
- package/es/formatter/libro-formatter-protocol.d.ts.map +1 -1
- package/es/formatter/libro-formatter-protocol.js +1 -1
- package/es/formatter/libro-formatter-string-contribution.d.ts +1 -1
- package/es/formatter/libro-formatter-string-contribution.js +1 -1
- package/es/formatter/libro-formatter-trans-default-contribution.js +1 -1
- package/es/index.d.ts +2 -0
- package/es/index.d.ts.map +1 -1
- package/es/index.js +2 -0
- package/es/index.less +0 -22
- package/es/libro-context-key.d.ts +3 -3
- package/es/libro-context-key.d.ts.map +1 -1
- package/es/libro-context-key.js +2 -2
- package/es/libro-keybind-registry.d.ts +1 -1
- package/es/libro-keybind-registry.d.ts.map +1 -1
- package/es/libro-keybind-registry.js +2 -2
- package/es/libro-model.d.ts +9 -9
- package/es/libro-model.d.ts.map +1 -1
- package/es/libro-model.js +4 -4
- package/es/libro-protocol.d.ts +2 -2
- package/es/libro-protocol.d.ts.map +1 -1
- package/es/libro-service.d.ts +13 -13
- package/es/libro-service.d.ts.map +1 -1
- package/es/libro-service.js +4 -4
- package/es/libro-setting-contribution.d.ts +2 -2
- package/es/libro-setting-contribution.d.ts.map +1 -1
- package/es/libro-setting-contribution.js +1 -1
- package/es/libro-setting.d.ts +1 -1
- package/es/libro-setting.d.ts.map +1 -1
- package/es/libro-setting.js +1 -1
- package/es/libro-view-tracker.js +1 -1
- package/es/libro-view.d.ts +9 -9
- package/es/libro-view.d.ts.map +1 -1
- package/es/libro-view.js +8 -12
- package/es/libro-workspace-service.d.ts +1 -1
- package/es/libro-workspace-service.d.ts.map +1 -1
- package/es/libro-workspace-service.js +2 -2
- package/es/module.d.ts +1 -1
- package/es/module.d.ts.map +1 -1
- package/es/module.js +2 -2
- package/es/output/output-area.d.ts +4 -4
- package/es/output/output-area.d.ts.map +1 -1
- package/es/output/output-area.js +2 -2
- package/es/output/output-contribution.d.ts +1 -1
- package/es/output/output-contribution.d.ts.map +1 -1
- package/es/output/output-contribution.js +1 -1
- package/es/output/output-model.d.ts +1 -1
- package/es/output/output-model.d.ts.map +1 -1
- package/es/output/output-model.js +2 -2
- package/es/output/output-module.d.ts +1 -1
- package/es/output/output-module.d.ts.map +1 -1
- package/es/output/output-module.js +1 -1
- package/es/output/output-protocol.d.ts +3 -3
- package/es/output/output-protocol.d.ts.map +1 -1
- package/es/output/output-protocol.js +1 -1
- package/es/settings/module.d.ts +1 -1
- package/es/settings/module.d.ts.map +1 -1
- package/es/settings/module.js +1 -1
- package/es/settings/setting-editor/configuration-panel-view.d.ts +2 -2
- package/es/settings/setting-editor/configuration-panel-view.d.ts.map +1 -1
- package/es/settings/setting-editor/configuration-panel-view.js +1 -1
- package/es/settings/setting-editor/configuration-render-contribution.d.ts +2 -2
- package/es/settings/setting-editor/configuration-render-contribution.d.ts.map +1 -1
- package/es/settings/setting-editor/configuration-render-contribution.js +1 -1
- package/es/settings/setting-editor/default-node-render.d.ts +1 -1
- package/es/settings/setting-editor/default-node-render.d.ts.map +1 -1
- package/es/settings/setting-editor/default-node-render.js +1 -1
- package/es/settings/setting-editor/module.d.ts +1 -1
- package/es/settings/setting-editor/module.d.ts.map +1 -1
- package/es/settings/setting-editor/module.js +1 -1
- package/es/settings/setting-editor/setting-editor-view.d.ts +1 -1
- package/es/settings/setting-editor/setting-editor-view.d.ts.map +1 -1
- package/es/settings/setting-editor/setting-editor-view.js +2 -2
- package/es/settings/setting-editor/setting-tree-service.d.ts +3 -3
- package/es/settings/setting-editor/setting-tree-service.d.ts.map +1 -1
- package/es/settings/setting-editor/setting-tree-service.js +2 -2
- package/es/settings/setting-editor/setting-tree-view.d.ts +2 -2
- package/es/settings/setting-editor/setting-tree-view.d.ts.map +1 -1
- package/es/settings/setting-editor/setting-tree-view.js +2 -2
- package/es/settings/settings-contribution.d.ts +3 -3
- package/es/settings/settings-contribution.d.ts.map +1 -1
- package/es/settings/settings-contribution.js +2 -2
- package/es/settings/settings-modal.d.ts +1 -1
- package/es/settings/settings-modal.d.ts.map +1 -1
- package/es/settings/settings-modal.js +3 -3
- package/es/settings/settings-protocol.d.ts +1 -1
- package/es/settings/settings-protocol.d.ts.map +1 -1
- 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 +2 -2
- package/es/slot/libro-slot-protocol.d.ts +2 -2
- package/es/slot/libro-slot-protocol.d.ts.map +1 -1
- package/es/slot/libro-slot-protocol.js +1 -1
- package/es/slot/libro-slot-view.d.ts +2 -2
- package/es/slot/libro-slot-view.d.ts.map +1 -1
- package/es/slot/libro-slot-view.js +3 -3
- package/es/slot/module.d.ts +1 -1
- package/es/slot/module.d.ts.map +1 -1
- package/es/slot/module.js +1 -1
- package/es/theme/libro-color-registry.d.ts +2 -2
- package/es/theme/libro-color-registry.d.ts.map +1 -1
- package/es/theme/libro-color-registry.js +2 -2
- package/es/toolbar/all-outputs-scroll-icon.js +1 -1
- package/es/toolbar/change-cell-to-selector.js +1 -1
- package/es/toolbar/hide-all-selector.js +2 -2
- package/es/toolbar/libro-toolbar.d.ts +2 -2
- package/es/toolbar/libro-toolbar.d.ts.map +1 -1
- package/es/toolbar/libro-toolbar.js +3 -3
- package/es/toolbar/module.d.ts +1 -1
- package/es/toolbar/module.d.ts.map +1 -1
- package/es/toolbar/module.js +1 -1
- package/es/toolbar/restart-clear-outputs-contribution.d.ts +2 -2
- package/es/toolbar/restart-clear-outputs-contribution.d.ts.map +1 -1
- package/es/toolbar/restart-clear-outputs-contribution.js +1 -1
- package/es/toolbar/restart-clear-outputs-modal.d.ts +1 -1
- package/es/toolbar/restart-clear-outputs-modal.d.ts.map +1 -1
- package/es/toolbar/restart-clear-outputs-modal.js +1 -1
- package/es/toolbar/save-icon.js +1 -1
- package/es/toolbar/shutdown-contribution.d.ts +2 -2
- package/es/toolbar/shutdown-contribution.d.ts.map +1 -1
- package/es/toolbar/shutdown-contribution.js +1 -1
- package/es/toolbar/shutdown-modal.d.ts +1 -1
- package/es/toolbar/shutdown-modal.d.ts.map +1 -1
- package/es/toolbar/side-toolar-more-select.js +4 -4
- package/es/utils/index.js +1 -1
- package/es/virtualized-manager-helper.js +1 -1
- package/es/virtualized-manager.d.ts.map +1 -1
- package/es/virtualized-manager.js +2 -9
- package/package.json +10 -9
- package/src/add-cell/libro-add-cell-module.ts +1 -1
- package/src/add-cell/libro-add-cell-slot-contribution.ts +2 -2
- package/src/add-cell/libro-add-cell-view.tsx +1 -1
- package/src/cell/libro-cell-contribution.ts +1 -1
- package/src/cell/libro-cell-model.ts +2 -2
- package/src/cell/libro-cell-module.ts +1 -1
- package/src/cell/libro-cell-protocol.ts +2 -2
- package/src/cell/libro-cell-service.ts +4 -4
- package/src/cell/libro-cell-view.tsx +7 -7
- package/src/cell/libro-edit-cell-view.tsx +1 -1
- package/src/cell/libro-executable-cell-model.ts +1 -1
- package/src/cell/libro-executable-cell-view.ts +3 -3
- package/src/collapse-service.ts +1 -1
- package/src/command/document-commands.ts +1 -1
- package/src/command/kernel-command.ts +2 -2
- package/src/command/libro-command-contribution.ts +3 -3
- package/src/command/libro-command-register.ts +2 -2
- package/src/command/module.ts +1 -1
- package/src/command/notebook-commands.ts +2 -2
- package/src/components/dnd-cell-item-render.tsx +2 -2
- package/src/components/dnd-component/default-dnd-content.tsx +101 -165
- package/src/components/dnd-component/dnd-list.tsx +309 -35
- package/src/components/dnd-component/index.less +84 -0
- package/src/components/dnd-component/index.tsx +0 -2
- package/src/components/dnd-component/virtualized-manager.ts +11 -8
- package/src/components/libro-component.tsx +2 -2
- package/src/components/libro-side-toolbar-menu.tsx +3 -3
- package/src/components/libro-view-header.tsx +1 -1
- package/src/content/libro-content-contribution.ts +1 -1
- package/src/content/libro-content-module.ts +1 -1
- package/src/content/libro-content-protocol.ts +1 -1
- package/src/content/libro-content-service.ts +2 -2
- package/src/content/libro-save-content-contribution.ts +1 -1
- package/src/formatter/libro-formatter-json-contribution.ts +1 -1
- package/src/formatter/libro-formatter-manager.ts +2 -2
- package/src/formatter/libro-formatter-module.ts +1 -1
- package/src/formatter/libro-formatter-protocol.ts +1 -1
- package/src/formatter/libro-formatter-string-contribution.ts +1 -1
- package/src/formatter/libro-formatter-trans-default-contribution.ts +1 -1
- package/src/index.less +0 -22
- package/src/index.tsx +3 -0
- package/src/libro-context-key.ts +4 -4
- package/src/libro-keybind-registry.ts +2 -2
- package/src/libro-model.ts +4 -4
- package/src/libro-protocol.ts +2 -2
- package/src/libro-service.ts +5 -5
- package/src/libro-setting-contribution.ts +1 -1
- package/src/libro-setting.ts +2 -2
- package/src/libro-view-tracker.ts +1 -1
- package/src/libro-view.tsx +8 -18
- package/src/libro-workspace-service.ts +2 -2
- package/src/module.ts +2 -2
- package/src/output/output-area.tsx +3 -3
- package/src/output/output-contribution.ts +1 -1
- package/src/output/output-model.tsx +2 -2
- package/src/output/output-module.ts +1 -1
- package/src/output/output-protocol.ts +3 -3
- package/src/settings/module.ts +1 -1
- package/src/settings/setting-editor/configuration-panel-view.tsx +2 -2
- package/src/settings/setting-editor/configuration-render-contribution.ts +2 -2
- package/src/settings/setting-editor/default-node-render.tsx +2 -2
- package/src/settings/setting-editor/module.ts +1 -1
- package/src/settings/setting-editor/setting-editor-view.tsx +2 -2
- package/src/settings/setting-editor/setting-tree-service.ts +3 -3
- package/src/settings/setting-editor/setting-tree-view.tsx +3 -3
- package/src/settings/settings-contribution.tsx +7 -3
- package/src/settings/settings-modal.tsx +4 -4
- package/src/settings/settings-protocol.ts +1 -1
- package/src/slot/libro-slot-manager.ts +3 -3
- package/src/slot/libro-slot-protocol.ts +2 -2
- package/src/slot/libro-slot-view.tsx +9 -4
- package/src/slot/module.ts +1 -1
- package/src/theme/libro-color-registry.ts +3 -3
- package/src/toolbar/all-outputs-scroll-icon.tsx +1 -1
- package/src/toolbar/change-cell-to-selector.tsx +2 -2
- package/src/toolbar/hide-all-selector.tsx +3 -3
- package/src/toolbar/libro-toolbar.tsx +4 -4
- package/src/toolbar/module.ts +1 -1
- package/src/toolbar/restart-clear-outputs-contribution.tsx +1 -1
- package/src/toolbar/restart-clear-outputs-modal.tsx +2 -2
- package/src/toolbar/save-icon.tsx +2 -2
- package/src/toolbar/shutdown-contribution.tsx +1 -1
- package/src/toolbar/shutdown-modal.tsx +1 -1
- package/src/toolbar/side-toolar-more-select.tsx +5 -5
- package/src/utils/index.ts +1 -1
- package/src/virtualized-manager-helper.ts +1 -1
- package/src/virtualized-manager.ts +10 -8
- package/es/components/dnd-component/custom-drag-layer.d.ts +0 -9
- package/es/components/dnd-component/custom-drag-layer.d.ts.map +0 -1
- package/es/components/dnd-component/custom-drag-layer.js +0 -140
- package/es/components/dnd-component/dnd-context.d.ts +0 -3
- package/es/components/dnd-component/dnd-context.d.ts.map +0 -1
- package/es/components/dnd-component/dnd-context.js +0 -20
- package/src/components/dnd-component/custom-drag-layer.tsx +0 -144
- package/src/components/dnd-component/dnd-context.tsx +0 -28
|
@@ -1,140 +0,0 @@
|
|
|
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
|
-
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
|
-
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
|
-
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
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
-
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); }
|
|
7
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
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
|
-
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
|
-
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
|
-
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
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
14
|
-
import { useInject, ViewInstance } from '@difizen/mana-app';
|
|
15
|
-
import { ViewRender } from '@difizen/mana-app';
|
|
16
|
-
import { useState, useEffect, memo } from 'react';
|
|
17
|
-
import { useDragLayer } from 'react-dnd';
|
|
18
|
-
import { LibroCellService } from "../../cell/index.js";
|
|
19
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
22
|
-
var layerStyles = {
|
|
23
|
-
position: 'fixed',
|
|
24
|
-
pointerEvents: 'none',
|
|
25
|
-
zIndex: 1000,
|
|
26
|
-
left: 0,
|
|
27
|
-
top: 0,
|
|
28
|
-
width: '300px',
|
|
29
|
-
height: '50px'
|
|
30
|
-
};
|
|
31
|
-
var getItemStyles = function getItemStyles(currentOffset) {
|
|
32
|
-
if (!currentOffset) {
|
|
33
|
-
return {
|
|
34
|
-
display: 'none'
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
var x = currentOffset.x,
|
|
38
|
-
y = currentOffset.y;
|
|
39
|
-
var transform = "translate(".concat(x, "px, ").concat(y, "px)");
|
|
40
|
-
return {
|
|
41
|
-
transform: transform,
|
|
42
|
-
WebkitTransform: transform
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
var MultipleSelectionPreview = function MultipleSelectionPreview(_ref) {
|
|
46
|
-
var activeCell = _ref.activeCell;
|
|
47
|
-
var cellService = useInject(LibroCellService);
|
|
48
|
-
var _useState = useState(),
|
|
49
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
50
|
-
multipleSelectionPreview = _useState2[0],
|
|
51
|
-
setMultipleSelectionPreview = _useState2[1];
|
|
52
|
-
useEffect(function () {
|
|
53
|
-
cellService.getOrCreateView(activeCell.model.options, activeCell.parent.id).then(function (view) {
|
|
54
|
-
setMultipleSelectionPreview(view);
|
|
55
|
-
return;
|
|
56
|
-
}).catch(function (e) {
|
|
57
|
-
//
|
|
58
|
-
});
|
|
59
|
-
}, []);
|
|
60
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
61
|
-
className: "libro-dnd-multiple-selection-preview",
|
|
62
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
63
|
-
className: "libro-dnd-active-selection",
|
|
64
|
-
children: multipleSelectionPreview && /*#__PURE__*/_jsx(ViewRender, {
|
|
65
|
-
view: multipleSelectionPreview
|
|
66
|
-
})
|
|
67
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
68
|
-
className: "libro-dnd-cascading-multiple-selection"
|
|
69
|
-
})]
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
export var MultipleSelectionPreviewMemo = /*#__PURE__*/memo(MultipleSelectionPreview);
|
|
73
|
-
var SingleSelectionDragPreview = function SingleSelectionDragPreview(_ref2) {
|
|
74
|
-
var activeCell = _ref2.activeCell;
|
|
75
|
-
var cellService = useInject(LibroCellService);
|
|
76
|
-
var _useState3 = useState(),
|
|
77
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
78
|
-
singleSelectionPreview = _useState4[0],
|
|
79
|
-
setSingleSelectionPreview = _useState4[1];
|
|
80
|
-
useEffect(function () {
|
|
81
|
-
cellService.getOrCreateView(_objectSpread(_objectSpread({}, activeCell.model.options), {}, {
|
|
82
|
-
modelId: activeCell.model.id,
|
|
83
|
-
singleSelectionDragPreview: true
|
|
84
|
-
}), activeCell.parent.id).then(function (view) {
|
|
85
|
-
setSingleSelectionPreview(view);
|
|
86
|
-
return;
|
|
87
|
-
}).catch(function (e) {
|
|
88
|
-
//
|
|
89
|
-
});
|
|
90
|
-
}, []);
|
|
91
|
-
return /*#__PURE__*/_jsx("div", {
|
|
92
|
-
className: "libro-dnd-active-selection",
|
|
93
|
-
children: singleSelectionPreview && /*#__PURE__*/_jsx(ViewRender, {
|
|
94
|
-
view: singleSelectionPreview
|
|
95
|
-
})
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
export var SingleSelectionPreviewMemo = /*#__PURE__*/memo(SingleSelectionDragPreview);
|
|
99
|
-
export var CustomDragLayer = function CustomDragLayer() {
|
|
100
|
-
var _useDragLayer = useDragLayer(function (monitor) {
|
|
101
|
-
return {
|
|
102
|
-
item: monitor.getItem(),
|
|
103
|
-
itemType: monitor.getItemType(),
|
|
104
|
-
currentOffset: monitor.getClientOffset(),
|
|
105
|
-
isDragging: monitor.isDragging()
|
|
106
|
-
};
|
|
107
|
-
}),
|
|
108
|
-
isDragging = _useDragLayer.isDragging,
|
|
109
|
-
item = _useDragLayer.item,
|
|
110
|
-
currentOffset = _useDragLayer.currentOffset;
|
|
111
|
-
var instance = useInject(ViewInstance);
|
|
112
|
-
function renderItem() {
|
|
113
|
-
var isItemSelected = instance.model.selections.findIndex(function (select) {
|
|
114
|
-
return select.id === item.cell.id;
|
|
115
|
-
}) >= 0;
|
|
116
|
-
if (instance.model.selections.length !== 0 && isItemSelected) {
|
|
117
|
-
return /*#__PURE__*/_jsx(_Fragment, {
|
|
118
|
-
children: instance.model.active && /*#__PURE__*/_jsx(MultipleSelectionPreviewMemo, {
|
|
119
|
-
activeCell: instance.model.active
|
|
120
|
-
})
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
return /*#__PURE__*/_jsx(_Fragment, {
|
|
124
|
-
children: instance.model.active && /*#__PURE__*/_jsx(SingleSelectionPreviewMemo, {
|
|
125
|
-
activeCell: instance.model.active
|
|
126
|
-
})
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
if (!isDragging) {
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
return /*#__PURE__*/_jsx("div", {
|
|
133
|
-
className: "libro-custom-drag-layer",
|
|
134
|
-
style: layerStyles,
|
|
135
|
-
children: /*#__PURE__*/_jsx("div", {
|
|
136
|
-
style: getItemStyles(currentOffset),
|
|
137
|
-
children: renderItem()
|
|
138
|
-
})
|
|
139
|
-
});
|
|
140
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dnd-context.d.ts","sourceRoot":"","sources":["../../../src/components/dnd-component/dnd-context.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAMhC,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,GAAG,CAmB9B,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { getOrigin, useInject } from '@difizen/mana-app';
|
|
2
|
-
import { ViewInstance } from '@difizen/mana-app';
|
|
3
|
-
import { DndProvider } from 'react-dnd';
|
|
4
|
-
import { HTML5Backend } from 'react-dnd-html5-backend';
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
export var DndContext = function DndContext(_ref) {
|
|
7
|
-
var _getOrigin$container;
|
|
8
|
-
var children = _ref.children;
|
|
9
|
-
var instance = useInject(ViewInstance);
|
|
10
|
-
if (!instance.isVisible && !instance.model.dndAreaNullEnable) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
return /*#__PURE__*/_jsx(DndProvider, {
|
|
14
|
-
backend: HTML5Backend,
|
|
15
|
-
options: {
|
|
16
|
-
rootElement: instance.isVisible || !instance.model.dndAreaNullEnable ? (_getOrigin$container = getOrigin(instance).container) === null || _getOrigin$container === void 0 ? void 0 : _getOrigin$container.current : null
|
|
17
|
-
},
|
|
18
|
-
children: children
|
|
19
|
-
});
|
|
20
|
-
};
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
|
-
import { useInject, ViewInstance } from '@difizen/mana-app';
|
|
3
|
-
import { ViewRender } from '@difizen/mana-app';
|
|
4
|
-
import type { FC, CSSProperties } from 'react';
|
|
5
|
-
import { useState, useEffect, memo } from 'react';
|
|
6
|
-
import type { XYCoord } from 'react-dnd';
|
|
7
|
-
import { useDragLayer } from 'react-dnd';
|
|
8
|
-
|
|
9
|
-
import type { CellService } from '../../cell/index.js';
|
|
10
|
-
import { LibroCellService } from '../../cell/index.js';
|
|
11
|
-
import type { CellView } from '../../libro-protocol.js';
|
|
12
|
-
import type { LibroView } from '../../libro-view.js';
|
|
13
|
-
|
|
14
|
-
export interface SelectionPreviewProps {
|
|
15
|
-
activeCell: CellView;
|
|
16
|
-
}
|
|
17
|
-
const layerStyles: CSSProperties = {
|
|
18
|
-
position: 'fixed',
|
|
19
|
-
pointerEvents: 'none',
|
|
20
|
-
zIndex: 1000,
|
|
21
|
-
left: 0,
|
|
22
|
-
top: 0,
|
|
23
|
-
width: '300px',
|
|
24
|
-
height: '50px',
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const getItemStyles = (currentOffset: XYCoord | null) => {
|
|
28
|
-
if (!currentOffset) {
|
|
29
|
-
return {
|
|
30
|
-
display: 'none',
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const { x, y } = currentOffset;
|
|
35
|
-
|
|
36
|
-
const transform = `translate(${x}px, ${y}px)`;
|
|
37
|
-
return {
|
|
38
|
-
transform,
|
|
39
|
-
WebkitTransform: transform,
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const MultipleSelectionPreview: FC<{ activeCell: CellView }> = ({ activeCell }) => {
|
|
44
|
-
const cellService = useInject<CellService>(LibroCellService);
|
|
45
|
-
const [multipleSelectionPreview, setMultipleSelectionPreview] = useState<CellView>();
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
cellService
|
|
48
|
-
.getOrCreateView(activeCell.model.options, activeCell.parent.id)
|
|
49
|
-
.then((view) => {
|
|
50
|
-
setMultipleSelectionPreview(view);
|
|
51
|
-
return;
|
|
52
|
-
})
|
|
53
|
-
.catch((e) => {
|
|
54
|
-
//
|
|
55
|
-
});
|
|
56
|
-
}, []);
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<div className="libro-dnd-multiple-selection-preview">
|
|
60
|
-
<div className="libro-dnd-active-selection">
|
|
61
|
-
{multipleSelectionPreview && <ViewRender view={multipleSelectionPreview} />}
|
|
62
|
-
</div>
|
|
63
|
-
<div className="libro-dnd-cascading-multiple-selection" />
|
|
64
|
-
</div>
|
|
65
|
-
);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export const MultipleSelectionPreviewMemo: FC<SelectionPreviewProps> = memo(
|
|
69
|
-
MultipleSelectionPreview,
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
const SingleSelectionDragPreview: FC<{ activeCell: CellView }> = ({ activeCell }) => {
|
|
73
|
-
const cellService = useInject<CellService>(LibroCellService);
|
|
74
|
-
const [singleSelectionPreview, setSingleSelectionPreview] = useState<CellView>();
|
|
75
|
-
useEffect(() => {
|
|
76
|
-
cellService
|
|
77
|
-
.getOrCreateView(
|
|
78
|
-
{
|
|
79
|
-
...activeCell.model.options,
|
|
80
|
-
modelId: activeCell.model.id,
|
|
81
|
-
singleSelectionDragPreview: true,
|
|
82
|
-
},
|
|
83
|
-
activeCell.parent.id,
|
|
84
|
-
)
|
|
85
|
-
.then((view) => {
|
|
86
|
-
setSingleSelectionPreview(view);
|
|
87
|
-
return;
|
|
88
|
-
})
|
|
89
|
-
.catch((e) => {
|
|
90
|
-
//
|
|
91
|
-
});
|
|
92
|
-
}, []);
|
|
93
|
-
|
|
94
|
-
return (
|
|
95
|
-
<div className="libro-dnd-active-selection">
|
|
96
|
-
{singleSelectionPreview && <ViewRender view={singleSelectionPreview} />}
|
|
97
|
-
</div>
|
|
98
|
-
);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
export const SingleSelectionPreviewMemo: FC<SelectionPreviewProps> = memo(
|
|
102
|
-
SingleSelectionDragPreview,
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
export const CustomDragLayer = () => {
|
|
106
|
-
const { isDragging, item, currentOffset } = useDragLayer((monitor) => ({
|
|
107
|
-
item: monitor.getItem(),
|
|
108
|
-
itemType: monitor.getItemType(),
|
|
109
|
-
currentOffset: monitor.getClientOffset(),
|
|
110
|
-
isDragging: monitor.isDragging(),
|
|
111
|
-
}));
|
|
112
|
-
|
|
113
|
-
const instance = useInject<LibroView>(ViewInstance);
|
|
114
|
-
|
|
115
|
-
function renderItem() {
|
|
116
|
-
const isItemSelected =
|
|
117
|
-
instance.model.selections.findIndex((select) => select.id === item.cell.id) >= 0;
|
|
118
|
-
if (instance.model.selections.length !== 0 && isItemSelected) {
|
|
119
|
-
return (
|
|
120
|
-
<>
|
|
121
|
-
{instance.model.active && (
|
|
122
|
-
<MultipleSelectionPreviewMemo activeCell={instance.model.active} />
|
|
123
|
-
)}
|
|
124
|
-
</>
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
return (
|
|
128
|
-
<>
|
|
129
|
-
{instance.model.active && (
|
|
130
|
-
<SingleSelectionPreviewMemo activeCell={instance.model.active} />
|
|
131
|
-
)}
|
|
132
|
-
</>
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (!isDragging) {
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
|
-
return (
|
|
140
|
-
<div className="libro-custom-drag-layer" style={layerStyles}>
|
|
141
|
-
<div style={getItemStyles(currentOffset)}>{renderItem()}</div>
|
|
142
|
-
</div>
|
|
143
|
-
);
|
|
144
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { getOrigin, useInject } from '@difizen/mana-app';
|
|
2
|
-
import { ViewInstance } from '@difizen/mana-app';
|
|
3
|
-
import type { FC } from 'react';
|
|
4
|
-
import { DndProvider } from 'react-dnd';
|
|
5
|
-
import { HTML5Backend } from 'react-dnd-html5-backend';
|
|
6
|
-
|
|
7
|
-
import type { LibroView } from '../../libro-view.js';
|
|
8
|
-
|
|
9
|
-
export const DndContext: FC<any> = ({ children }) => {
|
|
10
|
-
const instance = useInject<LibroView>(ViewInstance);
|
|
11
|
-
|
|
12
|
-
if (!instance.isVisible && !instance.model.dndAreaNullEnable) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
return (
|
|
16
|
-
<DndProvider
|
|
17
|
-
backend={HTML5Backend}
|
|
18
|
-
options={{
|
|
19
|
-
rootElement:
|
|
20
|
-
instance.isVisible || !instance.model.dndAreaNullEnable
|
|
21
|
-
? getOrigin(instance).container?.current
|
|
22
|
-
: null,
|
|
23
|
-
}}
|
|
24
|
-
>
|
|
25
|
-
{children}
|
|
26
|
-
</DndProvider>
|
|
27
|
-
);
|
|
28
|
-
};
|