@next-core/brick-kit 2.160.3 → 2.162.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';
@@ -3301,6 +3301,59 @@ function _dev_only_updateStoryboardBySnippet(appId, newSnippet) {
3301
3301
  function _dev_only_updateFormPreviewSettings(appId, formId, settings) {
3302
3302
  kernel._dev_only_updateFormPreviewSettings(appId, formId, settings);
3303
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
+ }
3304
3357
  class Runtime {
3305
3358
  constructor() {
3306
3359
  _defineProperty$1(this, "registerBrickTemplate", registerBrickTemplate);
@@ -9501,7 +9554,9 @@ function initFormContext(formData, brickConf, isPreview) {
9501
9554
  return formData;
9502
9555
  }
9503
9556
  function getFinalStoryBoard(formData, brickConf, isPreview, formContext) {
9557
+ var _brickConf$properties;
9504
9558
  var result = null;
9559
+ var renderRoot = typeof ((_brickConf$properties = brickConf.properties) === null || _brickConf$properties === void 0 ? void 0 : _brickConf$properties.renderRoot) === "boolean" ? brickConf.properties.renderRoot : true;
9505
9560
  var errorBrick = {
9506
9561
  brick: "presentational-bricks.brick-illustration",
9507
9562
  properties: {
@@ -9527,7 +9582,7 @@ function getFinalStoryBoard(formData, brickConf, isPreview, formContext) {
9527
9582
  });
9528
9583
  formStoryboard[0].events = events;
9529
9584
  }
9530
- result = _objectSpread(_objectSpread({}, brickConf), {}, {
9585
+ result = renderRoot ? _objectSpread(_objectSpread({}, brickConf), {}, {
9531
9586
  brick: "div",
9532
9587
  slots: {
9533
9588
  "": {
@@ -9548,6 +9603,14 @@ function getFinalStoryBoard(formData, brickConf, isPreview, formContext) {
9548
9603
  type: "bricks"
9549
9604
  }
9550
9605
  }
9606
+ }) : _objectSpread(_objectSpread({}, brickConf), {}, {
9607
+ brick: "div",
9608
+ slots: {
9609
+ "": {
9610
+ bricks: formStoryboard,
9611
+ type: "bricks"
9612
+ }
9613
+ }
9551
9614
  });
9552
9615
  } catch (error) {
9553
9616
  // eslint-disable-next-line no-console
@@ -11008,6 +11071,9 @@ class Router {
11008
11071
  // And the API Analyzer maybe disabled.
11009
11072
  var tracePageEnd = (_apiAnalyzer$getInsta = apiAnalyzer.getInstance()) === null || _apiAnalyzer$getInsta === void 0 ? void 0 : _apiAnalyzer$getInsta.tracePage();
11010
11073
  var locationContext = _this3.locationContext = new LocationContext(_this3.kernel, location);
11074
+ if (window.DEVELOPER_PREVIEW) {
11075
+ return;
11076
+ }
11011
11077
  var storyboard = locationContext.matchStoryboard(_this3.kernel.bootstrapData.storyboards);
11012
11078
 
11013
11079
  /** Pending task for loading bricks */
@@ -11392,6 +11458,12 @@ class Router {
11392
11458
  getResolver() {
11393
11459
  return this.locationContext.resolver;
11394
11460
  }
11461
+ getMountBrick() {
11462
+ return this.locationContext.mountBrick(...arguments);
11463
+ }
11464
+ getHandlePageLoad() {
11465
+ return this.locationContext.handlePageLoad();
11466
+ }
11395
11467
  getState() {
11396
11468
  return this.state;
11397
11469
  }
@@ -13354,7 +13426,8 @@ var developHelper = {
13354
13426
  updateStoryboardBySnippet: _dev_only_updateStoryboardBySnippet,
13355
13427
  updateTemplatePreviewSettings: _dev_only_updateTemplatePreviewSettings,
13356
13428
  updateSnippetPreviewSettings: _dev_only_updateSnippetPreviewSettings,
13357
- updateFormPreviewSettings: _dev_only_updateFormPreviewSettings
13429
+ updateFormPreviewSettings: _dev_only_updateFormPreviewSettings,
13430
+ render: _dev_only_render
13358
13431
  };
13359
13432
 
13360
13433
  var _excluded$2 = ["type"];