@next-core/brick-kit 2.178.2 → 2.178.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 +72 -5
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +73 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/Kernel.d.ts +4 -1
- package/dist/types/core/Kernel.d.ts.map +1 -1
- package/dist/types/core/Router.d.ts.map +1 -1
- package/dist/types/core/Runtime.d.ts +2 -1
- package/dist/types/core/Runtime.d.ts.map +1 -1
- package/dist/types/core/interfaces.d.ts +8 -1
- package/dist/types/core/interfaces.d.ts.map +1 -1
- package/dist/types/developHelper.d.ts +2 -1
- package/dist/types/developHelper.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 _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, isEmpty, merge, sortBy, orderBy, isObject as isObject$1, uniq, pick, omit, findLastIndex, noop, isString as isString$1 } from 'lodash';
|
|
7
|
-
import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, isTrackAll, trackAll, trackContext, trackState, trackFormState, transformAndInject, transform, scanPermissionActionsInStoryboard, precookFunction, cook, collectContextUsage, deferResolveContextConcurrently, resolveContextConcurrently, syncResolveContextConcurrently, trackUsedFormState, trackUsedState, trackUsedContext, shouldAllowRecursiveEvaluations, preevaluate, inject, scanPermissionActionsInAny, deepFreeze, scanProcessorsInAny, matchPath, asyncProcessBrick, createProviderClass, removeDeadConditionsInTpl, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, snippetEvaluate, prefetchScript, scanBricksInBrickConf, loadScript as loadScript$1, scanAppGetMenuInAny, scanInstalledAppsInStoryboard, removeDeadConditions, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
|
|
7
|
+
import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, isTrackAll, trackAll, trackContext, trackState, trackFormState, transformAndInject, transform, scanPermissionActionsInStoryboard, precookFunction, cook, collectContextUsage, deferResolveContextConcurrently, resolveContextConcurrently, syncResolveContextConcurrently, trackUsedFormState, trackUsedState, trackUsedContext, shouldAllowRecursiveEvaluations, preevaluate, inject, scanPermissionActionsInAny, deepFreeze, scanProcessorsInAny, matchPath, asyncProcessBrick, createProviderClass, removeDeadConditionsInTpl, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, snippetEvaluate, scanCustomApisInStoryboard, prefetchScript, scanBricksInBrickConf, loadScript as loadScript$1, scanAppGetMenuInAny, scanInstalledAppsInStoryboard, removeDeadConditions, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
|
|
8
8
|
import React, { useState, useEffect, useMemo, useContext, createContext, useRef, useReducer, useCallback } from 'react';
|
|
9
9
|
import { http, HttpResponseError, HttpAbortError, HttpFetchError } from '@next-core/brick-http';
|
|
10
10
|
import { Modal, message, Empty, ConfigProvider } from 'antd';
|
|
@@ -3528,6 +3528,11 @@ function _dev_only_updateStoryboardBySnippet(appId, newSnippet, settings) {
|
|
|
3528
3528
|
kernel._dev_only_updateStoryboardBySnippet(appId, newSnippet, settings);
|
|
3529
3529
|
}
|
|
3530
3530
|
|
|
3531
|
+
/* istanbul ignore next */
|
|
3532
|
+
function _dev_only_getAddedContracts(storyboardPatch, options) {
|
|
3533
|
+
return kernel._dev_only_getAddedContracts(storyboardPatch, options);
|
|
3534
|
+
}
|
|
3535
|
+
|
|
3531
3536
|
/* istanbul ignore next */
|
|
3532
3537
|
function _dev_only_getContextValue(name, _ref) {
|
|
3533
3538
|
var {
|
|
@@ -9264,12 +9269,15 @@ class Kernel {
|
|
|
9264
9269
|
routes.splice(previewRouteIndex, 1, newPreviewRoute);
|
|
9265
9270
|
}
|
|
9266
9271
|
}
|
|
9272
|
+
_dev_only_getSnippetPreviewPath(snippetId) {
|
|
9273
|
+
return "${APP.homepage}/_dev_only_/snippet-preview/".concat(snippetId);
|
|
9274
|
+
}
|
|
9267
9275
|
_dev_only_updateSnippetPreviewSettings(appId, snippetData, settings) {
|
|
9268
9276
|
var {
|
|
9269
9277
|
routes,
|
|
9270
9278
|
app
|
|
9271
9279
|
} = this.bootstrapData.storyboards.find(item => item.app.id === appId);
|
|
9272
|
-
var previewPath =
|
|
9280
|
+
var previewPath = this._dev_only_getSnippetPreviewPath(snippetData.snippetId);
|
|
9273
9281
|
var previewRouteIndex = routes.findIndex(route => route.path === previewPath);
|
|
9274
9282
|
try {
|
|
9275
9283
|
var _parsedSnippetData$br;
|
|
@@ -9338,11 +9346,14 @@ class Kernel {
|
|
|
9338
9346
|
_dev_only_updateStoryboardBySnippet(appId, newSnippet, settings) {
|
|
9339
9347
|
this._dev_only_updateSnippetPreviewSettings(appId, newSnippet, settings);
|
|
9340
9348
|
}
|
|
9349
|
+
_dev_only_getFormPreviewPath(formId) {
|
|
9350
|
+
return "${APP.homepage}/_dev_only_/form-preview/".concat(formId);
|
|
9351
|
+
}
|
|
9341
9352
|
_dev_only_updateFormPreviewSettings(appId, formId, formData) {
|
|
9342
9353
|
var {
|
|
9343
9354
|
routes
|
|
9344
9355
|
} = this.bootstrapData.storyboards.find(item => item.app.id === appId);
|
|
9345
|
-
var previewPath =
|
|
9356
|
+
var previewPath = this._dev_only_getFormPreviewPath(formId);
|
|
9346
9357
|
var previewRouteIndex = routes.findIndex(route => route.path === previewPath);
|
|
9347
9358
|
var newPreviewRoute = {
|
|
9348
9359
|
path: previewPath,
|
|
@@ -9362,6 +9373,56 @@ class Kernel {
|
|
|
9362
9373
|
routes.splice(previewRouteIndex, 1, newPreviewRoute);
|
|
9363
9374
|
}
|
|
9364
9375
|
}
|
|
9376
|
+
_dev_only_getAddedContracts(storyboardPatch, _ref6) {
|
|
9377
|
+
var {
|
|
9378
|
+
appId,
|
|
9379
|
+
updateStoryboardType,
|
|
9380
|
+
formId
|
|
9381
|
+
} = _ref6;
|
|
9382
|
+
var storyboard = this.bootstrapData.storyboards.find(item => item.app.id === appId);
|
|
9383
|
+
var updatedStoryboard;
|
|
9384
|
+
|
|
9385
|
+
// 拿到更新部分的 storyboard 配置,然后扫描一遍,找到新增的 contracts
|
|
9386
|
+
if (updateStoryboardType === "route") {
|
|
9387
|
+
updatedStoryboard = {
|
|
9388
|
+
routes: [storyboardPatch]
|
|
9389
|
+
};
|
|
9390
|
+
} else if (updateStoryboardType === "template") {
|
|
9391
|
+
updatedStoryboard = {
|
|
9392
|
+
meta: {
|
|
9393
|
+
customTemplates: [storyboardPatch]
|
|
9394
|
+
}
|
|
9395
|
+
};
|
|
9396
|
+
} else if (updateStoryboardType === "snippet") {
|
|
9397
|
+
var _storyboard$routes;
|
|
9398
|
+
// snippet 和 form 是放在挂载 route 里预览,通过 previewPath 拿到当前修改 route
|
|
9399
|
+
var snippetPreviewPath = this._dev_only_getSnippetPreviewPath(storyboardPatch.snippetId);
|
|
9400
|
+
var currentRoute = (_storyboard$routes = storyboard.routes) === null || _storyboard$routes === void 0 ? void 0 : _storyboard$routes.find(route => route.path === snippetPreviewPath);
|
|
9401
|
+
updatedStoryboard = {
|
|
9402
|
+
routes: [currentRoute]
|
|
9403
|
+
};
|
|
9404
|
+
} else if (updateStoryboardType === "form") {
|
|
9405
|
+
var _storyboard$routes2;
|
|
9406
|
+
var formPreviewPath = this._dev_only_getFormPreviewPath(formId);
|
|
9407
|
+
var _currentRoute = (_storyboard$routes2 = storyboard.routes) === null || _storyboard$routes2 === void 0 ? void 0 : _storyboard$routes2.find(route => route.path === formPreviewPath);
|
|
9408
|
+
updatedStoryboard = {
|
|
9409
|
+
routes: [_currentRoute]
|
|
9410
|
+
};
|
|
9411
|
+
}
|
|
9412
|
+
var addedContracts = [];
|
|
9413
|
+
if (updatedStoryboard) {
|
|
9414
|
+
var _scanCustomApisInStor;
|
|
9415
|
+
var contractApis = (_scanCustomApisInStor = scanCustomApisInStoryboard(updatedStoryboard)) === null || _scanCustomApisInStor === void 0 ? void 0 : _scanCustomApisInStor.filter(api => api.includes(":"));
|
|
9416
|
+
contractApis.forEach(api => {
|
|
9417
|
+
var _storyboard$meta$cont;
|
|
9418
|
+
var [_, namespaceId, name] = api.match(/(.*)@(.*):\d\.\d\.\d/);
|
|
9419
|
+
if (!((_storyboard$meta$cont = storyboard.meta.contracts) !== null && _storyboard$meta$cont !== void 0 && _storyboard$meta$cont.some(contract => contract.namespaceId === namespaceId && contract.name === name))) {
|
|
9420
|
+
addedContracts.push(api);
|
|
9421
|
+
}
|
|
9422
|
+
});
|
|
9423
|
+
}
|
|
9424
|
+
return addedContracts;
|
|
9425
|
+
}
|
|
9365
9426
|
loadDepsOfStoryboard(storyboard) {
|
|
9366
9427
|
return this.gracefullyLoadDeps(this._loadDepsOfStoryboard, storyboard);
|
|
9367
9428
|
}
|
|
@@ -9616,8 +9677,8 @@ class Kernel {
|
|
|
9616
9677
|
});
|
|
9617
9678
|
});
|
|
9618
9679
|
if (!filterMenus.length) {
|
|
9619
|
-
var
|
|
9620
|
-
filterMenus = (
|
|
9680
|
+
var _ref7, _yield$InstanceApi_po;
|
|
9681
|
+
filterMenus = (_ref7 = _this12.getFeatureFlags()["three-level-menu-layout"] ? (yield InstalledMicroAppApi_getMenusInfo(menuId, {
|
|
9621
9682
|
menuObjectId: "STANDALONE_MENU@EASYOPS"
|
|
9622
9683
|
})).menus : (_yield$InstanceApi_po = yield InstanceApi_postSearch("STANDALONE_MENU@EASYOPS", {
|
|
9623
9684
|
page: 1,
|
|
@@ -9648,7 +9709,7 @@ class Kernel {
|
|
|
9648
9709
|
$eq: true
|
|
9649
9710
|
}
|
|
9650
9711
|
}
|
|
9651
|
-
})) === null || _yield$InstanceApi_po === void 0 ? void 0 : _yield$InstanceApi_po.list) !== null &&
|
|
9712
|
+
})) === null || _yield$InstanceApi_po === void 0 ? void 0 : _yield$InstanceApi_po.list) !== null && _ref7 !== void 0 ? _ref7 : [];
|
|
9652
9713
|
}
|
|
9653
9714
|
return filterMenus;
|
|
9654
9715
|
})();
|
|
@@ -11952,6 +12013,11 @@ class Router {
|
|
|
11952
12013
|
} else if (isHttpAbortError(error)) {
|
|
11953
12014
|
return;
|
|
11954
12015
|
} else {
|
|
12016
|
+
var noAuthGuardLoginPath = getRuntime().getMiscSettings().noAuthGuardLoginPath;
|
|
12017
|
+
if (isUnauthenticatedError(error) && noAuthGuardLoginPath) {
|
|
12018
|
+
history.replace(noAuthGuardLoginPath);
|
|
12019
|
+
return;
|
|
12020
|
+
}
|
|
11955
12021
|
yield _this3.kernel.layoutBootstrap(layoutType);
|
|
11956
12022
|
var brickPageError = _this3.kernel.presetBricks.pageError;
|
|
11957
12023
|
yield _this3.kernel.loadDynamicBricks([brickPageError]);
|
|
@@ -14227,6 +14293,7 @@ var developHelper = {
|
|
|
14227
14293
|
updateTemplatePreviewSettings: _dev_only_updateTemplatePreviewSettings,
|
|
14228
14294
|
updateSnippetPreviewSettings: _dev_only_updateSnippetPreviewSettings,
|
|
14229
14295
|
updateFormPreviewSettings: _dev_only_updateFormPreviewSettings,
|
|
14296
|
+
getAddedContracts: _dev_only_getAddedContracts,
|
|
14230
14297
|
getContextValue: _dev_only_getContextValue,
|
|
14231
14298
|
getAllContextValues: _dev_only_getAllContextValues,
|
|
14232
14299
|
render: _dev_only_render
|