@next-core/brick-kit 2.92.2 → 2.95.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 +46 -90
- package/dist/index.bundle.js +322 -255
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +318 -252
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/Kernel.d.ts +0 -6
- package/dist/types/core/Kernel.d.ts.map +1 -1
- package/dist/types/core/MockRegistry.d.ts +6 -0
- package/dist/types/core/MockRegistry.d.ts.map +1 -0
- package/dist/types/core/Router.d.ts.map +1 -1
- package/dist/types/core/StoryboardFunctionRegistryFactory.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/internal/devtools.d.ts +6 -0
- package/dist/types/internal/devtools.d.ts.map +1 -1
- package/dist/types/internal/evaluate.d.ts.map +1 -1
- package/dist/types/internal/getGeneralGlobals.d.ts +10 -0
- package/dist/types/internal/getGeneralGlobals.d.ts.map +1 -0
- package/dist/types/internal/proxyFactories.d.ts +3 -0
- package/dist/types/internal/proxyFactories.d.ts.map +1 -0
- package/package.json +11 -11
package/dist/index.esm.js
CHANGED
|
@@ -7,9 +7,9 @@ import React, { useState, useEffect, forwardRef, useRef, useImperativeHandle, us
|
|
|
7
7
|
import lodash, { set, get, difference, identity, cloneDeep, isNil, sortBy, merge, clamp, uniqueId, orderBy, omit, isEmpty } from 'lodash';
|
|
8
8
|
import { toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, scanPermissionActionsInStoryboard, precookFunction, cook, shouldAllowRecursiveEvaluations, preevaluate, inject, deepFreeze, createProviderClass, scanRouteAliasInStoryboard, loadScript, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, getDllAndDepsByResource, resolveContextConcurrently, matchPath, asyncProcessBrick, restoreDynamicTemplates, mapCustomApisToNameAndNamespace, scanCustomApisInStoryboard } from '@next-core/brick-utils';
|
|
9
9
|
import { http, HttpResponseError, HttpFetchError } from '@next-core/brick-http';
|
|
10
|
-
import i18next, { getFixedT } from 'i18next';
|
|
11
10
|
import moment from 'moment';
|
|
12
11
|
import { pipes } from '@next-core/pipes';
|
|
12
|
+
import i18next, { getFixedT } from 'i18next';
|
|
13
13
|
import { userAnalytics, apiAnalyzer } from '@next-core/easyops-analytics';
|
|
14
14
|
import yaml from 'js-yaml';
|
|
15
15
|
import { Modal, message, Empty, ConfigProvider } from 'antd';
|
|
@@ -1159,7 +1159,6 @@ function listenDevtools() {
|
|
|
1159
1159
|
}
|
|
1160
1160
|
});
|
|
1161
1161
|
}
|
|
1162
|
-
|
|
1163
1162
|
function getDevHook() {
|
|
1164
1163
|
return window.__BRICK_NEXT_DEVTOOLS_HOOK__;
|
|
1165
1164
|
}
|
|
@@ -1170,6 +1169,90 @@ function restoreDehydrated(value) {
|
|
|
1170
1169
|
return (_getDevHook$restoreDe = (_getDevHook2 = getDevHook()) === null || _getDevHook2 === void 0 ? void 0 : _getDevHook2.restoreDehydrated(value)) !== null && _getDevHook$restoreDe !== void 0 ? _getDevHook$restoreDe : value;
|
|
1171
1170
|
}
|
|
1172
1171
|
|
|
1172
|
+
function getItemFactory(storageType) {
|
|
1173
|
+
return function (name) {
|
|
1174
|
+
var storage = storageType === "local" ? localStorage : sessionStorage;
|
|
1175
|
+
return JSON.parse(storage.getItem(name));
|
|
1176
|
+
};
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
var locale$7 = {
|
|
1180
|
+
[K.REQUEST_FAILED]: "Request Failed",
|
|
1181
|
+
[K.MODAL_OK]: "Ok",
|
|
1182
|
+
[K.MODAL_CANCEL]: "Cancel",
|
|
1183
|
+
[K.SOMETHING_WENT_WRONG]: "Something went wrong!",
|
|
1184
|
+
[K.LOGIN_TIMEOUT_MESSAGE]: "You haven't logged in or your login session has expired. Login right now?",
|
|
1185
|
+
[K.NETWORK_ERROR]: "Network error, please check your network."
|
|
1186
|
+
};
|
|
1187
|
+
var en = locale$7;
|
|
1188
|
+
|
|
1189
|
+
var locale$6 = {
|
|
1190
|
+
[K.REQUEST_FAILED]: "请求失败",
|
|
1191
|
+
[K.MODAL_OK]: "确认",
|
|
1192
|
+
[K.MODAL_CANCEL]: "取消",
|
|
1193
|
+
[K.SOMETHING_WENT_WRONG]: "出现了一些问题!",
|
|
1194
|
+
[K.LOGIN_TIMEOUT_MESSAGE]: "您还未登录或登录信息已过期,现在重新登录?",
|
|
1195
|
+
[K.NETWORK_ERROR]: "网络错误,请检查您的网络连接。"
|
|
1196
|
+
};
|
|
1197
|
+
var zh = locale$6;
|
|
1198
|
+
|
|
1199
|
+
/** @internal */
|
|
1200
|
+
|
|
1201
|
+
var initI18n = () => {
|
|
1202
|
+
i18next.addResourceBundle("en", NS_BRICK_KIT, en);
|
|
1203
|
+
i18next.addResourceBundle("zh", NS_BRICK_KIT, zh);
|
|
1204
|
+
};
|
|
1205
|
+
/** @internal */
|
|
1206
|
+
|
|
1207
|
+
function getI18nNamespace(type, id) {
|
|
1208
|
+
return "$".concat(type, "-").concat(id);
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
function registerWidgetI18n(widgetId, i18n) {
|
|
1212
|
+
var ns = getI18nNamespace("widget", widgetId);
|
|
1213
|
+
Object.entries(i18n).forEach(_ref => {
|
|
1214
|
+
var [lang, resources] = _ref;
|
|
1215
|
+
i18next.addResourceBundle(lang, ns, resources);
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
function widgetI18nFactory(widgetId) {
|
|
1219
|
+
return getFixedT(null, getI18nNamespace("widget", widgetId));
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
function i18nText(data) {
|
|
1223
|
+
var _i18next$language;
|
|
1224
|
+
|
|
1225
|
+
if (!data) {
|
|
1226
|
+
return;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
var language = (_i18next$language = i18next.language) !== null && _i18next$language !== void 0 ? _i18next$language : "zh-CN"; // First, make a perfect match.
|
|
1230
|
+
|
|
1231
|
+
if (hasOwnProperty(data, language)) {
|
|
1232
|
+
return data[language];
|
|
1233
|
+
} // https://en.wikipedia.org/wiki/IETF_language_tag
|
|
1234
|
+
|
|
1235
|
+
|
|
1236
|
+
var primaryLanguage = language.split("-")[0];
|
|
1237
|
+
|
|
1238
|
+
if (primaryLanguage !== language) {
|
|
1239
|
+
// Then, match the primary language (which omits other subtags).
|
|
1240
|
+
// E.g., match `zh` if the current language is `zh-CN`.
|
|
1241
|
+
return hasOwnProperty(data, primaryLanguage) ? data[primaryLanguage] : undefined;
|
|
1242
|
+
} // At last, match the first key which starts with the primary language,
|
|
1243
|
+
// if the current language contains primary subtag only.
|
|
1244
|
+
// E.g., match `zh-CN` if the current language is `zh`.
|
|
1245
|
+
|
|
1246
|
+
|
|
1247
|
+
var prefix = "".concat(primaryLanguage, "-");
|
|
1248
|
+
|
|
1249
|
+
for (var key of Object.keys(data)) {
|
|
1250
|
+
if (key.startsWith(prefix)) {
|
|
1251
|
+
return data[key];
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1173
1256
|
function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1174
1257
|
try {
|
|
1175
1258
|
var info = gen[key](arg);
|
|
@@ -1382,88 +1465,68 @@ function resetPermissionPreChecks() {
|
|
|
1382
1465
|
permissionMap.clear();
|
|
1383
1466
|
}
|
|
1384
1467
|
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
};
|
|
1390
|
-
}
|
|
1468
|
+
// `GeneralGlobals` are globals which are page-state-agnostic,
|
|
1469
|
+
// thus they can be used both in storyboard expressions and functions.
|
|
1470
|
+
function getGeneralGlobals(attemptToVisitGlobals, options) {
|
|
1471
|
+
var globalVariables = {};
|
|
1391
1472
|
|
|
1392
|
-
|
|
1393
|
-
|
|
1473
|
+
for (var variableName of attemptToVisitGlobals) {
|
|
1474
|
+
var variable = getIndividualGlobal(variableName, options);
|
|
1394
1475
|
|
|
1395
|
-
|
|
1396
|
-
|
|
1476
|
+
if (variable !== undefined) {
|
|
1477
|
+
globalVariables[variableName] = variable;
|
|
1478
|
+
}
|
|
1397
1479
|
}
|
|
1398
1480
|
|
|
1399
|
-
|
|
1481
|
+
return globalVariables;
|
|
1482
|
+
}
|
|
1400
1483
|
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1484
|
+
function getIndividualGlobal(variableName, _ref) {
|
|
1485
|
+
var {
|
|
1486
|
+
collectCoverage,
|
|
1487
|
+
widgetId,
|
|
1488
|
+
app,
|
|
1489
|
+
storyboardFunctions
|
|
1490
|
+
} = _ref;
|
|
1404
1491
|
|
|
1492
|
+
switch (variableName) {
|
|
1493
|
+
case "BASE_URL":
|
|
1494
|
+
return collectCoverage ? "/next" : getBasePath().replace(/\/$/, "");
|
|
1405
1495
|
|
|
1406
|
-
|
|
1496
|
+
case "FN":
|
|
1497
|
+
return storyboardFunctions;
|
|
1407
1498
|
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
// E.g., match `zh` if the current language is `zh-CN`.
|
|
1411
|
-
return hasOwnProperty(data, primaryLanguage) ? data[primaryLanguage] : undefined;
|
|
1412
|
-
} // At last, match the first key which starts with the primary language,
|
|
1413
|
-
// if the current language contains primary subtag only.
|
|
1414
|
-
// E.g., match `zh-CN` if the current language is `zh`.
|
|
1499
|
+
case "IMG":
|
|
1500
|
+
return collectCoverage ? fakeImageFactory() : widgetId ? widgetImagesFactory(widgetId) : imagesFactory(app.id, app.isBuildPush);
|
|
1415
1501
|
|
|
1502
|
+
case "I18N":
|
|
1503
|
+
return collectCoverage ? identity : widgetId ? widgetI18nFactory(widgetId) : getFixedT(null, getI18nNamespace("app", app.id));
|
|
1416
1504
|
|
|
1417
|
-
|
|
1505
|
+
case "I18N_TEXT":
|
|
1506
|
+
return collectCoverage ? fakeI18nText : i18nText;
|
|
1418
1507
|
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1508
|
+
case "PERMISSIONS":
|
|
1509
|
+
return {
|
|
1510
|
+
check: collectCoverage ? fakeCheckPermissions : checkPermissions
|
|
1511
|
+
};
|
|
1423
1512
|
}
|
|
1424
1513
|
}
|
|
1425
1514
|
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
[K.MODAL_CANCEL]: "Cancel",
|
|
1430
|
-
[K.SOMETHING_WENT_WRONG]: "Something went wrong!",
|
|
1431
|
-
[K.LOGIN_TIMEOUT_MESSAGE]: "You haven't logged in or your login session has expired. Login right now?",
|
|
1432
|
-
[K.NETWORK_ERROR]: "Network error, please check your network."
|
|
1433
|
-
};
|
|
1434
|
-
var en = locale$7;
|
|
1435
|
-
|
|
1436
|
-
var locale$6 = {
|
|
1437
|
-
[K.REQUEST_FAILED]: "请求失败",
|
|
1438
|
-
[K.MODAL_OK]: "确认",
|
|
1439
|
-
[K.MODAL_CANCEL]: "取消",
|
|
1440
|
-
[K.SOMETHING_WENT_WRONG]: "出现了一些问题!",
|
|
1441
|
-
[K.LOGIN_TIMEOUT_MESSAGE]: "您还未登录或登录信息已过期,现在重新登录?",
|
|
1442
|
-
[K.NETWORK_ERROR]: "网络错误,请检查您的网络连接。"
|
|
1443
|
-
};
|
|
1444
|
-
var zh = locale$6;
|
|
1445
|
-
|
|
1446
|
-
/** @internal */
|
|
1515
|
+
function fakeI18nText(data) {
|
|
1516
|
+
return data === null || data === void 0 ? void 0 : data.en;
|
|
1517
|
+
}
|
|
1447
1518
|
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1519
|
+
function fakeImageFactory() {
|
|
1520
|
+
return {
|
|
1521
|
+
get(name) {
|
|
1522
|
+
return "mock/images/".concat(name);
|
|
1523
|
+
}
|
|
1453
1524
|
|
|
1454
|
-
|
|
1455
|
-
return "$".concat(type, "-").concat(id);
|
|
1525
|
+
};
|
|
1456
1526
|
}
|
|
1457
1527
|
|
|
1458
|
-
function
|
|
1459
|
-
|
|
1460
|
-
Object.entries(i18n).forEach(_ref => {
|
|
1461
|
-
var [lang, resources] = _ref;
|
|
1462
|
-
i18next.addResourceBundle(lang, ns, resources);
|
|
1463
|
-
});
|
|
1464
|
-
}
|
|
1465
|
-
function widgetI18nFactory(widgetId) {
|
|
1466
|
-
return getFixedT(null, getI18nNamespace("widget", widgetId));
|
|
1528
|
+
function fakeCheckPermissions() {
|
|
1529
|
+
return true;
|
|
1467
1530
|
}
|
|
1468
1531
|
|
|
1469
1532
|
/** @internal */
|
|
@@ -1482,29 +1545,11 @@ function StoryboardFunctionRegistryFactory() {
|
|
|
1482
1545
|
}
|
|
1483
1546
|
|
|
1484
1547
|
});
|
|
1485
|
-
|
|
1486
|
-
var builtinSupply = _objectSpread({
|
|
1487
|
-
// Functions can call other functions.
|
|
1488
|
-
FN: storyboardFunctions
|
|
1489
|
-
}, collectCoverage ? {
|
|
1490
|
-
// Fake builtin methods for tests.
|
|
1491
|
-
I18N: identity,
|
|
1492
|
-
I18N_TEXT: fakeI18nText,
|
|
1493
|
-
IMG: fakeImageFactory()
|
|
1494
|
-
} : widgetId ? {
|
|
1495
|
-
I18N: widgetI18nFactory(widgetId),
|
|
1496
|
-
I18N_TEXT: i18nText,
|
|
1497
|
-
IMG: widgetImagesFactory(widgetId)
|
|
1498
|
-
} : {
|
|
1499
|
-
I18N_TEXT: i18nText
|
|
1500
|
-
});
|
|
1548
|
+
var currentApp;
|
|
1501
1549
|
|
|
1502
1550
|
function registerStoryboardFunctions(functions, app) {
|
|
1503
1551
|
if (app) {
|
|
1504
|
-
|
|
1505
|
-
I18N: getFixedT(null, getI18nNamespace("app", app.id)),
|
|
1506
|
-
IMG: imagesFactory(app.id, app.isBuildPush)
|
|
1507
|
-
});
|
|
1552
|
+
currentApp = app;
|
|
1508
1553
|
}
|
|
1509
1554
|
|
|
1510
1555
|
registeredFunctions.clear();
|
|
@@ -1546,7 +1591,12 @@ function StoryboardFunctionRegistryFactory() {
|
|
|
1546
1591
|
rules: {
|
|
1547
1592
|
noVar: true
|
|
1548
1593
|
},
|
|
1549
|
-
globalVariables: supply(precooked.attemptToVisitGlobals,
|
|
1594
|
+
globalVariables: supply(precooked.attemptToVisitGlobals, getGeneralGlobals(precooked.attemptToVisitGlobals, {
|
|
1595
|
+
collectCoverage,
|
|
1596
|
+
widgetId,
|
|
1597
|
+
app: currentApp,
|
|
1598
|
+
storyboardFunctions
|
|
1599
|
+
})),
|
|
1550
1600
|
hooks: collector && {
|
|
1551
1601
|
beforeEvaluate: collector.beforeEvaluate,
|
|
1552
1602
|
beforeCall: collector.beforeCall,
|
|
@@ -1571,19 +1621,6 @@ function StoryboardFunctionRegistryFactory() {
|
|
|
1571
1621
|
};
|
|
1572
1622
|
}
|
|
1573
1623
|
|
|
1574
|
-
function fakeI18nText(data) {
|
|
1575
|
-
return data === null || data === void 0 ? void 0 : data.en;
|
|
1576
|
-
}
|
|
1577
|
-
|
|
1578
|
-
function fakeImageFactory() {
|
|
1579
|
-
return {
|
|
1580
|
-
get(name) {
|
|
1581
|
-
return "mock/images/".concat(name);
|
|
1582
|
-
}
|
|
1583
|
-
|
|
1584
|
-
};
|
|
1585
|
-
}
|
|
1586
|
-
|
|
1587
1624
|
var {
|
|
1588
1625
|
storyboardFunctions,
|
|
1589
1626
|
registerStoryboardFunctions
|
|
@@ -1612,6 +1649,39 @@ function registerWidgetFunctions(widgetId, functions) {
|
|
|
1612
1649
|
registerStoryboardFunctions(functions);
|
|
1613
1650
|
}
|
|
1614
1651
|
|
|
1652
|
+
var THROW = () => {
|
|
1653
|
+
throw new Error("Can't modify read-only proxy object");
|
|
1654
|
+
};
|
|
1655
|
+
|
|
1656
|
+
var readOnlyHandler = {
|
|
1657
|
+
set: THROW,
|
|
1658
|
+
defineProperty: THROW,
|
|
1659
|
+
deleteProperty: THROW,
|
|
1660
|
+
setPrototypeOf: THROW
|
|
1661
|
+
};
|
|
1662
|
+
function getReadOnlyProxy(object) {
|
|
1663
|
+
return new Proxy(object, readOnlyHandler);
|
|
1664
|
+
} // First, we want to make accessing property of globals lazy,
|
|
1665
|
+
// So we use *Proxy* to make a dynamic accessor for each of these globals.
|
|
1666
|
+
// But we also want to keep them working in devtools.
|
|
1667
|
+
|
|
1668
|
+
function getDynamicReadOnlyProxy(_ref) {
|
|
1669
|
+
var {
|
|
1670
|
+
get,
|
|
1671
|
+
ownKeys
|
|
1672
|
+
} = _ref;
|
|
1673
|
+
|
|
1674
|
+
if (getDevHook()) {
|
|
1675
|
+
// In devtools, we extract them at beginning.
|
|
1676
|
+
var target = Object.fromEntries(ownKeys(null).map(key => [key, get(null, key, null)]));
|
|
1677
|
+
return getReadOnlyProxy(target);
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
return new Proxy(Object.freeze({}), {
|
|
1681
|
+
get
|
|
1682
|
+
});
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1615
1685
|
var symbolForRaw = Symbol.for("pre.evaluated.raw");
|
|
1616
1686
|
var symbolForContext = Symbol.for("pre.evaluated.context");
|
|
1617
1687
|
function isPreEvaluated(raw) {
|
|
@@ -1729,126 +1799,142 @@ function evaluate(raw) {
|
|
|
1729
1799
|
|
|
1730
1800
|
var app = (_runtimeContext$overr = runtimeContext.overrideApp) !== null && _runtimeContext$overr !== void 0 ? _runtimeContext$overr : currentApp;
|
|
1731
1801
|
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1802
|
+
function getIndividualGlobal(variableName) {
|
|
1803
|
+
switch (variableName) {
|
|
1804
|
+
case "ALIAS":
|
|
1805
|
+
return {
|
|
1806
|
+
getUrl: getUrlByAliasFactory(app)
|
|
1807
|
+
};
|
|
1735
1808
|
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
}
|
|
1809
|
+
case "ANCHOR":
|
|
1810
|
+
return hash ? hash.substr(1) : null;
|
|
1739
1811
|
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
}
|
|
1812
|
+
case "APP":
|
|
1813
|
+
return cloneDeep(app);
|
|
1743
1814
|
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1815
|
+
case "CTX":
|
|
1816
|
+
return getDynamicReadOnlyProxy({
|
|
1817
|
+
get(target, key) {
|
|
1818
|
+
var _item$brick$element;
|
|
1747
1819
|
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1820
|
+
var item = storyboardContext.get(key);
|
|
1821
|
+
return !item ? item : item.type === "brick-property" ? (_item$brick$element = item.brick.element) === null || _item$brick$element === void 0 ? void 0 : _item$brick$element[item.prop] : item.value;
|
|
1822
|
+
},
|
|
1751
1823
|
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1824
|
+
ownKeys() {
|
|
1825
|
+
return Array.from(storyboardContext.keys());
|
|
1826
|
+
}
|
|
1755
1827
|
|
|
1756
|
-
|
|
1757
|
-
globalVariables.FLAGS = cloneDeep(flags);
|
|
1758
|
-
}
|
|
1828
|
+
});
|
|
1759
1829
|
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
}
|
|
1830
|
+
case "FLAGS":
|
|
1831
|
+
return getReadOnlyProxy(flags);
|
|
1763
1832
|
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
}
|
|
1833
|
+
case "HASH":
|
|
1834
|
+
return hash;
|
|
1767
1835
|
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
}
|
|
1836
|
+
case "INSTALLED_APPS":
|
|
1837
|
+
return {
|
|
1838
|
+
has: (appId, matchVersion) => getRuntime().hasInstalledApp(appId, matchVersion)
|
|
1839
|
+
};
|
|
1773
1840
|
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
}
|
|
1841
|
+
case "LOCAL_STORAGE":
|
|
1842
|
+
return {
|
|
1843
|
+
getItem: getItemFactory("local")
|
|
1844
|
+
};
|
|
1779
1845
|
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
}
|
|
1846
|
+
case "MISC":
|
|
1847
|
+
return getRuntime().getMiscSettings();
|
|
1783
1848
|
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
}
|
|
1849
|
+
case "PARAMS":
|
|
1850
|
+
return new URLSearchParams(query);
|
|
1787
1851
|
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
}
|
|
1852
|
+
case "PATH":
|
|
1853
|
+
return getReadOnlyProxy(match.params);
|
|
1791
1854
|
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1855
|
+
case "PROCESSORS":
|
|
1856
|
+
return getDynamicReadOnlyProxy({
|
|
1857
|
+
get(target, key) {
|
|
1858
|
+
var pkg = customProcessorRegistry.get(key);
|
|
1859
|
+
return pkg ? getDynamicReadOnlyProxy({
|
|
1860
|
+
get(t, k) {
|
|
1861
|
+
return pkg.get(k);
|
|
1862
|
+
},
|
|
1795
1863
|
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1864
|
+
ownKeys() {
|
|
1865
|
+
return Array.from(pkg.keys());
|
|
1866
|
+
}
|
|
1799
1867
|
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
var _item$brick$element;
|
|
1868
|
+
}) : pkg;
|
|
1869
|
+
},
|
|
1803
1870
|
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
}
|
|
1871
|
+
ownKeys() {
|
|
1872
|
+
return Array.from(customProcessorRegistry.keys());
|
|
1873
|
+
}
|
|
1808
1874
|
|
|
1809
|
-
|
|
1810
|
-
globalVariables.PROCESSORS = Object.fromEntries(Array.from(customProcessorRegistry.entries()).map(_ref2 => {
|
|
1811
|
-
var [namespace, registry] = _ref2;
|
|
1812
|
-
return [namespace, Object.fromEntries(registry.entries())];
|
|
1813
|
-
}));
|
|
1814
|
-
}
|
|
1875
|
+
});
|
|
1815
1876
|
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1877
|
+
case "QUERY":
|
|
1878
|
+
return getDynamicReadOnlyProxy({
|
|
1879
|
+
get(target, key) {
|
|
1880
|
+
return query.get(key);
|
|
1881
|
+
},
|
|
1821
1882
|
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
};
|
|
1826
|
-
}
|
|
1883
|
+
ownKeys() {
|
|
1884
|
+
return Array.from(query.keys());
|
|
1885
|
+
}
|
|
1827
1886
|
|
|
1828
|
-
|
|
1829
|
-
globalVariables.SESSION_STORAGE = {
|
|
1830
|
-
getItem: getItemFactory("session")
|
|
1831
|
-
};
|
|
1832
|
-
}
|
|
1887
|
+
});
|
|
1833
1888
|
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1889
|
+
case "QUERY_ARRAY":
|
|
1890
|
+
return getDynamicReadOnlyProxy({
|
|
1891
|
+
get(target, key) {
|
|
1892
|
+
return query.getAll(key);
|
|
1893
|
+
},
|
|
1839
1894
|
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1895
|
+
ownKeys() {
|
|
1896
|
+
return Array.from(query.keys());
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
});
|
|
1900
|
+
|
|
1901
|
+
case "SEGUE":
|
|
1902
|
+
return {
|
|
1903
|
+
getUrl: getUrlBySegueFactory(app, segues)
|
|
1904
|
+
};
|
|
1905
|
+
|
|
1906
|
+
case "SESSION_STORAGE":
|
|
1907
|
+
return {
|
|
1908
|
+
getItem: getItemFactory("session")
|
|
1909
|
+
};
|
|
1910
|
+
|
|
1911
|
+
case "SYS":
|
|
1912
|
+
return getReadOnlyProxy(sys);
|
|
1843
1913
|
|
|
1844
|
-
|
|
1845
|
-
|
|
1914
|
+
case "__WIDGET_FN__":
|
|
1915
|
+
return widgetFunctions;
|
|
1916
|
+
|
|
1917
|
+
case "__WIDGET_IMG__":
|
|
1918
|
+
return widgetImagesFactory;
|
|
1919
|
+
|
|
1920
|
+
case "__WIDGET_I18N__":
|
|
1921
|
+
return widgetI18nFactory;
|
|
1922
|
+
}
|
|
1846
1923
|
}
|
|
1847
1924
|
|
|
1848
|
-
|
|
1849
|
-
|
|
1925
|
+
for (var variableName of attemptToVisitGlobals) {
|
|
1926
|
+
var variable = getIndividualGlobal(variableName);
|
|
1927
|
+
|
|
1928
|
+
if (variable !== undefined) {
|
|
1929
|
+
globalVariables[variableName] = variable;
|
|
1930
|
+
}
|
|
1850
1931
|
}
|
|
1851
1932
|
|
|
1933
|
+
Object.assign(globalVariables, getGeneralGlobals(precooked.attemptToVisitGlobals, {
|
|
1934
|
+
storyboardFunctions,
|
|
1935
|
+
app
|
|
1936
|
+
}));
|
|
1937
|
+
|
|
1852
1938
|
try {
|
|
1853
1939
|
var result = cook(precooked.expression, precooked.source, {
|
|
1854
1940
|
globalVariables: supply(precooked.attemptToVisitGlobals, globalVariables)
|
|
@@ -6097,14 +6183,6 @@ class Kernel {
|
|
|
6097
6183
|
|
|
6098
6184
|
_defineProperty$1(this, "loadingBar", void 0);
|
|
6099
6185
|
|
|
6100
|
-
_defineProperty$1(this, "navBar", void 0);
|
|
6101
|
-
|
|
6102
|
-
_defineProperty$1(this, "sideBar", void 0);
|
|
6103
|
-
|
|
6104
|
-
_defineProperty$1(this, "footer", void 0);
|
|
6105
|
-
|
|
6106
|
-
_defineProperty$1(this, "breadcrumb", void 0);
|
|
6107
|
-
|
|
6108
6186
|
_defineProperty$1(this, "router", void 0);
|
|
6109
6187
|
|
|
6110
6188
|
_defineProperty$1(this, "currentApp", void 0);
|
|
@@ -6121,8 +6199,6 @@ class Kernel {
|
|
|
6121
6199
|
|
|
6122
6200
|
_defineProperty$1(this, "currentLayout", void 0);
|
|
6123
6201
|
|
|
6124
|
-
_defineProperty$1(this, "enableUiV8", false);
|
|
6125
|
-
|
|
6126
6202
|
_defineProperty$1(this, "allUserMapPromise", Promise.resolve(new Map()));
|
|
6127
6203
|
|
|
6128
6204
|
_defineProperty$1(this, "allMagicBrickConfigMapPromise", Promise.resolve(new Map()));
|
|
@@ -6149,20 +6225,13 @@ class Kernel {
|
|
|
6149
6225
|
throw new Error("No storyboard were found.");
|
|
6150
6226
|
}
|
|
6151
6227
|
|
|
6152
|
-
_this.setUiVersion();
|
|
6153
|
-
|
|
6154
6228
|
if (isLoggedIn()) {
|
|
6155
6229
|
_this.loadSharedData();
|
|
6156
6230
|
}
|
|
6157
6231
|
|
|
6158
6232
|
_this.menuBar = new MenuBar(_this, "menuBar");
|
|
6159
6233
|
_this.appBar = new AppBar(_this, "appBar");
|
|
6160
|
-
_this.loadingBar = new BaseBar(_this, "loadingBar");
|
|
6161
|
-
|
|
6162
|
-
_this.navBar = new BaseBar(_this, "navBar");
|
|
6163
|
-
_this.sideBar = new BaseBar(_this, "sideBar");
|
|
6164
|
-
_this.breadcrumb = new BaseBar(_this, "breadcrumb");
|
|
6165
|
-
_this.footer = new BaseBar(_this, "footer");
|
|
6234
|
+
_this.loadingBar = new BaseBar(_this, "loadingBar");
|
|
6166
6235
|
_this.router = new Router(_this);
|
|
6167
6236
|
initAnalytics();
|
|
6168
6237
|
yield _this.router.bootstrap();
|
|
@@ -6190,13 +6259,7 @@ class Kernel {
|
|
|
6190
6259
|
loadingBar: "business-website.loading-bar",
|
|
6191
6260
|
pageNotFound: "business-website.page-not-found",
|
|
6192
6261
|
pageError: "business-website.page-error"
|
|
6193
|
-
} : _objectSpread(_objectSpread({}, _this2.
|
|
6194
|
-
loadingBar: _this2.bootstrapData.navbar.loadingBar,
|
|
6195
|
-
navBar: "frame-bricks.nav-bar",
|
|
6196
|
-
sideBar: "frame-bricks.side-bar",
|
|
6197
|
-
breadcrumb: null,
|
|
6198
|
-
footer: null
|
|
6199
|
-
} : _this2.bootstrapData.navbar), {}, {
|
|
6262
|
+
} : _objectSpread(_objectSpread({}, _this2.bootstrapData.navbar), {}, {
|
|
6200
6263
|
pageNotFound: "basic-bricks.page-not-found",
|
|
6201
6264
|
pageError: "basic-bricks.page-error"
|
|
6202
6265
|
});
|
|
@@ -6211,7 +6274,7 @@ class Kernel {
|
|
|
6211
6274
|
|
|
6212
6275
|
yield Promise.all([_this2.menuBar.bootstrap(_this2.presetBricks.menuBar, {
|
|
6213
6276
|
testid: "brick-next-menu-bar"
|
|
6214
|
-
}), _this2.appBar.bootstrap(_this2.presetBricks.appBar), _this2.
|
|
6277
|
+
}), _this2.appBar.bootstrap(_this2.presetBricks.appBar), _this2.loadingBar.bootstrap(_this2.presetBricks.loadingBar)]);
|
|
6215
6278
|
})();
|
|
6216
6279
|
}
|
|
6217
6280
|
|
|
@@ -6763,16 +6826,6 @@ class Kernel {
|
|
|
6763
6826
|
})();
|
|
6764
6827
|
}
|
|
6765
6828
|
|
|
6766
|
-
setUiVersion() {
|
|
6767
|
-
// get from localStorage fot test
|
|
6768
|
-
// this.enableUiV8 = this.getFeatureFlags()["ui-v8"];
|
|
6769
|
-
this.enableUiV8 = !!localStorage.getItem("test-ui-v8");
|
|
6770
|
-
|
|
6771
|
-
if (this.enableUiV8) {
|
|
6772
|
-
document.documentElement.dataset.ui = "v8";
|
|
6773
|
-
}
|
|
6774
|
-
}
|
|
6775
|
-
|
|
6776
6829
|
} // Since `@next-dll/editor-bricks-helper` depends on `@next-dll/react-dnd`,
|
|
6777
6830
|
// always load react-dnd before loading editor-bricks-helper.
|
|
6778
6831
|
|
|
@@ -6977,8 +7030,6 @@ var PropertyDisplayType;
|
|
|
6977
7030
|
|
|
6978
7031
|
/** @internal */
|
|
6979
7032
|
|
|
6980
|
-
/** @internal */
|
|
6981
|
-
|
|
6982
7033
|
/**
|
|
6983
7034
|
* 应用的 Storyboard 配置。
|
|
6984
7035
|
*/
|
|
@@ -9104,6 +9155,23 @@ function shouldBeDefaultCollapsed(defaultCollapsed, defaultCollapsedBreakpoint)
|
|
|
9104
9155
|
return defaultCollapsed || defaultCollapsedBreakpoint && document.documentElement.clientWidth < defaultCollapsedBreakpoint;
|
|
9105
9156
|
}
|
|
9106
9157
|
|
|
9158
|
+
var useMockList = [];
|
|
9159
|
+
function registerMock(mockList) {
|
|
9160
|
+
if (mockList) useMockList = mockList;
|
|
9161
|
+
}
|
|
9162
|
+
|
|
9163
|
+
function getUrlRegExp(str) {
|
|
9164
|
+
return new RegExp("".concat(str.replace(/:\w+/g, "[\\w|-]+"), "$"));
|
|
9165
|
+
}
|
|
9166
|
+
|
|
9167
|
+
var isMatchMockUrl = (requestUrl, uri) => {
|
|
9168
|
+
var reg = getUrlRegExp(uri);
|
|
9169
|
+
return reg.test(requestUrl);
|
|
9170
|
+
};
|
|
9171
|
+
var getMockRule = requestUrl => {
|
|
9172
|
+
return useMockList.find(item => isMatchMockUrl(requestUrl, item.uri));
|
|
9173
|
+
};
|
|
9174
|
+
|
|
9107
9175
|
class Router {
|
|
9108
9176
|
constructor(kernel) {
|
|
9109
9177
|
_defineProperty$1(this, "defaultCollapsed", false);
|
|
@@ -9289,7 +9357,7 @@ class Router {
|
|
|
9289
9357
|
var storyboard = locationContext.matchStoryboard(_this3.kernel.bootstrapData.storyboards);
|
|
9290
9358
|
|
|
9291
9359
|
if (storyboard) {
|
|
9292
|
-
var _storyboard$meta;
|
|
9360
|
+
var _storyboard$meta, _storyboard$meta2;
|
|
9293
9361
|
|
|
9294
9362
|
yield _this3.kernel.fulfilStoryboard(storyboard); // 将动态解析后的模板还原,以便重新动态解析。
|
|
9295
9363
|
|
|
@@ -9307,6 +9375,7 @@ class Router {
|
|
|
9307
9375
|
_this3.kernel.registerCustomTemplatesInStoryboard(storyboard);
|
|
9308
9376
|
|
|
9309
9377
|
registerStoryboardFunctions((_storyboard$meta = storyboard.meta) === null || _storyboard$meta === void 0 ? void 0 : _storyboard$meta.functions, storyboard.app);
|
|
9378
|
+
registerMock((_storyboard$meta2 = storyboard.meta) === null || _storyboard$meta2 === void 0 ? void 0 : _storyboard$meta2.mocks);
|
|
9310
9379
|
}
|
|
9311
9380
|
|
|
9312
9381
|
var {
|
|
@@ -9445,33 +9514,30 @@ class Router {
|
|
|
9445
9514
|
if (barsHidden || getRuntimeMisc().isInIframeOfLegacyConsole) {
|
|
9446
9515
|
_this3.kernel.toggleBars(false);
|
|
9447
9516
|
} else if (_this3.kernel.currentLayout === "console") {
|
|
9448
|
-
|
|
9449
|
-
if (!_this3.kernel.enableUiV8) {
|
|
9450
|
-
var _menuBar$menu, _menuBar$menu2;
|
|
9451
|
-
|
|
9452
|
-
yield constructMenu(menuBar, _this3.locationContext.getCurrentContext(), _this3.kernel);
|
|
9517
|
+
var _menuBar$menu, _menuBar$menu2;
|
|
9453
9518
|
|
|
9454
|
-
|
|
9455
|
-
_this3.kernel.menuBar.collapse(true);
|
|
9519
|
+
yield constructMenu(menuBar, _this3.locationContext.getCurrentContext(), _this3.kernel);
|
|
9456
9520
|
|
|
9457
|
-
|
|
9458
|
-
|
|
9459
|
-
if (_this3.defaultCollapsed) {
|
|
9460
|
-
_this3.kernel.menuBar.collapse(false);
|
|
9461
|
-
}
|
|
9521
|
+
if (shouldBeDefaultCollapsed((_menuBar$menu = menuBar.menu) === null || _menuBar$menu === void 0 ? void 0 : _menuBar$menu.defaultCollapsed, (_menuBar$menu2 = menuBar.menu) === null || _menuBar$menu2 === void 0 ? void 0 : _menuBar$menu2.defaultCollapsedBreakpoint)) {
|
|
9522
|
+
_this3.kernel.menuBar.collapse(true);
|
|
9462
9523
|
|
|
9463
|
-
|
|
9524
|
+
_this3.defaultCollapsed = true;
|
|
9525
|
+
} else {
|
|
9526
|
+
if (_this3.defaultCollapsed) {
|
|
9527
|
+
_this3.kernel.menuBar.collapse(false);
|
|
9464
9528
|
}
|
|
9465
9529
|
|
|
9466
|
-
|
|
9467
|
-
|
|
9468
|
-
// it will be *popped* from iframe automatically.
|
|
9469
|
-
delete appBar.breadcrumb;
|
|
9470
|
-
}
|
|
9530
|
+
_this3.defaultCollapsed = false;
|
|
9531
|
+
}
|
|
9471
9532
|
|
|
9472
|
-
|
|
9473
|
-
|
|
9533
|
+
if (actualLegacy === "iframe") {
|
|
9534
|
+
// Do not modify breadcrumb in iframe mode,
|
|
9535
|
+
// it will be *popped* from iframe automatically.
|
|
9536
|
+
delete appBar.breadcrumb;
|
|
9474
9537
|
}
|
|
9538
|
+
|
|
9539
|
+
mountStaticNode(_this3.kernel.menuBar.element, menuBar);
|
|
9540
|
+
mountStaticNode(_this3.kernel.appBar.element, appBar);
|
|
9475
9541
|
}
|
|
9476
9542
|
|
|
9477
9543
|
_this3.kernel.toggleLegacyIframe(actualLegacy === "iframe");
|
|
@@ -11298,5 +11364,5 @@ var ModalElement = _decorate(null, function (_initialize, _UpdatingElement) {
|
|
|
11298
11364
|
};
|
|
11299
11365
|
}, UpdatingElement);
|
|
11300
11366
|
|
|
11301
|
-
export { BrickAsComponent, BrickWrapper, DisplayByFeatureFlags, EasyopsEmpty, ErrorBoundary, FeatureFlagsProvider, ForwardRefSingleBrickAsComponent, ModalElement, SingleBrickAsComponent, StoryboardFunctionRegistryFactory, UpdatingElement, authenticate, checkIf, checkIfByTransform, createHistory, createRuntime, developHelper, doTransform, event, getAuth, getHistory, getRuntime, handleHttpError, httpErrorToString, i18nText, initI18n, isLoggedIn, logout, looseCheckIf, looseCheckIfByTransform, looseCheckIfOfComputed, method, preprocessTransformProperties, property, reTransformForDevtools, renderEasyopsEmpty, transformElementProperties, transformIntermediateData, transformProperties, useApplyPageTitle, useCurrentApp, useCurrentMode, useCurrentTheme, useFeatureFlags, useLocation, useRecentApps };
|
|
11367
|
+
export { BrickAsComponent, BrickWrapper, DisplayByFeatureFlags, EasyopsEmpty, ErrorBoundary, FeatureFlagsProvider, ForwardRefSingleBrickAsComponent, ModalElement, SingleBrickAsComponent, StoryboardFunctionRegistryFactory, UpdatingElement, authenticate, checkIf, checkIfByTransform, createHistory, createRuntime, developHelper, doTransform, event, getAuth, getHistory, getMockRule, getRuntime, handleHttpError, httpErrorToString, i18nText, initI18n, isLoggedIn, logout, looseCheckIf, looseCheckIfByTransform, looseCheckIfOfComputed, method, preprocessTransformProperties, property, reTransformForDevtools, renderEasyopsEmpty, transformElementProperties, transformIntermediateData, transformProperties, useApplyPageTitle, useCurrentApp, useCurrentMode, useCurrentTheme, useFeatureFlags, useLocation, useRecentApps };
|
|
11302
11368
|
//# sourceMappingURL=index.esm.js.map
|