ebaoferc 0.0.1 → 0.0.2-beta.1

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.
Files changed (141) hide show
  1. package/dist/{FlexRowCol → components/FlexRowCol}/index.js +1 -1
  2. package/dist/components/MindGraph/core/default.d.ts +6 -0
  3. package/dist/components/MindGraph/core/default.js +81 -0
  4. package/dist/components/MindGraph/core/graphic/drag.d.ts +42 -0
  5. package/dist/components/MindGraph/core/graphic/drag.js +120 -0
  6. package/dist/components/MindGraph/core/graphic/index.d.ts +181 -0
  7. package/dist/components/MindGraph/core/graphic/index.js +423 -0
  8. package/dist/components/MindGraph/core/graphic/node-translate-to.d.ts +11 -0
  9. package/dist/components/MindGraph/core/graphic/node-translate-to.js +55 -0
  10. package/dist/components/MindGraph/core/graphic/zoom.d.ts +17 -0
  11. package/dist/components/MindGraph/core/graphic/zoom.js +90 -0
  12. package/dist/components/MindGraph/core/helper/breadth-first-walk-tree.d.ts +5 -0
  13. package/dist/components/MindGraph/core/helper/breadth-first-walk-tree.js +21 -0
  14. package/dist/components/MindGraph/core/helper/depth-first-walk-tree.d.ts +10 -0
  15. package/dist/components/MindGraph/core/helper/depth-first-walk-tree.js +17 -0
  16. package/dist/components/MindGraph/core/helper/descendant.d.ts +6 -0
  17. package/dist/components/MindGraph/core/helper/descendant.js +28 -0
  18. package/dist/components/MindGraph/core/helper/error.d.ts +1 -0
  19. package/dist/components/MindGraph/core/helper/error.js +3 -0
  20. package/dist/components/MindGraph/core/helper/get-layout-calc-children.d.ts +10 -0
  21. package/dist/components/MindGraph/core/helper/get-layout-calc-children.js +37 -0
  22. package/dist/components/MindGraph/core/helper/get-svg-path-id.d.ts +1 -0
  23. package/dist/components/MindGraph/core/helper/get-svg-path-id.js +4 -0
  24. package/dist/components/MindGraph/core/helper/index.d.ts +23 -0
  25. package/dist/components/MindGraph/core/helper/index.js +26 -0
  26. package/dist/components/MindGraph/core/helper/judge-if-all-child-fold.d.ts +7 -0
  27. package/dist/components/MindGraph/core/helper/judge-if-all-child-fold.js +14 -0
  28. package/dist/components/MindGraph/core/helper/judge-if-heir-and-fold.d.ts +10 -0
  29. package/dist/components/MindGraph/core/helper/judge-if-heir-and-fold.js +26 -0
  30. package/dist/components/MindGraph/core/helper/judge-if-visual-leaf.d.ts +6 -0
  31. package/dist/components/MindGraph/core/helper/judge-if-visual-leaf.js +7 -0
  32. package/dist/components/MindGraph/core/helper/root-to-node-array.d.ts +2 -0
  33. package/dist/components/MindGraph/core/helper/root-to-node-array.js +27 -0
  34. package/dist/components/MindGraph/core/helper/transform-root-to-walkable.d.ts +5 -0
  35. package/dist/components/MindGraph/core/helper/transform-root-to-walkable.js +32 -0
  36. package/dist/components/MindGraph/core/helper/with-prefix.d.ts +1 -0
  37. package/dist/components/MindGraph/core/helper/with-prefix.js +3 -0
  38. package/dist/components/MindGraph/core/index.d.ts +394 -0
  39. package/dist/components/MindGraph/core/index.js +86 -0
  40. package/dist/components/MindGraph/core/process/anchor.d.ts +12 -0
  41. package/dist/components/MindGraph/core/process/anchor.js +63 -0
  42. package/dist/components/MindGraph/core/process/index.d.ts +91 -0
  43. package/dist/components/MindGraph/core/process/index.js +30 -0
  44. package/dist/components/MindGraph/core/process/layout/dagre.d.ts +2 -0
  45. package/dist/components/MindGraph/core/process/layout/dagre.js +20 -0
  46. package/dist/components/MindGraph/core/process/layout/descendant-center.d.ts +10 -0
  47. package/dist/components/MindGraph/core/process/layout/descendant-center.js +146 -0
  48. package/dist/components/MindGraph/core/process/layout/heir-center.d.ts +10 -0
  49. package/dist/components/MindGraph/core/process/layout/heir-center.js +52 -0
  50. package/dist/components/MindGraph/core/process/layout/index.d.ts +3 -0
  51. package/dist/components/MindGraph/core/process/layout/index.js +3 -0
  52. package/dist/components/MindGraph/core/process/layout/structured/calc-drag-attach.d.ts +2 -0
  53. package/dist/components/MindGraph/core/process/layout/structured/calc-drag-attach.js +172 -0
  54. package/dist/components/MindGraph/core/process/layout/structured/calc-drop-index.d.ts +2 -0
  55. package/dist/components/MindGraph/core/process/layout/structured/calc-drop-index.js +38 -0
  56. package/dist/components/MindGraph/core/process/layout/structured/get-node-cross-boundary.d.ts +10 -0
  57. package/dist/components/MindGraph/core/process/layout/structured/get-node-cross-boundary.js +35 -0
  58. package/dist/components/MindGraph/core/process/layout/structured/index.d.ts +13 -0
  59. package/dist/components/MindGraph/core/process/layout/structured/index.js +321 -0
  60. package/dist/components/MindGraph/core/process/layout/type.d.ts +44 -0
  61. package/dist/components/MindGraph/core/process/layout/type.js +51 -0
  62. package/dist/components/MindGraph/core/process/line.d.ts +9 -0
  63. package/dist/components/MindGraph/core/process/line.js +69 -0
  64. package/dist/components/MindGraph/core/process/node-valid.d.ts +6 -0
  65. package/dist/components/MindGraph/core/process/node-valid.js +35 -0
  66. package/dist/components/MindGraph/core/process/orientation.d.ts +8 -0
  67. package/dist/components/MindGraph/core/process/orientation.js +40 -0
  68. package/dist/components/MindGraph/core/process/size.d.ts +4 -0
  69. package/dist/components/MindGraph/core/process/size.js +16 -0
  70. package/dist/components/MindGraph/core/process/visible.d.ts +16 -0
  71. package/dist/components/MindGraph/core/process/visible.js +99 -0
  72. package/dist/components/MindGraph/core/render/calc-visible.d.ts +11 -0
  73. package/dist/components/MindGraph/core/render/calc-visible.js +25 -0
  74. package/dist/components/MindGraph/core/render/connect/bezier.d.ts +2 -0
  75. package/dist/components/MindGraph/core/render/connect/bezier.js +12 -0
  76. package/dist/components/MindGraph/core/render/connect/get-path-render.d.ts +2 -0
  77. package/dist/components/MindGraph/core/render/connect/get-path-render.js +17 -0
  78. package/dist/components/MindGraph/core/render/connect/index.d.ts +10 -0
  79. package/dist/components/MindGraph/core/render/connect/index.js +45 -0
  80. package/dist/components/MindGraph/core/render/connect/line.d.ts +2 -0
  81. package/dist/components/MindGraph/core/render/connect/line.js +71 -0
  82. package/dist/components/MindGraph/core/render/connect/temporary-line.d.ts +15 -0
  83. package/dist/components/MindGraph/core/render/connect/temporary-line.js +44 -0
  84. package/dist/components/MindGraph/core/render/index.d.ts +27 -0
  85. package/dist/components/MindGraph/core/render/index.js +8 -0
  86. package/dist/components/MindGraph/core/render/layout.d.ts +12 -0
  87. package/dist/components/MindGraph/core/render/layout.js +85 -0
  88. package/dist/components/MindGraph/demo.js +54 -0
  89. package/dist/components/MindGraph/index.d.ts +3 -0
  90. package/dist/components/MindGraph/index.js +3 -0
  91. package/dist/components/MindGraph/react/component/index.d.ts +3 -0
  92. package/dist/components/MindGraph/react/component/index.js +227 -0
  93. package/dist/components/MindGraph/react/component/index.module.less +72 -0
  94. package/dist/components/MindGraph/react/component/nodes.d.ts +13 -0
  95. package/dist/components/MindGraph/react/component/nodes.js +153 -0
  96. package/dist/components/MindGraph/react/hook/use-drag.d.ts +20 -0
  97. package/dist/components/MindGraph/react/hook/use-drag.js +191 -0
  98. package/dist/components/MindGraph/react/hook/use-shadow-state.d.ts +2 -0
  99. package/dist/components/MindGraph/react/hook/use-shadow-state.js +24 -0
  100. package/dist/components/MindGraph/react/index.d.ts +154 -0
  101. package/dist/components/MindGraph/react/index.js +9 -0
  102. package/dist/components/MindGraph/react/scrollbar/axis/index.d.ts +25 -0
  103. package/dist/components/MindGraph/react/scrollbar/axis/index.js +143 -0
  104. package/dist/components/MindGraph/react/scrollbar/axis/index.module.less +48 -0
  105. package/dist/components/MindGraph/react/scrollbar/index.d.ts +8 -0
  106. package/dist/components/MindGraph/react/scrollbar/index.js +134 -0
  107. package/dist/components/MindGraph/react/tools/class-name-wrapper.d.ts +1 -0
  108. package/dist/components/MindGraph/react/tools/class-name-wrapper.js +5 -0
  109. package/dist/{SliderVerify → components/SliderVerify}/icons/close.js +0 -1
  110. package/dist/{SliderVerify → components/SliderVerify}/icons/refresh.js +0 -1
  111. package/dist/components/SliderVerify/icons/slider.d.ts +1 -0
  112. package/dist/{SliderVerify → components/SliderVerify}/icons/slider.js +0 -1
  113. package/dist/{SliderVerify → components/SliderVerify}/style.module.less +119 -121
  114. package/dist/{StyledQueryFilter → components/StyledQueryFilter}/index.less +22 -22
  115. package/dist/{StyledTable → components/StyledTable}/index.less +11 -11
  116. package/dist/{TabSearchTools → components/TabSearchTools}/index.d.ts +2 -2
  117. package/dist/{TabSearchTools → components/TabSearchTools}/index.js +1 -1
  118. package/dist/components/index.d.ts +6 -0
  119. package/dist/components/index.js +6 -0
  120. package/dist/hooks/index.d.ts +1 -0
  121. package/dist/hooks/index.js +1 -0
  122. package/dist/hooks/useBIHooks/index.d.ts +10 -0
  123. package/dist/hooks/useBIHooks/index.js +64 -0
  124. package/dist/index.d.ts +3 -5
  125. package/dist/index.js +3 -5
  126. package/dist/utils/bi/index.d.ts +2 -0
  127. package/dist/utils/bi/index.js +35 -0
  128. package/dist/utils/format/index.js +8 -8
  129. package/dist/utils/index.d.ts +1 -0
  130. package/dist/utils/index.js +1 -0
  131. package/package.json +33 -20
  132. /package/dist/{FlexRowCol → components/FlexRowCol}/index.d.ts +0 -0
  133. /package/dist/{SliderVerify/icons/close.d.ts → components/MindGraph/demo.d.ts} +0 -0
  134. /package/dist/{SliderVerify/icons/refresh.d.ts → components/SliderVerify/icons/close.d.ts} +0 -0
  135. /package/dist/{SliderVerify/icons/slider.d.ts → components/SliderVerify/icons/refresh.d.ts} +0 -0
  136. /package/dist/{SliderVerify → components/SliderVerify}/index.d.ts +0 -0
  137. /package/dist/{SliderVerify → components/SliderVerify}/index.js +0 -0
  138. /package/dist/{StyledQueryFilter → components/StyledQueryFilter}/index.d.ts +0 -0
  139. /package/dist/{StyledQueryFilter → components/StyledQueryFilter}/index.js +0 -0
  140. /package/dist/{StyledTable → components/StyledTable}/index.d.ts +0 -0
  141. /package/dist/{StyledTable → components/StyledTable}/index.js +0 -0
@@ -9,7 +9,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
9
9
  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; }
10
10
  import { useSize } from 'ahooks';
11
11
  import { Col, Row } from 'antd';
12
- import React, { Children, isValidElement, useRef } from 'react';
12
+ import { Children, isValidElement, useRef } from 'react';
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  export var Gutter = [24, 0];
15
15
  export default function (props) {
@@ -0,0 +1,6 @@
1
+ import { Mind } from './index';
2
+ export declare const WithDefault: {
3
+ cache: (data?: Mind.NodeCache | undefined) => Required<Mind.NodeCache>;
4
+ options: (data?: Mind.Options | undefined) => Required<Mind.Options>;
5
+ transform: (data?: Mind.Transform | undefined) => Required<Mind.Transform>;
6
+ };
@@ -0,0 +1,81 @@
1
+ import { merge } from 'lodash';
2
+ import { Mind } from "./index";
3
+
4
+ // 函数式动态生成默认值,防止 value 为对象时的重复引用
5
+
6
+ var generateOptions = function generateOptions() {
7
+ return {
8
+ callback: {
9
+ onNodeVisibleChange: function onNodeVisibleChange(_n) {},
10
+ onTransformChange: function onTransformChange(_t) {}
11
+ },
12
+ childAlignMode: Mind.ChildAlignMode.structured,
13
+ direction: Mind.Direction.x,
14
+ event: {
15
+ onViewportContextMenu: function onViewportContextMenu(_e) {},
16
+ onZoomEventTrigger: {
17
+ end: function end(_e) {},
18
+ start: function start(_e) {},
19
+ zoom: function zoom(_e) {}
20
+ }
21
+ },
22
+ lineStyle: Mind.LinkStyle.bezier,
23
+ nodeSeparate: 50,
24
+ rankSeparate: 50,
25
+ viewportPreloadPadding: 0,
26
+ zoomExtent: {},
27
+ disableLinesTailor: false
28
+ };
29
+ };
30
+ var generateCache = function generateCache() {
31
+ return {
32
+ line: {
33
+ source: {
34
+ x: 0,
35
+ y: 0
36
+ },
37
+ target: {
38
+ x: 0,
39
+ y: 0
40
+ }
41
+ },
42
+ node: {},
43
+ orientation: Mind.Orientation.root,
44
+ processCache: {},
45
+ rect: {
46
+ height: 0,
47
+ width: 0,
48
+ x: 0,
49
+ y: 0
50
+ },
51
+ visible: {
52
+ lineAttachParent: true,
53
+ node: true
54
+ }
55
+ };
56
+ };
57
+ var generateTransform = function generateTransform() {
58
+ return {
59
+ scale: 1,
60
+ x: 0,
61
+ y: 0
62
+ };
63
+ };
64
+ var withDefaultBuilder = function withDefaultBuilder(defaultData) {
65
+ return /* eslint-disable */(
66
+ function (data) {
67
+ if (data) {
68
+ return merge(defaultData(), data);
69
+ } else {
70
+ return defaultData();
71
+ }
72
+ }
73
+ );
74
+ };
75
+ /* eslint-enable */
76
+
77
+ export var WithDefault = {
78
+ cache: withDefaultBuilder(generateCache),
79
+ options: withDefaultBuilder(generateOptions),
80
+ transform: withDefaultBuilder(generateTransform)
81
+ };
@@ -0,0 +1,42 @@
1
+ import { Mind } from '../index';
2
+ export declare class Drag {
3
+ private readonly options;
4
+ private readonly cacheMap;
5
+ private readonly root;
6
+ private readonly dragNode;
7
+ private readonly ignoreNodes;
8
+ private temporaryLine;
9
+ private readonly container;
10
+ private readonly draggableLayout;
11
+ constructor(context: {
12
+ options: Required<Mind.Options>;
13
+ cacheMap: Mind.CacheMap;
14
+ root: Mind.Root;
15
+ dragNode: Mind.Node;
16
+ container: HTMLElement;
17
+ });
18
+ /**
19
+ * 获取拖动节点插入到关联节点子代的下标
20
+ * @param attachedNodeChildren 关联节点的子代
21
+ * @param dropPosition 拖动节点镜像中心位置
22
+ * @param dragNode 拖动节点
23
+ * @param attachedNode 被关联的节点
24
+ * @return 期望插入位置
25
+ */
26
+ calcDropIndex: (attachedNodeChildren: Mind.Node[] | undefined, dropPosition: Mind.Coordinate, dragNode: Mind.Node, attachedNode: Mind.Node) => number;
27
+ /**
28
+ * 拖动操作
29
+ * - 根节点不可拖拽
30
+ * @param position 拖动节点镜像中心位置
31
+ * @param canBeAttachedNodes 需要搜索的可关联节点
32
+ * @return 链接关联信息
33
+ */
34
+ drag: (position: Mind.Coordinate, canBeAttachedNodes: Mind.Node[]) => {
35
+ attach: Mind.Node;
36
+ orientation: Mind.Orientation;
37
+ } | undefined;
38
+ /**
39
+ * 通知控制器拖动操作结束
40
+ */
41
+ end: () => void;
42
+ }
@@ -0,0 +1,120 @@
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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
+ 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."); }
4
+ 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); }
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
+ 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; }
8
+ 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; }
9
+ 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; }
10
+ 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); } }
11
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
12
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13
+ 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; }
14
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
15
+ 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); }
16
+ import { Helper } from "../helper";
17
+ import { Process } from "../process";
18
+ import { DraggableLayout } from "../process/layout/type";
19
+ import { TemporaryLine } from "../render/connect/temporary-line";
20
+ export var Drag = /*#__PURE__*/_createClass(function Drag(context) {
21
+ var _this = this;
22
+ _classCallCheck(this, Drag);
23
+ _defineProperty(this, "options", void 0);
24
+ _defineProperty(this, "cacheMap", void 0);
25
+ _defineProperty(this, "root", void 0);
26
+ _defineProperty(this, "dragNode", void 0);
27
+ _defineProperty(this, "ignoreNodes", void 0);
28
+ _defineProperty(this, "temporaryLine", void 0);
29
+ _defineProperty(this, "container", void 0);
30
+ _defineProperty(this, "draggableLayout", void 0);
31
+ /**
32
+ * 获取拖动节点插入到关联节点子代的下标
33
+ * @param attachedNodeChildren 关联节点的子代
34
+ * @param dropPosition 拖动节点镜像中心位置
35
+ * @param dragNode 拖动节点
36
+ * @param attachedNode 被关联的节点
37
+ * @return 期望插入位置
38
+ */
39
+ _defineProperty(this, "calcDropIndex", function (attachedNodeChildren, dropPosition, dragNode, attachedNode) {
40
+ return _this.draggableLayout.calcDropIndex({
41
+ attachedNode: attachedNode,
42
+ attachedNodeChildren: attachedNodeChildren,
43
+ cacheMap: _this.cacheMap,
44
+ dragNode: dragNode,
45
+ dropPosition: dropPosition,
46
+ options: _this.options,
47
+ root: _this.root
48
+ });
49
+ });
50
+ /**
51
+ * 拖动操作
52
+ * - 根节点不可拖拽
53
+ * @param position 拖动节点镜像中心位置
54
+ * @param canBeAttachedNodes 需要搜索的可关联节点
55
+ * @return 链接关联信息
56
+ */
57
+ _defineProperty(this, "drag", function (position, canBeAttachedNodes) {
58
+ var cache = _this.cacheMap.get(_this.dragNode.id);
59
+
60
+ // 根节点不可拖拽
61
+ if (!cache || cache.node.id === _this.root.node.id) {
62
+ return undefined;
63
+ }
64
+ var dragAttach = _this.draggableLayout.calcDragAttach({
65
+ cacheMap: _this.cacheMap,
66
+ canBeAttachedNodes: canBeAttachedNodes,
67
+ draggingRect: _objectSpread(_objectSpread({}, position), {}, {
68
+ height: cache.rect.height,
69
+ width: cache.rect.width
70
+ }),
71
+ ignoreNodes: _this.ignoreNodes,
72
+ options: _this.options,
73
+ root: _this.root
74
+ });
75
+
76
+ // 数据成功获取
77
+ if (dragAttach) {
78
+ _this.temporaryLine.render({
79
+ source: dragAttach.link.source,
80
+ target: dragAttach.link.target
81
+ });
82
+ return {
83
+ attach: dragAttach.node,
84
+ orientation: dragAttach.orientation
85
+ };
86
+ } else {
87
+ _this.temporaryLine.render();
88
+ return undefined;
89
+ }
90
+ });
91
+ /**
92
+ * 通知控制器拖动操作结束
93
+ */
94
+ _defineProperty(this, "end", function () {
95
+ _this.temporaryLine.destroy();
96
+ });
97
+ var options = context.options,
98
+ root = context.root,
99
+ _dragNode = context.dragNode,
100
+ cacheMap = context.cacheMap,
101
+ container = context.container;
102
+ this.options = options;
103
+ this.root = root;
104
+ this.dragNode = _dragNode;
105
+ this.cacheMap = cacheMap;
106
+ this.container = container;
107
+ this.draggableLayout = Process.getLayoutProcess(options);
108
+ // 检查当前使用的算法是否支持拖拽操作,如不支持,则报错
109
+ if (!DraggableLayout.isValidExtendsClass(this.draggableLayout)) {
110
+ if (options.layoutProcess) {
111
+ throw Helper.error("The custom layoutProcess is not support drag action, it should extends DraggableLayout");
112
+ } else {
113
+ throw Helper.error("The childAlignMode=\"".concat(options.childAlignMode, "\" match layout process ").concat(this.draggableLayout.name, " is not support drag action"));
114
+ }
115
+ }
116
+ // 当前节点以及其后代,全部忽略计算
117
+ this.ignoreNodes = [this.dragNode].concat(_toConsumableArray(Helper.descendant(this.dragNode)));
118
+ // 创建临时线
119
+ this.temporaryLine = new TemporaryLine(this.container, this.cacheMap, this.options);
120
+ });
@@ -0,0 +1,181 @@
1
+ import { Mind } from '../index';
2
+ import { Drag } from './drag';
3
+ export declare class Graphic {
4
+ /**
5
+ * 节点相关信息缓存,树形结构拍平
6
+ */
7
+ private cacheMap;
8
+ private options;
9
+ private readonly container;
10
+ private readonly viewport;
11
+ private transform;
12
+ private root?;
13
+ private anchor?;
14
+ private resizeObserver;
15
+ private unbindCache;
16
+ private readonly zoom;
17
+ /**
18
+ * 脑图管理器
19
+ * - `viewport`用作判断可视区域
20
+ * - svg连线将会自动注入到`container`中
21
+ * - transform 相关信息将会自动注入到`container`中
22
+ * @param viewport 视窗
23
+ * @param container 容器
24
+ * @param options 配置参数
25
+ */
26
+ constructor(viewport: HTMLElement, container: HTMLElement, options?: Mind.Options);
27
+ /**
28
+ * 同步 options 中的 zoom extent
29
+ */
30
+ private syncZoomExtentOptions;
31
+ /**
32
+ * 获取当前可见的节点
33
+ */
34
+ private getVisibleNodes;
35
+ /**
36
+ * 获取节点定位锚点(左上角)位置,可在节点绘制的时候确定其位置
37
+ * - 推荐所有节点使用`position:absolute;left:0;top:0;`并且配合`transform`来定位,避免出现绘制异常
38
+ * @param id 节点对应id
39
+ */
40
+ getNodeAnchorCoordinate: (id: string) => Mind.Coordinate | undefined;
41
+ private bindEventListener;
42
+ private onTransform;
43
+ /**
44
+ * - 计算节点可见是否改变,如改变,则通知外部
45
+ * - 重渲染连线,销毁不必要的连线
46
+ */
47
+ private refreshVisible;
48
+ private throttleRefreshVisible;
49
+ /**
50
+ * 视窗尺寸变化
51
+ * @private
52
+ */
53
+ private onViewportResize;
54
+ /**
55
+ * 注销事件绑定
56
+ * - 请在销毁组件之前调用
57
+ */
58
+ unbind: () => void;
59
+ /**
60
+ * 判断节点是否可视
61
+ * @param id 节点对应id
62
+ */
63
+ judgeNodeVisible: (id: string) => boolean;
64
+ /**
65
+ * 设定 `options`
66
+ * - 函数不会自动执行重渲染,如果改变的`options`需要重新计算布局等操作,推荐使用 `setData` 驱动数据重渲染
67
+ * @param options 设定选项
68
+ * @param isMerge 是否与之前的`options`做合并操作
69
+ */
70
+ setOptions: (options?: Mind.Options, isMerge?: boolean) => void;
71
+ /**
72
+ * 生成拖动控制器
73
+ * - 根节点不可拖拽
74
+ * - 当前暂时只有`Mind.ChildAlignMode.structured`布局算法支持拖拽功能
75
+ * @param drag 拖动节点node对象或id
76
+ * @return
77
+ * - 当root(没有调用`setData`)不存在时,或者`drag`为根节点时,返回`undefined`
78
+ * - 正常情况返回 `Drag` 类对象
79
+ */
80
+ dragControllerBuilder: (drag: Mind.Node | string) => Drag | undefined;
81
+ /**
82
+ * 获取渲染层尺寸
83
+ */
84
+ getLayoutSize: () => Mind.Size | undefined;
85
+ /**
86
+ * 获取`id`对应节点
87
+ * @param id 节点`id`
88
+ */
89
+ getNode: (id: string) => Mind.Node | undefined;
90
+ /**
91
+ * 获取`id`对应节点父级
92
+ * @param id 节点`id`
93
+ */
94
+ getParent: (id: string) => Mind.Node | undefined;
95
+ /**
96
+ * 获取`id`对应节点渲染方位
97
+ * @param id 节点`id`
98
+ */
99
+ getNodeOrientation: (id: string) => Mind.Orientation | undefined;
100
+ /**
101
+ * 主动设置位移缩放
102
+ * - 会与之前的`transform`做深度合并
103
+ * - 请注意:`setTransform` 之后 `onTransformChange` 事件依旧会触发
104
+ * - 此方法不受 `zoomExtent.translate`、`zoomExtent.scale` 限制
105
+ * @param transform 位移缩放数据
106
+ * @param duration 周期,如果配置,则执行变换会附带动画效果
107
+ */
108
+ setTransform: (transform: Partial<Mind.Transform>, duration?: number) => void;
109
+ /**
110
+ * 设定位移
111
+ * - 此方法受到 `zoomExtent.translate` 限制
112
+ * @param translate 位移差(屏幕尺度)
113
+ * @param duration 周期,如果配置,则执行变换会附带动画效果
114
+ */
115
+ translate: (translate: Mind.Coordinate, duration?: number) => void;
116
+ /**
117
+ * 设定缩放
118
+ * - 此方法受到 `zoomExtent.translate` 限制
119
+ * - 此方法受到 `zoomExtent.scale` 限制
120
+ * @param scale 缩放比
121
+ * @param point 缩放相对点(如不配置或为`undefined`,则默认相对于`viewport`中心缩放)
122
+ * @param duration 动画周期,如配置,则位移会附带动画效果
123
+ */
124
+ scale: (scale: number, point?: Mind.Coordinate, duration?: number) => void;
125
+ /**
126
+ * 将某一个节点中心从某个相对位置做位移(其尺度为屏幕尺度)操作
127
+ * - 此方法不受 `zoomExtent.translate` 限制
128
+ * @param config 配置参数
129
+ * @param config.id 节点id
130
+ * @param config.diff 位移差
131
+ * @param config.relative 相对位置
132
+ * @param duration 动画周期,如配置,则位移会附带动画效果
133
+ */
134
+ nodeTranslateTo: (config: {
135
+ id: string;
136
+ diff: Mind.Coordinate;
137
+ relative: Mind.Relative;
138
+ }, duration?: number) => void;
139
+ /**
140
+ * 获取位移缩放信息
141
+ */
142
+ getTransform: () => Mind.Transform;
143
+ /**
144
+ * 设置锚点节点
145
+ * @param id 锚定节点id(如不设定,则清空锚点,根节点居中,缩放比归一)
146
+ */
147
+ setAnchor: (id?: string) => void;
148
+ /**
149
+ * 设置/更新数据,启动重渲染
150
+ * - 在重计算定位时,将保持 `anchor` 对应节点在屏幕上的相对位置不变
151
+ * - 如果 `anchor` 没有设定,或者找不到对应节点,则,根节点居中,缩放比重置为1
152
+ * @param root 根数据
153
+ */
154
+ setData: (root: Mind.Root) => void;
155
+ /**
156
+ * 刷新
157
+ */
158
+ refresh: () => void;
159
+ /**
160
+ * 渲染链接到某个`container`下
161
+ * @param container 容器
162
+ */
163
+ connectTo: (container: HTMLElement) => void;
164
+ /**
165
+ * 同步渲染层尺寸到 container 中
166
+ */
167
+ private syncLayoutSize;
168
+ /**
169
+ * 链接各个节点
170
+ */
171
+ private connect;
172
+ /**
173
+ * 计算脑图布局
174
+ * - 请保证调用之前 data 已经通过 setData 设置完备
175
+ */
176
+ private layout;
177
+ /**
178
+ * 计算各节点可见性,以及链接可见性
179
+ */
180
+ private calcVisible;
181
+ }