@next-core/brick-kit 2.143.0 → 2.145.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/CHANGELOG.md +22 -0
- package/dist/index.bundle.js +83 -55
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +83 -55
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/LocationContext.d.ts.map +1 -1
- package/dist/types/core/Router.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/index.esm.js
CHANGED
|
@@ -10566,31 +10566,49 @@ class LocationContext {
|
|
|
10566
10566
|
}
|
|
10567
10567
|
|
|
10568
10568
|
matchRoutes(routes, app) {
|
|
10569
|
-
|
|
10569
|
+
var _this = this;
|
|
10570
|
+
|
|
10571
|
+
var _loop = function (route) {
|
|
10570
10572
|
var computedPath = computeRealRoutePath(route.path, app);
|
|
10571
10573
|
|
|
10572
10574
|
if ([].concat(computedPath).includes(undefined)) {
|
|
10573
10575
|
// eslint-disable-next-line no-console
|
|
10574
10576
|
console.error("Invalid route with invalid path:", route);
|
|
10575
|
-
return
|
|
10577
|
+
return {
|
|
10578
|
+
v: "missed"
|
|
10579
|
+
};
|
|
10576
10580
|
}
|
|
10577
10581
|
|
|
10578
|
-
var match = matchPath(
|
|
10582
|
+
var match = matchPath(_this.location.pathname, {
|
|
10579
10583
|
path: computedPath,
|
|
10580
|
-
exact: route.exact
|
|
10584
|
+
exact: route.exact,
|
|
10585
|
+
checkIf: context => looseCheckIf(route, context),
|
|
10586
|
+
getContext: match => _this.getContext({
|
|
10587
|
+
match
|
|
10588
|
+
})
|
|
10581
10589
|
});
|
|
10582
10590
|
|
|
10583
10591
|
if (match !== null) {
|
|
10584
10592
|
if (app.noAuthGuard || route.public || isLoggedIn()) {
|
|
10585
|
-
|
|
10593
|
+
_this.currentMatch = match;
|
|
10586
10594
|
return {
|
|
10587
|
-
|
|
10588
|
-
|
|
10595
|
+
v: {
|
|
10596
|
+
match,
|
|
10597
|
+
route
|
|
10598
|
+
}
|
|
10589
10599
|
};
|
|
10590
10600
|
}
|
|
10591
10601
|
|
|
10592
|
-
return
|
|
10602
|
+
return {
|
|
10603
|
+
v: "unauthenticated"
|
|
10604
|
+
};
|
|
10593
10605
|
}
|
|
10606
|
+
};
|
|
10607
|
+
|
|
10608
|
+
for (var route of routes) {
|
|
10609
|
+
var _ret = _loop(route);
|
|
10610
|
+
|
|
10611
|
+
if (typeof _ret === "object") return _ret.v;
|
|
10594
10612
|
}
|
|
10595
10613
|
|
|
10596
10614
|
return "missed";
|
|
@@ -10636,10 +10654,10 @@ class LocationContext {
|
|
|
10636
10654
|
}
|
|
10637
10655
|
|
|
10638
10656
|
mountRoutes(routes, slotId, mountRoutesResult) {
|
|
10639
|
-
var
|
|
10657
|
+
var _this2 = this;
|
|
10640
10658
|
|
|
10641
10659
|
return _asyncToGenerator$3(function* () {
|
|
10642
|
-
var matched =
|
|
10660
|
+
var matched = _this2.matchRoutes(routes, _this2.kernel.nextApp);
|
|
10643
10661
|
|
|
10644
10662
|
var redirect;
|
|
10645
10663
|
var redirectConf = {};
|
|
@@ -10658,22 +10676,22 @@ class LocationContext {
|
|
|
10658
10676
|
mountRoutesResult.route = route = matched.route;
|
|
10659
10677
|
|
|
10660
10678
|
if (route.segues) {
|
|
10661
|
-
Object.assign(
|
|
10679
|
+
Object.assign(_this2.segues, route.segues);
|
|
10662
10680
|
}
|
|
10663
10681
|
|
|
10664
10682
|
if (route.hybrid) {
|
|
10665
10683
|
mountRoutesResult.flags.hybrid = true;
|
|
10666
10684
|
}
|
|
10667
10685
|
|
|
10668
|
-
context =
|
|
10686
|
+
context = _this2.getContext({
|
|
10669
10687
|
match: matched.match
|
|
10670
10688
|
});
|
|
10671
10689
|
|
|
10672
|
-
|
|
10690
|
+
_this2.resolver.defineResolves(route.defineResolves, context);
|
|
10673
10691
|
|
|
10674
|
-
yield
|
|
10675
|
-
yield
|
|
10676
|
-
yield
|
|
10692
|
+
yield _this2.mountProviders(route.providers, matched.match, slotId, mountRoutesResult);
|
|
10693
|
+
yield _this2.storyboardContextWrapper.define(route.context, context);
|
|
10694
|
+
yield _this2.preCheckPermissions(route, context);
|
|
10677
10695
|
redirect = computeRealValue(route.redirect, context, true);
|
|
10678
10696
|
|
|
10679
10697
|
if (redirect) {
|
|
@@ -10685,7 +10703,7 @@ class LocationContext {
|
|
|
10685
10703
|
break;
|
|
10686
10704
|
} else {
|
|
10687
10705
|
// Resolvable redirect.
|
|
10688
|
-
yield
|
|
10706
|
+
yield _this2.resolver.resolveOne("reference", redirect, redirectConf);
|
|
10689
10707
|
|
|
10690
10708
|
if (redirectConf.redirect) {
|
|
10691
10709
|
mountRoutesResult.flags.redirect = {
|
|
@@ -10696,18 +10714,18 @@ class LocationContext {
|
|
|
10696
10714
|
}
|
|
10697
10715
|
}
|
|
10698
10716
|
|
|
10699
|
-
yield
|
|
10717
|
+
yield _this2.mountMenu(route.menu, matched.match, mountRoutesResult);
|
|
10700
10718
|
|
|
10701
10719
|
if (route.documentId) {
|
|
10702
10720
|
mountRoutesResult.appBar.documentId = route.documentId;
|
|
10703
10721
|
}
|
|
10704
10722
|
|
|
10705
10723
|
if (isRouteConfOfRoutes(route) && Array.isArray(route.routes)) {
|
|
10706
|
-
yield
|
|
10707
|
-
yield
|
|
10724
|
+
yield _this2.preFetchMenu(route.context);
|
|
10725
|
+
yield _this2.mountRoutes(route.routes, slotId, mountRoutesResult);
|
|
10708
10726
|
} else if (isRouteConfOfBricks(route) && Array.isArray(route.bricks)) {
|
|
10709
|
-
yield
|
|
10710
|
-
yield
|
|
10727
|
+
yield _this2.preFetchMenu(route);
|
|
10728
|
+
yield _this2.mountBricks(route.bricks, matched.match, slotId, mountRoutesResult); // analytics data (page_view event)
|
|
10711
10729
|
|
|
10712
10730
|
if (route.analyticsData) {
|
|
10713
10731
|
mountRoutesResult.analyticsData = computeRealValue(route.analyticsData, context, true);
|
|
@@ -10721,7 +10739,7 @@ class LocationContext {
|
|
|
10721
10739
|
}
|
|
10722
10740
|
|
|
10723
10741
|
mountMenu(menuConf, match, mountRoutesResult) {
|
|
10724
|
-
var
|
|
10742
|
+
var _this3 = this;
|
|
10725
10743
|
|
|
10726
10744
|
return _asyncToGenerator$3(function* () {
|
|
10727
10745
|
if (menuConf === false) {
|
|
@@ -10735,7 +10753,7 @@ class LocationContext {
|
|
|
10735
10753
|
return;
|
|
10736
10754
|
}
|
|
10737
10755
|
|
|
10738
|
-
var context =
|
|
10756
|
+
var context = _this3.getContext({
|
|
10739
10757
|
match
|
|
10740
10758
|
});
|
|
10741
10759
|
|
|
@@ -10754,10 +10772,10 @@ class LocationContext {
|
|
|
10754
10772
|
children: []
|
|
10755
10773
|
};
|
|
10756
10774
|
|
|
10757
|
-
|
|
10775
|
+
_this3.registerHandlersFromLifeCycle(menuConf.lifeCycle, brick, match); // Then, resolve the brick.
|
|
10758
10776
|
|
|
10759
10777
|
|
|
10760
|
-
yield
|
|
10778
|
+
yield _this3.resolver.resolve(menuConf, brick, context);
|
|
10761
10779
|
mountRoutesResult.menuInBg.push(brick);
|
|
10762
10780
|
return;
|
|
10763
10781
|
}
|
|
@@ -10765,7 +10783,7 @@ class LocationContext {
|
|
|
10765
10783
|
var injectDeep = menuConf.injectDeep;
|
|
10766
10784
|
|
|
10767
10785
|
if (menuConf.type === "resolve") {
|
|
10768
|
-
yield
|
|
10786
|
+
yield _this3.resolver.resolveOne("reference", _objectSpread({
|
|
10769
10787
|
transformMapArray: false
|
|
10770
10788
|
}, menuConf.resolve), menuConf, null, context);
|
|
10771
10789
|
injectDeep = false;
|
|
@@ -10811,12 +10829,12 @@ class LocationContext {
|
|
|
10811
10829
|
}
|
|
10812
10830
|
|
|
10813
10831
|
mountProviders(providers, match, slotId, mountRoutesResult) {
|
|
10814
|
-
var
|
|
10832
|
+
var _this4 = this;
|
|
10815
10833
|
|
|
10816
10834
|
return _asyncToGenerator$3(function* () {
|
|
10817
10835
|
if (Array.isArray(providers)) {
|
|
10818
10836
|
for (var providerConf of providers) {
|
|
10819
|
-
yield
|
|
10837
|
+
yield _this4.mountBrick(_objectSpread(_objectSpread({}, typeof providerConf === "string" ? {
|
|
10820
10838
|
brick: providerConf
|
|
10821
10839
|
} : providerConf), {}, {
|
|
10822
10840
|
bg: true,
|
|
@@ -10828,12 +10846,12 @@ class LocationContext {
|
|
|
10828
10846
|
}
|
|
10829
10847
|
|
|
10830
10848
|
mountBricks(bricks, match, slotId, mountRoutesResult, tplStack) {
|
|
10831
|
-
var
|
|
10849
|
+
var _this5 = this;
|
|
10832
10850
|
|
|
10833
10851
|
return _asyncToGenerator$3(function* () {
|
|
10834
10852
|
for (var brickConf of bricks) {
|
|
10835
10853
|
try {
|
|
10836
|
-
yield
|
|
10854
|
+
yield _this5.mountBrick(brickConf, match, slotId, mountRoutesResult, tplStack === null || tplStack === void 0 ? void 0 : tplStack.slice());
|
|
10837
10855
|
} catch (error) {
|
|
10838
10856
|
if (error instanceof ResolveRequestError) {
|
|
10839
10857
|
var errorMessage = httpErrorToString(error.rawError);
|
|
@@ -10862,13 +10880,13 @@ class LocationContext {
|
|
|
10862
10880
|
}
|
|
10863
10881
|
|
|
10864
10882
|
checkResolvableIf(ifContainer, context) {
|
|
10865
|
-
var
|
|
10883
|
+
var _this6 = this;
|
|
10866
10884
|
|
|
10867
10885
|
return _asyncToGenerator$3(function* () {
|
|
10868
10886
|
if (isObject(ifContainer.if)) {
|
|
10869
10887
|
var ifChecked = computeRealValue(ifContainer.if, context, true);
|
|
10870
10888
|
var ifConf = {};
|
|
10871
|
-
yield
|
|
10889
|
+
yield _this6.resolver.resolveOne("reference", ifChecked, ifConf);
|
|
10872
10890
|
return !hasOwnProperty(ifConf, "if") || !!ifConf.if;
|
|
10873
10891
|
}
|
|
10874
10892
|
|
|
@@ -10887,39 +10905,39 @@ class LocationContext {
|
|
|
10887
10905
|
|
|
10888
10906
|
mountBrick(brickConf, match, slotId, mountRoutesResult) {
|
|
10889
10907
|
var _arguments = arguments,
|
|
10890
|
-
|
|
10908
|
+
_this7 = this;
|
|
10891
10909
|
|
|
10892
10910
|
return _asyncToGenerator$3(function* () {
|
|
10893
|
-
var
|
|
10911
|
+
var _this7$kernel$nextApp, _brickConf$lifeCycle, _brick$lifeCycle;
|
|
10894
10912
|
|
|
10895
10913
|
var tplStack = _arguments.length > 4 && _arguments[4] !== undefined ? _arguments[4] : [];
|
|
10896
10914
|
var tplContextId = brickConf[symbolForTplContextId];
|
|
10897
10915
|
var formContextId = brickConf[symbolForFormContextId];
|
|
10898
10916
|
|
|
10899
|
-
var context =
|
|
10917
|
+
var context = _this7.getContext({
|
|
10900
10918
|
match,
|
|
10901
10919
|
tplContextId,
|
|
10902
10920
|
formContextId
|
|
10903
10921
|
}); // First, check whether the brick should be rendered.
|
|
10904
10922
|
|
|
10905
10923
|
|
|
10906
|
-
if (!(yield
|
|
10924
|
+
if (!(yield _this7.checkResolvableIf(brickConf, context))) {
|
|
10907
10925
|
return;
|
|
10908
10926
|
} // Then, resolve the template to a brick.
|
|
10909
10927
|
|
|
10910
10928
|
|
|
10911
10929
|
if (brickConf.template) {
|
|
10912
|
-
yield
|
|
10930
|
+
yield _this7.resolver.resolve(brickConf, null, context);
|
|
10913
10931
|
} // Check `if` again for dynamic loaded templates.
|
|
10914
10932
|
|
|
10915
10933
|
|
|
10916
|
-
if (!(yield
|
|
10934
|
+
if (!(yield _this7.checkResolvableIf(brickConf, context))) {
|
|
10917
10935
|
return;
|
|
10918
10936
|
} // If it's a custom template, `tplTagName` is the tag name of the template.
|
|
10919
10937
|
// Otherwise, `tplTagName` is false.
|
|
10920
10938
|
|
|
10921
10939
|
|
|
10922
|
-
var tplTagName = getTagNameOfCustomTemplate(brickConf.brick, (
|
|
10940
|
+
var tplTagName = getTagNameOfCustomTemplate(brickConf.brick, (_this7$kernel$nextApp = _this7.kernel.nextApp) === null || _this7$kernel$nextApp === void 0 ? void 0 : _this7$kernel$nextApp.id);
|
|
10923
10941
|
|
|
10924
10942
|
if (tplTagName) {
|
|
10925
10943
|
if (tplStack.includes(tplTagName)) {
|
|
@@ -10934,8 +10952,8 @@ class LocationContext {
|
|
|
10934
10952
|
}
|
|
10935
10953
|
|
|
10936
10954
|
var brick = {};
|
|
10937
|
-
yield
|
|
10938
|
-
yield
|
|
10955
|
+
yield _this7.storyboardContextWrapper.define(brickConf.context, context, brick);
|
|
10956
|
+
yield _this7.preCheckPermissions(brickConf, context);
|
|
10939
10957
|
var trackingContextList = [];
|
|
10940
10958
|
Object.assign(brick, _objectSpread({
|
|
10941
10959
|
type: tplTagName || brickConf.brick,
|
|
@@ -10967,40 +10985,40 @@ class LocationContext {
|
|
|
10967
10985
|
brick.refForProxy.brick = brick;
|
|
10968
10986
|
}
|
|
10969
10987
|
|
|
10970
|
-
|
|
10988
|
+
_this7.registerHandlersFromLifeCycle(brickConf.lifeCycle, brick, match, tplContextId);
|
|
10971
10989
|
|
|
10972
10990
|
if ((_brick$lifeCycle = brick.lifeCycle) !== null && _brick$lifeCycle !== void 0 && _brick$lifeCycle.onScrollIntoView) {
|
|
10973
|
-
|
|
10991
|
+
_this7.brickBindObserver(brick);
|
|
10974
10992
|
} // Then, resolve the brick.
|
|
10975
10993
|
|
|
10976
10994
|
|
|
10977
|
-
yield
|
|
10995
|
+
yield _this7.resolver.resolve(brickConf, brick, context);
|
|
10978
10996
|
var expandedBrickConf = brickConf;
|
|
10979
10997
|
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);
|
|
10980
10998
|
|
|
10981
|
-
if (tplTagName && (!isBaseLayout ||
|
|
10999
|
+
if (tplTagName && (!isBaseLayout || _this7.kernel.getFeatureFlags()["support-ui-8.0-base-layout"] && isBaseLayout)) {
|
|
10982
11000
|
var _customTemplateRegist;
|
|
10983
11001
|
|
|
10984
|
-
yield
|
|
11002
|
+
yield _this7.preFetchMenu((_customTemplateRegist = customTemplateRegistry.get(tplTagName)) === null || _customTemplateRegist === void 0 ? void 0 : _customTemplateRegist.bricks);
|
|
10985
11003
|
expandedBrickConf = yield asyncExpandCustomTemplate(_objectSpread(_objectSpread({}, brickConf), {}, {
|
|
10986
11004
|
brick: tplTagName,
|
|
10987
11005
|
// Properties are computed for custom templates.
|
|
10988
11006
|
properties: brick.properties
|
|
10989
11007
|
}), brick, context); // Try to load deps for dynamic added bricks.
|
|
10990
11008
|
|
|
10991
|
-
yield
|
|
11009
|
+
yield _this7.kernel.loadDynamicBricksInBrickConf(expandedBrickConf);
|
|
10992
11010
|
}
|
|
10993
11011
|
|
|
10994
11012
|
if (brick.type === formRenderer) {
|
|
10995
11013
|
var formData = JSON.parse(brick.properties.formData);
|
|
10996
11014
|
expandedBrickConf = yield ExpandCustomForm(formData, brickConf, brick.properties.isPreview, context);
|
|
10997
|
-
yield
|
|
11015
|
+
yield _this7.kernel.loadDynamicBricksInBrickConf(expandedBrickConf);
|
|
10998
11016
|
}
|
|
10999
11017
|
|
|
11000
11018
|
if (expandedBrickConf.exports) {
|
|
11001
11019
|
for (var [prop, ctxName] of Object.entries(expandedBrickConf.exports)) {
|
|
11002
11020
|
if (typeof ctxName === "string" && ctxName.startsWith("CTX.")) {
|
|
11003
|
-
|
|
11021
|
+
_this7.storyboardContextWrapper.set(ctxName.substring(4), {
|
|
11004
11022
|
type: "brick-property",
|
|
11005
11023
|
brick,
|
|
11006
11024
|
prop
|
|
@@ -11012,7 +11030,7 @@ class LocationContext {
|
|
|
11012
11030
|
if (expandedBrickConf.bg) {
|
|
11013
11031
|
// A bg brick has no slotId.
|
|
11014
11032
|
brick.slotId = undefined;
|
|
11015
|
-
appendBrick(brick,
|
|
11033
|
+
appendBrick(brick, _this7.kernel.mountPoints.bg);
|
|
11016
11034
|
} else {
|
|
11017
11035
|
if (expandedBrickConf.portal) {
|
|
11018
11036
|
// A portal brick has no slotId.
|
|
@@ -11029,9 +11047,9 @@ class LocationContext {
|
|
|
11029
11047
|
});
|
|
11030
11048
|
|
|
11031
11049
|
if (slotConf.type === "bricks") {
|
|
11032
|
-
yield
|
|
11050
|
+
yield _this7.mountBricks(slotConf.bricks, match, _slotId, slottedMountRoutesResult, tplStack);
|
|
11033
11051
|
} else if (slotConf.type === "routes") {
|
|
11034
|
-
yield
|
|
11052
|
+
yield _this7.mountRoutes(slotConf.routes, _slotId, slottedMountRoutesResult);
|
|
11035
11053
|
}
|
|
11036
11054
|
}
|
|
11037
11055
|
}
|
|
@@ -11232,13 +11250,13 @@ class LocationContext {
|
|
|
11232
11250
|
}
|
|
11233
11251
|
|
|
11234
11252
|
preFetchMenu(data) {
|
|
11235
|
-
var
|
|
11253
|
+
var _this8 = this;
|
|
11236
11254
|
|
|
11237
11255
|
return _asyncToGenerator$3(function* () {
|
|
11238
11256
|
var useMenus = scanAppGetMenuInAny(data);
|
|
11239
11257
|
|
|
11240
11258
|
if (useMenus.length) {
|
|
11241
|
-
yield preConstructMenus(useMenus,
|
|
11259
|
+
yield preConstructMenus(useMenus, _this8.getCurrentContext(), _this8.kernel);
|
|
11242
11260
|
}
|
|
11243
11261
|
})();
|
|
11244
11262
|
}
|
|
@@ -12074,6 +12092,16 @@ class Router {
|
|
|
12074
12092
|
if (storyboard) {
|
|
12075
12093
|
var _storyboard$meta, _storyboard$meta2, _storyboard$meta3;
|
|
12076
12094
|
|
|
12095
|
+
if (!window.STANDALONE_MICRO_APPS) {
|
|
12096
|
+
if (storyboard.app.standaloneMode) {
|
|
12097
|
+
// if nextApp was standalone micro-apps, use location.replace to reload window;
|
|
12098
|
+
var path = history.createHref({
|
|
12099
|
+
pathname: storyboard.app.homepage
|
|
12100
|
+
});
|
|
12101
|
+
window.location.replace(path);
|
|
12102
|
+
}
|
|
12103
|
+
}
|
|
12104
|
+
|
|
12077
12105
|
yield _this3.kernel.fulfilStoryboard(storyboard); // 将动态解析后的模板还原,以便重新动态解析。
|
|
12078
12106
|
|
|
12079
12107
|
restoreDynamicTemplates(storyboard); // 预加载权限信息
|