@next-core/brick-kit 2.164.2 → 2.164.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.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, 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';
7
+ import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, trackFormState, scanPermissionActionsInStoryboard, precookFunction, cook, collectContextUsage, deferResolveContextConcurrently, resolveContextConcurrently, syncResolveContextConcurrently, trackUsedFormState, 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';
@@ -1900,7 +1900,12 @@ class StoryboardContextWrapper {
1900
1900
  }
1901
1901
  }
1902
1902
  getResolveOptions(coreContext) {
1903
- return this.tplContextId ? {
1903
+ return this.formContextId ? {
1904
+ mergedContext: _objectSpread(_objectSpread({}, coreContext), {}, {
1905
+ formContextId: this.formContextId
1906
+ }),
1907
+ keyword: "FORM_STATE"
1908
+ } : this.tplContextId ? {
1904
1909
  mergedContext: _objectSpread(_objectSpread({}, coreContext), {}, {
1905
1910
  tplContextId: this.tplContextId
1906
1911
  }),
@@ -2018,8 +2023,9 @@ function resolveFreeVariableValue(value, contextConf, mergedContext, storyboardC
2018
2023
  }
2019
2024
  if (contextConf.track) {
2020
2025
  var isTemplateState = !!storyboardContextWrapper.tplContextId;
2026
+ var isFormState = !!storyboardContextWrapper.formContextId;
2021
2027
  // Track its dependencies and auto update when each of them changed.
2022
- var deps = (isTemplateState ? trackUsedState : trackUsedContext)(load ? contextConf.resolve : contextConf.value);
2028
+ var deps = (isFormState ? trackUsedFormState : isTemplateState ? trackUsedState : trackUsedContext)(load ? contextConf.resolve : contextConf.value);
2023
2029
  for (var dep of deps) {
2024
2030
  var _eventTarget;
2025
2031
  var ctx = storyboardContextWrapper.get().get(dep);
@@ -11112,7 +11118,7 @@ class Router {
11112
11118
  render(location) {
11113
11119
  var _this3 = this;
11114
11120
  return _asyncToGenerator$3(function* () {
11115
- var _apiAnalyzer$getInsta, _currentApp$config, _currentApp$config$_e, _getLocalAppsTheme;
11121
+ var _apiAnalyzer$getInsta, _currentApp$config, _currentApp$config$_e, _this3$kernel$bootstr, _this3$kernel$bootstr2, _getLocalAppsTheme;
11116
11122
  _this3.state = "initial";
11117
11123
  _this3.renderId = uniqueId("render-id-");
11118
11124
  resetAllInjected();
@@ -11189,9 +11195,12 @@ class Router {
11189
11195
  var layoutType = (currentApp === null || currentApp === void 0 ? void 0 : currentApp.layoutType) || "console";
11190
11196
  var faviconElement = document.querySelector("link[rel='shortcut icon']");
11191
11197
  var customFaviconHref = currentApp === null || currentApp === void 0 ? void 0 : (_currentApp$config = currentApp.config) === null || _currentApp$config === void 0 ? void 0 : (_currentApp$config$_e = _currentApp$config._easyops_app_favicon) === null || _currentApp$config$_e === void 0 ? void 0 : _currentApp$config$_e.default;
11198
+ var settingsFaviconHref = (_this3$kernel$bootstr = _this3.kernel.bootstrapData.settings) === null || _this3$kernel$bootstr === void 0 ? void 0 : (_this3$kernel$bootstr2 = _this3$kernel$bootstr.brand) === null || _this3$kernel$bootstr2 === void 0 ? void 0 : _this3$kernel$bootstr2.favicon;
11192
11199
  if (faviconElement) {
11193
11200
  if (customFaviconHref) {
11194
11201
  faviconElement.href = /^(?:https?|data):|^\//.test(customFaviconHref) ? customFaviconHref : imagesFactory(currentApp.id, currentApp.isBuildPush).get(customFaviconHref);
11202
+ } else if (settingsFaviconHref) {
11203
+ faviconElement.href = settingsFaviconHref;
11195
11204
  } else {
11196
11205
  faviconElement.href = _this3.kernel.getOriginFaviconHref();
11197
11206
  }
@@ -11359,7 +11368,7 @@ class Router {
11359
11368
  // When we have a matched route other than an abstract route,
11360
11369
  // we say *page found*, otherwise, *page not found*.
11361
11370
  if (route && route.type !== "routes" || failed) {
11362
- var _this3$kernel$bootstr, _this3$kernel$bootstr2, _getAuth$license;
11371
+ var _this3$kernel$bootstr3, _this3$kernel$bootstr4, _getAuth$license;
11363
11372
  yield pendingTask;
11364
11373
  main.length > 0 && mountTree(main, mountPoints.main);
11365
11374
  portal.length > 0 && mountTree(portal, mountPoints.portal);
@@ -11398,7 +11407,7 @@ class Router {
11398
11407
  var {
11399
11408
  loadTime = 0,
11400
11409
  loadInfoPage
11401
- } = (_this3$kernel$bootstr = (_this3$kernel$bootstr2 = _this3.kernel.bootstrapData.settings) === null || _this3$kernel$bootstr2 === void 0 ? void 0 : _this3$kernel$bootstr2.misc) !== null && _this3$kernel$bootstr !== void 0 ? _this3$kernel$bootstr : {};
11410
+ } = (_this3$kernel$bootstr3 = (_this3$kernel$bootstr4 = _this3.kernel.bootstrapData.settings) === null || _this3$kernel$bootstr4 === void 0 ? void 0 : _this3$kernel$bootstr4.misc) !== null && _this3$kernel$bootstr3 !== void 0 ? _this3$kernel$bootstr3 : {};
11402
11411
  if (currentApp.isBuildPush && loadTime > 0 && renderTime > loadTime) {
11403
11412
  var getSecond = time => Math.floor(time * 100) / 100;
11404
11413
  tipsDetail.push(_objectSpread({