ebaoferc 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +43 -43
- package/dist/components/FlexRowCol/index.js +1 -3
- package/dist/components/ImageViewTrigger/index.d.ts +4 -0
- package/dist/components/ImageViewTrigger/index.js +14 -6
- package/dist/components/ImageViewTrigger/index.less +25 -25
- package/dist/components/MindGraph/core/graphic/drag.js +15 -15
- package/dist/components/MindGraph/core/graphic/index.js +105 -105
- package/dist/components/MindGraph/core/helper/depth-first-walk-tree.js +4 -4
- package/dist/components/MindGraph/core/helper/descendant.js +3 -3
- package/dist/components/MindGraph/core/helper/get-layout-calc-children.js +6 -6
- package/dist/components/MindGraph/core/helper/judge-if-all-child-fold.js +4 -4
- package/dist/components/MindGraph/core/helper/judge-if-heir-and-fold.js +6 -6
- package/dist/components/MindGraph/core/helper/judge-if-visual-leaf.js +3 -3
- package/dist/components/MindGraph/core/index.d.ts +2 -6
- package/dist/components/MindGraph/core/index.js +26 -26
- package/dist/components/MindGraph/core/process/layout/structured/get-node-cross-boundary.js +7 -7
- package/dist/components/MindGraph/core/process/layout/type.js +20 -20
- package/dist/components/MindGraph/core/process/visible.js +3 -3
- package/dist/components/MindGraph/react/component/index.module.less +71 -71
- package/dist/components/MindGraph/react/scrollbar/axis/index.module.less +47 -47
- package/dist/components/QueryProCard/index.less +9 -9
- package/dist/components/SectionTitleBar/index.less +31 -31
- package/dist/components/SliderVerify/style.module.less +119 -119
- package/dist/components/StyledQueryFilter/index.less +34 -34
- package/dist/components/StyledTable/index.less +17 -17
- package/dist/components/ThemeStatusTag/index.less +11 -11
- package/dist/utils/format/index.js +14 -14
- package/package.json +100 -100
|
@@ -14,20 +14,20 @@ import { Drag } from "./drag";
|
|
|
14
14
|
import { nodeTranslateTo } from "./node-translate-to";
|
|
15
15
|
import { Zoom } from "./zoom";
|
|
16
16
|
export var Graphic = /*#__PURE__*/_createClass(
|
|
17
|
-
/**
|
|
18
|
-
* 脑图管理器
|
|
19
|
-
* - `viewport`用作判断可视区域
|
|
20
|
-
* - svg连线将会自动注入到`container`中
|
|
21
|
-
* - transform 相关信息将会自动注入到`container`中
|
|
22
|
-
* @param viewport 视窗
|
|
23
|
-
* @param container 容器
|
|
24
|
-
* @param options 配置参数
|
|
17
|
+
/**
|
|
18
|
+
* 脑图管理器
|
|
19
|
+
* - `viewport`用作判断可视区域
|
|
20
|
+
* - svg连线将会自动注入到`container`中
|
|
21
|
+
* - transform 相关信息将会自动注入到`container`中
|
|
22
|
+
* @param viewport 视窗
|
|
23
|
+
* @param container 容器
|
|
24
|
+
* @param options 配置参数
|
|
25
25
|
*/
|
|
26
26
|
function Graphic(viewport, _container, _options) {
|
|
27
27
|
var _this = this;
|
|
28
28
|
_classCallCheck(this, Graphic);
|
|
29
|
-
/**
|
|
30
|
-
* 节点相关信息缓存,树形结构拍平
|
|
29
|
+
/**
|
|
30
|
+
* 节点相关信息缓存,树形结构拍平
|
|
31
31
|
*/
|
|
32
32
|
_defineProperty(this, "cacheMap", new Map());
|
|
33
33
|
_defineProperty(this, "options", void 0);
|
|
@@ -39,16 +39,16 @@ function Graphic(viewport, _container, _options) {
|
|
|
39
39
|
_defineProperty(this, "resizeObserver", void 0);
|
|
40
40
|
_defineProperty(this, "unbindCache", []);
|
|
41
41
|
_defineProperty(this, "zoom", void 0);
|
|
42
|
-
/**
|
|
43
|
-
* 同步 options 中的 zoom extent
|
|
42
|
+
/**
|
|
43
|
+
* 同步 options 中的 zoom extent
|
|
44
44
|
*/
|
|
45
45
|
_defineProperty(this, "syncZoomExtentOptions", function () {
|
|
46
46
|
_this.zoom.syncZoomExtentOptions({
|
|
47
47
|
options: _this.options
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
|
-
/**
|
|
51
|
-
* 获取当前可见的节点
|
|
50
|
+
/**
|
|
51
|
+
* 获取当前可见的节点
|
|
52
52
|
*/
|
|
53
53
|
_defineProperty(this, "getVisibleNodes", function () {
|
|
54
54
|
var nodes = [];
|
|
@@ -65,10 +65,10 @@ function Graphic(viewport, _container, _options) {
|
|
|
65
65
|
}
|
|
66
66
|
return nodes;
|
|
67
67
|
});
|
|
68
|
-
/**
|
|
69
|
-
* 获取节点定位锚点(左上角)位置,可在节点绘制的时候确定其位置
|
|
70
|
-
* - 推荐所有节点使用`position:absolute;left:0;top:0;`并且配合`transform`来定位,避免出现绘制异常
|
|
71
|
-
* @param id 节点对应id
|
|
68
|
+
/**
|
|
69
|
+
* 获取节点定位锚点(左上角)位置,可在节点绘制的时候确定其位置
|
|
70
|
+
* - 推荐所有节点使用`position:absolute;left:0;top:0;`并且配合`transform`来定位,避免出现绘制异常
|
|
71
|
+
* @param id 节点对应id
|
|
72
72
|
*/
|
|
73
73
|
_defineProperty(this, "getNodeAnchorCoordinate", function (id) {
|
|
74
74
|
var cache = _this.cacheMap.get(id);
|
|
@@ -132,9 +132,9 @@ function Graphic(viewport, _container, _options) {
|
|
|
132
132
|
// 回调事件,通知外部 transform 改变
|
|
133
133
|
_this.options.callback.onTransformChange(transform);
|
|
134
134
|
});
|
|
135
|
-
/**
|
|
136
|
-
* - 计算节点可见是否改变,如改变,则通知外部
|
|
137
|
-
* - 重渲染连线,销毁不必要的连线
|
|
135
|
+
/**
|
|
136
|
+
* - 计算节点可见是否改变,如改变,则通知外部
|
|
137
|
+
* - 重渲染连线,销毁不必要的连线
|
|
138
138
|
*/
|
|
139
139
|
_defineProperty(this, "refreshVisible", function () {
|
|
140
140
|
if (_this.cacheMap.size) {
|
|
@@ -150,9 +150,9 @@ function Graphic(viewport, _container, _options) {
|
|
|
150
150
|
}
|
|
151
151
|
});
|
|
152
152
|
_defineProperty(this, "throttleRefreshVisible", throttle(this.refreshVisible, 100));
|
|
153
|
-
/**
|
|
154
|
-
* 视窗尺寸变化
|
|
155
|
-
* @private
|
|
153
|
+
/**
|
|
154
|
+
* 视窗尺寸变化
|
|
155
|
+
* @private
|
|
156
156
|
*/
|
|
157
157
|
_defineProperty(this, "onViewportResize", function () {
|
|
158
158
|
_this.zoom.syncZoomExtent({
|
|
@@ -162,9 +162,9 @@ function Graphic(viewport, _container, _options) {
|
|
|
162
162
|
// 避免频繁的刷新可视区域导致界面卡顿
|
|
163
163
|
_this.throttleRefreshVisible();
|
|
164
164
|
});
|
|
165
|
-
/**
|
|
166
|
-
* 注销事件绑定
|
|
167
|
-
* - 请在销毁组件之前调用
|
|
165
|
+
/**
|
|
166
|
+
* 注销事件绑定
|
|
167
|
+
* - 请在销毁组件之前调用
|
|
168
168
|
*/
|
|
169
169
|
_defineProperty(this, "unbind", function () {
|
|
170
170
|
_this.unbindCache.forEach(function (dispose) {
|
|
@@ -172,9 +172,9 @@ function Graphic(viewport, _container, _options) {
|
|
|
172
172
|
});
|
|
173
173
|
_this.unbindCache = [];
|
|
174
174
|
});
|
|
175
|
-
/**
|
|
176
|
-
* 判断节点是否可视
|
|
177
|
-
* @param id 节点对应id
|
|
175
|
+
/**
|
|
176
|
+
* 判断节点是否可视
|
|
177
|
+
* @param id 节点对应id
|
|
178
178
|
*/
|
|
179
179
|
_defineProperty(this, "judgeNodeVisible", function (id) {
|
|
180
180
|
var cache = _this.cacheMap.get(id);
|
|
@@ -184,11 +184,11 @@ function Graphic(viewport, _container, _options) {
|
|
|
184
184
|
return false;
|
|
185
185
|
}
|
|
186
186
|
});
|
|
187
|
-
/**
|
|
188
|
-
* 设定 `options`
|
|
189
|
-
* - 函数不会自动执行重渲染,如果改变的`options`需要重新计算布局等操作,推荐使用 `setData` 驱动数据重渲染
|
|
190
|
-
* @param options 设定选项
|
|
191
|
-
* @param isMerge 是否与之前的`options`做合并操作
|
|
187
|
+
/**
|
|
188
|
+
* 设定 `options`
|
|
189
|
+
* - 函数不会自动执行重渲染,如果改变的`options`需要重新计算布局等操作,推荐使用 `setData` 驱动数据重渲染
|
|
190
|
+
* @param options 设定选项
|
|
191
|
+
* @param isMerge 是否与之前的`options`做合并操作
|
|
192
192
|
*/
|
|
193
193
|
_defineProperty(this, "setOptions", function (options) {
|
|
194
194
|
var isMerge = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -199,14 +199,14 @@ function Graphic(viewport, _container, _options) {
|
|
|
199
199
|
}
|
|
200
200
|
_this.syncZoomExtentOptions();
|
|
201
201
|
});
|
|
202
|
-
/**
|
|
203
|
-
* 生成拖动控制器
|
|
204
|
-
* - 根节点不可拖拽
|
|
205
|
-
* - 当前暂时只有`Mind.ChildAlignMode.structured`布局算法支持拖拽功能
|
|
206
|
-
* @param drag 拖动节点node对象或id
|
|
207
|
-
* @return
|
|
208
|
-
* - 当root(没有调用`setData`)不存在时,或者`drag`为根节点时,返回`undefined`
|
|
209
|
-
* - 正常情况返回 `Drag` 类对象
|
|
202
|
+
/**
|
|
203
|
+
* 生成拖动控制器
|
|
204
|
+
* - 根节点不可拖拽
|
|
205
|
+
* - 当前暂时只有`Mind.ChildAlignMode.structured`布局算法支持拖拽功能
|
|
206
|
+
* @param drag 拖动节点node对象或id
|
|
207
|
+
* @return
|
|
208
|
+
* - 当root(没有调用`setData`)不存在时,或者`drag`为根节点时,返回`undefined`
|
|
209
|
+
* - 正常情况返回 `Drag` 类对象
|
|
210
210
|
*/
|
|
211
211
|
_defineProperty(this, "dragControllerBuilder", function (drag) {
|
|
212
212
|
var _this$cacheMap$get;
|
|
@@ -223,8 +223,8 @@ function Graphic(viewport, _container, _options) {
|
|
|
223
223
|
return undefined;
|
|
224
224
|
}
|
|
225
225
|
});
|
|
226
|
-
/**
|
|
227
|
-
* 获取渲染层尺寸
|
|
226
|
+
/**
|
|
227
|
+
* 获取渲染层尺寸
|
|
228
228
|
*/
|
|
229
229
|
_defineProperty(this, "getLayoutSize", function () {
|
|
230
230
|
var _this$root;
|
|
@@ -235,70 +235,70 @@ function Graphic(viewport, _container, _options) {
|
|
|
235
235
|
return undefined;
|
|
236
236
|
}
|
|
237
237
|
});
|
|
238
|
-
/**
|
|
239
|
-
* 获取`id`对应节点
|
|
240
|
-
* @param id 节点`id`
|
|
238
|
+
/**
|
|
239
|
+
* 获取`id`对应节点
|
|
240
|
+
* @param id 节点`id`
|
|
241
241
|
*/
|
|
242
242
|
_defineProperty(this, "getNode", function (id) {
|
|
243
243
|
var _this$cacheMap$get2;
|
|
244
244
|
return (_this$cacheMap$get2 = _this.cacheMap.get(id)) === null || _this$cacheMap$get2 === void 0 ? void 0 : _this$cacheMap$get2.node;
|
|
245
245
|
});
|
|
246
|
-
/**
|
|
247
|
-
* 获取`id`对应节点父级
|
|
248
|
-
* @param id 节点`id`
|
|
246
|
+
/**
|
|
247
|
+
* 获取`id`对应节点父级
|
|
248
|
+
* @param id 节点`id`
|
|
249
249
|
*/
|
|
250
250
|
_defineProperty(this, "getParent", function (id) {
|
|
251
251
|
var _this$cacheMap$get3;
|
|
252
252
|
return (_this$cacheMap$get3 = _this.cacheMap.get(id)) === null || _this$cacheMap$get3 === void 0 ? void 0 : _this$cacheMap$get3.parent;
|
|
253
253
|
});
|
|
254
|
-
/**
|
|
255
|
-
* 获取`id`对应节点渲染方位
|
|
256
|
-
* @param id 节点`id`
|
|
254
|
+
/**
|
|
255
|
+
* 获取`id`对应节点渲染方位
|
|
256
|
+
* @param id 节点`id`
|
|
257
257
|
*/
|
|
258
258
|
_defineProperty(this, "getNodeOrientation", function (id) {
|
|
259
259
|
var _this$cacheMap$get4;
|
|
260
260
|
return (_this$cacheMap$get4 = _this.cacheMap.get(id)) === null || _this$cacheMap$get4 === void 0 ? void 0 : _this$cacheMap$get4.orientation;
|
|
261
261
|
});
|
|
262
|
-
/**
|
|
263
|
-
* 主动设置位移缩放
|
|
264
|
-
* - 会与之前的`transform`做深度合并
|
|
265
|
-
* - 请注意:`setTransform` 之后 `onTransformChange` 事件依旧会触发
|
|
266
|
-
* - 此方法不受 `zoomExtent.translate`、`zoomExtent.scale` 限制
|
|
267
|
-
* @param transform 位移缩放数据
|
|
268
|
-
* @param duration 周期,如果配置,则执行变换会附带动画效果
|
|
262
|
+
/**
|
|
263
|
+
* 主动设置位移缩放
|
|
264
|
+
* - 会与之前的`transform`做深度合并
|
|
265
|
+
* - 请注意:`setTransform` 之后 `onTransformChange` 事件依旧会触发
|
|
266
|
+
* - 此方法不受 `zoomExtent.translate`、`zoomExtent.scale` 限制
|
|
267
|
+
* @param transform 位移缩放数据
|
|
268
|
+
* @param duration 周期,如果配置,则执行变换会附带动画效果
|
|
269
269
|
*/
|
|
270
270
|
_defineProperty(this, "setTransform", function (transform, duration) {
|
|
271
271
|
_this.transform = merge({}, _this.transform, transform);
|
|
272
272
|
_this.zoom.setTransform(_this.transform, duration);
|
|
273
273
|
});
|
|
274
|
-
/**
|
|
275
|
-
* 设定位移
|
|
276
|
-
* - 此方法受到 `zoomExtent.translate` 限制
|
|
277
|
-
* @param translate 位移差(屏幕尺度)
|
|
278
|
-
* @param duration 周期,如果配置,则执行变换会附带动画效果
|
|
274
|
+
/**
|
|
275
|
+
* 设定位移
|
|
276
|
+
* - 此方法受到 `zoomExtent.translate` 限制
|
|
277
|
+
* @param translate 位移差(屏幕尺度)
|
|
278
|
+
* @param duration 周期,如果配置,则执行变换会附带动画效果
|
|
279
279
|
*/
|
|
280
280
|
_defineProperty(this, "translate", function (translate, duration) {
|
|
281
281
|
_this.zoom.translate(translate, duration);
|
|
282
282
|
});
|
|
283
|
-
/**
|
|
284
|
-
* 设定缩放
|
|
285
|
-
* - 此方法受到 `zoomExtent.translate` 限制
|
|
286
|
-
* - 此方法受到 `zoomExtent.scale` 限制
|
|
287
|
-
* @param scale 缩放比
|
|
288
|
-
* @param point 缩放相对点(如不配置或为`undefined`,则默认相对于`viewport`中心缩放)
|
|
289
|
-
* @param duration 动画周期,如配置,则位移会附带动画效果
|
|
283
|
+
/**
|
|
284
|
+
* 设定缩放
|
|
285
|
+
* - 此方法受到 `zoomExtent.translate` 限制
|
|
286
|
+
* - 此方法受到 `zoomExtent.scale` 限制
|
|
287
|
+
* @param scale 缩放比
|
|
288
|
+
* @param point 缩放相对点(如不配置或为`undefined`,则默认相对于`viewport`中心缩放)
|
|
289
|
+
* @param duration 动画周期,如配置,则位移会附带动画效果
|
|
290
290
|
*/
|
|
291
291
|
_defineProperty(this, "scale", function (scale, point, duration) {
|
|
292
292
|
_this.zoom.scale(scale, point, duration);
|
|
293
293
|
});
|
|
294
|
-
/**
|
|
295
|
-
* 将某一个节点中心从某个相对位置做位移(其尺度为屏幕尺度)操作
|
|
296
|
-
* - 此方法不受 `zoomExtent.translate` 限制
|
|
297
|
-
* @param config 配置参数
|
|
298
|
-
* @param config.id 节点id
|
|
299
|
-
* @param config.diff 位移差
|
|
300
|
-
* @param config.relative 相对位置
|
|
301
|
-
* @param duration 动画周期,如配置,则位移会附带动画效果
|
|
294
|
+
/**
|
|
295
|
+
* 将某一个节点中心从某个相对位置做位移(其尺度为屏幕尺度)操作
|
|
296
|
+
* - 此方法不受 `zoomExtent.translate` 限制
|
|
297
|
+
* @param config 配置参数
|
|
298
|
+
* @param config.id 节点id
|
|
299
|
+
* @param config.diff 位移差
|
|
300
|
+
* @param config.relative 相对位置
|
|
301
|
+
* @param duration 动画周期,如配置,则位移会附带动画效果
|
|
302
302
|
*/
|
|
303
303
|
_defineProperty(this, "nodeTranslateTo", function (config, duration) {
|
|
304
304
|
var id = config.id,
|
|
@@ -314,24 +314,24 @@ function Graphic(viewport, _container, _options) {
|
|
|
314
314
|
zoom: _this.zoom
|
|
315
315
|
}, duration);
|
|
316
316
|
});
|
|
317
|
-
/**
|
|
318
|
-
* 获取位移缩放信息
|
|
317
|
+
/**
|
|
318
|
+
* 获取位移缩放信息
|
|
319
319
|
*/
|
|
320
320
|
_defineProperty(this, "getTransform", function () {
|
|
321
321
|
return _objectSpread({}, _this.transform);
|
|
322
322
|
});
|
|
323
|
-
/**
|
|
324
|
-
* 设置锚点节点
|
|
325
|
-
* @param id 锚定节点id(如不设定,则清空锚点,根节点居中,缩放比归一)
|
|
323
|
+
/**
|
|
324
|
+
* 设置锚点节点
|
|
325
|
+
* @param id 锚定节点id(如不设定,则清空锚点,根节点居中,缩放比归一)
|
|
326
326
|
*/
|
|
327
327
|
_defineProperty(this, "setAnchor", function (id) {
|
|
328
328
|
_this.anchor = id;
|
|
329
329
|
});
|
|
330
|
-
/**
|
|
331
|
-
* 设置/更新数据,启动重渲染
|
|
332
|
-
* - 在重计算定位时,将保持 `anchor` 对应节点在屏幕上的相对位置不变
|
|
333
|
-
* - 如果 `anchor` 没有设定,或者找不到对应节点,则,根节点居中,缩放比重置为1
|
|
334
|
-
* @param root 根数据
|
|
330
|
+
/**
|
|
331
|
+
* 设置/更新数据,启动重渲染
|
|
332
|
+
* - 在重计算定位时,将保持 `anchor` 对应节点在屏幕上的相对位置不变
|
|
333
|
+
* - 如果 `anchor` 没有设定,或者找不到对应节点,则,根节点居中,缩放比重置为1
|
|
334
|
+
* @param root 根数据
|
|
335
335
|
*/
|
|
336
336
|
_defineProperty(this, "setData", function (root) {
|
|
337
337
|
_this.root = root;
|
|
@@ -346,17 +346,17 @@ function Graphic(viewport, _container, _options) {
|
|
|
346
346
|
// 设定数据后,通知外部可见节点
|
|
347
347
|
_this.options.callback.onNodeVisibleChange(_this.getVisibleNodes());
|
|
348
348
|
});
|
|
349
|
-
/**
|
|
350
|
-
* 刷新
|
|
349
|
+
/**
|
|
350
|
+
* 刷新
|
|
351
351
|
*/
|
|
352
352
|
_defineProperty(this, "refresh", function () {
|
|
353
353
|
if (_this.root) {
|
|
354
354
|
_this.setData(_this.root);
|
|
355
355
|
}
|
|
356
356
|
});
|
|
357
|
-
/**
|
|
358
|
-
* 渲染链接到某个`container`下
|
|
359
|
-
* @param container 容器
|
|
357
|
+
/**
|
|
358
|
+
* 渲染链接到某个`container`下
|
|
359
|
+
* @param container 容器
|
|
360
360
|
*/
|
|
361
361
|
_defineProperty(this, "connectTo", function (container) {
|
|
362
362
|
Render.connect({
|
|
@@ -366,8 +366,8 @@ function Graphic(viewport, _container, _options) {
|
|
|
366
366
|
root: _this.root
|
|
367
367
|
});
|
|
368
368
|
});
|
|
369
|
-
/**
|
|
370
|
-
* 同步渲染层尺寸到 container 中
|
|
369
|
+
/**
|
|
370
|
+
* 同步渲染层尺寸到 container 中
|
|
371
371
|
*/
|
|
372
372
|
_defineProperty(this, "syncLayoutSize", function () {
|
|
373
373
|
var _this$cacheMap$get5, _this$root2;
|
|
@@ -378,15 +378,15 @@ function Graphic(viewport, _container, _options) {
|
|
|
378
378
|
_this.container.style.width = "".concat(layoutSize.width, "px");
|
|
379
379
|
_this.container.style.height = "".concat(layoutSize.height, "px");
|
|
380
380
|
});
|
|
381
|
-
/**
|
|
382
|
-
* 链接各个节点
|
|
381
|
+
/**
|
|
382
|
+
* 链接各个节点
|
|
383
383
|
*/
|
|
384
384
|
_defineProperty(this, "connect", function () {
|
|
385
385
|
_this.connectTo(_this.container);
|
|
386
386
|
});
|
|
387
|
-
/**
|
|
388
|
-
* 计算脑图布局
|
|
389
|
-
* - 请保证调用之前 data 已经通过 setData 设置完备
|
|
387
|
+
/**
|
|
388
|
+
* 计算脑图布局
|
|
389
|
+
* - 请保证调用之前 data 已经通过 setData 设置完备
|
|
390
390
|
*/
|
|
391
391
|
_defineProperty(this, "layout", function () {
|
|
392
392
|
Render.layout({
|
|
@@ -400,8 +400,8 @@ function Graphic(viewport, _container, _options) {
|
|
|
400
400
|
zoom: _this.zoom
|
|
401
401
|
});
|
|
402
402
|
});
|
|
403
|
-
/**
|
|
404
|
-
* 计算各节点可见性,以及链接可见性
|
|
403
|
+
/**
|
|
404
|
+
* 计算各节点可见性,以及链接可见性
|
|
405
405
|
*/
|
|
406
406
|
_defineProperty(this, "calcVisible", function () {
|
|
407
407
|
return Render.calcVisible({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 深度优先遍历
|
|
3
|
-
* @param root 根节点
|
|
4
|
-
* @param callback before:递归之前(返回 true 代表继续搜索子代,false代表终止),after:子代递归完成返回
|
|
1
|
+
/**
|
|
2
|
+
* 深度优先遍历
|
|
3
|
+
* @param root 根节点
|
|
4
|
+
* @param callback before:递归之前(返回 true 代表继续搜索子代,false代表终止),after:子代递归完成返回
|
|
5
5
|
*/
|
|
6
6
|
export var depthFirstWalkTree = function depthFirstWalkTree(root, callback) {
|
|
7
7
|
var recursion = function recursion(now, parent) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2
2
|
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); }
|
|
3
3
|
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; }
|
|
4
|
-
/**
|
|
5
|
-
* 获取某个节点的所有后代
|
|
6
|
-
* @param node 节点
|
|
4
|
+
/**
|
|
5
|
+
* 获取某个节点的所有后代
|
|
6
|
+
* @param node 节点
|
|
7
7
|
*/
|
|
8
8
|
export var descendant = function descendant(node) {
|
|
9
9
|
var result = [];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Mind } from "../index";
|
|
2
2
|
import { Helper } from "./index";
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* 获取用于布局计算的子代
|
|
6
|
-
* - 剔除掉被折叠的部分
|
|
7
|
-
* @param node
|
|
8
|
-
* @param rootId
|
|
9
|
-
* @param getRootHeirOrientation
|
|
4
|
+
/**
|
|
5
|
+
* 获取用于布局计算的子代
|
|
6
|
+
* - 剔除掉被折叠的部分
|
|
7
|
+
* @param node
|
|
8
|
+
* @param rootId
|
|
9
|
+
* @param getRootHeirOrientation
|
|
10
10
|
*/
|
|
11
11
|
export var getLayoutCalcChildren = function getLayoutCalcChildren(node, rootId, getRootHeirOrientation) {
|
|
12
12
|
// 判断是否所有子代都折叠了
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Mind } from "../index";
|
|
2
|
-
/**
|
|
3
|
-
* 判断节点是否为root直系子代并且已经被折叠了
|
|
4
|
-
* @param node
|
|
5
|
-
* @param parent
|
|
6
|
-
* @param root
|
|
7
|
-
* @param getRootHeirOrientation
|
|
2
|
+
/**
|
|
3
|
+
* 判断节点是否为root直系子代并且已经被折叠了
|
|
4
|
+
* @param node
|
|
5
|
+
* @param parent
|
|
6
|
+
* @param root
|
|
7
|
+
* @param getRootHeirOrientation
|
|
8
8
|
*/
|
|
9
9
|
export var judgeIfHeirAndFold = function judgeIfHeirAndFold(node, parent, root, getRootHeirOrientation) {
|
|
10
10
|
// 是否为根节点直系子代
|
|
@@ -361,9 +361,7 @@ export declare namespace Mind {
|
|
|
361
361
|
breadthFirstWalkTree: (node: Node, callback: {
|
|
362
362
|
before: (node: Node) => boolean;
|
|
363
363
|
after: (rank: Node[]) => void;
|
|
364
|
-
}) => void;
|
|
365
|
-
* 直系子代节点中心对齐
|
|
366
|
-
*/
|
|
364
|
+
}) => void;
|
|
367
365
|
depthFirstWalkTree: (root: Node, callback: {
|
|
368
366
|
before: (node: Node, parent?: Node | undefined) => boolean;
|
|
369
367
|
after: (node: Node, parent?: Node | undefined) => void;
|
|
@@ -386,9 +384,7 @@ export declare namespace Mind {
|
|
|
386
384
|
export const _WithDefault: {
|
|
387
385
|
cache: (data?: NodeCache | undefined) => Required<NodeCache>;
|
|
388
386
|
options: (data?: Options | undefined) => Required<Options>;
|
|
389
|
-
transform: (data?: Transform | undefined) => Required<Transform>;
|
|
390
|
-
* y轴垂直方向渲染
|
|
391
|
-
*/
|
|
387
|
+
transform: (data?: Transform | undefined) => Required<Transform>;
|
|
392
388
|
};
|
|
393
389
|
export {};
|
|
394
390
|
}
|
|
@@ -8,57 +8,57 @@ import { DraggableLayout as DraggableLayoutClass } from "./process/layout/type";
|
|
|
8
8
|
export var Mind;
|
|
9
9
|
(function (_Mind) {
|
|
10
10
|
var ChildAlignMode = _Mind.ChildAlignMode = {
|
|
11
|
-
/**
|
|
12
|
-
* 子代对齐模式
|
|
11
|
+
/**
|
|
12
|
+
* 子代对齐模式
|
|
13
13
|
*/
|
|
14
14
|
descendantCenter: 'descendant-center',
|
|
15
|
-
/**
|
|
16
|
-
* 直系子代节点中心对齐
|
|
15
|
+
/**
|
|
16
|
+
* 直系子代节点中心对齐
|
|
17
17
|
*/
|
|
18
18
|
heirCenter: 'heir-center',
|
|
19
|
-
/**
|
|
20
|
-
* 结构化规整模式
|
|
19
|
+
/**
|
|
20
|
+
* 结构化规整模式
|
|
21
21
|
*/
|
|
22
22
|
structured: 'structured'
|
|
23
23
|
};
|
|
24
24
|
var Orientation = _Mind.Orientation = {
|
|
25
|
-
/**
|
|
26
|
-
* 处于正向区域
|
|
25
|
+
/**
|
|
26
|
+
* 处于正向区域
|
|
27
27
|
*/
|
|
28
28
|
negative: 'negative',
|
|
29
|
-
/**
|
|
30
|
-
* 处于负向区域
|
|
29
|
+
/**
|
|
30
|
+
* 处于负向区域
|
|
31
31
|
*/
|
|
32
32
|
positive: 'positive',
|
|
33
|
-
/**
|
|
34
|
-
* 根节点
|
|
33
|
+
/**
|
|
34
|
+
* 根节点
|
|
35
35
|
*/
|
|
36
36
|
root: 'root'
|
|
37
37
|
};
|
|
38
38
|
var Direction = _Mind.Direction = {
|
|
39
|
-
/**
|
|
40
|
-
* x轴水平方向渲染
|
|
39
|
+
/**
|
|
40
|
+
* x轴水平方向渲染
|
|
41
41
|
*/
|
|
42
42
|
x: 'x',
|
|
43
|
-
/**
|
|
44
|
-
* y轴垂直方向渲染
|
|
43
|
+
/**
|
|
44
|
+
* y轴垂直方向渲染
|
|
45
45
|
*/
|
|
46
46
|
y: 'y'
|
|
47
47
|
};
|
|
48
48
|
var LinkStyle = _Mind.LinkStyle = {
|
|
49
|
-
/**
|
|
50
|
-
* 贝塞尔曲线
|
|
49
|
+
/**
|
|
50
|
+
* 贝塞尔曲线
|
|
51
51
|
*/
|
|
52
52
|
bezier: 'bezier',
|
|
53
|
-
/**
|
|
54
|
-
* 线性
|
|
55
|
-
* - 线性只有在 ChildAlignMode.structured 风格下表现最佳
|
|
53
|
+
/**
|
|
54
|
+
* 线性
|
|
55
|
+
* - 线性只有在 ChildAlignMode.structured 风格下表现最佳
|
|
56
56
|
*/
|
|
57
57
|
line: 'line'
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
/**
|
|
61
|
-
* 拖动关联信息
|
|
60
|
+
/**
|
|
61
|
+
* 拖动关联信息
|
|
62
62
|
*/
|
|
63
63
|
|
|
64
64
|
var RelativeX = _Mind.RelativeX = {
|
|
@@ -72,9 +72,9 @@ export var Mind;
|
|
|
72
72
|
top: 'top'
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
-
/**
|
|
76
|
-
* 位移/缩放事件函数
|
|
77
|
-
* @param event the underlying input event, such as mousemove or touchmove
|
|
75
|
+
/**
|
|
76
|
+
* 位移/缩放事件函数
|
|
77
|
+
* @param event the underlying input event, such as mousemove or touchmove
|
|
78
78
|
*/
|
|
79
79
|
|
|
80
80
|
var Graphic = _Mind.Graphic = GraphicClass;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Helper } from "../../../helper";
|
|
2
|
-
/**
|
|
3
|
-
* 获取节点交叉轴边界
|
|
4
|
-
* - 如果存在视觉子代,请保证视觉子代边界计算完成
|
|
5
|
-
* @param cache
|
|
6
|
-
* @param children
|
|
7
|
-
* @param vertical
|
|
8
|
-
* @param cacheMap
|
|
2
|
+
/**
|
|
3
|
+
* 获取节点交叉轴边界
|
|
4
|
+
* - 如果存在视觉子代,请保证视觉子代边界计算完成
|
|
5
|
+
* @param cache
|
|
6
|
+
* @param children
|
|
7
|
+
* @param vertical
|
|
8
|
+
* @param cacheMap
|
|
9
9
|
*/
|
|
10
10
|
export var getNodeCrossBoundary = function getNodeCrossBoundary(cache, children, vertical, cacheMap) {
|
|
11
11
|
var boundary = {
|
|
@@ -10,38 +10,38 @@ import { Helper } from "../../helper";
|
|
|
10
10
|
export var DraggableLayout = /*#__PURE__*/_createClass(function DraggableLayout() {
|
|
11
11
|
_classCallCheck(this, DraggableLayout);
|
|
12
12
|
});
|
|
13
|
-
/**
|
|
14
|
-
* 计算拖动关联信息
|
|
15
|
-
* @param context 上下文
|
|
16
|
-
* @param context.cacheMap 缓存地图
|
|
17
|
-
* @param context.draggingRect 正在拖动节点的大小以及位置
|
|
18
|
-
* @param context.canBeAttachedNodes 可以被关联的节点
|
|
19
|
-
* @param context.ignoreNodes 需要被忽略的节点
|
|
20
|
-
* @param context.root 根节点
|
|
21
|
-
* @param context.options 选项
|
|
22
|
-
* @return 如果没有合法的节点关联,则返回`undefined`
|
|
13
|
+
/**
|
|
14
|
+
* 计算拖动关联信息
|
|
15
|
+
* @param context 上下文
|
|
16
|
+
* @param context.cacheMap 缓存地图
|
|
17
|
+
* @param context.draggingRect 正在拖动节点的大小以及位置
|
|
18
|
+
* @param context.canBeAttachedNodes 可以被关联的节点
|
|
19
|
+
* @param context.ignoreNodes 需要被忽略的节点
|
|
20
|
+
* @param context.root 根节点
|
|
21
|
+
* @param context.options 选项
|
|
22
|
+
* @return 如果没有合法的节点关联,则返回`undefined`
|
|
23
23
|
*/
|
|
24
24
|
_defineProperty(DraggableLayout, "calcDragAttach", function (context) {
|
|
25
25
|
// 此处是为了 ts 报错
|
|
26
26
|
context = context;
|
|
27
27
|
throw Helper.error('DraggableLayout static calcDragAttach must be implemented');
|
|
28
28
|
});
|
|
29
|
-
/**
|
|
30
|
-
* 计算拖动结束被放置的下标
|
|
31
|
-
* @param context 上下文
|
|
32
|
-
* @param context.cacheMap 缓存地图
|
|
33
|
-
* @param context.attachedNodeChildren 关联节点子代
|
|
34
|
-
* @param context.dropPosition 拖拽结束位置
|
|
35
|
-
* @param context.root 根节点
|
|
29
|
+
/**
|
|
30
|
+
* 计算拖动结束被放置的下标
|
|
31
|
+
* @param context 上下文
|
|
32
|
+
* @param context.cacheMap 缓存地图
|
|
33
|
+
* @param context.attachedNodeChildren 关联节点子代
|
|
34
|
+
* @param context.dropPosition 拖拽结束位置
|
|
35
|
+
* @param context.root 根节点
|
|
36
36
|
*/
|
|
37
37
|
_defineProperty(DraggableLayout, "calcDropIndex", function (context) {
|
|
38
38
|
// 此处是为了 ts 报错
|
|
39
39
|
context = context;
|
|
40
40
|
throw Helper.error('DraggableLayout static calcDropIndex must be implemented');
|
|
41
41
|
});
|
|
42
|
-
/**
|
|
43
|
-
* 是否为合法的继承了这个类的类对象
|
|
44
|
-
* @param classObject
|
|
42
|
+
/**
|
|
43
|
+
* 是否为合法的继承了这个类的类对象
|
|
44
|
+
* @param classObject
|
|
45
45
|
*/
|
|
46
46
|
_defineProperty(DraggableLayout, "isValidExtendsClass", function (classObject) {
|
|
47
47
|
var shouldBeRealizedFunc = ['calcDragAttach', 'calcDropIndex'];
|
|
@@ -31,9 +31,9 @@ export var Visible = /*#__PURE__*/_createClass(function Visible() {
|
|
|
31
31
|
_this.options = options;
|
|
32
32
|
_this.getRootHeirOrientation = getRootHeirOrientation;
|
|
33
33
|
});
|
|
34
|
-
/**
|
|
35
|
-
* 返回可见是否改变
|
|
36
|
-
* - 使用次返回值得前提是,数据没有出现改变(也就是在viewport尺寸改变或者transform时可以使用)
|
|
34
|
+
/**
|
|
35
|
+
* 返回可见是否改变
|
|
36
|
+
* - 使用次返回值得前提是,数据没有出现改变(也就是在viewport尺寸改变或者transform时可以使用)
|
|
37
37
|
*/
|
|
38
38
|
_defineProperty(this, "end", function () {
|
|
39
39
|
var visibleChange = {
|