@next-core/brick-kit 2.175.1 → 2.177.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.bundle.js +35 -7
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +35 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/Router.d.ts.map +1 -1
- package/dist/types/core/StoryboardContext.d.ts +2 -0
- package/dist/types/core/StoryboardContext.d.ts.map +1 -1
- package/dist/types/internal/menu.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/index.bundle.js
CHANGED
|
@@ -1992,6 +1992,23 @@
|
|
|
1992
1992
|
}
|
|
1993
1993
|
})();
|
|
1994
1994
|
}
|
|
1995
|
+
|
|
1996
|
+
/** After mount, dispatch the change event when an async data is loaded */
|
|
1997
|
+
handleAsyncAfterMount() {
|
|
1998
|
+
this.data.forEach(item => {
|
|
1999
|
+
if (item.type === "free-variable" && item.async) {
|
|
2000
|
+
// An async data always has `loading`
|
|
2001
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2002
|
+
item.loading.then(value => {
|
|
2003
|
+
item.loaded = true;
|
|
2004
|
+
item.value = value;
|
|
2005
|
+
item.eventTarget.dispatchEvent(new CustomEvent(this.eventName, {
|
|
2006
|
+
detail: value
|
|
2007
|
+
}));
|
|
2008
|
+
});
|
|
2009
|
+
}
|
|
2010
|
+
});
|
|
2011
|
+
}
|
|
1995
2012
|
deferDefine(contextConfs, coreContext, brick) {
|
|
1996
2013
|
var {
|
|
1997
2014
|
mergedContext,
|
|
@@ -2078,7 +2095,8 @@
|
|
|
2078
2095
|
var isTemplateState = !!storyboardContextWrapper.tplContextId;
|
|
2079
2096
|
var value = getDefinedTemplateState(isTemplateState, contextConf, brick);
|
|
2080
2097
|
var load = null;
|
|
2081
|
-
var
|
|
2098
|
+
var loading;
|
|
2099
|
+
var resolvePolicy = "eager";
|
|
2082
2100
|
if (value === undefined) {
|
|
2083
2101
|
if (contextConf.resolve) {
|
|
2084
2102
|
yield storyboardContextWrapper.waitForUsedContext(contextConf.resolve.if);
|
|
@@ -2096,10 +2114,13 @@
|
|
|
2096
2114
|
return _ref.apply(this, arguments);
|
|
2097
2115
|
};
|
|
2098
2116
|
}();
|
|
2099
|
-
|
|
2100
|
-
|
|
2117
|
+
// `async` take precedence over `lazy`
|
|
2118
|
+
resolvePolicy = contextConf.resolve.async && !isTemplateState ? "async" : contextConf.resolve.lazy ? "lazy" : "eager";
|
|
2119
|
+
if (resolvePolicy === "eager") {
|
|
2101
2120
|
value = yield load();
|
|
2102
|
-
} else if (
|
|
2121
|
+
} else if (resolvePolicy === "async") {
|
|
2122
|
+
loading = load();
|
|
2123
|
+
} else if (contextConf.resolve.trigger) {
|
|
2103
2124
|
var lifecycleName = contextConf.resolve.trigger;
|
|
2104
2125
|
if (supportContextResolveTriggerBrickLifeCycle.includes(lifecycleName)) {
|
|
2105
2126
|
var contextNameArray = storyboardContextWrapper.batchTriggerContextsNamesMap.get(lifecycleName) || [];
|
|
@@ -2118,14 +2139,14 @@
|
|
|
2118
2139
|
return false;
|
|
2119
2140
|
}
|
|
2120
2141
|
}
|
|
2121
|
-
if ((!load ||
|
|
2142
|
+
if ((!load || resolvePolicy !== "eager") && contextConf.value !== undefined) {
|
|
2122
2143
|
yield storyboardContextWrapper.waitForUsedContext(contextConf.value);
|
|
2123
2144
|
// If the context has no resolve, just use its `value`.
|
|
2124
2145
|
// Or if the resolve is ignored or lazy, use its `value` as a fallback.
|
|
2125
2146
|
value = computeRealValue(contextConf.value, mergedContext, true);
|
|
2126
2147
|
}
|
|
2127
2148
|
}
|
|
2128
|
-
resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick, load,
|
|
2149
|
+
resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick, load, resolvePolicy === "eager", loading, resolvePolicy === "async");
|
|
2129
2150
|
return true;
|
|
2130
2151
|
});
|
|
2131
2152
|
return _resolveNormalStoryboardContext.apply(this, arguments);
|
|
@@ -2149,7 +2170,7 @@
|
|
|
2149
2170
|
return brick.properties[contextConf.name];
|
|
2150
2171
|
}
|
|
2151
2172
|
}
|
|
2152
|
-
function resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick, load, loaded) {
|
|
2173
|
+
function resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick, load, loaded, loading, async) {
|
|
2153
2174
|
var newContext = {
|
|
2154
2175
|
type: "free-variable",
|
|
2155
2176
|
value,
|
|
@@ -2157,6 +2178,8 @@
|
|
|
2157
2178
|
eventTarget: new EventTarget$1(),
|
|
2158
2179
|
load,
|
|
2159
2180
|
loaded,
|
|
2181
|
+
loading,
|
|
2182
|
+
async,
|
|
2160
2183
|
deps: []
|
|
2161
2184
|
};
|
|
2162
2185
|
var eventName = storyboardContextWrapper.formContextId ? "formstate.change" : storyboardContextWrapper.tplContextId ? "state.change" : "context.change";
|
|
@@ -3308,6 +3331,10 @@
|
|
|
3308
3331
|
if ("if" in data && data.if === null) {
|
|
3309
3332
|
delete data.if;
|
|
3310
3333
|
}
|
|
3334
|
+
if ("to" in data) {
|
|
3335
|
+
var _pipes$yaml;
|
|
3336
|
+
data.to = data.to ? (_pipes$yaml = pipes.pipes.yaml(data.to)) !== null && _pipes$yaml !== void 0 ? _pipes$yaml : "" : "";
|
|
3337
|
+
}
|
|
3311
3338
|
var newContext = context;
|
|
3312
3339
|
if (overrideAppId !== context.app.id && attemptToVisit(data, ["APP", "I18N", "IMG"])) {
|
|
3313
3340
|
if (window.STANDALONE_MICRO_APPS) {
|
|
@@ -12063,6 +12090,7 @@
|
|
|
12063
12090
|
// See https://github.com/ReactTraining/react-router/blob/master/packages/react-router-dom/docs/guides/scroll-restoration.md
|
|
12064
12091
|
window.scrollTo(0, 0);
|
|
12065
12092
|
if (!failed) {
|
|
12093
|
+
locationContext.storyboardContextWrapper.handleAsyncAfterMount();
|
|
12066
12094
|
_this3.locationContext.handleBrickBindObserver();
|
|
12067
12095
|
_this3.locationContext.handlePageLoad();
|
|
12068
12096
|
_this3.locationContext.handleAnchorLoad();
|