@visactor/vrender 1.1.8-alpha.0 → 1.1.8-alpha.2
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 +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/dist/index.es.js +113 -60
- package/dist/index.js +113 -60
- package/dist/index.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/package.json +7 -7
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,
|
|
@@ -8499,14 +8499,17 @@
|
|
|
8499
8499
|
}
|
|
8500
8500
|
return null === (_a = this.stage) || void 0 === _a ? void 0 : _a.rootSharedStateScope;
|
|
8501
8501
|
}
|
|
8502
|
-
|
|
8502
|
+
syncSharedStateScopeBinding(nextScope, markDirty = !0) {
|
|
8503
8503
|
var _a;
|
|
8504
|
-
const nextScope = this.resolveBoundSharedStateScope();
|
|
8505
8504
|
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);
|
|
8506
8505
|
}
|
|
8507
|
-
|
|
8506
|
+
syncSharedStateScopeBindingFromTree(markDirty = !0, inheritedSharedStateScope) {
|
|
8507
|
+
const nextScope = void 0 === inheritedSharedStateScope ? this.resolveBoundSharedStateScope() : null != inheritedSharedStateScope ? inheritedSharedStateScope : void 0;
|
|
8508
|
+
return this.syncSharedStateScopeBinding(nextScope, markDirty);
|
|
8509
|
+
}
|
|
8510
|
+
syncSharedStateScopeBindingOnTreeChange(markDirty = !0, inheritedSharedStateScope) {
|
|
8508
8511
|
var _a, _b;
|
|
8509
|
-
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);
|
|
8512
|
+
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);
|
|
8510
8513
|
}
|
|
8511
8514
|
syncSharedStateActiveRegistrations() {
|
|
8512
8515
|
var _a;
|
|
@@ -8514,6 +8517,7 @@
|
|
|
8514
8517
|
if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach(scope => {
|
|
8515
8518
|
scope.subtreeActiveDescendants.delete(this);
|
|
8516
8519
|
}), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
|
|
8520
|
+
if ((null == previousScopes ? void 0 : previousScopes.size) && this.isSharedStateScopeChainRegistered(previousScopes)) return;
|
|
8517
8521
|
const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
|
|
8518
8522
|
null == previousScopes || previousScopes.forEach(scope => {
|
|
8519
8523
|
nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
|
|
@@ -8521,6 +8525,15 @@
|
|
|
8521
8525
|
scope.subtreeActiveDescendants.add(this);
|
|
8522
8526
|
}), this.registeredActiveScopes = nextScopes;
|
|
8523
8527
|
}
|
|
8528
|
+
isSharedStateScopeChainRegistered(previousScopes) {
|
|
8529
|
+
let scope = this.boundSharedStateScope,
|
|
8530
|
+
scopeCount = 0;
|
|
8531
|
+
for (; scope;) {
|
|
8532
|
+
if (!previousScopes.has(scope)) return !1;
|
|
8533
|
+
scopeCount += 1, scope = scope.parentScope;
|
|
8534
|
+
}
|
|
8535
|
+
return scopeCount === previousScopes.size;
|
|
8536
|
+
}
|
|
8524
8537
|
clearSharedStateActiveRegistrations() {
|
|
8525
8538
|
const previousScopes = this.registeredActiveScopes;
|
|
8526
8539
|
previousScopes && (previousScopes.forEach(scope => {
|
|
@@ -8530,8 +8543,8 @@
|
|
|
8530
8543
|
markSharedStateDirty() {
|
|
8531
8544
|
this.sharedStateDirty = !0, enqueueGraphicSharedStateRefresh(this.stage, this), scheduleStageSharedStateRefresh(this.stage);
|
|
8532
8545
|
}
|
|
8533
|
-
onParentSharedStateTreeChanged(stage, layer) {
|
|
8534
|
-
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
|
|
8546
|
+
onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
|
|
8547
|
+
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope) : this.setStage(stage, layer, inheritedSharedStateScope);
|
|
8535
8548
|
}
|
|
8536
8549
|
refreshSharedStateBeforeRender() {
|
|
8537
8550
|
var _a;
|
|
@@ -9181,6 +9194,10 @@
|
|
|
9181
9194
|
var _a;
|
|
9182
9195
|
return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
|
|
9183
9196
|
}
|
|
9197
|
+
setStateDefinitionsWithCompiled(definitions, compiledDefinitions) {
|
|
9198
|
+
var _a;
|
|
9199
|
+
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}`;
|
|
9200
|
+
}
|
|
9184
9201
|
getStateResolveBaseAttrs() {
|
|
9185
9202
|
var _a;
|
|
9186
9203
|
return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
|
|
@@ -9300,6 +9317,11 @@
|
|
|
9300
9317
|
}
|
|
9301
9318
|
return !0;
|
|
9302
9319
|
}
|
|
9320
|
+
hasStatePatch(patch) {
|
|
9321
|
+
if (!patch) return !1;
|
|
9322
|
+
for (const key in patch) if (Object.prototype.hasOwnProperty.call(patch, key)) return !0;
|
|
9323
|
+
return !1;
|
|
9324
|
+
}
|
|
9303
9325
|
commitSameStatePatchRefresh(states, hasAnimation, animateSameStatePatchChange = !1) {
|
|
9304
9326
|
var _a;
|
|
9305
9327
|
const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
|
|
@@ -9367,15 +9389,17 @@
|
|
|
9367
9389
|
transition = this.resolveClearStatesTransition();
|
|
9368
9390
|
if (!transition.changed && 0 === previousStates.length) return this.currentStates = [], this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, void this.clearSharedStateActiveRegistrations();
|
|
9369
9391
|
const resolvedStateAttrs = hasAnimation || this.hasCustomEvent("beforeStateUpdate") ? cloneAttributeValue(null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : {}) : null !== (_c = this.baseAttributes) && void 0 !== _c ? _c : {};
|
|
9370
|
-
if (!transition.changed || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0)) if (this.currentStates = transition.states, this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, this.clearSharedStateActiveRegistrations(),
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9392
|
+
if (!transition.changed || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0)) if (this.currentStates = transition.states, this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, this.clearSharedStateActiveRegistrations(), this.attributeMayContainTransientAttrs || this.hasStatePatch(previousResolvedStatePatch)) {
|
|
9393
|
+
if (hasAnimation) {
|
|
9394
|
+
this._syncFinalAttributeFromStaticTruth();
|
|
9395
|
+
const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
|
|
9396
|
+
this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
|
|
9397
|
+
} else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
9398
|
+
type: exports.AttributeUpdateType.STATE
|
|
9399
|
+
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
|
|
9400
|
+
type: exports.AttributeUpdateType.STATE
|
|
9401
|
+
}), this.emitStateUpdateEvent();
|
|
9402
|
+
} else this.emitStateUpdateEvent();
|
|
9379
9403
|
}
|
|
9380
9404
|
removeState(stateName, hasAnimation) {
|
|
9381
9405
|
const transition = this.resolveRemoveStateTransition(stateName);
|
|
@@ -9416,15 +9440,17 @@
|
|
|
9416
9440
|
effectiveStates: effectiveStates,
|
|
9417
9441
|
resolvedStateAttrs: resolvedStateAttrs
|
|
9418
9442
|
} = this.resolveGraphicStateTransition(states);
|
|
9419
|
-
if ((transition.changed || !this.sameStateNames(previousStates, transition.states)) && this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) if (this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(),
|
|
9420
|
-
|
|
9421
|
-
|
|
9422
|
-
|
|
9423
|
-
|
|
9424
|
-
|
|
9425
|
-
|
|
9426
|
-
|
|
9427
|
-
|
|
9443
|
+
if ((transition.changed || !this.sameStateNames(previousStates, transition.states)) && this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) if (this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.attributeMayContainTransientAttrs || this.hasStatePatch(previousResolvedStatePatch) || this.hasStatePatch(resolvedStateAttrs)) {
|
|
9444
|
+
if (hasAnimation) {
|
|
9445
|
+
this._syncFinalAttributeFromStaticTruth();
|
|
9446
|
+
const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
|
|
9447
|
+
this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
|
|
9448
|
+
} else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
9449
|
+
type: exports.AttributeUpdateType.STATE
|
|
9450
|
+
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
|
|
9451
|
+
type: exports.AttributeUpdateType.STATE
|
|
9452
|
+
}), this.emitStateUpdateEvent();
|
|
9453
|
+
} else this.emitStateUpdateEvent();
|
|
9428
9454
|
}
|
|
9429
9455
|
invalidateResolver() {
|
|
9430
9456
|
var _a, _b;
|
|
@@ -9544,12 +9570,12 @@
|
|
|
9544
9570
|
this._globalTransMatrix.translate(scrollX, scrollY);
|
|
9545
9571
|
}
|
|
9546
9572
|
}
|
|
9547
|
-
setStage(stage, layer) {
|
|
9573
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
9548
9574
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
9549
9575
|
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,
|
|
9550
9576
|
previousStage = this.stage;
|
|
9551
9577
|
if (this.stage !== stage || this.layer !== layer) {
|
|
9552
|
-
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()) {
|
|
9578
|
+
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()) {
|
|
9553
9579
|
const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage),
|
|
9554
9580
|
nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage),
|
|
9555
9581
|
detachedStageAnimates = [];
|
|
@@ -9566,7 +9592,7 @@
|
|
|
9566
9592
|
}
|
|
9567
9593
|
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));
|
|
9568
9594
|
}
|
|
9569
|
-
((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);
|
|
9595
|
+
((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);
|
|
9570
9596
|
}
|
|
9571
9597
|
detachStageForRelease() {
|
|
9572
9598
|
var _a, _b, _c;
|
|
@@ -12147,8 +12173,8 @@
|
|
|
12147
12173
|
clone() {
|
|
12148
12174
|
return new RichText(Object.assign({}, this.attribute));
|
|
12149
12175
|
}
|
|
12150
|
-
setStage(stage, layer) {
|
|
12151
|
-
super.setStage(stage, layer);
|
|
12176
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
12177
|
+
super.setStage(stage, layer, inheritedSharedStateScope);
|
|
12152
12178
|
this.getFrameCache().icons.forEach(icon => {
|
|
12153
12179
|
icon.setStage(stage, layer);
|
|
12154
12180
|
});
|
|
@@ -12852,13 +12878,13 @@
|
|
|
12852
12878
|
child.setStage(null, null);
|
|
12853
12879
|
}), this.addUpdateBoundTag();
|
|
12854
12880
|
}
|
|
12855
|
-
setStage(stage, layer) {
|
|
12881
|
+
setStage(stage, layer, inheritedSharedStateScope) {
|
|
12856
12882
|
var _a, _b, _c, _d, _e, _f;
|
|
12857
12883
|
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,
|
|
12858
12884
|
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;
|
|
12859
|
-
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();
|
|
12885
|
+
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);
|
|
12860
12886
|
const layerChanged = this.layer !== layer;
|
|
12861
|
-
layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.notifyChildrenSharedStateTreeChanged();
|
|
12887
|
+
layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope), this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope)) : layerChanged && this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
|
|
12862
12888
|
}
|
|
12863
12889
|
addUpdatePositionTag() {
|
|
12864
12890
|
super.addUpdatePositionTag(), this.forEachChildren(g => {
|
|
@@ -12917,17 +12943,26 @@
|
|
|
12917
12943
|
hasSharedStateDefinitions() {
|
|
12918
12944
|
return !!this._sharedStateDefinitions && Object.keys(this._sharedStateDefinitions).length > 0;
|
|
12919
12945
|
}
|
|
12920
|
-
|
|
12946
|
+
resolveChildSharedStateScope(inheritedSharedStateScope) {
|
|
12947
|
+
var _a;
|
|
12948
|
+
return this.sharedStateScope ? this.sharedStateScope : void 0 !== inheritedSharedStateScope ? inheritedSharedStateScope : null !== (_a = this.resolveBoundSharedStateScope()) && void 0 !== _a ? _a : null;
|
|
12949
|
+
}
|
|
12950
|
+
notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope) {
|
|
12951
|
+
const childSharedStateScope = this.resolveChildSharedStateScope(inheritedSharedStateScope);
|
|
12921
12952
|
this.forEachChildren(item => {
|
|
12922
|
-
this.
|
|
12953
|
+
this.setStageToChild(item, childSharedStateScope);
|
|
12923
12954
|
});
|
|
12924
12955
|
}
|
|
12925
|
-
|
|
12926
|
-
child
|
|
12956
|
+
setStageToChild(child, inheritedSharedStateScope) {
|
|
12957
|
+
const graphic = child;
|
|
12958
|
+
"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);
|
|
12959
|
+
}
|
|
12960
|
+
syncChildSharedStateTreeBinding(child, inheritedSharedStateScope) {
|
|
12961
|
+
void 0 === inheritedSharedStateScope && (inheritedSharedStateScope = this.resolveChildSharedStateScope()), this.setStageToChild(child, inheritedSharedStateScope);
|
|
12927
12962
|
}
|
|
12928
|
-
onParentSharedStateTreeChanged(stage, layer) {
|
|
12963
|
+
onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
|
|
12929
12964
|
var _a;
|
|
12930
|
-
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);
|
|
12965
|
+
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);
|
|
12931
12966
|
}
|
|
12932
12967
|
}
|
|
12933
12968
|
Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|
|
@@ -26804,14 +26839,18 @@
|
|
|
26804
26839
|
}
|
|
26805
26840
|
}
|
|
26806
26841
|
measureText(text, method = application.global.measureTextMethod) {
|
|
26807
|
-
this.
|
|
26808
|
-
|
|
26809
|
-
|
|
26810
|
-
|
|
26811
|
-
|
|
26812
|
-
|
|
26813
|
-
|
|
26814
|
-
|
|
26842
|
+
const dpr = this.dpr || 1;
|
|
26843
|
+
this.setTransform(1, 0, 0, 1, 0, 0, !0, dpr);
|
|
26844
|
+
const metrics = super.measureText(text, method);
|
|
26845
|
+
return 1 === dpr || null == metrics.fontBoundingBoxAscent || null == metrics.fontBoundingBoxDescent ? metrics : Object.assign(Object.assign({}, metrics), {
|
|
26846
|
+
width: metrics.width,
|
|
26847
|
+
actualBoundingBoxLeft: metrics.actualBoundingBoxLeft,
|
|
26848
|
+
actualBoundingBoxRight: metrics.actualBoundingBoxRight,
|
|
26849
|
+
actualBoundingBoxAscent: metrics.actualBoundingBoxAscent,
|
|
26850
|
+
actualBoundingBoxDescent: metrics.actualBoundingBoxDescent,
|
|
26851
|
+
fontBoundingBoxAscent: metrics.fontBoundingBoxAscent / dpr,
|
|
26852
|
+
fontBoundingBoxDescent: metrics.fontBoundingBoxDescent / dpr
|
|
26853
|
+
});
|
|
26815
26854
|
}
|
|
26816
26855
|
createPattern(image, repetition) {
|
|
26817
26856
|
return null;
|
|
@@ -50207,7 +50246,7 @@
|
|
|
50207
50246
|
loadDiscreteLegendComponent();
|
|
50208
50247
|
class DiscreteLegend extends LegendBase {
|
|
50209
50248
|
constructor(attributes, options) {
|
|
50210
|
-
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 => {
|
|
50249
|
+
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 => {
|
|
50211
50250
|
const target = e.target;
|
|
50212
50251
|
if (target && target.name && target.name.startsWith(exports.LEGEND_ELEMENT_NAME.item)) {
|
|
50213
50252
|
const legendItem = target.delegate;
|
|
@@ -50255,7 +50294,7 @@
|
|
|
50255
50294
|
};
|
|
50256
50295
|
}
|
|
50257
50296
|
render() {
|
|
50258
|
-
super.render(), this._lastActiveItem = null;
|
|
50297
|
+
this._stateDefinitionsCache = new WeakMap(), super.render(), this._lastActiveItem = null;
|
|
50259
50298
|
}
|
|
50260
50299
|
setSelected(selectedData) {
|
|
50261
50300
|
var _a;
|
|
@@ -50435,7 +50474,7 @@
|
|
|
50435
50474
|
}), this._appendDataToShape(itemGroup, exports.LEGEND_ELEMENT_NAME.item, item, itemGroup)) : (itemGroup = graphicCreator.group(Object.assign({
|
|
50436
50475
|
x: 0,
|
|
50437
50476
|
y: 0
|
|
50438
|
-
}, 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);
|
|
50477
|
+
}, 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);
|
|
50439
50478
|
const innerGroup = graphicCreator.group({
|
|
50440
50479
|
x: 0,
|
|
50441
50480
|
y: 0,
|
|
@@ -50458,7 +50497,7 @@
|
|
|
50458
50497
|
Object.keys(shapeStyle.state || {}).forEach(key => {
|
|
50459
50498
|
const color = shapeStyle.state[key].fill || shapeStyle.state[key].stroke;
|
|
50460
50499
|
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);
|
|
50461
|
-
}), this._appendDataToShape(itemShape, exports.LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state), itemShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected), innerGroup.add(itemShape);
|
|
50500
|
+
}), 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);
|
|
50462
50501
|
}
|
|
50463
50502
|
let focusSpace = 0;
|
|
50464
50503
|
if (focus) {
|
|
@@ -50485,7 +50524,7 @@
|
|
|
50485
50524
|
_originText: labelAttr.formatMethod ? label : void 0
|
|
50486
50525
|
}),
|
|
50487
50526
|
labelShape = createTextGraphicByType(labelAttributes);
|
|
50488
|
-
this._appendDataToShape(labelShape, exports.LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state), labelShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected), innerGroup.add(labelShape);
|
|
50527
|
+
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);
|
|
50489
50528
|
const labelSpace = get$1(labelAttr, "space", DEFAULT_LABEL_SPACE);
|
|
50490
50529
|
if (isValid$1(value)) {
|
|
50491
50530
|
const valueSpace = get$1(valueAttr, "space", focus ? DEFAULT_VALUE_SPACE : 0),
|
|
@@ -50501,7 +50540,7 @@
|
|
|
50501
50540
|
_originText: valueAttr.formatMethod ? value : void 0
|
|
50502
50541
|
}),
|
|
50503
50542
|
valueShape = createTextGraphicByType(valueAttributes);
|
|
50504
|
-
if (this._appendDataToShape(valueShape, exports.LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state), valueShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected), this._itemWidthByUser) {
|
|
50543
|
+
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) {
|
|
50505
50544
|
const layoutWidth = this._itemWidthByUser - parsedPadding[1] - parsedPadding[3] - shapeSize - shapeSpace - labelSpace - focusSpace - valueSpace;
|
|
50506
50545
|
this._autoEllipsis(autoEllipsisStrategy, layoutWidth, labelShape, valueShape), valueAttr.alignRight ? valueShape.setAttributes({
|
|
50507
50546
|
textAlign: "right",
|
|
@@ -50931,8 +50970,17 @@
|
|
|
50931
50970
|
item.hasState(exports.LegendStateValue.selected) && selectedData.push(item.data);
|
|
50932
50971
|
}), selectedData;
|
|
50933
50972
|
}
|
|
50934
|
-
_appendDataToShape(shape, name, data, delegateShape, states =
|
|
50935
|
-
shape.name = name, shape.data = data, shape.delegate = delegateShape, shape.states = merge({}, DEFAULT_STATES, states);
|
|
50973
|
+
_appendDataToShape(shape, name, data, delegateShape, states, reuseStateDefinitions = !0) {
|
|
50974
|
+
if (shape.name = name, shape.data = data, shape.delegate = delegateShape, !reuseStateDefinitions) return void (shape.states = merge({}, DEFAULT_STATES, states));
|
|
50975
|
+
const source = null != states ? states : DEFAULT_STATES,
|
|
50976
|
+
cached = this._stateDefinitionsCache.get(source);
|
|
50977
|
+
if (cached) return shape.states = cached.definitions, void shape.setStateDefinitionsWithCompiled(cached.definitions, cached.compiledDefinitions);
|
|
50978
|
+
const definitions = states ? merge({}, DEFAULT_STATES, states) : DEFAULT_STATES,
|
|
50979
|
+
entry = {
|
|
50980
|
+
definitions: definitions,
|
|
50981
|
+
compiledDefinitions: new StateDefinitionCompiler().compile(definitions)
|
|
50982
|
+
};
|
|
50983
|
+
this._stateDefinitionsCache.set(source, entry), shape.states = entry.definitions, shape.setStateDefinitionsWithCompiled(entry.definitions, entry.compiledDefinitions);
|
|
50936
50984
|
}
|
|
50937
50985
|
_dispatchLegendEvent(eventName, legendItem, event) {
|
|
50938
50986
|
const currentSelectedItems = this._getSelectedLegends();
|
|
@@ -50949,12 +50997,17 @@
|
|
|
50949
50997
|
}
|
|
50950
50998
|
_handleStyle(config, item, isSelected, index, items) {
|
|
50951
50999
|
const newConfig = {};
|
|
50952
|
-
|
|
50953
|
-
|
|
50954
|
-
|
|
51000
|
+
if (config.style && (isFunction$1(config.style) ? newConfig.style = config.style(item, isSelected, index, items) : newConfig.style = config.style), config.state) {
|
|
51001
|
+
const stateKeys = Object.keys(config.state),
|
|
51002
|
+
hasStateFunction = stateKeys.some(key => isFunction$1(config.state[key]));
|
|
51003
|
+
newConfig.reuseStateDefinitions = !hasStateFunction, hasStateFunction ? (newConfig.state = {}, stateKeys.forEach(key => {
|
|
51004
|
+
config.state[key] && (newConfig.state[key] = isFunction$1(config.state[key]) ? config.state[key](item, isSelected, index, items) : config.state[key]);
|
|
51005
|
+
})) : newConfig.state = config.state;
|
|
51006
|
+
}
|
|
51007
|
+
return newConfig;
|
|
50955
51008
|
}
|
|
50956
51009
|
release() {
|
|
50957
|
-
super.release(), this.removeAllEventListeners();
|
|
51010
|
+
this._stateDefinitionsCache = new WeakMap(), super.release(), this.removeAllEventListeners();
|
|
50958
51011
|
}
|
|
50959
51012
|
}
|
|
50960
51013
|
DiscreteLegend.defaultAttributes = {
|
|
@@ -55859,7 +55912,7 @@
|
|
|
55859
55912
|
return resolveLegacyApp().createStage(params);
|
|
55860
55913
|
}
|
|
55861
55914
|
|
|
55862
|
-
const version = "1.1.8-alpha.
|
|
55915
|
+
const version = "1.1.8-alpha.2";
|
|
55863
55916
|
|
|
55864
55917
|
exports.AComponentAnimate = AComponentAnimate;
|
|
55865
55918
|
exports.ACustomAnimate = ACustomAnimate;
|