@next-core/brick-kit 2.153.1 → 2.153.3
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 +31 -8
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +32 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/types/checkIf.d.ts +1 -1
- package/dist/types/core/CustomTemplates/registerCustomTemplate.d.ts +1 -1
- package/dist/types/core/CustomTemplates/registerCustomTemplate.d.ts.map +1 -1
- package/dist/types/core/Kernel.d.ts.map +1 -1
- package/dist/types/core/Router.d.ts.map +1 -1
- package/dist/types/core/Runtime.d.ts.map +1 -1
- package/dist/types/core/matchStoryboard.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/index.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
|
|
|
4
4
|
import _asyncToGenerator$3 from '@babel/runtime/helpers/asyncToGenerator';
|
|
5
5
|
import _defineProperty$1 from '@babel/runtime/helpers/defineProperty';
|
|
6
6
|
import React, { useState, useEffect, useRef, forwardRef, useImperativeHandle, useMemo, useContext, createContext, useReducer, useCallback } from 'react';
|
|
7
|
-
import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, scanPermissionActionsInStoryboard, precookFunction, cook, resolveContextConcurrently, syncResolveContextConcurrently, trackUsedState, trackUsedContext, shouldAllowRecursiveEvaluations, preevaluate, inject, matchPath, deepFreeze, createProviderClass, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, loadScript, scanAppGetMenuInAny, asyncProcessBrick, scanInstalledAppsInStoryboard, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
|
|
7
|
+
import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, scanPermissionActionsInStoryboard, precookFunction, cook, resolveContextConcurrently, syncResolveContextConcurrently, trackUsedState, trackUsedContext, shouldAllowRecursiveEvaluations, preevaluate, inject, matchPath, deepFreeze, createProviderClass, removeDeadConditionsInTpl, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, loadScript, scanAppGetMenuInAny, asyncProcessBrick, scanInstalledAppsInStoryboard, removeDeadConditions, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
|
|
8
8
|
import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, isEmpty, sortBy, orderBy, merge, isObject as isObject$1, pick, omit, findLastIndex, noop, isString } from 'lodash';
|
|
9
9
|
import { http, HttpResponseError, HttpAbortError, HttpFetchError } from '@next-core/brick-http';
|
|
10
10
|
import moment from 'moment';
|
|
@@ -3557,6 +3557,10 @@ function matchStoryboard(storyboards, pathname) {
|
|
|
3557
3557
|
*/
|
|
3558
3558
|
|
|
3559
3559
|
function isOutsideApp(storyboard) {
|
|
3560
|
+
if (process.env.NODE_ENV === "test") {
|
|
3561
|
+
return false;
|
|
3562
|
+
}
|
|
3563
|
+
|
|
3560
3564
|
return !storyboard || !window.STANDALONE_MICRO_APPS && storyboard.app.standaloneMode;
|
|
3561
3565
|
}
|
|
3562
3566
|
|
|
@@ -3934,6 +3938,10 @@ function _internalApiGetCurrentContext() {
|
|
|
3934
3938
|
/* istanbul ignore next */
|
|
3935
3939
|
|
|
3936
3940
|
function _internalApiMatchStoryboard(pathname) {
|
|
3941
|
+
if (process.env.NODE_ENV === "test") {
|
|
3942
|
+
return;
|
|
3943
|
+
}
|
|
3944
|
+
|
|
3937
3945
|
return matchStoryboard(kernel.bootstrapData.storyboards, pathname);
|
|
3938
3946
|
}
|
|
3939
3947
|
/* istanbul ignore next */
|
|
@@ -8917,7 +8925,7 @@ function handleProxyOfCustomTemplate(brick) {
|
|
|
8917
8925
|
}
|
|
8918
8926
|
}
|
|
8919
8927
|
|
|
8920
|
-
function registerCustomTemplate(tplName, tplConstructor, appId) {
|
|
8928
|
+
function registerCustomTemplate(tplName, tplConstructor, appId, deadCOnditionsRemoved) {
|
|
8921
8929
|
var tagName = tplName; // When a template is registered by an app, its namespace maybe missed.
|
|
8922
8930
|
|
|
8923
8931
|
if (appId && !tplName.includes(".")) {
|
|
@@ -8941,6 +8949,13 @@ function registerCustomTemplate(tplName, tplConstructor, appId) {
|
|
|
8941
8949
|
// eslint-disable-next-line no-console
|
|
8942
8950
|
console.warn("Custom template of \"".concat(tagName, "\" already defined by customElements."));
|
|
8943
8951
|
}
|
|
8952
|
+
}
|
|
8953
|
+
|
|
8954
|
+
if (!deadCOnditionsRemoved && process.env.NODE_ENV !== "test") {
|
|
8955
|
+
removeDeadConditionsInTpl(tplConstructor, {
|
|
8956
|
+
constantFeatureFlags: true,
|
|
8957
|
+
featureFlags: getRuntime().getFeatureFlags()
|
|
8958
|
+
});
|
|
8944
8959
|
} // Now we allow re-register custom template
|
|
8945
8960
|
|
|
8946
8961
|
|
|
@@ -9618,7 +9633,7 @@ class Kernel {
|
|
|
9618
9633
|
bricks: tpl.bricks,
|
|
9619
9634
|
proxy: tpl.proxy,
|
|
9620
9635
|
state: tpl.state
|
|
9621
|
-
}, (_storyboard$app = storyboard.app) === null || _storyboard$app === void 0 ? void 0 : _storyboard$app.id);
|
|
9636
|
+
}, (_storyboard$app = storyboard.app) === null || _storyboard$app === void 0 ? void 0 : _storyboard$app.id, true);
|
|
9622
9637
|
}
|
|
9623
9638
|
} // 每个 storyboard 仅注册一次custom-template
|
|
9624
9639
|
|
|
@@ -12197,21 +12212,29 @@ class Router {
|
|
|
12197
12212
|
if (storyboard) {
|
|
12198
12213
|
var _storyboard$meta, _storyboard$meta2, _storyboard$meta3;
|
|
12199
12214
|
|
|
12200
|
-
yield _this3.kernel.fulfilStoryboard(storyboard);
|
|
12215
|
+
yield _this3.kernel.fulfilStoryboard(storyboard);
|
|
12216
|
+
removeDeadConditions(storyboard, {
|
|
12217
|
+
constantFeatureFlags: true,
|
|
12218
|
+
featureFlags: _this3.featureFlags
|
|
12219
|
+
}); // 将动态解析后的模板还原,以便重新动态解析。
|
|
12201
12220
|
|
|
12202
|
-
restoreDynamicTemplates(storyboard);
|
|
12221
|
+
restoreDynamicTemplates(storyboard);
|
|
12222
|
+
var parallelRequests = []; // 预加载权限信息
|
|
12203
12223
|
|
|
12204
12224
|
if (isLoggedIn() && !getAuth().isAdmin) {
|
|
12205
|
-
|
|
12225
|
+
parallelRequests.push(preCheckPermissions(storyboard));
|
|
12206
12226
|
} // Standalone App 需要额外读取 Installed App 信息
|
|
12207
12227
|
|
|
12208
12228
|
|
|
12209
12229
|
if (window.STANDALONE_MICRO_APPS && !window.NO_AUTH_GUARD) {
|
|
12210
12230
|
// TODO: get standalone apps when NO_AUTH_GUARD, maybe from conf.yaml
|
|
12211
|
-
|
|
12212
|
-
|
|
12213
|
-
|
|
12231
|
+
parallelRequests.push(preFetchStandaloneInstalledApps(storyboard).then(() => {
|
|
12232
|
+
_this3.kernel.bootstrapData.offSiteStandaloneApps = getStandaloneInstalledApps();
|
|
12233
|
+
}));
|
|
12234
|
+
} // `loadDepsOfStoryboard()` may requires these data.
|
|
12235
|
+
|
|
12214
12236
|
|
|
12237
|
+
yield Promise.all(parallelRequests); // 如果找到匹配的 storyboard,那么根据路由匹配得到的 sub-storyboard 加载它的依赖库。
|
|
12215
12238
|
|
|
12216
12239
|
var subStoryboard = _this3.locationContext.getSubStoryboardByRoute(storyboard);
|
|
12217
12240
|
|