@visactor/vchart-extension 1.13.5-alpha.10 → 1.13.5-alpha.12

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
@@ -391,11 +391,20 @@
391
391
  },
392
392
  pageSize: 5,
393
393
  scrollSize: 1,
394
- animation: {
395
- type: 'both',
396
- interval: 4000,
397
- duration: 2000,
394
+ animationAppear: {
395
+ enable: true,
396
+ type: 'grow',
397
+ duration: 1000,
398
398
  easing: 'linear'
399
+ },
400
+ animationUpdate: {
401
+ enable: true,
402
+ type: 'grow',
403
+ duration: 1000,
404
+ easing: 'linear'
405
+ },
406
+ animationNormal: {
407
+ interval: 1000
399
408
  }
400
409
  };
401
410
 
@@ -465,7 +474,8 @@
465
474
  super(...arguments);
466
475
  this.formatMap = {};
467
476
  this.paginateDataArr = (spec) => {
468
- const { data: arr, scrollSize = 1, pageSize = 5 } = spec;
477
+ const { scrollSize = 1, pageSize = 5 } = spec;
478
+ const arr = this.originalData;
469
479
  const result = {};
470
480
  let pageOrder = 0;
471
481
  for (let i = 0; i < arr.length; i += scrollSize) {
@@ -492,6 +502,7 @@
492
502
  spec.data.forEach((datum, index) => (datum[ORDER_KEY] = index + 1 < 10 ? `0${index + 1}` : index + 1));
493
503
  const pagerData = this.paginateDataArr(spec).result;
494
504
  const orderCount = this.paginateDataArr(spec).orderCount;
505
+ this.orderCount = orderCount;
495
506
  const supplyCount = spec.pageSize - pagerData[`page${orderCount}`].length;
496
507
  pagerData[`page${orderCount}`].push(...Array.from({ length: supplyCount }, _ => {
497
508
  return {
@@ -505,8 +516,8 @@
505
516
  data: [
506
517
  {
507
518
  id: 'datas',
508
- values: pagerData[order].map((d, i) => {
509
- return Object.assign(Object.assign({}, d), { [DATA_KEY]: order + '_' + i + '_' + new Date().getTime() });
519
+ values: pagerData[order].map(d => {
520
+ return Object.assign(Object.assign({}, d), { [DATA_KEY]: d[spec.yField] });
510
521
  })
511
522
  },
512
523
  {
@@ -520,48 +531,11 @@
520
531
  ]
521
532
  });
522
533
  });
523
- if (result.length === 1) {
524
- result.push({
525
- data: [
526
- {
527
- id: 'datas',
528
- values: pagerData['page1'].map((d, i) => {
529
- return Object.assign(Object.assign({}, d), { [DATA_KEY]: 'page2' + '_' + i + '_' + new Date().getTime() });
530
- })
531
- },
532
- {
533
- id: 'order',
534
- values: [
535
- {
536
- order: 'page2'
537
- }
538
- ]
539
- }
540
- ]
541
- });
542
- }
543
534
  return result;
544
535
  };
545
536
  }
546
- isSpecValid(spec) {
547
- var _a, _b, _c, _d;
548
- const { xField, yField, data } = spec;
549
- if (!xField || !yField) {
550
- (_b = (_a = this._option).onError) === null || _b === void 0 ? void 0 : _b.call(_a, 'Missing Required Config: `xField`, `yField` ');
551
- return false;
552
- }
553
- if (!data || data.length === 0) {
554
- (_d = (_c = this._option).onError) === null || _d === void 0 ? void 0 : _d.call(_c, 'Data is required');
555
- return false;
556
- }
557
- return true;
558
- }
559
537
  transformSpec(spec) {
560
- var _a;
561
538
  super.transformSpec(spec);
562
- if (!this.isSpecValid(spec)) {
563
- return;
564
- }
565
539
  this.normalizeSpec(spec);
566
540
  this.upgradeTextMeasure(spec);
567
541
  this.upgradeFormatMap(spec);
@@ -578,7 +552,6 @@
578
552
  this.generateValueLabel(spec)
579
553
  ];
580
554
  this.transformPaddingSpec(spec);
581
- (_a = spec.customTransformSpec) === null || _a === void 0 ? void 0 : _a.call(spec, spec);
582
555
  super.transformSpec(spec);
583
556
  }
584
557
  normalizeSpec(spec) {
@@ -615,8 +588,9 @@
615
588
  processData(spec) {
616
589
  var _a;
617
590
  if (!((_a = spec.data[0]) === null || _a === void 0 ? void 0 : _a.values)) {
618
- this.dataSpecs = this.processRankingData(spec);
619
591
  this.originalData = spec.data;
592
+ this.originalSpec = vutils.cloneDeep(spec);
593
+ this.dataSpecs = this.processRankingData(spec);
620
594
  spec.data = this.dataSpecs[0].data;
621
595
  }
622
596
  }
@@ -633,7 +607,7 @@
633
607
  barWidth: (_b = (_a = spec.bar) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 10,
634
608
  bar: Object.assign(Object.assign({}, spec.bar), { style: Object.assign(Object.assign({}, (_c = spec.bar) === null || _c === void 0 ? void 0 : _c.style), { x1: 0, visible: (datum) => {
635
609
  var _a, _b;
636
- if (datum[SUPPLY_DATA_KEY]) {
610
+ if (datum[SUPPLY_DATA_KEY] || datum[spec.xField] === null) {
637
611
  return false;
638
612
  }
639
613
  return (_b = (_a = spec.bar) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : true;
@@ -642,13 +616,15 @@
642
616
  ];
643
617
  }
644
618
  transformAnimationSpec(spec) {
645
- const totalDuration = spec.animation.duration;
646
- if (spec.animation) {
647
- spec.player = Object.assign(Object.assign({}, spec.player), { specs: this.dataSpecs, auto: true, visible: false, interval: spec.animation.interval + spec.animation.duration / 2, loop: true });
648
- spec.animationExit = this.getAnimationExit(spec, totalDuration);
649
- spec.animationAppear = this.getAnimationEnter(spec, 'rect', totalDuration);
650
- spec.animationEnter = this.getAnimationEnter(spec, 'rect', totalDuration);
619
+ var _a, _b, _c;
620
+ if (spec.animationUpdate.enable && this.orderCount > 1) {
621
+ spec.player = Object.assign({ specs: this.dataSpecs, auto: true, visible: false, interval: ((_b = (_a = spec.animationNormal) === null || _a === void 0 ? void 0 : _a.interval) !== null && _b !== void 0 ? _b : 1000) + ((_c = spec.animationUpdate.duration) !== null && _c !== void 0 ? _c : 1000) / 2, loop: true }, spec.player);
622
+ spec.animationExit = this.getAnimationExit(this.originalSpec);
623
+ spec.animationEnter = this.getAnimationEnter(this.originalSpec);
624
+ spec.animationUpdate = this.getAnimationUpdate(this.originalSpec);
651
625
  }
626
+ spec.animationNormal = this.originalSpec.animationNormal;
627
+ spec.animationAppear = this.getAnimationAppear(this.originalSpec, 'rect');
652
628
  }
653
629
  transformAxesSpec(spec) {
654
630
  const { min, max } = computeDataRange(this.originalData, spec.xField);
@@ -657,7 +633,8 @@
657
633
  orient: 'left',
658
634
  type: 'band',
659
635
  visible: false,
660
- inverse: true
636
+ inverse: true,
637
+ paddingOuter: 0.5
661
638
  },
662
639
  {
663
640
  orient: 'bottom',
@@ -671,7 +648,6 @@
671
648
  }
672
649
  generateBarBackground(spec) {
673
650
  var _a;
674
- const totalDuration = spec.animation.duration;
675
651
  return {
676
652
  type: spec.barBackground.type,
677
653
  dataId: 'data',
@@ -689,15 +665,15 @@
689
665
  }
690
666
  return spec.barBackground.style.visible;
691
667
  } }),
692
- animation: Boolean(spec.animation),
693
- animationEnter: this.getAnimationEnter(spec, 'barBack', totalDuration),
694
- animationExit: this.getAnimationExit(spec, totalDuration),
695
- animationAppear: this.getAnimationEnter(spec, 'barBack', totalDuration)
668
+ animation: true,
669
+ animationEnter: this.getAnimationEnter(this.originalSpec),
670
+ animationExit: this.getAnimationExit(this.originalSpec),
671
+ animationAppear: this.getAnimationAppear(this.originalSpec, 'barBack'),
672
+ animationUpdate: this.getAnimationUpdate(this.originalSpec)
696
673
  };
697
674
  }
698
675
  generateDecorateHaloIcons(spec) {
699
676
  var _a;
700
- const totalDuration = spec.animation.duration;
701
677
  return (_a = spec.decorateHaloIcons) === null || _a === void 0 ? void 0 : _a.map((decorateHaloIcon) => {
702
678
  return {
703
679
  type: 'symbol',
@@ -718,15 +694,15 @@
718
694
  }
719
695
  return decorateHaloIcon.style.visible;
720
696
  } }),
721
- animation: Boolean(spec.animation),
722
- animationEnter: this.getAnimationEnter(spec, 'symbol', totalDuration),
723
- animationExit: this.getAnimationExit(spec, totalDuration),
724
- animationAppear: this.getAnimationEnter(spec, 'symbol', totalDuration)
697
+ animation: true,
698
+ animationEnter: this.getAnimationEnter(this.originalSpec),
699
+ animationExit: this.getAnimationExit(this.originalSpec),
700
+ animationAppear: this.getAnimationAppear(this.originalSpec, 'symbol'),
701
+ animationUpdate: this.getAnimationUpdate(this.originalSpec)
725
702
  };
726
703
  });
727
704
  }
728
705
  generateRankingIcon(spec) {
729
- const totalDuration = spec.animation.duration;
730
706
  return {
731
707
  type: 'symbol',
732
708
  dataId: 'data',
@@ -760,15 +736,15 @@
760
736
  }
761
737
  return spec.rankingIcon.style.visible;
762
738
  } }),
763
- animation: Boolean(spec.animation),
764
- animationEnter: this.getAnimationEnter(spec, 'text', totalDuration),
765
- animationExit: this.getAnimationExit(spec, totalDuration),
766
- animationAppear: this.getAnimationEnter(spec, 'text', totalDuration)
739
+ animation: true,
740
+ animationEnter: this.getAnimationEnter(this.originalSpec),
741
+ animationExit: this.getAnimationExit(this.originalSpec),
742
+ animationAppear: this.getAnimationAppear(this.originalSpec, 'text'),
743
+ animationUpdate: this.getAnimationUpdate(this.originalSpec)
767
744
  };
768
745
  }
769
746
  generateNameLabel(spec) {
770
747
  var _a;
771
- const totalDuration = spec.animation.duration;
772
748
  return {
773
749
  type: 'text',
774
750
  dataId: 'data',
@@ -794,15 +770,15 @@
794
770
  }
795
771
  return spec.nameLabel.style.visible;
796
772
  } }),
797
- animation: Boolean(spec.animation),
798
- animationEnter: this.getAnimationEnter(spec, 'text', totalDuration),
799
- animationExit: this.getAnimationExit(spec, totalDuration),
800
- animationAppear: this.getAnimationEnter(spec, 'text', totalDuration)
773
+ animation: true,
774
+ animationEnter: this.getAnimationEnter(this.originalSpec),
775
+ animationExit: this.getAnimationExit(this.originalSpec),
776
+ animationAppear: this.getAnimationAppear(this.originalSpec, 'text'),
777
+ animationUpdate: this.getAnimationUpdate(this.originalSpec)
801
778
  };
802
779
  }
803
780
  generateOrderLabel(spec) {
804
781
  var _a;
805
- const totalDuration = spec.animation.duration;
806
782
  return {
807
783
  type: 'text',
808
784
  dataId: 'data',
@@ -829,28 +805,24 @@
829
805
  }
830
806
  return spec.orderLabel.style.visible;
831
807
  } }),
832
- animation: Boolean(spec.animation),
833
- animationEnter: this.getAnimationEnter(spec, 'text', totalDuration),
834
- animationExit: this.getAnimationExit(spec, totalDuration),
835
- animationAppear: this.getAnimationEnter(spec, 'text', totalDuration)
808
+ animation: true,
809
+ animationEnter: this.getAnimationEnter(this.originalSpec),
810
+ animationExit: this.getAnimationExit(this.originalSpec),
811
+ animationAppear: this.getAnimationAppear(this.originalSpec, 'text'),
812
+ animationUpdate: this.getAnimationUpdate(this.originalSpec)
836
813
  };
837
814
  }
838
815
  generateValueLabel(spec) {
839
- const totalDuration = spec.animation.duration;
816
+ var _a;
840
817
  return {
841
818
  type: 'text',
842
819
  dataId: 'data',
843
820
  visible: true,
844
821
  dataKey: DATA_KEY,
845
- state: {
846
- blur: {
847
- opacity: 0.2
848
- }
849
- },
822
+ state: (_a = spec.valueLabel) === null || _a === void 0 ? void 0 : _a.state,
850
823
  style: Object.assign(Object.assign({ text: (datum) => this.formatDatum(spec.xField, datum), x: (datum, ctx) => {
851
824
  if (spec.labelLayout === 'bothEnd') {
852
825
  return (ctx.getRegion().getLayoutRect().width +
853
- this.getMaxDataLabelLens(spec, spec.xField, this.nameLabelTextMeasure) +
854
826
  VALUE_LABEL_PADDING_LEFT);
855
827
  }
856
828
  else {
@@ -867,10 +839,11 @@
867
839
  }
868
840
  return spec.valueLabel.style.visible;
869
841
  } }),
870
- animation: Boolean(spec.animation),
871
- animationEnter: this.getAnimationEnter(spec, 'text', totalDuration),
872
- animationExit: this.getAnimationExit(spec, totalDuration),
873
- animationAppear: this.getAnimationEnter(spec, 'text', totalDuration)
842
+ animation: true,
843
+ animationEnter: this.getAnimationEnter(this.originalSpec),
844
+ animationExit: this.getAnimationExit(this.originalSpec),
845
+ animationAppear: this.getAnimationAppear(this.originalSpec, 'text'),
846
+ animationUpdate: this.getAnimationUpdate(this.originalSpec)
874
847
  };
875
848
  }
876
849
  transformPaddingSpec(spec) {
@@ -888,7 +861,7 @@
888
861
  CHART_PADDING_LEFT
889
862
  : CHART_PADDING_LEFT + maxHaloIconSize / 2, right: spec.labelLayout === 'bothEnd'
890
863
  ? VALUE_LABEL_PADDING_LEFT +
891
- this.getMaxDataLabelLens(spec, spec.yField, this.valueLabelTextMeasure) +
864
+ this.getMaxDataLabelLens(spec, spec.xField, this.valueLabelTextMeasure) +
892
865
  CHART_PADDING_RIGHT
893
866
  : CHART_PADDING_RIGHT + 10, top: 0, bottom: 0 }, spec.padding);
894
867
  }
@@ -908,50 +881,62 @@
908
881
  getLabelWidth(padding, width) {
909
882
  return width + padding;
910
883
  }
911
- getAnimationExit(spec, duration) {
912
- if (spec.animation.type === 'grow') {
913
- return {};
884
+ getAnimationExit(spec) {
885
+ var _a, _b, _c, _d, _e;
886
+ if (((_a = spec.animationUpdate) === null || _a === void 0 ? void 0 : _a.enable) === false) {
887
+ return false;
914
888
  }
915
889
  return {
916
890
  type: 'moveOut',
917
891
  options: {
918
892
  direction: 'y',
919
893
  orient: 'negative',
920
- point: (datum, element, opt) => {
894
+ point: (datum, element) => {
921
895
  const channelAttr = element.getGraphicAttribute('y');
922
- const barSpace = (spec.height / spec.pageSize - spec.bar.height) / 2;
923
- return { y: channelAttr - opt.height + barSpace };
896
+ const barSpace = spec.height / (spec.pageSize + 1);
897
+ return { y: channelAttr - barSpace * Math.min(spec.scrollSize, spec.pageSize) };
924
898
  }
925
899
  },
926
- duration: spec.animation.type === 'both' ? duration / 2 : duration,
927
- easing: spec.animation.easing
900
+ duration: (_c = (_b = spec.animationUpdate) === null || _b === void 0 ? void 0 : _b.duration) !== null && _c !== void 0 ? _c : 1000,
901
+ easing: (_e = (_d = spec.animationUpdate) === null || _d === void 0 ? void 0 : _d.easing) !== null && _e !== void 0 ? _e : 'linear'
928
902
  };
929
903
  }
930
- getAnimationEnter(spec, markType, totalDuration) {
931
- const { animation } = spec;
932
- const { type: animationType, easing } = animation;
933
- const scrollDuration = animationType === 'both' ? totalDuration / 2 : totalDuration;
934
- const growDuration = animationType === 'grow' ? totalDuration : totalDuration / 2;
935
- const result = [];
936
- if (animationType === 'scroll' || animationType === 'both') {
937
- result.push({
938
- type: 'moveIn',
939
- options: {
940
- direction: 'y',
941
- orient: 'negative',
942
- excludeChannels: ['y'],
943
- point: (datum, element, opt) => {
944
- const channelAttr = element.getGraphicAttribute('y');
945
- const barSpace = (spec.height / spec.pageSize - spec.bar.height) / 2;
946
- return { y: channelAttr + opt.height - barSpace };
947
- }
948
- },
949
- duration: scrollDuration,
950
- easing
951
- });
904
+ getAnimationEnter(spec) {
905
+ var _a, _b, _c, _d, _e;
906
+ if (((_a = spec.animationUpdate) === null || _a === void 0 ? void 0 : _a.enable) === false) {
907
+ return false;
952
908
  }
953
- if ((animationType === 'grow' || animationType === 'both') && markType !== 'text' && markType !== 'barBack') {
954
- result.push({
909
+ return {
910
+ type: 'moveIn',
911
+ options: {
912
+ direction: 'y',
913
+ orient: 'negative',
914
+ excludeChannels: ['y'],
915
+ point: (datum, element) => {
916
+ const channelAttr = element.getGraphicAttribute('y');
917
+ return { y: channelAttr + (spec.height / (spec.pageSize + 1)) * Math.min(spec.scrollSize, spec.pageSize) };
918
+ }
919
+ },
920
+ duration: (_c = (_b = spec.animationUpdate) === null || _b === void 0 ? void 0 : _b.duration) !== null && _c !== void 0 ? _c : 1000,
921
+ easing: (_e = (_d = spec.animationUpdate) === null || _d === void 0 ? void 0 : _d.easing) !== null && _e !== void 0 ? _e : 'linear'
922
+ };
923
+ }
924
+ getAnimationAppear(spec, markType) {
925
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
926
+ if (((_a = spec.animationAppear) === null || _a === void 0 ? void 0 : _a.enable) === false) {
927
+ return false;
928
+ }
929
+ if (markType === 'rect') {
930
+ return {
931
+ type: 'growWidthIn',
932
+ oneByOne: false,
933
+ duration: (_c = (_b = spec.animationAppear) === null || _b === void 0 ? void 0 : _b.duration) !== null && _c !== void 0 ? _c : 1000,
934
+ easing: (_e = (_d = spec.animationAppear) === null || _d === void 0 ? void 0 : _d.easing) !== null && _e !== void 0 ? _e : 'linear',
935
+ options: {}
936
+ };
937
+ }
938
+ else if (markType === 'symbol') {
939
+ return {
955
940
  channel: {
956
941
  x: {
957
942
  from: 0,
@@ -960,12 +945,32 @@
960
945
  }
961
946
  }
962
947
  },
963
- duration: growDuration,
964
- delay: animationType === 'both' ? scrollDuration : 0,
965
- easing
966
- });
948
+ duration: (_g = (_f = spec.animationAppear) === null || _f === void 0 ? void 0 : _f.duration) !== null && _g !== void 0 ? _g : 1000,
949
+ easing: (_j = (_h = spec.animationAppear) === null || _h === void 0 ? void 0 : _h.easing) !== null && _j !== void 0 ? _j : 'linear'
950
+ };
967
951
  }
968
- return result;
952
+ else {
953
+ return {
954
+ channel: {
955
+ opacity: {
956
+ from: 0,
957
+ to: 1
958
+ }
959
+ },
960
+ duration: (_l = (_k = spec.animationAppear) === null || _k === void 0 ? void 0 : _k.duration) !== null && _l !== void 0 ? _l : 1000,
961
+ easing: (_o = (_m = spec.animationAppear) === null || _m === void 0 ? void 0 : _m.easing) !== null && _o !== void 0 ? _o : 'linear'
962
+ };
963
+ }
964
+ }
965
+ getAnimationUpdate(spec) {
966
+ var _a, _b, _c, _d;
967
+ if (spec.animationUpdate.enable === false) {
968
+ return false;
969
+ }
970
+ return {
971
+ duration: (_b = (_a = spec.animationUpdate) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 1000,
972
+ easing: (_d = (_c = spec.animationUpdate) === null || _c === void 0 ? void 0 : _c.easing) !== null && _d !== void 0 ? _d : 'linear'
973
+ };
969
974
  }
970
975
  }
971
976
 
@@ -988,7 +993,7 @@
988
993
  (_b = (_a = this._option).onError) === null || _b === void 0 ? void 0 : _b.call(_a, 'Missing Required Config: `xField`, `yField` ');
989
994
  return false;
990
995
  }
991
- if (!data || data.length === 0) {
996
+ if (!data) {
992
997
  (_d = (_c = this._option).onError) === null || _d === void 0 ? void 0 : _d.call(_c, 'Data is required');
993
998
  return false;
994
999
  }
@@ -2904,7 +2909,7 @@
2904
2909
  default:
2905
2910
  if (this._t <= 0) this.context.lineTo(this._x, y, !1 !== this._lastDefined && !1 !== p.defined, this.lastPoint), this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined, p);else {
2906
2911
  const x1 = this._x * (1 - this._t) + x * this._t;
2907
- this.context.lineTo(x1, this._y, !1 !== this._lastDefined && !1 !== p.defined, this.lastPoint), this.context.lineTo(x1, y, !1 !== this._lastDefined && !1 !== p.defined, p);
2912
+ .5 === this._t ? this.context.lineTo(x1, this._y, !1 !== this._lastDefined, this.lastPoint) : this.context.lineTo(x1, this._y, !1 !== this._lastDefined && !1 !== p.defined, this.lastPoint), this.context.lineTo(x1, y, !1 !== this._lastDefined && !1 !== p.defined, p);
2908
2913
  }
2909
2914
  }
2910
2915
  this._lastDefined = p.defined, this._x = x, this._y = y, this.lastPoint = p;
@@ -4494,7 +4499,7 @@
4494
4499
  let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Generator.GenAutoIncrementId();
4495
4500
  let timeline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultTimeline;
4496
4501
  let slience = arguments.length > 2 ? arguments[2] : undefined;
4497
- this.id = id, this.timeline = timeline, this.status = AnimateStatus.INITIAL, this.tailAnimate = new SubAnimate(this), this.subAnimates = [this.tailAnimate], this.timeScale = 1, this.rawPosition = -1, this._startTime = 0, this._duringTime = 0, this.timeline.addAnimate(this), this.slience = slience;
4502
+ this.id = id, this.timeline = timeline || defaultTimeline, this.status = AnimateStatus.INITIAL, this.tailAnimate = new SubAnimate(this), this.subAnimates = [this.tailAnimate], this.timeScale = 1, this.rawPosition = -1, this._startTime = 0, this._duringTime = 0, this.timeline.addAnimate(this), this.slience = slience;
4498
4503
  }
4499
4504
  setTimeline(timeline) {
4500
4505
  timeline !== this.timeline && (this.timeline.removeAnimate(this, !1), timeline.addAnimate(this));
@@ -5028,7 +5033,7 @@
5028
5033
  }
5029
5034
  static GetFile(url, type) {
5030
5035
  let data = ResourceLoader.cache.get(url);
5031
- return data ? "init" === data.loadState || "fail" === data.loadState ? Promise.reject() : "loading" === data.loadState ? data.dataPromise.then(data => data.data) : Promise.resolve(data.data) : (data = {
5036
+ return data ? "fail" === data.loadState ? Promise.reject() : "init" === data.loadState || "loading" === data.loadState ? data.dataPromise.then(data => data.data) : Promise.resolve(data.data) : (data = {
5032
5037
  type: type,
5033
5038
  loadState: "init"
5034
5039
  }, ResourceLoader.cache.set(url, data), "arrayBuffer" === type ? data.dataPromise = application.global.loadArrayBuffer(url) : "blob" === type ? data.dataPromise = application.global.loadBlob(url) : "json" === type && (data.dataPromise = application.global.loadJson(url)), data.dataPromise.then(data => data.data));
@@ -7120,7 +7125,7 @@
7120
7125
  this._draw(line, lineAttribute, !1, drawContext, params);
7121
7126
  }
7122
7127
  drawSegmentItem(context, cache, fill, stroke, fillOpacity, strokeOpacity, attribute, defaultAttribute, clipRange, clipRangeByDimension, offsetX, offsetY, line, fillCb, strokeCb) {
7123
- var _a, _b, _c, _d, _e;
7128
+ var _a;
7124
7129
  if (!cache) return;
7125
7130
  context.beginPath();
7126
7131
  const z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
@@ -7133,27 +7138,7 @@
7133
7138
  x: originX = 0,
7134
7139
  x: originY = 0
7135
7140
  } = attribute;
7136
- !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.fill())), !1 !== stroke && (strokeCb ? strokeCb(context, attribute, defaultAttribute) : strokeOpacity && (context.setStrokeStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.stroke()));
7137
- let {
7138
- connectedType: connectedType,
7139
- connectedX: connectedX,
7140
- connectedY: connectedY,
7141
- connectedStyle: connectedStyle
7142
- } = attribute;
7143
- if (vutils.isArray(defaultAttribute) ? (connectedType = null !== (_b = null != connectedType ? connectedType : defaultAttribute[0].connectedType) && void 0 !== _b ? _b : defaultAttribute[1].connectedType, connectedX = null !== (_c = null != connectedX ? connectedX : defaultAttribute[0].connectedX) && void 0 !== _c ? _c : defaultAttribute[1].connectedX, connectedY = null !== (_d = null != connectedY ? connectedY : defaultAttribute[0].connectedY) && void 0 !== _d ? _d : defaultAttribute[1].connectedY, connectedStyle = null !== (_e = null != connectedStyle ? connectedStyle : defaultAttribute[0].connectedStyle) && void 0 !== _e ? _e : defaultAttribute[1].connectedStyle) : (connectedType = null != connectedType ? connectedType : defaultAttribute.connectedType, connectedX = null != connectedX ? connectedX : defaultAttribute.connectedX, connectedY = null != connectedY ? connectedY : defaultAttribute.connectedY, connectedStyle = null != connectedStyle ? connectedStyle : defaultAttribute.connectedStyle), "connect" !== connectedType && "zero" !== connectedType && (connectedType = "none"), "none" !== connectedType) {
7144
- context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, cache, clipRange, clipRangeByDimension, {
7145
- offsetX: offsetX,
7146
- offsetY: offsetY,
7147
- offsetZ: z,
7148
- drawConnect: !0,
7149
- mode: connectedType,
7150
- zeroX: connectedX,
7151
- zeroY: connectedY
7152
- });
7153
- const da = [];
7154
- vutils.isArray(defaultAttribute) ? defaultAttribute.forEach(i => da.push(i)) : da.push(defaultAttribute), da.push(attribute), !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(line, connectedStyle, originX - offsetX, originY - offsetY, da), context.fill())), !1 !== stroke && (strokeCb ? strokeCb(context, attribute, defaultAttribute) : strokeOpacity && (context.setStrokeStyle(line, connectedStyle, originX - offsetX, originY - offsetY, da), context.stroke()));
7155
- }
7156
- return !1;
7141
+ return !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.fill())), !1 !== stroke && (strokeCb ? strokeCb(context, attribute, defaultAttribute) : strokeOpacity && (context.setStrokeStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.stroke())), !1;
7157
7142
  }
7158
7143
  drawLinearLineHighPerformance(line, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, lineAttribute, drawContext, params, fillCb, strokeCb) {
7159
7144
  var _a;
@@ -7185,7 +7170,8 @@
7185
7170
  segments: segments,
7186
7171
  points: points,
7187
7172
  closePath: closePath,
7188
- curveTension = lineAttribute.curveTension
7173
+ curveTension = lineAttribute.curveTension,
7174
+ connectedType = lineAttribute.connectedType
7189
7175
  } = line.attribute;
7190
7176
  if (!this.valid(line, lineAttribute, fillCb, strokeCb)) return;
7191
7177
  let {
@@ -7197,6 +7183,9 @@
7197
7183
  clipRangeByDimension = lineAttribute.clipRangeByDimension
7198
7184
  } = line.attribute;
7199
7185
  if (1 === clipRange && !segments && !points.some(p => !1 === p.defined) && "linear" === curveType) return this.drawLinearLineHighPerformance(line, context, !!fill, !!stroke, fillOpacity, strokeOpacity, x, y, lineAttribute, drawContext, params, fillCb, strokeCb);
7186
+ function parsePoint(points, connectedType) {
7187
+ return "none" === connectedType ? points : points.filter(p => !1 !== p.defined);
7188
+ }
7200
7189
  if (line.shouldUpdateShape()) {
7201
7190
  const {
7202
7191
  points: points,
@@ -7218,7 +7207,7 @@
7218
7207
  y: lastSeg.endY,
7219
7208
  defined: lastSeg.curves[lastSeg.curves.length - 1].defined
7220
7209
  } : index > 1 && (startPoint.x = lastSeg.endX, startPoint.y = lastSeg.endY, startPoint.defined = lastSeg.curves[lastSeg.curves.length - 1].defined);
7221
- const data = calcLineCache(seg.points, curveType, {
7210
+ const data = calcLineCache(parsePoint(seg.points, connectedType), curveType, {
7222
7211
  startPoint: startPoint,
7223
7212
  curveTension: curveTension
7224
7213
  });
@@ -7237,7 +7226,7 @@
7237
7226
  }
7238
7227
  } else {
7239
7228
  if (!points || !points.length) return line.cache = null, void line.clearUpdateShapeTag();
7240
- line.cache = calcLineCache(_points, curveType, {
7229
+ line.cache = calcLineCache(parsePoint(_points, connectedType), curveType, {
7241
7230
  curveTension: curveTension
7242
7231
  });
7243
7232
  }
@@ -8657,7 +8646,7 @@
8657
8646
  } = attribute,
8658
8647
  b = aabbBounds;
8659
8648
  return points.forEach(p => {
8660
- !1 === p.defined && "zero" !== connectedType && "connect" !== connectedType || b.add(p.x, p.y);
8649
+ !1 === p.defined && "connect" !== connectedType || b.add(p.x, p.y);
8661
8650
  }), b;
8662
8651
  }
8663
8652
  updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds, graphic) {
@@ -8668,7 +8657,7 @@
8668
8657
  b = aabbBounds;
8669
8658
  return segments.forEach(s => {
8670
8659
  s.points.forEach(p => {
8671
- !1 === p.defined && "zero" !== connectedType && "connect" !== connectedType || b.add(p.x, p.y);
8660
+ !1 === p.defined && "connect" !== connectedType || b.add(p.x, p.y);
8672
8661
  });
8673
8662
  }), b;
8674
8663
  }
@@ -9048,10 +9037,17 @@
9048
9037
  this.render(), this.bindEvents();
9049
9038
  });
9050
9039
  }
9051
- setAttribute(key, value, forceUpdateTag) {
9040
+ setAttribute(key, value, forceUpdateTag, context) {
9041
+ const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
9042
+ [key]: value
9043
+ }, this.attribute, key, context);
9044
+ if (params) return this._setAttributes(params, forceUpdateTag);
9052
9045
  vutils.isPlainObject(this.attribute[key]) && vutils.isPlainObject(value) && !vutils.isFunction(this.attribute[key]) && !vutils.isFunction(value) ? vutils.merge(this.attribute[key], value) : this.attribute[key] = value, GROUP_ATTRIBUTES.includes(key) || this.render(), this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.onAttributeUpdate();
9053
9046
  }
9054
- setAttributes(params, forceUpdateTag) {
9047
+ setAttributes(params, forceUpdateTag, context) {
9048
+ return params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this._setAttributes(params, forceUpdateTag);
9049
+ }
9050
+ _setAttributes(params, forceUpdateTag) {
9055
9051
  const keys = Object.keys(params);
9056
9052
  this._mergeAttributes(params, keys), keys.every(key => GROUP_ATTRIBUTES.includes(key)) || this.render(), this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTags(keys) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.onAttributeUpdate();
9057
9053
  }