@visactor/react-vchart 2.1.4 → 2.1.5-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +96 -41
- package/build/index.min.js +1 -1
- package/cjs/components/Indicator.js +2 -1
- package/cjs/components/MarkArea.js +1 -2
- package/cjs/components/ScrollBar.js +1 -1
- package/cjs/components/Title.js +1 -1
- package/cjs/context/chart.js +1 -1
- package/cjs/context/stage.js +1 -1
- package/esm/components/Indicator.js +2 -1
- package/esm/components/MarkArea.js +1 -2
- package/esm/components/ScrollBar.js +1 -1
- package/esm/components/Title.js +1 -1
- package/esm/context/chart.js +1 -1
- package/esm/context/stage.js +1 -1
- package/package.json +6 -6
package/build/index.js
CHANGED
|
@@ -7605,7 +7605,7 @@
|
|
|
7605
7605
|
constructor() {
|
|
7606
7606
|
super(), this._uid = Generator.GenAutoIncrementId(), this._firstChild = null, this._lastChild = null, this.parent = null, this._count = 1;
|
|
7607
7607
|
}
|
|
7608
|
-
onParentSharedStateTreeChanged(_stage, _layer) {}
|
|
7608
|
+
onParentSharedStateTreeChanged(_stage, _layer, _inheritedSharedStateScope) {}
|
|
7609
7609
|
forEachChildren(cb, reverse = !1) {
|
|
7610
7610
|
if (reverse) {
|
|
7611
7611
|
let child = this._lastChild,
|
|
@@ -13377,14 +13377,17 @@
|
|
|
13377
13377
|
}
|
|
13378
13378
|
return null === (_a = this.stage) || void 0 === _a ? void 0 : _a.rootSharedStateScope;
|
|
13379
13379
|
}
|
|
13380
|
-
|
|
13380
|
+
syncSharedStateScopeBinding(nextScope, markDirty = !0) {
|
|
13381
13381
|
var _a;
|
|
13382
|
-
const nextScope = this.resolveBoundSharedStateScope();
|
|
13383
13382
|
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);
|
|
13384
13383
|
}
|
|
13385
|
-
|
|
13384
|
+
syncSharedStateScopeBindingFromTree(markDirty = !0, inheritedSharedStateScope) {
|
|
13385
|
+
const nextScope = void 0 === inheritedSharedStateScope ? this.resolveBoundSharedStateScope() : null != inheritedSharedStateScope ? inheritedSharedStateScope : void 0;
|
|
13386
|
+
return this.syncSharedStateScopeBinding(nextScope, markDirty);
|
|
13387
|
+
}
|
|
13388
|
+
syncSharedStateScopeBindingOnTreeChange(markDirty = !0, inheritedSharedStateScope) {
|
|
13386
13389
|
var _a, _b;
|
|
13387
|
-
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);
|
|
13390
|
+
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);
|
|
13388
13391
|
}
|
|
13389
13392
|
syncSharedStateActiveRegistrations() {
|
|
13390
13393
|
var _a;
|
|
@@ -13392,6 +13395,7 @@
|
|
|
13392
13395
|
if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach(scope => {
|
|
13393
13396
|
scope.subtreeActiveDescendants.delete(this);
|
|
13394
13397
|
}), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
|
|
13398
|
+
if ((null == previousScopes ? void 0 : previousScopes.size) && this.isSharedStateScopeChainRegistered(previousScopes)) return;
|
|
13395
13399
|
const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
|
|
13396
13400
|
null == previousScopes || previousScopes.forEach(scope => {
|
|
13397
13401
|
nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
|
|
@@ -13399,6 +13403,15 @@
|
|
|
13399
13403
|
scope.subtreeActiveDescendants.add(this);
|
|
13400
13404
|
}), this.registeredActiveScopes = nextScopes;
|
|
13401
13405
|
}
|
|
13406
|
+
isSharedStateScopeChainRegistered(previousScopes) {
|
|
13407
|
+
let scope = this.boundSharedStateScope,
|
|
13408
|
+
scopeCount = 0;
|
|
13409
|
+
for (; scope;) {
|
|
13410
|
+
if (!previousScopes.has(scope)) return !1;
|
|
13411
|
+
scopeCount += 1, scope = scope.parentScope;
|
|
13412
|
+
}
|
|
13413
|
+
return scopeCount === previousScopes.size;
|
|
13414
|
+
}
|
|
13402
13415
|
clearSharedStateActiveRegistrations() {
|
|
13403
13416
|
const previousScopes = this.registeredActiveScopes;
|
|
13404
13417
|
previousScopes && (previousScopes.forEach(scope => {
|
|
@@ -13408,8 +13421,8 @@
|
|
|
13408
13421
|
markSharedStateDirty() {
|
|
13409
13422
|
this.sharedStateDirty = !0, enqueueGraphicSharedStateRefresh(this.stage, this), scheduleStageSharedStateRefresh(this.stage);
|
|
13410
13423
|
}
|
|
13411
|
-
onParentSharedStateTreeChanged(stage, layer) {
|
|
13412
|
-
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
|
|
13424
|
+
onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
|
|
13425
|
+
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope) : this.setStage(stage, layer, inheritedSharedStateScope);
|
|
13413
13426
|
}
|
|
13414
13427
|
refreshSharedStateBeforeRender() {
|
|
13415
13428
|
var _a;
|
|
@@ -14060,6 +14073,10 @@
|
|
|
14060
14073
|
var _a;
|
|
14061
14074
|
return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
|
|
14062
14075
|
}
|
|
14076
|
+
setStateDefinitionsWithCompiled(definitions, compiledDefinitions) {
|
|
14077
|
+
var _a;
|
|
14078
|
+
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}`;
|
|
14079
|
+
}
|
|
14063
14080
|
getStateResolveBaseAttrs() {
|
|
14064
14081
|
var _a;
|
|
14065
14082
|
return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
|
|
@@ -14407,12 +14424,12 @@
|
|
|
14407
14424
|
this._globalTransMatrix.translate(scrollX, scrollY);
|
|
14408
14425
|
}
|
|
14409
14426
|
}
|
|
14410
|
-
setStage(stage, layer) {
|
|
14427
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
14411
14428
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
14412
14429
|
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,
|
|
14413
14430
|
previousStage = this.stage;
|
|
14414
14431
|
if (this.stage !== stage || this.layer !== layer) {
|
|
14415
|
-
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()) {
|
|
14432
|
+
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()) {
|
|
14416
14433
|
const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage),
|
|
14417
14434
|
nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage),
|
|
14418
14435
|
detachedStageAnimates = [];
|
|
@@ -14429,7 +14446,7 @@
|
|
|
14429
14446
|
}
|
|
14430
14447
|
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));
|
|
14431
14448
|
}
|
|
14432
|
-
((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);
|
|
14449
|
+
((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);
|
|
14433
14450
|
}
|
|
14434
14451
|
detachStageForRelease() {
|
|
14435
14452
|
var _a, _b, _c;
|
|
@@ -15370,13 +15387,13 @@
|
|
|
15370
15387
|
child.setStage(null, null);
|
|
15371
15388
|
}), this.addUpdateBoundTag();
|
|
15372
15389
|
}
|
|
15373
|
-
setStage(stage, layer) {
|
|
15390
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
15374
15391
|
var _a, _b, _c, _d, _e, _f;
|
|
15375
15392
|
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,
|
|
15376
15393
|
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;
|
|
15377
|
-
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();
|
|
15394
|
+
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);
|
|
15378
15395
|
const layerChanged = this.layer !== layer;
|
|
15379
|
-
layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.notifyChildrenSharedStateTreeChanged();
|
|
15396
|
+
layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope), this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope)) : layerChanged && this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
|
|
15380
15397
|
}
|
|
15381
15398
|
addUpdatePositionTag() {
|
|
15382
15399
|
super.addUpdatePositionTag(), this.forEachChildren(g => {
|
|
@@ -15435,17 +15452,26 @@
|
|
|
15435
15452
|
hasSharedStateDefinitions() {
|
|
15436
15453
|
return !!this._sharedStateDefinitions && Object.keys(this._sharedStateDefinitions).length > 0;
|
|
15437
15454
|
}
|
|
15438
|
-
|
|
15455
|
+
resolveChildSharedStateScope(inheritedSharedStateScope) {
|
|
15456
|
+
var _a;
|
|
15457
|
+
return this.sharedStateScope ? this.sharedStateScope : void 0 !== inheritedSharedStateScope ? inheritedSharedStateScope : null !== (_a = this.resolveBoundSharedStateScope()) && void 0 !== _a ? _a : null;
|
|
15458
|
+
}
|
|
15459
|
+
notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope) {
|
|
15460
|
+
const childSharedStateScope = this.resolveChildSharedStateScope(inheritedSharedStateScope);
|
|
15439
15461
|
this.forEachChildren(item => {
|
|
15440
|
-
this.
|
|
15462
|
+
this.setStageToChild(item, childSharedStateScope);
|
|
15441
15463
|
});
|
|
15442
15464
|
}
|
|
15443
|
-
|
|
15444
|
-
child
|
|
15465
|
+
setStageToChild(child, inheritedSharedStateScope) {
|
|
15466
|
+
const graphic = child;
|
|
15467
|
+
"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);
|
|
15468
|
+
}
|
|
15469
|
+
syncChildSharedStateTreeBinding(child, inheritedSharedStateScope) {
|
|
15470
|
+
void 0 === inheritedSharedStateScope && (inheritedSharedStateScope = this.resolveChildSharedStateScope()), this.setStageToChild(child, inheritedSharedStateScope);
|
|
15445
15471
|
}
|
|
15446
|
-
onParentSharedStateTreeChanged(stage, layer) {
|
|
15472
|
+
onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
|
|
15447
15473
|
var _a;
|
|
15448
|
-
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);
|
|
15474
|
+
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);
|
|
15449
15475
|
}
|
|
15450
15476
|
};
|
|
15451
15477
|
Group$1.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|
|
@@ -15985,13 +16011,14 @@
|
|
|
15985
16011
|
}) : fillStyle, setTextStyle(ctx, character);
|
|
15986
16012
|
}
|
|
15987
16013
|
function applyStrokeStyle(ctx, character) {
|
|
16014
|
+
var _a, _b;
|
|
15988
16015
|
const strokeStyle = character && character.stroke || defaultFormatting.stroke;
|
|
15989
16016
|
if (!strokeStyle) return void (ctx.globalAlpha = 0);
|
|
15990
16017
|
const {
|
|
15991
16018
|
strokeOpacity = 1,
|
|
15992
16019
|
opacity = 1
|
|
15993
16020
|
} = character;
|
|
15994
|
-
ctx.globalAlpha = strokeOpacity * opacity, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.strokeStyle = strokeStyle, setTextStyle(ctx, character);
|
|
16021
|
+
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);
|
|
15995
16022
|
}
|
|
15996
16023
|
function getStrByWithCanvas(desc, width, character, guessIndex, needTestLetter) {
|
|
15997
16024
|
if (desc.length <= 1) return 0;
|
|
@@ -16821,8 +16848,8 @@
|
|
|
16821
16848
|
clone() {
|
|
16822
16849
|
return new RichText(Object.assign({}, this.attribute));
|
|
16823
16850
|
}
|
|
16824
|
-
setStage(stage, layer) {
|
|
16825
|
-
super.setStage(stage, layer);
|
|
16851
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
16852
|
+
super.setStage(stage, layer, inheritedSharedStateScope);
|
|
16826
16853
|
this.getFrameCache().icons.forEach(icon => {
|
|
16827
16854
|
icon.setStage(stage, layer);
|
|
16828
16855
|
});
|
|
@@ -51758,6 +51785,9 @@
|
|
|
51758
51785
|
this._eventDispatcher.unregister("pointermove", {
|
|
51759
51786
|
query: null,
|
|
51760
51787
|
callback: this.onMouseMove
|
|
51788
|
+
}), this._eventDispatcher.unregister("pointerout", {
|
|
51789
|
+
query: null,
|
|
51790
|
+
callback: this.onMouseOut
|
|
51761
51791
|
}), isMobileLikeMode(this._mode) && this._eventDispatcher.unregister("pointerdown", {
|
|
51762
51792
|
query: null,
|
|
51763
51793
|
callback: this.onMouseMove
|
|
@@ -67228,7 +67258,7 @@
|
|
|
67228
67258
|
loadDiscreteLegendComponent();
|
|
67229
67259
|
let DiscreteLegend$1 = class DiscreteLegend extends LegendBase {
|
|
67230
67260
|
constructor(attributes, options) {
|
|
67231
|
-
super((null == options ? void 0 : options.skipDefault) ? attributes : merge$1({}, DiscreteLegend.defaultAttributes, attributes)), this.name = "discreteLegend", this._itemsContainer = null, this._itemHeightByUser = void 0, this._itemHeight = 0, this._itemMaxWidth = 0, this._contentMaxHeight = 0, this._onHover = e => {
|
|
67261
|
+
super((null == options ? void 0 : options.skipDefault) ? attributes : merge$1({}, DiscreteLegend.defaultAttributes, attributes)), this.name = "discreteLegend", this._itemsContainer = null, this._itemHeightByUser = void 0, this._itemHeight = 0, this._itemMaxWidth = 0, this._contentMaxHeight = 0, this._stateDefinitionsCache = new WeakMap(), this._onHover = e => {
|
|
67232
67262
|
const target = e.target;
|
|
67233
67263
|
if (target && target.name && target.name.startsWith(LEGEND_ELEMENT_NAME.item)) {
|
|
67234
67264
|
const legendItem = target.delegate;
|
|
@@ -67276,7 +67306,7 @@
|
|
|
67276
67306
|
};
|
|
67277
67307
|
}
|
|
67278
67308
|
render() {
|
|
67279
|
-
super.render(), this._lastActiveItem = null;
|
|
67309
|
+
this._stateDefinitionsCache = new WeakMap(), super.render(), this._lastActiveItem = null;
|
|
67280
67310
|
}
|
|
67281
67311
|
setSelected(selectedData) {
|
|
67282
67312
|
var _a;
|
|
@@ -67456,7 +67486,7 @@
|
|
|
67456
67486
|
}), this._appendDataToShape(itemGroup, LEGEND_ELEMENT_NAME.item, item, itemGroup)) : (itemGroup = graphicCreator.group(Object.assign({
|
|
67457
67487
|
x: 0,
|
|
67458
67488
|
y: 0
|
|
67459
|
-
}, 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);
|
|
67489
|
+
}, 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);
|
|
67460
67490
|
const innerGroup = graphicCreator.group({
|
|
67461
67491
|
x: 0,
|
|
67462
67492
|
y: 0,
|
|
@@ -67479,7 +67509,7 @@
|
|
|
67479
67509
|
Object.keys(shapeStyle.state || {}).forEach(key => {
|
|
67480
67510
|
const color = shapeStyle.state[key].fill || shapeStyle.state[key].stroke;
|
|
67481
67511
|
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);
|
|
67482
|
-
}), this._appendDataToShape(itemShape, LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state), itemShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(itemShape);
|
|
67512
|
+
}), this._appendDataToShape(itemShape, LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state, !1), itemShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(itemShape);
|
|
67483
67513
|
}
|
|
67484
67514
|
let focusSpace = 0;
|
|
67485
67515
|
if (focus) {
|
|
@@ -67506,7 +67536,7 @@
|
|
|
67506
67536
|
_originText: labelAttr.formatMethod ? label : void 0
|
|
67507
67537
|
}),
|
|
67508
67538
|
labelShape = createTextGraphicByType(labelAttributes);
|
|
67509
|
-
this._appendDataToShape(labelShape, LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state), labelShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(labelShape);
|
|
67539
|
+
this._appendDataToShape(labelShape, LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state, labelStyle.reuseStateDefinitions), labelShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(labelShape);
|
|
67510
67540
|
const labelSpace = get$1(labelAttr, "space", DEFAULT_LABEL_SPACE);
|
|
67511
67541
|
if (isValid$1(value)) {
|
|
67512
67542
|
const valueSpace = get$1(valueAttr, "space", focus ? DEFAULT_VALUE_SPACE : 0),
|
|
@@ -67522,7 +67552,7 @@
|
|
|
67522
67552
|
_originText: valueAttr.formatMethod ? value : void 0
|
|
67523
67553
|
}),
|
|
67524
67554
|
valueShape = createTextGraphicByType(valueAttributes);
|
|
67525
|
-
if (this._appendDataToShape(valueShape, LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state), valueShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), this._itemWidthByUser) {
|
|
67555
|
+
if (this._appendDataToShape(valueShape, LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state, valueStyle.reuseStateDefinitions), valueShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), this._itemWidthByUser) {
|
|
67526
67556
|
const layoutWidth = this._itemWidthByUser - parsedPadding[1] - parsedPadding[3] - shapeSize - shapeSpace - labelSpace - focusSpace - valueSpace;
|
|
67527
67557
|
this._autoEllipsis(autoEllipsisStrategy, layoutWidth, labelShape, valueShape), valueAttr.alignRight ? valueShape.setAttributes({
|
|
67528
67558
|
textAlign: "right",
|
|
@@ -67598,6 +67628,7 @@
|
|
|
67598
67628
|
}));
|
|
67599
67629
|
}
|
|
67600
67630
|
_updatePositionOfPager(renderStartY, compWidth, compHeight) {
|
|
67631
|
+
var _a;
|
|
67601
67632
|
const {
|
|
67602
67633
|
pager: pager
|
|
67603
67634
|
} = this.attribute,
|
|
@@ -67605,18 +67636,24 @@
|
|
|
67605
67636
|
totalPage: totalPage,
|
|
67606
67637
|
isHorizontal: isHorizontal
|
|
67607
67638
|
} = this._itemContext,
|
|
67608
|
-
position = pager && pager.position || "middle"
|
|
67639
|
+
position = pager && pager.position || "middle",
|
|
67640
|
+
hugContent = !(!pager || !pager.hugContent),
|
|
67641
|
+
pagerSpace = null !== (_a = pager && pager.space) && void 0 !== _a ? _a : DEFAULT_PAGER_SPACE;
|
|
67609
67642
|
if (this._pagerComponent.setTotal(totalPage), isHorizontal) {
|
|
67610
67643
|
let y;
|
|
67611
|
-
y = "start" === position ? renderStartY : "end" === position ? renderStartY + compHeight - this._pagerComponent.AABBBounds.height() / 2 : renderStartY + compHeight / 2 - this._pagerComponent.AABBBounds.height() / 2
|
|
67612
|
-
|
|
67644
|
+
y = "start" === position ? renderStartY : "end" === position ? renderStartY + compHeight - this._pagerComponent.AABBBounds.height() / 2 : renderStartY + compHeight / 2 - this._pagerComponent.AABBBounds.height() / 2;
|
|
67645
|
+
let x = compWidth - this._pagerComponent.AABBBounds.width();
|
|
67646
|
+
hugContent && (x = Math.max(0, Math.min(this._itemsContainer.AABBBounds.width() + pagerSpace, x))), this._pagerComponent.setAttributes({
|
|
67647
|
+
x: x,
|
|
67613
67648
|
y: y
|
|
67614
67649
|
});
|
|
67615
67650
|
} else {
|
|
67616
67651
|
let x;
|
|
67617
|
-
x = "start" === position ? 0 : "end" === position ? compWidth - this._pagerComponent.AABBBounds.width() : (compWidth - this._pagerComponent.AABBBounds.width()) / 2
|
|
67652
|
+
x = "start" === position ? 0 : "end" === position ? compWidth - this._pagerComponent.AABBBounds.width() : (compWidth - this._pagerComponent.AABBBounds.width()) / 2;
|
|
67653
|
+
let y = compHeight - this._pagerComponent.AABBBounds.height();
|
|
67654
|
+
hugContent && (y = Math.max(0, Math.min(renderStartY + this._itemsContainer.AABBBounds.height() + pagerSpace, y))), this._pagerComponent.setAttributes({
|
|
67618
67655
|
x: x,
|
|
67619
|
-
y:
|
|
67656
|
+
y: y
|
|
67620
67657
|
});
|
|
67621
67658
|
}
|
|
67622
67659
|
}
|
|
@@ -67771,11 +67808,15 @@
|
|
|
67771
67808
|
this._itemContext.totalPage = total, this._updatePositionOfPager(renderStartY, compWidth, compHeight);
|
|
67772
67809
|
}
|
|
67773
67810
|
defaultCurrent > 1 && (isHorizontal ? itemsContainer.setAttribute("y", -(defaultCurrent - 1) * (compHeight + spaceRow)) : itemsContainer.setAttribute("x", -(defaultCurrent - 1) * (compWidth + spaceCol)));
|
|
67811
|
+
const hugContent = !!pager.hugContent;
|
|
67812
|
+
let clipWidth = isHorizontal ? contentWidth : compWidth,
|
|
67813
|
+
clipHeight = isHorizontal ? compHeight : contentHeight;
|
|
67814
|
+
hugContent && (isHorizontal ? clipWidth = Math.max(0, Math.min(clipWidth, itemsContainer.AABBBounds.width())) : clipHeight = Math.max(0, Math.min(clipHeight, itemsContainer.AABBBounds.height())));
|
|
67774
67815
|
const clipGroup = graphicCreator.group({
|
|
67775
67816
|
x: 0,
|
|
67776
67817
|
y: renderStartY,
|
|
67777
|
-
width:
|
|
67778
|
-
height:
|
|
67818
|
+
width: clipWidth,
|
|
67819
|
+
height: clipHeight,
|
|
67779
67820
|
clip: !0,
|
|
67780
67821
|
pickable: !1
|
|
67781
67822
|
});
|
|
@@ -67941,8 +67982,17 @@
|
|
|
67941
67982
|
item.hasState(LegendStateValue.selected) && selectedData.push(item.data);
|
|
67942
67983
|
}), selectedData;
|
|
67943
67984
|
}
|
|
67944
|
-
_appendDataToShape(shape, name, data, delegateShape, states =
|
|
67945
|
-
shape.name = name, shape.data = data, shape.delegate = delegateShape, shape.states = merge$1({}, DEFAULT_STATES, states);
|
|
67985
|
+
_appendDataToShape(shape, name, data, delegateShape, states, reuseStateDefinitions = !0) {
|
|
67986
|
+
if (shape.name = name, shape.data = data, shape.delegate = delegateShape, !reuseStateDefinitions) return void (shape.states = merge$1({}, DEFAULT_STATES, states));
|
|
67987
|
+
const source = null != states ? states : DEFAULT_STATES,
|
|
67988
|
+
cached = this._stateDefinitionsCache.get(source);
|
|
67989
|
+
if (cached) return shape.states = cached.definitions, void shape.setStateDefinitionsWithCompiled(cached.definitions, cached.compiledDefinitions);
|
|
67990
|
+
const definitions = states ? merge$1({}, DEFAULT_STATES, states) : DEFAULT_STATES,
|
|
67991
|
+
entry = {
|
|
67992
|
+
definitions: definitions,
|
|
67993
|
+
compiledDefinitions: new StateDefinitionCompiler().compile(definitions)
|
|
67994
|
+
};
|
|
67995
|
+
this._stateDefinitionsCache.set(source, entry), shape.states = entry.definitions, shape.setStateDefinitionsWithCompiled(entry.definitions, entry.compiledDefinitions);
|
|
67946
67996
|
}
|
|
67947
67997
|
_dispatchLegendEvent(eventName, legendItem, event) {
|
|
67948
67998
|
const currentSelectedItems = this._getSelectedLegends();
|
|
@@ -67959,12 +68009,17 @@
|
|
|
67959
68009
|
}
|
|
67960
68010
|
_handleStyle(config, item, isSelected, index, items) {
|
|
67961
68011
|
const newConfig = {};
|
|
67962
|
-
|
|
67963
|
-
|
|
67964
|
-
|
|
68012
|
+
if (config.style && (isFunction$1(config.style) ? newConfig.style = config.style(item, isSelected, index, items) : newConfig.style = config.style), config.state) {
|
|
68013
|
+
const stateKeys = Object.keys(config.state),
|
|
68014
|
+
hasStateFunction = stateKeys.some(key => isFunction$1(config.state[key]));
|
|
68015
|
+
newConfig.reuseStateDefinitions = !hasStateFunction, hasStateFunction ? (newConfig.state = {}, stateKeys.forEach(key => {
|
|
68016
|
+
config.state[key] && (newConfig.state[key] = isFunction$1(config.state[key]) ? config.state[key](item, isSelected, index, items) : config.state[key]);
|
|
68017
|
+
})) : newConfig.state = config.state;
|
|
68018
|
+
}
|
|
68019
|
+
return newConfig;
|
|
67965
68020
|
}
|
|
67966
68021
|
release() {
|
|
67967
|
-
super.release(), this.removeAllEventListeners();
|
|
68022
|
+
this._stateDefinitionsCache = new WeakMap(), super.release(), this.removeAllEventListeners();
|
|
67968
68023
|
}
|
|
67969
68024
|
};
|
|
67970
68025
|
DiscreteLegend$1.defaultAttributes = {
|