@next-core/brick-kit 2.153.2 → 2.153.4
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 -12
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +38 -15
- 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/hooks/useProvider/fetch.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/index.esm.js
CHANGED
|
@@ -4,8 +4,8 @@ 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';
|
|
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';
|
|
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
|
+
import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, isEmpty, sortBy, orderBy, merge, isObject as isObject$1, pick, omit, findLastIndex, noop, isString as isString$1 } from 'lodash';
|
|
9
9
|
import { http, HttpResponseError, HttpAbortError, HttpFetchError } from '@next-core/brick-http';
|
|
10
10
|
import moment from 'moment';
|
|
11
11
|
import { pipes } from '@next-core/pipes';
|
|
@@ -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
|
|
|
@@ -14950,13 +14965,21 @@ function isObj(v) {
|
|
|
14950
14965
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
14951
14966
|
}
|
|
14952
14967
|
|
|
14953
|
-
function
|
|
14968
|
+
function isString(v) {
|
|
14969
|
+
return typeof v === "string";
|
|
14970
|
+
}
|
|
14971
|
+
|
|
14972
|
+
function buildSortedCacheKey(provider) {
|
|
14954
14973
|
var sortObj = obj => Object.keys(obj).sort().map(k => ({
|
|
14955
14974
|
[k]: obj[k]
|
|
14956
14975
|
}));
|
|
14957
14976
|
|
|
14977
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
14978
|
+
args[_key - 1] = arguments[_key];
|
|
14979
|
+
}
|
|
14980
|
+
|
|
14958
14981
|
try {
|
|
14959
|
-
var sortedArgs = isObj(args) ? sortObj(args) : args.map(arg => sortObj(arg));
|
|
14982
|
+
var sortedArgs = isObj(args) ? sortObj(args) : args.map(arg => isString(arg) ? arg : sortObj(arg));
|
|
14960
14983
|
return JSON.stringify({
|
|
14961
14984
|
provider,
|
|
14962
14985
|
args: sortedArgs
|
|
@@ -14975,8 +14998,8 @@ function fetch(_x, _x2) {
|
|
|
14975
14998
|
|
|
14976
14999
|
function _fetch() {
|
|
14977
15000
|
_fetch = _asyncToGenerator$3(function* (provider, cache) {
|
|
14978
|
-
for (var
|
|
14979
|
-
args[
|
|
15001
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
15002
|
+
args[_key2 - 2] = arguments[_key2];
|
|
14980
15003
|
}
|
|
14981
15004
|
|
|
14982
15005
|
var promise; // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -15067,7 +15090,7 @@ function useProvider() {
|
|
|
15067
15090
|
var providerStr = provider;
|
|
15068
15091
|
var providerArgs = [];
|
|
15069
15092
|
|
|
15070
|
-
if (isString(providerOrBody)) {
|
|
15093
|
+
if (isString$1(providerOrBody)) {
|
|
15071
15094
|
providerStr = providerOrBody;
|
|
15072
15095
|
}
|
|
15073
15096
|
|