@visactor/vchart-extension 1.13.3-alpha.6 → 1.13.3-alpha.8

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/index.js CHANGED
@@ -402,7 +402,15 @@
402
402
  const applyVisible = (spec, keyList) => {
403
403
  keyList.forEach(key => {
404
404
  var _a, _b, _c, _d, _e, _f;
405
- spec[key] = Object.assign(Object.assign({}, spec[key]), { style: Object.assign(Object.assign({}, (_a = spec[key]) === null || _a === void 0 ? void 0 : _a.style), { visible: (_f = (_d = (_c = (_b = spec[key]) === null || _b === void 0 ? void 0 : _b.style) === null || _c === void 0 ? void 0 : _c.visible) !== null && _d !== void 0 ? _d : (_e = spec[key]) === null || _e === void 0 ? void 0 : _e.visible) !== null && _f !== void 0 ? _f : true }) });
405
+ if (vutils.isArray(spec[key])) {
406
+ spec[key].forEach((s, i) => {
407
+ var _a, _b, _c;
408
+ spec[key][i] = Object.assign(Object.assign({}, s), { style: Object.assign(Object.assign({}, s === null || s === void 0 ? void 0 : s.style), { visible: (_c = (_b = (_a = s === null || s === void 0 ? void 0 : s.style) === null || _a === void 0 ? void 0 : _a.visible) !== null && _b !== void 0 ? _b : s === null || s === void 0 ? void 0 : s.visible) !== null && _c !== void 0 ? _c : true }) });
409
+ });
410
+ }
411
+ else {
412
+ spec[key] = Object.assign(Object.assign({}, spec[key]), { style: Object.assign(Object.assign({}, (_a = spec[key]) === null || _a === void 0 ? void 0 : _a.style), { visible: (_f = (_d = (_c = (_b = spec[key]) === null || _b === void 0 ? void 0 : _b.style) === null || _c === void 0 ? void 0 : _c.visible) !== null && _d !== void 0 ? _d : (_e = spec[key]) === null || _e === void 0 ? void 0 : _e.visible) !== null && _f !== void 0 ? _f : true }) });
413
+ }
406
414
  });
407
415
  };
408
416
  const mergeObjects = (objA, objB) => {
@@ -560,7 +568,7 @@
560
568
  applyVisible(spec, [
561
569
  'barBackground',
562
570
  'rankingIcon',
563
- 'decorateHaloIcon',
571
+ 'decorateHaloIcons',
564
572
  'orderLabel',
565
573
  'nameLabel',
566
574
  'valueLabel'
@@ -644,6 +652,7 @@
644
652
  ];
645
653
  }
646
654
  generateBarBackground(spec) {
655
+ var _a;
647
656
  const totalDuration = spec.animation.duration;
648
657
  return {
649
658
  type: spec.barBackground.type,
@@ -651,6 +660,7 @@
651
660
  visible: true,
652
661
  dataKey: DATA_KEY,
653
662
  zIndex: -99,
663
+ state: (_a = spec.barBackground) === null || _a === void 0 ? void 0 : _a.state,
654
664
  style: Object.assign(Object.assign({ x: (datum, ctx) => spec.barBackground.type === 'symbol' ? ctx.getRegion().getLayoutRect().width / 2 : 0, y: (datum, ctx) => {
655
665
  return (ctx.valueToY([datum[spec.yField]]) +
656
666
  ctx.yBandwidth() / 2 -
@@ -668,14 +678,19 @@
668
678
  };
669
679
  }
670
680
  generateDecorateHaloIcons(spec) {
681
+ var _a;
671
682
  const totalDuration = spec.animation.duration;
672
- return spec.decorateHaloIcons.map((decorateHaloIcon) => {
683
+ return (_a = spec.decorateHaloIcons) === null || _a === void 0 ? void 0 : _a.map((decorateHaloIcon) => {
673
684
  return {
674
685
  type: 'symbol',
675
686
  dataId: 'data',
676
687
  visible: true,
677
688
  dataKey: DATA_KEY,
689
+ state: decorateHaloIcon === null || decorateHaloIcon === void 0 ? void 0 : decorateHaloIcon.state,
678
690
  style: Object.assign(Object.assign({ x: (datum, ctx) => {
691
+ if (datum[spec.xField] === undefined || datum[spec.xField] === null) {
692
+ return undefined;
693
+ }
679
694
  return ctx.valueToX([datum[spec.xField]]);
680
695
  }, y: (datum, ctx) => {
681
696
  return ctx.valueToY([datum[spec.yField]]) + ctx.yBandwidth() / 2;
@@ -699,6 +714,7 @@
699
714
  dataId: 'data',
700
715
  visible: true,
701
716
  dataKey: DATA_KEY,
717
+ state: spec.rankingIcon.state,
702
718
  style: Object.assign(Object.assign({ x: (datum) => {
703
719
  if (spec.labelLayout === 'bothEnd') {
704
720
  return -(NAME_LABEL_PADDING_RIGHT +
@@ -733,11 +749,13 @@
733
749
  };
734
750
  }
735
751
  generateNameLabel(spec) {
752
+ var _a;
736
753
  const totalDuration = spec.animation.duration;
737
754
  return {
738
755
  type: 'text',
739
756
  dataId: 'data',
740
757
  dataKey: DATA_KEY,
758
+ state: (_a = spec.nameLabel) === null || _a === void 0 ? void 0 : _a.state,
741
759
  style: Object.assign(Object.assign({ text: (datum) => this.formatDatum(spec.yField, datum), x: () => {
742
760
  var _a;
743
761
  if (spec.labelLayout === 'bothEnd') {
@@ -765,11 +783,13 @@
765
783
  };
766
784
  }
767
785
  generateOrderLabel(spec) {
786
+ var _a;
768
787
  const totalDuration = spec.animation.duration;
769
788
  return {
770
789
  type: 'text',
771
790
  dataId: 'data',
772
791
  dataKey: DATA_KEY,
792
+ state: (_a = spec.orderLabel) === null || _a === void 0 ? void 0 : _a.state,
773
793
  style: Object.assign(Object.assign({ text: (datum) => this.formatDatum(ORDER_KEY, datum), x: (datum) => {
774
794
  var _a;
775
795
  if (spec.labelLayout === 'bothEnd') {
@@ -804,6 +824,11 @@
804
824
  dataId: 'data',
805
825
  visible: true,
806
826
  dataKey: DATA_KEY,
827
+ state: {
828
+ blur: {
829
+ opacity: 0.2
830
+ }
831
+ },
807
832
  style: Object.assign(Object.assign({ text: (datum) => this.formatDatum(spec.xField, datum), x: (datum, ctx) => {
808
833
  if (spec.labelLayout === 'bothEnd') {
809
834
  return (ctx.getRegion().getLayoutRect().width +
@@ -818,7 +843,7 @@
818
843
  return ctx.valueToY([datum[spec.yField]]) + ctx.yBandwidth() / 2;
819
844
  }
820
845
  return ctx.valueToY([datum[spec.yField]]) + ctx.yBandwidth() / 2 - spec.bar.height / 2 - LABEL_PADDING_BOTTOM;
821
- } }, spec.valueLabel.style), { textAlign: 'right', textBaseline: spec.labelLayout === 'bothEnd' ? 'middle' : 'bottom', visible: (datum) => {
846
+ } }, spec.valueLabel.style), { textAlign: spec.labelLayout === 'bothEnd' ? 'left' : 'right', textBaseline: spec.labelLayout === 'bothEnd' ? 'middle' : 'bottom', visible: (datum) => {
822
847
  if (datum[SUPPLY_DATA_KEY]) {
823
848
  return false;
824
849
  }
@@ -832,6 +857,9 @@
832
857
  }
833
858
  transformPaddingSpec(spec) {
834
859
  var _a;
860
+ const maxHaloIconSize = spec.decorateHaloIcons.length > 0
861
+ ? Math.max(...spec.decorateHaloIcons.map((icon) => { var _a, _b; return (_b = (_a = icon.style) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 18; }))
862
+ : 0;
835
863
  spec.padding = Object.assign({ left: spec.labelLayout === 'bothEnd'
836
864
  ? NAME_LABEL_PADDING_RIGHT +
837
865
  this.getMaxDataLabelLens(spec, spec.yField, this.nameLabelTextMeasure) +
@@ -840,7 +868,7 @@
840
868
  : 0) +
841
869
  (spec.rankingIcon.style.visible ? NAME_SYMBOL_PADDING_RIGHT + ((_a = spec.rankingIcon.style.size) !== null && _a !== void 0 ? _a : 10) : 0) +
842
870
  CHART_PADDING_LEFT
843
- : CHART_PADDING_LEFT, right: spec.labelLayout === 'bothEnd'
871
+ : CHART_PADDING_LEFT + maxHaloIconSize / 2, right: spec.labelLayout === 'bothEnd'
844
872
  ? VALUE_LABEL_PADDING_LEFT +
845
873
  this.getMaxDataLabelLens(spec, spec.yField, this.valueLabelTextMeasure) +
846
874
  CHART_PADDING_RIGHT