@alicloud/alfa-react 1.5.13-alpha.3 → 1.5.13

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.
@@ -11,6 +11,7 @@ import { createCWSWidget } from './widget';
11
11
  import createApplication from './createApplication';
12
12
  import beforeResolveHook from './hooks/beforeResolveHook';
13
13
  import beforeLoadHook from './hooks/beforeLoadHook';
14
+ import { isOneConsole } from './helpers/oneConsole';
14
15
  var loader = BaseLoader.create();
15
16
  loader.beforeResolve.use(beforeResolveHook);
16
17
  loader.beforeLoad.use(beforeLoadHook);
@@ -51,6 +52,12 @@ function createAlfaWidget(option) {
51
52
  return null;
52
53
  };
53
54
  var passedInOption = option;
55
+
56
+ // 非 oneConsole 环境下设置 iframe 沙箱地址为 about:blank
57
+ // 避免沙箱创建失败
58
+ if (passedInOption.sandbox && !passedInOption.sandbox.sandBoxUrl && !isOneConsole()) {
59
+ passedInOption.sandbox.sandBoxUrl = 'about:blank';
60
+ }
54
61
  return function (props) {
55
62
  return (
56
63
  /*#__PURE__*/
@@ -125,7 +125,9 @@ export default function createApplication(loader) {
125
125
  // 更新标记,保证每次更新都会更新
126
126
  customProps.__innerStamp = (+new Date()).toString(36);
127
127
  customProps.__historyState = getHistoryState();
128
- if (customProps.path) customProps.path = addLeftSlash(customProps.path);
128
+ if (customProps.path) {
129
+ customProps.path = addLeftSlash(customProps.path);
130
+ }
129
131
 
130
132
  // 受控模式锁定一些参数
131
133
  if ($syncHistory.current) {
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 是否是 oneConsole 环境
3
+ * @returns
4
+ */
5
+ export function isOneConsole() {
6
+ var _ALIYUN_CONSOLE_CONFI;
7
+ return ((_ALIYUN_CONSOLE_CONFI = window.ALIYUN_CONSOLE_CONFIG) === null || _ALIYUN_CONSOLE_CONFI === void 0 ? void 0 : _ALIYUN_CONSOLE_CONFI.portalType) === 'one';
8
+ }
package/es/version.js CHANGED
@@ -1 +1 @@
1
- export var version = '1.5.13-alpha.3';
1
+ export var version = '1.5.13';
@@ -18,6 +18,7 @@ var _widget = require("./widget");
18
18
  var _createApplication = _interopRequireDefault(require("./createApplication"));
19
19
  var _beforeResolveHook = _interopRequireDefault(require("./hooks/beforeResolveHook"));
20
20
  var _beforeLoadHook = _interopRequireDefault(require("./hooks/beforeLoadHook"));
21
+ var _oneConsole = require("./helpers/oneConsole");
21
22
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
22
23
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
24
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -62,6 +63,12 @@ function createAlfaWidget(option) {
62
63
  return null;
63
64
  };
64
65
  var passedInOption = option;
66
+
67
+ // 非 oneConsole 环境下设置 iframe 沙箱地址为 about:blank
68
+ // 避免沙箱创建失败
69
+ if (passedInOption.sandbox && !passedInOption.sandbox.sandBoxUrl && !(0, _oneConsole.isOneConsole)()) {
70
+ passedInOption.sandbox.sandBoxUrl = 'about:blank';
71
+ }
65
72
  return function (props) {
66
73
  return (
67
74
  /*#__PURE__*/
@@ -135,7 +135,9 @@ function createApplication(loader) {
135
135
  // 更新标记,保证每次更新都会更新
136
136
  customProps.__innerStamp = (+new Date()).toString(36);
137
137
  customProps.__historyState = getHistoryState();
138
- if (customProps.path) customProps.path = addLeftSlash(customProps.path);
138
+ if (customProps.path) {
139
+ customProps.path = addLeftSlash(customProps.path);
140
+ }
139
141
 
140
142
  // 受控模式锁定一些参数
141
143
  if ($syncHistory.current) {
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isOneConsole = isOneConsole;
7
+ /**
8
+ * 是否是 oneConsole 环境
9
+ * @returns
10
+ */
11
+ function isOneConsole() {
12
+ var _ALIYUN_CONSOLE_CONFI;
13
+ return ((_ALIYUN_CONSOLE_CONFI = window.ALIYUN_CONSOLE_CONFIG) === null || _ALIYUN_CONSOLE_CONFI === void 0 ? void 0 : _ALIYUN_CONSOLE_CONFI.portalType) === 'one';
14
+ }
package/lib/version.js CHANGED
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.version = void 0;
7
- var version = '1.5.13-alpha.3';
7
+ var version = '1.5.13';
8
8
  exports.version = version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alicloud/alfa-react",
3
- "version": "1.5.13-alpha.3",
3
+ "version": "1.5.13",
4
4
  "description": "Alfa Framework (React Version)",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 是否是 oneConsole 环境
3
+ * @returns
4
+ */
5
+ export declare function isOneConsole(): boolean;
@@ -1 +1 @@
1
- export declare const version = "1.5.13-alpha.3";
1
+ export declare const version = "1.5.13";