@next-core/brick-kit 2.199.1 → 2.199.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 +51 -17
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +52 -18
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/Router.d.ts.map +1 -1
- package/dist/types/core/StoryboardFunctionRegistryFactory.d.ts +1 -1
- package/dist/types/core/StoryboardFunctionRegistryFactory.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
|
|
|
4
4
|
import _defineProperty$1 from '@babel/runtime/helpers/defineProperty';
|
|
5
5
|
import _asyncToGenerator$3 from '@babel/runtime/helpers/asyncToGenerator';
|
|
6
6
|
import _, { escapeRegExp, set, get, difference, identity, uniqueId, isNil, isEmpty, merge, sortBy, cloneDeep, clamp, orderBy, pick, isObject as isObject$1, uniq, omit, findLastIndex, noop, isString as isString$1 } from 'lodash';
|
|
7
|
-
import { toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, isTrackAll, trackAll, trackContext, trackState, trackFormState, transformAndInject, transform, JsonStorage, scanPermissionActionsInStoryboard, precookFunction, cook, collectContextUsage, deferResolveContextConcurrently, resolveContextConcurrently, syncResolveContextConcurrently, trackUsedFormState, trackUsedState, trackUsedContext, scanPermissionActionsInAny, deepFreeze, scanProcessorsInAny, preevaluate, shouldAllowRecursiveEvaluations, inject, matchPath, asyncProcessBrick, createProviderClass, removeDeadConditionsInTpl, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, snippetEvaluate, scanCustomApisInStoryboard, prefetchScript, scanBricksInBrickConf, loadScript, scanAppGetMenuInAny, scanInstalledAppsInStoryboard, removeDeadConditions, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
|
|
7
|
+
import { toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, isTrackAll, trackAll, trackContext, trackState, trackFormState, transformAndInject, transform, JsonStorage, scanPermissionActionsInStoryboard, precookFunction, cook, collectContextUsage, deferResolveContextConcurrently, resolveContextConcurrently, syncResolveContextConcurrently, trackUsedFormState, trackUsedState, trackUsedContext, scanPermissionActionsInAny, deepFreeze, scanProcessorsInAny, preevaluate, shouldAllowRecursiveEvaluations, inject, matchPath, asyncProcessBrick, createProviderClass, removeDeadConditionsInTpl, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, snippetEvaluate, scanCustomApisInStoryboard, prefetchScript, scanBricksInBrickConf, loadScript, scanAppGetMenuInAny, scanInstalledAppsInStoryboard, clearExpressionASTCache, clearFunctionASTCache, removeDeadConditions, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
|
|
8
8
|
import moment from 'moment';
|
|
9
9
|
import { pipes } from '@next-core/pipes';
|
|
10
10
|
import i18next, { getFixedT } from 'i18next';
|
|
@@ -1432,9 +1432,16 @@ function StoryboardFunctionRegistryFactory() {
|
|
|
1432
1432
|
}
|
|
1433
1433
|
});
|
|
1434
1434
|
var currentApp;
|
|
1435
|
+
var needPerf = false;
|
|
1435
1436
|
function registerStoryboardFunctions(functions, app) {
|
|
1436
1437
|
if (app) {
|
|
1438
|
+
var _app$config, _app$config$settings;
|
|
1437
1439
|
currentApp = app;
|
|
1440
|
+
needPerf = app === null || app === void 0 ? void 0 : (_app$config = app.config) === null || _app$config === void 0 ? void 0 : (_app$config$settings = _app$config.settings) === null || _app$config$settings === void 0 ? void 0 : _app$config$settings.perfStoryboardFunctions;
|
|
1441
|
+
if (needPerf) {
|
|
1442
|
+
// Clear perf data when initialize functions.
|
|
1443
|
+
window.STORYBOARD_FUNCTIONS_PERF = [];
|
|
1444
|
+
}
|
|
1438
1445
|
}
|
|
1439
1446
|
registeredFunctions.clear();
|
|
1440
1447
|
if (Array.isArray(functions)) {
|
|
@@ -1459,6 +1466,7 @@ function StoryboardFunctionRegistryFactory() {
|
|
|
1459
1466
|
collector = collectCoverage.createCollector(name);
|
|
1460
1467
|
}
|
|
1461
1468
|
var precooked = precookFunction(fn.source, {
|
|
1469
|
+
cacheKey: fn,
|
|
1462
1470
|
typescript: fn.typescript,
|
|
1463
1471
|
hooks: collector && {
|
|
1464
1472
|
beforeVisit: collector.beforeVisit
|
|
@@ -1476,11 +1484,15 @@ function StoryboardFunctionRegistryFactory() {
|
|
|
1476
1484
|
storyboardFunctions,
|
|
1477
1485
|
isStoryboardFunction: true
|
|
1478
1486
|
}), !!collectCoverage),
|
|
1479
|
-
hooks:
|
|
1487
|
+
hooks: _objectSpread({
|
|
1488
|
+
perfCall: needPerf ? duration => {
|
|
1489
|
+
perf(name, fn.source, duration);
|
|
1490
|
+
} : undefined
|
|
1491
|
+
}, collector ? {
|
|
1480
1492
|
beforeEvaluate: collector.beforeEvaluate,
|
|
1481
1493
|
beforeCall: collector.beforeCall,
|
|
1482
1494
|
beforeBranch: collector.beforeBranch
|
|
1483
|
-
}
|
|
1495
|
+
} : null)
|
|
1484
1496
|
});
|
|
1485
1497
|
fn.processed = true;
|
|
1486
1498
|
return fn.cooked;
|
|
@@ -1496,6 +1508,19 @@ function StoryboardFunctionRegistryFactory() {
|
|
|
1496
1508
|
}
|
|
1497
1509
|
};
|
|
1498
1510
|
}
|
|
1511
|
+
function perf(name, source, duration) {
|
|
1512
|
+
var _window, _window$STORYBOARD_FU;
|
|
1513
|
+
var list = (_window$STORYBOARD_FU = (_window = window).STORYBOARD_FUNCTIONS_PERF) !== null && _window$STORYBOARD_FU !== void 0 ? _window$STORYBOARD_FU : _window.STORYBOARD_FUNCTIONS_PERF = [];
|
|
1514
|
+
var data = list.find(item => item.name === name);
|
|
1515
|
+
if (!data) {
|
|
1516
|
+
list.push(data = {
|
|
1517
|
+
name,
|
|
1518
|
+
durations: [],
|
|
1519
|
+
source
|
|
1520
|
+
});
|
|
1521
|
+
}
|
|
1522
|
+
data.durations.push(Math.round(duration * 1000));
|
|
1523
|
+
}
|
|
1499
1524
|
|
|
1500
1525
|
var {
|
|
1501
1526
|
storyboardFunctions,
|
|
@@ -2704,7 +2729,9 @@ function attemptToVisit(data, globals) {
|
|
|
2704
2729
|
if (globals.some(key => data.includes(key))) {
|
|
2705
2730
|
var {
|
|
2706
2731
|
attemptToVisitGlobals
|
|
2707
|
-
} = preevaluate(data
|
|
2732
|
+
} = preevaluate(data, {
|
|
2733
|
+
cache: true
|
|
2734
|
+
});
|
|
2708
2735
|
return globals.some(key => attemptToVisitGlobals.has(key));
|
|
2709
2736
|
}
|
|
2710
2737
|
} else if (globals.includes("APP")) {
|
|
@@ -2873,7 +2900,9 @@ function evaluate(raw) {
|
|
|
2873
2900
|
// A `SyntaxError` maybe thrown.
|
|
2874
2901
|
var precooked;
|
|
2875
2902
|
try {
|
|
2876
|
-
precooked = preevaluate(raw
|
|
2903
|
+
precooked = preevaluate(raw, {
|
|
2904
|
+
cache: true
|
|
2905
|
+
});
|
|
2877
2906
|
} catch (error) {
|
|
2878
2907
|
var message = "".concat(error.message, ", in \"").concat(raw, "\"");
|
|
2879
2908
|
if (options.isReEvaluation) {
|
|
@@ -12069,7 +12098,7 @@ class Router {
|
|
|
12069
12098
|
render(location) {
|
|
12070
12099
|
var _this3 = this;
|
|
12071
12100
|
return _asyncToGenerator$3(function* () {
|
|
12072
|
-
var _apiAnalyzer$getInsta, _storyboard$app, _this3$kernel$previou, _currentApp$config,
|
|
12101
|
+
var _apiAnalyzer$getInsta, _storyboard$app, _this3$kernel$previou, _currentApp, _currentApp2, _currentApp2$config, _currentApp2$config$_, _this3$kernel$bootstr, _this3$kernel$bootstr2, _getLocalAppsTheme, _currentApp3, _currentApp4, _storyboard$app$homep, _storyboard$app2;
|
|
12073
12102
|
_this3.state = "initial";
|
|
12074
12103
|
var renderId = _this3.renderId = uniqueId("render-id-");
|
|
12075
12104
|
resetAllInjected();
|
|
@@ -12101,6 +12130,14 @@ class Router {
|
|
|
12101
12130
|
version: storyboard.app.currentVersion
|
|
12102
12131
|
});
|
|
12103
12132
|
}
|
|
12133
|
+
var previousApp = _this3.kernel.currentApp;
|
|
12134
|
+
var currentApp = storyboard ? storyboard.app : undefined;
|
|
12135
|
+
// Storyboard maybe re-assigned, e.g. when open launchpad.
|
|
12136
|
+
var appChanged = previousApp && currentApp ? previousApp.id !== currentApp.id : previousApp !== currentApp;
|
|
12137
|
+
clearExpressionASTCache();
|
|
12138
|
+
if (appChanged) {
|
|
12139
|
+
clearFunctionASTCache();
|
|
12140
|
+
}
|
|
12104
12141
|
|
|
12105
12142
|
/** Pending task for loading bricks */
|
|
12106
12143
|
var pendingTask;
|
|
@@ -12147,18 +12184,15 @@ class Router {
|
|
|
12147
12184
|
registerMock((_storyboard$meta2 = storyboard.meta) === null || _storyboard$meta2 === void 0 ? void 0 : _storyboard$meta2.mocks);
|
|
12148
12185
|
registerFormRenderer();
|
|
12149
12186
|
collectContract((_storyboard$meta3 = storyboard.meta) === null || _storyboard$meta3 === void 0 ? void 0 : _storyboard$meta3.contracts);
|
|
12187
|
+
|
|
12188
|
+
// `app` maybe fulfilled
|
|
12189
|
+
currentApp = storyboard.app;
|
|
12150
12190
|
}
|
|
12151
|
-
var
|
|
12152
|
-
mountPoints,
|
|
12153
|
-
currentApp: previousApp
|
|
12154
|
-
} = _this3.kernel;
|
|
12155
|
-
var currentApp = storyboard ? storyboard.app : undefined;
|
|
12156
|
-
// Storyboard maybe re-assigned, e.g. when open launchpad.
|
|
12157
|
-
var appChanged = previousApp && currentApp ? previousApp.id !== currentApp.id : previousApp !== currentApp;
|
|
12191
|
+
var mountPoints = _this3.kernel.mountPoints;
|
|
12158
12192
|
var legacy = currentApp ? currentApp.legacy : undefined;
|
|
12159
|
-
var layoutType = (currentApp === null ||
|
|
12193
|
+
var layoutType = ((_currentApp = currentApp) === null || _currentApp === void 0 ? void 0 : _currentApp.layoutType) || "console";
|
|
12160
12194
|
var faviconElement = document.querySelector("link[rel='shortcut icon']");
|
|
12161
|
-
var customFaviconHref = currentApp === null ||
|
|
12195
|
+
var customFaviconHref = (_currentApp2 = currentApp) === null || _currentApp2 === void 0 ? void 0 : (_currentApp2$config = _currentApp2.config) === null || _currentApp2$config === void 0 ? void 0 : (_currentApp2$config$_ = _currentApp2$config._easyops_app_favicon) === null || _currentApp2$config$_ === void 0 ? void 0 : _currentApp2$config$_.default;
|
|
12162
12196
|
var settingsFaviconHref = (_this3$kernel$bootstr = _this3.kernel.bootstrapData.settings) === null || _this3$kernel$bootstr === void 0 ? void 0 : (_this3$kernel$bootstr2 = _this3$kernel$bootstr.brand) === null || _this3$kernel$bootstr2 === void 0 ? void 0 : _this3$kernel$bootstr2.favicon;
|
|
12163
12197
|
if (faviconElement) {
|
|
12164
12198
|
if (customFaviconHref) {
|
|
@@ -12177,7 +12211,7 @@ class Router {
|
|
|
12177
12211
|
transform: "translateY(-100px)",
|
|
12178
12212
|
height: "calc(100vh - var(--app-bar-height))"
|
|
12179
12213
|
};
|
|
12180
|
-
setTheme(((_getLocalAppsTheme = getLocalAppsTheme()) === null || _getLocalAppsTheme === void 0 ? void 0 : _getLocalAppsTheme[currentApp === null ||
|
|
12214
|
+
setTheme(((_getLocalAppsTheme = getLocalAppsTheme()) === null || _getLocalAppsTheme === void 0 ? void 0 : _getLocalAppsTheme[(_currentApp3 = currentApp) === null || _currentApp3 === void 0 ? void 0 : _currentApp3.id]) || ((_currentApp4 = currentApp) === null || _currentApp4 === void 0 ? void 0 : _currentApp4.theme) || "light");
|
|
12181
12215
|
getRuntime().getFeatureFlags()["support-ui-8.2-compact-layout"] ? document.body.classList.add("compact-layout") : document.body.classList.remove("compact-layout");
|
|
12182
12216
|
setMode("default");
|
|
12183
12217
|
devtoolsHookEmit("rendering");
|
|
@@ -12373,12 +12407,12 @@ class Router {
|
|
|
12373
12407
|
// When we have a matched route other than an abstract route,
|
|
12374
12408
|
// we say *page found*, otherwise, *page not found*.
|
|
12375
12409
|
if (route && route.type !== "routes" || failed) {
|
|
12376
|
-
var _this3$kernel$bootstr3, _this3$kernel$bootstr4, _getAuth$license;
|
|
12410
|
+
var _currentApp5, _this3$kernel$bootstr3, _this3$kernel$bootstr4, _getAuth$license;
|
|
12377
12411
|
if (!failed) {
|
|
12378
12412
|
yield pendingTask;
|
|
12379
12413
|
}
|
|
12380
12414
|
window.DISABLE_REACT_FLUSH_SYNC = false;
|
|
12381
|
-
setUIVersion(currentApp === null ||
|
|
12415
|
+
setUIVersion((_currentApp5 = currentApp) === null || _currentApp5 === void 0 ? void 0 : _currentApp5.uiVersion);
|
|
12382
12416
|
main.length > 0 && mountTree(main, mountPoints.main);
|
|
12383
12417
|
portal.length > 0 && mountTree(portal, mountPoints.portal);
|
|
12384
12418
|
afterMountTree(mountPoints.main);
|