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
@@ -0,0 +1,99 @@
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 _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); } }
5
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
6
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
7
+ 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; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
+ 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); }
10
+ import { Helper } from "../helper";
11
+ export var Visible = /*#__PURE__*/_createClass(function Visible() {
12
+ var _this = this;
13
+ _classCallCheck(this, Visible);
14
+ _defineProperty(this, "viewport", void 0);
15
+ _defineProperty(this, "transform", void 0);
16
+ _defineProperty(this, "root", void 0);
17
+ _defineProperty(this, "cacheMap", void 0);
18
+ _defineProperty(this, "options", void 0);
19
+ _defineProperty(this, "getRootHeirOrientation", void 0);
20
+ _defineProperty(this, "start", function (context) {
21
+ var viewport = context.viewport,
22
+ transform = context.transform,
23
+ root = context.root,
24
+ cacheMap = context.cacheMap,
25
+ options = context.options,
26
+ getRootHeirOrientation = context.getRootHeirOrientation;
27
+ _this.viewport = viewport;
28
+ _this.transform = transform;
29
+ _this.root = root;
30
+ _this.cacheMap = cacheMap;
31
+ _this.options = options;
32
+ _this.getRootHeirOrientation = getRootHeirOrientation;
33
+ });
34
+ /**
35
+ * 返回可见是否改变
36
+ * - 使用次返回值得前提是,数据没有出现改变(也就是在viewport尺寸改变或者transform时可以使用)
37
+ */
38
+ _defineProperty(this, "end", function () {
39
+ var visibleChange = {
40
+ lineAttachParent: false,
41
+ node: false
42
+ };
43
+ var viewportSize = {
44
+ height: _this.viewport.clientHeight,
45
+ width: _this.viewport.clientWidth
46
+ };
47
+
48
+ // 屏幕坐标转换到绘制坐标系
49
+ var normalizedArea = {
50
+ bottom: (viewportSize.height + _this.options.viewportPreloadPadding - _this.transform.y) / _this.transform.scale,
51
+ left: (-_this.options.viewportPreloadPadding - _this.transform.x) / _this.transform.scale,
52
+ right: (viewportSize.width + _this.options.viewportPreloadPadding - _this.transform.x) / _this.transform.scale,
53
+ top: (-_this.options.viewportPreloadPadding - _this.transform.y) / _this.transform.scale
54
+ };
55
+
56
+ // 广度优先搜索
57
+ Helper.breadthFirstWalkTree(_this.cacheMap.get(_this.root.node.id).node, {
58
+ after: function after() {},
59
+ before: function before(node) {
60
+ var cache = _this.cacheMap.get(node.id);
61
+ if (!cache || Helper.judgeIfHeirAndFold(node, cache.parent, _this.root, _this.getRootHeirOrientation)) {
62
+ return false;
63
+ }
64
+ var preVisible = _objectSpread({}, cache.visible);
65
+ cache.visible.node = true;
66
+ cache.visible.lineAttachParent = true;
67
+ var rect = cache.rect;
68
+ if (rect.x - rect.width / 2 > normalizedArea.right || rect.x + rect.width / 2 < normalizedArea.left || rect.y - rect.height / 2 > normalizedArea.bottom || rect.y + rect.height / 2 < normalizedArea.top) {
69
+ cache.visible.node = false;
70
+ }
71
+ if (cache.parent) {
72
+ var lineBelongArea = {
73
+ bottom: Math.max(cache.line.source.y, cache.line.target.y),
74
+ left: Math.min(cache.line.source.x, cache.line.target.x),
75
+ right: Math.max(cache.line.source.x, cache.line.target.x),
76
+ top: Math.min(cache.line.source.y, cache.line.target.y)
77
+ };
78
+
79
+ // 连线所属区域超出了可视区域,则直接隐藏连线
80
+ if (lineBelongArea.left > normalizedArea.right || lineBelongArea.right < normalizedArea.left || lineBelongArea.bottom < normalizedArea.top || lineBelongArea.top > normalizedArea.bottom) {
81
+ cache.visible.lineAttachParent = false;
82
+ }
83
+ }
84
+
85
+ // 与之前的可见值比较,观察是否出现了改变
86
+ if (preVisible.node !== cache.visible.node) {
87
+ visibleChange.node = true;
88
+ }
89
+ if (preVisible.lineAttachParent !== cache.visible.lineAttachParent) {
90
+ visibleChange.lineAttachParent = true;
91
+ }
92
+
93
+ // 折叠则不处理
94
+ return !Helper.judgeIfAllChildFold(node, _this.root.node.id);
95
+ }
96
+ });
97
+ return visibleChange;
98
+ });
99
+ });
@@ -0,0 +1,11 @@
1
+ import { Zoom } from '../graphic/zoom';
2
+ import { Mind } from '../index';
3
+ export declare const calcVisible: (context: {
4
+ cacheMap: Mind.CacheMap;
5
+ options: Required<Mind.Options>;
6
+ root: Mind.Root;
7
+ container: HTMLElement;
8
+ viewport: HTMLElement;
9
+ transform: Mind.Transform;
10
+ zoom: Zoom;
11
+ }) => Mind.Visible;
@@ -0,0 +1,25 @@
1
+ import { Helper } from "../helper";
2
+ import { Process } from "../process";
3
+ export var calcVisible = function calcVisible(context) {
4
+ var cacheMap = context.cacheMap,
5
+ options = context.options,
6
+ root = context.root,
7
+ container = context.container,
8
+ viewport = context.viewport,
9
+ transform = context.transform,
10
+ zoom = context.zoom;
11
+ var process = new Process.Visible();
12
+ var _Helper$transformRoot = Helper.transformRootToWalkable(root),
13
+ getRootHeirOrientation = _Helper$transformRoot.getRootHeirOrientation;
14
+ process.start({
15
+ cacheMap: cacheMap,
16
+ container: container,
17
+ getRootHeirOrientation: getRootHeirOrientation,
18
+ options: options,
19
+ root: root,
20
+ transform: transform,
21
+ viewport: viewport,
22
+ zoom: zoom
23
+ });
24
+ return process.end();
25
+ };
@@ -0,0 +1,2 @@
1
+ import { Mind } from '../../index';
2
+ export declare const bezier: Mind.PathRender;
@@ -0,0 +1,12 @@
1
+ import * as D3 from 'd3';
2
+ import { Mind } from "../../index";
3
+ export var bezier = function bezier(context) {
4
+ var source = context.source,
5
+ target = context.target,
6
+ options = context.options;
7
+ var link = options.direction === Mind.Direction.x ? D3.linkHorizontal() : D3.linkVertical();
8
+ return link({
9
+ source: [source.x, source.y],
10
+ target: [target.x, target.y]
11
+ });
12
+ };
@@ -0,0 +1,2 @@
1
+ import { Mind } from '../../index';
2
+ export declare const getPathRender: (options: Required<Mind.Options>) => Mind.PathRender;
@@ -0,0 +1,17 @@
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 _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; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
+ 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); }
5
+ import { Mind } from "../../index";
6
+ import { bezier } from "./bezier";
7
+ import { line } from "./line";
8
+ export var getPathRender = function getPathRender(options) {
9
+ var pathRender = options.pathRender,
10
+ lineStyle = options.lineStyle;
11
+ if (pathRender) {
12
+ return pathRender;
13
+ } else {
14
+ var styleMap = _defineProperty(_defineProperty({}, Mind.LinkStyle.line, line), Mind.LinkStyle.bezier, bezier);
15
+ return styleMap[lineStyle];
16
+ }
17
+ };
@@ -0,0 +1,10 @@
1
+ import { Mind } from '../../index';
2
+ export declare const SvgClassName: string;
3
+ export declare const GroupClassName: string;
4
+ export declare const PathClassName: string;
5
+ export declare const connect: (context: {
6
+ cacheMap: Mind.CacheMap;
7
+ options: Required<Mind.Options>;
8
+ root: Mind.Root;
9
+ container: HTMLElement;
10
+ }) => void;
@@ -0,0 +1,45 @@
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
+ // @ts-nocheck
8
+ import * as D3 from 'd3';
9
+ import { Helper } from "../../helper";
10
+ import { getPathRender } from "./get-path-render";
11
+ export var SvgClassName = Helper.withPrefix('lines');
12
+ export var GroupClassName = Helper.withPrefix('group');
13
+ export var PathClassName = Helper.withPrefix('line');
14
+ export var connect = function connect(context) {
15
+ var cacheMap = context.cacheMap,
16
+ options = context.options,
17
+ root = context.root,
18
+ container = context.container;
19
+ var rootCache = cacheMap.get(root.node.id);
20
+ var data = Array.from(cacheMap.values()).filter(function (cache) {
21
+ return (cache.visible.lineAttachParent || options.disableLinesTailor) && cache.node.id !== root.node.id;
22
+ }).map(function (cache) {
23
+ return {
24
+ node: cache.node,
25
+ source: cache.line.source,
26
+ target: cache.line.target
27
+ };
28
+ });
29
+ var containerSelector = D3.select(container);
30
+ // 初始化内容
31
+ if (containerSelector.selectChild("svg.".concat(SvgClassName)).empty()) {
32
+ containerSelector.append('svg').attr('class', SvgClassName).append('g').attr('class', GroupClassName);
33
+ }
34
+ containerSelector.selectChild("svg.".concat(SvgClassName)).attr('viewBox', [0, 0, rootCache.layoutSize.width, rootCache.layoutSize.height]).style('width', rootCache.layoutSize.width).style('height', rootCache.layoutSize.height).style('overflow', 'visible').style('position', 'relative').style('pointer-events', 'none').selectChild("g.".concat(GroupClassName)).selectAll('path').data(data, function (d) {
35
+ return d.node.id;
36
+ }).join('path').attr('id', function (d) {
37
+ return Helper.getSvgPathId(d.node.id);
38
+ }).attr('d', function (d) {
39
+ var context = _objectSpread(_objectSpread({}, d), {}, {
40
+ cacheMap: cacheMap,
41
+ options: options
42
+ });
43
+ return getPathRender(options)(context);
44
+ }).attr('class', PathClassName).attr('fill', 'transparent');
45
+ };
@@ -0,0 +1,2 @@
1
+ import { Mind } from '../../index';
2
+ export declare const line: Mind.PathRender;
@@ -0,0 +1,71 @@
1
+ import * as D3 from 'd3';
2
+ import { Mind } from "../../index";
3
+ export var line = function line(context) {
4
+ var radius = 12;
5
+ var source = context.source,
6
+ target = context.target,
7
+ options = context.options;
8
+ var middle = {
9
+ x: (source.x + target.x) / 2,
10
+ y: (source.y + target.y) / 2
11
+ };
12
+ var turning = [0, 0];
13
+ var curveStart = [0, 0];
14
+ var curveControl = [0, 0];
15
+ var curveEnd = [0, 0];
16
+ // x 轴分布
17
+ if (options.direction === Mind.Direction.x) {
18
+ // 同一 y 坐标,则,直线链接
19
+ if (source.y === target.y) {
20
+ return D3.line()([[source.x, source.y], [target.x, target.y]]);
21
+ }
22
+ turning = [middle.x, source.y];
23
+
24
+ // 路径需要往下走
25
+ if (target.y > source.y) {
26
+ curveStart = [middle.x, target.y - radius < source.y ? source.y : target.y - radius];
27
+ }
28
+ // 路径需要往上走
29
+ else {
30
+ curveStart = [middle.x, target.y + radius > source.y ? source.y : target.y + radius];
31
+ }
32
+
33
+ // 路径需要往右侧走
34
+ if (target.x > source.x) {
35
+ curveEnd = [middle.x + radius > target.x ? target.x : middle.x + radius, target.y];
36
+ }
37
+ // 路径需要往左侧走
38
+ else {
39
+ curveEnd = [middle.x - radius < target.x ? target.x : middle.x - radius, target.y];
40
+ }
41
+ curveControl = [curveStart[0], curveEnd[1]];
42
+ }
43
+ // y 轴分布
44
+ else {
45
+ // 同一 x 坐标,则,直线链接
46
+ if (source.x === target.x) {
47
+ return D3.line()([[source.x, source.y], [target.x, target.y]]);
48
+ }
49
+ turning = [source.x, middle.y];
50
+
51
+ // 路径往右边走
52
+ if (target.x > source.x) {
53
+ curveStart = [target.x - radius < source.x ? source.x : target.x - radius, middle.y];
54
+ }
55
+ // 路径需要往左边走
56
+ else {
57
+ curveStart = [target.x + radius > source.x ? source.x : target.x + radius, middle.y];
58
+ }
59
+
60
+ // 路径往下方走
61
+ if (target.y > source.y) {
62
+ curveEnd = [target.x, middle.y + radius > target.y ? target.y : middle.y + radius];
63
+ }
64
+ // 路径往上方走
65
+ else {
66
+ curveEnd = [target.x, middle.y - radius < target.y ? target.y : middle.y - radius];
67
+ }
68
+ curveControl = [curveEnd[0], curveStart[1]];
69
+ }
70
+ return D3.line()([[source.x, source.y], turning, curveStart]) + D3.line().curve(D3.curveBasis)([curveStart, curveControl, curveEnd]) + D3.line()([curveEnd, [target.x, target.y]]);
71
+ };
@@ -0,0 +1,15 @@
1
+ import { Mind } from '../../index';
2
+ export declare class TemporaryLine {
3
+ private svg;
4
+ private g;
5
+ private path;
6
+ private cacheMap;
7
+ private options;
8
+ constructor(container: HTMLElement, cacheMap: Mind.CacheMap, options: Required<Mind.Options>);
9
+ render: (link?: {
10
+ source: Mind.Coordinate;
11
+ target: Mind.Coordinate;
12
+ }) => void;
13
+ destroy: () => void;
14
+ private createPathElement;
15
+ }
@@ -0,0 +1,44 @@
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 _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); } }
3
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
4
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
+ 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; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ 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); }
8
+ // @ts-nocheck
9
+ import Classnames from 'classnames';
10
+ import * as D3 from 'd3';
11
+ import { withPrefix } from "../../helper/with-prefix";
12
+ import { getPathRender } from "./get-path-render";
13
+ import { PathClassName, SvgClassName } from "./index";
14
+ export var TemporaryLine = /*#__PURE__*/_createClass(function TemporaryLine(_container, cacheMap, options) {
15
+ var _this = this;
16
+ _classCallCheck(this, TemporaryLine);
17
+ _defineProperty(this, "svg", void 0);
18
+ _defineProperty(this, "g", void 0);
19
+ _defineProperty(this, "path", void 0);
20
+ _defineProperty(this, "cacheMap", void 0);
21
+ _defineProperty(this, "options", void 0);
22
+ _defineProperty(this, "render", function (link) {
23
+ _this.path.attr('d', link ? getPathRender(_this.options)({
24
+ cacheMap: _this.cacheMap,
25
+ node: {},
26
+ options: _this.options,
27
+ source: link.source,
28
+ target: link.target
29
+ }) : null);
30
+ });
31
+ _defineProperty(this, "destroy", function () {
32
+ _this.g.remove();
33
+ });
34
+ _defineProperty(this, "createPathElement", function (container) {
35
+ _this.svg = D3.select(container).select(".".concat(SvgClassName));
36
+ _this.g = _this.svg.append('g');
37
+ _this.path = _this.g.append('path');
38
+ _this.path.attr('class', Classnames(PathClassName, withPrefix('temporary-line')));
39
+ _this.path.attr('fill', 'transparent');
40
+ });
41
+ this.createPathElement(_container);
42
+ this.options = options;
43
+ this.cacheMap = cacheMap;
44
+ });
@@ -0,0 +1,27 @@
1
+ export declare const Render: {
2
+ calcVisible: (context: {
3
+ cacheMap: import("..").Mind.CacheMap;
4
+ options: Required<import("..").Mind.Options>;
5
+ root: import("..").Mind.Root;
6
+ container: HTMLElement;
7
+ viewport: HTMLElement;
8
+ transform: import("..").Mind.Transform;
9
+ zoom: import("../graphic/zoom").Zoom;
10
+ }) => import("..").Mind.Visible;
11
+ connect: (context: {
12
+ cacheMap: import("..").Mind.CacheMap;
13
+ options: Required<import("..").Mind.Options>;
14
+ root: import("..").Mind.Root;
15
+ container: HTMLElement;
16
+ }) => void;
17
+ layout: (context: {
18
+ cacheMap: import("..").Mind.CacheMap;
19
+ options: Required<import("..").Mind.Options>;
20
+ root: import("..").Mind.Root;
21
+ container: HTMLElement;
22
+ viewport: HTMLElement;
23
+ transform: import("..").Mind.Transform;
24
+ anchor?: string | undefined;
25
+ zoom: import("../graphic/zoom").Zoom;
26
+ }) => void;
27
+ };
@@ -0,0 +1,8 @@
1
+ import { calcVisible } from "./calc-visible";
2
+ import { connect } from "./connect";
3
+ import { layout } from "./layout";
4
+ export var Render = {
5
+ calcVisible: calcVisible,
6
+ connect: connect,
7
+ layout: layout
8
+ };
@@ -0,0 +1,12 @@
1
+ import { Zoom } from '../graphic/zoom';
2
+ import { Mind } from '../index';
3
+ export declare const layout: (context: {
4
+ cacheMap: Mind.CacheMap;
5
+ options: Required<Mind.Options>;
6
+ root: Mind.Root;
7
+ container: HTMLElement;
8
+ viewport: HTMLElement;
9
+ transform: Mind.Transform;
10
+ anchor?: string | undefined;
11
+ zoom: Zoom;
12
+ }) => void;
@@ -0,0 +1,85 @@
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
+ import { WithDefault } from "../default";
8
+ import { Helper } from "../helper";
9
+ import { Process } from "../process";
10
+ export var layout = function layout(context) {
11
+ var cacheMap = context.cacheMap,
12
+ options = context.options,
13
+ root = context.root,
14
+ container = context.container,
15
+ viewport = context.viewport,
16
+ transform = context.transform,
17
+ anchor = context.anchor,
18
+ zoom = context.zoom;
19
+ var preCacheMap = new Map(cacheMap);
20
+ cacheMap.clear();
21
+ var processes = [new Process.NodeValid(), new Process.Orientation(), new Process.Size(), new (Process.getLayoutProcess(options))(), new Process.Line(), new Process.Anchor()];
22
+ var _Helper$transformRoot = Helper.transformRootToWalkable(root),
23
+ shadowNode = _Helper$transformRoot.shadowNode,
24
+ getRootHeirOrientation = _Helper$transformRoot.getRootHeirOrientation;
25
+
26
+ // 处理器执行开始事件
27
+ processes.forEach(function (item) {
28
+ return item.start && item.start({
29
+ anchor: anchor,
30
+ cacheMap: cacheMap,
31
+ container: container,
32
+ getRootHeirOrientation: getRootHeirOrientation,
33
+ options: options,
34
+ preCacheMap: preCacheMap,
35
+ root: root,
36
+ transform: transform,
37
+ viewport: viewport,
38
+ zoom: zoom
39
+ });
40
+ });
41
+
42
+ // 深度遍历树
43
+ Helper.depthFirstWalkTree(shadowNode, {
44
+ after: function after(node, parent) {
45
+ // 此处处理根节点只有左侧折叠或者右侧折叠的情况
46
+ if (Helper.judgeIfHeirAndFold(node, parent, root, getRootHeirOrientation)) {
47
+ return;
48
+ }
49
+ var context = {
50
+ cache: cacheMap.get(node.id)
51
+ };
52
+ // 依次执行处理器
53
+ processes.forEach(function (item) {
54
+ return item.afterEvery && item.afterEvery(context);
55
+ });
56
+ },
57
+ before: function before(node, parent) {
58
+ // 此处处理根节点只有左侧折叠或者右侧折叠的情况
59
+ if (Helper.judgeIfHeirAndFold(node, parent, root, getRootHeirOrientation)) {
60
+ return false;
61
+ }
62
+
63
+ // ... 是为了避免引用同一对象
64
+ var cache = preCacheMap.get(node.id) ? _objectSpread({}, preCacheMap.get(node.id)) : WithDefault.cache();
65
+ cache.node = node;
66
+ cache.parent = parent;
67
+ // 缓存信息
68
+ cacheMap.set(node.id, cache);
69
+ var context = {
70
+ cache: cache
71
+ };
72
+ // 依次执行处理器
73
+ processes.forEach(function (item) {
74
+ return item.every && item.every(context);
75
+ });
76
+ // 如果节点被折叠,则,其子代不纳入后续处理
77
+ return !Helper.judgeIfAllChildFold(node, root.node.id);
78
+ }
79
+ });
80
+
81
+ // 处理器执行结束事件
82
+ processes.forEach(function (item) {
83
+ return item.end && item.end();
84
+ });
85
+ };
@@ -0,0 +1,54 @@
1
+ import { Mind, MindReact } from "../..";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ var Data = {
4
+ node: {
5
+ id: '1',
6
+ attachData: '1',
7
+ children: [{
8
+ id: '2',
9
+ attachData: '2',
10
+ children: [{
11
+ id: '3',
12
+ attachData: '3'
13
+ }, {
14
+ id: '4',
15
+ attachData: '4'
16
+ }]
17
+ }]
18
+ },
19
+ positive: [{
20
+ id: '2',
21
+ attachData: '2',
22
+ children: [{
23
+ id: '3',
24
+ attachData: '3'
25
+ }, {
26
+ id: '4',
27
+ attachData: '4'
28
+ }]
29
+ }]
30
+ };
31
+ var options = {
32
+ childAlignMode: Mind.ChildAlignMode.structured,
33
+ lineStyle: Mind.LinkStyle.line,
34
+ rankSeparate: 80,
35
+ nodeSeparate: 20
36
+ };
37
+ var Render = function Render(data) {
38
+ return /*#__PURE__*/_jsx("div", {
39
+ children: data.attachData
40
+ });
41
+ };
42
+ export default function () {
43
+ return /*#__PURE__*/_jsx("div", {
44
+ style: {
45
+ width: 600,
46
+ height: 600
47
+ },
48
+ children: /*#__PURE__*/_jsx(MindReact.View, {
49
+ data: Data,
50
+ options: options,
51
+ render: Render
52
+ })
53
+ });
54
+ }
@@ -0,0 +1,3 @@
1
+ import { MindReact } from './react';
2
+ import { Mind } from './core';
3
+ export { MindReact, Mind };
@@ -0,0 +1,3 @@
1
+ import { MindReact } from "./react";
2
+ import { Mind } from "./core";
3
+ export { MindReact, Mind };
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { MindReact } from '../';
3
+ export declare const View: React.ForwardRefExoticComponent<MindReact.ViewProps & React.RefAttributes<MindReact.GraphicRef>>;