@visactor/vchart 2.1.0-alpha.0 → 2.1.0-alpha.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.
- package/build/es5/index.js +1 -1
- package/build/index.es.js +77 -5
- package/build/index.js +77 -5
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/chart/index.js +1 -1
- package/cjs/chart/stack.js +1 -1
- package/cjs/chart/util.js +1 -1
- package/cjs/component/index.js +1 -1
- package/cjs/component/util.js +1 -1
- package/cjs/constant/attribute.js +2 -1
- package/cjs/constant/box-plot.js +1 -2
- package/cjs/constant/waterfall.js +2 -1
- package/cjs/core/expression-function.js +1 -2
- package/cjs/core/factory.js +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/instance-manager.js +1 -1
- package/cjs/core/interface.js +1 -1
- package/cjs/core/util.js +1 -1
- package/cjs/core/vchart.js +1 -1
- package/cjs/data/initialize.js +1 -1
- package/cjs/env/env.js +1 -1
- package/cjs/env/index.js +1 -1
- package/esm/chart/index.js +1 -1
- package/esm/chart/stack.js +1 -1
- package/esm/chart/util.js +1 -1
- package/esm/component/index.js +1 -1
- package/esm/component/util.js +1 -1
- package/esm/constant/attribute.js +2 -1
- package/esm/constant/box-plot.js +1 -2
- package/esm/constant/waterfall.js +2 -1
- package/esm/core/expression-function.js +1 -2
- package/esm/core/factory.js +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/instance-manager.js +1 -1
- package/esm/core/interface.js +1 -1
- package/esm/core/util.js +1 -1
- package/esm/core/vchart.js +1 -1
- package/esm/data/initialize.js +1 -1
- package/esm/env/env.js +1 -1
- package/esm/env/index.js +1 -1
- package/package.json +9 -9
package/build/index.es.js
CHANGED
|
@@ -43347,9 +43347,17 @@ class PulseAnimate extends ACustomAnimate {
|
|
|
43347
43347
|
}
|
|
43348
43348
|
}
|
|
43349
43349
|
|
|
43350
|
+
const clipPathGeometryAttrs = {
|
|
43351
|
+
x: !0,
|
|
43352
|
+
y: !0,
|
|
43353
|
+
x1: !0,
|
|
43354
|
+
y1: !0,
|
|
43355
|
+
width: !0,
|
|
43356
|
+
height: !0
|
|
43357
|
+
};
|
|
43350
43358
|
class Update extends ACustomAnimate {
|
|
43351
43359
|
constructor(from, to, duration, easing, params) {
|
|
43352
|
-
super(from, to, duration, easing, params);
|
|
43360
|
+
super(from, to, duration, easing, params), this.clipPathSyncKeys = null, this.clipPathSyncParent = null, this.clipPathSyncChildIndex = -1, this.clipPathSyncDisabled = !1;
|
|
43353
43361
|
}
|
|
43354
43362
|
onBind() {
|
|
43355
43363
|
var _a, _b;
|
|
@@ -43362,12 +43370,25 @@ class Update extends ACustomAnimate {
|
|
|
43362
43370
|
} = this.params;
|
|
43363
43371
|
diffAttrs = Object.assign({}, diffAttrs), (null === (_b = null == options ? void 0 : options.excludeChannels) || void 0 === _b ? void 0 : _b.length) && options.excludeChannels.forEach(channel => {
|
|
43364
43372
|
delete diffAttrs[channel];
|
|
43365
|
-
}), this.props = diffAttrs;
|
|
43373
|
+
}), this.props = diffAttrs, this.clipPathSyncKeys = Object.keys(diffAttrs).filter(key => clipPathGeometryAttrs[key]), this.clipPathSyncDisabled = !this.clipPathSyncKeys.length, this.syncParentClipPathToTarget();
|
|
43374
|
+
}
|
|
43375
|
+
getStaticCommitAttrs() {
|
|
43376
|
+
var _a;
|
|
43377
|
+
if (!this.props) return null;
|
|
43378
|
+
const target = this.target,
|
|
43379
|
+
contextFinalAttrs = null === (_a = target.context) || void 0 === _a ? void 0 : _a.finalAttrs,
|
|
43380
|
+
finalAttribute = "function" == typeof target.getFinalAttribute ? target.getFinalAttribute() : target.finalAttribute,
|
|
43381
|
+
commitAttrs = {};
|
|
43382
|
+
return Object.keys(this.props).forEach(key => {
|
|
43383
|
+
contextFinalAttrs && Object.prototype.hasOwnProperty.call(contextFinalAttrs, key) ? commitAttrs[key] = contextFinalAttrs[key] : finalAttribute && Object.prototype.hasOwnProperty.call(finalAttribute, key) ? commitAttrs[key] = finalAttribute[key] : this.animate.validAttr(key) && (commitAttrs[key] = this.props[key]);
|
|
43384
|
+
}), Object.keys(commitAttrs).length ? commitAttrs : null;
|
|
43366
43385
|
}
|
|
43367
43386
|
onEnd(cb) {
|
|
43368
|
-
|
|
43387
|
+
if (cb) return void super.onEnd(cb);
|
|
43388
|
+
const commitAttrs = this.getStaticCommitAttrs();
|
|
43389
|
+
commitAttrs && this.target.setAttributes(commitAttrs, !1, {
|
|
43369
43390
|
type: AttributeUpdateType.ANIMATE_END
|
|
43370
|
-
}), super.onEnd()
|
|
43391
|
+
}), this.syncParentClipPathToTarget(), super.onEnd();
|
|
43371
43392
|
}
|
|
43372
43393
|
update(end, ratio, out) {
|
|
43373
43394
|
if (this.onStart(), !this.props || !this.propKeys) return;
|
|
@@ -43376,7 +43397,58 @@ class Update extends ACustomAnimate {
|
|
|
43376
43397
|
if (!this.animate.validAttr(this.propKeys[index])) return;
|
|
43377
43398
|
const key = this.propKeys[index];
|
|
43378
43399
|
func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
|
|
43379
|
-
}), this.onUpdate(end, easedRatio, out);
|
|
43400
|
+
}), this.syncParentClipPathToTarget(), this.onUpdate(end, easedRatio, out);
|
|
43401
|
+
}
|
|
43402
|
+
syncParentClipPathToTarget() {
|
|
43403
|
+
var _a, _b;
|
|
43404
|
+
if (this.clipPathSyncDisabled) return;
|
|
43405
|
+
const target = this.target,
|
|
43406
|
+
parent = target.parent,
|
|
43407
|
+
path = null === (_a = null == parent ? void 0 : parent.attribute) || void 0 === _a ? void 0 : _a.path;
|
|
43408
|
+
if (!(null === (_b = null == parent ? void 0 : parent.attribute) || void 0 === _b ? void 0 : _b.clip) || !Array.isArray(path) || !path.length) return;
|
|
43409
|
+
const childIndex = this.getClipPathSyncChildIndex(parent);
|
|
43410
|
+
if (childIndex < 0 || childIndex >= path.length) return;
|
|
43411
|
+
const clipGraphic = path[childIndex];
|
|
43412
|
+
if (!(null == clipGraphic ? void 0 : clipGraphic.attribute) || clipGraphic.type !== target.type || !this.isClipPathStaticTarget(clipGraphic)) return;
|
|
43413
|
+
const syncAttrs = this.buildClipPathTransientAttrs(clipGraphic);
|
|
43414
|
+
syncAttrs && applyAnimationTransientAttributes(clipGraphic, syncAttrs, AttributeUpdateType.ANIMATE_UPDATE);
|
|
43415
|
+
}
|
|
43416
|
+
getClipPathSyncChildIndex(parent) {
|
|
43417
|
+
var _a;
|
|
43418
|
+
if (this.clipPathSyncParent === parent && this.clipPathSyncChildIndex >= 0) return this.clipPathSyncChildIndex;
|
|
43419
|
+
const target = this.target;
|
|
43420
|
+
let childIndex = -1;
|
|
43421
|
+
return null === (_a = parent.forEachChildren) || void 0 === _a || _a.call(parent, (child, index) => child === target && (childIndex = index, !0)), this.clipPathSyncParent = parent, this.clipPathSyncChildIndex = childIndex, childIndex;
|
|
43422
|
+
}
|
|
43423
|
+
isClipPathStaticTarget(clipGraphic) {
|
|
43424
|
+
var _a, _b;
|
|
43425
|
+
const target = this.target,
|
|
43426
|
+
targetFinalAttrs = this.getTargetFinalAttrs(),
|
|
43427
|
+
clipGraphicFinalAttrs = "function" == typeof clipGraphic.getFinalAttribute ? clipGraphic.getFinalAttribute() : clipGraphic.finalAttribute,
|
|
43428
|
+
clipFinalAttrs = null !== (_a = null != clipGraphicFinalAttrs ? clipGraphicFinalAttrs : clipGraphic.baseAttributes) && void 0 !== _a ? _a : clipGraphic.attribute,
|
|
43429
|
+
keys = null !== (_b = this.clipPathSyncKeys) && void 0 !== _b ? _b : [];
|
|
43430
|
+
return !!(keys.length && targetFinalAttrs && clipFinalAttrs) && keys.every(key => {
|
|
43431
|
+
var _a, _b;
|
|
43432
|
+
return this.isSameClipPathValue(clipFinalAttrs[key], null !== (_a = targetFinalAttrs[key]) && void 0 !== _a ? _a : null === (_b = target.attribute) || void 0 === _b ? void 0 : _b[key]);
|
|
43433
|
+
});
|
|
43434
|
+
}
|
|
43435
|
+
getTargetFinalAttrs() {
|
|
43436
|
+
var _a, _b, _c;
|
|
43437
|
+
const target = this.target;
|
|
43438
|
+
return null !== (_c = null !== (_b = null === (_a = target.context) || void 0 === _a ? void 0 : _a.finalAttrs) && void 0 !== _b ? _b : "function" == typeof target.getFinalAttribute ? target.getFinalAttribute() : target.finalAttribute) && void 0 !== _c ? _c : null;
|
|
43439
|
+
}
|
|
43440
|
+
isSameClipPathValue(a, b) {
|
|
43441
|
+
return "number" == typeof a && "number" == typeof b ? Math.abs(a - b) < 1e-8 : a === b;
|
|
43442
|
+
}
|
|
43443
|
+
buildClipPathTransientAttrs(clipGraphic) {
|
|
43444
|
+
var _a;
|
|
43445
|
+
const target = this.target,
|
|
43446
|
+
attrs = {};
|
|
43447
|
+
return (null !== (_a = this.clipPathSyncKeys) && void 0 !== _a ? _a : []).forEach(key => {
|
|
43448
|
+
var _a;
|
|
43449
|
+
const nextValue = null === (_a = target.attribute) || void 0 === _a ? void 0 : _a[key];
|
|
43450
|
+
Object.prototype.hasOwnProperty.call(clipGraphic.attribute, key) && void 0 !== nextValue && !this.isSameClipPathValue(clipGraphic.attribute[key], nextValue) && (attrs[key] = nextValue);
|
|
43451
|
+
}), Object.keys(attrs).length ? attrs : null;
|
|
43380
43452
|
}
|
|
43381
43453
|
}
|
|
43382
43454
|
|
package/build/index.js
CHANGED
|
@@ -43353,9 +43353,17 @@
|
|
|
43353
43353
|
}
|
|
43354
43354
|
}
|
|
43355
43355
|
|
|
43356
|
+
const clipPathGeometryAttrs = {
|
|
43357
|
+
x: !0,
|
|
43358
|
+
y: !0,
|
|
43359
|
+
x1: !0,
|
|
43360
|
+
y1: !0,
|
|
43361
|
+
width: !0,
|
|
43362
|
+
height: !0
|
|
43363
|
+
};
|
|
43356
43364
|
class Update extends ACustomAnimate {
|
|
43357
43365
|
constructor(from, to, duration, easing, params) {
|
|
43358
|
-
super(from, to, duration, easing, params);
|
|
43366
|
+
super(from, to, duration, easing, params), this.clipPathSyncKeys = null, this.clipPathSyncParent = null, this.clipPathSyncChildIndex = -1, this.clipPathSyncDisabled = !1;
|
|
43359
43367
|
}
|
|
43360
43368
|
onBind() {
|
|
43361
43369
|
var _a, _b;
|
|
@@ -43368,12 +43376,25 @@
|
|
|
43368
43376
|
} = this.params;
|
|
43369
43377
|
diffAttrs = Object.assign({}, diffAttrs), (null === (_b = null == options ? void 0 : options.excludeChannels) || void 0 === _b ? void 0 : _b.length) && options.excludeChannels.forEach(channel => {
|
|
43370
43378
|
delete diffAttrs[channel];
|
|
43371
|
-
}), this.props = diffAttrs;
|
|
43379
|
+
}), this.props = diffAttrs, this.clipPathSyncKeys = Object.keys(diffAttrs).filter(key => clipPathGeometryAttrs[key]), this.clipPathSyncDisabled = !this.clipPathSyncKeys.length, this.syncParentClipPathToTarget();
|
|
43380
|
+
}
|
|
43381
|
+
getStaticCommitAttrs() {
|
|
43382
|
+
var _a;
|
|
43383
|
+
if (!this.props) return null;
|
|
43384
|
+
const target = this.target,
|
|
43385
|
+
contextFinalAttrs = null === (_a = target.context) || void 0 === _a ? void 0 : _a.finalAttrs,
|
|
43386
|
+
finalAttribute = "function" == typeof target.getFinalAttribute ? target.getFinalAttribute() : target.finalAttribute,
|
|
43387
|
+
commitAttrs = {};
|
|
43388
|
+
return Object.keys(this.props).forEach(key => {
|
|
43389
|
+
contextFinalAttrs && Object.prototype.hasOwnProperty.call(contextFinalAttrs, key) ? commitAttrs[key] = contextFinalAttrs[key] : finalAttribute && Object.prototype.hasOwnProperty.call(finalAttribute, key) ? commitAttrs[key] = finalAttribute[key] : this.animate.validAttr(key) && (commitAttrs[key] = this.props[key]);
|
|
43390
|
+
}), Object.keys(commitAttrs).length ? commitAttrs : null;
|
|
43372
43391
|
}
|
|
43373
43392
|
onEnd(cb) {
|
|
43374
|
-
|
|
43393
|
+
if (cb) return void super.onEnd(cb);
|
|
43394
|
+
const commitAttrs = this.getStaticCommitAttrs();
|
|
43395
|
+
commitAttrs && this.target.setAttributes(commitAttrs, !1, {
|
|
43375
43396
|
type: AttributeUpdateType.ANIMATE_END
|
|
43376
|
-
}), super.onEnd()
|
|
43397
|
+
}), this.syncParentClipPathToTarget(), super.onEnd();
|
|
43377
43398
|
}
|
|
43378
43399
|
update(end, ratio, out) {
|
|
43379
43400
|
if (this.onStart(), !this.props || !this.propKeys) return;
|
|
@@ -43382,7 +43403,58 @@
|
|
|
43382
43403
|
if (!this.animate.validAttr(this.propKeys[index])) return;
|
|
43383
43404
|
const key = this.propKeys[index];
|
|
43384
43405
|
func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
|
|
43385
|
-
}), this.onUpdate(end, easedRatio, out);
|
|
43406
|
+
}), this.syncParentClipPathToTarget(), this.onUpdate(end, easedRatio, out);
|
|
43407
|
+
}
|
|
43408
|
+
syncParentClipPathToTarget() {
|
|
43409
|
+
var _a, _b;
|
|
43410
|
+
if (this.clipPathSyncDisabled) return;
|
|
43411
|
+
const target = this.target,
|
|
43412
|
+
parent = target.parent,
|
|
43413
|
+
path = null === (_a = null == parent ? void 0 : parent.attribute) || void 0 === _a ? void 0 : _a.path;
|
|
43414
|
+
if (!(null === (_b = null == parent ? void 0 : parent.attribute) || void 0 === _b ? void 0 : _b.clip) || !Array.isArray(path) || !path.length) return;
|
|
43415
|
+
const childIndex = this.getClipPathSyncChildIndex(parent);
|
|
43416
|
+
if (childIndex < 0 || childIndex >= path.length) return;
|
|
43417
|
+
const clipGraphic = path[childIndex];
|
|
43418
|
+
if (!(null == clipGraphic ? void 0 : clipGraphic.attribute) || clipGraphic.type !== target.type || !this.isClipPathStaticTarget(clipGraphic)) return;
|
|
43419
|
+
const syncAttrs = this.buildClipPathTransientAttrs(clipGraphic);
|
|
43420
|
+
syncAttrs && applyAnimationTransientAttributes(clipGraphic, syncAttrs, AttributeUpdateType.ANIMATE_UPDATE);
|
|
43421
|
+
}
|
|
43422
|
+
getClipPathSyncChildIndex(parent) {
|
|
43423
|
+
var _a;
|
|
43424
|
+
if (this.clipPathSyncParent === parent && this.clipPathSyncChildIndex >= 0) return this.clipPathSyncChildIndex;
|
|
43425
|
+
const target = this.target;
|
|
43426
|
+
let childIndex = -1;
|
|
43427
|
+
return null === (_a = parent.forEachChildren) || void 0 === _a || _a.call(parent, (child, index) => child === target && (childIndex = index, !0)), this.clipPathSyncParent = parent, this.clipPathSyncChildIndex = childIndex, childIndex;
|
|
43428
|
+
}
|
|
43429
|
+
isClipPathStaticTarget(clipGraphic) {
|
|
43430
|
+
var _a, _b;
|
|
43431
|
+
const target = this.target,
|
|
43432
|
+
targetFinalAttrs = this.getTargetFinalAttrs(),
|
|
43433
|
+
clipGraphicFinalAttrs = "function" == typeof clipGraphic.getFinalAttribute ? clipGraphic.getFinalAttribute() : clipGraphic.finalAttribute,
|
|
43434
|
+
clipFinalAttrs = null !== (_a = null != clipGraphicFinalAttrs ? clipGraphicFinalAttrs : clipGraphic.baseAttributes) && void 0 !== _a ? _a : clipGraphic.attribute,
|
|
43435
|
+
keys = null !== (_b = this.clipPathSyncKeys) && void 0 !== _b ? _b : [];
|
|
43436
|
+
return !!(keys.length && targetFinalAttrs && clipFinalAttrs) && keys.every(key => {
|
|
43437
|
+
var _a, _b;
|
|
43438
|
+
return this.isSameClipPathValue(clipFinalAttrs[key], null !== (_a = targetFinalAttrs[key]) && void 0 !== _a ? _a : null === (_b = target.attribute) || void 0 === _b ? void 0 : _b[key]);
|
|
43439
|
+
});
|
|
43440
|
+
}
|
|
43441
|
+
getTargetFinalAttrs() {
|
|
43442
|
+
var _a, _b, _c;
|
|
43443
|
+
const target = this.target;
|
|
43444
|
+
return null !== (_c = null !== (_b = null === (_a = target.context) || void 0 === _a ? void 0 : _a.finalAttrs) && void 0 !== _b ? _b : "function" == typeof target.getFinalAttribute ? target.getFinalAttribute() : target.finalAttribute) && void 0 !== _c ? _c : null;
|
|
43445
|
+
}
|
|
43446
|
+
isSameClipPathValue(a, b) {
|
|
43447
|
+
return "number" == typeof a && "number" == typeof b ? Math.abs(a - b) < 1e-8 : a === b;
|
|
43448
|
+
}
|
|
43449
|
+
buildClipPathTransientAttrs(clipGraphic) {
|
|
43450
|
+
var _a;
|
|
43451
|
+
const target = this.target,
|
|
43452
|
+
attrs = {};
|
|
43453
|
+
return (null !== (_a = this.clipPathSyncKeys) && void 0 !== _a ? _a : []).forEach(key => {
|
|
43454
|
+
var _a;
|
|
43455
|
+
const nextValue = null === (_a = target.attribute) || void 0 === _a ? void 0 : _a[key];
|
|
43456
|
+
Object.prototype.hasOwnProperty.call(clipGraphic.attribute, key) && void 0 !== nextValue && !this.isSameClipPathValue(clipGraphic.attribute[key], nextValue) && (attrs[key] = nextValue);
|
|
43457
|
+
}), Object.keys(attrs).length ? attrs : null;
|
|
43386
43458
|
}
|
|
43387
43459
|
}
|
|
43388
43460
|
|