ls-pro-common 3.0.34 → 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 document.body;
379
+ return win.document.body;
375
380
  }
376
381
  }, modalProps), /*#__PURE__*/React.createElement("div", {
377
382
  style: {
@@ -343,6 +343,12 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
343
343
  (_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : (_tableRef$current2$cl = _tableRef$current2.clearSelected) === null || _tableRef$current2$cl === void 0 ? void 0 : _tableRef$current2$cl.call(_tableRef$current2);
344
344
  }
345
345
  }, [text, multiple]);
346
+ useEffect(function () {
347
+ if (visible && loadOnShow) {
348
+ var _tableRef$current3, _tableRef$current3$re;
349
+ (_tableRef$current3 = tableRef.current) === null || _tableRef$current3 === void 0 ? void 0 : (_tableRef$current3$re = _tableRef$current3.reload) === null || _tableRef$current3$re === void 0 ? void 0 : _tableRef$current3$re.call(_tableRef$current3);
350
+ }
351
+ }, [visible, loadOnShow]);
346
352
  var tableDom = /*#__PURE__*/React.createElement(ProTable, _extends({
347
353
  className: "ls-input-table",
348
354
  columns: columns,
package/es/utils/index.js CHANGED
@@ -334,34 +334,70 @@ _message.config({
334
334
  });
335
335
  /** @name 显示错误 */
336
336
  export var showError = function showError(text) {
337
- var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 4;
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() || document.body;
347
+ return getFullScreenElement() || win.document.body;
348
+ },
349
+ onClick: function onClick(e) {
350
+ var _e$target;
351
+ var tag = (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.tagName.toLowerCase();
352
+ if (tag === 'img' || tag === 'path' || tag === 'svg') {
353
+ _message.destroy();
354
+ }
343
355
  }
344
356
  });
345
357
  };
346
358
  /** @name 显示警示 */
347
359
  export var showWarn = function showWarn(text) {
348
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
+ }
349
366
  _message.warn({
350
367
  content: text,
351
368
  duration: duration,
352
369
  getPopupContainer: function getPopupContainer(e) {
353
- return getFullScreenElement() || document.body;
370
+ return getFullScreenElement() || win.document.body;
371
+ },
372
+ onClick: function onClick(e) {
373
+ var _e$target2;
374
+ var tag = (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.tagName.toLowerCase();
375
+ if (tag === 'img' || tag === 'path' || tag === 'svg') {
376
+ _message.destroy();
377
+ }
354
378
  }
355
379
  });
356
380
  };
357
381
  /** @name 显示成功 */
358
382
  export var showSuccess = function showSuccess(text) {
359
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
+ }
360
389
  _message.success({
361
390
  content: text,
362
391
  duration: duration,
363
392
  getPopupContainer: function getPopupContainer(e) {
364
- return getFullScreenElement() || document.body;
393
+ return getFullScreenElement() || win.document.body;
394
+ },
395
+ onClick: function onClick(e) {
396
+ var _e$target3;
397
+ var tag = (_e$target3 = e.target) === null || _e$target3 === void 0 ? void 0 : _e$target3.tagName.toLowerCase();
398
+ if (tag === 'img' || tag === 'path' || tag === 'svg') {
399
+ _message.destroy();
400
+ }
365
401
  }
366
402
  });
367
403
  };
@@ -377,11 +413,16 @@ export var showAlert = function showAlert(text) {
377
413
  var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '系统提示';
378
414
  var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'error';
379
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
+ }
380
421
  return new Promise(function (resolve, reject) {
381
422
  _Modal[type](_objectSpread({
382
423
  content: text,
383
424
  title: title,
384
- getContainer: getFullScreenElement() || document.body,
425
+ getContainer: getFullScreenElement() || win.document.body,
385
426
  onOk: function onOk() {
386
427
  resolve(true);
387
428
  },
@@ -403,6 +444,11 @@ export var exitAlert = function exitAlert() {
403
444
  export var showConfirm = function showConfirm(text) {
404
445
  var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '系统提示';
405
446
  return new Promise(function (resolve, reject) {
447
+ var win = top || window;
448
+ //@ts-ignore
449
+ if (!win.lsAppList) {
450
+ win = window;
451
+ }
406
452
  _Modal.confirm({
407
453
  title: title,
408
454
  content: text,
@@ -412,7 +458,7 @@ export var showConfirm = function showConfirm(text) {
412
458
  cancelButtonProps: {
413
459
  className: 'ant-btn-gray'
414
460
  },
415
- getContainer: getFullScreenElement() || document.body,
461
+ getContainer: getFullScreenElement() || win.document.body,
416
462
  onOk: function onOk() {
417
463
  resolve(true);
418
464
  },
@@ -430,10 +476,16 @@ var timeout = false;
430
476
  export var reLogin = function reLogin() {
431
477
  if (timeout) return;
432
478
  timeout = true;
479
+ var win = top || window;
480
+ //@ts-ignore
481
+ if (!win.lsAppList) {
482
+ win = window;
483
+ }
433
484
  _Modal.warning({
434
485
  title: '登录状态已过期,请重新登录',
435
486
  okText: '重新登录',
436
487
  maskClosable: false,
488
+ getContainer: getFullScreenElement() || win.document.body,
437
489
  afterClose: function afterClose() {
438
490
  timeout = false;
439
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 document.body;
379
+ return win.document.body;
375
380
  }
376
381
  }, modalProps), /*#__PURE__*/React.createElement("div", {
377
382
  style: {
@@ -343,6 +343,12 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
343
343
  (_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : (_tableRef$current2$cl = _tableRef$current2.clearSelected) === null || _tableRef$current2$cl === void 0 ? void 0 : _tableRef$current2$cl.call(_tableRef$current2);
344
344
  }
345
345
  }, [text, multiple]);
346
+ useEffect(function () {
347
+ if (visible && loadOnShow) {
348
+ var _tableRef$current3, _tableRef$current3$re;
349
+ (_tableRef$current3 = tableRef.current) === null || _tableRef$current3 === void 0 ? void 0 : (_tableRef$current3$re = _tableRef$current3.reload) === null || _tableRef$current3$re === void 0 ? void 0 : _tableRef$current3$re.call(_tableRef$current3);
350
+ }
351
+ }, [visible, loadOnShow]);
346
352
  var tableDom = /*#__PURE__*/React.createElement(ProTable, _extends({
347
353
  className: "ls-input-table",
348
354
  columns: columns,
@@ -334,34 +334,70 @@ _message.config({
334
334
  });
335
335
  /** @name 显示错误 */
336
336
  export var showError = function showError(text) {
337
- var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 4;
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() || document.body;
347
+ return getFullScreenElement() || win.document.body;
348
+ },
349
+ onClick: function onClick(e) {
350
+ var _e$target;
351
+ var tag = (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.tagName.toLowerCase();
352
+ if (tag === 'img' || tag === 'path' || tag === 'svg') {
353
+ _message.destroy();
354
+ }
343
355
  }
344
356
  });
345
357
  };
346
358
  /** @name 显示警示 */
347
359
  export var showWarn = function showWarn(text) {
348
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
+ }
349
366
  _message.warn({
350
367
  content: text,
351
368
  duration: duration,
352
369
  getPopupContainer: function getPopupContainer(e) {
353
- return getFullScreenElement() || document.body;
370
+ return getFullScreenElement() || win.document.body;
371
+ },
372
+ onClick: function onClick(e) {
373
+ var _e$target2;
374
+ var tag = (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.tagName.toLowerCase();
375
+ if (tag === 'img' || tag === 'path' || tag === 'svg') {
376
+ _message.destroy();
377
+ }
354
378
  }
355
379
  });
356
380
  };
357
381
  /** @name 显示成功 */
358
382
  export var showSuccess = function showSuccess(text) {
359
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
+ }
360
389
  _message.success({
361
390
  content: text,
362
391
  duration: duration,
363
392
  getPopupContainer: function getPopupContainer(e) {
364
- return getFullScreenElement() || document.body;
393
+ return getFullScreenElement() || win.document.body;
394
+ },
395
+ onClick: function onClick(e) {
396
+ var _e$target3;
397
+ var tag = (_e$target3 = e.target) === null || _e$target3 === void 0 ? void 0 : _e$target3.tagName.toLowerCase();
398
+ if (tag === 'img' || tag === 'path' || tag === 'svg') {
399
+ _message.destroy();
400
+ }
365
401
  }
366
402
  });
367
403
  };
@@ -377,11 +413,16 @@ export var showAlert = function showAlert(text) {
377
413
  var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '系统提示';
378
414
  var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'error';
379
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
+ }
380
421
  return new Promise(function (resolve, reject) {
381
422
  _Modal[type](_objectSpread({
382
423
  content: text,
383
424
  title: title,
384
- getContainer: getFullScreenElement() || document.body,
425
+ getContainer: getFullScreenElement() || win.document.body,
385
426
  onOk: function onOk() {
386
427
  resolve(true);
387
428
  },
@@ -403,6 +444,11 @@ export var exitAlert = function exitAlert() {
403
444
  export var showConfirm = function showConfirm(text) {
404
445
  var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '系统提示';
405
446
  return new Promise(function (resolve, reject) {
447
+ var win = top || window;
448
+ //@ts-ignore
449
+ if (!win.lsAppList) {
450
+ win = window;
451
+ }
406
452
  _Modal.confirm({
407
453
  title: title,
408
454
  content: text,
@@ -412,7 +458,7 @@ export var showConfirm = function showConfirm(text) {
412
458
  cancelButtonProps: {
413
459
  className: 'ant-btn-gray'
414
460
  },
415
- getContainer: getFullScreenElement() || document.body,
461
+ getContainer: getFullScreenElement() || win.document.body,
416
462
  onOk: function onOk() {
417
463
  resolve(true);
418
464
  },
@@ -430,10 +476,16 @@ var timeout = false;
430
476
  export var reLogin = function reLogin() {
431
477
  if (timeout) return;
432
478
  timeout = true;
479
+ var win = top || window;
480
+ //@ts-ignore
481
+ if (!win.lsAppList) {
482
+ win = window;
483
+ }
433
484
  _Modal.warning({
434
485
  title: '登录状态已过期,请重新登录',
435
486
  okText: '重新登录',
436
487
  maskClosable: false,
488
+ getContainer: getFullScreenElement() || win.document.body,
437
489
  afterClose: function afterClose() {
438
490
  timeout = false;
439
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.34",
3
+ "version": "3.0.36",
4
4
  "description": "ls-pro-common",
5
5
  "license": "MIT",
6
6
  "sideEffects": [
@@ -21,10 +21,11 @@
21
21
  ],
22
22
  "dependencies": {
23
23
  "@ant-design/icons": "^4.3.0",
24
- "ls-pro-table": "^3.0.22",
25
- "ls-pro-form": "^3.0.8",
24
+ "ls-pro-table": "^3.0.23",
25
+ "ls-pro-form": "^3.0.9",
26
26
  "ls-pro-descriptions": "^3.0.1",
27
27
  "ls-pro-card": "^3.0.3",
28
+ "ls-pro-utils": "^3.0.6",
28
29
  "@babel/runtime": "^7.16.3",
29
30
  "classnames": "^2.2.6",
30
31
  "moment": "^2.27.0",