shineout 1.12.4-beta.4 → 1.12.4

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.
@@ -49,9 +49,10 @@ var PICKER_V_MARGIN = 4;
49
49
  var root;
50
50
 
51
51
  function initRoot() {
52
+ var defaultContainer = (0, _config.getDefaultContainer)();
52
53
  root = document.createElement('div');
53
54
  root.className = (0, _styles.listClass)('root', (0, _config.isRTL)() && 'rtl');
54
- document.body.appendChild(root);
55
+ defaultContainer.appendChild(root);
55
56
  }
56
57
 
57
58
  function getRoot() {
@@ -162,7 +163,8 @@ function _default(List) {
162
163
  }
163
164
 
164
165
  var container = this.container;
165
- var rootContainer = container === getRoot() || !container ? document.body : container;
166
+ var defaultContainer = (0, _config.getDefaultContainer)();
167
+ var rootContainer = container === getRoot() || !container ? defaultContainer : container;
166
168
  var containerRect = rootContainer.getBoundingClientRect();
167
169
  var containerScroll = {
168
170
  left: rootContainer.scrollLeft,
@@ -11,6 +11,8 @@ var _reactDom = _interopRequireDefault(require("react-dom"));
11
11
 
12
12
  var _Gallery = _interopRequireDefault(require("./Gallery"));
13
13
 
14
+ var _config = require("../config");
15
+
14
16
  var _styles = require("./styles");
15
17
 
16
18
  var container;
@@ -31,8 +33,9 @@ function keyClose(e) {
31
33
 
32
34
  function getContainer() {
33
35
  if (container) return container;
36
+ var defaultContainer = (0, _config.getDefaultContainer)();
34
37
  container = document.createElement('div');
35
- document.body.appendChild(container);
38
+ defaultContainer.appendChild(container);
36
39
  container.className = (0, _styles.imageClass)('gallery');
37
40
  return container;
38
41
  }
@@ -14,13 +14,16 @@ var _styles = require("./styles");
14
14
 
15
15
  var _Container = _interopRequireDefault(require("./Container"));
16
16
 
17
+ var _config = require("../config");
18
+
17
19
  var elements = {};
18
20
  var components = {};
19
21
 
20
22
  function getElement(type) {
23
+ var defaultContainer = (0, _config.getDefaultContainer)();
21
24
  var div = document.createElement('div');
22
25
  div.className = (0, _styles.messageClass)('_', type);
23
- document.body.appendChild(div);
26
+ defaultContainer.appendChild(div);
24
27
  elements[type] = div;
25
28
  return div;
26
29
  }
@@ -101,11 +101,12 @@ function close(props, callback) {
101
101
  }
102
102
 
103
103
  function createDiv(props) {
104
+ var defaultContainer = (0, _config.getDefaultContainer)();
104
105
  var id = props.id,
105
106
  position = props.position,
106
107
  fullScreen = props.fullScreen,
107
108
  _props$container = props.container,
108
- container = _props$container === void 0 ? document.body : _props$container;
109
+ container = _props$container === void 0 ? defaultContainer : _props$container;
109
110
  var div = getDiv(props.id);
110
111
  if (div) return div;
111
112
  var parent = typeof container === 'function' ? container() : container;
package/css/config.js CHANGED
@@ -6,10 +6,13 @@ exports.__esModule = true;
6
6
  exports.set = set;
7
7
  exports.setConfig = setConfig;
8
8
  exports.isRTL = isRTL;
9
+ exports.getDefaultContainer = getDefaultContainer;
9
10
  exports.default = exports.noti = void 0;
10
11
 
11
12
  var _objects = require("./utils/objects");
12
13
 
14
+ var _is = require("./utils/is");
15
+
13
16
  var _notification = _interopRequireDefault(require("./utils/notification"));
14
17
 
15
18
  var noti = new _notification.default();
@@ -24,7 +27,8 @@ var config = {
24
27
  trim: undefined,
25
28
  spin: undefined,
26
29
  caret: undefined,
27
- direction: 'ltr'
30
+ direction: 'ltr',
31
+ popupContainer: undefined
28
32
  };
29
33
  var _default = config;
30
34
  exports.default = _default;
@@ -56,4 +60,17 @@ function setConfig(conf) {
56
60
 
57
61
  function isRTL() {
58
62
  return config.direction === 'rtl';
63
+ }
64
+
65
+ function getDefaultContainer() {
66
+ if ((0, _is.isFunc)(config.popupContainer)) {
67
+ var container = config.popupContainer();
68
+
69
+ if (container instanceof HTMLElement) {
70
+ return container;
71
+ }
72
+ }
73
+
74
+ if (config.popupContainer instanceof HTMLElement) return config.popupContainer;
75
+ return document.body;
59
76
  }
package/css/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import * as utils from './utils'
3
3
 
4
4
  declare const __default: {
5
5
  utils: typeof utils,
6
- version: '1.12.4-beta.4'
6
+ version: '1.12.4'
7
7
  }
8
8
 
9
9
  export default __default
package/css/index.js CHANGED
@@ -224,6 +224,6 @@ exports.Upload = _Upload.default;
224
224
  // Created by scripts/src-index.js.
225
225
  var _default = {
226
226
  utils: utils,
227
- version: '1.12.4-beta.4'
227
+ version: '1.12.4'
228
228
  };
229
229
  exports.default = _default;
@@ -1,17 +1,16 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  exports.__esModule = true;
6
4
  exports.default = void 0;
7
5
 
8
- var _ready = _interopRequireDefault(require("./ready"));
9
-
10
6
  var _isInDocument = require("./isInDocument");
11
7
 
8
+ var _config = require("../../config");
9
+
12
10
  /**
13
11
  * 最外层容器
14
12
  */
13
+ // import ready from './ready'
15
14
  var Container = null;
16
15
 
17
16
  var getContainer = function getContainer() {
@@ -21,9 +20,8 @@ var getContainer = function getContainer() {
21
20
 
22
21
  Container = document.createElement('div');
23
22
  Container.setAttribute('style', 'position: absolute; top: 0; left: 0; width: 100%; contain: size');
24
- (0, _ready.default)(function () {
25
- document.body.appendChild(Container);
26
- });
23
+ var target = (0, _config.getDefaultContainer)();
24
+ target.appendChild(Container);
27
25
  return Container;
28
26
  };
29
27