@next-core/brick-kit 2.162.1 → 2.164.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/dist/index.esm.js CHANGED
@@ -3,8 +3,8 @@ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
3
3
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
4
  import _defineProperty$1 from '@babel/runtime/helpers/defineProperty';
5
5
  import _asyncToGenerator$3 from '@babel/runtime/helpers/asyncToGenerator';
6
- import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, isEmpty, sortBy, orderBy, merge, isObject as isObject$1, uniq, pick, omit, findLastIndex, noop, isString as isString$1 } from 'lodash';
7
- import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, trackFormState, scanPermissionActionsInStoryboard, precookFunction, cook, collectContextUsage, deferResolveContextConcurrently, resolveContextConcurrently, syncResolveContextConcurrently, trackUsedState, trackUsedContext, shouldAllowRecursiveEvaluations, preevaluate, inject, scanPermissionActionsInAny, matchPath, asyncProcessBrick, deepFreeze, createProviderClass, removeDeadConditionsInTpl, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, loadScript, scanAppGetMenuInAny, scanInstalledAppsInStoryboard, removeDeadConditions, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
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, transformAndInject, transform, trackContext, trackState, trackFormState, scanPermissionActionsInStoryboard, precookFunction, cook, collectContextUsage, deferResolveContextConcurrently, resolveContextConcurrently, syncResolveContextConcurrently, trackUsedState, trackUsedContext, shouldAllowRecursiveEvaluations, preevaluate, inject, scanPermissionActionsInAny, deepFreeze, matchPath, asyncProcessBrick, createProviderClass, removeDeadConditionsInTpl, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, loadScript, scanAppGetMenuInAny, scanInstalledAppsInStoryboard, removeDeadConditions, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
8
8
  import React, { useState, useEffect, useRef, useMemo, useCallback, forwardRef, useImperativeHandle, useContext, createContext, useReducer } from 'react';
9
9
  import { http, HttpResponseError, HttpAbortError, HttpFetchError } from '@next-core/brick-http';
10
10
  import { Modal, message, Empty, ConfigProvider } from 'antd';
@@ -2932,6 +2932,9 @@ function _loadDynamicMenuItems() {
2932
2932
  var newContext = context;
2933
2933
  if (overrideAppId !== context.app.id && attemptToVisit(menu.itemsResolve, ["APP", "I18N"])) {
2934
2934
  if (window.STANDALONE_MICRO_APPS) {
2935
+ if (menu.overrideApp) {
2936
+ menu.overrideApp.config = deepFreeze(merge({}, menu.overrideApp.defaultConfig, menu.overrideApp.userConfig));
2937
+ }
2935
2938
  newContext = _objectSpread(_objectSpread({}, context), {}, {
2936
2939
  overrideApp: menu.overrideApp,
2937
2940
  appendI18nNamespace: menuWithI18n.get(menu)
@@ -3124,6 +3127,9 @@ function _computeRealValueWithOverrideApp() {
3124
3127
  var newContext = context;
3125
3128
  if (overrideAppId !== context.app.id && attemptToVisit(data, ["APP", "I18N"])) {
3126
3129
  if (window.STANDALONE_MICRO_APPS) {
3130
+ if (data[symbolOverrideApp]) {
3131
+ data[symbolOverrideApp].config = deepFreeze(merge({}, data[symbolOverrideApp].defaultConfig, data[symbolOverrideApp].userConfig));
3132
+ }
3127
3133
  newContext = _objectSpread(_objectSpread({}, context), {}, {
3128
3134
  overrideApp: data[symbolOverrideApp],
3129
3135
  appendI18nNamespace: data[symbolMenuI18nNamespace]
@@ -5479,8 +5485,7 @@ function clearPollTimeout() {
5479
5485
  */
5480
5486
  var BootstrapStandaloneApi_runtimeStandalone = /*#__PURE__*/function () {
5481
5487
  var _ref = _asyncToGenerator$3(function* (options) {
5482
- return (/**! @contract easyops.api.api_gateway.bootstrap_standalone.RuntimeStandalone@1.0.1 */
5483
- (yield http.get("api/v1/runtime_standalone", options)).data
5488
+ return (/**! @contract easyops.api.api_gateway.bootstrap_standalone.RuntimeStandalone@1.0.1 */(yield http.get("api/v1/runtime_standalone", options)).data
5484
5489
  );
5485
5490
  });
5486
5491
  return function BootstrapStandaloneApi_runtimeStandalone(_x) {
@@ -5494,8 +5499,7 @@ var BootstrapStandaloneApi_runtimeStandalone = /*#__PURE__*/function () {
5494
5499
  */
5495
5500
  var BootstrapV2Api_bootstrapV2 = /*#__PURE__*/function () {
5496
5501
  var _ref = _asyncToGenerator$3(function* (params, options) {
5497
- return (/**! @contract easyops.api.api_gateway.bootstrap_v2.BootstrapV2@1.0.0 */
5498
- (yield http.get("api/auth/v2/bootstrap", _objectSpread(_objectSpread({}, options), {}, {
5502
+ return (/**! @contract easyops.api.api_gateway.bootstrap_v2.BootstrapV2@1.1.0 */(yield http.get("api/auth/v2/bootstrap", _objectSpread(_objectSpread({}, options), {}, {
5499
5503
  params
5500
5504
  }))).data
5501
5505
  );
@@ -5511,8 +5515,7 @@ var BootstrapV2Api_bootstrapV2 = /*#__PURE__*/function () {
5511
5515
  */
5512
5516
  var BootstrapV2Api_getAppStoryboardV2 = /*#__PURE__*/function () {
5513
5517
  var _ref = _asyncToGenerator$3(function* (appId, params, options) {
5514
- return (/**! @contract easyops.api.api_gateway.bootstrap_v2.GetAppStoryboardV2@1.0.0 */
5515
- (yield http.get("api/auth/v2/bootstrap/".concat(appId), _objectSpread(_objectSpread({}, options), {}, {
5518
+ return (/**! @contract easyops.api.api_gateway.bootstrap_v2.GetAppStoryboardV2@1.0.0 */(yield http.get("api/auth/v2/bootstrap/".concat(appId), _objectSpread(_objectSpread({}, options), {}, {
5516
5519
  params
5517
5520
  }))).data
5518
5521
  );
@@ -5522,14 +5525,29 @@ var BootstrapV2Api_getAppStoryboardV2 = /*#__PURE__*/function () {
5522
5525
  };
5523
5526
  }();
5524
5527
 
5528
+ /**
5529
+ * @description 获取bricks信息
5530
+ * @endpoint GET /api/v1/api_gateway/bricks
5531
+ */
5532
+ var BootstrapV2Api_getBricksInfo = /*#__PURE__*/function () {
5533
+ var _ref = _asyncToGenerator$3(function* (params, options) {
5534
+ return (/**! @contract easyops.api.api_gateway.bootstrap_v2.GetBricksInfo@1.0.0 */(yield http.get("api/v1/api_gateway/bricks", _objectSpread(_objectSpread({}, options), {}, {
5535
+ params
5536
+ }))).data
5537
+ );
5538
+ });
5539
+ return function BootstrapV2Api_getBricksInfo(_x, _x2) {
5540
+ return _ref.apply(this, arguments);
5541
+ };
5542
+ }();
5543
+
5525
5544
  /**
5526
5545
  * @description 通过defaultOrg查找单个契约信息
5527
5546
  * @endpoint POST /api/contract/single_search
5528
5547
  */
5529
5548
  var ContractApi_searchSingleContract = /*#__PURE__*/function () {
5530
5549
  var _ref = _asyncToGenerator$3(function* (data, options) {
5531
- return (/**! @contract easyops.api.api_gateway.contract.SearchSingleContract@1.0.0 */
5532
- (yield http.post("api/contract/single_search", data, options)).data
5550
+ return (/**! @contract easyops.api.api_gateway.contract.SearchSingleContract@1.0.0 */(yield http.post("api/contract/single_search", data, options)).data
5533
5551
  );
5534
5552
  });
5535
5553
  return function ContractApi_searchSingleContract(_x, _x2) {
@@ -6729,7 +6747,7 @@ function _standaloneBootstrap() {
6729
6747
  // eslint-disable-next-line no-console
6730
6748
  console.warn("request runtime api from api-gateway failed: ", error, ", something might went wrong running standalone micro app");
6731
6749
  return;
6732
- })];
6750
+ }), window.DEVELOPER_PREVIEW ? BootstrapV2Api_getBricksInfo({}) : null];
6733
6751
  if (!window.NO_AUTH_GUARD) {
6734
6752
  var matches;
6735
6753
  var appId = window.APP_ID || (window.APP_ROOT && (matches = window.APP_ROOT.match(/^(?:(?:\/next)?\/)?sa-static\/([^/]+)\/versions\//)) ? matches[1] : null);
@@ -6738,7 +6756,7 @@ function _standaloneBootstrap() {
6738
6756
  safeGetRuntimeMicroAppStandalone(appId);
6739
6757
  }
6740
6758
  }
6741
- var [bootstrapResult, confString, runtimeData] = yield Promise.all(requests);
6759
+ var [bootstrapResult, confString, runtimeData, previewPackageData] = yield Promise.all(requests);
6742
6760
  var conf;
6743
6761
  try {
6744
6762
  conf = confString ? yaml.safeLoad(confString, {
@@ -6793,6 +6811,12 @@ function _standaloneBootstrap() {
6793
6811
  }
6794
6812
  }
6795
6813
  }
6814
+ if (previewPackageData) {
6815
+ Object.assign(bootstrapResult, {
6816
+ brickPackages: previewPackageData.bricksInfo,
6817
+ templatePackages: previewPackageData.templatesInfo
6818
+ });
6819
+ }
6796
6820
  return _objectSpread(_objectSpread({}, bootstrapResult), {}, {
6797
6821
  settings
6798
6822
  });
@@ -9544,10 +9568,10 @@ function initFormContext(formData, brickConf, isPreview) {
9544
9568
  item.value = brickConf.properties[item.name];
9545
9569
  }
9546
9570
  });
9547
- if (brickConf.properties.condition) {
9571
+ if (brickConf.properties.params) {
9548
9572
  formData.context.push({
9549
- name: "condition",
9550
- value: brickConf.properties.condition
9573
+ name: "params",
9574
+ value: brickConf.properties.params
9551
9575
  });
9552
9576
  }
9553
9577
  }