@next-core/brick-kit 2.160.2 → 2.161.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
@@ -1,18 +1,18 @@
1
1
  import { parsePath, createBrowserHistory, locationsAreEqual } from 'history';
2
2
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
3
3
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
- import _asyncToGenerator$3 from '@babel/runtime/helpers/asyncToGenerator';
5
4
  import _defineProperty$1 from '@babel/runtime/helpers/defineProperty';
6
- import React, { useState, useEffect, useRef, useMemo, useCallback, forwardRef, useImperativeHandle, useContext, createContext, useReducer } from 'react';
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, deepFreeze, createProviderClass, removeDeadConditionsInTpl, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, loadScript, scanAppGetMenuInAny, asyncProcessBrick, scanInstalledAppsInStoryboard, removeDeadConditions, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
5
+ import _asyncToGenerator$3 from '@babel/runtime/helpers/asyncToGenerator';
8
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';
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
+ import { Modal, message, Empty, ConfigProvider } from 'antd';
11
+ import { ExclamationCircleOutlined } from '@ant-design/icons';
12
+ import i18next, { getFixedT } from 'i18next';
10
13
  import moment from 'moment';
11
14
  import { pipes } from '@next-core/pipes';
12
- import i18next, { getFixedT } from 'i18next';
13
15
  import { userAnalytics, apiAnalyzer } from '@next-core/easyops-analytics';
14
- import { Modal, message, Empty, ConfigProvider } from 'antd';
15
- import { ExclamationCircleOutlined } from '@ant-design/icons';
16
16
  import yaml from 'js-yaml';
17
17
  import { withTranslation } from 'react-i18next';
18
18
  import _extends from '@babel/runtime/helpers/esm/extends';
@@ -3266,6 +3266,7 @@ function _dev_only_getFakeKernel(overrides) {
3266
3266
  bootstrapData: kernel.bootstrapData,
3267
3267
  getFeatureFlags: kernel.getFeatureFlags.bind(kernel),
3268
3268
  loadDynamicBricksInBrickConf: kernel.loadDynamicBricksInBrickConf.bind(kernel),
3269
+ loadDynamicBricks: kernel.loadDynamicBricks.bind(kernel),
3269
3270
  getProviderBrick: kernel.getProviderBrick.bind(kernel)
3270
3271
  }, overrides);
3271
3272
  }
@@ -3300,6 +3301,59 @@ function _dev_only_updateStoryboardBySnippet(appId, newSnippet) {
3300
3301
  function _dev_only_updateFormPreviewSettings(appId, formId, settings) {
3301
3302
  kernel._dev_only_updateFormPreviewSettings(appId, formId, settings);
3302
3303
  }
3304
+ function _dev_only_render(_x, _x2) {
3305
+ return _dev_only_render2.apply(this, arguments);
3306
+ }
3307
+ function _dev_only_render2() {
3308
+ _dev_only_render2 = _asyncToGenerator$3(function* (mountPoints, conf) {
3309
+ var _kernel$router;
3310
+ unmountTree(mountPoints.bg);
3311
+ if (!getRuntime()) {
3312
+ var runtime = createRuntime();
3313
+ yield runtime.bootstrap(mountPoints);
3314
+ }
3315
+ if ((_kernel$router = kernel.router) !== null && _kernel$router !== void 0 && _kernel$router.getResolver()) {
3316
+ kernel.router.getResolver().resetRefreshQueue();
3317
+ }
3318
+ var mountRoutesResult = {
3319
+ main: [],
3320
+ portal: [],
3321
+ failed: false
3322
+ };
3323
+ try {
3324
+ var mutableConf = cloneDeep(conf);
3325
+ yield asyncProcessBrick(mutableConf, brickTemplateRegistry, kernel.bootstrapData.templatePackages);
3326
+ yield kernel.loadDynamicBricksInBrickConf(mutableConf);
3327
+ yield kernel.router.getMountBrick(mutableConf, null, "", mountRoutesResult);
3328
+ } catch (error) {
3329
+ // eslint-disable-next-line no-console
3330
+ console.error(error);
3331
+ mountRoutesResult.failed = true;
3332
+ mountRoutesResult.main = [{
3333
+ type: "basic-bricks.page-error",
3334
+ properties: {
3335
+ error: httpErrorToString(error)
3336
+ },
3337
+ events: {}
3338
+ }];
3339
+ mountRoutesResult.portal = [];
3340
+ }
3341
+ var {
3342
+ main,
3343
+ failed,
3344
+ portal
3345
+ } = mountRoutesResult;
3346
+ mountTree(main, mountPoints.main);
3347
+ mountTree(portal, mountPoints.portal);
3348
+ afterMountTree(main);
3349
+ afterMountTree(portal);
3350
+ if (!failed) {
3351
+ kernel.router.getHandlePageLoad();
3352
+ kernel.router.getResolver().scheduleRefreshing();
3353
+ }
3354
+ });
3355
+ return _dev_only_render2.apply(this, arguments);
3356
+ }
3303
3357
  class Runtime {
3304
3358
  constructor() {
3305
3359
  _defineProperty$1(this, "registerBrickTemplate", registerBrickTemplate);
@@ -11007,6 +11061,9 @@ class Router {
11007
11061
  // And the API Analyzer maybe disabled.
11008
11062
  var tracePageEnd = (_apiAnalyzer$getInsta = apiAnalyzer.getInstance()) === null || _apiAnalyzer$getInsta === void 0 ? void 0 : _apiAnalyzer$getInsta.tracePage();
11009
11063
  var locationContext = _this3.locationContext = new LocationContext(_this3.kernel, location);
11064
+ if (window.DEVELOPER_PREVIEW) {
11065
+ return;
11066
+ }
11010
11067
  var storyboard = locationContext.matchStoryboard(_this3.kernel.bootstrapData.storyboards);
11011
11068
 
11012
11069
  /** Pending task for loading bricks */
@@ -11391,6 +11448,12 @@ class Router {
11391
11448
  getResolver() {
11392
11449
  return this.locationContext.resolver;
11393
11450
  }
11451
+ getMountBrick() {
11452
+ return this.locationContext.mountBrick(...arguments);
11453
+ }
11454
+ getHandlePageLoad() {
11455
+ return this.locationContext.handlePageLoad();
11456
+ }
11394
11457
  getState() {
11395
11458
  return this.state;
11396
11459
  }
@@ -13353,7 +13416,8 @@ var developHelper = {
13353
13416
  updateStoryboardBySnippet: _dev_only_updateStoryboardBySnippet,
13354
13417
  updateTemplatePreviewSettings: _dev_only_updateTemplatePreviewSettings,
13355
13418
  updateSnippetPreviewSettings: _dev_only_updateSnippetPreviewSettings,
13356
- updateFormPreviewSettings: _dev_only_updateFormPreviewSettings
13419
+ updateFormPreviewSettings: _dev_only_updateFormPreviewSettings,
13420
+ render: _dev_only_render
13357
13421
  };
13358
13422
 
13359
13423
  var _excluded$2 = ["type"];