@next-core/brick-kit 2.178.3 → 2.178.5
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 +74 -273
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +72 -270
- 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/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 +5 -4
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
|
|
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, 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';
|
|
@@ -14,6 +14,7 @@ import moment from 'moment';
|
|
|
14
14
|
import { pipes } from '@next-core/pipes';
|
|
15
15
|
import { userAnalytics, apiAnalyzer } from '@next-core/easyops-analytics';
|
|
16
16
|
import yaml from 'js-yaml';
|
|
17
|
+
import { loadBricksImperatively, loadProcessorsImperatively } from '@next-core/loader';
|
|
17
18
|
import { withTranslation } from 'react-i18next';
|
|
18
19
|
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
19
20
|
import { getIllustration } from '@next-core/illustrations';
|
|
@@ -3528,6 +3529,11 @@ function _dev_only_updateStoryboardBySnippet(appId, newSnippet, settings) {
|
|
|
3528
3529
|
kernel._dev_only_updateStoryboardBySnippet(appId, newSnippet, settings);
|
|
3529
3530
|
}
|
|
3530
3531
|
|
|
3532
|
+
/* istanbul ignore next */
|
|
3533
|
+
function _dev_only_getAddedContracts(storyboardPatch, options) {
|
|
3534
|
+
return kernel._dev_only_getAddedContracts(storyboardPatch, options);
|
|
3535
|
+
}
|
|
3536
|
+
|
|
3531
3537
|
/* istanbul ignore next */
|
|
3532
3538
|
function _dev_only_getContextValue(name, _ref) {
|
|
3533
3539
|
var {
|
|
@@ -6879,267 +6885,6 @@ var UserAdminApi_searchAllUsersInfo = /*#__PURE__*/function () {
|
|
|
6879
6885
|
};
|
|
6880
6886
|
}();
|
|
6881
6887
|
|
|
6882
|
-
var cache$1 = new Map();
|
|
6883
|
-
function loadScript(src, prefix) {
|
|
6884
|
-
if (Array.isArray(src)) {
|
|
6885
|
-
return Promise.all(src.map(item => loadScript(item, prefix)));
|
|
6886
|
-
}
|
|
6887
|
-
var fixedSrc = prefix ? "".concat(prefix).concat(src) : src;
|
|
6888
|
-
var cachedPromise = cache$1.get(fixedSrc);
|
|
6889
|
-
if (cachedPromise) {
|
|
6890
|
-
return cachedPromise;
|
|
6891
|
-
}
|
|
6892
|
-
var promise = new Promise((resolve, reject) => {
|
|
6893
|
-
var end = () => {
|
|
6894
|
-
window.dispatchEvent(new Event("request.end"));
|
|
6895
|
-
};
|
|
6896
|
-
var script = document.createElement("script");
|
|
6897
|
-
script.src = fixedSrc;
|
|
6898
|
-
script.type = "text/javascript";
|
|
6899
|
-
script.async = true;
|
|
6900
|
-
script.onload = () => {
|
|
6901
|
-
resolve(fixedSrc);
|
|
6902
|
-
end();
|
|
6903
|
-
};
|
|
6904
|
-
script.onerror = e => {
|
|
6905
|
-
reject(e);
|
|
6906
|
-
end();
|
|
6907
|
-
};
|
|
6908
|
-
var firstScript = document.currentScript || document.getElementsByTagName("script")[0];
|
|
6909
|
-
firstScript.parentNode.insertBefore(script, firstScript);
|
|
6910
|
-
window.dispatchEvent(new Event("request.start"));
|
|
6911
|
-
});
|
|
6912
|
-
cache$1.set(fixedSrc, promise);
|
|
6913
|
-
return promise;
|
|
6914
|
-
}
|
|
6915
|
-
|
|
6916
|
-
// https://github.com/module-federation/module-federation-examples/blob/eda9493f3991a423479fd834cfb1d7b241d9d1f0/advanced-api/dynamic-remotes/app1/src/App.js
|
|
6917
|
-
function loadSharedModule(_x, _x2) {
|
|
6918
|
-
return _loadSharedModule.apply(this, arguments);
|
|
6919
|
-
}
|
|
6920
|
-
function _loadSharedModule() {
|
|
6921
|
-
_loadSharedModule = _asyncToGenerator$3(function* (scope, module) {
|
|
6922
|
-
// Initializes the share scope. This fills it with known provided modules from this build and all remotes
|
|
6923
|
-
yield __webpack_init_sharing__("default");
|
|
6924
|
-
var container = window[scope]; // or get the container somewhere else
|
|
6925
|
-
// Initialize the container, it may provide shared modules
|
|
6926
|
-
yield container.init(__webpack_share_scopes__.default);
|
|
6927
|
-
var factory = yield container.get(module);
|
|
6928
|
-
return factory();
|
|
6929
|
-
});
|
|
6930
|
-
return _loadSharedModule.apply(this, arguments);
|
|
6931
|
-
}
|
|
6932
|
-
|
|
6933
|
-
var resolveBasicPkg;
|
|
6934
|
-
var basicPkgWillBeResolved = false;
|
|
6935
|
-
var waitBasicPkg = new Promise(resolve => {
|
|
6936
|
-
resolveBasicPkg = resolve;
|
|
6937
|
-
});
|
|
6938
|
-
function flushStableLoadBricks() {
|
|
6939
|
-
if (!basicPkgWillBeResolved) {
|
|
6940
|
-
resolveBasicPkg();
|
|
6941
|
-
}
|
|
6942
|
-
}
|
|
6943
|
-
function loadBricksImperatively(_x, _x2) {
|
|
6944
|
-
return _loadBricksImperatively.apply(this, arguments);
|
|
6945
|
-
}
|
|
6946
|
-
function _loadBricksImperatively() {
|
|
6947
|
-
_loadBricksImperatively = _asyncToGenerator$3(function* (bricks, brickPackages) {
|
|
6948
|
-
var promise = enqueueStableLoad("bricks", bricks, brickPackages);
|
|
6949
|
-
flushStableLoadBricks();
|
|
6950
|
-
return dispatchRequestStatus(promise);
|
|
6951
|
-
});
|
|
6952
|
-
return _loadBricksImperatively.apply(this, arguments);
|
|
6953
|
-
}
|
|
6954
|
-
function loadProcessorsImperatively(processors, brickPackages) {
|
|
6955
|
-
var promise = enqueueStableLoad("processors", processors, brickPackages);
|
|
6956
|
-
flushStableLoadBricks();
|
|
6957
|
-
return dispatchRequestStatus(promise);
|
|
6958
|
-
}
|
|
6959
|
-
var v2AdapterPromise;
|
|
6960
|
-
var V2_ADAPTER_LOAD_BRICKS = "v2-adapter.load-bricks";
|
|
6961
|
-
|
|
6962
|
-
// Get brick/processor items including their dependencies
|
|
6963
|
-
function getItemsByPkg(type, list, brickPackagesMap) {
|
|
6964
|
-
var itemsByPkg = new Map();
|
|
6965
|
-
var listToLoad = new Set();
|
|
6966
|
-
var add = item => {
|
|
6967
|
-
var _pkg$dependencies;
|
|
6968
|
-
if (listToLoad.has(item)) {
|
|
6969
|
-
return;
|
|
6970
|
-
}
|
|
6971
|
-
listToLoad.add(item);
|
|
6972
|
-
var pkg;
|
|
6973
|
-
var namespace;
|
|
6974
|
-
var itemName;
|
|
6975
|
-
if (type === "processors" || item.includes(".")) {
|
|
6976
|
-
[namespace, itemName] = item.split(".");
|
|
6977
|
-
var pkgId = "bricks/".concat(type === "processors" ? getProcessorPackageName(namespace) : namespace);
|
|
6978
|
-
pkg = brickPackagesMap.get(pkgId);
|
|
6979
|
-
} else {
|
|
6980
|
-
itemName = item;
|
|
6981
|
-
for (var p of brickPackagesMap.values()) {
|
|
6982
|
-
var _p$elements;
|
|
6983
|
-
if ((_p$elements = p.elements) !== null && _p$elements !== void 0 && _p$elements.some(e => e === itemName)) {
|
|
6984
|
-
pkg = p;
|
|
6985
|
-
break;
|
|
6986
|
-
}
|
|
6987
|
-
}
|
|
6988
|
-
}
|
|
6989
|
-
if (!pkg) {
|
|
6990
|
-
throw new Error("Package for ".concat(item, " not found."));
|
|
6991
|
-
}
|
|
6992
|
-
var groupItems = itemsByPkg.get(pkg);
|
|
6993
|
-
if (!groupItems) {
|
|
6994
|
-
groupItems = [];
|
|
6995
|
-
itemsByPkg.set(pkg, groupItems);
|
|
6996
|
-
}
|
|
6997
|
-
groupItems.push(itemName);
|
|
6998
|
-
|
|
6999
|
-
// Load their dependencies too
|
|
7000
|
-
var deps = (_pkg$dependencies = pkg.dependencies) === null || _pkg$dependencies === void 0 ? void 0 : _pkg$dependencies[item];
|
|
7001
|
-
if (deps) {
|
|
7002
|
-
for (var dep of deps) {
|
|
7003
|
-
add(dep);
|
|
7004
|
-
}
|
|
7005
|
-
}
|
|
7006
|
-
};
|
|
7007
|
-
for (var item of list) {
|
|
7008
|
-
add(item);
|
|
7009
|
-
}
|
|
7010
|
-
return itemsByPkg;
|
|
7011
|
-
}
|
|
7012
|
-
function loadBrickModule(_x3, _x4, _x5) {
|
|
7013
|
-
return _loadBrickModule.apply(this, arguments);
|
|
7014
|
-
}
|
|
7015
|
-
function _loadBrickModule() {
|
|
7016
|
-
_loadBrickModule = _asyncToGenerator$3(function* (type, pkgId, itemName) {
|
|
7017
|
-
var moduleName = "".concat(type === "processors" ? "./processors/" : "./").concat(itemName);
|
|
7018
|
-
try {
|
|
7019
|
-
yield loadSharedModule(pkgId, moduleName);
|
|
7020
|
-
} catch (error) {
|
|
7021
|
-
// eslint-disable-next-line no-console
|
|
7022
|
-
console.error(error);
|
|
7023
|
-
throw new Error("Load ".concat(type, " of \"").concat(pkgId.split("/").pop(), ".").concat(moduleName.split("/").pop(), "\" failed"));
|
|
7024
|
-
}
|
|
7025
|
-
});
|
|
7026
|
-
return _loadBrickModule.apply(this, arguments);
|
|
7027
|
-
}
|
|
7028
|
-
function loadRestBricks(type, pkgs, itemsMap) {
|
|
7029
|
-
return pkgs.map( /*#__PURE__*/function () {
|
|
7030
|
-
var _ref = _asyncToGenerator$3(function* (pkg) {
|
|
7031
|
-
var _window$PUBLIC_ROOT;
|
|
7032
|
-
yield loadScript(pkg.filePath, (_window$PUBLIC_ROOT = window.PUBLIC_ROOT) !== null && _window$PUBLIC_ROOT !== void 0 ? _window$PUBLIC_ROOT : "");
|
|
7033
|
-
yield waitBasicPkg;
|
|
7034
|
-
return Promise.all(
|
|
7035
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
7036
|
-
itemsMap.get(pkg).map(itemName => loadBrickModule(type, pkg.id, itemName)));
|
|
7037
|
-
});
|
|
7038
|
-
return function (_x6) {
|
|
7039
|
-
return _ref.apply(this, arguments);
|
|
7040
|
-
};
|
|
7041
|
-
}());
|
|
7042
|
-
}
|
|
7043
|
-
function enqueueStableLoad(_x7, _x8, _x9) {
|
|
7044
|
-
return _enqueueStableLoad.apply(this, arguments);
|
|
7045
|
-
}
|
|
7046
|
-
function _enqueueStableLoad() {
|
|
7047
|
-
_enqueueStableLoad = _asyncToGenerator$3(function* (type, list, brickPackages) {
|
|
7048
|
-
var brickPackagesMap = new Map();
|
|
7049
|
-
for (var pkg of brickPackages) {
|
|
7050
|
-
var _pkg$id;
|
|
7051
|
-
var pkgId = (_pkg$id = pkg.id) !== null && _pkg$id !== void 0 ? _pkg$id : getPkgIdByFilePath(pkg.filePath);
|
|
7052
|
-
brickPackagesMap.set(pkgId, pkg);
|
|
7053
|
-
}
|
|
7054
|
-
var itemsByPkg = getItemsByPkg(type, list, brickPackagesMap);
|
|
7055
|
-
var foundBasicPkg;
|
|
7056
|
-
var v2Packages = [];
|
|
7057
|
-
var v3PackagesOtherThanBasic = [];
|
|
7058
|
-
var maybeV2Adapter;
|
|
7059
|
-
for (var _pkg of itemsByPkg.keys()) {
|
|
7060
|
-
if (_pkg.id) {
|
|
7061
|
-
if (_pkg.id === "bricks/basic") {
|
|
7062
|
-
foundBasicPkg = _pkg;
|
|
7063
|
-
} else {
|
|
7064
|
-
v3PackagesOtherThanBasic.push(_pkg);
|
|
7065
|
-
}
|
|
7066
|
-
} else {
|
|
7067
|
-
// Brick packages of v2 has no `id`
|
|
7068
|
-
v2Packages.push(_pkg);
|
|
7069
|
-
maybeV2Adapter = brickPackagesMap.get("bricks/v2-adapter");
|
|
7070
|
-
if (!maybeV2Adapter) {
|
|
7071
|
-
// eslint-disable-next-line no-console
|
|
7072
|
-
console.error("Using v2 bricks, but v2-adapter not found");
|
|
7073
|
-
}
|
|
7074
|
-
}
|
|
7075
|
-
}
|
|
7076
|
-
var v2Adapter = maybeV2Adapter;
|
|
7077
|
-
var basicPkgPromise;
|
|
7078
|
-
var basicPkg = foundBasicPkg;
|
|
7079
|
-
if (basicPkg) {
|
|
7080
|
-
var _window$PUBLIC_ROOT2;
|
|
7081
|
-
var tempPromise = loadScript(basicPkg.filePath, (_window$PUBLIC_ROOT2 = window.PUBLIC_ROOT) !== null && _window$PUBLIC_ROOT2 !== void 0 ? _window$PUBLIC_ROOT2 : "");
|
|
7082
|
-
// Packages other than BASIC will wait for an extra micro-task tick.
|
|
7083
|
-
if (!basicPkgWillBeResolved) {
|
|
7084
|
-
basicPkgWillBeResolved = true;
|
|
7085
|
-
tempPromise.then(() => Promise.resolve()).then(resolveBasicPkg);
|
|
7086
|
-
}
|
|
7087
|
-
basicPkgPromise = tempPromise.then(() => Promise.all(
|
|
7088
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
7089
|
-
itemsByPkg.get(basicPkg).map(itemName => loadBrickModule(type, basicPkg.id, itemName))));
|
|
7090
|
-
}
|
|
7091
|
-
var pkgPromises = [basicPkgPromise].concat(loadRestBricks(type, v3PackagesOtherThanBasic, itemsByPkg));
|
|
7092
|
-
if (v2Adapter && v2Packages.length > 0) {
|
|
7093
|
-
if (!v2AdapterPromise) {
|
|
7094
|
-
// Load `v2-adapter.load-bricks` and its dependencies
|
|
7095
|
-
var v2AdapterItemsByPkg = getItemsByPkg("bricks", [V2_ADAPTER_LOAD_BRICKS], brickPackagesMap);
|
|
7096
|
-
var v2AdapterPackages = [...v2AdapterItemsByPkg.keys()];
|
|
7097
|
-
var loadV2Adapter = /*#__PURE__*/function () {
|
|
7098
|
-
var _ref2 = _asyncToGenerator$3(function* () {
|
|
7099
|
-
yield Promise.all(loadRestBricks("bricks", v2AdapterPackages, v2AdapterItemsByPkg));
|
|
7100
|
-
return document.createElement(V2_ADAPTER_LOAD_BRICKS);
|
|
7101
|
-
});
|
|
7102
|
-
return function loadV2Adapter() {
|
|
7103
|
-
return _ref2.apply(this, arguments);
|
|
7104
|
-
};
|
|
7105
|
-
}();
|
|
7106
|
-
v2AdapterPromise = loadV2Adapter();
|
|
7107
|
-
}
|
|
7108
|
-
pkgPromises.push(v2AdapterPromise.then(adapter => Promise.all(v2Packages.map(pkg => {
|
|
7109
|
-
var pkgId = getPkgIdByFilePath(pkg.filePath);
|
|
7110
|
-
var pkgNamespace = pkgId.split("/")[1];
|
|
7111
|
-
return adapter.resolve(v2Adapter.filePath, pkg.filePath, type === "bricks" ?
|
|
7112
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
7113
|
-
itemsByPkg.get(pkg).map(itemName => "".concat(pkgNamespace, ".").concat(itemName)) : [], pkg.dll,
|
|
7114
|
-
// Todo: remove `brickPackages` as an argument
|
|
7115
|
-
brickPackages);
|
|
7116
|
-
}))));
|
|
7117
|
-
}
|
|
7118
|
-
yield Promise.all(pkgPromises);
|
|
7119
|
-
});
|
|
7120
|
-
return _enqueueStableLoad.apply(this, arguments);
|
|
7121
|
-
}
|
|
7122
|
-
function dispatchRequestStatus(_x10) {
|
|
7123
|
-
return _dispatchRequestStatus.apply(this, arguments);
|
|
7124
|
-
}
|
|
7125
|
-
function _dispatchRequestStatus() {
|
|
7126
|
-
_dispatchRequestStatus = _asyncToGenerator$3(function* (promise) {
|
|
7127
|
-
window.dispatchEvent(new Event("request.start"));
|
|
7128
|
-
try {
|
|
7129
|
-
yield promise;
|
|
7130
|
-
} finally {
|
|
7131
|
-
window.dispatchEvent(new Event("request.end"));
|
|
7132
|
-
}
|
|
7133
|
-
});
|
|
7134
|
-
return _dispatchRequestStatus.apply(this, arguments);
|
|
7135
|
-
}
|
|
7136
|
-
function getProcessorPackageName(camelPackageName) {
|
|
7137
|
-
return camelPackageName.replace(/[A-Z]/g, match => "-".concat(match[0].toLocaleLowerCase())).replace(/_[0-9]/g, match => "-".concat(match[1]));
|
|
7138
|
-
}
|
|
7139
|
-
function getPkgIdByFilePath(filePath) {
|
|
7140
|
-
return filePath.split("/").slice(0, 2).join("/");
|
|
7141
|
-
}
|
|
7142
|
-
|
|
7143
6888
|
/**
|
|
7144
6889
|
* Merge `app.defaultConfig` and `app.userConfig` to `app.config`.
|
|
7145
6890
|
*
|
|
@@ -9264,12 +9009,15 @@ class Kernel {
|
|
|
9264
9009
|
routes.splice(previewRouteIndex, 1, newPreviewRoute);
|
|
9265
9010
|
}
|
|
9266
9011
|
}
|
|
9012
|
+
_dev_only_getSnippetPreviewPath(snippetId) {
|
|
9013
|
+
return "${APP.homepage}/_dev_only_/snippet-preview/".concat(snippetId);
|
|
9014
|
+
}
|
|
9267
9015
|
_dev_only_updateSnippetPreviewSettings(appId, snippetData, settings) {
|
|
9268
9016
|
var {
|
|
9269
9017
|
routes,
|
|
9270
9018
|
app
|
|
9271
9019
|
} = this.bootstrapData.storyboards.find(item => item.app.id === appId);
|
|
9272
|
-
var previewPath =
|
|
9020
|
+
var previewPath = this._dev_only_getSnippetPreviewPath(snippetData.snippetId);
|
|
9273
9021
|
var previewRouteIndex = routes.findIndex(route => route.path === previewPath);
|
|
9274
9022
|
try {
|
|
9275
9023
|
var _parsedSnippetData$br;
|
|
@@ -9338,11 +9086,14 @@ class Kernel {
|
|
|
9338
9086
|
_dev_only_updateStoryboardBySnippet(appId, newSnippet, settings) {
|
|
9339
9087
|
this._dev_only_updateSnippetPreviewSettings(appId, newSnippet, settings);
|
|
9340
9088
|
}
|
|
9089
|
+
_dev_only_getFormPreviewPath(formId) {
|
|
9090
|
+
return "${APP.homepage}/_dev_only_/form-preview/".concat(formId);
|
|
9091
|
+
}
|
|
9341
9092
|
_dev_only_updateFormPreviewSettings(appId, formId, formData) {
|
|
9342
9093
|
var {
|
|
9343
9094
|
routes
|
|
9344
9095
|
} = this.bootstrapData.storyboards.find(item => item.app.id === appId);
|
|
9345
|
-
var previewPath =
|
|
9096
|
+
var previewPath = this._dev_only_getFormPreviewPath(formId);
|
|
9346
9097
|
var previewRouteIndex = routes.findIndex(route => route.path === previewPath);
|
|
9347
9098
|
var newPreviewRoute = {
|
|
9348
9099
|
path: previewPath,
|
|
@@ -9362,6 +9113,56 @@ class Kernel {
|
|
|
9362
9113
|
routes.splice(previewRouteIndex, 1, newPreviewRoute);
|
|
9363
9114
|
}
|
|
9364
9115
|
}
|
|
9116
|
+
_dev_only_getAddedContracts(storyboardPatch, _ref6) {
|
|
9117
|
+
var {
|
|
9118
|
+
appId,
|
|
9119
|
+
updateStoryboardType,
|
|
9120
|
+
formId
|
|
9121
|
+
} = _ref6;
|
|
9122
|
+
var storyboard = this.bootstrapData.storyboards.find(item => item.app.id === appId);
|
|
9123
|
+
var updatedStoryboard;
|
|
9124
|
+
|
|
9125
|
+
// 拿到更新部分的 storyboard 配置,然后扫描一遍,找到新增的 contracts
|
|
9126
|
+
if (updateStoryboardType === "route") {
|
|
9127
|
+
updatedStoryboard = {
|
|
9128
|
+
routes: [storyboardPatch]
|
|
9129
|
+
};
|
|
9130
|
+
} else if (updateStoryboardType === "template") {
|
|
9131
|
+
updatedStoryboard = {
|
|
9132
|
+
meta: {
|
|
9133
|
+
customTemplates: [storyboardPatch]
|
|
9134
|
+
}
|
|
9135
|
+
};
|
|
9136
|
+
} else if (updateStoryboardType === "snippet") {
|
|
9137
|
+
var _storyboard$routes;
|
|
9138
|
+
// snippet 和 form 是放在挂载 route 里预览,通过 previewPath 拿到当前修改 route
|
|
9139
|
+
var snippetPreviewPath = this._dev_only_getSnippetPreviewPath(storyboardPatch.snippetId);
|
|
9140
|
+
var currentRoute = (_storyboard$routes = storyboard.routes) === null || _storyboard$routes === void 0 ? void 0 : _storyboard$routes.find(route => route.path === snippetPreviewPath);
|
|
9141
|
+
updatedStoryboard = {
|
|
9142
|
+
routes: [currentRoute]
|
|
9143
|
+
};
|
|
9144
|
+
} else if (updateStoryboardType === "form") {
|
|
9145
|
+
var _storyboard$routes2;
|
|
9146
|
+
var formPreviewPath = this._dev_only_getFormPreviewPath(formId);
|
|
9147
|
+
var _currentRoute = (_storyboard$routes2 = storyboard.routes) === null || _storyboard$routes2 === void 0 ? void 0 : _storyboard$routes2.find(route => route.path === formPreviewPath);
|
|
9148
|
+
updatedStoryboard = {
|
|
9149
|
+
routes: [_currentRoute]
|
|
9150
|
+
};
|
|
9151
|
+
}
|
|
9152
|
+
var addedContracts = [];
|
|
9153
|
+
if (updatedStoryboard) {
|
|
9154
|
+
var _scanCustomApisInStor;
|
|
9155
|
+
var contractApis = (_scanCustomApisInStor = scanCustomApisInStoryboard(updatedStoryboard)) === null || _scanCustomApisInStor === void 0 ? void 0 : _scanCustomApisInStor.filter(api => api.includes(":"));
|
|
9156
|
+
contractApis.forEach(api => {
|
|
9157
|
+
var _storyboard$meta$cont;
|
|
9158
|
+
var [_, namespaceId, name] = api.match(/(.*)@(.*):\d\.\d\.\d/);
|
|
9159
|
+
if (!((_storyboard$meta$cont = storyboard.meta.contracts) !== null && _storyboard$meta$cont !== void 0 && _storyboard$meta$cont.some(contract => contract.namespaceId === namespaceId && contract.name === name))) {
|
|
9160
|
+
addedContracts.push(api);
|
|
9161
|
+
}
|
|
9162
|
+
});
|
|
9163
|
+
}
|
|
9164
|
+
return addedContracts;
|
|
9165
|
+
}
|
|
9365
9166
|
loadDepsOfStoryboard(storyboard) {
|
|
9366
9167
|
return this.gracefullyLoadDeps(this._loadDepsOfStoryboard, storyboard);
|
|
9367
9168
|
}
|
|
@@ -9616,8 +9417,8 @@ class Kernel {
|
|
|
9616
9417
|
});
|
|
9617
9418
|
});
|
|
9618
9419
|
if (!filterMenus.length) {
|
|
9619
|
-
var
|
|
9620
|
-
filterMenus = (
|
|
9420
|
+
var _ref7, _yield$InstanceApi_po;
|
|
9421
|
+
filterMenus = (_ref7 = _this12.getFeatureFlags()["three-level-menu-layout"] ? (yield InstalledMicroAppApi_getMenusInfo(menuId, {
|
|
9621
9422
|
menuObjectId: "STANDALONE_MENU@EASYOPS"
|
|
9622
9423
|
})).menus : (_yield$InstanceApi_po = yield InstanceApi_postSearch("STANDALONE_MENU@EASYOPS", {
|
|
9623
9424
|
page: 1,
|
|
@@ -9648,7 +9449,7 @@ class Kernel {
|
|
|
9648
9449
|
$eq: true
|
|
9649
9450
|
}
|
|
9650
9451
|
}
|
|
9651
|
-
})) === null || _yield$InstanceApi_po === void 0 ? void 0 : _yield$InstanceApi_po.list) !== null &&
|
|
9452
|
+
})) === null || _yield$InstanceApi_po === void 0 ? void 0 : _yield$InstanceApi_po.list) !== null && _ref7 !== void 0 ? _ref7 : [];
|
|
9652
9453
|
}
|
|
9653
9454
|
return filterMenus;
|
|
9654
9455
|
})();
|
|
@@ -9691,15 +9492,15 @@ function _loadScriptOfDll() {
|
|
|
9691
9492
|
_loadScriptOfDll = _asyncToGenerator$3(function* (dlls) {
|
|
9692
9493
|
if (dlls.some(dll => dll.startsWith("dll-of-editor-bricks-helper."))) {
|
|
9693
9494
|
var dllPath = window.DLL_PATH || {};
|
|
9694
|
-
yield loadScript
|
|
9495
|
+
yield loadScript(dllPath["react-dnd"], window.CORE_ROOT);
|
|
9695
9496
|
}
|
|
9696
9497
|
// `loadScript` is auto cached, no need to filter out `react-dnd`.
|
|
9697
|
-
yield loadScript
|
|
9498
|
+
yield loadScript(dlls, window.CORE_ROOT);
|
|
9698
9499
|
});
|
|
9699
9500
|
return _loadScriptOfDll.apply(this, arguments);
|
|
9700
9501
|
}
|
|
9701
9502
|
function loadScriptOfBricksOrTemplates(src) {
|
|
9702
|
-
return loadScript
|
|
9503
|
+
return loadScript(src, window.PUBLIC_ROOT);
|
|
9703
9504
|
}
|
|
9704
9505
|
function generateColorTheme(theme) {
|
|
9705
9506
|
if (!theme) {
|
|
@@ -14232,6 +14033,7 @@ var developHelper = {
|
|
|
14232
14033
|
updateTemplatePreviewSettings: _dev_only_updateTemplatePreviewSettings,
|
|
14233
14034
|
updateSnippetPreviewSettings: _dev_only_updateSnippetPreviewSettings,
|
|
14234
14035
|
updateFormPreviewSettings: _dev_only_updateFormPreviewSettings,
|
|
14036
|
+
getAddedContracts: _dev_only_getAddedContracts,
|
|
14235
14037
|
getContextValue: _dev_only_getContextValue,
|
|
14236
14038
|
getAllContextValues: _dev_only_getAllContextValues,
|
|
14237
14039
|
render: _dev_only_render
|