@antv/hierarchy 0.6.10 → 0.6.11
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/.eslintrc +9 -23
- package/build/hierarchy.js +67 -12
- package/build/hierarchy.js.map +1 -1
- package/dist/hierarchy.min.js +1 -1
- package/lib/layout/indented.js +6 -12
- package/package.json +1 -1
- package/src/layout/indented.js +8 -10
package/.eslintrc
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": [
|
|
3
|
-
"egg"
|
|
4
|
-
],
|
|
2
|
+
"extends": ["egg"],
|
|
5
3
|
"globals": {
|
|
6
4
|
"$": true,
|
|
7
5
|
"DataSet": true,
|
|
@@ -12,31 +10,19 @@
|
|
|
12
10
|
"parserOptions": {
|
|
13
11
|
"sourceType": "module"
|
|
14
12
|
},
|
|
15
|
-
"plugins": [
|
|
16
|
-
"html"
|
|
17
|
-
],
|
|
13
|
+
"plugins": ["html"],
|
|
18
14
|
"rules": {
|
|
19
|
-
"no-bitwise": [
|
|
20
|
-
|
|
21
|
-
],
|
|
22
|
-
"experimentalDecorators": [
|
|
23
|
-
0
|
|
24
|
-
],
|
|
25
|
-
"comma-dangle": [
|
|
26
|
-
"error",
|
|
27
|
-
"never"
|
|
28
|
-
],
|
|
15
|
+
"no-bitwise": [0],
|
|
16
|
+
"experimentalDecorators": [0],
|
|
17
|
+
"comma-dangle": ["error", "never"],
|
|
29
18
|
"no-console": [
|
|
30
19
|
"error",
|
|
31
20
|
{
|
|
32
|
-
"allow": [
|
|
33
|
-
"warn",
|
|
34
|
-
"error"
|
|
35
|
-
]
|
|
21
|
+
"allow": ["warn", "error"]
|
|
36
22
|
}
|
|
37
23
|
],
|
|
38
|
-
"linebreak-style": [
|
|
39
|
-
|
|
40
|
-
]
|
|
24
|
+
"linebreak-style": [0],
|
|
25
|
+
"quotes": [0],
|
|
26
|
+
"arrow-parens": [0]
|
|
41
27
|
}
|
|
42
28
|
}
|
package/build/hierarchy.js
CHANGED
|
@@ -3139,6 +3139,10 @@ function size(o) {
|
|
|
3139
3139
|
/* unused harmony export __rest */
|
|
3140
3140
|
/* unused harmony export __decorate */
|
|
3141
3141
|
/* unused harmony export __param */
|
|
3142
|
+
/* unused harmony export __esDecorate */
|
|
3143
|
+
/* unused harmony export __runInitializers */
|
|
3144
|
+
/* unused harmony export __propKey */
|
|
3145
|
+
/* unused harmony export __setFunctionName */
|
|
3142
3146
|
/* unused harmony export __metadata */
|
|
3143
3147
|
/* unused harmony export __awaiter */
|
|
3144
3148
|
/* unused harmony export __generator */
|
|
@@ -3223,6 +3227,63 @@ function __param(paramIndex, decorator) {
|
|
|
3223
3227
|
decorator(target, key, paramIndex);
|
|
3224
3228
|
};
|
|
3225
3229
|
}
|
|
3230
|
+
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3231
|
+
function accept(f) {
|
|
3232
|
+
if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
|
|
3233
|
+
return f;
|
|
3234
|
+
}
|
|
3235
|
+
var kind = contextIn.kind,
|
|
3236
|
+
key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
3237
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
3238
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
3239
|
+
var _,
|
|
3240
|
+
done = false;
|
|
3241
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
3242
|
+
var context = {};
|
|
3243
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
3244
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
3245
|
+
context.addInitializer = function (f) {
|
|
3246
|
+
if (done) throw new TypeError("Cannot add initializers after decoration has completed");
|
|
3247
|
+
extraInitializers.push(accept(f || null));
|
|
3248
|
+
};
|
|
3249
|
+
var result = (0, decorators[i])(kind === "accessor" ? {
|
|
3250
|
+
get: descriptor.get,
|
|
3251
|
+
set: descriptor.set
|
|
3252
|
+
} : descriptor[key], context);
|
|
3253
|
+
if (kind === "accessor") {
|
|
3254
|
+
if (result === void 0) continue;
|
|
3255
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
3256
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
3257
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
3258
|
+
if (_ = accept(result.init)) initializers.push(_);
|
|
3259
|
+
} else if (_ = accept(result)) {
|
|
3260
|
+
if (kind === "field") initializers.push(_);else descriptor[key] = _;
|
|
3261
|
+
}
|
|
3262
|
+
}
|
|
3263
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
3264
|
+
done = true;
|
|
3265
|
+
}
|
|
3266
|
+
;
|
|
3267
|
+
function __runInitializers(thisArg, initializers, value) {
|
|
3268
|
+
var useValue = arguments.length > 2;
|
|
3269
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
3270
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
3271
|
+
}
|
|
3272
|
+
return useValue ? value : void 0;
|
|
3273
|
+
}
|
|
3274
|
+
;
|
|
3275
|
+
function __propKey(x) {
|
|
3276
|
+
return typeof x === "symbol" ? x : "".concat(x);
|
|
3277
|
+
}
|
|
3278
|
+
;
|
|
3279
|
+
function __setFunctionName(f, name, prefix) {
|
|
3280
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
3281
|
+
return Object.defineProperty(f, "name", {
|
|
3282
|
+
configurable: true,
|
|
3283
|
+
value: prefix ? "".concat(prefix, " ", name) : name
|
|
3284
|
+
});
|
|
3285
|
+
}
|
|
3286
|
+
;
|
|
3226
3287
|
function __metadata(metadataKey, metadataValue) {
|
|
3227
3288
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
3228
3289
|
}
|
|
@@ -3469,7 +3530,7 @@ function __asyncDelegator(o) {
|
|
|
3469
3530
|
i[n] = o[n] ? function (v) {
|
|
3470
3531
|
return (p = !p) ? {
|
|
3471
3532
|
value: __await(o[n](v)),
|
|
3472
|
-
done:
|
|
3533
|
+
done: false
|
|
3473
3534
|
} : f ? f(v) : v;
|
|
3474
3535
|
} : f;
|
|
3475
3536
|
}
|
|
@@ -4121,7 +4182,7 @@ module.exports = indentedLayout;
|
|
|
4121
4182
|
var util = __webpack_require__(6);
|
|
4122
4183
|
function positionNode(node, previousNode, indent, dropCap, align) {
|
|
4123
4184
|
// caculate the node's horizontal offset DX, dx's type might be number or function
|
|
4124
|
-
var displacementX = typeof indent ===
|
|
4185
|
+
var displacementX = typeof indent === "function" ? indent(node) : indent * node.depth;
|
|
4125
4186
|
if (!dropCap) {
|
|
4126
4187
|
try {
|
|
4127
4188
|
if (node.id === node.parent.children[0].id) {
|
|
@@ -4135,18 +4196,12 @@ function positionNode(node, previousNode, indent, dropCap, align) {
|
|
|
4135
4196
|
}
|
|
4136
4197
|
node.x += displacementX;
|
|
4137
4198
|
if (previousNode) {
|
|
4138
|
-
var _previousNode$parent;
|
|
4139
4199
|
node.y = previousNode.y + util.getHeight(previousNode, node, align);
|
|
4140
|
-
if (node.parent.id !==
|
|
4200
|
+
if (previousNode.parent && node.parent.id !== previousNode.parent.id) {
|
|
4141
4201
|
// previous node has different parent
|
|
4142
|
-
var
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
var preNode = node.parent.children[index - 1];
|
|
4146
|
-
if (preNode) {
|
|
4147
|
-
var preY = preNode.y + util.getHeight(preNode, node, align);
|
|
4148
|
-
node.y = preY > node.y ? preY : node.y;
|
|
4149
|
-
}
|
|
4202
|
+
var prevParent = previousNode.parent;
|
|
4203
|
+
var preY = prevParent.y + util.getHeight(prevParent, node, align);
|
|
4204
|
+
node.y = preY > node.y ? preY : node.y;
|
|
4150
4205
|
}
|
|
4151
4206
|
} else {
|
|
4152
4207
|
node.y = 0;
|