@next-core/brick-kit 2.123.4 → 2.123.7

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
+ import { parsePath, createBrowserHistory, locationsAreEqual, createPath } from 'history';
2
+ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
3
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
1
4
  import _asyncToGenerator$4 from '@babel/runtime/helpers/asyncToGenerator';
2
5
  import _defineProperty$1 from '@babel/runtime/helpers/defineProperty';
3
- import _objectSpread from '@babel/runtime/helpers/objectSpread2';
4
- import { Modal, message, Empty, ConfigProvider } from 'antd';
5
- import { userAnalytics, apiAnalyzer } from '@next-core/easyops-analytics';
6
- import React, { useState, useEffect, useRef, forwardRef, useImperativeHandle, useMemo, createContext, useContext, useReducer, useCallback } from 'react';
6
+ import React, { useState, useEffect, useRef, forwardRef, useImperativeHandle, useMemo, useContext, createContext, useReducer, useCallback } from 'react';
7
+ import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, scanPermissionActionsInStoryboard, precookFunction, cook, resolveContextConcurrently, syncResolveContextConcurrently, shouldAllowRecursiveEvaluations, preevaluate, inject, deepFreeze, createProviderClass, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, loadScript, matchPath, scanAppGetMenuInAny, asyncProcessBrick, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
8
+ import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, sortBy, merge, isEmpty, isObject as isObject$1, pick, orderBy, omit, findLastIndex, noop, isString } from 'lodash';
7
9
  import { http, HttpResponseError, HttpFetchError } from '@next-core/brick-http';
8
- import { ExclamationCircleOutlined } from '@ant-design/icons';
9
- import i18next, { getFixedT } from 'i18next';
10
- import { parsePath, createBrowserHistory, locationsAreEqual, createPath } from 'history';
11
- import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
12
- import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, scanPermissionActionsInStoryboard, precookFunction, cook, resolveContextConcurrently, syncResolveContextConcurrently, shouldAllowRecursiveEvaluations, preevaluate, inject, deepFreeze, createProviderClass, loadScript, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, matchPath, scanAppGetMenuInAny, asyncProcessBrick, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
13
- import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, sortBy, merge, isEmpty, pick, orderBy, omit, findLastIndex, noop, isObject as isObject$1, isString } from 'lodash';
14
10
  import moment from 'moment';
15
11
  import { pipes } from '@next-core/pipes';
12
+ import i18next, { getFixedT } from 'i18next';
13
+ 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';
@@ -1137,14 +1137,21 @@ var TRANSFORMATION_EDIT = "devtools-transformation-edit";
1137
1137
 
1138
1138
  /* istanbul ignore next */
1139
1139
  function devtoolsHookEmit(type, payload) {
1140
- Promise.resolve().then(() => {
1140
+ var emit = () => {
1141
1141
  var _getDevHook, _getDevHook$emit;
1142
1142
 
1143
1143
  (_getDevHook = getDevHook()) === null || _getDevHook === void 0 ? void 0 : (_getDevHook$emit = _getDevHook.emit) === null || _getDevHook$emit === void 0 ? void 0 : _getDevHook$emit.call(_getDevHook, {
1144
1144
  type,
1145
1145
  payload
1146
1146
  });
1147
- });
1147
+ }; // Try to emit only in idle time.
1148
+
1149
+
1150
+ if (typeof window.requestIdleCallback === "function") {
1151
+ window.requestIdleCallback(emit);
1152
+ } else {
1153
+ setTimeout(emit, 0);
1154
+ }
1148
1155
  }
1149
1156
  function listenDevtools() {
1150
1157
  window.addEventListener("message", event => {
@@ -1209,6 +1216,7 @@ var locale$7 = {
1209
1216
  [K.LOGIN_TIMEOUT_MESSAGE]: "You haven't logged in or your login session has expired. Login right now?",
1210
1217
  [K.NETWORK_ERROR]: "Network error, please check your network."
1211
1218
  };
1219
+ var en = locale$7;
1212
1220
 
1213
1221
  var locale$6 = {
1214
1222
  [K.REQUEST_FAILED]: "请求失败",
@@ -1218,12 +1226,13 @@ var locale$6 = {
1218
1226
  [K.LOGIN_TIMEOUT_MESSAGE]: "您还未登录或登录信息已过期,现在重新登录?",
1219
1227
  [K.NETWORK_ERROR]: "网络错误,请检查您的网络连接。"
1220
1228
  };
1229
+ var zh = locale$6;
1221
1230
 
1222
1231
  /** @internal */
1223
1232
 
1224
1233
  var initI18n = () => {
1225
- i18next.addResourceBundle("en", NS_BRICK_KIT, locale$7);
1226
- i18next.addResourceBundle("zh", NS_BRICK_KIT, locale$6);
1234
+ i18next.addResourceBundle("en", NS_BRICK_KIT, en);
1235
+ i18next.addResourceBundle("zh", NS_BRICK_KIT, zh);
1227
1236
  };
1228
1237
  /** @internal */
1229
1238
 
@@ -6972,19 +6981,29 @@ function hasFileType(request) {
6972
6981
  return flag;
6973
6982
  }
6974
6983
  function transformFormData(data) {
6984
+ if (data instanceof FormData) {
6985
+ return data;
6986
+ }
6987
+
6975
6988
  var formData = new FormData();
6976
6989
 
6977
- for (var [key, value] of Object.entries(data)) {
6990
+ var _loop = function (key, value) {
6978
6991
  if (Array.isArray(value)) {
6979
- (function () {
6980
- var k = "".concat(key, "[]");
6981
- value.forEach(v => {
6982
- formData.append(k, v);
6983
- });
6984
- })();
6992
+ value.forEach(v => {
6993
+ formData.append(key, v);
6994
+ });
6995
+ } else if (isObject$1(value) && !(value instanceof Blob) && !(value instanceof Date)) {
6996
+ Object.entries(value).forEach(_ref => {
6997
+ var [k, v] = _ref;
6998
+ formData.append("".concat(key, "[").concat(k, "]"), v);
6999
+ });
6985
7000
  } else {
6986
7001
  formData.append(key, value);
6987
7002
  }
7003
+ };
7004
+
7005
+ for (var [key, value] of Object.entries(data)) {
7006
+ _loop(key, value);
6988
7007
  }
6989
7008
 
6990
7009
  return formData;
@@ -6994,14 +7013,14 @@ function CustomApi(_x) {
6994
7013
  }
6995
7014
 
6996
7015
  function _CustomApi() {
6997
- _CustomApi = _asyncToGenerator$4(function* (_ref) {
7016
+ _CustomApi = _asyncToGenerator$4(function* (_ref2) {
6998
7017
  var {
6999
7018
  url,
7000
7019
  method = "GET",
7001
7020
  responseWrapper = true,
7002
7021
  ext_fields = [],
7003
7022
  request
7004
- } = _ref;
7023
+ } = _ref2;
7005
7024
  var isSimpleRequest = ["get", "delete", "head"].includes(method.toLowerCase());
7006
7025
  var response;
7007
7026
 
@@ -7887,19 +7906,6 @@ Object.keys(presetPrimaryColors).forEach(function (key) {
7887
7906
  });
7888
7907
  presetDarkPalettes[key].primary = presetDarkPalettes[key][5];
7889
7908
  });
7890
- presetPalettes.red;
7891
- presetPalettes.volcano;
7892
- presetPalettes.gold;
7893
- presetPalettes.orange;
7894
- presetPalettes.yellow;
7895
- presetPalettes.lime;
7896
- presetPalettes.green;
7897
- presetPalettes.cyan;
7898
- presetPalettes.blue;
7899
- presetPalettes.geekblue;
7900
- presetPalettes.purple;
7901
- presetPalettes.magenta;
7902
- presetPalettes.grey;
7903
7909
 
7904
7910
  function getStyleByBaseColors(theme, baseColors, backgroundColor) {
7905
7911
  return (theme === "dark" ? getDarkStyle : getLightStyle)("".concat(getCssVariableDefinitionsByPalettes(generatePalettes(baseColors, theme, backgroundColor), theme), "\n").concat(getMigratedCssVariableDefinitions(theme, baseColors, backgroundColor)));