@next-core/brick-kit 2.153.2 → 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 +23 -8
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +24 -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/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';
|
|
@@ -8925,7 +8925,7 @@ function handleProxyOfCustomTemplate(brick) {
|
|
|
8925
8925
|
}
|
|
8926
8926
|
}
|
|
8927
8927
|
|
|
8928
|
-
function registerCustomTemplate(tplName, tplConstructor, appId) {
|
|
8928
|
+
function registerCustomTemplate(tplName, tplConstructor, appId, deadCOnditionsRemoved) {
|
|
8929
8929
|
var tagName = tplName; // When a template is registered by an app, its namespace maybe missed.
|
|
8930
8930
|
|
|
8931
8931
|
if (appId && !tplName.includes(".")) {
|
|
@@ -8949,6 +8949,13 @@ function registerCustomTemplate(tplName, tplConstructor, appId) {
|
|
|
8949
8949
|
// eslint-disable-next-line no-console
|
|
8950
8950
|
console.warn("Custom template of \"".concat(tagName, "\" already defined by customElements."));
|
|
8951
8951
|
}
|
|
8952
|
+
}
|
|
8953
|
+
|
|
8954
|
+
if (!deadCOnditionsRemoved && process.env.NODE_ENV !== "test") {
|
|
8955
|
+
removeDeadConditionsInTpl(tplConstructor, {
|
|
8956
|
+
constantFeatureFlags: true,
|
|
8957
|
+
featureFlags: getRuntime().getFeatureFlags()
|
|
8958
|
+
});
|
|
8952
8959
|
} // Now we allow re-register custom template
|
|
8953
8960
|
|
|
8954
8961
|
|
|
@@ -9626,7 +9633,7 @@ class Kernel {
|
|
|
9626
9633
|
bricks: tpl.bricks,
|
|
9627
9634
|
proxy: tpl.proxy,
|
|
9628
9635
|
state: tpl.state
|
|
9629
|
-
}, (_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);
|
|
9630
9637
|
}
|
|
9631
9638
|
} // 每个 storyboard 仅注册一次custom-template
|
|
9632
9639
|
|
|
@@ -12205,21 +12212,29 @@ class Router {
|
|
|
12205
12212
|
if (storyboard) {
|
|
12206
12213
|
var _storyboard$meta, _storyboard$meta2, _storyboard$meta3;
|
|
12207
12214
|
|
|
12208
|
-
yield _this3.kernel.fulfilStoryboard(storyboard);
|
|
12215
|
+
yield _this3.kernel.fulfilStoryboard(storyboard);
|
|
12216
|
+
removeDeadConditions(storyboard, {
|
|
12217
|
+
constantFeatureFlags: true,
|
|
12218
|
+
featureFlags: _this3.featureFlags
|
|
12219
|
+
}); // 将动态解析后的模板还原,以便重新动态解析。
|
|
12209
12220
|
|
|
12210
|
-
restoreDynamicTemplates(storyboard);
|
|
12221
|
+
restoreDynamicTemplates(storyboard);
|
|
12222
|
+
var parallelRequests = []; // 预加载权限信息
|
|
12211
12223
|
|
|
12212
12224
|
if (isLoggedIn() && !getAuth().isAdmin) {
|
|
12213
|
-
|
|
12225
|
+
parallelRequests.push(preCheckPermissions(storyboard));
|
|
12214
12226
|
} // Standalone App 需要额外读取 Installed App 信息
|
|
12215
12227
|
|
|
12216
12228
|
|
|
12217
12229
|
if (window.STANDALONE_MICRO_APPS && !window.NO_AUTH_GUARD) {
|
|
12218
12230
|
// TODO: get standalone apps when NO_AUTH_GUARD, maybe from conf.yaml
|
|
12219
|
-
|
|
12220
|
-
|
|
12221
|
-
|
|
12231
|
+
parallelRequests.push(preFetchStandaloneInstalledApps(storyboard).then(() => {
|
|
12232
|
+
_this3.kernel.bootstrapData.offSiteStandaloneApps = getStandaloneInstalledApps();
|
|
12233
|
+
}));
|
|
12234
|
+
} // `loadDepsOfStoryboard()` may requires these data.
|
|
12235
|
+
|
|
12222
12236
|
|
|
12237
|
+
yield Promise.all(parallelRequests); // 如果找到匹配的 storyboard,那么根据路由匹配得到的 sub-storyboard 加载它的依赖库。
|
|
12223
12238
|
|
|
12224
12239
|
var subStoryboard = _this3.locationContext.getSubStoryboardByRoute(storyboard);
|
|
12225
12240
|
|