@visactor/vchart 1.2.3-beta.0 → 1.2.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.
Files changed (71) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +53 -18
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/component/axis/cartesian/axis.js +1 -0
  6. package/cjs/component/axis/cartesian/axis.js.map +1 -1
  7. package/cjs/component/axis/mixin/linear-axis-mixin.js +1 -1
  8. package/cjs/component/axis/mixin/linear-axis-mixin.js.map +1 -1
  9. package/cjs/component/axis/polar/axis.js +3 -2
  10. package/cjs/component/axis/polar/axis.js.map +1 -1
  11. package/cjs/component/legend/continuous/legend.js +5 -2
  12. package/cjs/component/legend/continuous/legend.js.map +1 -1
  13. package/cjs/component/tooltip/handler/base.js +6 -3
  14. package/cjs/component/tooltip/handler/base.js.map +1 -1
  15. package/cjs/component/tooltip/handler/utils/common.js +2 -2
  16. package/cjs/component/tooltip/handler/utils/common.js.map +1 -1
  17. package/cjs/core/index.d.ts +1 -1
  18. package/cjs/core/index.js +1 -1
  19. package/cjs/core/index.js.map +1 -1
  20. package/cjs/data/transforms/legend-data/continuous/continuous.js +1 -2
  21. package/cjs/data/transforms/legend-data/continuous/continuous.js.map +1 -1
  22. package/cjs/mark/arc-3d.js +1 -1
  23. package/cjs/mark/arc.js +1 -1
  24. package/cjs/mark/area.js +1 -1
  25. package/cjs/mark/box-plot.js +1 -1
  26. package/cjs/mark/cell.js +1 -1
  27. package/cjs/model/base-model.js +3 -2
  28. package/cjs/model/base-model.js.map +1 -1
  29. package/cjs/model/interface.js +1 -1
  30. package/cjs/model/layout-item.js +1 -1
  31. package/cjs/model/model-state-manager.js +1 -1
  32. package/cjs/model/tooltip-helper.js +1 -1
  33. package/cjs/series/line/line.js +2 -1
  34. package/cjs/series/line/line.js.map +1 -1
  35. package/cjs/util/spec.d.ts +1 -0
  36. package/cjs/util/spec.js +13 -5
  37. package/cjs/util/spec.js.map +1 -1
  38. package/esm/component/axis/cartesian/axis.js +1 -0
  39. package/esm/component/axis/cartesian/axis.js.map +1 -1
  40. package/esm/component/axis/mixin/linear-axis-mixin.js +1 -1
  41. package/esm/component/axis/mixin/linear-axis-mixin.js.map +1 -1
  42. package/esm/component/axis/polar/axis.js +3 -2
  43. package/esm/component/axis/polar/axis.js.map +1 -1
  44. package/esm/component/legend/continuous/legend.js +5 -2
  45. package/esm/component/legend/continuous/legend.js.map +1 -1
  46. package/esm/component/tooltip/handler/base.js +6 -3
  47. package/esm/component/tooltip/handler/base.js.map +1 -1
  48. package/esm/component/tooltip/handler/utils/common.js +2 -2
  49. package/esm/component/tooltip/handler/utils/common.js.map +1 -1
  50. package/esm/core/index.d.ts +1 -1
  51. package/esm/core/index.js +1 -1
  52. package/esm/core/index.js.map +1 -1
  53. package/esm/data/transforms/legend-data/continuous/continuous.js +1 -1
  54. package/esm/data/transforms/legend-data/continuous/continuous.js.map +1 -1
  55. package/esm/mark/arc-3d.js +1 -1
  56. package/esm/mark/arc.js +1 -1
  57. package/esm/mark/area.js +1 -1
  58. package/esm/mark/box-plot.js +1 -1
  59. package/esm/mark/cell.js +1 -1
  60. package/esm/model/base-model.js +3 -3
  61. package/esm/model/base-model.js.map +1 -1
  62. package/esm/model/interface.js +1 -1
  63. package/esm/model/layout-item.js +1 -1
  64. package/esm/model/model-state-manager.js +1 -1
  65. package/esm/model/tooltip-helper.js +1 -1
  66. package/esm/series/line/line.js +2 -1
  67. package/esm/series/line/line.js.map +1 -1
  68. package/esm/util/spec.d.ts +1 -0
  69. package/esm/util/spec.js +11 -3
  70. package/esm/util/spec.js.map +1 -1
  71. package/package.json +5 -5
package/build/index.js CHANGED
@@ -9700,7 +9700,7 @@
9700
9700
  if (!isValid(value) || typeof value !== 'object') {
9701
9701
  return value;
9702
9702
  }
9703
- if (isDataView(value)) {
9703
+ if (isDataView(value) || isHTMLElement(value)) {
9704
9704
  return value;
9705
9705
  }
9706
9706
  const isArr = isArray$3(value);
@@ -9732,9 +9732,24 @@
9732
9732
  return result;
9733
9733
  }
9734
9734
  function isDataView(obj) {
9735
- const dataViewKeys = ['dataSet', 'latestData', 'rawData', 'parserData', 'isDataView', 'history'];
9736
- const keys = Object.keys(obj);
9737
- return obj instanceof DataView || dataViewKeys.every(key => keys.includes(key));
9735
+ return obj instanceof DataView;
9736
+ }
9737
+ function isHTMLElement(obj) {
9738
+ try {
9739
+ return obj instanceof Element;
9740
+ }
9741
+ catch {
9742
+ const htmlElementKeys = [
9743
+ 'children',
9744
+ 'innerHTML',
9745
+ 'classList',
9746
+ 'setAttribute',
9747
+ 'tagName',
9748
+ 'getBoundingClientRect'
9749
+ ];
9750
+ const keys = Object.keys(obj);
9751
+ return htmlElementKeys.every(key => keys.includes(key));
9752
+ }
9738
9753
  }
9739
9754
  function convertBackgroundSpec(bg) {
9740
9755
  if (!bg) {
@@ -36667,7 +36682,7 @@
36667
36682
  graphicItem && (graphicItem[BridgeElementKey] = null, graphicItem.release(), graphicItem.parent && graphicItem.parent.removeChild(graphicItem));
36668
36683
  };
36669
36684
 
36670
- class Element {
36685
+ let Element$1 = class Element {
36671
36686
  constructor(mark) {
36672
36687
  this.data = null, this.states = [], this.diffState = DiffState.enter, this.isReserved = !1, this.runtimeStatesEncoder = null, this.items = [], this.getStateAttrs = (stateName, nextStates) => {
36673
36688
  var _a, _b, _c, _d;
@@ -36939,7 +36954,7 @@
36939
36954
  var _a, _b;
36940
36955
  return this.mark.isCollectionMark() ? null !== (_a = this.data) && void 0 !== _a ? _a : [] : null === (_b = this.data) || void 0 === _b ? void 0 : _b[0];
36941
36956
  }
36942
- }
36957
+ };
36943
36958
 
36944
36959
  const clipIn = (element, options, animationParameters) => {
36945
36960
  var _a;
@@ -39429,7 +39444,7 @@
39429
39444
  return null;
39430
39445
  };
39431
39446
 
39432
- class GlyphElement extends Element {
39447
+ class GlyphElement extends Element$1 {
39433
39448
  constructor(mark) {
39434
39449
  super(mark), this.getStateAttrs = (stateName, nextStates) => {
39435
39450
  var _a, _b, _c, _d;
@@ -39635,7 +39650,7 @@
39635
39650
  }
39636
39651
  }
39637
39652
 
39638
- const createElement = mark => mark.markType === GrammarMarkType.glyph ? new GlyphElement(mark) : new Element(mark);
39653
+ const createElement = mark => mark.markType === GrammarMarkType.glyph ? new GlyphElement(mark) : new Element$1(mark);
39639
39654
 
39640
39655
  function point(event) {
39641
39656
  ["touches", "changedTouches", "targetTouches"].forEach(touchKey => {
@@ -56524,6 +56539,9 @@
56524
56539
  return;
56525
56540
  }
56526
56541
  const value = obj[key];
56542
+ if (isObject$f(value) && (isDataView(value) || isHTMLElement(value))) {
56543
+ return;
56544
+ }
56527
56545
  if (isObject$f(value) && !isFunction(value)) {
56528
56546
  if (isColorKey(value)) {
56529
56547
  newObj[key] = getActualColor(value, this._option.getTheme?.()?.colorScheme, this.modelType === 'series' ? this.type : undefined);
@@ -58422,7 +58440,7 @@
58422
58440
  VChart.useMark([ComponentMark, GroupMark, ImageMark]);
58423
58441
  Factory.registerRegion('region', Region);
58424
58442
  Factory.registerLayout('base', Layout);
58425
- const version = "1.2.3-beta.0";
58443
+ const version = "1.2.3";
58426
58444
  Logger.getInstance(LoggerLevel.Error);
58427
58445
 
58428
58446
  var SeriesMarkNameEnum;
@@ -64671,7 +64689,7 @@
64671
64689
  }
64672
64690
  }
64673
64691
  getSeriesStyle(datum) {
64674
- const isLineAsSeriesMark = this._spec.seriesMark !== 'point';
64692
+ const isLineAsSeriesMark = this._spec?.seriesMark !== 'point';
64675
64693
  return (attribute) => {
64676
64694
  if (isLineAsSeriesMark) {
64677
64695
  attribute === 'fill' && (attribute = 'stroke');
@@ -81248,6 +81266,7 @@
81248
81266
  }
81249
81267
  return new C({
81250
81268
  ...spec,
81269
+ type: axisType,
81251
81270
  inverse
81252
81271
  }, options);
81253
81272
  }
@@ -81906,7 +81925,7 @@
81906
81925
  }
81907
81926
  niceDomain(domain) {
81908
81927
  const { min: userMin, max: userMax } = getLinearAxisSpecDomain(this._spec);
81909
- if (isValid(userMin) || isValid(userMax)) {
81928
+ if (isValid(userMin) || isValid(userMax) || this._spec.type !== 'linear') {
81910
81929
  return domain;
81911
81930
  }
81912
81931
  if (Math.abs(minInArray(domain) - maxInArray(domain)) <= 1e-12) {
@@ -82338,7 +82357,10 @@
82338
82357
  const componentName = `${PolarAxis.type}-${axisType}`;
82339
82358
  const C = Factory.getComponentInKey(componentName);
82340
82359
  if (C) {
82341
- return new C(spec, options);
82360
+ return new C({
82361
+ ...spec,
82362
+ type: axisType
82363
+ }, options);
82342
82364
  }
82343
82365
  options.onError(`Component ${componentName} not found`);
82344
82366
  return null;
@@ -83243,10 +83265,10 @@
83243
83265
  const statisticData = s.getRawDataStatistics().latestData;
83244
83266
  const seriesMin = statisticData?.[datumField]?.min;
83245
83267
  const seriesMax = statisticData?.[datumField]?.max;
83246
- if (isValidNumber(seriesMin) && seriesMin < min) {
83268
+ if (isValidNumber(seriesMin)) {
83247
83269
  min = seriesMin;
83248
83270
  }
83249
- if (isValidNumber(seriesMax) && seriesMax > max) {
83271
+ if (isValidNumber(seriesMax)) {
83250
83272
  max = seriesMax;
83251
83273
  }
83252
83274
  });
@@ -83453,13 +83475,20 @@
83453
83475
  if (isEmpty(visualMappingRange)) {
83454
83476
  visualMappingRange = this._legendType === 'color' ? SINGLE_SEQUENCE : SIZE;
83455
83477
  }
83478
+ let min = this._legendData.getLatestData()[0] ?? 0;
83479
+ let max = this._legendData.getLatestData()[1] ?? 1;
83480
+ const isSame = this._legendData.getLatestData()[0] === this._legendData.getLatestData()[1];
83481
+ if (isSame) {
83482
+ min = Math.min(0, this._legendData.getLatestData()[0]);
83483
+ max = this._legendData.getLatestData()[0] === 0 ? 1 : Math.max(0, this._legendData.getLatestData()[0]);
83484
+ }
83456
83485
  const attrs = {
83457
83486
  ...getContinuousLegendAttributes(this._spec),
83458
83487
  layout,
83459
83488
  align,
83460
83489
  zIndex: this.layoutZIndex,
83461
- min: this._legendData.getLatestData()[0] ?? 0,
83462
- max: this._legendData.getLatestData()[1] ?? 1,
83490
+ min,
83491
+ max,
83463
83492
  value: this._spec.defaultSelected,
83464
83493
  [this._legendType === 'color' ? 'colors' : 'sizeRange']: visualMappingRange
83465
83494
  };
@@ -86562,6 +86591,9 @@
86562
86591
  }
86563
86592
  }
86564
86593
  const getScale = (element, boundingClientRect) => {
86594
+ if (!element) {
86595
+ return 1;
86596
+ }
86565
86597
  if (!boundingClientRect) {
86566
86598
  boundingClientRect = element.getBoundingClientRect();
86567
86599
  }
@@ -87395,9 +87427,12 @@
87395
87427
  containerSize.width = window.innerWidth;
87396
87428
  containerSize.height = window.innerHeight;
87397
87429
  if (!isCanvas) {
87398
- tooltipParentElementRect = tooltipParentElement.getBoundingClientRect();
87430
+ tooltipParentElementRect = tooltipParentElement?.getBoundingClientRect() ?? {
87431
+ x: Infinity,
87432
+ y: Infinity
87433
+ };
87399
87434
  const chartElement = (this._compiler.getCanvas() ?? this._chartContainer);
87400
- const chartElementRect = chartElement.getBoundingClientRect();
87435
+ const chartElementRect = chartElement?.getBoundingClientRect();
87401
87436
  relativePosOffset = {
87402
87437
  x: chartElementRect.x - tooltipParentElementRect.x,
87403
87438
  y: chartElementRect.y - tooltipParentElementRect.y