@next-core/brick-kit 2.127.2 → 2.128.1
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 +34 -0
- package/dist/index.bundle.js +100 -52
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +101 -53
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/Kernel.d.ts +1 -1
- package/dist/types/core/Kernel.d.ts.map +1 -1
- package/dist/types/core/LocationContext.d.ts.map +1 -1
- package/dist/types/core/standaloneBootstrap.d.ts.map +1 -1
- package/dist/types/internal/devtools.d.ts +3 -0
- package/dist/types/internal/devtools.d.ts.map +1 -1
- package/dist/types/internal/menu.d.ts +3 -3
- package/dist/types/internal/menu.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -5,7 +5,7 @@ import _asyncToGenerator$4 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
7
|
import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, scanPermissionActionsInStoryboard, precookFunction, cook, resolveContextConcurrently, syncResolveContextConcurrently, shouldAllowRecursiveEvaluations, preevaluate, inject, deepFreeze, createProviderClass, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, loadScript, matchPath, scanAppGetMenuInAny, asyncProcessBrick, scanInstalledAppsInStoryboard, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
|
|
8
|
-
import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, sortBy, merge,
|
|
8
|
+
import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, isEmpty, sortBy, merge, isObject as isObject$1, pick, orderBy, omit, findLastIndex, noop, isString } from 'lodash';
|
|
9
9
|
import { http, HttpResponseError, HttpFetchError } from '@next-core/brick-http';
|
|
10
10
|
import moment from 'moment';
|
|
11
11
|
import { pipes } from '@next-core/pipes';
|
|
@@ -1134,12 +1134,17 @@ function getNextDoTransformOptions(options, isArray, key) {
|
|
|
1134
1134
|
var MESSAGE_SOURCE_PANEL = "brick-next-devtools-panel";
|
|
1135
1135
|
var EVALUATION_EDIT = "devtools-evaluation-edit";
|
|
1136
1136
|
var TRANSFORMATION_EDIT = "devtools-transformation-edit";
|
|
1137
|
-
|
|
1137
|
+
var FRAME_ACTIVE_CHANGE = "devtools-frame-active-change";
|
|
1138
|
+
var PANEL_CHANGE = "devtools-panel-change";
|
|
1139
|
+
var frameIsActive = true;
|
|
1140
|
+
var selectedPanel;
|
|
1138
1141
|
/* istanbul ignore next */
|
|
1142
|
+
|
|
1139
1143
|
function devtoolsHookEmit(type, payload) {
|
|
1140
1144
|
var devtools = getDevHook();
|
|
1141
1145
|
|
|
1142
|
-
if (!devtools) {
|
|
1146
|
+
if (!devtools || !(type === "evaluation" ? frameIsActive && (!selectedPanel || selectedPanel === "Evaluations") : type === "transformation" ? frameIsActive && (!selectedPanel || selectedPanel === "Transformations") : true)) {
|
|
1147
|
+
// Ignore messages if current devtools panel is not relevant.
|
|
1143
1148
|
return;
|
|
1144
1149
|
}
|
|
1145
1150
|
|
|
@@ -1159,41 +1164,78 @@ function devtoolsHookEmit(type, payload) {
|
|
|
1159
1164
|
setTimeout(emit, 0);
|
|
1160
1165
|
}
|
|
1161
1166
|
}
|
|
1167
|
+
function listenDevtoolsEagerly() {
|
|
1168
|
+
window.addEventListener("message", _ref => {
|
|
1169
|
+
var {
|
|
1170
|
+
data
|
|
1171
|
+
} = _ref;
|
|
1172
|
+
|
|
1173
|
+
if ((data === null || data === void 0 ? void 0 : data.source) !== MESSAGE_SOURCE_PANEL) {
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
var payload = data.payload;
|
|
1178
|
+
|
|
1179
|
+
switch (payload === null || payload === void 0 ? void 0 : payload.type) {
|
|
1180
|
+
case FRAME_ACTIVE_CHANGE:
|
|
1181
|
+
{
|
|
1182
|
+
frameIsActive = payload.active;
|
|
1183
|
+
break;
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
case PANEL_CHANGE:
|
|
1187
|
+
{
|
|
1188
|
+
selectedPanel = payload.panel;
|
|
1189
|
+
break;
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1162
1194
|
function listenDevtools() {
|
|
1163
|
-
window.addEventListener("message",
|
|
1164
|
-
var
|
|
1195
|
+
window.addEventListener("message", _ref2 => {
|
|
1196
|
+
var {
|
|
1197
|
+
data
|
|
1198
|
+
} = _ref2;
|
|
1165
1199
|
|
|
1166
|
-
if ((
|
|
1200
|
+
if ((data === null || data === void 0 ? void 0 : data.source) !== MESSAGE_SOURCE_PANEL) {
|
|
1167
1201
|
return;
|
|
1168
1202
|
}
|
|
1169
1203
|
|
|
1170
|
-
var payload =
|
|
1204
|
+
var payload = data.payload;
|
|
1171
1205
|
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1206
|
+
switch (payload === null || payload === void 0 ? void 0 : payload.type) {
|
|
1207
|
+
case EVALUATION_EDIT:
|
|
1208
|
+
{
|
|
1209
|
+
var {
|
|
1210
|
+
raw,
|
|
1211
|
+
context,
|
|
1212
|
+
id
|
|
1213
|
+
} = payload;
|
|
1214
|
+
evaluate(raw, {
|
|
1215
|
+
data: context.data,
|
|
1216
|
+
event: restoreDehydrated(context.event)
|
|
1217
|
+
}, {
|
|
1218
|
+
isReEvaluation: true,
|
|
1219
|
+
evaluationId: id
|
|
1220
|
+
});
|
|
1221
|
+
break;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
case TRANSFORMATION_EDIT:
|
|
1225
|
+
{
|
|
1226
|
+
var {
|
|
1227
|
+
data: _data,
|
|
1228
|
+
transform,
|
|
1229
|
+
id: _id,
|
|
1230
|
+
options: {
|
|
1231
|
+
from,
|
|
1232
|
+
mapArray,
|
|
1233
|
+
allowInject
|
|
1234
|
+
}
|
|
1235
|
+
} = payload;
|
|
1236
|
+
reTransformForDevtools(_id, _data, transform, from, mapArray, allowInject);
|
|
1237
|
+
break;
|
|
1194
1238
|
}
|
|
1195
|
-
} = payload;
|
|
1196
|
-
reTransformForDevtools(_id, data, transform, from, mapArray, allowInject);
|
|
1197
1239
|
}
|
|
1198
1240
|
});
|
|
1199
1241
|
}
|
|
@@ -1594,10 +1636,14 @@ function getIndividualGlobal(variableName, _ref) {
|
|
|
1594
1636
|
case "location":
|
|
1595
1637
|
return collectCoverage ? {
|
|
1596
1638
|
href: "http://localhost:3000/functions/test",
|
|
1597
|
-
origin: "http://localhost:3000"
|
|
1639
|
+
origin: "http://localhost:3000",
|
|
1640
|
+
host: "localhost:3000",
|
|
1641
|
+
hostname: "localhost"
|
|
1598
1642
|
} : {
|
|
1599
1643
|
href: location.href,
|
|
1600
|
-
origin: location.origin
|
|
1644
|
+
origin: location.origin,
|
|
1645
|
+
host: location.host,
|
|
1646
|
+
hostname: location.hostname
|
|
1601
1647
|
};
|
|
1602
1648
|
}
|
|
1603
1649
|
}
|
|
@@ -2966,30 +3012,30 @@ function _constructMenu() {
|
|
|
2966
3012
|
return _constructMenu.apply(this, arguments);
|
|
2967
3013
|
}
|
|
2968
3014
|
|
|
2969
|
-
function
|
|
2970
|
-
return
|
|
3015
|
+
function preConstructMenus(_x4, _x5, _x6) {
|
|
3016
|
+
return _preConstructMenus.apply(this, arguments);
|
|
2971
3017
|
}
|
|
2972
3018
|
|
|
2973
|
-
function
|
|
2974
|
-
|
|
2975
|
-
var data = yield Promise.all(menus.map(menuId => processMenu(menuId, context, kernel)));
|
|
3019
|
+
function _preConstructMenus() {
|
|
3020
|
+
_preConstructMenus = _asyncToGenerator$4(function* (menus, context, kernel) {
|
|
3021
|
+
var data = yield Promise.all(menus.map(menuId => processMenu(menuId, context, kernel, undefined, true)));
|
|
2976
3022
|
data.forEach((item, index) => processMenuCache.set(menus[index], item));
|
|
2977
3023
|
});
|
|
2978
|
-
return
|
|
3024
|
+
return _preConstructMenus.apply(this, arguments);
|
|
2979
3025
|
}
|
|
2980
3026
|
|
|
2981
3027
|
var getMenu = menuId => processMenuCache.get(menuId);
|
|
2982
|
-
function fetchMenuById(_x7, _x8) {
|
|
3028
|
+
function fetchMenuById(_x7, _x8, _x9) {
|
|
2983
3029
|
return _fetchMenuById.apply(this, arguments);
|
|
2984
3030
|
}
|
|
2985
3031
|
|
|
2986
3032
|
function _fetchMenuById() {
|
|
2987
|
-
_fetchMenuById = _asyncToGenerator$4(function* (menuId, kernel) {
|
|
3033
|
+
_fetchMenuById = _asyncToGenerator$4(function* (menuId, kernel, isPreFetch) {
|
|
2988
3034
|
if (menuCache.has(menuId)) {
|
|
2989
3035
|
return menuCache.get(menuId);
|
|
2990
3036
|
}
|
|
2991
3037
|
|
|
2992
|
-
var menuList = window.STANDALONE_MICRO_APPS ? kernel.getStandaloneMenus(menuId) : (yield InstanceApi_postSearch("EASYOPS_STORYBOARD_MENU", {
|
|
3038
|
+
var menuList = window.STANDALONE_MICRO_APPS ? kernel.getStandaloneMenus(menuId, isPreFetch) : (yield InstanceApi_postSearch("EASYOPS_STORYBOARD_MENU", {
|
|
2993
3039
|
page: 1,
|
|
2994
3040
|
page_size: 200,
|
|
2995
3041
|
fields: {
|
|
@@ -3085,7 +3131,7 @@ function processGroupInject(items, menu, injectWithMenus) {
|
|
|
3085
3131
|
});
|
|
3086
3132
|
}
|
|
3087
3133
|
|
|
3088
|
-
function loadDynamicMenuItems(
|
|
3134
|
+
function loadDynamicMenuItems(_x10) {
|
|
3089
3135
|
return _loadDynamicMenuItems.apply(this, arguments);
|
|
3090
3136
|
}
|
|
3091
3137
|
|
|
@@ -3103,13 +3149,13 @@ function _loadDynamicMenuItems() {
|
|
|
3103
3149
|
return _loadDynamicMenuItems.apply(this, arguments);
|
|
3104
3150
|
}
|
|
3105
3151
|
|
|
3106
|
-
function processMenu(
|
|
3152
|
+
function processMenu(_x11, _x12, _x13, _x14, _x15) {
|
|
3107
3153
|
return _processMenu.apply(this, arguments);
|
|
3108
3154
|
}
|
|
3109
3155
|
|
|
3110
3156
|
function _processMenu() {
|
|
3111
|
-
_processMenu = _asyncToGenerator$4(function* (menuId, context, kernel, hasSubMenu) {
|
|
3112
|
-
var _yield$fetchMenuById = yield fetchMenuById(menuId, kernel),
|
|
3157
|
+
_processMenu = _asyncToGenerator$4(function* (menuId, context, kernel, hasSubMenu, isPreFetch) {
|
|
3158
|
+
var _yield$fetchMenuById = yield fetchMenuById(menuId, kernel, isPreFetch),
|
|
3113
3159
|
{
|
|
3114
3160
|
items,
|
|
3115
3161
|
app
|
|
@@ -3162,19 +3208,19 @@ function computeMenuItemsWithOverrideApp(items, context, kernel) {
|
|
|
3162
3208
|
});
|
|
3163
3209
|
});
|
|
3164
3210
|
|
|
3165
|
-
return function (
|
|
3211
|
+
return function (_x16) {
|
|
3166
3212
|
return _ref2.apply(this, arguments);
|
|
3167
3213
|
};
|
|
3168
3214
|
}()));
|
|
3169
3215
|
}
|
|
3170
3216
|
|
|
3171
|
-
function processMenuTitle(
|
|
3217
|
+
function processMenuTitle(_x17) {
|
|
3172
3218
|
return _processMenuTitle.apply(this, arguments);
|
|
3173
3219
|
}
|
|
3174
3220
|
|
|
3175
3221
|
function _processMenuTitle() {
|
|
3176
3222
|
_processMenuTitle = _asyncToGenerator$4(function* (menuData) {
|
|
3177
|
-
if (menuData.title ||
|
|
3223
|
+
if (menuData.title || isEmpty(menuData.titleDataSource)) {
|
|
3178
3224
|
return menuData.title;
|
|
3179
3225
|
}
|
|
3180
3226
|
|
|
@@ -3263,7 +3309,7 @@ function requireOverrideApp(data) {
|
|
|
3263
3309
|
return false;
|
|
3264
3310
|
}
|
|
3265
3311
|
|
|
3266
|
-
function computeRealValueWithOverrideApp(
|
|
3312
|
+
function computeRealValueWithOverrideApp(_x18, _x19, _x20, _x21) {
|
|
3267
3313
|
return _computeRealValueWithOverrideApp.apply(this, arguments);
|
|
3268
3314
|
}
|
|
3269
3315
|
|
|
@@ -8792,6 +8838,7 @@ class Kernel {
|
|
|
8792
8838
|
return _asyncToGenerator$4(function* () {
|
|
8793
8839
|
var _this2$bootstrapData$, _this2$bootstrapData$2;
|
|
8794
8840
|
|
|
8841
|
+
listenDevtoolsEagerly();
|
|
8795
8842
|
_this2.mountPoints = mountPoints;
|
|
8796
8843
|
yield Promise.all([_this2.loadCheckLogin(), _this2.loadMicroApps()]);
|
|
8797
8844
|
|
|
@@ -9475,10 +9522,11 @@ class Kernel {
|
|
|
9475
9522
|
return Object.assign({}, (_this$bootstrapData = this.bootstrapData) === null || _this$bootstrapData === void 0 ? void 0 : (_this$bootstrapData$s = _this$bootstrapData.settings) === null || _this$bootstrapData$s === void 0 ? void 0 : _this$bootstrapData$s.featureFlags);
|
|
9476
9523
|
}
|
|
9477
9524
|
|
|
9478
|
-
getStandaloneMenus(menuId) {
|
|
9525
|
+
getStandaloneMenus(menuId, isPreFetch) {
|
|
9479
9526
|
var _currentStoryboard$me, _currentStoryboard$me2;
|
|
9480
9527
|
|
|
9481
|
-
var
|
|
9528
|
+
var app = isPreFetch ? this.nextApp : this.currentApp;
|
|
9529
|
+
var currentAppId = app.id;
|
|
9482
9530
|
var currentStoryboard = this.bootstrapData.storyboards.find(storyboard => storyboard.app.id === currentAppId);
|
|
9483
9531
|
var menus = (_currentStoryboard$me = currentStoryboard.meta) !== null && _currentStoryboard$me !== void 0 && _currentStoryboard$me.injectMenus ? cloneDeep(currentStoryboard.meta.injectMenus) : (_currentStoryboard$me2 = currentStoryboard.meta) !== null && _currentStoryboard$me2 !== void 0 && _currentStoryboard$me2.menus ? cloneDeep(currentStoryboard.meta.menus) : [];
|
|
9484
9532
|
return menus.filter(menu => menu.menuId === menuId).map(menu => {
|
|
@@ -10909,7 +10957,7 @@ class LocationContext {
|
|
|
10909
10957
|
var useMenus = scanAppGetMenuInAny(data);
|
|
10910
10958
|
|
|
10911
10959
|
if (useMenus.length) {
|
|
10912
|
-
yield
|
|
10960
|
+
yield preConstructMenus(useMenus, _this7.getCurrentContext(), _this7.kernel);
|
|
10913
10961
|
}
|
|
10914
10962
|
})();
|
|
10915
10963
|
}
|