@visactor/vchart 2.1.4 → 2.1.5-alpha.0

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.es.js CHANGED
@@ -23703,6 +23703,10 @@ class DimensionHoverEvent extends DimensionEvent {
23703
23703
  query: null,
23704
23704
  callback: this.onMouseMove
23705
23705
  });
23706
+ this._eventDispatcher.unregister('pointerout', {
23707
+ query: null,
23708
+ callback: this.onMouseOut
23709
+ });
23706
23710
  if (isMobileLikeMode(this._mode)) {
23707
23711
  this._eventDispatcher.unregister('pointerdown', {
23708
23712
  query: null,
package/build/index.js CHANGED
@@ -9105,7 +9105,7 @@
9105
9105
  constructor() {
9106
9106
  super(), this._uid = Generator.GenAutoIncrementId(), this._firstChild = null, this._lastChild = null, this.parent = null, this._count = 1;
9107
9107
  }
9108
- onParentSharedStateTreeChanged(_stage, _layer) {}
9108
+ onParentSharedStateTreeChanged(_stage, _layer, _inheritedSharedStateScope) {}
9109
9109
  forEachChildren(cb, reverse = !1) {
9110
9110
  if (reverse) {
9111
9111
  let child = this._lastChild,
@@ -14719,14 +14719,17 @@
14719
14719
  }
14720
14720
  return null === (_a = this.stage) || void 0 === _a ? void 0 : _a.rootSharedStateScope;
14721
14721
  }
14722
- syncSharedStateScopeBindingFromTree(markDirty = !0) {
14722
+ syncSharedStateScopeBinding(nextScope, markDirty = !0) {
14723
14723
  var _a;
14724
- const nextScope = this.resolveBoundSharedStateScope();
14725
14724
  return this.boundSharedStateScope === nextScope ? (this.syncSharedStateActiveRegistrations(), !1) : (this.boundSharedStateScope = nextScope, this.boundSharedStateRevision = void 0, this.compiledStateDefinitions = void 0, this.compiledStateDefinitionsCacheKey = void 0, this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0, this.syncSharedStateActiveRegistrations(), markDirty && (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && this.markSharedStateDirty(), !0);
14726
14725
  }
14727
- syncSharedStateScopeBindingOnTreeChange(markDirty = !0) {
14726
+ syncSharedStateScopeBindingFromTree(markDirty = !0, inheritedSharedStateScope) {
14727
+ const nextScope = void 0 === inheritedSharedStateScope ? this.resolveBoundSharedStateScope() : null != inheritedSharedStateScope ? inheritedSharedStateScope : void 0;
14728
+ return this.syncSharedStateScopeBinding(nextScope, markDirty);
14729
+ }
14730
+ syncSharedStateScopeBindingOnTreeChange(markDirty = !0, inheritedSharedStateScope) {
14728
14731
  var _a, _b;
14729
- return !!((null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || this.boundSharedStateScope || (null === (_b = this.registeredActiveScopes) || void 0 === _b ? void 0 : _b.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingFromTree(markDirty);
14732
+ return !!((null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || this.boundSharedStateScope || (null === (_b = this.registeredActiveScopes) || void 0 === _b ? void 0 : _b.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingFromTree(markDirty, inheritedSharedStateScope);
14730
14733
  }
14731
14734
  syncSharedStateActiveRegistrations() {
14732
14735
  var _a;
@@ -14734,6 +14737,7 @@
14734
14737
  if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach(scope => {
14735
14738
  scope.subtreeActiveDescendants.delete(this);
14736
14739
  }), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
14740
+ if ((null == previousScopes ? void 0 : previousScopes.size) && this.isSharedStateScopeChainRegistered(previousScopes)) return;
14737
14741
  const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
14738
14742
  null == previousScopes || previousScopes.forEach(scope => {
14739
14743
  nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
@@ -14741,6 +14745,15 @@
14741
14745
  scope.subtreeActiveDescendants.add(this);
14742
14746
  }), this.registeredActiveScopes = nextScopes;
14743
14747
  }
14748
+ isSharedStateScopeChainRegistered(previousScopes) {
14749
+ let scope = this.boundSharedStateScope,
14750
+ scopeCount = 0;
14751
+ for (; scope;) {
14752
+ if (!previousScopes.has(scope)) return !1;
14753
+ scopeCount += 1, scope = scope.parentScope;
14754
+ }
14755
+ return scopeCount === previousScopes.size;
14756
+ }
14744
14757
  clearSharedStateActiveRegistrations() {
14745
14758
  const previousScopes = this.registeredActiveScopes;
14746
14759
  previousScopes && (previousScopes.forEach(scope => {
@@ -14750,8 +14763,8 @@
14750
14763
  markSharedStateDirty() {
14751
14764
  this.sharedStateDirty = !0, enqueueGraphicSharedStateRefresh(this.stage, this), scheduleStageSharedStateRefresh(this.stage);
14752
14765
  }
14753
- onParentSharedStateTreeChanged(stage, layer) {
14754
- this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
14766
+ onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
14767
+ this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope) : this.setStage(stage, layer, inheritedSharedStateScope);
14755
14768
  }
14756
14769
  refreshSharedStateBeforeRender() {
14757
14770
  var _a;
@@ -15402,6 +15415,10 @@
15402
15415
  var _a;
15403
15416
  return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
15404
15417
  }
15418
+ setStateDefinitionsWithCompiled(definitions, compiledDefinitions) {
15419
+ var _a;
15420
+ this.states = definitions, this.localStateDefinitionsSource !== definitions && (this.localStateDefinitionsSource = definitions, this.localStateDefinitionsVersion = (null !== (_a = this.localStateDefinitionsVersion) && void 0 !== _a ? _a : 0) + 1), this.compiledStateDefinitions = compiledDefinitions, this.compiledStateDefinitionsCacheKey = `local:${this.localStateDefinitionsVersion}`;
15421
+ }
15405
15422
  getStateResolveBaseAttrs() {
15406
15423
  var _a;
15407
15424
  return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
@@ -15749,12 +15766,12 @@
15749
15766
  this._globalTransMatrix.translate(scrollX, scrollY);
15750
15767
  }
15751
15768
  }
15752
- setStage(stage, layer) {
15769
+ setStage(stage, layer, inheritedSharedStateScope) {
15753
15770
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
15754
15771
  const graphicService = null !== (_c = null !== (_a = null == stage ? void 0 : stage.graphicService) && void 0 !== _a ? _a : null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application.graphicService,
15755
15772
  previousStage = this.stage;
15756
15773
  if (this.stage !== stage || this.layer !== layer) {
15757
- if (this.stage = stage, this.layer = layer, ((null === (_d = this.currentStates) || void 0 === _d ? void 0 : _d.length) || this.boundSharedStateScope || (null === (_e = this.registeredActiveScopes) || void 0 === _e ? void 0 : _e.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingOnTreeChange(!0), this.setStageToShadowRoot(stage, layer), this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
15774
+ if (this.stage = stage, this.layer = layer, ((null === (_d = this.currentStates) || void 0 === _d ? void 0 : _d.length) || this.boundSharedStateScope || (null === (_e = this.registeredActiveScopes) || void 0 === _e ? void 0 : _e.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope), this.setStageToShadowRoot(stage, layer), this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
15758
15775
  const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage),
15759
15776
  nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage),
15760
15777
  detachedStageAnimates = [];
@@ -15771,7 +15788,7 @@
15771
15788
  }
15772
15789
  return this._onSetStage && this._onSetStage(this, stage, layer), void (null === (_h = null == graphicService ? void 0 : graphicService.onSetStage) || void 0 === _h || _h.call(graphicService, this, stage));
15773
15790
  }
15774
- ((null === (_j = this.currentStates) || void 0 === _j ? void 0 : _j.length) || this.boundSharedStateScope || (null === (_k = this.registeredActiveScopes) || void 0 === _k ? void 0 : _k.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingOnTreeChange(!0);
15791
+ ((null === (_j = this.currentStates) || void 0 === _j ? void 0 : _j.length) || this.boundSharedStateScope || (null === (_k = this.registeredActiveScopes) || void 0 === _k ? void 0 : _k.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope);
15775
15792
  }
15776
15793
  detachStageForRelease() {
15777
15794
  var _a, _b, _c;
@@ -16712,13 +16729,13 @@
16712
16729
  child.setStage(null, null);
16713
16730
  }), this.addUpdateBoundTag();
16714
16731
  }
16715
- setStage(stage, layer) {
16732
+ setStage(stage, layer, inheritedSharedStateScope) {
16716
16733
  var _a, _b, _c, _d, _e, _f;
16717
16734
  const graphicService = null !== (_c = null !== (_a = null == stage ? void 0 : stage.graphicService) && void 0 !== _a ? _a : null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application.graphicService,
16718
16735
  needsSharedStateTreeSync = this.hasSharedStateDefinitions() || this.sharedStateScope || (null === (_d = this.currentStates) || void 0 === _d ? void 0 : _d.length) || this.boundSharedStateScope || (null === (_e = this.registeredActiveScopes) || void 0 === _e ? void 0 : _e.size) || this.sharedStateDirty;
16719
- if (this.stage !== stage) return this.stage = stage, this.layer = layer, needsSharedStateTreeSync && (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0)), this.setStageToShadowRoot(stage, layer), this._onSetStage && this._onSetStage(this, stage, layer), null === (_f = null == graphicService ? void 0 : graphicService.onSetStage) || void 0 === _f || _f.call(graphicService, this, stage), void this.notifyChildrenSharedStateTreeChanged();
16736
+ if (this.stage !== stage) return this.stage = stage, this.layer = layer, needsSharedStateTreeSync && (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope)), this.setStageToShadowRoot(stage, layer), this._onSetStage && this._onSetStage(this, stage, layer), null === (_f = null == graphicService ? void 0 : graphicService.onSetStage) || void 0 === _f || _f.call(graphicService, this, stage), void this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
16720
16737
  const layerChanged = this.layer !== layer;
16721
- layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.notifyChildrenSharedStateTreeChanged();
16738
+ layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope), this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope)) : layerChanged && this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
16722
16739
  }
16723
16740
  addUpdatePositionTag() {
16724
16741
  super.addUpdatePositionTag(), this.forEachChildren(g => {
@@ -16777,17 +16794,26 @@
16777
16794
  hasSharedStateDefinitions() {
16778
16795
  return !!this._sharedStateDefinitions && Object.keys(this._sharedStateDefinitions).length > 0;
16779
16796
  }
16780
- notifyChildrenSharedStateTreeChanged() {
16797
+ resolveChildSharedStateScope(inheritedSharedStateScope) {
16798
+ var _a;
16799
+ return this.sharedStateScope ? this.sharedStateScope : void 0 !== inheritedSharedStateScope ? inheritedSharedStateScope : null !== (_a = this.resolveBoundSharedStateScope()) && void 0 !== _a ? _a : null;
16800
+ }
16801
+ notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope) {
16802
+ const childSharedStateScope = this.resolveChildSharedStateScope(inheritedSharedStateScope);
16781
16803
  this.forEachChildren(item => {
16782
- this.syncChildSharedStateTreeBinding(item);
16804
+ this.setStageToChild(item, childSharedStateScope);
16783
16805
  });
16784
16806
  }
16785
- syncChildSharedStateTreeBinding(child) {
16786
- child.onParentSharedStateTreeChanged(this.stage, this.layer);
16807
+ setStageToChild(child, inheritedSharedStateScope) {
16808
+ const graphic = child;
16809
+ "function" != typeof graphic.setStage || child.onParentSharedStateTreeChanged !== Graphic.prototype.onParentSharedStateTreeChanged && child.onParentSharedStateTreeChanged !== Group.prototype.onParentSharedStateTreeChanged || graphic.stage === this.stage && graphic.layer === this.layer ? child.onParentSharedStateTreeChanged(this.stage, this.layer, inheritedSharedStateScope) : graphic.setStage(this.stage, this.layer, inheritedSharedStateScope);
16787
16810
  }
16788
- onParentSharedStateTreeChanged(stage, layer) {
16811
+ syncChildSharedStateTreeBinding(child, inheritedSharedStateScope) {
16812
+ void 0 === inheritedSharedStateScope && (inheritedSharedStateScope = this.resolveChildSharedStateScope()), this.setStageToChild(child, inheritedSharedStateScope);
16813
+ }
16814
+ onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
16789
16815
  var _a;
16790
- this.stage === stage && this.layer === layer ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length)), this.notifyChildrenSharedStateTreeChanged()) : this.setStage(stage, layer);
16816
+ this.stage === stage && this.layer === layer ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length), inheritedSharedStateScope), this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope)) : this.setStage(stage, layer, inheritedSharedStateScope);
16791
16817
  }
16792
16818
  };
16793
16819
  Group$1.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
@@ -17327,13 +17353,14 @@
17327
17353
  }) : fillStyle, setTextStyle(ctx, character);
17328
17354
  }
17329
17355
  function applyStrokeStyle(ctx, character) {
17356
+ var _a, _b;
17330
17357
  const strokeStyle = character && character.stroke || defaultFormatting.stroke;
17331
17358
  if (!strokeStyle) return void (ctx.globalAlpha = 0);
17332
17359
  const {
17333
17360
  strokeOpacity = 1,
17334
17361
  opacity = 1
17335
17362
  } = character;
17336
- ctx.globalAlpha = strokeOpacity * opacity, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.strokeStyle = strokeStyle, setTextStyle(ctx, character);
17363
+ ctx.globalAlpha = strokeOpacity * opacity, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.setLineDash(null !== (_a = character.lineDash) && void 0 !== _a ? _a : []), ctx.lineDashOffset = null !== (_b = character.lineDashOffset) && void 0 !== _b ? _b : 0, ctx.strokeStyle = strokeStyle, setTextStyle(ctx, character);
17337
17364
  }
17338
17365
  function getStrByWithCanvas(desc, width, character, guessIndex, needTestLetter) {
17339
17366
  if (desc.length <= 1) return 0;
@@ -18153,8 +18180,8 @@
18153
18180
  clone() {
18154
18181
  return new RichText(Object.assign({}, this.attribute));
18155
18182
  }
18156
- setStage(stage, layer) {
18157
- super.setStage(stage, layer);
18183
+ setStage(stage, layer, inheritedSharedStateScope) {
18184
+ super.setStage(stage, layer, inheritedSharedStateScope);
18158
18185
  this.getFrameCache().icons.forEach(icon => {
18159
18186
  icon.setStage(stage, layer);
18160
18187
  });
@@ -52319,6 +52346,10 @@
52319
52346
  query: null,
52320
52347
  callback: this.onMouseMove
52321
52348
  });
52349
+ this._eventDispatcher.unregister('pointerout', {
52350
+ query: null,
52351
+ callback: this.onMouseOut
52352
+ });
52322
52353
  if (isMobileLikeMode(this._mode)) {
52323
52354
  this._eventDispatcher.unregister('pointerdown', {
52324
52355
  query: null,
@@ -70364,7 +70395,7 @@
70364
70395
  loadDiscreteLegendComponent();
70365
70396
  let DiscreteLegend$1 = class DiscreteLegend extends LegendBase {
70366
70397
  constructor(attributes, options) {
70367
- super((null == options ? void 0 : options.skipDefault) ? attributes : merge$1({}, DiscreteLegend.defaultAttributes, attributes)), this.name = "discreteLegend", this._itemsContainer = null, this._itemHeightByUser = void 0, this._itemHeight = 0, this._itemMaxWidth = 0, this._contentMaxHeight = 0, this._onHover = e => {
70398
+ super((null == options ? void 0 : options.skipDefault) ? attributes : merge$1({}, DiscreteLegend.defaultAttributes, attributes)), this.name = "discreteLegend", this._itemsContainer = null, this._itemHeightByUser = void 0, this._itemHeight = 0, this._itemMaxWidth = 0, this._contentMaxHeight = 0, this._stateDefinitionsCache = new WeakMap(), this._onHover = e => {
70368
70399
  const target = e.target;
70369
70400
  if (target && target.name && target.name.startsWith(LEGEND_ELEMENT_NAME.item)) {
70370
70401
  const legendItem = target.delegate;
@@ -70412,7 +70443,7 @@
70412
70443
  };
70413
70444
  }
70414
70445
  render() {
70415
- super.render(), this._lastActiveItem = null;
70446
+ this._stateDefinitionsCache = new WeakMap(), super.render(), this._lastActiveItem = null;
70416
70447
  }
70417
70448
  setSelected(selectedData) {
70418
70449
  var _a;
@@ -70592,7 +70623,7 @@
70592
70623
  }), this._appendDataToShape(itemGroup, LEGEND_ELEMENT_NAME.item, item, itemGroup)) : (itemGroup = graphicCreator.group(Object.assign({
70593
70624
  x: 0,
70594
70625
  y: 0
70595
- }, backgroundStyle.style)), this._appendDataToShape(itemGroup, LEGEND_ELEMENT_NAME.item, item, itemGroup, backgroundStyle.state)), itemGroup.id = `${null != id ? id : label}-${index}`, itemGroup.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected);
70626
+ }, backgroundStyle.style)), this._appendDataToShape(itemGroup, LEGEND_ELEMENT_NAME.item, item, itemGroup, backgroundStyle.state, backgroundStyle.reuseStateDefinitions)), itemGroup.id = `${null != id ? id : label}-${index}`, itemGroup.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected);
70596
70627
  const innerGroup = graphicCreator.group({
70597
70628
  x: 0,
70598
70629
  y: 0,
@@ -70615,7 +70646,7 @@
70615
70646
  Object.keys(shapeStyle.state || {}).forEach(key => {
70616
70647
  const color = shapeStyle.state[key].fill || shapeStyle.state[key].stroke;
70617
70648
  shape.fill && isNil$1(shapeStyle.state[key].fill) && color && (shapeStyle.state[key].fill = color), shape.stroke && isNil$1(shapeStyle.state[key].stroke) && color && (shapeStyle.state[key].stroke = color);
70618
- }), this._appendDataToShape(itemShape, LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state), itemShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(itemShape);
70649
+ }), this._appendDataToShape(itemShape, LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state, !1), itemShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(itemShape);
70619
70650
  }
70620
70651
  let focusSpace = 0;
70621
70652
  if (focus) {
@@ -70642,7 +70673,7 @@
70642
70673
  _originText: labelAttr.formatMethod ? label : void 0
70643
70674
  }),
70644
70675
  labelShape = createTextGraphicByType(labelAttributes);
70645
- this._appendDataToShape(labelShape, LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state), labelShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(labelShape);
70676
+ this._appendDataToShape(labelShape, LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state, labelStyle.reuseStateDefinitions), labelShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(labelShape);
70646
70677
  const labelSpace = get$1(labelAttr, "space", DEFAULT_LABEL_SPACE);
70647
70678
  if (isValid$1(value)) {
70648
70679
  const valueSpace = get$1(valueAttr, "space", focus ? DEFAULT_VALUE_SPACE : 0),
@@ -70658,7 +70689,7 @@
70658
70689
  _originText: valueAttr.formatMethod ? value : void 0
70659
70690
  }),
70660
70691
  valueShape = createTextGraphicByType(valueAttributes);
70661
- if (this._appendDataToShape(valueShape, LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state), valueShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), this._itemWidthByUser) {
70692
+ if (this._appendDataToShape(valueShape, LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state, valueStyle.reuseStateDefinitions), valueShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), this._itemWidthByUser) {
70662
70693
  const layoutWidth = this._itemWidthByUser - parsedPadding[1] - parsedPadding[3] - shapeSize - shapeSpace - labelSpace - focusSpace - valueSpace;
70663
70694
  this._autoEllipsis(autoEllipsisStrategy, layoutWidth, labelShape, valueShape), valueAttr.alignRight ? valueShape.setAttributes({
70664
70695
  textAlign: "right",
@@ -70734,6 +70765,7 @@
70734
70765
  }));
70735
70766
  }
70736
70767
  _updatePositionOfPager(renderStartY, compWidth, compHeight) {
70768
+ var _a;
70737
70769
  const {
70738
70770
  pager: pager
70739
70771
  } = this.attribute,
@@ -70741,18 +70773,24 @@
70741
70773
  totalPage: totalPage,
70742
70774
  isHorizontal: isHorizontal
70743
70775
  } = this._itemContext,
70744
- position = pager && pager.position || "middle";
70776
+ position = pager && pager.position || "middle",
70777
+ hugContent = !(!pager || !pager.hugContent),
70778
+ pagerSpace = null !== (_a = pager && pager.space) && void 0 !== _a ? _a : DEFAULT_PAGER_SPACE;
70745
70779
  if (this._pagerComponent.setTotal(totalPage), isHorizontal) {
70746
70780
  let y;
70747
- y = "start" === position ? renderStartY : "end" === position ? renderStartY + compHeight - this._pagerComponent.AABBBounds.height() / 2 : renderStartY + compHeight / 2 - this._pagerComponent.AABBBounds.height() / 2, this._pagerComponent.setAttributes({
70748
- x: compWidth - this._pagerComponent.AABBBounds.width(),
70781
+ y = "start" === position ? renderStartY : "end" === position ? renderStartY + compHeight - this._pagerComponent.AABBBounds.height() / 2 : renderStartY + compHeight / 2 - this._pagerComponent.AABBBounds.height() / 2;
70782
+ let x = compWidth - this._pagerComponent.AABBBounds.width();
70783
+ hugContent && (x = Math.max(0, Math.min(this._itemsContainer.AABBBounds.width() + pagerSpace, x))), this._pagerComponent.setAttributes({
70784
+ x: x,
70749
70785
  y: y
70750
70786
  });
70751
70787
  } else {
70752
70788
  let x;
70753
- x = "start" === position ? 0 : "end" === position ? compWidth - this._pagerComponent.AABBBounds.width() : (compWidth - this._pagerComponent.AABBBounds.width()) / 2, this._pagerComponent.setAttributes({
70789
+ x = "start" === position ? 0 : "end" === position ? compWidth - this._pagerComponent.AABBBounds.width() : (compWidth - this._pagerComponent.AABBBounds.width()) / 2;
70790
+ let y = compHeight - this._pagerComponent.AABBBounds.height();
70791
+ hugContent && (y = Math.max(0, Math.min(renderStartY + this._itemsContainer.AABBBounds.height() + pagerSpace, y))), this._pagerComponent.setAttributes({
70754
70792
  x: x,
70755
- y: compHeight - this._pagerComponent.AABBBounds.height()
70793
+ y: y
70756
70794
  });
70757
70795
  }
70758
70796
  }
@@ -70907,11 +70945,15 @@
70907
70945
  this._itemContext.totalPage = total, this._updatePositionOfPager(renderStartY, compWidth, compHeight);
70908
70946
  }
70909
70947
  defaultCurrent > 1 && (isHorizontal ? itemsContainer.setAttribute("y", -(defaultCurrent - 1) * (compHeight + spaceRow)) : itemsContainer.setAttribute("x", -(defaultCurrent - 1) * (compWidth + spaceCol)));
70948
+ const hugContent = !!pager.hugContent;
70949
+ let clipWidth = isHorizontal ? contentWidth : compWidth,
70950
+ clipHeight = isHorizontal ? compHeight : contentHeight;
70951
+ hugContent && (isHorizontal ? clipWidth = Math.max(0, Math.min(clipWidth, itemsContainer.AABBBounds.width())) : clipHeight = Math.max(0, Math.min(clipHeight, itemsContainer.AABBBounds.height())));
70910
70952
  const clipGroup = graphicCreator.group({
70911
70953
  x: 0,
70912
70954
  y: renderStartY,
70913
- width: isHorizontal ? contentWidth : compWidth,
70914
- height: isHorizontal ? compHeight : contentHeight,
70955
+ width: clipWidth,
70956
+ height: clipHeight,
70915
70957
  clip: !0,
70916
70958
  pickable: !1
70917
70959
  });
@@ -71077,8 +71119,17 @@
71077
71119
  item.hasState(LegendStateValue.selected) && selectedData.push(item.data);
71078
71120
  }), selectedData;
71079
71121
  }
71080
- _appendDataToShape(shape, name, data, delegateShape, states = {}) {
71081
- shape.name = name, shape.data = data, shape.delegate = delegateShape, shape.states = merge$1({}, DEFAULT_STATES, states);
71122
+ _appendDataToShape(shape, name, data, delegateShape, states, reuseStateDefinitions = !0) {
71123
+ if (shape.name = name, shape.data = data, shape.delegate = delegateShape, !reuseStateDefinitions) return void (shape.states = merge$1({}, DEFAULT_STATES, states));
71124
+ const source = null != states ? states : DEFAULT_STATES,
71125
+ cached = this._stateDefinitionsCache.get(source);
71126
+ if (cached) return shape.states = cached.definitions, void shape.setStateDefinitionsWithCompiled(cached.definitions, cached.compiledDefinitions);
71127
+ const definitions = states ? merge$1({}, DEFAULT_STATES, states) : DEFAULT_STATES,
71128
+ entry = {
71129
+ definitions: definitions,
71130
+ compiledDefinitions: new StateDefinitionCompiler().compile(definitions)
71131
+ };
71132
+ this._stateDefinitionsCache.set(source, entry), shape.states = entry.definitions, shape.setStateDefinitionsWithCompiled(entry.definitions, entry.compiledDefinitions);
71082
71133
  }
71083
71134
  _dispatchLegendEvent(eventName, legendItem, event) {
71084
71135
  const currentSelectedItems = this._getSelectedLegends();
@@ -71095,12 +71146,17 @@
71095
71146
  }
71096
71147
  _handleStyle(config, item, isSelected, index, items) {
71097
71148
  const newConfig = {};
71098
- return config.style && (isFunction$1(config.style) ? newConfig.style = config.style(item, isSelected, index, items) : newConfig.style = config.style), config.state && (newConfig.state = {}, Object.keys(config.state).forEach(key => {
71099
- config.state[key] && (isFunction$1(config.state[key]) ? newConfig.state[key] = config.state[key](item, isSelected, index, items) : newConfig.state[key] = config.state[key]);
71100
- })), newConfig;
71149
+ if (config.style && (isFunction$1(config.style) ? newConfig.style = config.style(item, isSelected, index, items) : newConfig.style = config.style), config.state) {
71150
+ const stateKeys = Object.keys(config.state),
71151
+ hasStateFunction = stateKeys.some(key => isFunction$1(config.state[key]));
71152
+ newConfig.reuseStateDefinitions = !hasStateFunction, hasStateFunction ? (newConfig.state = {}, stateKeys.forEach(key => {
71153
+ config.state[key] && (newConfig.state[key] = isFunction$1(config.state[key]) ? config.state[key](item, isSelected, index, items) : config.state[key]);
71154
+ })) : newConfig.state = config.state;
71155
+ }
71156
+ return newConfig;
71101
71157
  }
71102
71158
  release() {
71103
- super.release(), this.removeAllEventListeners();
71159
+ this._stateDefinitionsCache = new WeakMap(), super.release(), this.removeAllEventListeners();
71104
71160
  }
71105
71161
  };
71106
71162
  DiscreteLegend$1.defaultAttributes = {