@visactor/vrender 1.1.4 → 1.1.6-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/dist/index.js CHANGED
@@ -2728,7 +2728,7 @@
2728
2728
  constructor() {
2729
2729
  super(), this._uid = Generator.GenAutoIncrementId(), this._firstChild = null, this._lastChild = null, this.parent = null, this._count = 1;
2730
2730
  }
2731
- onParentSharedStateTreeChanged(_stage, _layer) {}
2731
+ onParentSharedStateTreeChanged(_stage, _layer, _inheritedSharedStateScope) {}
2732
2732
  forEachChildren(cb, reverse = !1) {
2733
2733
  if (reverse) {
2734
2734
  let child = this._lastChild,
@@ -8487,14 +8487,17 @@
8487
8487
  }
8488
8488
  return null === (_a = this.stage) || void 0 === _a ? void 0 : _a.rootSharedStateScope;
8489
8489
  }
8490
- syncSharedStateScopeBindingFromTree(markDirty = !0) {
8490
+ syncSharedStateScopeBinding(nextScope, markDirty = !0) {
8491
8491
  var _a;
8492
- const nextScope = this.resolveBoundSharedStateScope();
8493
8492
  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);
8494
8493
  }
8495
- syncSharedStateScopeBindingOnTreeChange(markDirty = !0) {
8494
+ syncSharedStateScopeBindingFromTree(markDirty = !0, inheritedSharedStateScope) {
8495
+ const nextScope = void 0 === inheritedSharedStateScope ? this.resolveBoundSharedStateScope() : null != inheritedSharedStateScope ? inheritedSharedStateScope : void 0;
8496
+ return this.syncSharedStateScopeBinding(nextScope, markDirty);
8497
+ }
8498
+ syncSharedStateScopeBindingOnTreeChange(markDirty = !0, inheritedSharedStateScope) {
8496
8499
  var _a, _b;
8497
- 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);
8500
+ 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);
8498
8501
  }
8499
8502
  syncSharedStateActiveRegistrations() {
8500
8503
  var _a;
@@ -8502,6 +8505,7 @@
8502
8505
  if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach(scope => {
8503
8506
  scope.subtreeActiveDescendants.delete(this);
8504
8507
  }), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
8508
+ if ((null == previousScopes ? void 0 : previousScopes.size) && this.isSharedStateScopeChainRegistered(previousScopes)) return;
8505
8509
  const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
8506
8510
  null == previousScopes || previousScopes.forEach(scope => {
8507
8511
  nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
@@ -8509,6 +8513,15 @@
8509
8513
  scope.subtreeActiveDescendants.add(this);
8510
8514
  }), this.registeredActiveScopes = nextScopes;
8511
8515
  }
8516
+ isSharedStateScopeChainRegistered(previousScopes) {
8517
+ let scope = this.boundSharedStateScope,
8518
+ scopeCount = 0;
8519
+ for (; scope;) {
8520
+ if (!previousScopes.has(scope)) return !1;
8521
+ scopeCount += 1, scope = scope.parentScope;
8522
+ }
8523
+ return scopeCount === previousScopes.size;
8524
+ }
8512
8525
  clearSharedStateActiveRegistrations() {
8513
8526
  const previousScopes = this.registeredActiveScopes;
8514
8527
  previousScopes && (previousScopes.forEach(scope => {
@@ -8518,8 +8531,8 @@
8518
8531
  markSharedStateDirty() {
8519
8532
  this.sharedStateDirty = !0, enqueueGraphicSharedStateRefresh(this.stage, this), scheduleStageSharedStateRefresh(this.stage);
8520
8533
  }
8521
- onParentSharedStateTreeChanged(stage, layer) {
8522
- this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
8534
+ onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
8535
+ this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope) : this.setStage(stage, layer, inheritedSharedStateScope);
8523
8536
  }
8524
8537
  refreshSharedStateBeforeRender() {
8525
8538
  var _a;
@@ -9170,6 +9183,10 @@
9170
9183
  var _a;
9171
9184
  return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
9172
9185
  }
9186
+ setStateDefinitionsWithCompiled(definitions, compiledDefinitions) {
9187
+ var _a;
9188
+ 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}`;
9189
+ }
9173
9190
  getStateResolveBaseAttrs() {
9174
9191
  var _a;
9175
9192
  return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
@@ -9517,12 +9534,12 @@
9517
9534
  this._globalTransMatrix.translate(scrollX, scrollY);
9518
9535
  }
9519
9536
  }
9520
- setStage(stage, layer) {
9537
+ setStage(stage, layer, inheritedSharedStateScope) {
9521
9538
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
9522
9539
  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,
9523
9540
  previousStage = this.stage;
9524
9541
  if (this.stage !== stage || this.layer !== layer) {
9525
- 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()) {
9542
+ 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()) {
9526
9543
  const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage),
9527
9544
  nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage),
9528
9545
  detachedStageAnimates = [];
@@ -9539,7 +9556,7 @@
9539
9556
  }
9540
9557
  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));
9541
9558
  }
9542
- ((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);
9559
+ ((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);
9543
9560
  }
9544
9561
  detachStageForRelease() {
9545
9562
  var _a, _b, _c;
@@ -11163,13 +11180,14 @@
11163
11180
  }) : fillStyle, setTextStyle(ctx, character);
11164
11181
  }
11165
11182
  function applyStrokeStyle(ctx, character) {
11183
+ var _a, _b;
11166
11184
  const strokeStyle = character && character.stroke || defaultFormatting.stroke;
11167
11185
  if (!strokeStyle) return void (ctx.globalAlpha = 0);
11168
11186
  const {
11169
11187
  strokeOpacity = 1,
11170
11188
  opacity = 1
11171
11189
  } = character;
11172
- ctx.globalAlpha = strokeOpacity * opacity, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.strokeStyle = strokeStyle, setTextStyle(ctx, character);
11190
+ 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);
11173
11191
  }
11174
11192
  function getStrByWithCanvas(desc, width, character, guessIndex, needTestLetter) {
11175
11193
  if (desc.length <= 1) return 0;
@@ -12112,8 +12130,8 @@
12112
12130
  clone() {
12113
12131
  return new RichText(Object.assign({}, this.attribute));
12114
12132
  }
12115
- setStage(stage, layer) {
12116
- super.setStage(stage, layer);
12133
+ setStage(stage, layer, inheritedSharedStateScope) {
12134
+ super.setStage(stage, layer, inheritedSharedStateScope);
12117
12135
  this.getFrameCache().icons.forEach(icon => {
12118
12136
  icon.setStage(stage, layer);
12119
12137
  });
@@ -12817,13 +12835,13 @@
12817
12835
  child.setStage(null, null);
12818
12836
  }), this.addUpdateBoundTag();
12819
12837
  }
12820
- setStage(stage, layer) {
12838
+ setStage(stage, layer, inheritedSharedStateScope) {
12821
12839
  var _a, _b, _c, _d, _e, _f;
12822
12840
  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,
12823
12841
  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;
12824
- 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();
12842
+ 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);
12825
12843
  const layerChanged = this.layer !== layer;
12826
- layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.notifyChildrenSharedStateTreeChanged();
12844
+ layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope), this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope)) : layerChanged && this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
12827
12845
  }
12828
12846
  addUpdatePositionTag() {
12829
12847
  super.addUpdatePositionTag(), this.forEachChildren(g => {
@@ -12882,17 +12900,26 @@
12882
12900
  hasSharedStateDefinitions() {
12883
12901
  return !!this._sharedStateDefinitions && Object.keys(this._sharedStateDefinitions).length > 0;
12884
12902
  }
12885
- notifyChildrenSharedStateTreeChanged() {
12903
+ resolveChildSharedStateScope(inheritedSharedStateScope) {
12904
+ var _a;
12905
+ return this.sharedStateScope ? this.sharedStateScope : void 0 !== inheritedSharedStateScope ? inheritedSharedStateScope : null !== (_a = this.resolveBoundSharedStateScope()) && void 0 !== _a ? _a : null;
12906
+ }
12907
+ notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope) {
12908
+ const childSharedStateScope = this.resolveChildSharedStateScope(inheritedSharedStateScope);
12886
12909
  this.forEachChildren(item => {
12887
- this.syncChildSharedStateTreeBinding(item);
12910
+ this.setStageToChild(item, childSharedStateScope);
12888
12911
  });
12889
12912
  }
12890
- syncChildSharedStateTreeBinding(child) {
12891
- child.onParentSharedStateTreeChanged(this.stage, this.layer);
12913
+ setStageToChild(child, inheritedSharedStateScope) {
12914
+ const graphic = child;
12915
+ "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);
12892
12916
  }
12893
- onParentSharedStateTreeChanged(stage, layer) {
12917
+ syncChildSharedStateTreeBinding(child, inheritedSharedStateScope) {
12918
+ void 0 === inheritedSharedStateScope && (inheritedSharedStateScope = this.resolveChildSharedStateScope()), this.setStageToChild(child, inheritedSharedStateScope);
12919
+ }
12920
+ onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
12894
12921
  var _a;
12895
- 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);
12922
+ 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);
12896
12923
  }
12897
12924
  }
12898
12925
  Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
@@ -49944,7 +49971,7 @@
49944
49971
  loadDiscreteLegendComponent();
49945
49972
  class DiscreteLegend extends LegendBase {
49946
49973
  constructor(attributes, options) {
49947
- super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, 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 => {
49974
+ super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, 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 => {
49948
49975
  const target = e.target;
49949
49976
  if (target && target.name && target.name.startsWith(exports.LEGEND_ELEMENT_NAME.item)) {
49950
49977
  const legendItem = target.delegate;
@@ -49992,7 +50019,7 @@
49992
50019
  };
49993
50020
  }
49994
50021
  render() {
49995
- super.render(), this._lastActiveItem = null;
50022
+ this._stateDefinitionsCache = new WeakMap(), super.render(), this._lastActiveItem = null;
49996
50023
  }
49997
50024
  setSelected(selectedData) {
49998
50025
  var _a;
@@ -50172,7 +50199,7 @@
50172
50199
  }), this._appendDataToShape(itemGroup, exports.LEGEND_ELEMENT_NAME.item, item, itemGroup)) : (itemGroup = graphicCreator.group(Object.assign({
50173
50200
  x: 0,
50174
50201
  y: 0
50175
- }, backgroundStyle.style)), this._appendDataToShape(itemGroup, exports.LEGEND_ELEMENT_NAME.item, item, itemGroup, backgroundStyle.state)), itemGroup.id = `${null != id ? id : label}-${index}`, itemGroup.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected);
50202
+ }, backgroundStyle.style)), this._appendDataToShape(itemGroup, exports.LEGEND_ELEMENT_NAME.item, item, itemGroup, backgroundStyle.state, backgroundStyle.reuseStateDefinitions)), itemGroup.id = `${null != id ? id : label}-${index}`, itemGroup.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected);
50176
50203
  const innerGroup = graphicCreator.group({
50177
50204
  x: 0,
50178
50205
  y: 0,
@@ -50195,7 +50222,7 @@
50195
50222
  Object.keys(shapeStyle.state || {}).forEach(key => {
50196
50223
  const color = shapeStyle.state[key].fill || shapeStyle.state[key].stroke;
50197
50224
  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);
50198
- }), this._appendDataToShape(itemShape, exports.LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state), itemShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected), innerGroup.add(itemShape);
50225
+ }), this._appendDataToShape(itemShape, exports.LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state, !1), itemShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected), innerGroup.add(itemShape);
50199
50226
  }
50200
50227
  let focusSpace = 0;
50201
50228
  if (focus) {
@@ -50222,7 +50249,7 @@
50222
50249
  _originText: labelAttr.formatMethod ? label : void 0
50223
50250
  }),
50224
50251
  labelShape = createTextGraphicByType(labelAttributes);
50225
- this._appendDataToShape(labelShape, exports.LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state), labelShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected), innerGroup.add(labelShape);
50252
+ this._appendDataToShape(labelShape, exports.LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state, labelStyle.reuseStateDefinitions), labelShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected), innerGroup.add(labelShape);
50226
50253
  const labelSpace = get$1(labelAttr, "space", DEFAULT_LABEL_SPACE);
50227
50254
  if (isValid$1(value)) {
50228
50255
  const valueSpace = get$1(valueAttr, "space", focus ? DEFAULT_VALUE_SPACE : 0),
@@ -50238,7 +50265,7 @@
50238
50265
  _originText: valueAttr.formatMethod ? value : void 0
50239
50266
  }),
50240
50267
  valueShape = createTextGraphicByType(valueAttributes);
50241
- if (this._appendDataToShape(valueShape, exports.LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state), valueShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected), this._itemWidthByUser) {
50268
+ if (this._appendDataToShape(valueShape, exports.LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state, valueStyle.reuseStateDefinitions), valueShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected), this._itemWidthByUser) {
50242
50269
  const layoutWidth = this._itemWidthByUser - parsedPadding[1] - parsedPadding[3] - shapeSize - shapeSpace - labelSpace - focusSpace - valueSpace;
50243
50270
  this._autoEllipsis(autoEllipsisStrategy, layoutWidth, labelShape, valueShape), valueAttr.alignRight ? valueShape.setAttributes({
50244
50271
  textAlign: "right",
@@ -50314,6 +50341,7 @@
50314
50341
  }));
50315
50342
  }
50316
50343
  _updatePositionOfPager(renderStartY, compWidth, compHeight) {
50344
+ var _a;
50317
50345
  const {
50318
50346
  pager: pager
50319
50347
  } = this.attribute,
@@ -50321,18 +50349,24 @@
50321
50349
  totalPage: totalPage,
50322
50350
  isHorizontal: isHorizontal
50323
50351
  } = this._itemContext,
50324
- position = pager && pager.position || "middle";
50352
+ position = pager && pager.position || "middle",
50353
+ hugContent = !(!pager || !pager.hugContent),
50354
+ pagerSpace = null !== (_a = pager && pager.space) && void 0 !== _a ? _a : DEFAULT_PAGER_SPACE;
50325
50355
  if (this._pagerComponent.setTotal(totalPage), isHorizontal) {
50326
50356
  let y;
50327
- y = "start" === position ? renderStartY : "end" === position ? renderStartY + compHeight - this._pagerComponent.AABBBounds.height() / 2 : renderStartY + compHeight / 2 - this._pagerComponent.AABBBounds.height() / 2, this._pagerComponent.setAttributes({
50328
- x: compWidth - this._pagerComponent.AABBBounds.width(),
50357
+ y = "start" === position ? renderStartY : "end" === position ? renderStartY + compHeight - this._pagerComponent.AABBBounds.height() / 2 : renderStartY + compHeight / 2 - this._pagerComponent.AABBBounds.height() / 2;
50358
+ let x = compWidth - this._pagerComponent.AABBBounds.width();
50359
+ hugContent && (x = Math.max(0, Math.min(this._itemsContainer.AABBBounds.width() + pagerSpace, x))), this._pagerComponent.setAttributes({
50360
+ x: x,
50329
50361
  y: y
50330
50362
  });
50331
50363
  } else {
50332
50364
  let x;
50333
- x = "start" === position ? 0 : "end" === position ? compWidth - this._pagerComponent.AABBBounds.width() : (compWidth - this._pagerComponent.AABBBounds.width()) / 2, this._pagerComponent.setAttributes({
50365
+ x = "start" === position ? 0 : "end" === position ? compWidth - this._pagerComponent.AABBBounds.width() : (compWidth - this._pagerComponent.AABBBounds.width()) / 2;
50366
+ let y = compHeight - this._pagerComponent.AABBBounds.height();
50367
+ hugContent && (y = Math.max(0, Math.min(renderStartY + this._itemsContainer.AABBBounds.height() + pagerSpace, y))), this._pagerComponent.setAttributes({
50334
50368
  x: x,
50335
- y: compHeight - this._pagerComponent.AABBBounds.height()
50369
+ y: y
50336
50370
  });
50337
50371
  }
50338
50372
  }
@@ -50487,11 +50521,15 @@
50487
50521
  this._itemContext.totalPage = total, this._updatePositionOfPager(renderStartY, compWidth, compHeight);
50488
50522
  }
50489
50523
  defaultCurrent > 1 && (isHorizontal ? itemsContainer.setAttribute("y", -(defaultCurrent - 1) * (compHeight + spaceRow)) : itemsContainer.setAttribute("x", -(defaultCurrent - 1) * (compWidth + spaceCol)));
50524
+ const hugContent = !!pager.hugContent;
50525
+ let clipWidth = isHorizontal ? contentWidth : compWidth,
50526
+ clipHeight = isHorizontal ? compHeight : contentHeight;
50527
+ hugContent && (isHorizontal ? clipWidth = Math.max(0, Math.min(clipWidth, itemsContainer.AABBBounds.width())) : clipHeight = Math.max(0, Math.min(clipHeight, itemsContainer.AABBBounds.height())));
50490
50528
  const clipGroup = graphicCreator.group({
50491
50529
  x: 0,
50492
50530
  y: renderStartY,
50493
- width: isHorizontal ? contentWidth : compWidth,
50494
- height: isHorizontal ? compHeight : contentHeight,
50531
+ width: clipWidth,
50532
+ height: clipHeight,
50495
50533
  clip: !0,
50496
50534
  pickable: !1
50497
50535
  });
@@ -50657,8 +50695,17 @@
50657
50695
  item.hasState(exports.LegendStateValue.selected) && selectedData.push(item.data);
50658
50696
  }), selectedData;
50659
50697
  }
50660
- _appendDataToShape(shape, name, data, delegateShape, states = {}) {
50661
- shape.name = name, shape.data = data, shape.delegate = delegateShape, shape.states = merge({}, DEFAULT_STATES, states);
50698
+ _appendDataToShape(shape, name, data, delegateShape, states, reuseStateDefinitions = !0) {
50699
+ if (shape.name = name, shape.data = data, shape.delegate = delegateShape, !reuseStateDefinitions) return void (shape.states = merge({}, DEFAULT_STATES, states));
50700
+ const source = null != states ? states : DEFAULT_STATES,
50701
+ cached = this._stateDefinitionsCache.get(source);
50702
+ if (cached) return shape.states = cached.definitions, void shape.setStateDefinitionsWithCompiled(cached.definitions, cached.compiledDefinitions);
50703
+ const definitions = states ? merge({}, DEFAULT_STATES, states) : DEFAULT_STATES,
50704
+ entry = {
50705
+ definitions: definitions,
50706
+ compiledDefinitions: new StateDefinitionCompiler().compile(definitions)
50707
+ };
50708
+ this._stateDefinitionsCache.set(source, entry), shape.states = entry.definitions, shape.setStateDefinitionsWithCompiled(entry.definitions, entry.compiledDefinitions);
50662
50709
  }
50663
50710
  _dispatchLegendEvent(eventName, legendItem, event) {
50664
50711
  const currentSelectedItems = this._getSelectedLegends();
@@ -50675,12 +50722,17 @@
50675
50722
  }
50676
50723
  _handleStyle(config, item, isSelected, index, items) {
50677
50724
  const newConfig = {};
50678
- 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 => {
50679
- config.state[key] && (isFunction$1(config.state[key]) ? newConfig.state[key] = config.state[key](item, isSelected, index, items) : newConfig.state[key] = config.state[key]);
50680
- })), newConfig;
50725
+ if (config.style && (isFunction$1(config.style) ? newConfig.style = config.style(item, isSelected, index, items) : newConfig.style = config.style), config.state) {
50726
+ const stateKeys = Object.keys(config.state),
50727
+ hasStateFunction = stateKeys.some(key => isFunction$1(config.state[key]));
50728
+ newConfig.reuseStateDefinitions = !hasStateFunction, hasStateFunction ? (newConfig.state = {}, stateKeys.forEach(key => {
50729
+ config.state[key] && (newConfig.state[key] = isFunction$1(config.state[key]) ? config.state[key](item, isSelected, index, items) : config.state[key]);
50730
+ })) : newConfig.state = config.state;
50731
+ }
50732
+ return newConfig;
50681
50733
  }
50682
50734
  release() {
50683
- super.release(), this.removeAllEventListeners();
50735
+ this._stateDefinitionsCache = new WeakMap(), super.release(), this.removeAllEventListeners();
50684
50736
  }
50685
50737
  }
50686
50738
  DiscreteLegend.defaultAttributes = {
@@ -55562,7 +55614,7 @@
55562
55614
  return resolveLegacyApp().createStage(params);
55563
55615
  }
55564
55616
 
55565
- const version = "1.1.4";
55617
+ const version = "1.1.6-alpha.0";
55566
55618
 
55567
55619
  exports.AComponentAnimate = AComponentAnimate;
55568
55620
  exports.ACustomAnimate = ACustomAnimate;