@visactor/vrender 1.1.5 → 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/cjs/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Direction } from '@visactor/vrender-core';
2
- export declare const version = "1.1.5";
2
+ export declare const version = "1.1.6-alpha.0";
3
3
  export * from '@visactor/vrender-core';
4
4
  export * from '@visactor/vrender-kits';
5
5
  export * from '@visactor/vrender-animate';
package/cjs/index.js CHANGED
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "Direction", {
26
26
  get: function() {
27
27
  return vrender_core_1.Direction;
28
28
  }
29
- }), exports.version = "1.1.5", __exportStar(require("@visactor/vrender-core"), exports),
29
+ }), exports.version = "1.1.6-alpha.0", __exportStar(require("@visactor/vrender-core"), exports),
30
30
  __exportStar(require("@visactor/vrender-kits"), exports), __exportStar(require("@visactor/vrender-animate"), exports),
31
31
  __exportStar(require("@visactor/vrender-components"), exports), __exportStar(require("./entries"), exports);
32
32
 
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAmD;AAa1C,0FAbA,wBAAS,OAaA;AAXL,QAAA,OAAO,GAAG,OAAO,CAAC;AAE/B,yDAAuC;AACvC,yDAAuC;AACvC,4DAA0C;AAC1C,+DAA6C;AAC7C,4CAA0B;AAC1B,mCAAuC;AAA9B,qGAAA,WAAW,OAAA;AAGpB,6DAAkD;AAAzC,wGAAA,KAAK,OAAA","file":"index.js","sourcesContent":["import { Direction } from '@visactor/vrender-core';\n// 导出版本号\nexport const version = \"1.1.5\";\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\nexport * from '@visactor/vrender-animate';\nexport * from '@visactor/vrender-components';\nexport * from './entries';\nexport { createStage } from './legacy';\n\n// avoid naming conflicts with 'State' & 'Direction' in '@visactor/vrender-components'\nexport { State } from '@visactor/vrender-animate';\nexport { Direction };\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAmD;AAa1C,0FAbA,wBAAS,OAaA;AAXL,QAAA,OAAO,GAAG,eAAe,CAAC;AAEvC,yDAAuC;AACvC,yDAAuC;AACvC,4DAA0C;AAC1C,+DAA6C;AAC7C,4CAA0B;AAC1B,mCAAuC;AAA9B,qGAAA,WAAW,OAAA;AAGpB,6DAAkD;AAAzC,wGAAA,KAAK,OAAA","file":"index.js","sourcesContent":["import { Direction } from '@visactor/vrender-core';\n// 导出版本号\nexport const version = \"1.1.6-alpha.0\";\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\nexport * from '@visactor/vrender-animate';\nexport * from '@visactor/vrender-components';\nexport * from './entries';\nexport { createStage } from './legacy';\n\n// avoid naming conflicts with 'State' & 'Direction' in '@visactor/vrender-components'\nexport { State } from '@visactor/vrender-animate';\nexport { Direction };\n"]}
package/dist/index.es.js CHANGED
@@ -2722,7 +2722,7 @@ class Node extends EventEmitter {
2722
2722
  constructor() {
2723
2723
  super(), this._uid = Generator.GenAutoIncrementId(), this._firstChild = null, this._lastChild = null, this.parent = null, this._count = 1;
2724
2724
  }
2725
- onParentSharedStateTreeChanged(_stage, _layer) {}
2725
+ onParentSharedStateTreeChanged(_stage, _layer, _inheritedSharedStateScope) {}
2726
2726
  forEachChildren(cb, reverse = !1) {
2727
2727
  if (reverse) {
2728
2728
  let child = this._lastChild,
@@ -8481,14 +8481,17 @@ class GraphicImpl extends Node {
8481
8481
  }
8482
8482
  return null === (_a = this.stage) || void 0 === _a ? void 0 : _a.rootSharedStateScope;
8483
8483
  }
8484
- syncSharedStateScopeBindingFromTree(markDirty = !0) {
8484
+ syncSharedStateScopeBinding(nextScope, markDirty = !0) {
8485
8485
  var _a;
8486
- const nextScope = this.resolveBoundSharedStateScope();
8487
8486
  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);
8488
8487
  }
8489
- syncSharedStateScopeBindingOnTreeChange(markDirty = !0) {
8488
+ syncSharedStateScopeBindingFromTree(markDirty = !0, inheritedSharedStateScope) {
8489
+ const nextScope = void 0 === inheritedSharedStateScope ? this.resolveBoundSharedStateScope() : null != inheritedSharedStateScope ? inheritedSharedStateScope : void 0;
8490
+ return this.syncSharedStateScopeBinding(nextScope, markDirty);
8491
+ }
8492
+ syncSharedStateScopeBindingOnTreeChange(markDirty = !0, inheritedSharedStateScope) {
8490
8493
  var _a, _b;
8491
- 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);
8494
+ 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);
8492
8495
  }
8493
8496
  syncSharedStateActiveRegistrations() {
8494
8497
  var _a;
@@ -8496,6 +8499,7 @@ class GraphicImpl extends Node {
8496
8499
  if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach(scope => {
8497
8500
  scope.subtreeActiveDescendants.delete(this);
8498
8501
  }), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
8502
+ if ((null == previousScopes ? void 0 : previousScopes.size) && this.isSharedStateScopeChainRegistered(previousScopes)) return;
8499
8503
  const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
8500
8504
  null == previousScopes || previousScopes.forEach(scope => {
8501
8505
  nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
@@ -8503,6 +8507,15 @@ class GraphicImpl extends Node {
8503
8507
  scope.subtreeActiveDescendants.add(this);
8504
8508
  }), this.registeredActiveScopes = nextScopes;
8505
8509
  }
8510
+ isSharedStateScopeChainRegistered(previousScopes) {
8511
+ let scope = this.boundSharedStateScope,
8512
+ scopeCount = 0;
8513
+ for (; scope;) {
8514
+ if (!previousScopes.has(scope)) return !1;
8515
+ scopeCount += 1, scope = scope.parentScope;
8516
+ }
8517
+ return scopeCount === previousScopes.size;
8518
+ }
8506
8519
  clearSharedStateActiveRegistrations() {
8507
8520
  const previousScopes = this.registeredActiveScopes;
8508
8521
  previousScopes && (previousScopes.forEach(scope => {
@@ -8512,8 +8525,8 @@ class GraphicImpl extends Node {
8512
8525
  markSharedStateDirty() {
8513
8526
  this.sharedStateDirty = !0, enqueueGraphicSharedStateRefresh(this.stage, this), scheduleStageSharedStateRefresh(this.stage);
8514
8527
  }
8515
- onParentSharedStateTreeChanged(stage, layer) {
8516
- this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
8528
+ onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
8529
+ this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope) : this.setStage(stage, layer, inheritedSharedStateScope);
8517
8530
  }
8518
8531
  refreshSharedStateBeforeRender() {
8519
8532
  var _a;
@@ -9164,6 +9177,10 @@ class GraphicImpl extends Node {
9164
9177
  var _a;
9165
9178
  return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
9166
9179
  }
9180
+ setStateDefinitionsWithCompiled(definitions, compiledDefinitions) {
9181
+ var _a;
9182
+ 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}`;
9183
+ }
9167
9184
  getStateResolveBaseAttrs() {
9168
9185
  var _a;
9169
9186
  return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
@@ -9511,12 +9528,12 @@ class GraphicImpl extends Node {
9511
9528
  this._globalTransMatrix.translate(scrollX, scrollY);
9512
9529
  }
9513
9530
  }
9514
- setStage(stage, layer) {
9531
+ setStage(stage, layer, inheritedSharedStateScope) {
9515
9532
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
9516
9533
  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,
9517
9534
  previousStage = this.stage;
9518
9535
  if (this.stage !== stage || this.layer !== layer) {
9519
- 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()) {
9536
+ 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()) {
9520
9537
  const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage),
9521
9538
  nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage),
9522
9539
  detachedStageAnimates = [];
@@ -9533,7 +9550,7 @@ class GraphicImpl extends Node {
9533
9550
  }
9534
9551
  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));
9535
9552
  }
9536
- ((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);
9553
+ ((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);
9537
9554
  }
9538
9555
  detachStageForRelease() {
9539
9556
  var _a, _b, _c;
@@ -12107,8 +12124,8 @@ class RichText extends Graphic {
12107
12124
  clone() {
12108
12125
  return new RichText(Object.assign({}, this.attribute));
12109
12126
  }
12110
- setStage(stage, layer) {
12111
- super.setStage(stage, layer);
12127
+ setStage(stage, layer, inheritedSharedStateScope) {
12128
+ super.setStage(stage, layer, inheritedSharedStateScope);
12112
12129
  this.getFrameCache().icons.forEach(icon => {
12113
12130
  icon.setStage(stage, layer);
12114
12131
  });
@@ -12812,13 +12829,13 @@ class Group extends Graphic {
12812
12829
  child.setStage(null, null);
12813
12830
  }), this.addUpdateBoundTag();
12814
12831
  }
12815
- setStage(stage, layer) {
12832
+ setStage(stage, layer, inheritedSharedStateScope) {
12816
12833
  var _a, _b, _c, _d, _e, _f;
12817
12834
  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,
12818
12835
  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;
12819
- 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();
12836
+ 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);
12820
12837
  const layerChanged = this.layer !== layer;
12821
- layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.notifyChildrenSharedStateTreeChanged();
12838
+ layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope), this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope)) : layerChanged && this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
12822
12839
  }
12823
12840
  addUpdatePositionTag() {
12824
12841
  super.addUpdatePositionTag(), this.forEachChildren(g => {
@@ -12877,17 +12894,26 @@ class Group extends Graphic {
12877
12894
  hasSharedStateDefinitions() {
12878
12895
  return !!this._sharedStateDefinitions && Object.keys(this._sharedStateDefinitions).length > 0;
12879
12896
  }
12880
- notifyChildrenSharedStateTreeChanged() {
12897
+ resolveChildSharedStateScope(inheritedSharedStateScope) {
12898
+ var _a;
12899
+ return this.sharedStateScope ? this.sharedStateScope : void 0 !== inheritedSharedStateScope ? inheritedSharedStateScope : null !== (_a = this.resolveBoundSharedStateScope()) && void 0 !== _a ? _a : null;
12900
+ }
12901
+ notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope) {
12902
+ const childSharedStateScope = this.resolveChildSharedStateScope(inheritedSharedStateScope);
12881
12903
  this.forEachChildren(item => {
12882
- this.syncChildSharedStateTreeBinding(item);
12904
+ this.setStageToChild(item, childSharedStateScope);
12883
12905
  });
12884
12906
  }
12885
- syncChildSharedStateTreeBinding(child) {
12886
- child.onParentSharedStateTreeChanged(this.stage, this.layer);
12907
+ setStageToChild(child, inheritedSharedStateScope) {
12908
+ const graphic = child;
12909
+ "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);
12887
12910
  }
12888
- onParentSharedStateTreeChanged(stage, layer) {
12911
+ syncChildSharedStateTreeBinding(child, inheritedSharedStateScope) {
12912
+ void 0 === inheritedSharedStateScope && (inheritedSharedStateScope = this.resolveChildSharedStateScope()), this.setStageToChild(child, inheritedSharedStateScope);
12913
+ }
12914
+ onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
12889
12915
  var _a;
12890
- 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);
12916
+ 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);
12891
12917
  }
12892
12918
  }
12893
12919
  Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
@@ -49939,7 +49965,7 @@ const DEFAULT_STATES = {
49939
49965
  loadDiscreteLegendComponent();
49940
49966
  class DiscreteLegend extends LegendBase {
49941
49967
  constructor(attributes, options) {
49942
- 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 => {
49968
+ 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 => {
49943
49969
  const target = e.target;
49944
49970
  if (target && target.name && target.name.startsWith(LEGEND_ELEMENT_NAME.item)) {
49945
49971
  const legendItem = target.delegate;
@@ -49987,7 +50013,7 @@ class DiscreteLegend extends LegendBase {
49987
50013
  };
49988
50014
  }
49989
50015
  render() {
49990
- super.render(), this._lastActiveItem = null;
50016
+ this._stateDefinitionsCache = new WeakMap(), super.render(), this._lastActiveItem = null;
49991
50017
  }
49992
50018
  setSelected(selectedData) {
49993
50019
  var _a;
@@ -50167,7 +50193,7 @@ class DiscreteLegend extends LegendBase {
50167
50193
  }), this._appendDataToShape(itemGroup, LEGEND_ELEMENT_NAME.item, item, itemGroup)) : (itemGroup = graphicCreator.group(Object.assign({
50168
50194
  x: 0,
50169
50195
  y: 0
50170
- }, 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);
50196
+ }, 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);
50171
50197
  const innerGroup = graphicCreator.group({
50172
50198
  x: 0,
50173
50199
  y: 0,
@@ -50190,7 +50216,7 @@ class DiscreteLegend extends LegendBase {
50190
50216
  Object.keys(shapeStyle.state || {}).forEach(key => {
50191
50217
  const color = shapeStyle.state[key].fill || shapeStyle.state[key].stroke;
50192
50218
  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);
50193
- }), this._appendDataToShape(itemShape, LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state), itemShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(itemShape);
50219
+ }), this._appendDataToShape(itemShape, LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state, !1), itemShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(itemShape);
50194
50220
  }
50195
50221
  let focusSpace = 0;
50196
50222
  if (focus) {
@@ -50217,7 +50243,7 @@ class DiscreteLegend extends LegendBase {
50217
50243
  _originText: labelAttr.formatMethod ? label : void 0
50218
50244
  }),
50219
50245
  labelShape = createTextGraphicByType(labelAttributes);
50220
- this._appendDataToShape(labelShape, LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state), labelShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(labelShape);
50246
+ this._appendDataToShape(labelShape, LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state, labelStyle.reuseStateDefinitions), labelShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(labelShape);
50221
50247
  const labelSpace = get$1(labelAttr, "space", DEFAULT_LABEL_SPACE);
50222
50248
  if (isValid$1(value)) {
50223
50249
  const valueSpace = get$1(valueAttr, "space", focus ? DEFAULT_VALUE_SPACE : 0),
@@ -50233,7 +50259,7 @@ class DiscreteLegend extends LegendBase {
50233
50259
  _originText: valueAttr.formatMethod ? value : void 0
50234
50260
  }),
50235
50261
  valueShape = createTextGraphicByType(valueAttributes);
50236
- if (this._appendDataToShape(valueShape, LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state), valueShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), this._itemWidthByUser) {
50262
+ if (this._appendDataToShape(valueShape, LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state, valueStyle.reuseStateDefinitions), valueShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), this._itemWidthByUser) {
50237
50263
  const layoutWidth = this._itemWidthByUser - parsedPadding[1] - parsedPadding[3] - shapeSize - shapeSpace - labelSpace - focusSpace - valueSpace;
50238
50264
  this._autoEllipsis(autoEllipsisStrategy, layoutWidth, labelShape, valueShape), valueAttr.alignRight ? valueShape.setAttributes({
50239
50265
  textAlign: "right",
@@ -50663,8 +50689,17 @@ class DiscreteLegend extends LegendBase {
50663
50689
  item.hasState(LegendStateValue.selected) && selectedData.push(item.data);
50664
50690
  }), selectedData;
50665
50691
  }
50666
- _appendDataToShape(shape, name, data, delegateShape, states = {}) {
50667
- shape.name = name, shape.data = data, shape.delegate = delegateShape, shape.states = merge({}, DEFAULT_STATES, states);
50692
+ _appendDataToShape(shape, name, data, delegateShape, states, reuseStateDefinitions = !0) {
50693
+ if (shape.name = name, shape.data = data, shape.delegate = delegateShape, !reuseStateDefinitions) return void (shape.states = merge({}, DEFAULT_STATES, states));
50694
+ const source = null != states ? states : DEFAULT_STATES,
50695
+ cached = this._stateDefinitionsCache.get(source);
50696
+ if (cached) return shape.states = cached.definitions, void shape.setStateDefinitionsWithCompiled(cached.definitions, cached.compiledDefinitions);
50697
+ const definitions = states ? merge({}, DEFAULT_STATES, states) : DEFAULT_STATES,
50698
+ entry = {
50699
+ definitions: definitions,
50700
+ compiledDefinitions: new StateDefinitionCompiler().compile(definitions)
50701
+ };
50702
+ this._stateDefinitionsCache.set(source, entry), shape.states = entry.definitions, shape.setStateDefinitionsWithCompiled(entry.definitions, entry.compiledDefinitions);
50668
50703
  }
50669
50704
  _dispatchLegendEvent(eventName, legendItem, event) {
50670
50705
  const currentSelectedItems = this._getSelectedLegends();
@@ -50681,12 +50716,17 @@ class DiscreteLegend extends LegendBase {
50681
50716
  }
50682
50717
  _handleStyle(config, item, isSelected, index, items) {
50683
50718
  const newConfig = {};
50684
- 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 => {
50685
- config.state[key] && (isFunction$1(config.state[key]) ? newConfig.state[key] = config.state[key](item, isSelected, index, items) : newConfig.state[key] = config.state[key]);
50686
- })), newConfig;
50719
+ if (config.style && (isFunction$1(config.style) ? newConfig.style = config.style(item, isSelected, index, items) : newConfig.style = config.style), config.state) {
50720
+ const stateKeys = Object.keys(config.state),
50721
+ hasStateFunction = stateKeys.some(key => isFunction$1(config.state[key]));
50722
+ newConfig.reuseStateDefinitions = !hasStateFunction, hasStateFunction ? (newConfig.state = {}, stateKeys.forEach(key => {
50723
+ config.state[key] && (newConfig.state[key] = isFunction$1(config.state[key]) ? config.state[key](item, isSelected, index, items) : config.state[key]);
50724
+ })) : newConfig.state = config.state;
50725
+ }
50726
+ return newConfig;
50687
50727
  }
50688
50728
  release() {
50689
- super.release(), this.removeAllEventListeners();
50729
+ this._stateDefinitionsCache = new WeakMap(), super.release(), this.removeAllEventListeners();
50690
50730
  }
50691
50731
  }
50692
50732
  DiscreteLegend.defaultAttributes = {
@@ -55568,6 +55608,6 @@ function createStage(params) {
55568
55608
  return resolveLegacyApp().createStage(params);
55569
55609
  }
55570
55610
 
55571
- const version = "1.1.5";
55611
+ const version = "1.1.6-alpha.0";
55572
55612
 
55573
55613
  export { AComponentAnimate, ACustomAnimate, APPLICATION_STATE_SYMBOL, ARC3D_NUMBER_TYPE, ARC_NUMBER_TYPE, AREA_NUMBER_TYPE, AStageAnimate, AXIS_ELEMENT_NAME, AbstractComponent, AbstractGraphicRender, Animate, AnimateExecutor, AnimateMode, AnimateStatus, Step as AnimateStep, AnimateStepType, AnimationStateManager, AnimationStateStore, AnimationStates, AnimationTransitionRegistry, AppContext, Application, Arc, Arc3d, Arc3dRender, ArcInfo, ArcLabel, ArcRender, ArcRenderContribution, ArcSegment, Area, AreaRender, AreaRenderContribution, AttributeUpdateType, AutoEnablePlugins, AxisStateValue, Base3dRender, BaseCanvas, BaseEnvContribution, BasePlayer, BaseRender, BaseRenderContributionTime, BaseWindowHandlerContribution, Basis, BeforeRenderConstribution, BoundsContext, BoundsPicker, BrowserEntry, BrowserEnvContribution, Brush, CIRCLE_NUMBER_TYPE, CONTRIBUTION_STORE_STATE_SYMBOL, Canvas3DDrawItemInterceptor, Canvas3DPickItemInterceptor, CanvasArc3dPicker, CanvasArcPicker, CanvasAreaPicker, CanvasCirclePicker, CanvasFactory, CanvasGifImagePicker, CanvasGlyphPicker, CanvasGroupPicker, CanvasImagePicker, CanvasLinePicker, CanvasLottiePicker, CanvasPathPicker, CanvasPickerContribution, CanvasPolygonPicker, CanvasPyramid3dPicker, CanvasRect3dPicker, CanvasRectPicker, CanvasRichTextPicker, CanvasStarPicker, CanvasSymbolPicker, CanvasTextLayout, CanvasTextPicker, CheckBox, Circle, CircleAxis, CircleAxisGrid, CircleCrosshair, CircleRender, CircleRenderContribution, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipIn, ClipOut, ClipRadiusAnimate, ColorContinuousLegend, ColorInterpolate, ColorStore, ColorType, CommonDrawItemInterceptorContribution, CommonRenderContribution, ComponentAnimator, Context2dFactory, ContinuousPlayer, ContributionProvider, ContributionRegistry, ContributionStore, CubicBezierCurve, CurveContext, CurveTypeEnum, CustomEvent, CustomPath2D, CustomSymbolClass, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TEXT_FONT_FAMILY$1 as DEFAULT_TEXT_FONT_FAMILY, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DebugDrawItemInterceptorContribution, DefaultArcAllocate, DefaultArcAttribute, DefaultArcRenderContribution, DefaultAreaAllocate, DefaultAreaAttribute, DefaultAreaTextureRenderContribution, DefaultAttribute, DefaultBaseBackgroundRenderContribution, DefaultBaseClipRenderAfterContribution, DefaultBaseClipRenderBeforeContribution, DefaultBaseInteractiveRenderContribution, DefaultBaseTextureRenderContribution, DefaultCanvasAllocate, DefaultCanvasArc3DRender, DefaultCanvasArcRender, DefaultCanvasAreaRender, DefaultCanvasCircleRender, DefaultCanvasGroupRender, DefaultCanvasImageRender, DefaultCanvasLineRender, DefaultCanvasPathRender, DefaultCanvasPolygonRender, DefaultCanvasPyramid3dRender, DefaultCanvasRect3dRender, DefaultCanvasRectRender, DefaultCanvasSymbolRender, DefaultCanvasTextRender, DefaultCircleAllocate, DefaultCircleAttribute, DefaultCircleRenderContribution, DefaultConnectAttribute, DefaultDebugAttribute, DefaultFillStyle, DefaultGlobal, DefaultGlobalPickerService, DefaultGlyphAttribute, DefaultGraphicAllocate, DefaultGraphicMemoryManager, DefaultGraphicService, DefaultGraphicUtil, DefaultGroupAttribute, DefaultGroupBackgroundRenderContribution, DefaultImageAttribute, DefaultImageRenderContribution, DefaultLayerService, DefaultLayout, DefaultLineAllocate, DefaultLineAttribute, DefaultMat4Allocate, DefaultMatrixAllocate, DefaultPathAllocate, DefaultPathAttribute, DefaultPickService, DefaultPickStyle, DefaultPolygonAttribute, DefaultRect3dAttribute, DefaultRectAllocate, DefaultRectAttribute, DefaultRectRenderContribution, DefaultRenderService, DefaultRichTextAttribute, DefaultRichTextIconAttribute, DefaultStarAttribute, DefaultStrokeStyle, DefaultStyle, DefaultSymbolAllocate, DefaultSymbolAttribute, DefaultSymbolClipRangeStrokeRenderContribution, DefaultSymbolRenderContribution, DefaultTextAllocate, DefaultTextAttribute, DefaultTextMeasureContribution, DefaultTextStyle, DefaultTicker, DefaultTimeline, DefaultTransform, DefaultTransformUtil, DefaultWindow, Direction, DirectionEnum, DirectionalLight, DiscreteLegend, DiscretePlayer, Dissolve, Distortion, DragNDrop, DrawContribution, DrawItemInterceptor, DynamicLayerHandlerContribution, Easing, Edge, EditModule, EmptyContext2d, EmptyTip, EnvContribution, EventManager, EventSystem, EventTarget, FACTORY_STATE_SYMBOL, FORMAT_ALL_TEXT_COMMAND, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, Factory, FadeIn, FadeOut, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FlexLayoutPlugin, Fragment, FromTo, GLYPH_NUMBER_TYPE, GRAPHIC_CLASS_SYMBOL, GRAPHIC_REGISTRY_SYMBOL, GRAPHIC_UPDATE_TAG_KEY, GROUP_NUMBER_TYPE, GaussianBlur, Generator, Gesture, GifImage, Glitch, GlobalPickerService, Glyph, GlyphRender, GradientParser, Graphic, GraphicCreator$1 as GraphicCreator, GraphicFactory, GraphicPicker, GraphicRender, GraphicService, GraphicStateExtension, GraphicUtil, Grayscale, Group, GroupFadeIn, GroupFadeOut, GroupRender, GroupRenderContribution, GroupTransition, GroupUpdateAABBBoundsMode, GrowAngleIn, GrowAngleOut, GrowCenterIn, GrowCenterOut, GrowHeightIn, GrowHeightOut, GrowIn, GrowOut, GrowPointsIn, GrowPointsOut, GrowPointsXIn, GrowPointsXOut, GrowPointsYIn, GrowPointsYOut, GrowRadiusIn, GrowRadiusOut, GrowWidthIn, GrowWidthOut, HtmlAttributePlugin, IContainPointMode, IDataZoomEvent, IDataZoomInteractiveEvent, IMAGE_NUMBER_TYPE, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Image$1 as Image, ImageRender, ImageRenderContribution, IncreaseCount, IncrementalDrawContribution, Indicator, InputRichText, InputText, InteractiveDrawItemInterceptorContribution, InteractivePickItemInterceptorContribution, InteractiveSubRenderContribution, LEGEND_ELEMENT_NAME, LINE_NUMBER_TYPE, LabelBase, LabelItemAppear, LabelItemDisappear, Layer, LayerFactory, LayerService, LegendEvent, LegendStateValue, Line$1 as Line, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LineRender, Linear, LinearClosed, LinkPath, Lottie, ManualTicker, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Mat4Allocate, MathArcPicker, MathAreaPicker, MathCirclePicker, MathGlyphPicker, MathImagePicker, MathLinePicker, MathPathPicker, MathPickerContribution, MathPolygonPicker, MathRectPicker, MathRichTextPicker, MathSymbolPicker, MathTextPicker, MatrixAllocate, MeasureModeEnum, MiniappEntry, MonotoneX, MonotoneY, MorphingPath, MotionPath, MoveIn, MoveOut, MoveRotateIn, MoveRotateOut, MoveScaleIn, MoveScaleOut, MultiToOneMorphingPath, NOWORK_ANIMATE_ATTR, Node, NodeEntry, OrthoCamera, OutputRichText, PATH_NUMBER_TYPE, POLYGON_NUMBER_TYPE, PURE_STYLE_KEY, PYRAMID3D_NUMBER_TYPE, Pager, Particle, Path, PathRender, PathRenderContribution, PerformanceRAF, PickItemInterceptor, PickServiceInterceptor, PickerRegistry, PickerService, Pixelation, PlayerEventEnum, PluginRegistry, PluginService, Polygon, PolygonCrosshair, PolygonRender, PolygonRenderContribution, PolygonSectorCrosshair, PopTip, PoptipAppear, PoptipDisappear, PulseAnimate, Pyramid3d, Pyramid3dRender, REACT_TO_CANOPUS_EVENTS, REACT_TO_CANOPUS_EVENTS_LIST, RECT3D_NUMBER_TYPE, RECT_NUMBER_TYPE, RICHTEXT_NUMBER_TYPE, RUNTIME_INSTALLER_STATE_SYMBOL, Radio, RafBasedSTO, ReactAttributePlugin, Rect, Rect3DRender, Rect3d, RectCrosshair, RectLabel, RectRender, RectRenderContribution, ReflectSegContext, RenderSelector, RenderService, RendererRegistry, ResourceLoader, RichText, RichTextEditPlugin, RichTextRender, RotateBySphereAnimate, RotateIn, RotateOut, SLIDER_ELEMENT_NAME, STAR_NUMBER_TYPE, STATUS$1 as STATUS, SVG_ATTRIBUTE_MAP, SVG_ATTRIBUTE_MAP_KEYS, SVG_PARSE_ATTRIBUTE_MAP, SVG_PARSE_ATTRIBUTE_MAP_KEYS, SYMBOL_NUMBER_TYPE, ScaleIn, ScaleOut, ScrollBar, SectorCrosshair, SegContext, Segment, SeriesNumberCellStateValue, SeriesNumberEvent, ShadowPickServiceInterceptorContribution, ShadowRoot, ShadowRootDrawItemInterceptorContribution, ShadowRootPickItemInterceptorContribution, SizeContinuousLegend, SlideIn, SlideOut, SlideOutRichText, SlideRichText, Slider, SpinIn, SpinOut, SplitRectAfterRenderContribution, SplitRectBeforeRenderContribution, Stage, StageFactory, Star, StarRender, StarRenderContribution, State, StateDefinitionCompiler, StateEngine, StaticLayerHandlerContribution, Step$1 as Step, StepClosed, StoryLabelItem, StreamLight, StrokeIn, StrokeOut, Switch, Symbol$1 as Symbol, SymbolLabel, SymbolRender, SymbolRenderContribution, TEXT_NUMBER_TYPE, TableSeriesNumber, Tag, TagPointsUpdate, Text, TextDirection, TextMeasureContribution, TextRender, TextRenderContribution, Theme, Timeline, Title, Tooltip, TopZIndex, TransformUtil, Update, UpdateTag, VArc, VArc3d, VArea, VCircle, VGlobal, VGlyph, VGroup, VImage, VLine, VPath, VPolygon, VPyramid3d, VRect, VRect3d, VRichText, VSymbol, VTag, VText, VWindow, ViewTransform3dPlugin, VirtualLayerHandlerContribution, WILDCARD, WeatherBox, WindowHandlerContribution, WrapText, XMLParser, _calculateLineHeight, _interpolateColor, _registerArc, acquireSharedVRenderApp, addArcToBezierPath$1 as addArcToBezierPath, addAttributeToPrototype, alignBezierCurves, alignSubpath, alignTextInLine, alternatingWave, angle, angleLabelOrientAttribute, angleTo, application, applyTransformOnBezierCurves, arc3dModule, arcModule, areaModule, bezier, bezierCurversToPath, binarySplitPolygon, bindArc3dCanvasPickerContribution, bindArc3dRenderModule, bindArcCanvasPickerContribution, bindArcMathPickerContribution, bindArcRenderModule, bindAreaCanvasPickerContribution, bindAreaMathPickerContribution, bindAreaRenderModule, bindBrowserEnv, bindCircleCanvasPickerContribution, bindCircleMathPickerContribution, bindCircleRenderModule, bindContributionProvider, bindContributionProviderNoSingletonScope, bindFeishuEnv, bindGifImageCanvasPickerContribution, bindGifImageRenderContribution, bindGlyphCanvasPickerContribution, bindGlyphMathPickerContribution, bindGlyphRenderModule, bindHarmonyEnv, bindImageCanvasPickerContribution, bindImageMathPickerContribution, bindImageRenderModule, bindLineCanvasPickerContribution, bindLineMathPickerContribution, bindLineRenderModule, bindLottieCanvasPickerContribution, bindLottieRenderContribution, bindLynxEnv, bindMathPicker, bindNodeEnv, bindPathCanvasPickerContribution, bindPathMathPickerContribution, bindPathRenderModule, bindPolygonCanvasPickerContribution, bindPolygonMathPickerContribution, bindPolygonRenderModule, bindPyramid3dCanvasPickerContribution, bindPyramid3dRenderModule, bindRect3dCanvasPickerContribution, bindRect3dRenderModule, bindRectCanvasPickerContribution, bindRectMathPickerContribution, bindRectRenderModule, bindRichTextMathPickerContribution, bindRichtextCanvasPickerContribution, bindRichtextRenderModule, bindStarRenderModule, bindSymbolCanvasPickerContribution, bindSymbolMathPickerContribution, bindSymbolRenderModule, bindTTEnv, bindTaroEnv, bindTextCanvasPickerContribution, bindTextMathPickerContribution, bindTextRenderModule, bindWxEnv, bootstrapLegacyVRenderRuntime, bootstrapVRenderBrowserApp, bootstrapVRenderMiniApp, bootstrapVRenderNodeApp, boundStroke, builtInSymbolStrMap, builtinSymbols, builtinSymbolsMap, calcLineCache, calculateArcCornerRadius, calculateLineHeight, canvasAllocate, cartesianTicks, centerToCorner, centroidOfSubpath, circleBounds, circleModule, clampRadian, clock, colorEqual, colorStringInterpolationToStr, columnCenterToEdge, columnEdgeToCenter, columnLeftToRight, columnRightToLeft, computeOffsetForlimit, configureRuntimeApplicationForApp, container, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, cornerTangents, cornerToCenter, createBrowserApp as createApp, createArc, createArc3d, createArea, createBrowserApp, createBrowserVRenderApp, createCanvasEventTransformer, createCircle, createColor, createComponentAnimator, createConicalGradient, createContributionProvider$1 as createContributionProvider, createEventTransformer, createFeishuVRenderApp, createGifImage, createGlyph, createGraphic$1 as createGraphic, createGroup, createHarmonyVRenderApp, createImage, createImageElement$1 as createImageElement, createLine, createLottie, createLynxVRenderApp, createMat4, createMiniappApp$1 as createMiniappApp, createNodeApp$1 as createNodeApp, createNodeVRenderApp, createPath, createPolygon, createPyramid3d, createRect, createRect3d, createRectPath, createRichText, createShadowRoot, createStage, createStar, createSymbol, createTTVRenderApp, createTaroVRenderApp, createText, createTextGraphicByType, createWrapText, createWxVRenderApp, cubicCalc, cubicLength, cubicPointAt, cubicSubdivide, decodeReactDom, defaultArcAllocate, defaultArcBackgroundRenderContribution, defaultArcRenderContribution, defaultArcTextureRenderContribution, defaultAreaAllocate, defaultBaseBackgroundRenderContribution, defaultBaseClipRenderAfterContribution, defaultBaseClipRenderBeforeContribution, defaultBaseTextureRenderContribution, defaultCircleAllocate, defaultCircleBackgroundRenderContribution, defaultCircleRenderContribution, defaultCircleTextureRenderContribution, defaultGraphicMemoryManager, defaultGroupBackgroundRenderContribution, defaultImageBackgroundRenderContribution, defaultImageRenderContribution, defaultLineAllocate, defaultPathAllocate, defaultRectAllocate, defaultRectBackgroundRenderContribution, defaultRectRenderContribution, defaultRectTextureRenderContribution, defaultStarBackgroundRenderContribution, defaultStarTextureRenderContribution, defaultSymbolAllocate, defaultSymbolBackgroundRenderContribution, defaultSymbolClipRangeStrokeRenderContribution, defaultSymbolRenderContribution, defaultSymbolTextureRenderContribution, defaultTextAllocate, defaultTicker, defaultTimeline, deltaXYToAngle, diagonalCenterToEdge, diagonalTopLeftToBottomRight, diff, divideCubic, drawArc, drawArcPath$1 as drawArcPath, drawAreaSegments, drawBackgroundImage, drawImageWithLayout, drawIncrementalAreaSegments, drawIncrementalSegments, drawSegments, enumCommandMap, fillVisible, findBestMorphingRotation, findConfigIndexByCursorIdx, findCursorIdxByConfigIndex, findNextGraphic, flatten_simplify, foreach, foreachAsync, fuzzyEqualNumber, genBasisSegments, genBasisTypeSegments, genLinearClosedSegments, genLinearClosedTypeSegments, genLinearSegments, genLinearTypeSegments, genMonotoneXSegments, genMonotoneXTypeSegments, genMonotoneYSegments, genMonotoneYTypeSegments, genNumberType, genStepClosedSegments, genStepSegments, genStepTypeSegments, generatorPathEasingFunc, getApplicationState, getAttributeFromDefaultAttrList, getAxisBreakSymbolAttrs, getBackgroundImage, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getConicGradientAt, getContributionStoreState, getCurrentEnv, getDefaultCharacterConfig, getElMap, getExtraModelMatrix, getFactoryState, getGraphicClassState, getGraphicRegistryState, getHorizontalPath, getLegacyBindingContext, getMarksByName, getModelMatrix, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getRichTextBounds, getRuntimeInstallerBindingContext, getRuntimeInstallerGlobal, getRuntimeInstallerState, getScaledStroke, getSharedVRenderApp, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextBounds, getTextType, getTheme, getThemeFromGroup, getVerticalCoord, getVerticalPath, globalTheme, glyphModule, graphicCreator$1 as graphicCreator, graphicService, graphicUtil, hasOverlap, htmlAttributeTransform, identityMat4, imageModule, incrementalAddTo, initAllEnv, initBrowserEnv, initFeishuEnv, initHarmonyEnv, initLynxEnv, initNodeEnv, initTTEnv, initTaroEnv, initTextMeasure, initWxEnv, installBrowserEnvToApp, installBrowserPickersToApp, installDefaultGraphicsToApp, installFeishuEnvToApp, installHarmonyEnvToApp, installLynxEnvToApp, installMathPickersToApp, installNodeEnvToApp, installNodePickersToApp, installPoptipToApp, installRuntimeContributionModule, installRuntimeDrawContributionsToApp, installRuntimeGraphicRenderersToApp, installRuntimePickersToApp, installScrollbarToApp, installTTEnvToApp, installTaroEnvToApp, installWxEnvToApp, interpolateColor, interpolateGradientConicalColor, interpolateGradientLinearColor, interpolateGradientRadialColor, interpolatePureColorArray, interpolatePureColorArrayToStr, intersect, isBrowserEnv, isInRange, isNoRepeatSizingMode, isNodeEnv, isPostiveXAxis, isRichText, isSvg, isVisible, isXML, jsx, labelSmartInvert, layerService, length, limitShapeInBounds, lineModule, linearDiscreteTicks, loadAllEnv, loadAllModule, loadBrowserEnv, loadFeishuEnv, loadHarmonyEnv, loadLynxEnv, loadMathPicker, loadNodeEnv, loadPoptip, loadScrollbar, loadTTEnv, loadTaroEnv, loadWxEnv, lookAt, mapToCanvasPointForCanvas, mat3Tomat4, mat4Allocate, matrixAllocate, measureTextSize, morphPath, multiToOneMorph, multiplyMat4Mat3, multiplyMat4Mat4, newThemeObj, normalize$1 as normalize, oneToMultiMorph, ortho, parsePadding, parseStroke, parseSvgPath, particleEffect, pathModule, pathToBezierCurves, point$3 as point, pointEqual, pointInterpolation, pointInterpolationHighPerformance, pointsEqual, pointsInterpolation, polarAngleAxisDiscreteTicks, polarTicks, polygonModule, preLoadAllModule, pulseWave, pyramid3dModule, quadCalc, quadLength, quadPointAt, rafBasedSto, randomOpacity, reactAttributeTransform, rect3dModule, rectFillVisible, rectModule, rectStrokeVisible, recursiveCallBinarySplit, refreshRuntimeInstallerContributions, registerAnimate, registerArc, registerArc3d, registerArc3dGraphic, registerArcDataLabel, registerArcGraphic, registerArea, registerAreaGraphic, registerCircle, registerCircleGraphic, registerCustomAnimate, registerDirectionalLight, registerFlexLayoutPlugin, registerGifGraphic, registerGifImage, registerGlobalEventTransformer, registerGlyph, registerGlyphGraphic, registerGraphic, registerGroup, registerGroupGraphic, registerHtmlAttributePlugin, registerImage, registerImageGraphic, registerLine, registerLineDataLabel, registerLineGraphic, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerOrthoCamera, registerPath, registerPathGraphic, registerPolygon, registerPolygonGraphic, registerPyramid3d, registerPyramid3dGraphic, registerReactAttributePlugin, registerRect, registerRect3d, registerRect3dGraphic, registerRectDataLabel, registerRectGraphic, registerRichtext, registerRichtextGraphic, registerShadowRoot, registerShadowRootGraphic, registerStar, registerStarGraphic, registerSymbol, registerSymbolDataLabel, registerSymbolGraphic, registerText, registerTextGraphic, registerViewTransform3dPlugin, registerWindowEventTransformer, registerWrapText, registerWrapTextGraphic, releaseSharedVRenderApp, removeRepeatPoint, renderCommandList, resolveBackgroundDrawMode, resolveBackgroundParamsByImageSizing, resolveBackgroundPosition, resolveBackgroundSizing, resolveContainerBinding$1 as resolveContainerBinding, resolveImageMode, resolveImageRepeatMode, resolveRenderableImageSize, rewriteProto, richTextAttributeTransform, richtextModule, rippleEffect, rotateX, rotateY, rotateZ, rotationScan, roughModule, rowBottomToTop, rowCenterToEdge, rowEdgeToCenter, rowTopToBottom, runFill, runStroke, scale, scaleMat4, segments, setPoptipTheme, shouldClipImageByLayout, shouldUseMat4, smartInvertStrategy, snakeWave, snapLength, spiralEffect, splitArc, splitArea, splitCircle, splitLine, splitPath, splitPolygon, splitRect, splitToGrids, starModule, strCommandMap, strokeVisible, symbolModule, tan2AngleToAngle, textAttributesToStyle, textDrawOffsetX, textDrawOffsetY, textIntersect, textLayoutOffsetY, textModule, ticks, transformMat4, transformPointForCanvas, transformUtil, transitionRegistry, translate, traverseGroup, version, verticalLayout, vglobal, waitForAllSubLayers, wrapCanvas, wrapContext, xul };
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;
@@ -12113,8 +12130,8 @@
12113
12130
  clone() {
12114
12131
  return new RichText(Object.assign({}, this.attribute));
12115
12132
  }
12116
- setStage(stage, layer) {
12117
- super.setStage(stage, layer);
12133
+ setStage(stage, layer, inheritedSharedStateScope) {
12134
+ super.setStage(stage, layer, inheritedSharedStateScope);
12118
12135
  this.getFrameCache().icons.forEach(icon => {
12119
12136
  icon.setStage(stage, layer);
12120
12137
  });
@@ -12818,13 +12835,13 @@
12818
12835
  child.setStage(null, null);
12819
12836
  }), this.addUpdateBoundTag();
12820
12837
  }
12821
- setStage(stage, layer) {
12838
+ setStage(stage, layer, inheritedSharedStateScope) {
12822
12839
  var _a, _b, _c, _d, _e, _f;
12823
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,
12824
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;
12825
- 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);
12826
12843
  const layerChanged = this.layer !== layer;
12827
- 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);
12828
12845
  }
12829
12846
  addUpdatePositionTag() {
12830
12847
  super.addUpdatePositionTag(), this.forEachChildren(g => {
@@ -12883,17 +12900,26 @@
12883
12900
  hasSharedStateDefinitions() {
12884
12901
  return !!this._sharedStateDefinitions && Object.keys(this._sharedStateDefinitions).length > 0;
12885
12902
  }
12886
- 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);
12887
12909
  this.forEachChildren(item => {
12888
- this.syncChildSharedStateTreeBinding(item);
12910
+ this.setStageToChild(item, childSharedStateScope);
12889
12911
  });
12890
12912
  }
12891
- syncChildSharedStateTreeBinding(child) {
12892
- 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);
12893
12916
  }
12894
- onParentSharedStateTreeChanged(stage, layer) {
12917
+ syncChildSharedStateTreeBinding(child, inheritedSharedStateScope) {
12918
+ void 0 === inheritedSharedStateScope && (inheritedSharedStateScope = this.resolveChildSharedStateScope()), this.setStageToChild(child, inheritedSharedStateScope);
12919
+ }
12920
+ onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
12895
12921
  var _a;
12896
- 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);
12897
12923
  }
12898
12924
  }
12899
12925
  Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
@@ -49945,7 +49971,7 @@
49945
49971
  loadDiscreteLegendComponent();
49946
49972
  class DiscreteLegend extends LegendBase {
49947
49973
  constructor(attributes, options) {
49948
- 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 => {
49949
49975
  const target = e.target;
49950
49976
  if (target && target.name && target.name.startsWith(exports.LEGEND_ELEMENT_NAME.item)) {
49951
49977
  const legendItem = target.delegate;
@@ -49993,7 +50019,7 @@
49993
50019
  };
49994
50020
  }
49995
50021
  render() {
49996
- super.render(), this._lastActiveItem = null;
50022
+ this._stateDefinitionsCache = new WeakMap(), super.render(), this._lastActiveItem = null;
49997
50023
  }
49998
50024
  setSelected(selectedData) {
49999
50025
  var _a;
@@ -50173,7 +50199,7 @@
50173
50199
  }), this._appendDataToShape(itemGroup, exports.LEGEND_ELEMENT_NAME.item, item, itemGroup)) : (itemGroup = graphicCreator.group(Object.assign({
50174
50200
  x: 0,
50175
50201
  y: 0
50176
- }, 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);
50177
50203
  const innerGroup = graphicCreator.group({
50178
50204
  x: 0,
50179
50205
  y: 0,
@@ -50196,7 +50222,7 @@
50196
50222
  Object.keys(shapeStyle.state || {}).forEach(key => {
50197
50223
  const color = shapeStyle.state[key].fill || shapeStyle.state[key].stroke;
50198
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);
50199
- }), 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);
50200
50226
  }
50201
50227
  let focusSpace = 0;
50202
50228
  if (focus) {
@@ -50223,7 +50249,7 @@
50223
50249
  _originText: labelAttr.formatMethod ? label : void 0
50224
50250
  }),
50225
50251
  labelShape = createTextGraphicByType(labelAttributes);
50226
- 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);
50227
50253
  const labelSpace = get$1(labelAttr, "space", DEFAULT_LABEL_SPACE);
50228
50254
  if (isValid$1(value)) {
50229
50255
  const valueSpace = get$1(valueAttr, "space", focus ? DEFAULT_VALUE_SPACE : 0),
@@ -50239,7 +50265,7 @@
50239
50265
  _originText: valueAttr.formatMethod ? value : void 0
50240
50266
  }),
50241
50267
  valueShape = createTextGraphicByType(valueAttributes);
50242
- 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) {
50243
50269
  const layoutWidth = this._itemWidthByUser - parsedPadding[1] - parsedPadding[3] - shapeSize - shapeSpace - labelSpace - focusSpace - valueSpace;
50244
50270
  this._autoEllipsis(autoEllipsisStrategy, layoutWidth, labelShape, valueShape), valueAttr.alignRight ? valueShape.setAttributes({
50245
50271
  textAlign: "right",
@@ -50669,8 +50695,17 @@
50669
50695
  item.hasState(exports.LegendStateValue.selected) && selectedData.push(item.data);
50670
50696
  }), selectedData;
50671
50697
  }
50672
- _appendDataToShape(shape, name, data, delegateShape, states = {}) {
50673
- 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);
50674
50709
  }
50675
50710
  _dispatchLegendEvent(eventName, legendItem, event) {
50676
50711
  const currentSelectedItems = this._getSelectedLegends();
@@ -50687,12 +50722,17 @@
50687
50722
  }
50688
50723
  _handleStyle(config, item, isSelected, index, items) {
50689
50724
  const newConfig = {};
50690
- 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 => {
50691
- config.state[key] && (isFunction$1(config.state[key]) ? newConfig.state[key] = config.state[key](item, isSelected, index, items) : newConfig.state[key] = config.state[key]);
50692
- })), 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;
50693
50733
  }
50694
50734
  release() {
50695
- super.release(), this.removeAllEventListeners();
50735
+ this._stateDefinitionsCache = new WeakMap(), super.release(), this.removeAllEventListeners();
50696
50736
  }
50697
50737
  }
50698
50738
  DiscreteLegend.defaultAttributes = {
@@ -55574,7 +55614,7 @@
55574
55614
  return resolveLegacyApp().createStage(params);
55575
55615
  }
55576
55616
 
55577
- const version = "1.1.5";
55617
+ const version = "1.1.6-alpha.0";
55578
55618
 
55579
55619
  exports.AComponentAnimate = AComponentAnimate;
55580
55620
  exports.ACustomAnimate = ACustomAnimate;