@next-core/brick-kit 2.160.0 → 2.160.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/dist/index.bundle.js +354 -197
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +355 -198
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/CustomForms/CustomFormContext.d.ts.map +1 -1
- package/dist/types/core/CustomForms/ExpandCustomForm.d.ts +3 -2
- package/dist/types/core/CustomForms/ExpandCustomForm.d.ts.map +1 -1
- package/dist/types/core/CustomTemplates/expandCustomTemplate.d.ts +2 -1
- package/dist/types/core/CustomTemplates/expandCustomTemplate.d.ts.map +1 -1
- package/dist/types/core/Kernel.d.ts.map +1 -1
- package/dist/types/core/LocationContext.d.ts +3 -1
- package/dist/types/core/LocationContext.d.ts.map +1 -1
- package/dist/types/core/Resolver.d.ts +3 -2
- package/dist/types/core/Resolver.d.ts.map +1 -1
- package/dist/types/core/Router.d.ts +1 -0
- package/dist/types/core/Router.d.ts.map +1 -1
- package/dist/types/core/StoryboardContext.d.ts +5 -0
- package/dist/types/core/StoryboardContext.d.ts.map +1 -1
- package/dist/types/internal/getSubStoryboardByRoute.d.ts +2 -2
- package/dist/types/internal/getSubStoryboardByRoute.d.ts.map +1 -1
- package/dist/types/internal/menu.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.bundle.js
CHANGED
|
@@ -1731,6 +1731,7 @@
|
|
|
1731
1731
|
_defineProperty__default["default"](this, "data", new Map());
|
|
1732
1732
|
_defineProperty__default["default"](this, "tplContextId", void 0);
|
|
1733
1733
|
_defineProperty__default["default"](this, "formContextId", void 0);
|
|
1734
|
+
_defineProperty__default["default"](this, "pendingStack", []);
|
|
1734
1735
|
this.tplContextId = tplContextId;
|
|
1735
1736
|
this.formContextId = formContextId;
|
|
1736
1737
|
}
|
|
@@ -1832,15 +1833,59 @@
|
|
|
1832
1833
|
detail: item.value
|
|
1833
1834
|
}));
|
|
1834
1835
|
}
|
|
1835
|
-
|
|
1836
|
+
waitForUsedContext(data) {
|
|
1836
1837
|
var _this = this;
|
|
1838
|
+
return _asyncToGenerator__default["default"](function* () {
|
|
1839
|
+
if (_this.tplContextId || _this.formContextId) {
|
|
1840
|
+
return;
|
|
1841
|
+
}
|
|
1842
|
+
var usage = brickUtils.collectContextUsage(data, "CTX");
|
|
1843
|
+
if (usage.includesComputed) {
|
|
1844
|
+
for (var pending of _this.pendingStack) {
|
|
1845
|
+
yield pending.pendingResult;
|
|
1846
|
+
}
|
|
1847
|
+
} else if (usage.usedContexts.length > 0) {
|
|
1848
|
+
var _loop = function* (pendingContexts) {
|
|
1849
|
+
yield Promise.all(usage.usedContexts.map(ctx => pendingContexts.get(ctx)));
|
|
1850
|
+
};
|
|
1851
|
+
for (var {
|
|
1852
|
+
pendingContexts
|
|
1853
|
+
} of _this.pendingStack) {
|
|
1854
|
+
yield* _loop(pendingContexts);
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
})();
|
|
1858
|
+
}
|
|
1859
|
+
waitForAllContext() {
|
|
1860
|
+
var _this2 = this;
|
|
1861
|
+
return _asyncToGenerator__default["default"](function* () {
|
|
1862
|
+
if (_this2.tplContextId || _this2.formContextId) {
|
|
1863
|
+
return;
|
|
1864
|
+
}
|
|
1865
|
+
for (var pending of _this2.pendingStack) {
|
|
1866
|
+
yield pending.pendingResult;
|
|
1867
|
+
}
|
|
1868
|
+
})();
|
|
1869
|
+
}
|
|
1870
|
+
deferDefine(contextConfs, coreContext, brick) {
|
|
1871
|
+
var {
|
|
1872
|
+
mergedContext,
|
|
1873
|
+
keyword
|
|
1874
|
+
} = this.getResolveOptions(coreContext);
|
|
1875
|
+
if (Array.isArray(contextConfs) && contextConfs.length > 0) {
|
|
1876
|
+
var pending = brickUtils.deferResolveContextConcurrently(contextConfs, contextConf => resolveStoryboardContext(contextConf, mergedContext, this, brick), keyword);
|
|
1877
|
+
this.pendingStack.push(pending);
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
define(contextConfs, coreContext, brick) {
|
|
1881
|
+
var _this3 = this;
|
|
1837
1882
|
return _asyncToGenerator__default["default"](function* () {
|
|
1838
1883
|
if (Array.isArray(contextConfs)) {
|
|
1839
1884
|
var {
|
|
1840
1885
|
mergedContext,
|
|
1841
1886
|
keyword
|
|
1842
|
-
} =
|
|
1843
|
-
yield brickUtils.resolveContextConcurrently(contextConfs, contextConf => resolveStoryboardContext(contextConf, mergedContext,
|
|
1887
|
+
} = _this3.getResolveOptions(coreContext);
|
|
1888
|
+
yield brickUtils.resolveContextConcurrently(contextConfs, contextConf => resolveStoryboardContext(contextConf, mergedContext, _this3, brick), keyword);
|
|
1844
1889
|
}
|
|
1845
1890
|
})();
|
|
1846
1891
|
}
|
|
@@ -1892,6 +1937,7 @@
|
|
|
1892
1937
|
}
|
|
1893
1938
|
function _resolveNormalStoryboardContext() {
|
|
1894
1939
|
_resolveNormalStoryboardContext = _asyncToGenerator__default["default"](function* (contextConf, mergedContext, storyboardContextWrapper, brick) {
|
|
1940
|
+
yield storyboardContextWrapper.waitForUsedContext(contextConf.if);
|
|
1895
1941
|
if (!looseCheckIf(contextConf, mergedContext)) {
|
|
1896
1942
|
return false;
|
|
1897
1943
|
}
|
|
@@ -1901,6 +1947,7 @@
|
|
|
1901
1947
|
var isLazyResolve = false;
|
|
1902
1948
|
if (value === undefined) {
|
|
1903
1949
|
if (contextConf.resolve) {
|
|
1950
|
+
yield storyboardContextWrapper.waitForUsedContext(contextConf.resolve.if);
|
|
1904
1951
|
if (looseCheckIf(contextConf.resolve, mergedContext)) {
|
|
1905
1952
|
load = /*#__PURE__*/function () {
|
|
1906
1953
|
var _ref = _asyncToGenerator__default["default"](function* (options) {
|
|
@@ -1924,6 +1971,7 @@
|
|
|
1924
1971
|
}
|
|
1925
1972
|
}
|
|
1926
1973
|
if ((!load || isLazyResolve) && contextConf.value !== undefined) {
|
|
1974
|
+
yield storyboardContextWrapper.waitForUsedContext(contextConf.value);
|
|
1927
1975
|
// If the context has no resolve, just use its `value`.
|
|
1928
1976
|
// Or if the resolve is ignored or lazy, use its `value` as a fallback.
|
|
1929
1977
|
value = computeRealValue(contextConf.value, mergedContext, true);
|
|
@@ -2069,7 +2117,7 @@
|
|
|
2069
2117
|
_defineProperty__default["default"](this, "formState", void 0);
|
|
2070
2118
|
_defineProperty__default["default"](this, "id", _.uniqueId("form-ctx-"));
|
|
2071
2119
|
FormContextMap.set(this.id, this);
|
|
2072
|
-
this.formState = new StoryboardContextWrapper(
|
|
2120
|
+
this.formState = new StoryboardContextWrapper(undefined, this.id);
|
|
2073
2121
|
}
|
|
2074
2122
|
}
|
|
2075
2123
|
function getCustomFormContext(formContextId) {
|
|
@@ -2726,20 +2774,23 @@
|
|
|
2726
2774
|
function _constructMenu() {
|
|
2727
2775
|
_constructMenu = _asyncToGenerator__default["default"](function* (menuBar, context, kernel) {
|
|
2728
2776
|
var hasSubMenu = !!menuBar.subMenuId;
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2777
|
+
yield Promise.all([_asyncToGenerator__default["default"](function* () {
|
|
2778
|
+
if (menuBar.menuId) {
|
|
2779
|
+
var _menuBar$menu;
|
|
2780
|
+
var defaultCollapsed = (_menuBar$menu = menuBar.menu) === null || _menuBar$menu === void 0 ? void 0 : _menuBar$menu.defaultCollapsed;
|
|
2781
|
+
var menu = yield processMenu(menuBar.menuId, context, kernel, hasSubMenu);
|
|
2782
|
+
if (!_.isNil(defaultCollapsed)) {
|
|
2783
|
+
menu.defaultCollapsed = defaultCollapsed;
|
|
2784
|
+
}
|
|
2785
|
+
menuBar.menu = menu;
|
|
2786
|
+
}
|
|
2787
|
+
})(), _asyncToGenerator__default["default"](function* () {
|
|
2788
|
+
if (hasSubMenu) {
|
|
2789
|
+
menuBar.subMenu = yield processMenu(menuBar.subMenuId, context, kernel);
|
|
2790
|
+
} else {
|
|
2791
|
+
menuBar.subMenu = null;
|
|
2735
2792
|
}
|
|
2736
|
-
|
|
2737
|
-
}
|
|
2738
|
-
if (hasSubMenu) {
|
|
2739
|
-
menuBar.subMenu = yield processMenu(menuBar.subMenuId, context, kernel);
|
|
2740
|
-
} else {
|
|
2741
|
-
menuBar.subMenu = null;
|
|
2742
|
-
}
|
|
2793
|
+
})()]);
|
|
2743
2794
|
});
|
|
2744
2795
|
return _constructMenu.apply(this, arguments);
|
|
2745
2796
|
}
|
|
@@ -2820,8 +2871,8 @@
|
|
|
2820
2871
|
(function () {
|
|
2821
2872
|
var menuI18nNamespace = getI18nNamespace("menu", "".concat(menu.menuId, "~").concat(menu.app[0].appId, "+").concat(menu.instanceId));
|
|
2822
2873
|
// Support any language in `meta.i18n`.
|
|
2823
|
-
Object.entries(menu.i18n).forEach(
|
|
2824
|
-
var [lang, resources] =
|
|
2874
|
+
Object.entries(menu.i18n).forEach(_ref6 => {
|
|
2875
|
+
var [lang, resources] = _ref6;
|
|
2825
2876
|
i18next__default["default"].addResourceBundle(lang, menuI18nNamespace, resources);
|
|
2826
2877
|
});
|
|
2827
2878
|
menuWithI18n.set(menu, menuI18nNamespace);
|
|
@@ -2921,8 +2972,8 @@
|
|
|
2921
2972
|
}
|
|
2922
2973
|
collectAppsRequireI18nFulfilled(items, context.app.id, appsRequireI18nFulfilled);
|
|
2923
2974
|
yield kernel.fulfilStoryboardI18n([...appsRequireI18nFulfilled]);
|
|
2924
|
-
var menuData = _objectSpread__default["default"](_objectSpread__default["default"]({}, computeRealValueWithOverrideApp(restMenuData, rootAppId, context, kernel)), {}, {
|
|
2925
|
-
items: computeMenuItemsWithOverrideApp(items, context, kernel)
|
|
2975
|
+
var menuData = _objectSpread__default["default"](_objectSpread__default["default"]({}, yield computeRealValueWithOverrideApp(restMenuData, rootAppId, context, kernel)), {}, {
|
|
2976
|
+
items: yield computeMenuItemsWithOverrideApp(items, context, kernel)
|
|
2926
2977
|
});
|
|
2927
2978
|
return {
|
|
2928
2979
|
title: yield processMenuTitle(menuData),
|
|
@@ -2970,17 +3021,22 @@
|
|
|
2970
3021
|
collect(items);
|
|
2971
3022
|
}
|
|
2972
3023
|
function computeMenuItemsWithOverrideApp(items, context, kernel) {
|
|
2973
|
-
return items.map(
|
|
2974
|
-
var {
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
3024
|
+
return Promise.all(items.map( /*#__PURE__*/function () {
|
|
3025
|
+
var _ref3 = _asyncToGenerator__default["default"](function* (_ref2) {
|
|
3026
|
+
var {
|
|
3027
|
+
children
|
|
3028
|
+
} = _ref2,
|
|
3029
|
+
rest = _objectWithoutProperties__default["default"](_ref2, _excluded2$2);
|
|
3030
|
+
return _objectSpread__default["default"](_objectSpread__default["default"]({}, yield computeRealValueWithOverrideApp(rest, rest[symbolAppId], context, kernel)), {}, {
|
|
3031
|
+
children: children && (yield computeMenuItemsWithOverrideApp(children, context, kernel))
|
|
3032
|
+
});
|
|
2980
3033
|
});
|
|
2981
|
-
|
|
3034
|
+
return function (_x20) {
|
|
3035
|
+
return _ref3.apply(this, arguments);
|
|
3036
|
+
};
|
|
3037
|
+
}()));
|
|
2982
3038
|
}
|
|
2983
|
-
function processMenuTitle(
|
|
3039
|
+
function processMenuTitle(_x21) {
|
|
2984
3040
|
return _processMenuTitle.apply(this, arguments);
|
|
2985
3041
|
}
|
|
2986
3042
|
function _processMenuTitle() {
|
|
@@ -3059,25 +3115,32 @@
|
|
|
3059
3115
|
}
|
|
3060
3116
|
return false;
|
|
3061
3117
|
}
|
|
3062
|
-
function computeRealValueWithOverrideApp(
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3118
|
+
function computeRealValueWithOverrideApp(_x22, _x23, _x24, _x25) {
|
|
3119
|
+
return _computeRealValueWithOverrideApp.apply(this, arguments);
|
|
3120
|
+
}
|
|
3121
|
+
function _computeRealValueWithOverrideApp() {
|
|
3122
|
+
_computeRealValueWithOverrideApp = _asyncToGenerator__default["default"](function* (data, overrideAppId, context, kernel) {
|
|
3123
|
+
var newContext = context;
|
|
3124
|
+
if (overrideAppId !== context.app.id && attemptToVisit(data, ["APP", "I18N"])) {
|
|
3125
|
+
if (window.STANDALONE_MICRO_APPS) {
|
|
3126
|
+
newContext = _objectSpread__default["default"](_objectSpread__default["default"]({}, context), {}, {
|
|
3127
|
+
overrideApp: data[symbolOverrideApp],
|
|
3128
|
+
appendI18nNamespace: data[symbolMenuI18nNamespace]
|
|
3129
|
+
});
|
|
3130
|
+
} else {
|
|
3131
|
+
var storyboard = kernel.bootstrapData.storyboards.find(story => story.app.id === overrideAppId);
|
|
3132
|
+
newContext = _objectSpread__default["default"](_objectSpread__default["default"]({}, context), {}, {
|
|
3133
|
+
overrideApp: storyboard === null || storyboard === void 0 ? void 0 : storyboard.app,
|
|
3134
|
+
appendI18nNamespace: data[symbolMenuI18nNamespace]
|
|
3135
|
+
});
|
|
3136
|
+
}
|
|
3076
3137
|
}
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3138
|
+
yield kernel.router.waitForUsedContext(data);
|
|
3139
|
+
return computeRealValue(data, newContext, true, {
|
|
3140
|
+
ignoreSymbols: true
|
|
3141
|
+
});
|
|
3080
3142
|
});
|
|
3143
|
+
return _computeRealValueWithOverrideApp.apply(this, arguments);
|
|
3081
3144
|
}
|
|
3082
3145
|
|
|
3083
3146
|
var lazyBrickRegistry = new Map();
|
|
@@ -7634,17 +7697,21 @@
|
|
|
7634
7697
|
}
|
|
7635
7698
|
return lowLevelExpandCustomTemplate(template, brickConf, proxyBrick, context, tplContext);
|
|
7636
7699
|
}
|
|
7637
|
-
function asyncExpandCustomTemplate(_x, _x2, _x3) {
|
|
7700
|
+
function asyncExpandCustomTemplate(_x, _x2, _x3, _x4) {
|
|
7638
7701
|
return _asyncExpandCustomTemplate.apply(this, arguments);
|
|
7639
7702
|
}
|
|
7640
7703
|
function _asyncExpandCustomTemplate() {
|
|
7641
|
-
_asyncExpandCustomTemplate = _asyncToGenerator__default["default"](function* (brickConf, proxyBrick, context) {
|
|
7704
|
+
_asyncExpandCustomTemplate = _asyncToGenerator__default["default"](function* (brickConf, proxyBrick, context, locationContext) {
|
|
7642
7705
|
var tplContext = new CustomTemplateContext(proxyBrick);
|
|
7643
7706
|
var template = customTemplateRegistry.get(brickConf.brick);
|
|
7644
7707
|
if (template.contracts) {
|
|
7645
7708
|
collectWidgetContract(template.contracts);
|
|
7646
7709
|
}
|
|
7647
7710
|
if (Array.isArray(template.state)) {
|
|
7711
|
+
if (locationContext) {
|
|
7712
|
+
// Handle use cases of using `CTX.*` in template states.
|
|
7713
|
+
yield locationContext.storyboardContextWrapper.waitForUsedContext(template.state.map(state => [state.if, state.value, state.resolve]));
|
|
7714
|
+
}
|
|
7648
7715
|
yield tplContext.state.define(template.state, context, proxyBrick);
|
|
7649
7716
|
}
|
|
7650
7717
|
return lowLevelExpandCustomTemplate(template, brickConf, proxyBrick, context, tplContext);
|
|
@@ -8991,50 +9058,85 @@
|
|
|
8991
9058
|
return conf.type === "routes";
|
|
8992
9059
|
}
|
|
8993
9060
|
|
|
8994
|
-
function getSubStoryboardByRoute(
|
|
8995
|
-
|
|
8996
|
-
|
|
8997
|
-
|
|
8998
|
-
function
|
|
8999
|
-
|
|
9000
|
-
return
|
|
9001
|
-
|
|
9061
|
+
function getSubStoryboardByRoute(_x, _x2) {
|
|
9062
|
+
return _getSubStoryboardByRoute.apply(this, arguments);
|
|
9063
|
+
}
|
|
9064
|
+
function _getSubStoryboardByRoute() {
|
|
9065
|
+
_getSubStoryboardByRoute = _asyncToGenerator__default["default"](function* (storyboard, matcher) {
|
|
9066
|
+
function getSubRoutes(_x3) {
|
|
9067
|
+
return _getSubRoutes.apply(this, arguments);
|
|
9068
|
+
}
|
|
9069
|
+
function _getSubRoutes() {
|
|
9070
|
+
_getSubRoutes = _asyncToGenerator__default["default"](function* (routes) {
|
|
9071
|
+
return Promise.all((yield matcher(routes)).map(getSubRoute));
|
|
9002
9072
|
});
|
|
9073
|
+
return _getSubRoutes.apply(this, arguments);
|
|
9003
9074
|
}
|
|
9004
|
-
|
|
9005
|
-
|
|
9006
|
-
}
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
|
|
9016
|
-
|
|
9017
|
-
slots: Object.fromEntries(Object.entries(brickConf.slots).map(_ref => {
|
|
9018
|
-
var [slotId, slotConf] = _ref;
|
|
9019
|
-
if (slotConf.type === "routes") {
|
|
9020
|
-
return [slotId, _objectSpread__default["default"](_objectSpread__default["default"]({}, slotConf), {}, {
|
|
9021
|
-
routes: getSubRoutes(slotConf.routes)
|
|
9022
|
-
})];
|
|
9023
|
-
} /* istanbul ignore else: should never reach */else if (slotConf.type === "bricks") {
|
|
9024
|
-
return [slotId, _objectSpread__default["default"](_objectSpread__default["default"]({}, slotConf), {}, {
|
|
9025
|
-
bricks: getSubBricks(slotConf.bricks)
|
|
9026
|
-
})];
|
|
9027
|
-
}
|
|
9028
|
-
/* istanbul ignore next: should never reach */
|
|
9029
|
-
return [slotId, slotConf];
|
|
9030
|
-
}))
|
|
9075
|
+
function getSubRoute(_x4) {
|
|
9076
|
+
return _getSubRoute.apply(this, arguments);
|
|
9077
|
+
}
|
|
9078
|
+
function _getSubRoute() {
|
|
9079
|
+
_getSubRoute = _asyncToGenerator__default["default"](function* (route) {
|
|
9080
|
+
if (route.type === "routes") {
|
|
9081
|
+
return _objectSpread__default["default"](_objectSpread__default["default"]({}, route), {}, {
|
|
9082
|
+
routes: yield getSubRoutes(route.routes)
|
|
9083
|
+
});
|
|
9084
|
+
}
|
|
9085
|
+
return _objectSpread__default["default"](_objectSpread__default["default"]({}, route), {}, {
|
|
9086
|
+
bricks: yield getSubBricks(route.bricks)
|
|
9087
|
+
});
|
|
9031
9088
|
});
|
|
9089
|
+
return _getSubRoute.apply(this, arguments);
|
|
9032
9090
|
}
|
|
9033
|
-
|
|
9034
|
-
|
|
9035
|
-
|
|
9036
|
-
|
|
9091
|
+
function getSubBricks(_x5) {
|
|
9092
|
+
return _getSubBricks.apply(this, arguments);
|
|
9093
|
+
}
|
|
9094
|
+
function _getSubBricks() {
|
|
9095
|
+
_getSubBricks = _asyncToGenerator__default["default"](function* (bricks) {
|
|
9096
|
+
if (Array.isArray(bricks)) {
|
|
9097
|
+
return Promise.all(bricks.map(brickConf => getSubBrick(brickConf)));
|
|
9098
|
+
}
|
|
9099
|
+
return bricks;
|
|
9100
|
+
});
|
|
9101
|
+
return _getSubBricks.apply(this, arguments);
|
|
9102
|
+
}
|
|
9103
|
+
function getSubBrick(_x6) {
|
|
9104
|
+
return _getSubBrick.apply(this, arguments);
|
|
9105
|
+
}
|
|
9106
|
+
function _getSubBrick() {
|
|
9107
|
+
_getSubBrick = _asyncToGenerator__default["default"](function* (brickConf) {
|
|
9108
|
+
if (brickUtils.isObject(brickConf.slots)) {
|
|
9109
|
+
return _objectSpread__default["default"](_objectSpread__default["default"]({}, brickConf), {}, {
|
|
9110
|
+
slots: Object.fromEntries(yield Promise.all(Object.entries(brickConf.slots).map( /*#__PURE__*/function () {
|
|
9111
|
+
var _ref2 = _asyncToGenerator__default["default"](function* (_ref) {
|
|
9112
|
+
var [slotId, slotConf] = _ref;
|
|
9113
|
+
if (slotConf.type === "routes") {
|
|
9114
|
+
return [slotId, _objectSpread__default["default"](_objectSpread__default["default"]({}, slotConf), {}, {
|
|
9115
|
+
routes: yield getSubRoutes(slotConf.routes)
|
|
9116
|
+
})];
|
|
9117
|
+
} /* istanbul ignore else: should never reach */else if (slotConf.type === "bricks") {
|
|
9118
|
+
return [slotId, _objectSpread__default["default"](_objectSpread__default["default"]({}, slotConf), {}, {
|
|
9119
|
+
bricks: yield getSubBricks(slotConf.bricks)
|
|
9120
|
+
})];
|
|
9121
|
+
}
|
|
9122
|
+
/* istanbul ignore next: should never reach */
|
|
9123
|
+
return [slotId, slotConf];
|
|
9124
|
+
});
|
|
9125
|
+
return function (_x7) {
|
|
9126
|
+
return _ref2.apply(this, arguments);
|
|
9127
|
+
};
|
|
9128
|
+
}())))
|
|
9129
|
+
});
|
|
9130
|
+
}
|
|
9131
|
+
return brickConf;
|
|
9132
|
+
});
|
|
9133
|
+
return _getSubBrick.apply(this, arguments);
|
|
9134
|
+
}
|
|
9135
|
+
return _objectSpread__default["default"](_objectSpread__default["default"]({}, storyboard), {}, {
|
|
9136
|
+
routes: yield getSubRoutes(storyboard.routes)
|
|
9137
|
+
});
|
|
9037
9138
|
});
|
|
9139
|
+
return _getSubStoryboardByRoute.apply(this, arguments);
|
|
9038
9140
|
}
|
|
9039
9141
|
|
|
9040
9142
|
function listenOnTrackingContext(brick, trackingContextList, context) {
|
|
@@ -9085,14 +9187,18 @@
|
|
|
9085
9187
|
}
|
|
9086
9188
|
return getFinalStoryBoard(formData, brickConf, isPreview, formContext);
|
|
9087
9189
|
}
|
|
9088
|
-
function AsyncExpandCustomForm(_x, _x2, _x3, _x4) {
|
|
9190
|
+
function AsyncExpandCustomForm(_x, _x2, _x3, _x4, _x5) {
|
|
9089
9191
|
return _AsyncExpandCustomForm.apply(this, arguments);
|
|
9090
9192
|
}
|
|
9091
9193
|
function _AsyncExpandCustomForm() {
|
|
9092
|
-
_AsyncExpandCustomForm = _asyncToGenerator__default["default"](function* (formData, brickConf, isPreview, context) {
|
|
9194
|
+
_AsyncExpandCustomForm = _asyncToGenerator__default["default"](function* (formData, brickConf, isPreview, context, locationContext) {
|
|
9093
9195
|
var formContext = new CustomFormContext();
|
|
9094
9196
|
formData = initFormContext(formData, brickConf, isPreview);
|
|
9095
9197
|
if (Array.isArray(formData.context)) {
|
|
9198
|
+
if (locationContext) {
|
|
9199
|
+
// Handle use cases of using `CTX.*` in template states.
|
|
9200
|
+
yield locationContext.storyboardContextWrapper.waitForUsedContext(formData.context.map(state => [state.if, state.value, state.resolve]));
|
|
9201
|
+
}
|
|
9096
9202
|
yield formContext.formState.define(formData.context, _objectSpread__default["default"](_objectSpread__default["default"]({}, context), {}, {
|
|
9097
9203
|
formContextId: formContext.id
|
|
9098
9204
|
}), {});
|
|
@@ -9478,7 +9584,7 @@
|
|
|
9478
9584
|
_defineProperty__default["default"](this, "observersList", []);
|
|
9479
9585
|
this.kernel = kernel;
|
|
9480
9586
|
this.location = location;
|
|
9481
|
-
this.resolver = new Resolver(kernel);
|
|
9587
|
+
this.resolver = new Resolver(kernel, this);
|
|
9482
9588
|
this.query = new URLSearchParams(location.search);
|
|
9483
9589
|
this.messageDispatcher = getMessageDispatcher();
|
|
9484
9590
|
}
|
|
@@ -9516,60 +9622,79 @@
|
|
|
9516
9622
|
match: this.currentMatch
|
|
9517
9623
|
});
|
|
9518
9624
|
}
|
|
9625
|
+
deferComputeRealValue() {
|
|
9626
|
+
var _arguments = arguments,
|
|
9627
|
+
_this = this;
|
|
9628
|
+
return _asyncToGenerator__default["default"](function* () {
|
|
9629
|
+
yield _this.storyboardContextWrapper.waitForUsedContext(_arguments.length <= 0 ? undefined : _arguments[0]);
|
|
9630
|
+
return computeRealValue(..._arguments);
|
|
9631
|
+
})();
|
|
9632
|
+
}
|
|
9519
9633
|
matchRoutes(routes, app) {
|
|
9520
|
-
var
|
|
9521
|
-
|
|
9522
|
-
var
|
|
9523
|
-
|
|
9524
|
-
|
|
9525
|
-
|
|
9526
|
-
|
|
9527
|
-
v: "missed"
|
|
9528
|
-
};
|
|
9529
|
-
}
|
|
9530
|
-
var match = brickUtils.matchPath(_this.location.pathname, {
|
|
9531
|
-
path: computedPath,
|
|
9532
|
-
exact: route.exact,
|
|
9533
|
-
checkIf: context => looseCheckIf(route, context),
|
|
9534
|
-
getContext: match => _this.getContext({
|
|
9535
|
-
match
|
|
9536
|
-
})
|
|
9537
|
-
});
|
|
9538
|
-
if (match !== null) {
|
|
9539
|
-
if (app.noAuthGuard || route.public || isLoggedIn()) {
|
|
9540
|
-
_this.currentMatch = match;
|
|
9634
|
+
var _this2 = this;
|
|
9635
|
+
return _asyncToGenerator__default["default"](function* () {
|
|
9636
|
+
var _loop = function* (route) {
|
|
9637
|
+
var computedPath = brickUtils.computeRealRoutePath(route.path, app);
|
|
9638
|
+
if ([].concat(computedPath).includes(undefined)) {
|
|
9639
|
+
// eslint-disable-next-line no-console
|
|
9640
|
+
console.error("Invalid route with invalid path:", route);
|
|
9541
9641
|
return {
|
|
9542
|
-
v:
|
|
9543
|
-
match,
|
|
9544
|
-
route
|
|
9545
|
-
}
|
|
9642
|
+
v: "missed"
|
|
9546
9643
|
};
|
|
9547
9644
|
}
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
|
|
9645
|
+
yield _this2.storyboardContextWrapper.waitForUsedContext(route.if);
|
|
9646
|
+
var match = brickUtils.matchPath(_this2.location.pathname, {
|
|
9647
|
+
path: computedPath,
|
|
9648
|
+
exact: route.exact,
|
|
9649
|
+
checkIf: context => looseCheckIf(route, context),
|
|
9650
|
+
getContext: match => _this2.getContext({
|
|
9651
|
+
match
|
|
9652
|
+
})
|
|
9653
|
+
});
|
|
9654
|
+
if (match !== null) {
|
|
9655
|
+
if (app.noAuthGuard || route.public || isLoggedIn()) {
|
|
9656
|
+
_this2.currentMatch = match;
|
|
9657
|
+
return {
|
|
9658
|
+
v: {
|
|
9659
|
+
match,
|
|
9660
|
+
route
|
|
9661
|
+
}
|
|
9662
|
+
};
|
|
9663
|
+
}
|
|
9664
|
+
return {
|
|
9665
|
+
v: "unauthenticated"
|
|
9666
|
+
};
|
|
9667
|
+
}
|
|
9668
|
+
};
|
|
9669
|
+
for (var route of routes) {
|
|
9670
|
+
var _ret = yield* _loop(route);
|
|
9671
|
+
if (typeof _ret === "object") return _ret.v;
|
|
9551
9672
|
}
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
var _ret = _loop(route);
|
|
9555
|
-
if (typeof _ret === "object") return _ret.v;
|
|
9556
|
-
}
|
|
9557
|
-
return "missed";
|
|
9673
|
+
return "missed";
|
|
9674
|
+
})();
|
|
9558
9675
|
}
|
|
9559
9676
|
matchStoryboard(storyboards) {
|
|
9560
9677
|
return matchStoryboard(storyboards, this.location.pathname);
|
|
9561
9678
|
}
|
|
9562
9679
|
getSubStoryboardByRoute(storyboard) {
|
|
9563
|
-
var
|
|
9564
|
-
|
|
9565
|
-
|
|
9566
|
-
|
|
9567
|
-
|
|
9680
|
+
var _this3 = this;
|
|
9681
|
+
return _asyncToGenerator__default["default"](function* () {
|
|
9682
|
+
var matcher = /*#__PURE__*/function () {
|
|
9683
|
+
var _ref2 = _asyncToGenerator__default["default"](function* (routes) {
|
|
9684
|
+
var matched = yield _this3.matchRoutes(routes, storyboard.app);
|
|
9685
|
+
return brickUtils.isObject(matched) ? [matched.route] : [];
|
|
9686
|
+
});
|
|
9687
|
+
return function matcher(_x) {
|
|
9688
|
+
return _ref2.apply(this, arguments);
|
|
9689
|
+
};
|
|
9690
|
+
}();
|
|
9691
|
+
return getSubStoryboardByRoute(storyboard, matcher);
|
|
9692
|
+
})();
|
|
9568
9693
|
}
|
|
9569
9694
|
mountRoutes(routes, slotId, mountRoutesResult) {
|
|
9570
|
-
var
|
|
9695
|
+
var _this4 = this;
|
|
9571
9696
|
return _asyncToGenerator__default["default"](function* () {
|
|
9572
|
-
var matched =
|
|
9697
|
+
var matched = yield _this4.matchRoutes(routes, _this4.kernel.nextApp);
|
|
9573
9698
|
var redirect;
|
|
9574
9699
|
var redirectConf = {};
|
|
9575
9700
|
var context;
|
|
@@ -9583,19 +9708,26 @@
|
|
|
9583
9708
|
default:
|
|
9584
9709
|
mountRoutesResult.route = route = matched.route;
|
|
9585
9710
|
if (route.segues) {
|
|
9586
|
-
Object.assign(
|
|
9711
|
+
Object.assign(_this4.segues, route.segues);
|
|
9587
9712
|
}
|
|
9588
9713
|
if (route.hybrid) {
|
|
9589
9714
|
mountRoutesResult.flags.hybrid = true;
|
|
9590
9715
|
}
|
|
9591
|
-
context =
|
|
9716
|
+
context = _this4.getContext({
|
|
9592
9717
|
match: matched.match
|
|
9593
9718
|
});
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
yield
|
|
9597
|
-
|
|
9598
|
-
|
|
9719
|
+
yield _this4.storyboardContextWrapper.waitForUsedContext(route.defineResolves);
|
|
9720
|
+
_this4.resolver.defineResolves(route.defineResolves, context);
|
|
9721
|
+
yield _this4.mountProviders(route.providers, matched.match, slotId, mountRoutesResult);
|
|
9722
|
+
|
|
9723
|
+
// istanbul ignore else
|
|
9724
|
+
if (_this4.kernel.getFeatureFlags()["next-core-deferred-context"]) {
|
|
9725
|
+
_this4.storyboardContextWrapper.deferDefine(route.context, context);
|
|
9726
|
+
} else {
|
|
9727
|
+
yield _this4.storyboardContextWrapper.define(route.context, context);
|
|
9728
|
+
}
|
|
9729
|
+
yield _this4.preCheckPermissions(route, context);
|
|
9730
|
+
redirect = yield _this4.deferComputeRealValue(route.redirect, context, true);
|
|
9599
9731
|
if (redirect) {
|
|
9600
9732
|
if (typeof redirect === "string") {
|
|
9601
9733
|
// Directly redirect.
|
|
@@ -9605,7 +9737,7 @@
|
|
|
9605
9737
|
break;
|
|
9606
9738
|
} else {
|
|
9607
9739
|
// Resolvable redirect.
|
|
9608
|
-
yield
|
|
9740
|
+
yield _this4.resolver.resolveOne("reference", redirect, redirectConf);
|
|
9609
9741
|
if (redirectConf.redirect) {
|
|
9610
9742
|
mountRoutesResult.flags.redirect = {
|
|
9611
9743
|
path: redirectConf.redirect
|
|
@@ -9614,20 +9746,20 @@
|
|
|
9614
9746
|
}
|
|
9615
9747
|
}
|
|
9616
9748
|
}
|
|
9617
|
-
yield
|
|
9749
|
+
yield _this4.mountMenu(route.menu, matched.match, mountRoutesResult);
|
|
9618
9750
|
if (route.documentId) {
|
|
9619
9751
|
mountRoutesResult.appBar.documentId = route.documentId;
|
|
9620
9752
|
}
|
|
9621
9753
|
if (isRouteConfOfRoutes(route) && Array.isArray(route.routes)) {
|
|
9622
|
-
yield
|
|
9623
|
-
yield
|
|
9754
|
+
yield _this4.preFetchMenu(route.context);
|
|
9755
|
+
yield _this4.mountRoutes(route.routes, slotId, mountRoutesResult);
|
|
9624
9756
|
} else if (isRouteConfOfBricks(route) && Array.isArray(route.bricks)) {
|
|
9625
|
-
yield
|
|
9626
|
-
yield
|
|
9757
|
+
yield _this4.preFetchMenu(route);
|
|
9758
|
+
yield _this4.mountBricks(route.bricks, matched.match, slotId, mountRoutesResult);
|
|
9627
9759
|
|
|
9628
9760
|
// analytics data (page_view event)
|
|
9629
9761
|
if (route.analyticsData) {
|
|
9630
|
-
mountRoutesResult.analyticsData =
|
|
9762
|
+
mountRoutesResult.analyticsData = yield _this4.deferComputeRealValue(route.analyticsData, context, true);
|
|
9631
9763
|
}
|
|
9632
9764
|
}
|
|
9633
9765
|
}
|
|
@@ -9635,7 +9767,7 @@
|
|
|
9635
9767
|
})();
|
|
9636
9768
|
}
|
|
9637
9769
|
mountMenu(menuConf, match, mountRoutesResult) {
|
|
9638
|
-
var
|
|
9770
|
+
var _this5 = this;
|
|
9639
9771
|
return _asyncToGenerator__default["default"](function* () {
|
|
9640
9772
|
if (menuConf === false) {
|
|
9641
9773
|
// `route.menu` 设置为 `false` 表示不显示顶栏和侧栏。
|
|
@@ -9647,7 +9779,7 @@
|
|
|
9647
9779
|
if (!menuConf) {
|
|
9648
9780
|
return;
|
|
9649
9781
|
}
|
|
9650
|
-
var context =
|
|
9782
|
+
var context = _this5.getContext({
|
|
9651
9783
|
match
|
|
9652
9784
|
});
|
|
9653
9785
|
if (menuConf.type === "brick") {
|
|
@@ -9657,6 +9789,7 @@
|
|
|
9657
9789
|
// 那么可以将菜单配置指定为一个构件,这个构件会被装载到背景容器中(不会在界面中显示),
|
|
9658
9790
|
// 应该在这个构件的 `connectedCallback` 中执行相关菜单设置,
|
|
9659
9791
|
// 例如 `getRuntime().menuBar.setAppMenu(...)`。
|
|
9792
|
+
yield _this5.storyboardContextWrapper.waitForUsedContext(menuConf.properties);
|
|
9660
9793
|
var brick = {
|
|
9661
9794
|
type: menuConf.brick,
|
|
9662
9795
|
properties: computeRealProperties(menuConf.properties, context, menuConf.injectDeep !== false),
|
|
@@ -9664,16 +9797,16 @@
|
|
|
9664
9797
|
context,
|
|
9665
9798
|
children: []
|
|
9666
9799
|
};
|
|
9667
|
-
|
|
9800
|
+
_this5.registerHandlersFromLifeCycle(menuConf.lifeCycle, brick, match);
|
|
9668
9801
|
|
|
9669
9802
|
// Then, resolve the brick.
|
|
9670
|
-
yield
|
|
9803
|
+
yield _this5.resolver.resolve(menuConf, brick, context);
|
|
9671
9804
|
mountRoutesResult.menuInBg.push(brick);
|
|
9672
9805
|
return;
|
|
9673
9806
|
}
|
|
9674
9807
|
var injectDeep = menuConf.injectDeep;
|
|
9675
9808
|
if (menuConf.type === "resolve") {
|
|
9676
|
-
yield
|
|
9809
|
+
yield _this5.resolver.resolveOne("reference", _objectSpread__default["default"]({
|
|
9677
9810
|
transformMapArray: false
|
|
9678
9811
|
}, menuConf.resolve), menuConf, null, context);
|
|
9679
9812
|
injectDeep = false;
|
|
@@ -9681,7 +9814,7 @@
|
|
|
9681
9814
|
|
|
9682
9815
|
// 静态菜单配置,仅在有值时才设置,这样可以让菜单设置也具有按路由层级覆盖的能力。
|
|
9683
9816
|
var otherMenuConf = _.omit(menuConf, ["injectDeep", "type"]);
|
|
9684
|
-
var injectedMenuConf = injectDeep !== false ?
|
|
9817
|
+
var injectedMenuConf = injectDeep !== false ? yield _this5.deferComputeRealValue(otherMenuConf, context, true) : otherMenuConf;
|
|
9685
9818
|
var {
|
|
9686
9819
|
sidebarMenu,
|
|
9687
9820
|
pageTitle,
|
|
@@ -9713,11 +9846,11 @@
|
|
|
9713
9846
|
})();
|
|
9714
9847
|
}
|
|
9715
9848
|
mountProviders(providers, match, slotId, mountRoutesResult) {
|
|
9716
|
-
var
|
|
9849
|
+
var _this6 = this;
|
|
9717
9850
|
return _asyncToGenerator__default["default"](function* () {
|
|
9718
9851
|
if (Array.isArray(providers)) {
|
|
9719
9852
|
for (var providerConf of providers) {
|
|
9720
|
-
yield
|
|
9853
|
+
yield _this6.mountBrick(_objectSpread__default["default"](_objectSpread__default["default"]({}, typeof providerConf === "string" ? {
|
|
9721
9854
|
brick: providerConf
|
|
9722
9855
|
} : providerConf), {}, {
|
|
9723
9856
|
bg: true,
|
|
@@ -9728,11 +9861,11 @@
|
|
|
9728
9861
|
})();
|
|
9729
9862
|
}
|
|
9730
9863
|
mountBricks(bricks, match, slotId, mountRoutesResult, tplStack) {
|
|
9731
|
-
var
|
|
9864
|
+
var _this7 = this;
|
|
9732
9865
|
return _asyncToGenerator__default["default"](function* () {
|
|
9733
9866
|
for (var brickConf of bricks) {
|
|
9734
9867
|
try {
|
|
9735
|
-
yield
|
|
9868
|
+
yield _this7.mountBrick(brickConf, match, slotId, mountRoutesResult, tplStack && new Map(tplStack));
|
|
9736
9869
|
} catch (error) {
|
|
9737
9870
|
if (error instanceof ResolveRequestError) {
|
|
9738
9871
|
var errorMessage = httpErrorToString(error.rawError);
|
|
@@ -9760,57 +9893,59 @@
|
|
|
9760
9893
|
})();
|
|
9761
9894
|
}
|
|
9762
9895
|
checkResolvableIf(ifContainer, context) {
|
|
9763
|
-
var
|
|
9896
|
+
var _this8 = this;
|
|
9764
9897
|
return _asyncToGenerator__default["default"](function* () {
|
|
9898
|
+
yield _this8.storyboardContextWrapper.waitForUsedContext(ifContainer.if);
|
|
9765
9899
|
if (brickUtils.isObject(ifContainer.if)) {
|
|
9766
9900
|
var ifChecked = computeRealValue(ifContainer.if, context, true);
|
|
9767
9901
|
var ifConf = {};
|
|
9768
|
-
yield
|
|
9902
|
+
yield _this8.resolver.resolveOne("reference", ifChecked, ifConf);
|
|
9769
9903
|
return !brickUtils.hasOwnProperty(ifConf, "if") || !!ifConf.if;
|
|
9770
9904
|
}
|
|
9771
9905
|
return looseCheckIf(ifContainer, context);
|
|
9772
9906
|
})();
|
|
9773
9907
|
}
|
|
9774
9908
|
preCheckPermissions(container, context) {
|
|
9909
|
+
var _this9 = this;
|
|
9775
9910
|
return _asyncToGenerator__default["default"](function* () {
|
|
9776
9911
|
if (isLoggedIn() && !getAuth().isAdmin && container.permissionsPreCheck && Array.isArray(container.permissionsPreCheck)) {
|
|
9777
|
-
var usedActions =
|
|
9912
|
+
var usedActions = yield _this9.deferComputeRealValue(container.permissionsPreCheck, context, true);
|
|
9778
9913
|
yield validatePermissions(usedActions);
|
|
9779
9914
|
}
|
|
9780
9915
|
})();
|
|
9781
9916
|
}
|
|
9782
9917
|
mountBrick(brickConf, match, slotId, mountRoutesResult) {
|
|
9783
|
-
var
|
|
9784
|
-
|
|
9918
|
+
var _arguments2 = arguments,
|
|
9919
|
+
_this10 = this;
|
|
9785
9920
|
return _asyncToGenerator__default["default"](function* () {
|
|
9786
|
-
var
|
|
9787
|
-
var tplStack =
|
|
9921
|
+
var _this10$kernel$nextAp, _brickConf$lifeCycle, _brick$lifeCycle;
|
|
9922
|
+
var tplStack = _arguments2.length > 4 && _arguments2[4] !== undefined ? _arguments2[4] : new Map();
|
|
9788
9923
|
var tplContextId = brickConf[symbolForTplContextId];
|
|
9789
9924
|
var formContextId = brickConf[symbolForFormContextId];
|
|
9790
|
-
var context =
|
|
9925
|
+
var context = _this10.getContext({
|
|
9791
9926
|
match,
|
|
9792
9927
|
tplContextId,
|
|
9793
9928
|
formContextId
|
|
9794
9929
|
});
|
|
9795
9930
|
|
|
9796
9931
|
// First, check whether the brick should be rendered.
|
|
9797
|
-
if (!(yield
|
|
9932
|
+
if (!(yield _this10.checkResolvableIf(brickConf, context))) {
|
|
9798
9933
|
return;
|
|
9799
9934
|
}
|
|
9800
9935
|
|
|
9801
9936
|
// Then, resolve the template to a brick.
|
|
9802
9937
|
if (brickConf.template) {
|
|
9803
|
-
yield
|
|
9938
|
+
yield _this10.resolver.resolve(brickConf, null, context);
|
|
9804
9939
|
}
|
|
9805
9940
|
|
|
9806
9941
|
// Check `if` again for dynamic loaded templates.
|
|
9807
|
-
if (!(yield
|
|
9942
|
+
if (!(yield _this10.checkResolvableIf(brickConf, context))) {
|
|
9808
9943
|
return;
|
|
9809
9944
|
}
|
|
9810
9945
|
|
|
9811
9946
|
// If it's a custom template, `tplTagName` is the tag name of the template.
|
|
9812
9947
|
// Otherwise, `tplTagName` is false.
|
|
9813
|
-
var tplTagName = getTagNameOfCustomTemplate(brickConf.brick, (
|
|
9948
|
+
var tplTagName = getTagNameOfCustomTemplate(brickConf.brick, (_this10$kernel$nextAp = _this10.kernel.nextApp) === null || _this10$kernel$nextAp === void 0 ? void 0 : _this10$kernel$nextAp.id);
|
|
9814
9949
|
if (tplTagName) {
|
|
9815
9950
|
var _tplStack$get;
|
|
9816
9951
|
var tplCount = (_tplStack$get = tplStack.get(tplTagName)) !== null && _tplStack$get !== void 0 ? _tplStack$get : 0;
|
|
@@ -9823,9 +9958,16 @@
|
|
|
9823
9958
|
brickConf.properties.formData = JSON.stringify(brickConf.properties.formData);
|
|
9824
9959
|
}
|
|
9825
9960
|
var brick = {};
|
|
9826
|
-
|
|
9827
|
-
|
|
9961
|
+
|
|
9962
|
+
// istanbul ignore else
|
|
9963
|
+
if (_this10.kernel.getFeatureFlags()["next-core-deferred-context"]) {
|
|
9964
|
+
_this10.storyboardContextWrapper.deferDefine(brickConf.context, context, brick);
|
|
9965
|
+
} else {
|
|
9966
|
+
yield _this10.storyboardContextWrapper.define(brickConf.context, context, brick);
|
|
9967
|
+
}
|
|
9968
|
+
yield _this10.preCheckPermissions(brickConf, context);
|
|
9828
9969
|
var trackingContextList = [];
|
|
9970
|
+
yield _this10.storyboardContextWrapper.waitForUsedContext(brickConf.properties);
|
|
9829
9971
|
Object.assign(brick, _objectSpread__default["default"]({
|
|
9830
9972
|
type: tplTagName || brickConf.brick,
|
|
9831
9973
|
properties: computeRealProperties(brickConf.properties, context, brickConf.injectDeep !== false, trackingContextList),
|
|
@@ -9843,8 +9985,8 @@
|
|
|
9843
9985
|
}
|
|
9844
9986
|
} : {}));
|
|
9845
9987
|
if (brickConf[symbolForComputedPropsFromProxy]) {
|
|
9846
|
-
Object.entries(brickConf[symbolForComputedPropsFromProxy]).forEach(
|
|
9847
|
-
var [propName, propValue] =
|
|
9988
|
+
Object.entries(brickConf[symbolForComputedPropsFromProxy]).forEach(_ref3 => {
|
|
9989
|
+
var [propName, propValue] = _ref3;
|
|
9848
9990
|
_.set(brick.properties, propName, propValue);
|
|
9849
9991
|
});
|
|
9850
9992
|
}
|
|
@@ -9852,36 +9994,36 @@
|
|
|
9852
9994
|
if (brick.refForProxy) {
|
|
9853
9995
|
brick.refForProxy.brick = brick;
|
|
9854
9996
|
}
|
|
9855
|
-
|
|
9997
|
+
_this10.registerHandlersFromLifeCycle(brickConf.lifeCycle, brick, match, tplContextId);
|
|
9856
9998
|
if ((_brick$lifeCycle = brick.lifeCycle) !== null && _brick$lifeCycle !== void 0 && _brick$lifeCycle.onScrollIntoView) {
|
|
9857
|
-
|
|
9999
|
+
_this10.brickBindObserver(brick);
|
|
9858
10000
|
}
|
|
9859
10001
|
|
|
9860
10002
|
// Then, resolve the brick.
|
|
9861
|
-
yield
|
|
10003
|
+
yield _this10.resolver.resolve(brickConf, brick, context);
|
|
9862
10004
|
var expandedBrickConf = brickConf;
|
|
9863
10005
|
var isBaseLayout = ["base-layout.tpl-homepage-base-module", "base-layout.tpl-base-page-module", "base-layout.tpl-homepage-base-module-cmdb", "base-layout.tpl-base-page-module-cmdb"].includes(tplTagName);
|
|
9864
|
-
if (tplTagName && (!isBaseLayout ||
|
|
10006
|
+
if (tplTagName && (!isBaseLayout || _this10.kernel.getFeatureFlags()["support-ui-8.0-base-layout"] && isBaseLayout)) {
|
|
9865
10007
|
var _customTemplateRegist;
|
|
9866
|
-
yield
|
|
10008
|
+
yield _this10.preFetchMenu((_customTemplateRegist = customTemplateRegistry.get(tplTagName)) === null || _customTemplateRegist === void 0 ? void 0 : _customTemplateRegist.bricks);
|
|
9867
10009
|
expandedBrickConf = yield asyncExpandCustomTemplate(_objectSpread__default["default"](_objectSpread__default["default"]({}, brickConf), {}, {
|
|
9868
10010
|
brick: tplTagName,
|
|
9869
10011
|
// Properties are computed for custom templates.
|
|
9870
10012
|
properties: brick.properties
|
|
9871
|
-
}), brick, context);
|
|
10013
|
+
}), brick, context, _this10);
|
|
9872
10014
|
|
|
9873
10015
|
// Try to load deps for dynamic added bricks.
|
|
9874
|
-
yield
|
|
10016
|
+
yield _this10.kernel.loadDynamicBricksInBrickConf(expandedBrickConf);
|
|
9875
10017
|
}
|
|
9876
10018
|
if (brick.type === formRenderer) {
|
|
9877
10019
|
var formData = typeof brick.properties.formData === "string" ? JSON.parse(brick.properties.formData) : brick.properties.formData;
|
|
9878
|
-
expandedBrickConf = yield AsyncExpandCustomForm(formData, brickConf, brick.properties.isPreview, context);
|
|
9879
|
-
yield
|
|
10020
|
+
expandedBrickConf = yield AsyncExpandCustomForm(formData, brickConf, brick.properties.isPreview, context, _this10);
|
|
10021
|
+
yield _this10.kernel.loadDynamicBricksInBrickConf(expandedBrickConf);
|
|
9880
10022
|
}
|
|
9881
10023
|
if (expandedBrickConf.exports) {
|
|
9882
10024
|
for (var [prop, ctxName] of Object.entries(expandedBrickConf.exports)) {
|
|
9883
10025
|
if (typeof ctxName === "string" && ctxName.startsWith("CTX.")) {
|
|
9884
|
-
|
|
10026
|
+
_this10.storyboardContextWrapper.set(ctxName.substring(4), {
|
|
9885
10027
|
type: "brick-property",
|
|
9886
10028
|
brick,
|
|
9887
10029
|
prop
|
|
@@ -9892,8 +10034,8 @@
|
|
|
9892
10034
|
if (expandedBrickConf.bg) {
|
|
9893
10035
|
// A bg brick has no slotId.
|
|
9894
10036
|
brick.slotId = undefined;
|
|
9895
|
-
yield
|
|
9896
|
-
appendBrick(brick,
|
|
10037
|
+
yield _this10.kernel.loadDynamicBricks([brick.type]);
|
|
10038
|
+
appendBrick(brick, _this10.kernel.mountPoints.bg);
|
|
9897
10039
|
} else {
|
|
9898
10040
|
if (expandedBrickConf.portal) {
|
|
9899
10041
|
// A portal brick has no slotId.
|
|
@@ -9908,9 +10050,9 @@
|
|
|
9908
10050
|
main: brick.children
|
|
9909
10051
|
});
|
|
9910
10052
|
if (slotConf.type === "bricks") {
|
|
9911
|
-
yield
|
|
10053
|
+
yield _this10.mountBricks(slotConf.bricks, match, _slotId, slottedMountRoutesResult, tplStack);
|
|
9912
10054
|
} else if (slotConf.type === "routes") {
|
|
9913
|
-
yield
|
|
10055
|
+
yield _this10.mountRoutes(slotConf.routes, _slotId, slottedMountRoutesResult);
|
|
9914
10056
|
}
|
|
9915
10057
|
}
|
|
9916
10058
|
}
|
|
@@ -10086,11 +10228,11 @@
|
|
|
10086
10228
|
}
|
|
10087
10229
|
}
|
|
10088
10230
|
preFetchMenu(data) {
|
|
10089
|
-
var
|
|
10231
|
+
var _this11 = this;
|
|
10090
10232
|
return _asyncToGenerator__default["default"](function* () {
|
|
10091
10233
|
var useMenus = brickUtils.scanAppGetMenuInAny(data);
|
|
10092
10234
|
if (useMenus.length) {
|
|
10093
|
-
yield preConstructMenus(useMenus,
|
|
10235
|
+
yield preConstructMenus(useMenus, _this11.getCurrentContext(), _this11.kernel);
|
|
10094
10236
|
}
|
|
10095
10237
|
})();
|
|
10096
10238
|
}
|
|
@@ -10277,12 +10419,13 @@
|
|
|
10277
10419
|
}
|
|
10278
10420
|
|
|
10279
10421
|
class Resolver {
|
|
10280
|
-
constructor(kernel) {
|
|
10422
|
+
constructor(kernel, locationContext) {
|
|
10281
10423
|
_defineProperty__default["default"](this, "cache", new Map());
|
|
10282
10424
|
_defineProperty__default["default"](this, "refreshQueue", new Map());
|
|
10283
10425
|
_defineProperty__default["default"](this, "definedResolves", new Map());
|
|
10284
10426
|
_defineProperty__default["default"](this, "active", true);
|
|
10285
10427
|
this.kernel = kernel;
|
|
10428
|
+
this.locationContext = locationContext;
|
|
10286
10429
|
}
|
|
10287
10430
|
resetRefreshQueue() {
|
|
10288
10431
|
if (this.refreshQueue.size > 0) {
|
|
@@ -10306,9 +10449,15 @@
|
|
|
10306
10449
|
var _this = this;
|
|
10307
10450
|
return _asyncToGenerator__default["default"](function* () {
|
|
10308
10451
|
var _brickConf$lifeCycle$, _brickConf$lifeCycle;
|
|
10309
|
-
var useResolves = ((_brickConf$lifeCycle$ = (_brickConf$lifeCycle = brickConf.lifeCycle) === null || _brickConf$lifeCycle === void 0 ? void 0 : _brickConf$lifeCycle.useResolves) !== null && _brickConf$lifeCycle$ !== void 0 ? _brickConf$lifeCycle$ : []).
|
|
10310
|
-
|
|
10311
|
-
|
|
10452
|
+
var useResolves = (yield Promise.all(((_brickConf$lifeCycle$ = (_brickConf$lifeCycle = brickConf.lifeCycle) === null || _brickConf$lifeCycle === void 0 ? void 0 : _brickConf$lifeCycle.useResolves) !== null && _brickConf$lifeCycle$ !== void 0 ? _brickConf$lifeCycle$ : []).map( /*#__PURE__*/function () {
|
|
10453
|
+
var _ref = _asyncToGenerator__default["default"](function* (r) {
|
|
10454
|
+
yield _this.locationContext.storyboardContextWrapper.waitForUsedContext(r.if);
|
|
10455
|
+
return r;
|
|
10456
|
+
});
|
|
10457
|
+
return function (_x) {
|
|
10458
|
+
return _ref.apply(this, arguments);
|
|
10459
|
+
};
|
|
10460
|
+
}()))).filter(r => looseCheckIf(r, context));
|
|
10312
10461
|
yield Promise.all(useResolves.map(resolveConf => _this.resolveOne("brick", resolveConf, brickConf, brick, context)));
|
|
10313
10462
|
if (brickConf.template) {
|
|
10314
10463
|
brickConf.$$resolved = true;
|
|
@@ -10392,7 +10541,7 @@
|
|
|
10392
10541
|
}
|
|
10393
10542
|
}
|
|
10394
10543
|
var actualArgs = args ? ref ? args // `args` are already computed for `defineResolves`
|
|
10395
|
-
: context ?
|
|
10544
|
+
: context ? yield _this2.locationContext.deferComputeRealValue(args, context, true) : args : providerBrick.args || [];
|
|
10396
10545
|
var cacheKey;
|
|
10397
10546
|
try {
|
|
10398
10547
|
// `actualArgs` may contain circular references, which makes
|
|
@@ -10455,6 +10604,7 @@
|
|
|
10455
10604
|
yield fetchData();
|
|
10456
10605
|
} catch (error) {
|
|
10457
10606
|
if (isHandleRejectByTransform(onReject)) {
|
|
10607
|
+
yield _this2.locationContext.storyboardContextWrapper.waitForUsedContext(onReject.transform);
|
|
10458
10608
|
transformProperties(props, error, context ? computeRealValue(onReject.transform, context, true) : onReject.transform);
|
|
10459
10609
|
return;
|
|
10460
10610
|
} else if (isHandleRejectByCatch(onReject)) {
|
|
@@ -10467,18 +10617,21 @@
|
|
|
10467
10617
|
yield fetchData();
|
|
10468
10618
|
}
|
|
10469
10619
|
if (ref) {
|
|
10620
|
+
yield _this2.locationContext.storyboardContextWrapper.waitForUsedContext(transform);
|
|
10470
10621
|
data = transformIntermediateData(data, context ? computeRealValue(transform, context, true) : transform, transformFrom, transformMapArray);
|
|
10471
10622
|
}
|
|
10623
|
+
var transformTo = resolveConf.transform || resolveConf.name;
|
|
10624
|
+
yield _this2.locationContext.storyboardContextWrapper.waitForUsedContext(transformTo);
|
|
10472
10625
|
transformProperties(props, data,
|
|
10473
10626
|
// Also support legacy `name`
|
|
10474
|
-
context ? computeRealValue(
|
|
10627
|
+
context ? computeRealValue(transformTo, context, true) : transformTo, resolveConf.transformFrom, resolveConf.transformMapArray);
|
|
10475
10628
|
})();
|
|
10476
10629
|
}
|
|
10477
10630
|
scheduleRefreshing() {
|
|
10478
10631
|
var _this3 = this;
|
|
10479
10632
|
var _loop = function (providerBrick, interval) {
|
|
10480
10633
|
var request = /*#__PURE__*/function () {
|
|
10481
|
-
var
|
|
10634
|
+
var _ref3 = _asyncToGenerator__default["default"](function* () {
|
|
10482
10635
|
yield providerBrick.$refresh({
|
|
10483
10636
|
ignoreErrors: interval.ignoreErrors,
|
|
10484
10637
|
throwErrors: true,
|
|
@@ -10490,7 +10643,7 @@
|
|
|
10490
10643
|
}
|
|
10491
10644
|
});
|
|
10492
10645
|
return function request() {
|
|
10493
|
-
return
|
|
10646
|
+
return _ref3.apply(this, arguments);
|
|
10494
10647
|
};
|
|
10495
10648
|
}();
|
|
10496
10649
|
interval.timeoutId = setTimeout(request, interval.delay);
|
|
@@ -10887,7 +11040,7 @@
|
|
|
10887
11040
|
yield Promise.all(parallelRequests);
|
|
10888
11041
|
|
|
10889
11042
|
// 如果找到匹配的 storyboard,那么根据路由匹配得到的 sub-storyboard 加载它的依赖库。
|
|
10890
|
-
var subStoryboard = _this3.locationContext.getSubStoryboardByRoute(storyboard);
|
|
11043
|
+
var subStoryboard = yield _this3.locationContext.getSubStoryboardByRoute(storyboard);
|
|
10891
11044
|
({
|
|
10892
11045
|
pendingTask
|
|
10893
11046
|
} = yield _this3.kernel.loadDepsOfStoryboard(subStoryboard));
|
|
@@ -10959,6 +11112,7 @@
|
|
|
10959
11112
|
try {
|
|
10960
11113
|
var mergedRoutes = mergePreviewRoutes(storyboard.routes);
|
|
10961
11114
|
yield locationContext.mountRoutes(mergedRoutes, undefined, mountRoutesResult);
|
|
11115
|
+
yield locationContext.storyboardContextWrapper.waitForAllContext();
|
|
10962
11116
|
} catch (error) {
|
|
10963
11117
|
// eslint-disable-next-line no-console
|
|
10964
11118
|
console.error(error);
|
|
@@ -11259,6 +11413,9 @@
|
|
|
11259
11413
|
handleMessageClose(event) {
|
|
11260
11414
|
return this.locationContext.handleMessageClose(event);
|
|
11261
11415
|
}
|
|
11416
|
+
waitForUsedContext(data) {
|
|
11417
|
+
return this.locationContext.storyboardContextWrapper.waitForUsedContext(data);
|
|
11418
|
+
}
|
|
11262
11419
|
}
|
|
11263
11420
|
|
|
11264
11421
|
var customProcessorRegistry = new Map();
|