@visactor/vchart 2.1.2-alpha.8 → 2.1.2

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 (70) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +40 -13
  3. package/build/index.js +40 -13
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/animation/animation-planner.js +2 -1
  7. package/cjs/animation/callback-disappear.d.ts +1 -1
  8. package/cjs/animation/callback-disappear.js.map +1 -1
  9. package/cjs/animation/grammar-dector.js +1 -2
  10. package/cjs/constant/attribute.js +2 -1
  11. package/cjs/constant/hierarchy.js +1 -1
  12. package/cjs/constant/label.js +1 -1
  13. package/cjs/constant/layout.js +1 -1
  14. package/cjs/constant/marker.js +1 -1
  15. package/cjs/constant/polar.js +1 -2
  16. package/cjs/constant/scatter.js +1 -1
  17. package/cjs/constant/scroll-bar.js +1 -1
  18. package/cjs/constant/sunburst.js +1 -1
  19. package/cjs/constant/waterfall.js +1 -1
  20. package/cjs/constant/word-cloud.js +1 -1
  21. package/cjs/core/index.d.ts +1 -1
  22. package/cjs/core/index.js +2 -2
  23. package/cjs/core/index.js.map +1 -1
  24. package/cjs/core/instance-manager.js +1 -1
  25. package/cjs/core/interface.js +1 -1
  26. package/cjs/core/util.js +1 -1
  27. package/cjs/core/vchart.js +1 -1
  28. package/cjs/data/data-view-utils.js +1 -1
  29. package/cjs/data/initialize.js +1 -1
  30. package/cjs/data/register.js +1 -1
  31. package/cjs/env/env.js +1 -1
  32. package/cjs/env/index.js +1 -1
  33. package/cjs/mark/base/base-mark.d.ts +1 -0
  34. package/cjs/mark/base/base-mark.js +9 -1
  35. package/cjs/mark/base/base-mark.js.map +1 -1
  36. package/cjs/mark/group.js +2 -1
  37. package/cjs/mark/group.js.map +1 -1
  38. package/esm/animation/animation-planner.js +2 -1
  39. package/esm/animation/callback-disappear.d.ts +1 -1
  40. package/esm/animation/callback-disappear.js.map +1 -1
  41. package/esm/animation/grammar-dector.js +1 -2
  42. package/esm/constant/attribute.js +2 -1
  43. package/esm/constant/hierarchy.js +1 -1
  44. package/esm/constant/label.js +1 -1
  45. package/esm/constant/layout.js +1 -1
  46. package/esm/constant/marker.js +1 -1
  47. package/esm/constant/polar.js +1 -2
  48. package/esm/constant/scatter.js +1 -1
  49. package/esm/constant/scroll-bar.js +1 -1
  50. package/esm/constant/sunburst.js +1 -1
  51. package/esm/constant/waterfall.js +1 -1
  52. package/esm/constant/word-cloud.js +1 -1
  53. package/esm/core/index.d.ts +1 -1
  54. package/esm/core/index.js +2 -2
  55. package/esm/core/index.js.map +1 -1
  56. package/esm/core/instance-manager.js +1 -1
  57. package/esm/core/interface.js +1 -1
  58. package/esm/core/util.js +1 -1
  59. package/esm/core/vchart.js +1 -1
  60. package/esm/data/data-view-utils.js +1 -1
  61. package/esm/data/initialize.js +1 -1
  62. package/esm/data/register.js +1 -1
  63. package/esm/env/env.js +1 -1
  64. package/esm/env/index.js +1 -1
  65. package/esm/mark/base/base-mark.d.ts +1 -0
  66. package/esm/mark/base/base-mark.js +9 -1
  67. package/esm/mark/base/base-mark.js.map +1 -1
  68. package/esm/mark/group.js +2 -1
  69. package/esm/mark/group.js.map +1 -1
  70. package/package.json +9 -9
package/build/index.es.js CHANGED
@@ -19952,14 +19952,14 @@ class DefaultWindow extends EventListenerManager {
19952
19952
  get dpr() {
19953
19953
  return this._handler.getDpr();
19954
19954
  }
19955
- constructor(global = application.global, handlerFactory = defaultWindowHandlerFactory) {
19955
+ constructor(vRenderGlobal = application.global, handlerFactory = defaultWindowHandlerFactory) {
19956
19956
  super(), this.handlerFactory = handlerFactory, this.hooks = {
19957
19957
  onChange: new SyncHook(["x", "y", "width", "height"])
19958
19958
  }, this.active = () => {
19959
- const global = this.global;
19960
- if (!global.env || this.actived) return;
19961
- this.handlerFactory(global.env).configure(this, global), this.actived = !0;
19962
- }, this._uid = Generator.GenAutoIncrementId(), this.global = global, this.postInit();
19959
+ const vRenderGlobal = this.global;
19960
+ if (!vRenderGlobal.env || this.actived) return;
19961
+ this.handlerFactory(vRenderGlobal.env).configure(this, vRenderGlobal), this.actived = !0;
19962
+ }, this._uid = Generator.GenAutoIncrementId(), this.global = vRenderGlobal, this.postInit();
19963
19963
  }
19964
19964
  _nativeAddEventListener(type, listener, options) {
19965
19965
  return this._handler.addEventListener(type, listener, options);
@@ -34244,7 +34244,8 @@ class BrowserWindowHandlerContribution extends BaseWindowHandlerContribution {
34244
34244
  params.canvas ? this.createWindowByCanvas(params) : this.createWindowByConfig(params), this.postInit();
34245
34245
  }
34246
34246
  postInit() {
34247
- if (this.global.optimizeVisible) try {
34247
+ var _a;
34248
+ if (null === (_a = this.global) || void 0 === _a ? void 0 : _a.optimizeVisible) try {
34248
34249
  this.observerCanvas();
34249
34250
  } catch (err) {
34250
34251
  console.error("发生错误,该环境不存在IntersectionObserver");
@@ -34285,10 +34286,10 @@ class BrowserWindowHandlerContribution extends BaseWindowHandlerContribution {
34285
34286
  this.canvas = new BrowserCanvas(options);
34286
34287
  }
34287
34288
  createWindowByCanvas(params) {
34288
- var _a, _b;
34289
+ var _a, _b, _c;
34289
34290
  let canvas;
34290
34291
  if ("string" == typeof params.canvas) {
34291
- if (canvas = this.global.getElementById(params.canvas), canvas || "undefined" == typeof document || (canvas = document.getElementById(params.canvas)), !canvas) throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom");
34292
+ if (canvas = null === (_a = this.global) || void 0 === _a ? void 0 : _a.getElementById(params.canvas), canvas || "undefined" == typeof document || (canvas = document.getElementById(params.canvas)), !canvas) throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom");
34292
34293
  } else canvas = params.canvas;
34293
34294
  if (!canvas) throw new Error("发生错误,传入的canvas不正确");
34294
34295
  let width = params.width,
@@ -34299,14 +34300,14 @@ class BrowserWindowHandlerContribution extends BaseWindowHandlerContribution {
34299
34300
  }
34300
34301
  let dpr = params.dpr;
34301
34302
  if (null == dpr) {
34302
- dpr = null !== (_a = canvas.getContext("2d").pixelRatio) && void 0 !== _a ? _a : canvas.width / width;
34303
+ dpr = null !== (_b = canvas.getContext("2d").pixelRatio) && void 0 !== _b ? _b : canvas.width / width;
34303
34304
  }
34304
34305
  this.canvas = new BrowserCanvas({
34305
34306
  width: width,
34306
34307
  height: height,
34307
34308
  dpr: dpr,
34308
34309
  nativeCanvas: canvas,
34309
- canvasControled: null !== (_b = params.canvasControled) && void 0 !== _b && _b
34310
+ canvasControled: null !== (_c = params.canvasControled) && void 0 !== _c && _c
34310
34311
  });
34311
34312
  }
34312
34313
  releaseWindow() {
@@ -41628,6 +41629,20 @@ class BaseMark extends GrammarItem {
41628
41629
  _hasDiffAttrs(g) {
41629
41630
  return !!g.context.diffAttrs && Object.keys(g.context.diffAttrs).length > 0;
41630
41631
  }
41632
+ _commitPreventedAnimationStaticAttrs(g, attrs) {
41633
+ var _a, _b;
41634
+ if (!attrs || !Object.keys(attrs).length) {
41635
+ return;
41636
+ }
41637
+ const graphic = g;
41638
+ (_a = graphic.setFinalAttributes) === null || _a === void 0 ? void 0 : _a.call(graphic, attrs);
41639
+ if (graphic._commitAnimationStaticAttributes) {
41640
+ graphic._commitAnimationStaticAttributes(attrs);
41641
+ }
41642
+ else {
41643
+ (_b = graphic.commitInternalBaseAttributes) === null || _b === void 0 ? void 0 : _b.call(graphic, attrs);
41644
+ }
41645
+ }
41631
41646
  _runApplyGraphic(graphics) {
41632
41647
  const hasAnimation = this.hasAnimation();
41633
41648
  graphics.forEach((g, index) => {
@@ -41665,7 +41680,13 @@ class BaseMark extends GrammarItem {
41665
41680
  g.context.reusing = false;
41666
41681
  }
41667
41682
  else if (!hasStateAnimation) {
41668
- hasAnimation ? g.setAttributesAndPreventAnimate(diffAttrs) : g.setAttributes(diffAttrs);
41683
+ if (hasAnimation) {
41684
+ g.setAttributesAndPreventAnimate(diffAttrs);
41685
+ this._commitPreventedAnimationStaticAttrs(g, diffAttrs);
41686
+ }
41687
+ else {
41688
+ g.setAttributes(diffAttrs);
41689
+ }
41669
41690
  }
41670
41691
  if (!((_b = this.renderContext) === null || _b === void 0 ? void 0 : _b.progressive) && this._product && g.parent !== this._product) {
41671
41692
  this._product.appendChild(g);
@@ -42141,7 +42162,13 @@ class GroupMark extends BaseMark {
42141
42162
  const diffAttrs = getDiffAttributesOfGraphic(this._product, newAttrs);
42142
42163
  this._product.context.diffAttrs = diffAttrs;
42143
42164
  if (!this.hasAnimationByState(this._product.context.animationState)) {
42144
- hasAnimation ? this._product.setAttributesAndPreventAnimate(diffAttrs) : this._product.setAttributes(diffAttrs);
42165
+ if (hasAnimation) {
42166
+ this._product.setAttributesAndPreventAnimate(diffAttrs);
42167
+ this._commitPreventedAnimationStaticAttrs(this._product, diffAttrs);
42168
+ }
42169
+ else {
42170
+ this._product.setAttributes(diffAttrs);
42171
+ }
42145
42172
  }
42146
42173
  }
42147
42174
  else {
@@ -49194,7 +49221,7 @@ const lookup = (data, opt) => {
49194
49221
  });
49195
49222
  };
49196
49223
 
49197
- const version = "2.1.1";
49224
+ const version = "2.1.2";
49198
49225
 
49199
49226
  const addVChartProperty = (data, op) => {
49200
49227
  const context = op.beforeCall();
package/build/index.js CHANGED
@@ -19958,14 +19958,14 @@
19958
19958
  get dpr() {
19959
19959
  return this._handler.getDpr();
19960
19960
  }
19961
- constructor(global = application.global, handlerFactory = defaultWindowHandlerFactory) {
19961
+ constructor(vRenderGlobal = application.global, handlerFactory = defaultWindowHandlerFactory) {
19962
19962
  super(), this.handlerFactory = handlerFactory, this.hooks = {
19963
19963
  onChange: new SyncHook(["x", "y", "width", "height"])
19964
19964
  }, this.active = () => {
19965
- const global = this.global;
19966
- if (!global.env || this.actived) return;
19967
- this.handlerFactory(global.env).configure(this, global), this.actived = !0;
19968
- }, this._uid = Generator.GenAutoIncrementId(), this.global = global, this.postInit();
19965
+ const vRenderGlobal = this.global;
19966
+ if (!vRenderGlobal.env || this.actived) return;
19967
+ this.handlerFactory(vRenderGlobal.env).configure(this, vRenderGlobal), this.actived = !0;
19968
+ }, this._uid = Generator.GenAutoIncrementId(), this.global = vRenderGlobal, this.postInit();
19969
19969
  }
19970
19970
  _nativeAddEventListener(type, listener, options) {
19971
19971
  return this._handler.addEventListener(type, listener, options);
@@ -34250,7 +34250,8 @@
34250
34250
  params.canvas ? this.createWindowByCanvas(params) : this.createWindowByConfig(params), this.postInit();
34251
34251
  }
34252
34252
  postInit() {
34253
- if (this.global.optimizeVisible) try {
34253
+ var _a;
34254
+ if (null === (_a = this.global) || void 0 === _a ? void 0 : _a.optimizeVisible) try {
34254
34255
  this.observerCanvas();
34255
34256
  } catch (err) {
34256
34257
  console.error("发生错误,该环境不存在IntersectionObserver");
@@ -34291,10 +34292,10 @@
34291
34292
  this.canvas = new BrowserCanvas(options);
34292
34293
  }
34293
34294
  createWindowByCanvas(params) {
34294
- var _a, _b;
34295
+ var _a, _b, _c;
34295
34296
  let canvas;
34296
34297
  if ("string" == typeof params.canvas) {
34297
- if (canvas = this.global.getElementById(params.canvas), canvas || "undefined" == typeof document || (canvas = document.getElementById(params.canvas)), !canvas) throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom");
34298
+ if (canvas = null === (_a = this.global) || void 0 === _a ? void 0 : _a.getElementById(params.canvas), canvas || "undefined" == typeof document || (canvas = document.getElementById(params.canvas)), !canvas) throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom");
34298
34299
  } else canvas = params.canvas;
34299
34300
  if (!canvas) throw new Error("发生错误,传入的canvas不正确");
34300
34301
  let width = params.width,
@@ -34305,14 +34306,14 @@
34305
34306
  }
34306
34307
  let dpr = params.dpr;
34307
34308
  if (null == dpr) {
34308
- dpr = null !== (_a = canvas.getContext("2d").pixelRatio) && void 0 !== _a ? _a : canvas.width / width;
34309
+ dpr = null !== (_b = canvas.getContext("2d").pixelRatio) && void 0 !== _b ? _b : canvas.width / width;
34309
34310
  }
34310
34311
  this.canvas = new BrowserCanvas({
34311
34312
  width: width,
34312
34313
  height: height,
34313
34314
  dpr: dpr,
34314
34315
  nativeCanvas: canvas,
34315
- canvasControled: null !== (_b = params.canvasControled) && void 0 !== _b && _b
34316
+ canvasControled: null !== (_c = params.canvasControled) && void 0 !== _c && _c
34316
34317
  });
34317
34318
  }
34318
34319
  releaseWindow() {
@@ -41634,6 +41635,20 @@
41634
41635
  _hasDiffAttrs(g) {
41635
41636
  return !!g.context.diffAttrs && Object.keys(g.context.diffAttrs).length > 0;
41636
41637
  }
41638
+ _commitPreventedAnimationStaticAttrs(g, attrs) {
41639
+ var _a, _b;
41640
+ if (!attrs || !Object.keys(attrs).length) {
41641
+ return;
41642
+ }
41643
+ const graphic = g;
41644
+ (_a = graphic.setFinalAttributes) === null || _a === void 0 ? void 0 : _a.call(graphic, attrs);
41645
+ if (graphic._commitAnimationStaticAttributes) {
41646
+ graphic._commitAnimationStaticAttributes(attrs);
41647
+ }
41648
+ else {
41649
+ (_b = graphic.commitInternalBaseAttributes) === null || _b === void 0 ? void 0 : _b.call(graphic, attrs);
41650
+ }
41651
+ }
41637
41652
  _runApplyGraphic(graphics) {
41638
41653
  const hasAnimation = this.hasAnimation();
41639
41654
  graphics.forEach((g, index) => {
@@ -41671,7 +41686,13 @@
41671
41686
  g.context.reusing = false;
41672
41687
  }
41673
41688
  else if (!hasStateAnimation) {
41674
- hasAnimation ? g.setAttributesAndPreventAnimate(diffAttrs) : g.setAttributes(diffAttrs);
41689
+ if (hasAnimation) {
41690
+ g.setAttributesAndPreventAnimate(diffAttrs);
41691
+ this._commitPreventedAnimationStaticAttrs(g, diffAttrs);
41692
+ }
41693
+ else {
41694
+ g.setAttributes(diffAttrs);
41695
+ }
41675
41696
  }
41676
41697
  if (!((_b = this.renderContext) === null || _b === void 0 ? void 0 : _b.progressive) && this._product && g.parent !== this._product) {
41677
41698
  this._product.appendChild(g);
@@ -42147,7 +42168,13 @@
42147
42168
  const diffAttrs = getDiffAttributesOfGraphic(this._product, newAttrs);
42148
42169
  this._product.context.diffAttrs = diffAttrs;
42149
42170
  if (!this.hasAnimationByState(this._product.context.animationState)) {
42150
- hasAnimation ? this._product.setAttributesAndPreventAnimate(diffAttrs) : this._product.setAttributes(diffAttrs);
42171
+ if (hasAnimation) {
42172
+ this._product.setAttributesAndPreventAnimate(diffAttrs);
42173
+ this._commitPreventedAnimationStaticAttrs(this._product, diffAttrs);
42174
+ }
42175
+ else {
42176
+ this._product.setAttributes(diffAttrs);
42177
+ }
42151
42178
  }
42152
42179
  }
42153
42180
  else {
@@ -49200,7 +49227,7 @@
49200
49227
  });
49201
49228
  };
49202
49229
 
49203
- const version = "2.1.1";
49230
+ const version = "2.1.2";
49204
49231
 
49205
49232
  const addVChartProperty = (data, op) => {
49206
49233
  const context = op.beforeCall();