ls-pro-common 3.0.35 → 3.0.36

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.
@@ -254,6 +254,11 @@ function ImageSelector(prop) {
254
254
  formRef.current.setFieldsValue(_objectSpread({}, formValue));
255
255
  }
256
256
  };
257
+ var win = top || window;
258
+ //@ts-ignore
259
+ if (!win.lsAppList) {
260
+ win = window;
261
+ }
257
262
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ProFormText, _extends({
258
263
  name: name
259
264
  }, rest), isInput ? /*#__PURE__*/React.createElement(_Input, _extends({
@@ -371,7 +376,7 @@ function ImageSelector(prop) {
371
376
  onClick: confirmImage
372
377
  }, "\u786E\u8BA4")),
373
378
  getContainer: function getContainer() {
374
- return (top || window).document.body;
379
+ return win.document.body;
375
380
  }
376
381
  }, modalProps), /*#__PURE__*/React.createElement("div", {
377
382
  style: {
package/es/utils/index.js CHANGED
@@ -335,11 +335,16 @@ _message.config({
335
335
  /** @name 显示错误 */
336
336
  export var showError = function showError(text) {
337
337
  var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
338
+ var win = top || window;
339
+ //@ts-ignore
340
+ if (!win.lsAppList) {
341
+ win = window;
342
+ }
338
343
  _message.error({
339
344
  content: text,
340
345
  duration: duration,
341
346
  getPopupContainer: function getPopupContainer(e) {
342
- return getFullScreenElement() || (top || window).document.body;
347
+ return getFullScreenElement() || win.document.body;
343
348
  },
344
349
  onClick: function onClick(e) {
345
350
  var _e$target;
@@ -353,11 +358,16 @@ export var showError = function showError(text) {
353
358
  /** @name 显示警示 */
354
359
  export var showWarn = function showWarn(text) {
355
360
  var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
361
+ var win = top || window;
362
+ //@ts-ignore
363
+ if (!win.lsAppList) {
364
+ win = window;
365
+ }
356
366
  _message.warn({
357
367
  content: text,
358
368
  duration: duration,
359
369
  getPopupContainer: function getPopupContainer(e) {
360
- return getFullScreenElement() || (top || window).document.body;
370
+ return getFullScreenElement() || win.document.body;
361
371
  },
362
372
  onClick: function onClick(e) {
363
373
  var _e$target2;
@@ -371,11 +381,16 @@ export var showWarn = function showWarn(text) {
371
381
  /** @name 显示成功 */
372
382
  export var showSuccess = function showSuccess(text) {
373
383
  var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
384
+ var win = top || window;
385
+ //@ts-ignore
386
+ if (!win.lsAppList) {
387
+ win = window;
388
+ }
374
389
  _message.success({
375
390
  content: text,
376
391
  duration: duration,
377
392
  getPopupContainer: function getPopupContainer(e) {
378
- return getFullScreenElement() || (top || window).document.body;
393
+ return getFullScreenElement() || win.document.body;
379
394
  },
380
395
  onClick: function onClick(e) {
381
396
  var _e$target3;
@@ -398,11 +413,16 @@ export var showAlert = function showAlert(text) {
398
413
  var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '系统提示';
399
414
  var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'error';
400
415
  var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
416
+ var win = top || window;
417
+ //@ts-ignore
418
+ if (!win.lsAppList) {
419
+ win = window;
420
+ }
401
421
  return new Promise(function (resolve, reject) {
402
422
  _Modal[type](_objectSpread({
403
423
  content: text,
404
424
  title: title,
405
- getContainer: getFullScreenElement() || (top || window).document.body,
425
+ getContainer: getFullScreenElement() || win.document.body,
406
426
  onOk: function onOk() {
407
427
  resolve(true);
408
428
  },
@@ -424,6 +444,11 @@ export var exitAlert = function exitAlert() {
424
444
  export var showConfirm = function showConfirm(text) {
425
445
  var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '系统提示';
426
446
  return new Promise(function (resolve, reject) {
447
+ var win = top || window;
448
+ //@ts-ignore
449
+ if (!win.lsAppList) {
450
+ win = window;
451
+ }
427
452
  _Modal.confirm({
428
453
  title: title,
429
454
  content: text,
@@ -433,7 +458,7 @@ export var showConfirm = function showConfirm(text) {
433
458
  cancelButtonProps: {
434
459
  className: 'ant-btn-gray'
435
460
  },
436
- getContainer: getFullScreenElement() || (top || window).document.body,
461
+ getContainer: getFullScreenElement() || win.document.body,
437
462
  onOk: function onOk() {
438
463
  resolve(true);
439
464
  },
@@ -451,11 +476,16 @@ var timeout = false;
451
476
  export var reLogin = function reLogin() {
452
477
  if (timeout) return;
453
478
  timeout = true;
479
+ var win = top || window;
480
+ //@ts-ignore
481
+ if (!win.lsAppList) {
482
+ win = window;
483
+ }
454
484
  _Modal.warning({
455
485
  title: '登录状态已过期,请重新登录',
456
486
  okText: '重新登录',
457
487
  maskClosable: false,
458
- getContainer: getFullScreenElement() || (top || window).document.body,
488
+ getContainer: getFullScreenElement() || win.document.body,
459
489
  afterClose: function afterClose() {
460
490
  timeout = false;
461
491
  (window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
@@ -254,6 +254,11 @@ function ImageSelector(prop) {
254
254
  formRef.current.setFieldsValue(_objectSpread({}, formValue));
255
255
  }
256
256
  };
257
+ var win = top || window;
258
+ //@ts-ignore
259
+ if (!win.lsAppList) {
260
+ win = window;
261
+ }
257
262
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ProFormText, _extends({
258
263
  name: name
259
264
  }, rest), isInput ? /*#__PURE__*/React.createElement(_Input, _extends({
@@ -371,7 +376,7 @@ function ImageSelector(prop) {
371
376
  onClick: confirmImage
372
377
  }, "\u786E\u8BA4")),
373
378
  getContainer: function getContainer() {
374
- return (top || window).document.body;
379
+ return win.document.body;
375
380
  }
376
381
  }, modalProps), /*#__PURE__*/React.createElement("div", {
377
382
  style: {
@@ -335,11 +335,16 @@ _message.config({
335
335
  /** @name 显示错误 */
336
336
  export var showError = function showError(text) {
337
337
  var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
338
+ var win = top || window;
339
+ //@ts-ignore
340
+ if (!win.lsAppList) {
341
+ win = window;
342
+ }
338
343
  _message.error({
339
344
  content: text,
340
345
  duration: duration,
341
346
  getPopupContainer: function getPopupContainer(e) {
342
- return getFullScreenElement() || (top || window).document.body;
347
+ return getFullScreenElement() || win.document.body;
343
348
  },
344
349
  onClick: function onClick(e) {
345
350
  var _e$target;
@@ -353,11 +358,16 @@ export var showError = function showError(text) {
353
358
  /** @name 显示警示 */
354
359
  export var showWarn = function showWarn(text) {
355
360
  var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
361
+ var win = top || window;
362
+ //@ts-ignore
363
+ if (!win.lsAppList) {
364
+ win = window;
365
+ }
356
366
  _message.warn({
357
367
  content: text,
358
368
  duration: duration,
359
369
  getPopupContainer: function getPopupContainer(e) {
360
- return getFullScreenElement() || (top || window).document.body;
370
+ return getFullScreenElement() || win.document.body;
361
371
  },
362
372
  onClick: function onClick(e) {
363
373
  var _e$target2;
@@ -371,11 +381,16 @@ export var showWarn = function showWarn(text) {
371
381
  /** @name 显示成功 */
372
382
  export var showSuccess = function showSuccess(text) {
373
383
  var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
384
+ var win = top || window;
385
+ //@ts-ignore
386
+ if (!win.lsAppList) {
387
+ win = window;
388
+ }
374
389
  _message.success({
375
390
  content: text,
376
391
  duration: duration,
377
392
  getPopupContainer: function getPopupContainer(e) {
378
- return getFullScreenElement() || (top || window).document.body;
393
+ return getFullScreenElement() || win.document.body;
379
394
  },
380
395
  onClick: function onClick(e) {
381
396
  var _e$target3;
@@ -398,11 +413,16 @@ export var showAlert = function showAlert(text) {
398
413
  var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '系统提示';
399
414
  var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'error';
400
415
  var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
416
+ var win = top || window;
417
+ //@ts-ignore
418
+ if (!win.lsAppList) {
419
+ win = window;
420
+ }
401
421
  return new Promise(function (resolve, reject) {
402
422
  _Modal[type](_objectSpread({
403
423
  content: text,
404
424
  title: title,
405
- getContainer: getFullScreenElement() || (top || window).document.body,
425
+ getContainer: getFullScreenElement() || win.document.body,
406
426
  onOk: function onOk() {
407
427
  resolve(true);
408
428
  },
@@ -424,6 +444,11 @@ export var exitAlert = function exitAlert() {
424
444
  export var showConfirm = function showConfirm(text) {
425
445
  var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '系统提示';
426
446
  return new Promise(function (resolve, reject) {
447
+ var win = top || window;
448
+ //@ts-ignore
449
+ if (!win.lsAppList) {
450
+ win = window;
451
+ }
427
452
  _Modal.confirm({
428
453
  title: title,
429
454
  content: text,
@@ -433,7 +458,7 @@ export var showConfirm = function showConfirm(text) {
433
458
  cancelButtonProps: {
434
459
  className: 'ant-btn-gray'
435
460
  },
436
- getContainer: getFullScreenElement() || (top || window).document.body,
461
+ getContainer: getFullScreenElement() || win.document.body,
437
462
  onOk: function onOk() {
438
463
  resolve(true);
439
464
  },
@@ -451,11 +476,16 @@ var timeout = false;
451
476
  export var reLogin = function reLogin() {
452
477
  if (timeout) return;
453
478
  timeout = true;
479
+ var win = top || window;
480
+ //@ts-ignore
481
+ if (!win.lsAppList) {
482
+ win = window;
483
+ }
454
484
  _Modal.warning({
455
485
  title: '登录状态已过期,请重新登录',
456
486
  okText: '重新登录',
457
487
  maskClosable: false,
458
- getContainer: getFullScreenElement() || (top || window).document.body,
488
+ getContainer: getFullScreenElement() || win.document.body,
459
489
  afterClose: function afterClose() {
460
490
  timeout = false;
461
491
  (window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "3.0.35",
3
+ "version": "3.0.36",
4
4
  "description": "ls-pro-common",
5
5
  "license": "MIT",
6
6
  "sideEffects": [