1 | (function(modules) {
|
2 |
|
3 | var installedModules = {};
|
4 |
|
5 |
|
6 | function __webpack_require__(moduleId) {
|
7 |
|
8 |
|
9 | if(installedModules[moduleId])
|
10 | return installedModules[moduleId].exports;
|
11 |
|
12 |
|
13 | var module = installedModules[moduleId] = {
|
14 | exports: {},
|
15 | id: moduleId,
|
16 | loaded: false
|
17 | };
|
18 |
|
19 |
|
20 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21 |
|
22 |
|
23 | module.loaded = true;
|
24 |
|
25 |
|
26 | return module.exports;
|
27 | }
|
28 |
|
29 |
|
30 |
|
31 | __webpack_require__.m = modules;
|
32 |
|
33 |
|
34 | __webpack_require__.c = installedModules;
|
35 |
|
36 |
|
37 | __webpack_require__.p = "";
|
38 |
|
39 |
|
40 | return __webpack_require__(0);
|
41 | })
|
42 |
|
43 | ([
|
44 |
|
45 | (function(module, exports, __webpack_require__) {
|
46 |
|
47 | 'use strict';
|
48 |
|
49 | var _react = __webpack_require__(1);
|
50 |
|
51 | var _react2 = _interopRequireDefault(_react);
|
52 |
|
53 | var _reactDom = __webpack_require__(2);
|
54 |
|
55 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
56 |
|
57 | var _beeLayout = __webpack_require__(3);
|
58 |
|
59 | var _beePanel = __webpack_require__(9);
|
60 |
|
61 | var _beeDrawer = __webpack_require__(82);
|
62 |
|
63 | var _beeDrawer2 = _interopRequireDefault(_beeDrawer);
|
64 |
|
65 | var _beeClipboard = __webpack_require__(96);
|
66 |
|
67 | var _beeClipboard2 = _interopRequireDefault(_beeClipboard);
|
68 |
|
69 | var _src = __webpack_require__(157);
|
70 |
|
71 | var _src2 = _interopRequireDefault(_src);
|
72 |
|
73 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
74 |
|
75 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
76 |
|
77 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
78 |
|
79 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
80 |
|
81 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
82 |
|
83 | var Demo1 = __webpack_require__(161);var Demo2 = __webpack_require__(162);var Demo3 = __webpack_require__(163);var Demo4 = __webpack_require__(164);var Demo5 = __webpack_require__(165);var DemoArray = [{ "example": _react2['default'].createElement(Demo1, null), "title": " Radio 基本用法", "code": "/**\n * @title Radio 基本用法\n * @description `defaultValue`设置默认被选中的radio值,`disabled`参数设置是否可用,`onChange`是值改变的回调\n */\n\nimport React, { Component } from 'react'\nimport { } from 'tinper-bee';\nimport Radio from \"tinper-bee/lib/src\";\n\nclass Demo1 extends Component{\n constructor(props) {\n super(props);\n }\n handleChange = (value) => {\n console.log('onChange:',value)\n }\n render() {\n return (\n <Radio.RadioGroup\n name=\"fruits\"\n defaultValue=\"1\"\n onChange={this.handleChange}\n >\n <Radio value=\"1\" disabled>苹果</Radio>\n <Radio value=\"2\" disabled>香蕉</Radio>\n <Radio value=\"3\" >葡萄</Radio>\n <Radio value=\"4\" >菠萝</Radio>\n <Radio value=\"5\" >梨</Radio>\n <Radio value=\"6\" >石榴</Radio>\n </Radio.RadioGroup> \n )\n }\n};\n\n", "desc": " `defaultValue`设置默认被选中的radio值,`disabled`参数设置是否可用,`onChange`是值改变的回调" }, { "example": _react2['default'].createElement(Demo2, null), "title": " 不同颜色的radio", "code": "/**\r\n * @title 不同颜色的radio\r\n * @description `colors`参数控制背景色\r\n */\r\n\r\nimport React, { Component } from 'react'\nimport { } from 'tinper-bee';\r\nimport Radio from \"tinper-bee/lib/src\";\r\n\r\n\r\n\r\nclass Demo2 extends Component{\r\n constructor(props) {\r\n \tsuper(props);\r\n \tthis.state = {\r\n \tselectedValue: '3'\r\n };\r\n }\r\n handleChange(value) {\r\n this.setState({selectedValue: value});\r\n }\r\n render() {\r\n return (\r\n <Radio.RadioGroup\r\n name=\"color\"\r\n selectedValue={this.state.selectedValue}\r\n onChange={this.handleChange.bind(this)}>\r\n <Radio colors=\"primary\" value=\"1\" >苹果</Radio>\r\n <Radio colors=\"success\" value=\"2\" >香蕉</Radio>\r\n <Radio colors=\"info\" value=\"3\" >葡萄</Radio>\r\n <Radio colors=\"warning\" value=\"4\" >菠萝</Radio>\r\n <Radio colors=\"danger\" value=\"5\" >梨</Radio>\r\n <Radio colors=\"dark\" value=\"6\" >石榴</Radio>\r\n </Radio.RadioGroup>\r\n )\r\n }\r\n};\r\n\r\n", "desc": " `colors`参数控制背景色" }, { "example": _react2['default'].createElement(Demo3, null), "title": " 竖方向Radio", "code": "/**\n * @title 竖方向Radio\n * @description 可以通过style来设置radio样式\n */\n\nimport React, { Component } from 'react'\nimport { } from 'tinper-bee';\nimport Radio from \"tinper-bee/lib/src\";\n\n\n\nclass Demo3 extends Component{\n constructor(props) {\n \tsuper(props);\n \tthis.state = {\n \tselectedValue: '1'\n };\n }\n handleChange(value) {\n this.setState({selectedValue: value});\n }\n render() {\n const radioStyle = {\n display: 'block'\n };\n return (\n <div className=\"demo3\">\n <Radio.RadioGroup\n name=\"team\"\n selectedValue={this.state.selectedValue}\n onChange={this.handleChange.bind(this)}>\n <Radio style={radioStyle} value=\"1\" >苹果</Radio>\n <Radio style={radioStyle} value=\"2\" >香蕉</Radio>\n <Radio style={radioStyle} value=\"3\" >葡萄</Radio>\n <Radio style={radioStyle} value=\"4\" >菠萝</Radio>\n <Radio style={radioStyle} value=\"5\" >梨</Radio>\n <Radio style={radioStyle} value=\"6\" >石榴</Radio>\n </Radio.RadioGroup>\n </div>\n )\n }\n};\n\n", "desc": " 可以通过style来设置radio样式", "scss_code": ".demo3 .u-radio-group .u-radio{\r\n margin-bottom: 8px;\r\n}" }, { "example": _react2['default'].createElement(Demo4, null), "title": " RadioButton 基本使用", "code": "/**\r\n * @title RadioButton 基本使用\r\n * @description `selectedValue`参数设置被选中的radio值,`onChange`设置值改变的回调\r\n */\r\n\r\nimport React, { Component } from 'react'\nimport { } from 'tinper-bee';\r\nimport Radio from \"tinper-bee/lib/src\";\r\n\r\nconst RadioGroup = Radio.RadioGroup;\r\n\r\nclass Demo4 extends Component{\r\n constructor(props) {\r\n \tsuper(props);\r\n \tthis.state = {\r\n selectedValue: 'orange',\r\n selectedValue2: 'apple'\r\n };\r\n }\r\n handleChange(value) {\r\n this.setState({selectedValue: value});\r\n }\r\n handleChange2(value) {\r\n this.setState({selectedValue2: value});\r\n }\r\n render() {\r\n return (\r\n <div>\r\n <Radio.RadioGroup\r\n name=\"fruit\"\r\n selectedValue={this.state.selectedValue}\r\n onChange={this.handleChange.bind(this)}>\r\n <Radio.RadioButton value=\"apple\">apple</Radio.RadioButton>\r\n <Radio.RadioButton value=\"banana\">banana</Radio.RadioButton>\r\n <Radio.RadioButton value=\"orange\">orange</Radio.RadioButton>\r\n </Radio.RadioGroup>\r\n\r\n <div style={{ marginTop: 16 }}>\r\n <Radio.RadioGroup \r\n selectedValue={this.state.selectedValue2}\r\n onChange={this.handleChange2.bind(this)}>\r\n <Radio.RadioButton value=\"apple\">apple</Radio.RadioButton>\r\n <Radio.RadioButton value=\"banana\" disabled>banana</Radio.RadioButton>\r\n <Radio.RadioButton value=\"orange\">orange</Radio.RadioButton>\r\n </Radio.RadioGroup>\r\n </div>\r\n\r\n <div style={{ marginTop: 16 }}>\r\n <Radio.RadioGroup selectedValue=\"apple\">\r\n <Radio.RadioButton value=\"apple\" disabled>apple</Radio.RadioButton>\r\n <Radio.RadioButton value=\"banana\" disabled>banana</Radio.RadioButton>\r\n <Radio.RadioButton value=\"orange\" disabled>orange</Radio.RadioButton>\r\n </Radio.RadioGroup>\r\n </div>\r\n </div>\r\n\r\n )\r\n }\r\n};\r\n\r\n", "desc": " `selectedValue`参数设置被选中的radio值,`onChange`设置值改变的回调" }, { "example": _react2['default'].createElement(Demo5, null), "title": " 红色填充的 Radio", "code": "/**\r\n * @title 红色填充的 Radio\r\n * @description `inverse` 参数设置选中为红色填充。\r\n */\r\n\r\nimport React, { Component } from 'react'\nimport { } from 'tinper-bee';\r\nimport Radio from \"tinper-bee/lib/src\";\r\n\r\n\r\n\r\nclass Demo1 extends Component{\r\n constructor(props) {\r\n \tsuper(props);\r\n \tthis.state = {\r\n \tselectedValue: '1'\r\n };\r\n }\r\n handleChange(value) {\r\n this.setState({selectedValue: value});\r\n }\r\n render() {\r\n return (\r\n <Radio.RadioGroup\r\n name=\"fruits\"\r\n selectedValue={this.state.selectedValue}\r\n onChange={this.handleChange.bind(this)}>\r\n <Radio value=\"1\" inverse>苹果</Radio>\r\n <Radio value=\"2\" inverse>香蕉</Radio>\r\n <Radio value=\"3\" inverse>葡萄</Radio>\r\n </Radio.RadioGroup> \r\n )\r\n }\r\n};\r\n\r\n", "desc": " `inverse` 参数设置选中为红色填充。" }];
|
84 |
|
85 | var Demo = function (_Component) {
|
86 | _inherits(Demo, _Component);
|
87 |
|
88 | function Demo(props) {
|
89 | _classCallCheck(this, Demo);
|
90 |
|
91 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
92 |
|
93 | _this.handleClick = function () {
|
94 | _this.setState({ open: !_this.state.open });
|
95 | };
|
96 |
|
97 | _this.fCloseDrawer = function () {
|
98 | _this.setState({
|
99 | open: false
|
100 | });
|
101 | };
|
102 |
|
103 | _this.state = {
|
104 | open: false
|
105 | };
|
106 | return _this;
|
107 | }
|
108 |
|
109 | Demo.prototype.render = function render() {
|
110 | var _props = this.props,
|
111 | title = _props.title,
|
112 | example = _props.example,
|
113 | code = _props.code,
|
114 | desc = _props.desc,
|
115 | scss_code = _props.scss_code;
|
116 |
|
117 |
|
118 | var header = _react2['default'].createElement(
|
119 | 'div',
|
120 | null,
|
121 | _react2['default'].createElement(
|
122 | 'p',
|
123 | { className: 'component-title' },
|
124 | title
|
125 | ),
|
126 | _react2['default'].createElement(
|
127 | 'p',
|
128 | null,
|
129 | desc
|
130 | ),
|
131 | _react2['default'].createElement(
|
132 | 'span',
|
133 | { className: 'component-code', onClick: this.handleClick },
|
134 | ' \u67E5\u770B\u6E90\u7801 ',
|
135 | _react2['default'].createElement('i', { className: 'uf uf-arrow-right' }),
|
136 | ' '
|
137 | )
|
138 | );
|
139 | return _react2['default'].createElement(
|
140 | _beeLayout.Col,
|
141 | { md: 12, id: title.trim(), className: 'component-demo' },
|
142 | _react2['default'].createElement(
|
143 | _beePanel.Panel,
|
144 | { header: header },
|
145 | example
|
146 | ),
|
147 | _react2['default'].createElement(
|
148 | _beeDrawer2['default'],
|
149 | { className: 'component-drawerc', title: title, show: this.state.open, placement: 'right', onClose: this.fCloseDrawer },
|
150 | _react2['default'].createElement(
|
151 | 'div',
|
152 | { className: 'component-code-copy' },
|
153 | ' JS\u4EE3\u7801',
|
154 | _react2['default'].createElement(_beeClipboard2['default'], { action: 'copy', text: code })
|
155 | ),
|
156 | _react2['default'].createElement(
|
157 | 'pre',
|
158 | { className: 'pre-js' },
|
159 | _react2['default'].createElement(
|
160 | 'code',
|
161 | { className: 'hljs javascript' },
|
162 | code
|
163 | )
|
164 | ),
|
165 | !!scss_code ? _react2['default'].createElement(
|
166 | 'div',
|
167 | { className: 'component-code-copy copy-css' },
|
168 | ' SCSS\u4EE3\u7801',
|
169 | _react2['default'].createElement(_beeClipboard2['default'], { action: 'copy', text: scss_code })
|
170 | ) : null,
|
171 | !!scss_code ? _react2['default'].createElement(
|
172 | 'pre',
|
173 | { className: 'pre-css' },
|
174 | _react2['default'].createElement(
|
175 | 'code',
|
176 | { className: 'hljs css' },
|
177 | scss_code
|
178 | )
|
179 | ) : null
|
180 | )
|
181 | );
|
182 | };
|
183 |
|
184 | return Demo;
|
185 | }(_react.Component);
|
186 |
|
187 | var DemoGroup = function (_Component2) {
|
188 | _inherits(DemoGroup, _Component2);
|
189 |
|
190 | function DemoGroup(props) {
|
191 | _classCallCheck(this, DemoGroup);
|
192 |
|
193 | return _possibleConstructorReturn(this, _Component2.call(this, props));
|
194 | }
|
195 |
|
196 | DemoGroup.prototype.render = function render() {
|
197 | return _react2['default'].createElement(
|
198 | _beeLayout.Row,
|
199 | null,
|
200 | DemoArray.map(function (child, index) {
|
201 |
|
202 | return _react2['default'].createElement(Demo, { example: child.example, title: child.title, code: child.code, scss_code: child.scss_code, desc: child.desc, key: index });
|
203 | })
|
204 | );
|
205 | };
|
206 |
|
207 | return DemoGroup;
|
208 | }(_react.Component);
|
209 |
|
210 | _reactDom2['default'].render(_react2['default'].createElement(DemoGroup, null), document.getElementById('tinperBeeDemo'));
|
211 |
|
212 | }),
|
213 |
|
214 | (function(module, exports) {
|
215 |
|
216 | module.exports = React;
|
217 |
|
218 | }),
|
219 |
|
220 | (function(module, exports) {
|
221 |
|
222 | module.exports = ReactDOM;
|
223 |
|
224 | }),
|
225 |
|
226 | (function(module, exports, __webpack_require__) {
|
227 |
|
228 | 'use strict';
|
229 |
|
230 | Object.defineProperty(exports, "__esModule", {
|
231 | value: true
|
232 | });
|
233 | exports.Con = exports.Row = exports.Col = undefined;
|
234 |
|
235 | var _Col2 = __webpack_require__(4);
|
236 |
|
237 | var _Col3 = _interopRequireDefault(_Col2);
|
238 |
|
239 | var _Row2 = __webpack_require__(7);
|
240 |
|
241 | var _Row3 = _interopRequireDefault(_Row2);
|
242 |
|
243 | var _Layout = __webpack_require__(8);
|
244 |
|
245 | var _Layout2 = _interopRequireDefault(_Layout);
|
246 |
|
247 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
248 |
|
249 | exports.Col = _Col3["default"];
|
250 | exports.Row = _Row3["default"];
|
251 | exports.Con = _Layout2["default"];
|
252 |
|
253 | }),
|
254 |
|
255 | (function(module, exports, __webpack_require__) {
|
256 |
|
257 | 'use strict';
|
258 |
|
259 | Object.defineProperty(exports, "__esModule", {
|
260 | value: true
|
261 | });
|
262 |
|
263 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
264 |
|
265 | var _classnames = __webpack_require__(5);
|
266 |
|
267 | var _classnames2 = _interopRequireDefault(_classnames);
|
268 |
|
269 | var _react = __webpack_require__(1);
|
270 |
|
271 | var _react2 = _interopRequireDefault(_react);
|
272 |
|
273 | var _propTypes = __webpack_require__(6);
|
274 |
|
275 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
276 |
|
277 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
278 |
|
279 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
280 |
|
281 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
282 |
|
283 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
284 |
|
285 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
286 |
|
287 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
288 |
|
289 | var propTypes = {
|
290 | componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string]),
|
291 |
|
292 | |
293 |
|
294 |
|
295 | xs: _propTypes2["default"].number,
|
296 | |
297 |
|
298 |
|
299 | sm: _propTypes2["default"].number,
|
300 | |
301 |
|
302 |
|
303 | md: _propTypes2["default"].number,
|
304 | |
305 |
|
306 |
|
307 | lg: _propTypes2["default"].number,
|
308 | |
309 |
|
310 |
|
311 | xsOffset: _propTypes2["default"].number,
|
312 | |
313 |
|
314 |
|
315 | smOffset: _propTypes2["default"].number,
|
316 | |
317 |
|
318 |
|
319 | mdOffset: _propTypes2["default"].number,
|
320 | |
321 |
|
322 |
|
323 | lgOffset: _propTypes2["default"].number,
|
324 | |
325 |
|
326 |
|
327 | xsPush: _propTypes2["default"].number,
|
328 | |
329 |
|
330 |
|
331 | smPush: _propTypes2["default"].number,
|
332 | |
333 |
|
334 |
|
335 | mdPush: _propTypes2["default"].number,
|
336 | |
337 |
|
338 |
|
339 | lgPush: _propTypes2["default"].number,
|
340 | |
341 |
|
342 |
|
343 | xsPull: _propTypes2["default"].number,
|
344 | |
345 |
|
346 |
|
347 | smPull: _propTypes2["default"].number,
|
348 | |
349 |
|
350 |
|
351 | mdPull: _propTypes2["default"].number,
|
352 | |
353 |
|
354 |
|
355 | lgPull: _propTypes2["default"].number
|
356 | };
|
357 |
|
358 | var defaultProps = {
|
359 | componentClass: 'div',
|
360 | clsPrefix: 'u-col'
|
361 | };
|
362 |
|
363 | var DEVICE_SIZES = ['lg', 'md', 'sm', 'xs'];
|
364 |
|
365 | var Col = function (_Component) {
|
366 | _inherits(Col, _Component);
|
367 |
|
368 | function Col() {
|
369 | _classCallCheck(this, Col);
|
370 |
|
371 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
372 | }
|
373 |
|
374 | Col.prototype.render = function render() {
|
375 | var _props = this.props,
|
376 | Component = _props.componentClass,
|
377 | className = _props.className,
|
378 | clsPrefix = _props.clsPrefix,
|
379 | others = _objectWithoutProperties(_props, ['componentClass', 'className', 'clsPrefix']);
|
380 |
|
381 | var tbClass = [];
|
382 | |
383 |
|
384 |
|
385 |
|
386 | DEVICE_SIZES.forEach(function (size) {
|
387 | function popProp(propSuffix, modifier) {
|
388 | var propName = '' + size + propSuffix;
|
389 | var propValue = others[propName];
|
390 |
|
391 | if (propValue != undefined && propValue != null) {
|
392 | tbClass.push(clsPrefix + '-' + size + modifier + '-' + propValue);
|
393 | }
|
394 |
|
395 | delete others[propName];
|
396 | }
|
397 |
|
398 | popProp('', '');
|
399 | popProp('Offset', '-offset');
|
400 | popProp('Push', '-push');
|
401 | popProp('Pull', '-pull');
|
402 | });
|
403 |
|
404 | return _react2["default"].createElement(
|
405 | Component,
|
406 | _extends({
|
407 | className: (0, _classnames2["default"])(tbClass, className)
|
408 | }, others),
|
409 | this.props.children
|
410 | );
|
411 | };
|
412 |
|
413 | return Col;
|
414 | }(_react.Component);
|
415 |
|
416 | Col.defaultProps = defaultProps;
|
417 | Col.propTypes = propTypes;
|
418 |
|
419 | exports["default"] = Col;
|
420 | module.exports = exports['default'];
|
421 |
|
422 | }),
|
423 |
|
424 | (function(module, exports, __webpack_require__) {
|
425 |
|
426 | var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; |
427 |
|
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 | (function () {
|
434 | 'use strict';
|
435 |
|
436 | var hasOwn = {}.hasOwnProperty;
|
437 |
|
438 | function classNames () {
|
439 | var classes = [];
|
440 |
|
441 | for (var i = 0; i < arguments.length; i++) {
|
442 | var arg = arguments[i];
|
443 | if (!arg) continue;
|
444 |
|
445 | var argType = typeof arg;
|
446 |
|
447 | if (argType === 'string' || argType === 'number') {
|
448 | classes.push(arg);
|
449 | } else if (Array.isArray(arg) && arg.length) {
|
450 | var inner = classNames.apply(null, arg);
|
451 | if (inner) {
|
452 | classes.push(inner);
|
453 | }
|
454 | } else if (argType === 'object') {
|
455 | for (var key in arg) {
|
456 | if (hasOwn.call(arg, key) && arg[key]) {
|
457 | classes.push(key);
|
458 | }
|
459 | }
|
460 | }
|
461 | }
|
462 |
|
463 | return classes.join(' ');
|
464 | }
|
465 |
|
466 | if (typeof module !== 'undefined' && module.exports) {
|
467 | classNames.default = classNames;
|
468 | module.exports = classNames;
|
469 | } else if (true) {
|
470 |
|
471 | !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
|
472 | return classNames;
|
473 | }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
474 | } else {
|
475 | window.classNames = classNames;
|
476 | }
|
477 | }());
|
478 |
|
479 |
|
480 | }),
|
481 |
|
482 | (function(module, exports) {
|
483 |
|
484 | module.exports = PropTypes;
|
485 |
|
486 | }),
|
487 |
|
488 | (function(module, exports, __webpack_require__) {
|
489 |
|
490 | 'use strict';
|
491 |
|
492 | Object.defineProperty(exports, "__esModule", {
|
493 | value: true
|
494 | });
|
495 |
|
496 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
497 |
|
498 | var _classnames = __webpack_require__(5);
|
499 |
|
500 | var _classnames2 = _interopRequireDefault(_classnames);
|
501 |
|
502 | var _react = __webpack_require__(1);
|
503 |
|
504 | var _react2 = _interopRequireDefault(_react);
|
505 |
|
506 | var _propTypes = __webpack_require__(6);
|
507 |
|
508 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
509 |
|
510 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
511 |
|
512 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
513 |
|
514 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
515 |
|
516 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
517 |
|
518 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
519 |
|
520 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
521 |
|
522 | var propTypes = {
|
523 | componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string])
|
524 | };
|
525 |
|
526 | var defaultProps = {
|
527 | componentClass: 'div',
|
528 | clsPrefix: 'u-row'
|
529 | };
|
530 |
|
531 | var Row = function (_Component) {
|
532 | _inherits(Row, _Component);
|
533 |
|
534 | function Row() {
|
535 | _classCallCheck(this, Row);
|
536 |
|
537 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
538 | }
|
539 |
|
540 | Row.prototype.render = function render() {
|
541 | var _props = this.props,
|
542 | Component = _props.componentClass,
|
543 | clsPrefix = _props.clsPrefix,
|
544 | className = _props.className,
|
545 | others = _objectWithoutProperties(_props, ['componentClass', 'clsPrefix', 'className']);
|
546 |
|
547 | var bsclass = '' + clsPrefix;
|
548 |
|
549 | return _react2["default"].createElement(
|
550 | Component,
|
551 | _extends({}, others, {
|
552 | className: (0, _classnames2["default"])(bsclass, className)
|
553 | }),
|
554 | this.props.children
|
555 | );
|
556 | };
|
557 |
|
558 | return Row;
|
559 | }(_react.Component);
|
560 |
|
561 | Row.propTypes = propTypes;
|
562 | Row.defaultProps = defaultProps;
|
563 |
|
564 | exports["default"] = Row;
|
565 | module.exports = exports['default'];
|
566 |
|
567 | }),
|
568 |
|
569 | (function(module, exports, __webpack_require__) {
|
570 |
|
571 | 'use strict';
|
572 |
|
573 | Object.defineProperty(exports, "__esModule", {
|
574 | value: true
|
575 | });
|
576 |
|
577 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
578 |
|
579 | var _classnames = __webpack_require__(5);
|
580 |
|
581 | var _classnames2 = _interopRequireDefault(_classnames);
|
582 |
|
583 | var _react = __webpack_require__(1);
|
584 |
|
585 | var _react2 = _interopRequireDefault(_react);
|
586 |
|
587 | var _propTypes = __webpack_require__(6);
|
588 |
|
589 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
590 |
|
591 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
592 |
|
593 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
594 |
|
595 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
596 |
|
597 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
598 |
|
599 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
600 |
|
601 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
602 |
|
603 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
604 |
|
605 | var propTypes = {
|
606 | |
607 |
|
608 |
|
609 | fluid: _propTypes2["default"].bool,
|
610 | |
611 |
|
612 |
|
613 | componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string])
|
614 | };
|
615 |
|
616 | var defaultProps = {
|
617 | componentClass: 'div',
|
618 | fluid: false,
|
619 | clsPrefix: 'u-container'
|
620 | };
|
621 |
|
622 | var Con = function (_React$Component) {
|
623 | _inherits(Con, _React$Component);
|
624 |
|
625 | function Con() {
|
626 | _classCallCheck(this, Con);
|
627 |
|
628 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
629 | }
|
630 |
|
631 | Con.prototype.render = function render() {
|
632 | var _tbclass;
|
633 |
|
634 | var _props = this.props,
|
635 | fluid = _props.fluid,
|
636 | Component = _props.componentClass,
|
637 | clsPrefix = _props.clsPrefix,
|
638 | className = _props.className,
|
639 | others = _objectWithoutProperties(_props, ['fluid', 'componentClass', 'clsPrefix', 'className']);
|
640 |
|
641 | var tbclass = (_tbclass = {}, _defineProperty(_tbclass, '' + clsPrefix, !fluid), _defineProperty(_tbclass, clsPrefix + '-fluid', fluid), _tbclass);
|
642 |
|
643 | return _react2["default"].createElement(
|
644 | Component,
|
645 | _extends({}, others, {
|
646 | className: (0, _classnames2["default"])(tbclass, className)
|
647 | }),
|
648 | this.props.children
|
649 | );
|
650 | };
|
651 |
|
652 | return Con;
|
653 | }(_react2["default"].Component);
|
654 |
|
655 | Con.propTypes = propTypes;
|
656 | Con.defaultProps = defaultProps;
|
657 |
|
658 | exports["default"] = Con;
|
659 | module.exports = exports['default'];
|
660 |
|
661 | }),
|
662 |
|
663 | (function(module, exports, __webpack_require__) {
|
664 |
|
665 | 'use strict';
|
666 |
|
667 | Object.defineProperty(exports, "__esModule", {
|
668 | value: true
|
669 | });
|
670 | exports.PanelGroup = exports.Panel = undefined;
|
671 |
|
672 | var _Panel2 = __webpack_require__(10);
|
673 |
|
674 | var _Panel3 = _interopRequireDefault(_Panel2);
|
675 |
|
676 | var _PanelGroup2 = __webpack_require__(81);
|
677 |
|
678 | var _PanelGroup3 = _interopRequireDefault(_PanelGroup2);
|
679 |
|
680 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
681 |
|
682 | exports.Panel = _Panel3["default"];
|
683 | exports.PanelGroup = _PanelGroup3["default"];
|
684 |
|
685 | }),
|
686 |
|
687 | (function(module, exports, __webpack_require__) {
|
688 |
|
689 | 'use strict';
|
690 |
|
691 | Object.defineProperty(exports, "__esModule", {
|
692 | value: true
|
693 | });
|
694 |
|
695 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
696 |
|
697 | var _classnames = __webpack_require__(5);
|
698 |
|
699 | var _classnames2 = _interopRequireDefault(_classnames);
|
700 |
|
701 | var _react = __webpack_require__(1);
|
702 |
|
703 | var _react2 = _interopRequireDefault(_react);
|
704 |
|
705 | var _beeTransition = __webpack_require__(11);
|
706 |
|
707 | var _beeMessage = __webpack_require__(65);
|
708 |
|
709 | var _beeMessage2 = _interopRequireDefault(_beeMessage);
|
710 |
|
711 | var _propTypes = __webpack_require__(6);
|
712 |
|
713 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
714 |
|
715 | var _copyToClipboard = __webpack_require__(79);
|
716 |
|
717 | var _copyToClipboard2 = _interopRequireDefault(_copyToClipboard);
|
718 |
|
719 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
720 |
|
721 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
722 |
|
723 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
724 |
|
725 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
726 |
|
727 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
728 |
|
729 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
730 |
|
731 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
732 |
|
733 | var propTypes = {
|
734 |
|
735 | collapsible: _propTypes2["default"].bool,
|
736 | onSelect: _propTypes2["default"].func,
|
737 |
|
738 | header: _propTypes2["default"].node,
|
739 | headerStyle: _propTypes2["default"].object,
|
740 | id: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
|
741 | headerContent: _propTypes2["default"].bool,
|
742 |
|
743 | footer: _propTypes2["default"].node,
|
744 | footerStyle: _propTypes2["default"].object,
|
745 |
|
746 | defaultExpanded: _propTypes2["default"].bool,
|
747 |
|
748 | expanded: _propTypes2["default"].bool,
|
749 |
|
750 | eventKey: _propTypes2["default"].any,
|
751 | headerRole: _propTypes2["default"].string,
|
752 | panelRole: _propTypes2["default"].string,
|
753 |
|
754 | colors: _propTypes2["default"].oneOf(['primary', 'accent', 'success', 'info', 'warning', 'danger', 'default', 'bordered']),
|
755 |
|
756 |
|
757 | onEnter: _propTypes2["default"].func,
|
758 | onEntering: _propTypes2["default"].func,
|
759 | onEntered: _propTypes2["default"].func,
|
760 | onExit: _propTypes2["default"].func,
|
761 | onExiting: _propTypes2["default"].func,
|
762 | onExited: _propTypes2["default"].func,
|
763 |
|
764 | copyable: _propTypes2["default"].bool
|
765 | };
|
766 |
|
767 | var defaultProps = {
|
768 | defaultExpanded: false,
|
769 | clsPrefix: "u-panel",
|
770 | colors: "default"
|
771 | };
|
772 |
|
773 | var Panel = function (_React$Component) {
|
774 | _inherits(Panel, _React$Component);
|
775 |
|
776 | function Panel(props, context) {
|
777 | _classCallCheck(this, Panel);
|
778 |
|
779 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
780 |
|
781 | _this.handleClickTitle = _this.handleClickTitle.bind(_this);
|
782 |
|
783 | _this.state = {
|
784 | expanded: _this.props.defaultExpanded
|
785 | };
|
786 | return _this;
|
787 | }
|
788 |
|
789 |
|
790 |
|
791 |
|
792 | Panel.prototype.handleClickTitle = function handleClickTitle(e) {
|
793 |
|
794 | e.persist();
|
795 | e.selected = true;
|
796 |
|
797 | if (this.props.onSelect) {
|
798 | this.props.onSelect(this.props.eventKey, e);
|
799 | } else {
|
800 | e.preventDefault();
|
801 | }
|
802 |
|
803 | if (e.selected) {
|
804 | this.setState({ expanded: !this.state.expanded });
|
805 | }
|
806 | };
|
807 |
|
808 |
|
809 |
|
810 |
|
811 | Panel.prototype.renderHeader = function renderHeader(collapsible, header, id, role, expanded, clsPrefix) {
|
812 | var titleClassName = clsPrefix + '-title';
|
813 |
|
814 | if (!collapsible) {
|
815 | if (!_react2["default"].isValidElement(header)) {
|
816 | return header;
|
817 | }
|
818 |
|
819 | return (0, _react.cloneElement)(header, {
|
820 | className: (0, _classnames2["default"])(header.props.className, titleClassName)
|
821 | });
|
822 | }
|
823 |
|
824 | if (!_react2["default"].isValidElement(header)) {
|
825 | return _react2["default"].createElement(
|
826 | 'h4',
|
827 | { role: 'presentation', className: titleClassName },
|
828 | this.renderAnchor(header, id, role, expanded)
|
829 | );
|
830 | }
|
831 | if (this.props.headerContent) {
|
832 | return (0, _react.cloneElement)(header, {
|
833 | className: (0, _classnames2["default"])(header.props.className, titleClassName)
|
834 | });
|
835 | }
|
836 |
|
837 | return (0, _react.cloneElement)(header, {
|
838 | className: (0, _classnames2["default"])(header.props.className, titleClassName),
|
839 | children: this.renderAnchor(header.props.children, id, role, expanded)
|
840 | });
|
841 | };
|
842 |
|
843 |
|
844 |
|
845 |
|
846 | Panel.prototype.renderAnchor = function renderAnchor(header, id, role, expanded) {
|
847 | return _react2["default"].createElement(
|
848 | 'a',
|
849 | {
|
850 | role: role,
|
851 | href: id && '#' + id,
|
852 | 'aria-controls': id,
|
853 | 'aria-expanded': expanded,
|
854 | 'aria-selected': expanded,
|
855 | className: expanded ? null : 'collapsed'
|
856 | },
|
857 | header
|
858 | );
|
859 | };
|
860 |
|
861 |
|
862 |
|
863 |
|
864 | Panel.prototype.copyDemo = function copyDemo(e) {
|
865 | var panelTarget = e.target.parentNode;
|
866 | var clipBoardContent = panelTarget.firstChild.innerText;
|
867 | (0, _copyToClipboard2["default"])(clipBoardContent);
|
868 | _beeMessage2["default"].create({ content: '复制成功!', color: 'success', duration: 2 });
|
869 | };
|
870 |
|
871 |
|
872 |
|
873 |
|
874 | Panel.prototype.renderCollapsibleBody = function renderCollapsibleBody(id, expanded, role, children, clsPrefix, copyable, animationHooks) {
|
875 | return _react2["default"].createElement(
|
876 | _beeTransition.Collapse,
|
877 | _extends({ 'in': expanded }, animationHooks),
|
878 | _react2["default"].createElement(
|
879 | 'div',
|
880 | {
|
881 | id: id,
|
882 | role: role,
|
883 | className: clsPrefix + '-collapse',
|
884 | 'aria-hidden': !expanded
|
885 | },
|
886 | this.renderBody(children, clsPrefix, copyable)
|
887 | )
|
888 | );
|
889 | };
|
890 |
|
891 |
|
892 |
|
893 |
|
894 | Panel.prototype.renderBody = function renderBody(rawChildren, clsPrefix, copyable) {
|
895 | var self = this;
|
896 | var children = [];
|
897 | var bodyChildren = [];
|
898 |
|
899 | var bodyClassName = clsPrefix + '-body';
|
900 |
|
901 | function maybeAddBody(self) {
|
902 | if (!bodyChildren.length) {
|
903 | return;
|
904 | }
|
905 |
|
906 | children.push(_react2["default"].createElement(
|
907 | 'div',
|
908 | { key: children.length, className: bodyClassName },
|
909 | bodyChildren,
|
910 | copyable && _react2["default"].createElement('i', { className: clsPrefix + '-copy uf uf-files-o', onClick: self.copyDemo })
|
911 | ));
|
912 | bodyChildren = [];
|
913 | }
|
914 |
|
915 |
|
916 | _react2["default"].Children.toArray(rawChildren).forEach(function (child) {
|
917 | if (_react2["default"].isValidElement(child) && child.props.fill) {
|
918 | maybeAddBody(self);
|
919 |
|
920 |
|
921 | children.push((0, _react.cloneElement)(child, { fill: undefined }));
|
922 |
|
923 | return;
|
924 | }
|
925 | bodyChildren.push(child);
|
926 | });
|
927 |
|
928 | maybeAddBody(self);
|
929 |
|
930 | return children;
|
931 | };
|
932 |
|
933 | Panel.prototype.render = function render() {
|
934 | var _props = this.props,
|
935 | collapsible = _props.collapsible,
|
936 | header = _props.header,
|
937 | id = _props.id,
|
938 | footer = _props.footer,
|
939 | propsExpanded = _props.expanded,
|
940 | footerStyle = _props.footerStyle,
|
941 | headerStyle = _props.headerStyle,
|
942 | headerRole = _props.headerRole,
|
943 | panelRole = _props.panelRole,
|
944 | className = _props.className,
|
945 | colors = _props.colors,
|
946 | children = _props.children,
|
947 | onEnter = _props.onEnter,
|
948 | onEntering = _props.onEntering,
|
949 | onEntered = _props.onEntered,
|
950 | clsPrefix = _props.clsPrefix,
|
951 | onExit = _props.onExit,
|
952 | headerContent = _props.headerContent,
|
953 | onExiting = _props.onExiting,
|
954 | onExited = _props.onExited,
|
955 | defaultExpanded = _props.defaultExpanded,
|
956 | eventKey = _props.eventKey,
|
957 | onSelect = _props.onSelect,
|
958 | copyable = _props.copyable,
|
959 | props = _objectWithoutProperties(_props, ['collapsible', 'header', 'id', 'footer', 'expanded', 'footerStyle', 'headerStyle', 'headerRole', 'panelRole', 'className', 'colors', 'children', 'onEnter', 'onEntering', 'onEntered', 'clsPrefix', 'onExit', 'headerContent', 'onExiting', 'onExited', 'defaultExpanded', 'eventKey', 'onSelect', 'copyable']);
|
960 |
|
961 | var expanded = propsExpanded != null ? propsExpanded : this.state.expanded;
|
962 |
|
963 | var classes = {};
|
964 | classes['' + clsPrefix] = true;
|
965 | classes[clsPrefix + '-' + colors] = true;
|
966 |
|
967 | var headerClass = _defineProperty({}, clsPrefix + '-heading', true);
|
968 |
|
969 | copyable === false ? false : true;
|
970 | return _react2["default"].createElement(
|
971 | 'div',
|
972 | _extends({}, props, {
|
973 | className: (0, _classnames2["default"])(className, classes),
|
974 | id: collapsible ? null : id
|
975 | }),
|
976 | header && _react2["default"].createElement(
|
977 | 'div',
|
978 | { className: (0, _classnames2["default"])(headerClass), style: headerStyle, onClick: this.handleClickTitle },
|
979 | this.renderHeader(collapsible, header, id, headerRole, expanded, clsPrefix)
|
980 | ),
|
981 | collapsible ? this.renderCollapsibleBody(id, expanded, panelRole, children, clsPrefix, copyable, { onEnter: onEnter, onEntering: onEntering, onEntered: onEntered, onExit: onExit, onExiting: onExiting, onExited: onExited }) : this.renderBody(children, clsPrefix, copyable),
|
982 | footer && _react2["default"].createElement(
|
983 | 'div',
|
984 | { className: clsPrefix + '-footer', style: footerStyle },
|
985 | footer
|
986 | )
|
987 | );
|
988 | };
|
989 |
|
990 | return Panel;
|
991 | }(_react2["default"].Component);
|
992 |
|
993 | Panel.propTypes = propTypes;
|
994 | Panel.defaultProps = defaultProps;
|
995 |
|
996 | exports["default"] = Panel;
|
997 | module.exports = exports['default'];
|
998 |
|
999 | }),
|
1000 |
|
1001 | (function(module, exports, __webpack_require__) {
|
1002 |
|
1003 | 'use strict';
|
1004 |
|
1005 | Object.defineProperty(exports, "__esModule", {
|
1006 | value: true
|
1007 | });
|
1008 | exports.Fade = exports.Collapse = exports.Transition = undefined;
|
1009 |
|
1010 | var _Transition2 = __webpack_require__(12);
|
1011 |
|
1012 | var _Transition3 = _interopRequireDefault(_Transition2);
|
1013 |
|
1014 | var _Collapse2 = __webpack_require__(17);
|
1015 |
|
1016 | var _Collapse3 = _interopRequireDefault(_Collapse2);
|
1017 |
|
1018 | var _Fade2 = __webpack_require__(64);
|
1019 |
|
1020 | var _Fade3 = _interopRequireDefault(_Fade2);
|
1021 |
|
1022 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
1023 |
|
1024 | exports.Transition = _Transition3["default"];
|
1025 | exports.Collapse = _Collapse3["default"];
|
1026 | exports.Fade = _Fade3["default"];
|
1027 |
|
1028 | }),
|
1029 |
|
1030 | (function(module, exports, __webpack_require__) {
|
1031 |
|
1032 | 'use strict';
|
1033 |
|
1034 | Object.defineProperty(exports, "__esModule", {
|
1035 | value: true
|
1036 | });
|
1037 | exports.EXITING = exports.ENTERED = exports.ENTERING = exports.EXITED = exports.UNMOUNTED = undefined;
|
1038 |
|
1039 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
1040 |
|
1041 | var _react = __webpack_require__(1);
|
1042 |
|
1043 | var _react2 = _interopRequireDefault(_react);
|
1044 |
|
1045 | var _reactDom = __webpack_require__(2);
|
1046 |
|
1047 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
1048 |
|
1049 | var _properties = __webpack_require__(13);
|
1050 |
|
1051 | var _properties2 = _interopRequireDefault(_properties);
|
1052 |
|
1053 | var _on = __webpack_require__(16);
|
1054 |
|
1055 | var _on2 = _interopRequireDefault(_on);
|
1056 |
|
1057 | var _classnames = __webpack_require__(5);
|
1058 |
|
1059 | var _classnames2 = _interopRequireDefault(_classnames);
|
1060 |
|
1061 | var _propTypes = __webpack_require__(6);
|
1062 |
|
1063 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
1064 |
|
1065 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
1066 |
|
1067 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
1068 |
|
1069 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
1070 |
|
1071 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1072 |
|
1073 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
1074 |
|
1075 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
1076 |
|
1077 | var transitionEndEvent = _properties2["default"].end;
|
1078 |
|
1079 |
|
1080 | var UNMOUNTED = exports.UNMOUNTED = 0;
|
1081 | var EXITED = exports.EXITED = 1;
|
1082 | var ENTERING = exports.ENTERING = 2;
|
1083 | var ENTERED = exports.ENTERED = 3;
|
1084 | var EXITING = exports.EXITING = 4;
|
1085 |
|
1086 | var propTypes = {
|
1087 | |
1088 |
|
1089 |
|
1090 | "in": _propTypes2["default"].bool,
|
1091 |
|
1092 | |
1093 |
|
1094 |
|
1095 | unmountOnExit: _propTypes2["default"].bool,
|
1096 |
|
1097 | |
1098 |
|
1099 |
|
1100 | transitionAppear: _propTypes2["default"].bool,
|
1101 |
|
1102 | |
1103 |
|
1104 |
|
1105 | timeout: _propTypes2["default"].number,
|
1106 |
|
1107 | |
1108 |
|
1109 |
|
1110 | exitedClassName: _propTypes2["default"].string,
|
1111 | |
1112 |
|
1113 |
|
1114 | exitingClassName: _propTypes2["default"].string,
|
1115 | |
1116 |
|
1117 |
|
1118 | enteredClassName: _propTypes2["default"].string,
|
1119 | |
1120 |
|
1121 |
|
1122 | enteringClassName: _propTypes2["default"].string,
|
1123 |
|
1124 | |
1125 |
|
1126 |
|
1127 | onEnter: _propTypes2["default"].func,
|
1128 | |
1129 |
|
1130 |
|
1131 | onEntering: _propTypes2["default"].func,
|
1132 | |
1133 |
|
1134 |
|
1135 | onEntered: _propTypes2["default"].func,
|
1136 | |
1137 |
|
1138 |
|
1139 | onExit: _propTypes2["default"].func,
|
1140 | |
1141 |
|
1142 |
|
1143 | onExiting: _propTypes2["default"].func,
|
1144 | |
1145 |
|
1146 |
|
1147 | onExited: _propTypes2["default"].func
|
1148 | };
|
1149 |
|
1150 | function noop() {}
|
1151 |
|
1152 | var defaultProps = {
|
1153 | "in": false,
|
1154 | unmountOnExit: false,
|
1155 | transitionAppear: false,
|
1156 | timeout: 5000,
|
1157 | onEnter: noop,
|
1158 | onEntering: noop,
|
1159 | onEntered: noop,
|
1160 | onExit: noop,
|
1161 | onExiting: noop,
|
1162 | onExited: noop
|
1163 | };
|
1164 |
|
1165 | |
1166 |
|
1167 |
|
1168 |
|
1169 | var Transition = function (_Component) {
|
1170 | _inherits(Transition, _Component);
|
1171 |
|
1172 | function Transition(props, context) {
|
1173 | _classCallCheck(this, Transition);
|
1174 |
|
1175 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
1176 |
|
1177 | var initialStatus = void 0;
|
1178 | if (props["in"]) {
|
1179 |
|
1180 | initialStatus = props.transitionAppear ? EXITED : ENTERED;
|
1181 | } else {
|
1182 | initialStatus = props.unmountOnExit ? UNMOUNTED : EXITED;
|
1183 | }
|
1184 | _this.state = { status: initialStatus };
|
1185 |
|
1186 | _this.nextCallback = null;
|
1187 | return _this;
|
1188 | }
|
1189 |
|
1190 | Transition.prototype.componentDidMount = function componentDidMount() {
|
1191 | if (this.props.transitionAppear && this.props["in"]) {
|
1192 | this.performEnter(this.props);
|
1193 | }
|
1194 | };
|
1195 |
|
1196 | Transition.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
1197 | if (nextProps["in"] && this.props.unmountOnExit) {
|
1198 | if (this.state.status === UNMOUNTED) {
|
1199 |
|
1200 | this.setState({ status: EXITED });
|
1201 | }
|
1202 | } else {
|
1203 | this._needsUpdate = true;
|
1204 | }
|
1205 | };
|
1206 |
|
1207 | Transition.prototype.componentDidUpdate = function componentDidUpdate() {
|
1208 | var status = this.state.status;
|
1209 |
|
1210 | if (this.props.unmountOnExit && status === EXITED) {
|
1211 |
|
1212 | if (this.props["in"]) {
|
1213 | this.performEnter(this.props);
|
1214 | } else {
|
1215 | this.setState({ status: UNMOUNTED });
|
1216 | }
|
1217 |
|
1218 | return;
|
1219 | }
|
1220 |
|
1221 |
|
1222 | if (this._needsUpdate) {
|
1223 | this._needsUpdate = false;
|
1224 |
|
1225 | if (this.props["in"]) {
|
1226 | if (status === EXITING) {
|
1227 | this.performEnter(this.props);
|
1228 | } else if (status === EXITED) {
|
1229 | this.performEnter(this.props);
|
1230 | }
|
1231 |
|
1232 | } else {
|
1233 | if (status === ENTERING || status === ENTERED) {
|
1234 | this.performExit(this.props);
|
1235 | }
|
1236 |
|
1237 | }
|
1238 | }
|
1239 | };
|
1240 |
|
1241 | Transition.prototype.componentWillUnmount = function componentWillUnmount() {
|
1242 | this.cancelNextCallback();
|
1243 | };
|
1244 |
|
1245 | Transition.prototype.performEnter = function performEnter(props) {
|
1246 | var _this2 = this;
|
1247 |
|
1248 | this.cancelNextCallback();
|
1249 | var node = _reactDom2["default"].findDOMNode(this);
|
1250 |
|
1251 |
|
1252 | props.onEnter(node);
|
1253 |
|
1254 | this.safeSetState({ status: ENTERING }, function () {
|
1255 | _this2.props.onEntering(node);
|
1256 |
|
1257 | _this2.onTransitionEnd(node, function () {
|
1258 | _this2.safeSetState({ status: ENTERED }, function () {
|
1259 | _this2.props.onEntered(node);
|
1260 | });
|
1261 | });
|
1262 | });
|
1263 | };
|
1264 |
|
1265 | Transition.prototype.performExit = function performExit(props) {
|
1266 | var _this3 = this;
|
1267 |
|
1268 | this.cancelNextCallback();
|
1269 | var node = _reactDom2["default"].findDOMNode(this);
|
1270 |
|
1271 | props.onExit(node);
|
1272 |
|
1273 | this.safeSetState({ status: EXITING }, function () {
|
1274 | _this3.props.onExiting(node);
|
1275 |
|
1276 | _this3.onTransitionEnd(node, function () {
|
1277 | _this3.safeSetState({ status: EXITED }, function () {
|
1278 | _this3.props.onExited(node);
|
1279 | });
|
1280 | });
|
1281 | });
|
1282 | };
|
1283 |
|
1284 | Transition.prototype.cancelNextCallback = function cancelNextCallback() {
|
1285 | if (this.nextCallback !== null) {
|
1286 | this.nextCallback.cancel();
|
1287 | this.nextCallback = null;
|
1288 | }
|
1289 | };
|
1290 |
|
1291 | Transition.prototype.safeSetState = function safeSetState(nextState, callback) {
|
1292 |
|
1293 | this.setState(nextState, this.setNextCallback(callback));
|
1294 | };
|
1295 |
|
1296 | Transition.prototype.setNextCallback = function setNextCallback(callback) {
|
1297 | var _this4 = this;
|
1298 |
|
1299 | var active = true;
|
1300 |
|
1301 | this.nextCallback = function (event) {
|
1302 | if (active) {
|
1303 | active = false;
|
1304 | _this4.nextCallback = null;
|
1305 |
|
1306 | callback(event);
|
1307 | }
|
1308 | };
|
1309 |
|
1310 | this.nextCallback.cancel = function () {
|
1311 | active = false;
|
1312 | };
|
1313 |
|
1314 | return this.nextCallback;
|
1315 | };
|
1316 |
|
1317 | Transition.prototype.onTransitionEnd = function onTransitionEnd(node, handler) {
|
1318 | this.setNextCallback(handler);
|
1319 |
|
1320 | if (node) {
|
1321 | if (transitionEndEvent == undefined) {
|
1322 | this.nextCallback();
|
1323 | } else {
|
1324 | (0, _on2["default"])(node, transitionEndEvent, this.nextCallback);
|
1325 | }
|
1326 | setTimeout(this.nextCallback, this.props.timeout);
|
1327 | } else {
|
1328 | setTimeout(this.nextCallback, 0);
|
1329 | }
|
1330 | };
|
1331 |
|
1332 | Transition.prototype.render = function render() {
|
1333 | var status = this.state.status;
|
1334 | if (status === UNMOUNTED) {
|
1335 | return null;
|
1336 | }
|
1337 |
|
1338 | var _props = this.props,
|
1339 | children = _props.children,
|
1340 | className = _props.className,
|
1341 | childProps = _objectWithoutProperties(_props, ['children', 'className']);
|
1342 |
|
1343 | Object.keys(Transition.propTypes).forEach(function (key) {
|
1344 | return delete childProps[key];
|
1345 | });
|
1346 |
|
1347 | var transitionClassName = void 0;
|
1348 | if (status === EXITED) {
|
1349 | transitionClassName = this.props.exitedClassName;
|
1350 | } else if (status === ENTERING) {
|
1351 | transitionClassName = this.props.enteringClassName;
|
1352 | } else if (status === ENTERED) {
|
1353 | transitionClassName = this.props.enteredClassName;
|
1354 | } else if (status === EXITING) {
|
1355 | transitionClassName = this.props.exitingClassName;
|
1356 | }
|
1357 |
|
1358 | var child = _react2["default"].Children.only(children);
|
1359 | return _react2["default"].cloneElement(child, _extends({}, childProps, {
|
1360 | className: (0, _classnames2["default"])(child.props.className, className, transitionClassName)
|
1361 | }));
|
1362 | };
|
1363 |
|
1364 | return Transition;
|
1365 | }(_react.Component);
|
1366 |
|
1367 | Transition.propTypes = propTypes;
|
1368 |
|
1369 | Transition.defaultProps = defaultProps;
|
1370 |
|
1371 | exports["default"] = Transition;
|
1372 |
|
1373 | }),
|
1374 |
|
1375 | (function(module, exports, __webpack_require__) {
|
1376 |
|
1377 | "use strict";
|
1378 |
|
1379 | var _interopRequireDefault = __webpack_require__(14);
|
1380 |
|
1381 | exports.__esModule = true;
|
1382 | exports.default = exports.animationEnd = exports.animationDelay = exports.animationTiming = exports.animationDuration = exports.animationName = exports.transitionEnd = exports.transitionDuration = exports.transitionDelay = exports.transitionTiming = exports.transitionProperty = exports.transform = void 0;
|
1383 |
|
1384 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
1385 |
|
1386 | var transform = 'transform';
|
1387 | exports.transform = transform;
|
1388 | var prefix, transitionEnd, animationEnd;
|
1389 | exports.animationEnd = animationEnd;
|
1390 | exports.transitionEnd = transitionEnd;
|
1391 | var transitionProperty, transitionDuration, transitionTiming, transitionDelay;
|
1392 | exports.transitionDelay = transitionDelay;
|
1393 | exports.transitionTiming = transitionTiming;
|
1394 | exports.transitionDuration = transitionDuration;
|
1395 | exports.transitionProperty = transitionProperty;
|
1396 | var animationName, animationDuration, animationTiming, animationDelay;
|
1397 | exports.animationDelay = animationDelay;
|
1398 | exports.animationTiming = animationTiming;
|
1399 | exports.animationDuration = animationDuration;
|
1400 | exports.animationName = animationName;
|
1401 |
|
1402 | if (_inDOM.default) {
|
1403 | var _getTransitionPropert = getTransitionProperties();
|
1404 |
|
1405 | prefix = _getTransitionPropert.prefix;
|
1406 | exports.transitionEnd = transitionEnd = _getTransitionPropert.transitionEnd;
|
1407 | exports.animationEnd = animationEnd = _getTransitionPropert.animationEnd;
|
1408 | exports.transform = transform = prefix + "-" + transform;
|
1409 | exports.transitionProperty = transitionProperty = prefix + "-transition-property";
|
1410 | exports.transitionDuration = transitionDuration = prefix + "-transition-duration";
|
1411 | exports.transitionDelay = transitionDelay = prefix + "-transition-delay";
|
1412 | exports.transitionTiming = transitionTiming = prefix + "-transition-timing-function";
|
1413 | exports.animationName = animationName = prefix + "-animation-name";
|
1414 | exports.animationDuration = animationDuration = prefix + "-animation-duration";
|
1415 | exports.animationTiming = animationTiming = prefix + "-animation-delay";
|
1416 | exports.animationDelay = animationDelay = prefix + "-animation-timing-function";
|
1417 | }
|
1418 |
|
1419 | var _default = {
|
1420 | transform: transform,
|
1421 | end: transitionEnd,
|
1422 | property: transitionProperty,
|
1423 | timing: transitionTiming,
|
1424 | delay: transitionDelay,
|
1425 | duration: transitionDuration
|
1426 | };
|
1427 | exports.default = _default;
|
1428 |
|
1429 | function getTransitionProperties() {
|
1430 | var style = document.createElement('div').style;
|
1431 | var vendorMap = {
|
1432 | O: function O(e) {
|
1433 | return "o" + e.toLowerCase();
|
1434 | },
|
1435 | Moz: function Moz(e) {
|
1436 | return e.toLowerCase();
|
1437 | },
|
1438 | Webkit: function Webkit(e) {
|
1439 | return "webkit" + e;
|
1440 | },
|
1441 | ms: function ms(e) {
|
1442 | return "MS" + e;
|
1443 | }
|
1444 | };
|
1445 | var vendors = Object.keys(vendorMap);
|
1446 | var transitionEnd, animationEnd;
|
1447 | var prefix = '';
|
1448 |
|
1449 | for (var i = 0; i < vendors.length; i++) {
|
1450 | var vendor = vendors[i];
|
1451 |
|
1452 | if (vendor + "TransitionProperty" in style) {
|
1453 | prefix = "-" + vendor.toLowerCase();
|
1454 | transitionEnd = vendorMap[vendor]('TransitionEnd');
|
1455 | animationEnd = vendorMap[vendor]('AnimationEnd');
|
1456 | break;
|
1457 | }
|
1458 | }
|
1459 |
|
1460 | if (!transitionEnd && 'transitionProperty' in style) transitionEnd = 'transitionend';
|
1461 | if (!animationEnd && 'animationName' in style) animationEnd = 'animationend';
|
1462 | style = null;
|
1463 | return {
|
1464 | animationEnd: animationEnd,
|
1465 | transitionEnd: transitionEnd,
|
1466 | prefix: prefix
|
1467 | };
|
1468 | }
|
1469 |
|
1470 | }),
|
1471 |
|
1472 | (function(module, exports) {
|
1473 |
|
1474 | function _interopRequireDefault(obj) {
|
1475 | return obj && obj.__esModule ? obj : {
|
1476 | default: obj
|
1477 | };
|
1478 | }
|
1479 |
|
1480 | module.exports = _interopRequireDefault;
|
1481 |
|
1482 | }),
|
1483 |
|
1484 | (function(module, exports) {
|
1485 |
|
1486 | "use strict";
|
1487 |
|
1488 | exports.__esModule = true;
|
1489 | exports.default = void 0;
|
1490 |
|
1491 | var _default = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
1492 |
|
1493 | exports.default = _default;
|
1494 | module.exports = exports["default"];
|
1495 |
|
1496 | }),
|
1497 |
|
1498 | (function(module, exports, __webpack_require__) {
|
1499 |
|
1500 | "use strict";
|
1501 |
|
1502 | var _interopRequireDefault = __webpack_require__(14);
|
1503 |
|
1504 | exports.__esModule = true;
|
1505 | exports.default = void 0;
|
1506 |
|
1507 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
1508 |
|
1509 | var on = function on() {};
|
1510 |
|
1511 | if (_inDOM.default) {
|
1512 | on = function () {
|
1513 | if (document.addEventListener) return function (node, eventName, handler, capture) {
|
1514 | return node.addEventListener(eventName, handler, capture || false);
|
1515 | };else if (document.attachEvent) return function (node, eventName, handler) {
|
1516 | return node.attachEvent('on' + eventName, function (e) {
|
1517 | e = e || window.event;
|
1518 | e.target = e.target || e.srcElement;
|
1519 | e.currentTarget = node;
|
1520 | handler.call(node, e);
|
1521 | });
|
1522 | };
|
1523 | }();
|
1524 | }
|
1525 |
|
1526 | var _default = on;
|
1527 | exports.default = _default;
|
1528 | module.exports = exports["default"];
|
1529 |
|
1530 | }),
|
1531 |
|
1532 | (function(module, exports, __webpack_require__) {
|
1533 |
|
1534 | 'use strict';
|
1535 |
|
1536 | Object.defineProperty(exports, "__esModule", {
|
1537 | value: true
|
1538 | });
|
1539 |
|
1540 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
1541 |
|
1542 | var _classnames = __webpack_require__(5);
|
1543 |
|
1544 | var _classnames2 = _interopRequireDefault(_classnames);
|
1545 |
|
1546 | var _style = __webpack_require__(18);
|
1547 |
|
1548 | var _style2 = _interopRequireDefault(_style);
|
1549 |
|
1550 | var _react = __webpack_require__(1);
|
1551 |
|
1552 | var _react2 = _interopRequireDefault(_react);
|
1553 |
|
1554 | var _propTypes = __webpack_require__(6);
|
1555 |
|
1556 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
1557 |
|
1558 | var _Transition = __webpack_require__(12);
|
1559 |
|
1560 | var _Transition2 = _interopRequireDefault(_Transition);
|
1561 |
|
1562 | var _capitalize = __webpack_require__(26);
|
1563 |
|
1564 | var _capitalize2 = _interopRequireDefault(_capitalize);
|
1565 |
|
1566 | var _tinperBeeCore = __webpack_require__(27);
|
1567 |
|
1568 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
1569 |
|
1570 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
1571 |
|
1572 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
1573 |
|
1574 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1575 |
|
1576 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
1577 |
|
1578 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
1579 |
|
1580 | var MARGINS = {
|
1581 | height: ['marginTop', 'marginBottom'],
|
1582 | width: ['marginLeft', 'marginRight']
|
1583 | };
|
1584 |
|
1585 |
|
1586 |
|
1587 | function triggerBrowserReflow(node) {
|
1588 | node.offsetHeight;
|
1589 | }
|
1590 |
|
1591 | function getDimensionValue(dimension, elem) {
|
1592 | var value = elem['offset' + (0, _capitalize2["default"])(dimension)];
|
1593 | var margins = MARGINS[dimension];
|
1594 |
|
1595 | return value + parseInt((0, _style2["default"])(elem, margins[0]), 10) + parseInt((0, _style2["default"])(elem, margins[1]), 10);
|
1596 | }
|
1597 |
|
1598 | var propTypes = {
|
1599 | |
1600 |
|
1601 |
|
1602 | "in": _propTypes2["default"].bool,
|
1603 |
|
1604 | |
1605 |
|
1606 |
|
1607 | unmountOnExit: _propTypes2["default"].bool,
|
1608 |
|
1609 | |
1610 |
|
1611 |
|
1612 |
|
1613 | transitionAppear: _propTypes2["default"].bool,
|
1614 |
|
1615 | |
1616 |
|
1617 |
|
1618 |
|
1619 |
|
1620 | timeout: _propTypes2["default"].number,
|
1621 |
|
1622 | |
1623 |
|
1624 |
|
1625 | onEnter: _propTypes2["default"].func,
|
1626 | |
1627 |
|
1628 |
|
1629 | onEntering: _propTypes2["default"].func,
|
1630 | |
1631 |
|
1632 |
|
1633 | onEntered: _propTypes2["default"].func,
|
1634 | |
1635 |
|
1636 |
|
1637 | onExit: _propTypes2["default"].func,
|
1638 | |
1639 |
|
1640 |
|
1641 | onExiting: _propTypes2["default"].func,
|
1642 | |
1643 |
|
1644 |
|
1645 | onExited: _propTypes2["default"].func,
|
1646 |
|
1647 | |
1648 |
|
1649 |
|
1650 |
|
1651 |
|
1652 |
|
1653 |
|
1654 | dimension: _propTypes2["default"].oneOfType([_propTypes2["default"].oneOf(['height', 'width']), _propTypes2["default"].func]),
|
1655 |
|
1656 | |
1657 |
|
1658 |
|
1659 |
|
1660 |
|
1661 |
|
1662 |
|
1663 | getDimensionValue: _propTypes2["default"].func,
|
1664 |
|
1665 | |
1666 |
|
1667 |
|
1668 | role: _propTypes2["default"].string
|
1669 | };
|
1670 |
|
1671 | var defaultProps = {
|
1672 | "in": false,
|
1673 | timeout: 300,
|
1674 | unmountOnExit: false,
|
1675 | transitionAppear: false,
|
1676 |
|
1677 | dimension: 'height',
|
1678 | getDimensionValue: getDimensionValue
|
1679 | };
|
1680 |
|
1681 | var Collapse = function (_React$Component) {
|
1682 | _inherits(Collapse, _React$Component);
|
1683 |
|
1684 | function Collapse(props, context) {
|
1685 | _classCallCheck(this, Collapse);
|
1686 |
|
1687 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
1688 |
|
1689 | _this.handleEnter = _this.handleEnter.bind(_this);
|
1690 | _this.handleEntering = _this.handleEntering.bind(_this);
|
1691 | _this.handleEntered = _this.handleEntered.bind(_this);
|
1692 | _this.handleExit = _this.handleExit.bind(_this);
|
1693 | _this.handleExiting = _this.handleExiting.bind(_this);
|
1694 | return _this;
|
1695 | }
|
1696 |
|
1697 |
|
1698 |
|
1699 |
|
1700 | Collapse.prototype.handleEnter = function handleEnter(elem) {
|
1701 | var dimension = this._dimension();
|
1702 | elem.style[dimension] = '0';
|
1703 | };
|
1704 |
|
1705 | Collapse.prototype.handleEntering = function handleEntering(elem) {
|
1706 | var dimension = this._dimension();
|
1707 | elem.style[dimension] = this._getScrollDimensionValue(elem, dimension);
|
1708 | };
|
1709 |
|
1710 | Collapse.prototype.handleEntered = function handleEntered(elem) {
|
1711 | var dimension = this._dimension();
|
1712 | elem.style[dimension] = null;
|
1713 | };
|
1714 |
|
1715 |
|
1716 |
|
1717 |
|
1718 | Collapse.prototype.handleExit = function handleExit(elem) {
|
1719 | var dimension = this._dimension();
|
1720 | elem.style[dimension] = this.props.getDimensionValue(dimension, elem) + 'px';
|
1721 | triggerBrowserReflow(elem);
|
1722 | };
|
1723 |
|
1724 | Collapse.prototype.handleExiting = function handleExiting(elem) {
|
1725 | var dimension = this._dimension();
|
1726 | elem.style[dimension] = '0';
|
1727 | };
|
1728 |
|
1729 | Collapse.prototype._dimension = function _dimension() {
|
1730 | return typeof this.props.dimension === 'function' ? this.props.dimension() : this.props.dimension;
|
1731 | };
|
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 | Collapse.prototype._getScrollDimensionValue = function _getScrollDimensionValue(elem, dimension) {
|
1737 | return elem['scroll' + (0, _capitalize2["default"])(dimension)] + 'px';
|
1738 | };
|
1739 |
|
1740 | Collapse.prototype.render = function render() {
|
1741 | var _props = this.props,
|
1742 | onEnter = _props.onEnter,
|
1743 | onEntering = _props.onEntering,
|
1744 | onEntered = _props.onEntered,
|
1745 | onExit = _props.onExit,
|
1746 | onExiting = _props.onExiting,
|
1747 | className = _props.className,
|
1748 | props = _objectWithoutProperties(_props, ['onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'className']);
|
1749 |
|
1750 | delete props.dimension;
|
1751 | delete props.getDimensionValue;
|
1752 |
|
1753 | var handleEnter = (0, _tinperBeeCore.createChainedFunction)(this.handleEnter, onEnter);
|
1754 | var handleEntering = (0, _tinperBeeCore.createChainedFunction)(this.handleEntering, onEntering);
|
1755 | var handleEntered = (0, _tinperBeeCore.createChainedFunction)(this.handleEntered, onEntered);
|
1756 | var handleExit = (0, _tinperBeeCore.createChainedFunction)(this.handleExit, onExit);
|
1757 | var handleExiting = (0, _tinperBeeCore.createChainedFunction)(this.handleExiting, onExiting);
|
1758 |
|
1759 | var classes = {
|
1760 | width: this._dimension() === 'width'
|
1761 | };
|
1762 |
|
1763 | return _react2["default"].createElement(_Transition2["default"], _extends({}, props, {
|
1764 | 'aria-expanded': props.role ? props["in"] : null,
|
1765 | className: (0, _classnames2["default"])(className, classes),
|
1766 | exitedClassName: 'collapse',
|
1767 | exitingClassName: 'collapsing',
|
1768 | enteredClassName: 'collapse in',
|
1769 | enteringClassName: 'collapsing',
|
1770 | onEnter: handleEnter,
|
1771 | onEntering: handleEntering,
|
1772 | onEntered: handleEntered,
|
1773 | onExit: handleExit,
|
1774 | onExiting: handleExiting
|
1775 | }));
|
1776 | };
|
1777 |
|
1778 | return Collapse;
|
1779 | }(_react2["default"].Component);
|
1780 |
|
1781 | Collapse.propTypes = propTypes;
|
1782 | Collapse.defaultProps = defaultProps;
|
1783 |
|
1784 | exports["default"] = Collapse;
|
1785 | module.exports = exports['default'];
|
1786 |
|
1787 | }),
|
1788 |
|
1789 | (function(module, exports, __webpack_require__) {
|
1790 |
|
1791 | "use strict";
|
1792 |
|
1793 | var _interopRequireDefault = __webpack_require__(14);
|
1794 |
|
1795 | exports.__esModule = true;
|
1796 | exports.default = style;
|
1797 |
|
1798 | var _camelizeStyle = _interopRequireDefault(__webpack_require__(19));
|
1799 |
|
1800 | var _hyphenateStyle = _interopRequireDefault(__webpack_require__(21));
|
1801 |
|
1802 | var _getComputedStyle2 = _interopRequireDefault(__webpack_require__(23));
|
1803 |
|
1804 | var _removeStyle = _interopRequireDefault(__webpack_require__(24));
|
1805 |
|
1806 | var _properties = __webpack_require__(13);
|
1807 |
|
1808 | var _isTransform = _interopRequireDefault(__webpack_require__(25));
|
1809 |
|
1810 | function style(node, property, value) {
|
1811 | var css = '';
|
1812 | var transforms = '';
|
1813 | var props = property;
|
1814 |
|
1815 | if (typeof property === 'string') {
|
1816 | if (value === undefined) {
|
1817 | return node.style[(0, _camelizeStyle.default)(property)] || (0, _getComputedStyle2.default)(node).getPropertyValue((0, _hyphenateStyle.default)(property));
|
1818 | } else {
|
1819 | (props = {})[property] = value;
|
1820 | }
|
1821 | }
|
1822 |
|
1823 | Object.keys(props).forEach(function (key) {
|
1824 | var value = props[key];
|
1825 |
|
1826 | if (!value && value !== 0) {
|
1827 | (0, _removeStyle.default)(node, (0, _hyphenateStyle.default)(key));
|
1828 | } else if ((0, _isTransform.default)(key)) {
|
1829 | transforms += key + "(" + value + ") ";
|
1830 | } else {
|
1831 | css += (0, _hyphenateStyle.default)(key) + ": " + value + ";";
|
1832 | }
|
1833 | });
|
1834 |
|
1835 | if (transforms) {
|
1836 | css += _properties.transform + ": " + transforms + ";";
|
1837 | }
|
1838 |
|
1839 | node.style.cssText += ';' + css;
|
1840 | }
|
1841 |
|
1842 | module.exports = exports["default"];
|
1843 |
|
1844 | }),
|
1845 |
|
1846 | (function(module, exports, __webpack_require__) {
|
1847 |
|
1848 | "use strict";
|
1849 |
|
1850 | var _interopRequireDefault = __webpack_require__(14);
|
1851 |
|
1852 | exports.__esModule = true;
|
1853 | exports.default = camelizeStyleName;
|
1854 |
|
1855 | var _camelize = _interopRequireDefault(__webpack_require__(20));
|
1856 |
|
1857 | |
1858 |
|
1859 |
|
1860 |
|
1861 |
|
1862 | var msPattern = /^-ms-/;
|
1863 |
|
1864 | function camelizeStyleName(string) {
|
1865 | return (0, _camelize.default)(string.replace(msPattern, 'ms-'));
|
1866 | }
|
1867 |
|
1868 | module.exports = exports["default"];
|
1869 |
|
1870 | }),
|
1871 |
|
1872 | (function(module, exports) {
|
1873 |
|
1874 | "use strict";
|
1875 |
|
1876 | exports.__esModule = true;
|
1877 | exports.default = camelize;
|
1878 | var rHyphen = /-(.)/g;
|
1879 |
|
1880 | function camelize(string) {
|
1881 | return string.replace(rHyphen, function (_, chr) {
|
1882 | return chr.toUpperCase();
|
1883 | });
|
1884 | }
|
1885 |
|
1886 | module.exports = exports["default"];
|
1887 |
|
1888 | }),
|
1889 |
|
1890 | (function(module, exports, __webpack_require__) {
|
1891 |
|
1892 | "use strict";
|
1893 |
|
1894 | var _interopRequireDefault = __webpack_require__(14);
|
1895 |
|
1896 | exports.__esModule = true;
|
1897 | exports.default = hyphenateStyleName;
|
1898 |
|
1899 | var _hyphenate = _interopRequireDefault(__webpack_require__(22));
|
1900 |
|
1901 | |
1902 |
|
1903 |
|
1904 |
|
1905 |
|
1906 | var msPattern = /^ms-/;
|
1907 |
|
1908 | function hyphenateStyleName(string) {
|
1909 | return (0, _hyphenate.default)(string).replace(msPattern, '-ms-');
|
1910 | }
|
1911 |
|
1912 | module.exports = exports["default"];
|
1913 |
|
1914 | }),
|
1915 |
|
1916 | (function(module, exports) {
|
1917 |
|
1918 | "use strict";
|
1919 |
|
1920 | exports.__esModule = true;
|
1921 | exports.default = hyphenate;
|
1922 | var rUpper = /([A-Z])/g;
|
1923 |
|
1924 | function hyphenate(string) {
|
1925 | return string.replace(rUpper, '-$1').toLowerCase();
|
1926 | }
|
1927 |
|
1928 | module.exports = exports["default"];
|
1929 |
|
1930 | }),
|
1931 |
|
1932 | (function(module, exports, __webpack_require__) {
|
1933 |
|
1934 | "use strict";
|
1935 |
|
1936 | var _interopRequireDefault = __webpack_require__(14);
|
1937 |
|
1938 | exports.__esModule = true;
|
1939 | exports.default = _getComputedStyle;
|
1940 |
|
1941 | var _camelizeStyle = _interopRequireDefault(__webpack_require__(19));
|
1942 |
|
1943 | var rposition = /^(top|right|bottom|left)$/;
|
1944 | var rnumnonpx = /^([+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|))(?!px)[a-z%]+$/i;
|
1945 |
|
1946 | function _getComputedStyle(node) {
|
1947 | if (!node) throw new TypeError('No Element passed to `getComputedStyle()`');
|
1948 | var doc = node.ownerDocument;
|
1949 | return 'defaultView' in doc ? doc.defaultView.opener ? node.ownerDocument.defaultView.getComputedStyle(node, null) : window.getComputedStyle(node, null) : {
|
1950 |
|
1951 | getPropertyValue: function getPropertyValue(prop) {
|
1952 | var style = node.style;
|
1953 | prop = (0, _camelizeStyle.default)(prop);
|
1954 | if (prop == 'float') prop = 'styleFloat';
|
1955 | var current = node.currentStyle[prop] || null;
|
1956 | if (current == null && style && style[prop]) current = style[prop];
|
1957 |
|
1958 | if (rnumnonpx.test(current) && !rposition.test(prop)) {
|
1959 |
|
1960 | var left = style.left;
|
1961 | var runStyle = node.runtimeStyle;
|
1962 | var rsLeft = runStyle && runStyle.left;
|
1963 |
|
1964 | if (rsLeft) runStyle.left = node.currentStyle.left;
|
1965 | style.left = prop === 'fontSize' ? '1em' : current;
|
1966 | current = style.pixelLeft + 'px';
|
1967 |
|
1968 | style.left = left;
|
1969 | if (rsLeft) runStyle.left = rsLeft;
|
1970 | }
|
1971 |
|
1972 | return current;
|
1973 | }
|
1974 | };
|
1975 | }
|
1976 |
|
1977 | module.exports = exports["default"];
|
1978 |
|
1979 | }),
|
1980 |
|
1981 | (function(module, exports) {
|
1982 |
|
1983 | "use strict";
|
1984 |
|
1985 | exports.__esModule = true;
|
1986 | exports.default = removeStyle;
|
1987 |
|
1988 | function removeStyle(node, key) {
|
1989 | return 'removeProperty' in node.style ? node.style.removeProperty(key) : node.style.removeAttribute(key);
|
1990 | }
|
1991 |
|
1992 | module.exports = exports["default"];
|
1993 |
|
1994 | }),
|
1995 |
|
1996 | (function(module, exports) {
|
1997 |
|
1998 | "use strict";
|
1999 |
|
2000 | exports.__esModule = true;
|
2001 | exports.default = isTransform;
|
2002 | var supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;
|
2003 |
|
2004 | function isTransform(property) {
|
2005 | return !!(property && supportedTransforms.test(property));
|
2006 | }
|
2007 |
|
2008 | module.exports = exports["default"];
|
2009 |
|
2010 | }),
|
2011 |
|
2012 | (function(module, exports) {
|
2013 |
|
2014 | "use strict";
|
2015 |
|
2016 | Object.defineProperty(exports, "__esModule", {
|
2017 | value: true
|
2018 | });
|
2019 | exports["default"] = capitalize;
|
2020 | function capitalize(string) {
|
2021 | return "" + string.charAt(0).toUpperCase() + string.slice(1);
|
2022 | }
|
2023 | module.exports = exports["default"];
|
2024 |
|
2025 | }),
|
2026 |
|
2027 | (function(module, exports, __webpack_require__) {
|
2028 |
|
2029 | 'use strict';
|
2030 |
|
2031 | exports.__esModule = true;
|
2032 | exports.Align = exports.toArray = exports.cssAnimation = exports.addEventListener = exports.contains = exports.KeyCode = exports.createChainedFunction = exports.splitComponent = exports.isRequiredForA11y = exports.elementType = exports.deprecated = exports.componentOrElement = exports.all = undefined;
|
2033 |
|
2034 | var _all2 = __webpack_require__(28);
|
2035 |
|
2036 | var _all3 = _interopRequireDefault(_all2);
|
2037 |
|
2038 | var _componentOrElement2 = __webpack_require__(30);
|
2039 |
|
2040 | var _componentOrElement3 = _interopRequireDefault(_componentOrElement2);
|
2041 |
|
2042 | var _deprecated2 = __webpack_require__(31);
|
2043 |
|
2044 | var _deprecated3 = _interopRequireDefault(_deprecated2);
|
2045 |
|
2046 | var _elementType2 = __webpack_require__(34);
|
2047 |
|
2048 | var _elementType3 = _interopRequireDefault(_elementType2);
|
2049 |
|
2050 | var _isRequiredForA11y2 = __webpack_require__(35);
|
2051 |
|
2052 | var _isRequiredForA11y3 = _interopRequireDefault(_isRequiredForA11y2);
|
2053 |
|
2054 | var _splitComponent2 = __webpack_require__(36);
|
2055 |
|
2056 | var _splitComponent3 = _interopRequireDefault(_splitComponent2);
|
2057 |
|
2058 | var _createChainedFunction2 = __webpack_require__(37);
|
2059 |
|
2060 | var _createChainedFunction3 = _interopRequireDefault(_createChainedFunction2);
|
2061 |
|
2062 | var _keyCode = __webpack_require__(38);
|
2063 |
|
2064 | var _keyCode2 = _interopRequireDefault(_keyCode);
|
2065 |
|
2066 | var _contains2 = __webpack_require__(39);
|
2067 |
|
2068 | var _contains3 = _interopRequireDefault(_contains2);
|
2069 |
|
2070 | var _addEventListener2 = __webpack_require__(40);
|
2071 |
|
2072 | var _addEventListener3 = _interopRequireDefault(_addEventListener2);
|
2073 |
|
2074 | var _cssAnimation2 = __webpack_require__(45);
|
2075 |
|
2076 | var _cssAnimation3 = _interopRequireDefault(_cssAnimation2);
|
2077 |
|
2078 | var _toArray2 = __webpack_require__(49);
|
2079 |
|
2080 | var _toArray3 = _interopRequireDefault(_toArray2);
|
2081 |
|
2082 | var _Align2 = __webpack_require__(50);
|
2083 |
|
2084 | var _Align3 = _interopRequireDefault(_Align2);
|
2085 |
|
2086 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2087 |
|
2088 | exports.all = _all3.default;
|
2089 | exports.componentOrElement = _componentOrElement3.default;
|
2090 | exports.deprecated = _deprecated3.default;
|
2091 | exports.elementType = _elementType3.default;
|
2092 | exports.isRequiredForA11y = _isRequiredForA11y3.default;
|
2093 | exports.splitComponent = _splitComponent3.default;
|
2094 | exports.createChainedFunction = _createChainedFunction3.default;
|
2095 | exports.KeyCode = _keyCode2.default;
|
2096 | exports.contains = _contains3.default;
|
2097 | exports.addEventListener = _addEventListener3.default;
|
2098 | exports.cssAnimation = _cssAnimation3.default;
|
2099 | exports.toArray = _toArray3.default;
|
2100 |
|
2101 |
|
2102 | exports.Align = _Align3.default;
|
2103 |
|
2104 | }),
|
2105 |
|
2106 | (function(module, exports, __webpack_require__) {
|
2107 |
|
2108 | 'use strict';
|
2109 |
|
2110 | exports.__esModule = true;
|
2111 | exports.default = all;
|
2112 |
|
2113 | var _createChainableTypeChecker = __webpack_require__(29);
|
2114 |
|
2115 | var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);
|
2116 |
|
2117 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2118 |
|
2119 | function all() {
|
2120 | for (var _len = arguments.length, validators = Array(_len), _key = 0; _key < _len; _key++) {
|
2121 | validators[_key] = arguments[_key];
|
2122 | }
|
2123 |
|
2124 | function allPropTypes() {
|
2125 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
2126 | args[_key2] = arguments[_key2];
|
2127 | }
|
2128 |
|
2129 | var error = null;
|
2130 |
|
2131 | validators.forEach(function (validator) {
|
2132 | if (error != null) {
|
2133 | return;
|
2134 | }
|
2135 |
|
2136 | var result = validator.apply(undefined, args);
|
2137 | if (result != null) {
|
2138 | error = result;
|
2139 | }
|
2140 | });
|
2141 |
|
2142 | return error;
|
2143 | }
|
2144 |
|
2145 | return (0, _createChainableTypeChecker2.default)(allPropTypes);
|
2146 | } |
2147 |
|
2148 |
|
2149 |
|
2150 |
|
2151 | }),
|
2152 |
|
2153 | (function(module, exports) {
|
2154 |
|
2155 | 'use strict';
|
2156 |
|
2157 | exports.__esModule = true;
|
2158 | exports.default = createChainableTypeChecker;
|
2159 | |
2160 |
|
2161 |
|
2162 |
|
2163 |
|
2164 |
|
2165 |
|
2166 |
|
2167 |
|
2168 |
|
2169 |
|
2170 | |
2171 |
|
2172 |
|
2173 |
|
2174 | function createChainableTypeChecker(validate) {
|
2175 | function checkType(isRequired, props, propName, componentName, location, propFullName) {
|
2176 | var componentNameSafe = componentName || '<<anonymous>>';
|
2177 | var propFullNameSafe = propFullName || propName;
|
2178 |
|
2179 | if (props[propName] == null) {
|
2180 | if (isRequired) {
|
2181 | return new Error('Required ' + location + ' `' + propFullNameSafe + '` was not specified ' + ('in `' + componentNameSafe + '`.'));
|
2182 | }
|
2183 |
|
2184 | return null;
|
2185 | }
|
2186 |
|
2187 | for (var _len = arguments.length, args = Array(_len > 6 ? _len - 6 : 0), _key = 6; _key < _len; _key++) {
|
2188 | args[_key - 6] = arguments[_key];
|
2189 | }
|
2190 |
|
2191 | return validate.apply(undefined, [props, propName, componentNameSafe, location, propFullNameSafe].concat(args));
|
2192 | }
|
2193 |
|
2194 | var chainedCheckType = checkType.bind(null, false);
|
2195 | chainedCheckType.isRequired = checkType.bind(null, true);
|
2196 |
|
2197 | return chainedCheckType;
|
2198 | }
|
2199 |
|
2200 | }),
|
2201 |
|
2202 | (function(module, exports, __webpack_require__) {
|
2203 |
|
2204 | 'use strict';
|
2205 |
|
2206 | exports.__esModule = true;
|
2207 |
|
2208 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; |
2209 |
|
2210 |
|
2211 |
|
2212 |
|
2213 |
|
2214 | var _react = __webpack_require__(1);
|
2215 |
|
2216 | var _react2 = _interopRequireDefault(_react);
|
2217 |
|
2218 | var _createChainableTypeChecker = __webpack_require__(29);
|
2219 |
|
2220 | var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);
|
2221 |
|
2222 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2223 |
|
2224 | function validate(props, propName, componentName, location, propFullName) {
|
2225 | var propValue = props[propName];
|
2226 | var propType = typeof propValue === 'undefined' ? 'undefined' : _typeof(propValue);
|
2227 |
|
2228 | if (_react2.default.isValidElement(propValue)) {
|
2229 | return new Error('Invalid ' + location + ' `' + propFullName + '` of type ReactElement ' + ('supplied to `' + componentName + '`, expected a ReactComponent or a ') + 'DOMElement. You can usually obtain a ReactComponent or DOMElement ' + 'from a ReactElement by attaching a ref to it.');
|
2230 | }
|
2231 |
|
2232 | if ((propType !== 'object' || typeof propValue.render !== 'function') && propValue.nodeType !== 1) {
|
2233 | return new Error('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected a ReactComponent or a ') + 'DOMElement.');
|
2234 | }
|
2235 |
|
2236 | return null;
|
2237 | }
|
2238 |
|
2239 | exports.default = (0, _createChainableTypeChecker2.default)(validate);
|
2240 |
|
2241 | }),
|
2242 |
|
2243 | (function(module, exports, __webpack_require__) {
|
2244 |
|
2245 | 'use strict';
|
2246 |
|
2247 | exports.__esModule = true;
|
2248 | exports.default = deprecated;
|
2249 |
|
2250 | var _warning = __webpack_require__(32);
|
2251 |
|
2252 | var _warning2 = _interopRequireDefault(_warning);
|
2253 |
|
2254 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2255 |
|
2256 | var warned = {}; |
2257 |
|
2258 |
|
2259 |
|
2260 | function deprecated(validator, reason) {
|
2261 | return function validate(props, propName, componentName, location, propFullName) {
|
2262 | var componentNameSafe = componentName || '<<anonymous>>';
|
2263 | var propFullNameSafe = propFullName || propName;
|
2264 |
|
2265 | if (props[propName] != null) {
|
2266 | var messageKey = componentName + '.' + propName;
|
2267 |
|
2268 | (0, _warning2.default)(warned[messageKey], 'The ' + location + ' `' + propFullNameSafe + '` of ' + ('`' + componentNameSafe + '` is deprecated. ' + reason + '.'));
|
2269 |
|
2270 | warned[messageKey] = true;
|
2271 | }
|
2272 |
|
2273 | for (var _len = arguments.length, args = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {
|
2274 | args[_key - 5] = arguments[_key];
|
2275 | }
|
2276 |
|
2277 | return validator.apply(undefined, [props, propName, componentName, location, propFullName].concat(args));
|
2278 | };
|
2279 | }
|
2280 |
|
2281 |
|
2282 | function _resetWarned() {
|
2283 | warned = {};
|
2284 | }
|
2285 |
|
2286 | deprecated._resetWarned = _resetWarned;
|
2287 |
|
2288 |
|
2289 | }),
|
2290 |
|
2291 | (function(module, exports, __webpack_require__) {
|
2292 |
|
2293 | (function(process) { |
2294 |
|
2295 |
|
2296 |
|
2297 |
|
2298 |
|
2299 |
|
2300 |
|
2301 |
|
2302 | 'use strict';
|
2303 |
|
2304 | |
2305 |
|
2306 |
|
2307 |
|
2308 |
|
2309 |
|
2310 |
|
2311 | var warning = function() {};
|
2312 |
|
2313 | if (process.env.NODE_ENV !== 'production') {
|
2314 | warning = function(condition, format, args) {
|
2315 | var len = arguments.length;
|
2316 | args = new Array(len > 2 ? len - 2 : 0);
|
2317 | for (var key = 2; key < len; key++) {
|
2318 | args[key - 2] = arguments[key];
|
2319 | }
|
2320 | if (format === undefined) {
|
2321 | throw new Error(
|
2322 | '`warning(condition, format, ...args)` requires a warning ' +
|
2323 | 'message argument'
|
2324 | );
|
2325 | }
|
2326 |
|
2327 | if (format.length < 10 || (/^[s\W]*$/).test(format)) {
|
2328 | throw new Error(
|
2329 | 'The warning format should be able to uniquely identify this ' +
|
2330 | 'warning. Please, use a more descriptive format than: ' + format
|
2331 | );
|
2332 | }
|
2333 |
|
2334 | if (!condition) {
|
2335 | var argIndex = 0;
|
2336 | var message = 'Warning: ' +
|
2337 | format.replace(/%s/g, function() {
|
2338 | return args[argIndex++];
|
2339 | });
|
2340 | if (typeof console !== 'undefined') {
|
2341 | console.error(message);
|
2342 | }
|
2343 | try {
|
2344 |
|
2345 |
|
2346 | throw new Error(message);
|
2347 | } catch(x) {}
|
2348 | }
|
2349 | };
|
2350 | }
|
2351 |
|
2352 | module.exports = warning;
|
2353 |
|
2354 | }.call(exports, __webpack_require__(33)))
|
2355 |
|
2356 | }),
|
2357 |
|
2358 | (function(module, exports) {
|
2359 |
|
2360 |
|
2361 | var process = module.exports = {};
|
2362 |
|
2363 |
|
2364 |
|
2365 |
|
2366 |
|
2367 |
|
2368 | var cachedSetTimeout;
|
2369 | var cachedClearTimeout;
|
2370 |
|
2371 | function defaultSetTimout() {
|
2372 | throw new Error('setTimeout has not been defined');
|
2373 | }
|
2374 | function defaultClearTimeout () {
|
2375 | throw new Error('clearTimeout has not been defined');
|
2376 | }
|
2377 | (function () {
|
2378 | try {
|
2379 | if (typeof setTimeout === 'function') {
|
2380 | cachedSetTimeout = setTimeout;
|
2381 | } else {
|
2382 | cachedSetTimeout = defaultSetTimout;
|
2383 | }
|
2384 | } catch (e) {
|
2385 | cachedSetTimeout = defaultSetTimout;
|
2386 | }
|
2387 | try {
|
2388 | if (typeof clearTimeout === 'function') {
|
2389 | cachedClearTimeout = clearTimeout;
|
2390 | } else {
|
2391 | cachedClearTimeout = defaultClearTimeout;
|
2392 | }
|
2393 | } catch (e) {
|
2394 | cachedClearTimeout = defaultClearTimeout;
|
2395 | }
|
2396 | } ())
|
2397 | function runTimeout(fun) {
|
2398 | if (cachedSetTimeout === setTimeout) {
|
2399 |
|
2400 | return setTimeout(fun, 0);
|
2401 | }
|
2402 |
|
2403 | if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
2404 | cachedSetTimeout = setTimeout;
|
2405 | return setTimeout(fun, 0);
|
2406 | }
|
2407 | try {
|
2408 |
|
2409 | return cachedSetTimeout(fun, 0);
|
2410 | } catch(e){
|
2411 | try {
|
2412 |
|
2413 | return cachedSetTimeout.call(null, fun, 0);
|
2414 | } catch(e){
|
2415 |
|
2416 | return cachedSetTimeout.call(this, fun, 0);
|
2417 | }
|
2418 | }
|
2419 |
|
2420 |
|
2421 | }
|
2422 | function runClearTimeout(marker) {
|
2423 | if (cachedClearTimeout === clearTimeout) {
|
2424 |
|
2425 | return clearTimeout(marker);
|
2426 | }
|
2427 |
|
2428 | if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
2429 | cachedClearTimeout = clearTimeout;
|
2430 | return clearTimeout(marker);
|
2431 | }
|
2432 | try {
|
2433 |
|
2434 | return cachedClearTimeout(marker);
|
2435 | } catch (e){
|
2436 | try {
|
2437 |
|
2438 | return cachedClearTimeout.call(null, marker);
|
2439 | } catch (e){
|
2440 |
|
2441 |
|
2442 | return cachedClearTimeout.call(this, marker);
|
2443 | }
|
2444 | }
|
2445 |
|
2446 |
|
2447 |
|
2448 | }
|
2449 | var queue = [];
|
2450 | var draining = false;
|
2451 | var currentQueue;
|
2452 | var queueIndex = -1;
|
2453 |
|
2454 | function cleanUpNextTick() {
|
2455 | if (!draining || !currentQueue) {
|
2456 | return;
|
2457 | }
|
2458 | draining = false;
|
2459 | if (currentQueue.length) {
|
2460 | queue = currentQueue.concat(queue);
|
2461 | } else {
|
2462 | queueIndex = -1;
|
2463 | }
|
2464 | if (queue.length) {
|
2465 | drainQueue();
|
2466 | }
|
2467 | }
|
2468 |
|
2469 | function drainQueue() {
|
2470 | if (draining) {
|
2471 | return;
|
2472 | }
|
2473 | var timeout = runTimeout(cleanUpNextTick);
|
2474 | draining = true;
|
2475 |
|
2476 | var len = queue.length;
|
2477 | while(len) {
|
2478 | currentQueue = queue;
|
2479 | queue = [];
|
2480 | while (++queueIndex < len) {
|
2481 | if (currentQueue) {
|
2482 | currentQueue[queueIndex].run();
|
2483 | }
|
2484 | }
|
2485 | queueIndex = -1;
|
2486 | len = queue.length;
|
2487 | }
|
2488 | currentQueue = null;
|
2489 | draining = false;
|
2490 | runClearTimeout(timeout);
|
2491 | }
|
2492 |
|
2493 | process.nextTick = function (fun) {
|
2494 | var args = new Array(arguments.length - 1);
|
2495 | if (arguments.length > 1) {
|
2496 | for (var i = 1; i < arguments.length; i++) {
|
2497 | args[i - 1] = arguments[i];
|
2498 | }
|
2499 | }
|
2500 | queue.push(new Item(fun, args));
|
2501 | if (queue.length === 1 && !draining) {
|
2502 | runTimeout(drainQueue);
|
2503 | }
|
2504 | };
|
2505 |
|
2506 |
|
2507 | function Item(fun, array) {
|
2508 | this.fun = fun;
|
2509 | this.array = array;
|
2510 | }
|
2511 | Item.prototype.run = function () {
|
2512 | this.fun.apply(null, this.array);
|
2513 | };
|
2514 | process.title = 'browser';
|
2515 | process.browser = true;
|
2516 | process.env = {};
|
2517 | process.argv = [];
|
2518 | process.version = '';
|
2519 | process.versions = {};
|
2520 |
|
2521 | function noop() {}
|
2522 |
|
2523 | process.on = noop;
|
2524 | process.addListener = noop;
|
2525 | process.once = noop;
|
2526 | process.off = noop;
|
2527 | process.removeListener = noop;
|
2528 | process.removeAllListeners = noop;
|
2529 | process.emit = noop;
|
2530 | process.prependListener = noop;
|
2531 | process.prependOnceListener = noop;
|
2532 |
|
2533 | process.listeners = function (name) { return [] }
|
2534 |
|
2535 | process.binding = function (name) {
|
2536 | throw new Error('process.binding is not supported');
|
2537 | };
|
2538 |
|
2539 | process.cwd = function () { return '/' };
|
2540 | process.chdir = function (dir) {
|
2541 | throw new Error('process.chdir is not supported');
|
2542 | };
|
2543 | process.umask = function() { return 0; };
|
2544 |
|
2545 |
|
2546 | }),
|
2547 |
|
2548 | (function(module, exports, __webpack_require__) {
|
2549 |
|
2550 | 'use strict';
|
2551 |
|
2552 | exports.__esModule = true;
|
2553 |
|
2554 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; |
2555 |
|
2556 |
|
2557 |
|
2558 |
|
2559 |
|
2560 | var _react = __webpack_require__(1);
|
2561 |
|
2562 | var _react2 = _interopRequireDefault(_react);
|
2563 |
|
2564 | var _createChainableTypeChecker = __webpack_require__(29);
|
2565 |
|
2566 | var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);
|
2567 |
|
2568 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2569 |
|
2570 | function elementType(props, propName, componentName, location, propFullName) {
|
2571 | var propValue = props[propName];
|
2572 | var propType = typeof propValue === 'undefined' ? 'undefined' : _typeof(propValue);
|
2573 |
|
2574 | if (_react2.default.isValidElement(propValue)) {
|
2575 | return new Error('Invalid ' + location + ' `' + propFullName + '` of type ReactElement ' + ('supplied to `' + componentName + '`, expected an element type (a string ') + 'or a ReactClass).');
|
2576 | }
|
2577 |
|
2578 | if (propType !== 'function' && propType !== 'string') {
|
2579 | return new Error('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected an element type (a string ') + 'or a ReactClass).');
|
2580 | }
|
2581 |
|
2582 | return null;
|
2583 | }
|
2584 |
|
2585 | exports.default = (0, _createChainableTypeChecker2.default)(elementType);
|
2586 |
|
2587 | }),
|
2588 |
|
2589 | (function(module, exports) {
|
2590 |
|
2591 | 'use strict';
|
2592 |
|
2593 | exports.__esModule = true;
|
2594 | exports.default = isRequiredForA11y;
|
2595 | |
2596 |
|
2597 |
|
2598 |
|
2599 | function isRequiredForA11y(validator) {
|
2600 | return function validate(props, propName, componentName, location, propFullName) {
|
2601 | var componentNameSafe = componentName || '<<anonymous>>';
|
2602 | var propFullNameSafe = propFullName || propName;
|
2603 |
|
2604 | if (props[propName] == null) {
|
2605 | return new Error('The ' + location + ' `' + propFullNameSafe + '` is required to make ' + ('`' + componentNameSafe + '` accessible for users of assistive ') + 'technologies such as screen readers.');
|
2606 | }
|
2607 |
|
2608 | for (var _len = arguments.length, args = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {
|
2609 | args[_key - 5] = arguments[_key];
|
2610 | }
|
2611 |
|
2612 | return validator.apply(undefined, [props, propName, componentName, location, propFullName].concat(args));
|
2613 | };
|
2614 | }
|
2615 |
|
2616 | }),
|
2617 |
|
2618 | (function(module, exports) {
|
2619 |
|
2620 | "use strict";
|
2621 |
|
2622 | exports.__esModule = true;
|
2623 | exports.default = splitComponentProps;
|
2624 | |
2625 |
|
2626 |
|
2627 |
|
2628 | function _objectEntries(obj) {
|
2629 | var entries = [];
|
2630 | var keys = Object.keys(obj);
|
2631 |
|
2632 | for (var k = 0; k < keys.length; ++k) {
|
2633 | entries.push([keys[k], obj[keys[k]]]);
|
2634 | }return entries;
|
2635 | }
|
2636 |
|
2637 | |
2638 |
|
2639 |
|
2640 |
|
2641 |
|
2642 |
|
2643 | function splitComponentProps(props, Component) {
|
2644 | var componentPropTypes = Component.propTypes;
|
2645 |
|
2646 | var parentProps = {};
|
2647 | var childProps = {};
|
2648 |
|
2649 | _objectEntries(props).forEach(function (_ref) {
|
2650 | var propName = _ref[0],
|
2651 | propValue = _ref[1];
|
2652 |
|
2653 | if (componentPropTypes[propName]) {
|
2654 | parentProps[propName] = propValue;
|
2655 | } else {
|
2656 | childProps[propName] = propValue;
|
2657 | }
|
2658 | });
|
2659 |
|
2660 | return [parentProps, childProps];
|
2661 | }
|
2662 |
|
2663 | }),
|
2664 |
|
2665 | (function(module, exports) {
|
2666 |
|
2667 | 'use strict';
|
2668 |
|
2669 | exports.__esModule = true;
|
2670 | |
2671 |
|
2672 |
|
2673 |
|
2674 | function createChainedFunction() {
|
2675 | for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
|
2676 | funcs[_key] = arguments[_key];
|
2677 | }
|
2678 |
|
2679 | return funcs.filter(function (f) {
|
2680 | return f != null;
|
2681 | }).reduce(function (acc, f) {
|
2682 | if (typeof f !== 'function') {
|
2683 | throw new Error('Invalid Argument Type, must only provide functions, undefined, or null.');
|
2684 | }
|
2685 |
|
2686 | if (acc === null) {
|
2687 | return f;
|
2688 | }
|
2689 |
|
2690 | return function chainedFunction() {
|
2691 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
2692 | args[_key2] = arguments[_key2];
|
2693 | }
|
2694 |
|
2695 | acc.apply(this, args);
|
2696 | f.apply(this, args);
|
2697 | };
|
2698 | }, null);
|
2699 | }
|
2700 | exports.default = createChainedFunction;
|
2701 |
|
2702 | }),
|
2703 |
|
2704 | (function(module, exports) {
|
2705 |
|
2706 | |
2707 |
|
2708 |
|
2709 |
|
2710 | 'use strict';
|
2711 |
|
2712 | |
2713 |
|
2714 |
|
2715 |
|
2716 |
|
2717 |
|
2718 | var KeyCode = {
|
2719 | |
2720 |
|
2721 |
|
2722 | MAC_ENTER: 3,
|
2723 | |
2724 |
|
2725 |
|
2726 | BACKSPACE: 8,
|
2727 | |
2728 |
|
2729 |
|
2730 | TAB: 9,
|
2731 | |
2732 |
|
2733 |
|
2734 | NUM_CENTER: 12,
|
2735 | |
2736 |
|
2737 |
|
2738 | ENTER: 13,
|
2739 | |
2740 |
|
2741 |
|
2742 | SHIFT: 16,
|
2743 | |
2744 |
|
2745 |
|
2746 | CTRL: 17,
|
2747 | |
2748 |
|
2749 |
|
2750 | ALT: 18,
|
2751 | |
2752 |
|
2753 |
|
2754 | PAUSE: 19,
|
2755 | |
2756 |
|
2757 |
|
2758 | CAPS_LOCK: 20,
|
2759 | |
2760 |
|
2761 |
|
2762 | ESC: 27,
|
2763 | |
2764 |
|
2765 |
|
2766 | SPACE: 32,
|
2767 | |
2768 |
|
2769 |
|
2770 | PAGE_UP: 33,
|
2771 | |
2772 |
|
2773 |
|
2774 | PAGE_DOWN: 34,
|
2775 | |
2776 |
|
2777 |
|
2778 | END: 35,
|
2779 | |
2780 |
|
2781 |
|
2782 | HOME: 36,
|
2783 | |
2784 |
|
2785 |
|
2786 | LEFT: 37,
|
2787 | |
2788 |
|
2789 |
|
2790 | UP: 38,
|
2791 | |
2792 |
|
2793 |
|
2794 | RIGHT: 39,
|
2795 | |
2796 |
|
2797 |
|
2798 | DOWN: 40,
|
2799 | |
2800 |
|
2801 |
|
2802 | PRINT_SCREEN: 44,
|
2803 | |
2804 |
|
2805 |
|
2806 | INSERT: 45,
|
2807 | |
2808 |
|
2809 |
|
2810 | DELETE: 46,
|
2811 | |
2812 |
|
2813 |
|
2814 | ZERO: 48,
|
2815 | |
2816 |
|
2817 |
|
2818 | ONE: 49,
|
2819 | |
2820 |
|
2821 |
|
2822 | TWO: 50,
|
2823 | |
2824 |
|
2825 |
|
2826 | THREE: 51,
|
2827 | |
2828 |
|
2829 |
|
2830 | FOUR: 52,
|
2831 | |
2832 |
|
2833 |
|
2834 | FIVE: 53,
|
2835 | |
2836 |
|
2837 |
|
2838 | SIX: 54,
|
2839 | |
2840 |
|
2841 |
|
2842 | SEVEN: 55,
|
2843 | |
2844 |
|
2845 |
|
2846 | EIGHT: 56,
|
2847 | |
2848 |
|
2849 |
|
2850 | NINE: 57,
|
2851 | |
2852 |
|
2853 |
|
2854 | QUESTION_MARK: 63,
|
2855 | |
2856 |
|
2857 |
|
2858 | A: 65,
|
2859 | |
2860 |
|
2861 |
|
2862 | B: 66,
|
2863 | |
2864 |
|
2865 |
|
2866 | C: 67,
|
2867 | |
2868 |
|
2869 |
|
2870 | D: 68,
|
2871 | |
2872 |
|
2873 |
|
2874 | E: 69,
|
2875 | |
2876 |
|
2877 |
|
2878 | F: 70,
|
2879 | |
2880 |
|
2881 |
|
2882 | G: 71,
|
2883 | |
2884 |
|
2885 |
|
2886 | H: 72,
|
2887 | |
2888 |
|
2889 |
|
2890 | I: 73,
|
2891 | |
2892 |
|
2893 |
|
2894 | J: 74,
|
2895 | |
2896 |
|
2897 |
|
2898 | K: 75,
|
2899 | |
2900 |
|
2901 |
|
2902 | L: 76,
|
2903 | |
2904 |
|
2905 |
|
2906 | M: 77,
|
2907 | |
2908 |
|
2909 |
|
2910 | N: 78,
|
2911 | |
2912 |
|
2913 |
|
2914 | O: 79,
|
2915 | |
2916 |
|
2917 |
|
2918 | P: 80,
|
2919 | |
2920 |
|
2921 |
|
2922 | Q: 81,
|
2923 | |
2924 |
|
2925 |
|
2926 | R: 82,
|
2927 | |
2928 |
|
2929 |
|
2930 | S: 83,
|
2931 | |
2932 |
|
2933 |
|
2934 | T: 84,
|
2935 | |
2936 |
|
2937 |
|
2938 | U: 85,
|
2939 | |
2940 |
|
2941 |
|
2942 | V: 86,
|
2943 | |
2944 |
|
2945 |
|
2946 | W: 87,
|
2947 | |
2948 |
|
2949 |
|
2950 | X: 88,
|
2951 | |
2952 |
|
2953 |
|
2954 | Y: 89,
|
2955 | |
2956 |
|
2957 |
|
2958 | Z: 90,
|
2959 | |
2960 |
|
2961 |
|
2962 | META: 91,
|
2963 | |
2964 |
|
2965 |
|
2966 | WIN_KEY_RIGHT: 92,
|
2967 | |
2968 |
|
2969 |
|
2970 | CONTEXT_MENU: 93,
|
2971 | |
2972 |
|
2973 |
|
2974 | NUM_ZERO: 96,
|
2975 | |
2976 |
|
2977 |
|
2978 | NUM_ONE: 97,
|
2979 | |
2980 |
|
2981 |
|
2982 | NUM_TWO: 98,
|
2983 | |
2984 |
|
2985 |
|
2986 | NUM_THREE: 99,
|
2987 | |
2988 |
|
2989 |
|
2990 | NUM_FOUR: 100,
|
2991 | |
2992 |
|
2993 |
|
2994 | NUM_FIVE: 101,
|
2995 | |
2996 |
|
2997 |
|
2998 | NUM_SIX: 102,
|
2999 | |
3000 |
|
3001 |
|
3002 | NUM_SEVEN: 103,
|
3003 | |
3004 |
|
3005 |
|
3006 | NUM_EIGHT: 104,
|
3007 | |
3008 |
|
3009 |
|
3010 | NUM_NINE: 105,
|
3011 | |
3012 |
|
3013 |
|
3014 | NUM_MULTIPLY: 106,
|
3015 | |
3016 |
|
3017 |
|
3018 | NUM_PLUS: 107,
|
3019 | |
3020 |
|
3021 |
|
3022 | NUM_MINUS: 109,
|
3023 | |
3024 |
|
3025 |
|
3026 | NUM_PERIOD: 110,
|
3027 | |
3028 |
|
3029 |
|
3030 | NUM_DIVISION: 111,
|
3031 | |
3032 |
|
3033 |
|
3034 | F1: 112,
|
3035 | |
3036 |
|
3037 |
|
3038 | F2: 113,
|
3039 | |
3040 |
|
3041 |
|
3042 | F3: 114,
|
3043 | |
3044 |
|
3045 |
|
3046 | F4: 115,
|
3047 | |
3048 |
|
3049 |
|
3050 | F5: 116,
|
3051 | |
3052 |
|
3053 |
|
3054 | F6: 117,
|
3055 | |
3056 |
|
3057 |
|
3058 | F7: 118,
|
3059 | |
3060 |
|
3061 |
|
3062 | F8: 119,
|
3063 | |
3064 |
|
3065 |
|
3066 | F9: 120,
|
3067 | |
3068 |
|
3069 |
|
3070 | F10: 121,
|
3071 | |
3072 |
|
3073 |
|
3074 | F11: 122,
|
3075 | |
3076 |
|
3077 |
|
3078 | F12: 123,
|
3079 | |
3080 |
|
3081 |
|
3082 | NUMLOCK: 144,
|
3083 | |
3084 |
|
3085 |
|
3086 | SEMICOLON: 186,
|
3087 | |
3088 |
|
3089 |
|
3090 | DASH: 189,
|
3091 | |
3092 |
|
3093 |
|
3094 | EQUALS: 187,
|
3095 | |
3096 |
|
3097 |
|
3098 | COMMA: 188,
|
3099 | |
3100 |
|
3101 |
|
3102 | PERIOD: 190,
|
3103 | |
3104 |
|
3105 |
|
3106 | SLASH: 191,
|
3107 | |
3108 |
|
3109 |
|
3110 | APOSTROPHE: 192,
|
3111 | |
3112 |
|
3113 |
|
3114 | SINGLE_QUOTE: 222,
|
3115 | |
3116 |
|
3117 |
|
3118 | OPEN_SQUARE_BRACKET: 219,
|
3119 | |
3120 |
|
3121 |
|
3122 | BACKSLASH: 220,
|
3123 | |
3124 |
|
3125 |
|
3126 | CLOSE_SQUARE_BRACKET: 221,
|
3127 | |
3128 |
|
3129 |
|
3130 | WIN_KEY: 224,
|
3131 | |
3132 |
|
3133 |
|
3134 | MAC_FF_META: 224,
|
3135 | |
3136 |
|
3137 |
|
3138 | WIN_IME: 229
|
3139 | };
|
3140 |
|
3141 | |
3142 |
|
3143 |
|
3144 | KeyCode.isTextModifyingKeyEvent = function isTextModifyingKeyEvent(e) {
|
3145 | var keyCode = e.keyCode;
|
3146 | if (e.altKey && !e.ctrlKey || e.metaKey ||
|
3147 |
|
3148 | keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) {
|
3149 | return false;
|
3150 | }
|
3151 |
|
3152 |
|
3153 |
|
3154 | switch (keyCode) {
|
3155 | case KeyCode.ALT:
|
3156 | case KeyCode.CAPS_LOCK:
|
3157 | case KeyCode.CONTEXT_MENU:
|
3158 | case KeyCode.CTRL:
|
3159 | case KeyCode.DOWN:
|
3160 | case KeyCode.END:
|
3161 | case KeyCode.ESC:
|
3162 | case KeyCode.HOME:
|
3163 | case KeyCode.INSERT:
|
3164 | case KeyCode.LEFT:
|
3165 | case KeyCode.MAC_FF_META:
|
3166 | case KeyCode.META:
|
3167 | case KeyCode.NUMLOCK:
|
3168 | case KeyCode.NUM_CENTER:
|
3169 | case KeyCode.PAGE_DOWN:
|
3170 | case KeyCode.PAGE_UP:
|
3171 | case KeyCode.PAUSE:
|
3172 | case KeyCode.PRINT_SCREEN:
|
3173 | case KeyCode.RIGHT:
|
3174 | case KeyCode.SHIFT:
|
3175 | case KeyCode.UP:
|
3176 | case KeyCode.WIN_KEY:
|
3177 | case KeyCode.WIN_KEY_RIGHT:
|
3178 | return false;
|
3179 | default:
|
3180 | return true;
|
3181 | }
|
3182 | };
|
3183 |
|
3184 | |
3185 |
|
3186 |
|
3187 | KeyCode.isCharacterKey = function isCharacterKey(keyCode) {
|
3188 | if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) {
|
3189 | return true;
|
3190 | }
|
3191 |
|
3192 | if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) {
|
3193 | return true;
|
3194 | }
|
3195 |
|
3196 | if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) {
|
3197 | return true;
|
3198 | }
|
3199 |
|
3200 |
|
3201 | if (window.navigation.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) {
|
3202 | return true;
|
3203 | }
|
3204 |
|
3205 | switch (keyCode) {
|
3206 | case KeyCode.SPACE:
|
3207 | case KeyCode.QUESTION_MARK:
|
3208 | case KeyCode.NUM_PLUS:
|
3209 | case KeyCode.NUM_MINUS:
|
3210 | case KeyCode.NUM_PERIOD:
|
3211 | case KeyCode.NUM_DIVISION:
|
3212 | case KeyCode.SEMICOLON:
|
3213 | case KeyCode.DASH:
|
3214 | case KeyCode.EQUALS:
|
3215 | case KeyCode.COMMA:
|
3216 | case KeyCode.PERIOD:
|
3217 | case KeyCode.SLASH:
|
3218 | case KeyCode.APOSTROPHE:
|
3219 | case KeyCode.SINGLE_QUOTE:
|
3220 | case KeyCode.OPEN_SQUARE_BRACKET:
|
3221 | case KeyCode.BACKSLASH:
|
3222 | case KeyCode.CLOSE_SQUARE_BRACKET:
|
3223 | return true;
|
3224 | default:
|
3225 | return false;
|
3226 | }
|
3227 | };
|
3228 |
|
3229 | module.exports = KeyCode;
|
3230 |
|
3231 | }),
|
3232 |
|
3233 | (function(module, exports) {
|
3234 |
|
3235 | "use strict";
|
3236 |
|
3237 | exports.__esModule = true;
|
3238 | exports.default = contains;
|
3239 | |
3240 |
|
3241 |
|
3242 |
|
3243 | function contains(root, n) {
|
3244 | var node = n;
|
3245 | while (node) {
|
3246 | if (node === root) {
|
3247 | return true;
|
3248 | }
|
3249 | node = node.parentNode;
|
3250 | }
|
3251 |
|
3252 | return false;
|
3253 | }
|
3254 |
|
3255 | }),
|
3256 |
|
3257 | (function(module, exports, __webpack_require__) {
|
3258 |
|
3259 | 'use strict';
|
3260 |
|
3261 | exports.__esModule = true;
|
3262 | exports.default = addEventListenerWrap;
|
3263 |
|
3264 | var _addDomEventListener = __webpack_require__(41);
|
3265 |
|
3266 | var _addDomEventListener2 = _interopRequireDefault(_addDomEventListener);
|
3267 |
|
3268 | var _reactDom = __webpack_require__(2);
|
3269 |
|
3270 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
3271 |
|
3272 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3273 |
|
3274 | |
3275 |
|
3276 |
|
3277 |
|
3278 | function addEventListenerWrap(target, eventType, cb) {
|
3279 |
|
3280 | var callback = _reactDom2.default.unstable_batchedUpdates ? function run(e) {
|
3281 | _reactDom2.default.unstable_batchedUpdates(cb, e);
|
3282 | } : cb;
|
3283 | return (0, _addDomEventListener2.default)(target, eventType, callback);
|
3284 | }
|
3285 |
|
3286 | }),
|
3287 |
|
3288 | (function(module, exports, __webpack_require__) {
|
3289 |
|
3290 | 'use strict';
|
3291 |
|
3292 | Object.defineProperty(exports, '__esModule', {
|
3293 | value: true
|
3294 | });
|
3295 | exports['default'] = addEventListener;
|
3296 |
|
3297 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
3298 |
|
3299 | var _EventObject = __webpack_require__(42);
|
3300 |
|
3301 | var _EventObject2 = _interopRequireDefault(_EventObject);
|
3302 |
|
3303 | function addEventListener(target, eventType, callback, option) {
|
3304 | function wrapCallback(e) {
|
3305 | var ne = new _EventObject2['default'](e);
|
3306 | callback.call(target, ne);
|
3307 | }
|
3308 |
|
3309 | if (target.addEventListener) {
|
3310 | var _ret = (function () {
|
3311 | var useCapture = false;
|
3312 | if (typeof option === 'object') {
|
3313 | useCapture = option.capture || false;
|
3314 | } else if (typeof option === 'boolean') {
|
3315 | useCapture = option;
|
3316 | }
|
3317 |
|
3318 | target.addEventListener(eventType, wrapCallback, option || false);
|
3319 |
|
3320 | return {
|
3321 | v: {
|
3322 | remove: function remove() {
|
3323 | target.removeEventListener(eventType, wrapCallback, useCapture);
|
3324 | }
|
3325 | }
|
3326 | };
|
3327 | })();
|
3328 |
|
3329 | if (typeof _ret === 'object') return _ret.v;
|
3330 | } else if (target.attachEvent) {
|
3331 | target.attachEvent('on' + eventType, wrapCallback);
|
3332 | return {
|
3333 | remove: function remove() {
|
3334 | target.detachEvent('on' + eventType, wrapCallback);
|
3335 | }
|
3336 | };
|
3337 | }
|
3338 | }
|
3339 |
|
3340 | module.exports = exports['default'];
|
3341 |
|
3342 | }),
|
3343 |
|
3344 | (function(module, exports, __webpack_require__) {
|
3345 |
|
3346 | |
3347 |
|
3348 |
|
3349 |
|
3350 |
|
3351 |
|
3352 | 'use strict';
|
3353 |
|
3354 | Object.defineProperty(exports, '__esModule', {
|
3355 | value: true
|
3356 | });
|
3357 |
|
3358 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
3359 |
|
3360 | var _EventBaseObject = __webpack_require__(43);
|
3361 |
|
3362 | var _EventBaseObject2 = _interopRequireDefault(_EventBaseObject);
|
3363 |
|
3364 | var _objectAssign = __webpack_require__(44);
|
3365 |
|
3366 | var _objectAssign2 = _interopRequireDefault(_objectAssign);
|
3367 |
|
3368 | var TRUE = true;
|
3369 | var FALSE = false;
|
3370 | var commonProps = ['altKey', 'bubbles', 'cancelable', 'ctrlKey', 'currentTarget', 'eventPhase', 'metaKey', 'shiftKey', 'target', 'timeStamp', 'view', 'type'];
|
3371 |
|
3372 | function isNullOrUndefined(w) {
|
3373 | return w === null || w === undefined;
|
3374 | }
|
3375 |
|
3376 | var eventNormalizers = [{
|
3377 | reg: /^key/,
|
3378 | props: ['char', 'charCode', 'key', 'keyCode', 'which'],
|
3379 | fix: function fix(event, nativeEvent) {
|
3380 | if (isNullOrUndefined(event.which)) {
|
3381 | event.which = !isNullOrUndefined(nativeEvent.charCode) ? nativeEvent.charCode : nativeEvent.keyCode;
|
3382 | }
|
3383 |
|
3384 |
|
3385 | if (event.metaKey === undefined) {
|
3386 | event.metaKey = event.ctrlKey;
|
3387 | }
|
3388 | }
|
3389 | }, {
|
3390 | reg: /^touch/,
|
3391 | props: ['touches', 'changedTouches', 'targetTouches']
|
3392 | }, {
|
3393 | reg: /^hashchange$/,
|
3394 | props: ['newURL', 'oldURL']
|
3395 | }, {
|
3396 | reg: /^gesturechange$/i,
|
3397 | props: ['rotation', 'scale']
|
3398 | }, {
|
3399 | reg: /^(mousewheel|DOMMouseScroll)$/,
|
3400 | props: [],
|
3401 | fix: function fix(event, nativeEvent) {
|
3402 | var deltaX = undefined;
|
3403 | var deltaY = undefined;
|
3404 | var delta = undefined;
|
3405 | var wheelDelta = nativeEvent.wheelDelta;
|
3406 | var axis = nativeEvent.axis;
|
3407 | var wheelDeltaY = nativeEvent.wheelDeltaY;
|
3408 | var wheelDeltaX = nativeEvent.wheelDeltaX;
|
3409 | var detail = nativeEvent.detail;
|
3410 |
|
3411 |
|
3412 | if (wheelDelta) {
|
3413 | delta = wheelDelta / 120;
|
3414 | }
|
3415 |
|
3416 |
|
3417 | if (detail) {
|
3418 |
|
3419 | delta = 0 - (detail % 3 === 0 ? detail / 3 : detail);
|
3420 | }
|
3421 |
|
3422 |
|
3423 | if (axis !== undefined) {
|
3424 | if (axis === event.HORIZONTAL_AXIS) {
|
3425 | deltaY = 0;
|
3426 | deltaX = 0 - delta;
|
3427 | } else if (axis === event.VERTICAL_AXIS) {
|
3428 | deltaX = 0;
|
3429 | deltaY = delta;
|
3430 | }
|
3431 | }
|
3432 |
|
3433 |
|
3434 | if (wheelDeltaY !== undefined) {
|
3435 | deltaY = wheelDeltaY / 120;
|
3436 | }
|
3437 | if (wheelDeltaX !== undefined) {
|
3438 | deltaX = -1 * wheelDeltaX / 120;
|
3439 | }
|
3440 |
|
3441 |
|
3442 | if (!deltaX && !deltaY) {
|
3443 | deltaY = delta;
|
3444 | }
|
3445 |
|
3446 | if (deltaX !== undefined) {
|
3447 | |
3448 |
|
3449 |
|
3450 |
|
3451 |
|
3452 | event.deltaX = deltaX;
|
3453 | }
|
3454 |
|
3455 | if (deltaY !== undefined) {
|
3456 | |
3457 |
|
3458 |
|
3459 |
|
3460 |
|
3461 | event.deltaY = deltaY;
|
3462 | }
|
3463 |
|
3464 | if (delta !== undefined) {
|
3465 | |
3466 |
|
3467 |
|
3468 |
|
3469 |
|
3470 | event.delta = delta;
|
3471 | }
|
3472 | }
|
3473 | }, {
|
3474 | reg: /^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i,
|
3475 | props: ['buttons', 'clientX', 'clientY', 'button', 'offsetX', 'relatedTarget', 'which', 'fromElement', 'toElement', 'offsetY', 'pageX', 'pageY', 'screenX', 'screenY'],
|
3476 | fix: function fix(event, nativeEvent) {
|
3477 | var eventDoc = undefined;
|
3478 | var doc = undefined;
|
3479 | var body = undefined;
|
3480 | var target = event.target;
|
3481 | var button = nativeEvent.button;
|
3482 |
|
3483 |
|
3484 | if (target && isNullOrUndefined(event.pageX) && !isNullOrUndefined(nativeEvent.clientX)) {
|
3485 | eventDoc = target.ownerDocument || document;
|
3486 | doc = eventDoc.documentElement;
|
3487 | body = eventDoc.body;
|
3488 | event.pageX = nativeEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
|
3489 | event.pageY = nativeEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
|
3490 | }
|
3491 |
|
3492 |
|
3493 |
|
3494 | if (!event.which && button !== undefined) {
|
3495 | if (button & 1) {
|
3496 | event.which = 1;
|
3497 | } else if (button & 2) {
|
3498 | event.which = 3;
|
3499 | } else if (button & 4) {
|
3500 | event.which = 2;
|
3501 | } else {
|
3502 | event.which = 0;
|
3503 | }
|
3504 | }
|
3505 |
|
3506 |
|
3507 | if (!event.relatedTarget && event.fromElement) {
|
3508 | event.relatedTarget = event.fromElement === target ? event.toElement : event.fromElement;
|
3509 | }
|
3510 |
|
3511 | return event;
|
3512 | }
|
3513 | }];
|
3514 |
|
3515 | function retTrue() {
|
3516 | return TRUE;
|
3517 | }
|
3518 |
|
3519 | function retFalse() {
|
3520 | return FALSE;
|
3521 | }
|
3522 |
|
3523 | function DomEventObject(nativeEvent) {
|
3524 | var type = nativeEvent.type;
|
3525 |
|
3526 | var isNative = typeof nativeEvent.stopPropagation === 'function' || typeof nativeEvent.cancelBubble === 'boolean';
|
3527 |
|
3528 | _EventBaseObject2['default'].call(this);
|
3529 |
|
3530 | this.nativeEvent = nativeEvent;
|
3531 |
|
3532 |
|
3533 | var isDefaultPrevented = retFalse;
|
3534 | if ('defaultPrevented' in nativeEvent) {
|
3535 | isDefaultPrevented = nativeEvent.defaultPrevented ? retTrue : retFalse;
|
3536 | } else if ('getPreventDefault' in nativeEvent) {
|
3537 |
|
3538 | isDefaultPrevented = nativeEvent.getPreventDefault() ? retTrue : retFalse;
|
3539 | } else if ('returnValue' in nativeEvent) {
|
3540 | isDefaultPrevented = nativeEvent.returnValue === FALSE ? retTrue : retFalse;
|
3541 | }
|
3542 |
|
3543 | this.isDefaultPrevented = isDefaultPrevented;
|
3544 |
|
3545 | var fixFns = [];
|
3546 | var fixFn = undefined;
|
3547 | var l = undefined;
|
3548 | var prop = undefined;
|
3549 | var props = commonProps.concat();
|
3550 |
|
3551 | eventNormalizers.forEach(function (normalizer) {
|
3552 | if (type.match(normalizer.reg)) {
|
3553 | props = props.concat(normalizer.props);
|
3554 | if (normalizer.fix) {
|
3555 | fixFns.push(normalizer.fix);
|
3556 | }
|
3557 | }
|
3558 | });
|
3559 |
|
3560 | l = props.length;
|
3561 |
|
3562 |
|
3563 | while (l) {
|
3564 | prop = props[--l];
|
3565 | this[prop] = nativeEvent[prop];
|
3566 | }
|
3567 |
|
3568 |
|
3569 | if (!this.target && isNative) {
|
3570 | this.target = nativeEvent.srcElement || document;
|
3571 | }
|
3572 |
|
3573 |
|
3574 | if (this.target && this.target.nodeType === 3) {
|
3575 | this.target = this.target.parentNode;
|
3576 | }
|
3577 |
|
3578 | l = fixFns.length;
|
3579 |
|
3580 | while (l) {
|
3581 | fixFn = fixFns[--l];
|
3582 | fixFn(this, nativeEvent);
|
3583 | }
|
3584 |
|
3585 | this.timeStamp = nativeEvent.timeStamp || Date.now();
|
3586 | }
|
3587 |
|
3588 | var EventBaseObjectProto = _EventBaseObject2['default'].prototype;
|
3589 |
|
3590 | (0, _objectAssign2['default'])(DomEventObject.prototype, EventBaseObjectProto, {
|
3591 | constructor: DomEventObject,
|
3592 |
|
3593 | preventDefault: function preventDefault() {
|
3594 | var e = this.nativeEvent;
|
3595 |
|
3596 |
|
3597 | if (e.preventDefault) {
|
3598 | e.preventDefault();
|
3599 | } else {
|
3600 |
|
3601 | e.returnValue = FALSE;
|
3602 | }
|
3603 |
|
3604 | EventBaseObjectProto.preventDefault.call(this);
|
3605 | },
|
3606 |
|
3607 | stopPropagation: function stopPropagation() {
|
3608 | var e = this.nativeEvent;
|
3609 |
|
3610 |
|
3611 | if (e.stopPropagation) {
|
3612 | e.stopPropagation();
|
3613 | } else {
|
3614 |
|
3615 | e.cancelBubble = TRUE;
|
3616 | }
|
3617 |
|
3618 | EventBaseObjectProto.stopPropagation.call(this);
|
3619 | }
|
3620 | });
|
3621 |
|
3622 | exports['default'] = DomEventObject;
|
3623 | module.exports = exports['default'];
|
3624 |
|
3625 | }),
|
3626 |
|
3627 | (function(module, exports) {
|
3628 |
|
3629 | |
3630 |
|
3631 |
|
3632 |
|
3633 |
|
3634 |
|
3635 | "use strict";
|
3636 |
|
3637 | Object.defineProperty(exports, "__esModule", {
|
3638 | value: true
|
3639 | });
|
3640 | function returnFalse() {
|
3641 | return false;
|
3642 | }
|
3643 |
|
3644 | function returnTrue() {
|
3645 | return true;
|
3646 | }
|
3647 |
|
3648 | function EventBaseObject() {
|
3649 | this.timeStamp = Date.now();
|
3650 | this.target = undefined;
|
3651 | this.currentTarget = undefined;
|
3652 | }
|
3653 |
|
3654 | EventBaseObject.prototype = {
|
3655 | isEventObject: 1,
|
3656 |
|
3657 | constructor: EventBaseObject,
|
3658 |
|
3659 | isDefaultPrevented: returnFalse,
|
3660 |
|
3661 | isPropagationStopped: returnFalse,
|
3662 |
|
3663 | isImmediatePropagationStopped: returnFalse,
|
3664 |
|
3665 | preventDefault: function preventDefault() {
|
3666 | this.isDefaultPrevented = returnTrue;
|
3667 | },
|
3668 |
|
3669 | stopPropagation: function stopPropagation() {
|
3670 | this.isPropagationStopped = returnTrue;
|
3671 | },
|
3672 |
|
3673 | stopImmediatePropagation: function stopImmediatePropagation() {
|
3674 | this.isImmediatePropagationStopped = returnTrue;
|
3675 |
|
3676 |
|
3677 | this.stopPropagation();
|
3678 | },
|
3679 |
|
3680 | halt: function halt(immediate) {
|
3681 | if (immediate) {
|
3682 | this.stopImmediatePropagation();
|
3683 | } else {
|
3684 | this.stopPropagation();
|
3685 | }
|
3686 | this.preventDefault();
|
3687 | }
|
3688 | };
|
3689 |
|
3690 | exports["default"] = EventBaseObject;
|
3691 | module.exports = exports["default"];
|
3692 |
|
3693 | }),
|
3694 |
|
3695 | (function(module, exports) {
|
3696 |
|
3697 | |
3698 |
|
3699 |
|
3700 |
|
3701 |
|
3702 |
|
3703 | 'use strict';
|
3704 |
|
3705 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
3706 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
3707 | var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
3708 |
|
3709 | function toObject(val) {
|
3710 | if (val === null || val === undefined) {
|
3711 | throw new TypeError('Object.assign cannot be called with null or undefined');
|
3712 | }
|
3713 |
|
3714 | return Object(val);
|
3715 | }
|
3716 |
|
3717 | function shouldUseNative() {
|
3718 | try {
|
3719 | if (!Object.assign) {
|
3720 | return false;
|
3721 | }
|
3722 |
|
3723 |
|
3724 |
|
3725 |
|
3726 | var test1 = new String('abc');
|
3727 | test1[5] = 'de';
|
3728 | if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
3729 | return false;
|
3730 | }
|
3731 |
|
3732 |
|
3733 | var test2 = {};
|
3734 | for (var i = 0; i < 10; i++) {
|
3735 | test2['_' + String.fromCharCode(i)] = i;
|
3736 | }
|
3737 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
3738 | return test2[n];
|
3739 | });
|
3740 | if (order2.join('') !== '0123456789') {
|
3741 | return false;
|
3742 | }
|
3743 |
|
3744 |
|
3745 | var test3 = {};
|
3746 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
3747 | test3[letter] = letter;
|
3748 | });
|
3749 | if (Object.keys(Object.assign({}, test3)).join('') !==
|
3750 | 'abcdefghijklmnopqrst') {
|
3751 | return false;
|
3752 | }
|
3753 |
|
3754 | return true;
|
3755 | } catch (err) {
|
3756 |
|
3757 | return false;
|
3758 | }
|
3759 | }
|
3760 |
|
3761 | module.exports = shouldUseNative() ? Object.assign : function (target, source) {
|
3762 | var from;
|
3763 | var to = toObject(target);
|
3764 | var symbols;
|
3765 |
|
3766 | for (var s = 1; s < arguments.length; s++) {
|
3767 | from = Object(arguments[s]);
|
3768 |
|
3769 | for (var key in from) {
|
3770 | if (hasOwnProperty.call(from, key)) {
|
3771 | to[key] = from[key];
|
3772 | }
|
3773 | }
|
3774 |
|
3775 | if (getOwnPropertySymbols) {
|
3776 | symbols = getOwnPropertySymbols(from);
|
3777 | for (var i = 0; i < symbols.length; i++) {
|
3778 | if (propIsEnumerable.call(from, symbols[i])) {
|
3779 | to[symbols[i]] = from[symbols[i]];
|
3780 | }
|
3781 | }
|
3782 | }
|
3783 | }
|
3784 |
|
3785 | return to;
|
3786 | };
|
3787 |
|
3788 |
|
3789 | }),
|
3790 |
|
3791 | (function(module, exports, __webpack_require__) {
|
3792 |
|
3793 | 'use strict';
|
3794 |
|
3795 | exports.__esModule = true;
|
3796 |
|
3797 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; |
3798 |
|
3799 |
|
3800 |
|
3801 |
|
3802 |
|
3803 | var _Event = __webpack_require__(46);
|
3804 |
|
3805 | var _Event2 = _interopRequireDefault(_Event);
|
3806 |
|
3807 | var _componentClasses = __webpack_require__(47);
|
3808 |
|
3809 | var _componentClasses2 = _interopRequireDefault(_componentClasses);
|
3810 |
|
3811 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3812 |
|
3813 | var isCssAnimationSupported = _Event2.default.endEvents.length !== 0;
|
3814 |
|
3815 |
|
3816 | var capitalPrefixes = ['Webkit', 'Moz', 'O',
|
3817 |
|
3818 | 'ms'];
|
3819 | var prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', ''];
|
3820 |
|
3821 | function getStyleProperty(node, name) {
|
3822 | var style = window.getComputedStyle(node);
|
3823 |
|
3824 | var ret = '';
|
3825 | for (var i = 0; i < prefixes.length; i++) {
|
3826 | ret = style.getPropertyValue(prefixes[i] + name);
|
3827 | if (ret) {
|
3828 | break;
|
3829 | }
|
3830 | }
|
3831 | return ret;
|
3832 | }
|
3833 |
|
3834 | function fixBrowserByTimeout(node) {
|
3835 | if (isCssAnimationSupported) {
|
3836 | var transitionDelay = parseFloat(getStyleProperty(node, 'transition-delay')) || 0;
|
3837 | var transitionDuration = parseFloat(getStyleProperty(node, 'transition-duration')) || 0;
|
3838 | var animationDelay = parseFloat(getStyleProperty(node, 'animation-delay')) || 0;
|
3839 | var animationDuration = parseFloat(getStyleProperty(node, 'animation-duration')) || 0;
|
3840 | var time = Math.max(transitionDuration + transitionDelay, animationDuration + animationDelay);
|
3841 |
|
3842 | node.rcEndAnimTimeout = setTimeout(function () {
|
3843 | node.rcEndAnimTimeout = null;
|
3844 | if (node.rcEndListener) {
|
3845 | node.rcEndListener();
|
3846 | }
|
3847 | }, time * 1000 + 200);
|
3848 | }
|
3849 | }
|
3850 |
|
3851 | function clearBrowserBugTimeout(node) {
|
3852 | if (node.rcEndAnimTimeout) {
|
3853 | clearTimeout(node.rcEndAnimTimeout);
|
3854 | node.rcEndAnimTimeout = null;
|
3855 | }
|
3856 | }
|
3857 |
|
3858 | var cssAnimation = function cssAnimation(node, transitionName, endCallback) {
|
3859 | var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object';
|
3860 | var className = nameIsObj ? transitionName.name : transitionName;
|
3861 | var activeClassName = nameIsObj ? transitionName.active : transitionName + '-active';
|
3862 | var end = endCallback;
|
3863 | var start = void 0;
|
3864 | var active = void 0;
|
3865 | var nodeClasses = (0, _componentClasses2.default)(node);
|
3866 |
|
3867 | if (endCallback && Object.prototype.toString.call(endCallback) === '[object Object]') {
|
3868 | end = endCallback.end;
|
3869 | start = endCallback.start;
|
3870 | active = endCallback.active;
|
3871 | }
|
3872 |
|
3873 | if (node.rcEndListener) {
|
3874 | node.rcEndListener();
|
3875 | }
|
3876 |
|
3877 | node.rcEndListener = function (e) {
|
3878 | if (e && e.target !== node) {
|
3879 | return;
|
3880 | }
|
3881 |
|
3882 | if (node.rcAnimTimeout) {
|
3883 | clearTimeout(node.rcAnimTimeout);
|
3884 | node.rcAnimTimeout = null;
|
3885 | }
|
3886 |
|
3887 | clearBrowserBugTimeout(node);
|
3888 |
|
3889 | nodeClasses.remove(className);
|
3890 | nodeClasses.remove(activeClassName);
|
3891 |
|
3892 | _Event2.default.removeEndEventListener(node, node.rcEndListener);
|
3893 | node.rcEndListener = null;
|
3894 |
|
3895 |
|
3896 |
|
3897 | if (end) {
|
3898 | end();
|
3899 | }
|
3900 | };
|
3901 |
|
3902 | _Event2.default.addEndEventListener(node, node.rcEndListener);
|
3903 |
|
3904 | if (start) {
|
3905 | start();
|
3906 | }
|
3907 | nodeClasses.add(className);
|
3908 |
|
3909 | node.rcAnimTimeout = setTimeout(function () {
|
3910 | node.rcAnimTimeout = null;
|
3911 | nodeClasses.add(activeClassName);
|
3912 | if (active) {
|
3913 | setTimeout(active, 0);
|
3914 | }
|
3915 | fixBrowserByTimeout(node);
|
3916 |
|
3917 | }, 30);
|
3918 |
|
3919 | return {
|
3920 | stop: function stop() {
|
3921 | if (node.rcEndListener) {
|
3922 | node.rcEndListener();
|
3923 | }
|
3924 | }
|
3925 | };
|
3926 | };
|
3927 |
|
3928 | cssAnimation.style = function (node, style, callback) {
|
3929 | if (node.rcEndListener) {
|
3930 | node.rcEndListener();
|
3931 | }
|
3932 |
|
3933 | node.rcEndListener = function (e) {
|
3934 | if (e && e.target !== node) {
|
3935 | return;
|
3936 | }
|
3937 |
|
3938 | if (node.rcAnimTimeout) {
|
3939 | clearTimeout(node.rcAnimTimeout);
|
3940 | node.rcAnimTimeout = null;
|
3941 | }
|
3942 |
|
3943 | clearBrowserBugTimeout(node);
|
3944 |
|
3945 | _Event2.default.removeEndEventListener(node, node.rcEndListener);
|
3946 | node.rcEndListener = null;
|
3947 |
|
3948 |
|
3949 |
|
3950 | if (callback) {
|
3951 | callback();
|
3952 | }
|
3953 | };
|
3954 |
|
3955 | _Event2.default.addEndEventListener(node, node.rcEndListener);
|
3956 |
|
3957 | node.rcAnimTimeout = setTimeout(function () {
|
3958 | for (var s in style) {
|
3959 | if (style.hasOwnProperty(s)) {
|
3960 | node.style[s] = style[s];
|
3961 | }
|
3962 | }
|
3963 | node.rcAnimTimeout = null;
|
3964 | fixBrowserByTimeout(node);
|
3965 | }, 0);
|
3966 | };
|
3967 |
|
3968 | cssAnimation.setTransition = function (node, p, value) {
|
3969 | var property = p;
|
3970 | var v = value;
|
3971 | if (value === undefined) {
|
3972 | v = property;
|
3973 | property = '';
|
3974 | }
|
3975 | property = property || '';
|
3976 | capitalPrefixes.forEach(function (prefix) {
|
3977 | node.style[prefix + 'Transition' + property] = v;
|
3978 | });
|
3979 | };
|
3980 |
|
3981 | cssAnimation.isCssAnimationSupported = isCssAnimationSupported;
|
3982 |
|
3983 | exports.default = cssAnimation;
|
3984 |
|
3985 | }),
|
3986 |
|
3987 | (function(module, exports) {
|
3988 |
|
3989 | 'use strict';
|
3990 |
|
3991 | exports.__esModule = true;
|
3992 | |
3993 |
|
3994 |
|
3995 |
|
3996 | var EVENT_NAME_MAP = {
|
3997 | transitionend: {
|
3998 | transition: 'transitionend',
|
3999 | WebkitTransition: 'webkitTransitionEnd',
|
4000 | MozTransition: 'mozTransitionEnd',
|
4001 | OTransition: 'oTransitionEnd',
|
4002 | msTransition: 'MSTransitionEnd'
|
4003 | },
|
4004 |
|
4005 | animationend: {
|
4006 | animation: 'animationend',
|
4007 | WebkitAnimation: 'webkitAnimationEnd',
|
4008 | MozAnimation: 'mozAnimationEnd',
|
4009 | OAnimation: 'oAnimationEnd',
|
4010 | msAnimation: 'MSAnimationEnd'
|
4011 | }
|
4012 | };
|
4013 |
|
4014 | var endEvents = [];
|
4015 |
|
4016 | function detectEvents() {
|
4017 | var testEl = document.createElement('div');
|
4018 | var style = testEl.style;
|
4019 |
|
4020 | if (!('AnimationEvent' in window)) {
|
4021 | delete EVENT_NAME_MAP.animationend.animation;
|
4022 | }
|
4023 |
|
4024 | if (!('TransitionEvent' in window)) {
|
4025 | delete EVENT_NAME_MAP.transitionend.transition;
|
4026 | }
|
4027 |
|
4028 | for (var baseEventName in EVENT_NAME_MAP) {
|
4029 | if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) {
|
4030 | var baseEvents = EVENT_NAME_MAP[baseEventName];
|
4031 | for (var styleName in baseEvents) {
|
4032 | if (styleName in style) {
|
4033 | endEvents.push(baseEvents[styleName]);
|
4034 | break;
|
4035 | }
|
4036 | }
|
4037 | }
|
4038 | }
|
4039 | }
|
4040 |
|
4041 | if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
4042 | detectEvents();
|
4043 | }
|
4044 |
|
4045 | function addEventListener(node, eventName, eventListener) {
|
4046 | node.addEventListener(eventName, eventListener, false);
|
4047 | }
|
4048 |
|
4049 | function removeEventListener(node, eventName, eventListener) {
|
4050 | node.removeEventListener(eventName, eventListener, false);
|
4051 | }
|
4052 |
|
4053 | var TransitionEvents = {
|
4054 | addEndEventListener: function addEndEventListener(node, eventListener) {
|
4055 | if (endEvents.length === 0) {
|
4056 | window.setTimeout(eventListener, 0);
|
4057 | return;
|
4058 | }
|
4059 | endEvents.forEach(function (endEvent) {
|
4060 | addEventListener(node, endEvent, eventListener);
|
4061 | });
|
4062 | },
|
4063 |
|
4064 |
|
4065 | endEvents: endEvents,
|
4066 |
|
4067 | removeEndEventListener: function removeEndEventListener(node, eventListener) {
|
4068 | if (endEvents.length === 0) {
|
4069 | return;
|
4070 | }
|
4071 | endEvents.forEach(function (endEvent) {
|
4072 | removeEventListener(node, endEvent, eventListener);
|
4073 | });
|
4074 | }
|
4075 | };
|
4076 |
|
4077 | exports.default = TransitionEvents;
|
4078 |
|
4079 | }),
|
4080 |
|
4081 | (function(module, exports, __webpack_require__) {
|
4082 |
|
4083 | |
4084 |
|
4085 |
|
4086 |
|
4087 | try {
|
4088 | var index = __webpack_require__(48);
|
4089 | } catch (err) {
|
4090 | var index = __webpack_require__(48);
|
4091 | }
|
4092 |
|
4093 | |
4094 |
|
4095 |
|
4096 |
|
4097 | var re = /\s+/;
|
4098 |
|
4099 | |
4100 |
|
4101 |
|
4102 |
|
4103 | var toString = Object.prototype.toString;
|
4104 |
|
4105 | |
4106 |
|
4107 |
|
4108 |
|
4109 |
|
4110 |
|
4111 |
|
4112 |
|
4113 | module.exports = function(el){
|
4114 | return new ClassList(el);
|
4115 | };
|
4116 |
|
4117 | |
4118 |
|
4119 |
|
4120 |
|
4121 |
|
4122 |
|
4123 |
|
4124 | function ClassList(el) {
|
4125 | if (!el || !el.nodeType) {
|
4126 | throw new Error('A DOM element reference is required');
|
4127 | }
|
4128 | this.el = el;
|
4129 | this.list = el.classList;
|
4130 | }
|
4131 |
|
4132 | |
4133 |
|
4134 |
|
4135 |
|
4136 |
|
4137 |
|
4138 |
|
4139 |
|
4140 | ClassList.prototype.add = function(name){
|
4141 |
|
4142 | if (this.list) {
|
4143 | this.list.add(name);
|
4144 | return this;
|
4145 | }
|
4146 |
|
4147 |
|
4148 | var arr = this.array();
|
4149 | var i = index(arr, name);
|
4150 | if (!~i) arr.push(name);
|
4151 | this.el.className = arr.join(' ');
|
4152 | return this;
|
4153 | };
|
4154 |
|
4155 | |
4156 |
|
4157 |
|
4158 |
|
4159 |
|
4160 |
|
4161 |
|
4162 |
|
4163 |
|
4164 |
|
4165 | ClassList.prototype.remove = function(name){
|
4166 | if ('[object RegExp]' == toString.call(name)) {
|
4167 | return this.removeMatching(name);
|
4168 | }
|
4169 |
|
4170 |
|
4171 | if (this.list) {
|
4172 | this.list.remove(name);
|
4173 | return this;
|
4174 | }
|
4175 |
|
4176 |
|
4177 | var arr = this.array();
|
4178 | var i = index(arr, name);
|
4179 | if (~i) arr.splice(i, 1);
|
4180 | this.el.className = arr.join(' ');
|
4181 | return this;
|
4182 | };
|
4183 |
|
4184 | |
4185 |
|
4186 |
|
4187 |
|
4188 |
|
4189 |
|
4190 |
|
4191 |
|
4192 | ClassList.prototype.removeMatching = function(re){
|
4193 | var arr = this.array();
|
4194 | for (var i = 0; i < arr.length; i++) {
|
4195 | if (re.test(arr[i])) {
|
4196 | this.remove(arr[i]);
|
4197 | }
|
4198 | }
|
4199 | return this;
|
4200 | };
|
4201 |
|
4202 | |
4203 |
|
4204 |
|
4205 |
|
4206 |
|
4207 |
|
4208 |
|
4209 |
|
4210 |
|
4211 |
|
4212 |
|
4213 |
|
4214 | ClassList.prototype.toggle = function(name, force){
|
4215 |
|
4216 | if (this.list) {
|
4217 | if ("undefined" !== typeof force) {
|
4218 | if (force !== this.list.toggle(name, force)) {
|
4219 | this.list.toggle(name);
|
4220 | }
|
4221 | } else {
|
4222 | this.list.toggle(name);
|
4223 | }
|
4224 | return this;
|
4225 | }
|
4226 |
|
4227 |
|
4228 | if ("undefined" !== typeof force) {
|
4229 | if (!force) {
|
4230 | this.remove(name);
|
4231 | } else {
|
4232 | this.add(name);
|
4233 | }
|
4234 | } else {
|
4235 | if (this.has(name)) {
|
4236 | this.remove(name);
|
4237 | } else {
|
4238 | this.add(name);
|
4239 | }
|
4240 | }
|
4241 |
|
4242 | return this;
|
4243 | };
|
4244 |
|
4245 | |
4246 |
|
4247 |
|
4248 |
|
4249 |
|
4250 |
|
4251 |
|
4252 | ClassList.prototype.array = function(){
|
4253 | var className = this.el.getAttribute('class') || '';
|
4254 | var str = className.replace(/^\s+|\s+$/g, '');
|
4255 | var arr = str.split(re);
|
4256 | if ('' === arr[0]) arr.shift();
|
4257 | return arr;
|
4258 | };
|
4259 |
|
4260 | |
4261 |
|
4262 |
|
4263 |
|
4264 |
|
4265 |
|
4266 |
|
4267 |
|
4268 | ClassList.prototype.has =
|
4269 | ClassList.prototype.contains = function(name){
|
4270 | return this.list
|
4271 | ? this.list.contains(name)
|
4272 | : !! ~index(this.array(), name);
|
4273 | };
|
4274 |
|
4275 |
|
4276 | }),
|
4277 |
|
4278 | (function(module, exports) {
|
4279 |
|
4280 | module.exports = function(arr, obj){
|
4281 | if (arr.indexOf) return arr.indexOf(obj);
|
4282 | for (var i = 0; i < arr.length; ++i) {
|
4283 | if (arr[i] === obj) return i;
|
4284 | }
|
4285 | return -1;
|
4286 | };
|
4287 |
|
4288 | }),
|
4289 |
|
4290 | (function(module, exports, __webpack_require__) {
|
4291 |
|
4292 | 'use strict';
|
4293 |
|
4294 | exports.__esModule = true;
|
4295 | exports.default = toArray;
|
4296 |
|
4297 | var _react = __webpack_require__(1);
|
4298 |
|
4299 | var _react2 = _interopRequireDefault(_react);
|
4300 |
|
4301 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
4302 |
|
4303 | function toArray(children) {
|
4304 | var ret = [];
|
4305 | _react2.default.Children.forEach(children, function (c) {
|
4306 | ret.push(c);
|
4307 | });
|
4308 | return ret;
|
4309 | } |
4310 |
|
4311 |
|
4312 |
|
4313 |
|
4314 | }),
|
4315 |
|
4316 | (function(module, exports, __webpack_require__) {
|
4317 |
|
4318 | 'use strict';
|
4319 |
|
4320 | exports.__esModule = true;
|
4321 |
|
4322 | var _react = __webpack_require__(1);
|
4323 |
|
4324 | var _react2 = _interopRequireDefault(_react);
|
4325 |
|
4326 | var _propTypes = __webpack_require__(6);
|
4327 |
|
4328 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
4329 |
|
4330 | var _reactDom = __webpack_require__(2);
|
4331 |
|
4332 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
4333 |
|
4334 | var _domAlign = __webpack_require__(51);
|
4335 |
|
4336 | var _domAlign2 = _interopRequireDefault(_domAlign);
|
4337 |
|
4338 | var _addEventListener = __webpack_require__(40);
|
4339 |
|
4340 | var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
4341 |
|
4342 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
4343 |
|
4344 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
4345 |
|
4346 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
4347 |
|
4348 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } |
4349 |
|
4350 |
|
4351 |
|
4352 |
|
4353 |
|
4354 |
|
4355 |
|
4356 | function isWindow(obj) {
|
4357 |
|
4358 |
|
4359 | return obj != null && obj == obj.window;
|
4360 | }
|
4361 |
|
4362 | function buffer(fn, ms) {
|
4363 | var timer = void 0;
|
4364 |
|
4365 | function clear() {
|
4366 | if (timer) {
|
4367 | clearTimeout(timer);
|
4368 | timer = null;
|
4369 | }
|
4370 | }
|
4371 |
|
4372 | function bufferFn() {
|
4373 | clear();
|
4374 | timer = setTimeout(fn, ms);
|
4375 | }
|
4376 |
|
4377 | bufferFn.clear = clear;
|
4378 |
|
4379 | return bufferFn;
|
4380 | }
|
4381 |
|
4382 | var propTypes = {
|
4383 | childrenProps: _propTypes2.default.object,
|
4384 | align: _propTypes2.default.object.isRequired,
|
4385 | target: _propTypes2.default.func,
|
4386 | onAlign: _propTypes2.default.func,
|
4387 | monitorBufferTime: _propTypes2.default.number,
|
4388 | monitorWindowResize: _propTypes2.default.bool,
|
4389 | disabled: _propTypes2.default.bool,
|
4390 | children: _propTypes2.default.any
|
4391 | };
|
4392 |
|
4393 | var defaultProps = {
|
4394 | target: function target() {
|
4395 | return window;
|
4396 | },
|
4397 | onAlign: function onAlign() {},
|
4398 |
|
4399 | monitorBufferTime: 50,
|
4400 | monitorWindowResize: false,
|
4401 | disabled: false
|
4402 | };
|
4403 |
|
4404 | var Align = function (_React$Component) {
|
4405 | _inherits(Align, _React$Component);
|
4406 |
|
4407 | function Align(props) {
|
4408 | _classCallCheck(this, Align);
|
4409 |
|
4410 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
4411 |
|
4412 | _initialiseProps.call(_this);
|
4413 |
|
4414 | return _this;
|
4415 | }
|
4416 |
|
4417 | Align.prototype.componentDidMount = function componentDidMount() {
|
4418 | var props = this.props;
|
4419 |
|
4420 | this.forceAlign();
|
4421 | if (!props.disabled && props.monitorWindowResize) {
|
4422 | this.startMonitorWindowResize();
|
4423 | }
|
4424 | };
|
4425 |
|
4426 | Align.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
4427 | var reAlign = false;
|
4428 | var props = this.props;
|
4429 |
|
4430 | if (!props.disabled) {
|
4431 | if (prevProps.disabled || prevProps.align !== props.align) {
|
4432 | reAlign = true;
|
4433 | } else {
|
4434 | var lastTarget = prevProps.target();
|
4435 | var currentTarget = props.target();
|
4436 | if (isWindow(lastTarget) && isWindow(currentTarget)) {
|
4437 | reAlign = false;
|
4438 | } else if (lastTarget !== currentTarget) {
|
4439 | reAlign = true;
|
4440 | }
|
4441 | }
|
4442 | }
|
4443 |
|
4444 | if (reAlign) {
|
4445 | this.forceAlign();
|
4446 | }
|
4447 |
|
4448 | if (props.monitorWindowResize && !props.disabled) {
|
4449 | this.startMonitorWindowResize();
|
4450 | } else {
|
4451 | this.stopMonitorWindowResize();
|
4452 | }
|
4453 | };
|
4454 |
|
4455 | Align.prototype.componentWillUnmount = function componentWillUnmount() {
|
4456 | this.stopMonitorWindowResize();
|
4457 | };
|
4458 |
|
4459 | Align.prototype.render = function render() {
|
4460 | var _props = this.props,
|
4461 | childrenProps = _props.childrenProps,
|
4462 | children = _props.children;
|
4463 |
|
4464 | var child = _react2.default.Children.only(children);
|
4465 | if (childrenProps) {
|
4466 | var newProps = {};
|
4467 | for (var prop in childrenProps) {
|
4468 | if (childrenProps.hasOwnProperty(prop)) {
|
4469 | newProps[prop] = this.props[childrenProps[prop]];
|
4470 | }
|
4471 | }
|
4472 | return _react2.default.cloneElement(child, newProps);
|
4473 | }
|
4474 | return child;
|
4475 | };
|
4476 |
|
4477 | return Align;
|
4478 | }(_react2.default.Component);
|
4479 |
|
4480 | var _initialiseProps = function _initialiseProps() {
|
4481 | var _this2 = this;
|
4482 |
|
4483 | this.startMonitorWindowResize = function () {
|
4484 | if (!_this2.resizeHandler) {
|
4485 | _this2.bufferMonitor = buffer(_this2.forceAlign, _this2.props.monitorBufferTime);
|
4486 | _this2.resizeHandler = (0, _addEventListener2.default)(window, 'resize', _this2.bufferMonitor);
|
4487 | }
|
4488 | };
|
4489 |
|
4490 | this.stopMonitorWindowResize = function () {
|
4491 | if (_this2.resizeHandler) {
|
4492 | _this2.bufferMonitor.clear();
|
4493 | _this2.resizeHandler.remove();
|
4494 | _this2.resizeHandler = null;
|
4495 | }
|
4496 | };
|
4497 |
|
4498 | this.forceAlign = function () {
|
4499 | var props = _this2.props;
|
4500 | if (!props.disabled) {
|
4501 | var source = _reactDom2.default.findDOMNode(_this2);
|
4502 | props.onAlign(source, (0, _domAlign2.default)(source, props.target(), props.align));
|
4503 | }
|
4504 | };
|
4505 | };
|
4506 |
|
4507 | ;
|
4508 |
|
4509 | Align.defaultProps = defaultProps;
|
4510 | Align.propTypes = propTypes;
|
4511 |
|
4512 | exports.default = Align;
|
4513 |
|
4514 | }),
|
4515 |
|
4516 | (function(module, exports, __webpack_require__) {
|
4517 |
|
4518 | 'use strict';
|
4519 |
|
4520 | Object.defineProperty(exports, "__esModule", {
|
4521 | value: true
|
4522 | });
|
4523 | exports.alignPoint = exports.alignElement = undefined;
|
4524 |
|
4525 | var _alignElement = __webpack_require__(52);
|
4526 |
|
4527 | var _alignElement2 = _interopRequireDefault(_alignElement);
|
4528 |
|
4529 | var _alignPoint = __webpack_require__(63);
|
4530 |
|
4531 | var _alignPoint2 = _interopRequireDefault(_alignPoint);
|
4532 |
|
4533 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
4534 |
|
4535 | exports.alignElement = _alignElement2['default'];
|
4536 | exports.alignPoint = _alignPoint2['default'];
|
4537 | exports['default'] = _alignElement2['default'];
|
4538 |
|
4539 | }),
|
4540 |
|
4541 | (function(module, exports, __webpack_require__) {
|
4542 |
|
4543 | 'use strict';
|
4544 |
|
4545 | Object.defineProperty(exports, "__esModule", {
|
4546 | value: true
|
4547 | });
|
4548 |
|
4549 | var _align = __webpack_require__(53);
|
4550 |
|
4551 | var _align2 = _interopRequireDefault(_align);
|
4552 |
|
4553 | var _getOffsetParent = __webpack_require__(57);
|
4554 |
|
4555 | var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent);
|
4556 |
|
4557 | var _getVisibleRectForElement = __webpack_require__(56);
|
4558 |
|
4559 | var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement);
|
4560 |
|
4561 | var _getRegion = __webpack_require__(60);
|
4562 |
|
4563 | var _getRegion2 = _interopRequireDefault(_getRegion);
|
4564 |
|
4565 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
4566 |
|
4567 | function isOutOfVisibleRect(target) {
|
4568 | var visibleRect = (0, _getVisibleRectForElement2['default'])(target);
|
4569 | var targetRegion = (0, _getRegion2['default'])(target);
|
4570 |
|
4571 | return !visibleRect || targetRegion.left + targetRegion.width <= visibleRect.left || targetRegion.top + targetRegion.height <= visibleRect.top || targetRegion.left >= visibleRect.right || targetRegion.top >= visibleRect.bottom;
|
4572 | }
|
4573 |
|
4574 | function alignElement(el, refNode, align) {
|
4575 | var target = align.target || refNode;
|
4576 | var refNodeRegion = (0, _getRegion2['default'])(target);
|
4577 |
|
4578 | var isTargetNotOutOfVisible = !isOutOfVisibleRect(target);
|
4579 |
|
4580 | return (0, _align2['default'])(el, refNodeRegion, align, isTargetNotOutOfVisible);
|
4581 | }
|
4582 |
|
4583 | alignElement.__getOffsetParent = _getOffsetParent2['default'];
|
4584 |
|
4585 | alignElement.__getVisibleRectForElement = _getVisibleRectForElement2['default'];
|
4586 |
|
4587 | exports['default'] = alignElement;
|
4588 | module.exports = exports['default'];
|
4589 |
|
4590 | }),
|
4591 |
|
4592 | (function(module, exports, __webpack_require__) {
|
4593 |
|
4594 | 'use strict';
|
4595 |
|
4596 | Object.defineProperty(exports, "__esModule", {
|
4597 | value: true
|
4598 | });
|
4599 |
|
4600 | var _utils = __webpack_require__(54);
|
4601 |
|
4602 | var _utils2 = _interopRequireDefault(_utils);
|
4603 |
|
4604 | var _getVisibleRectForElement = __webpack_require__(56);
|
4605 |
|
4606 | var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement);
|
4607 |
|
4608 | var _adjustForViewport = __webpack_require__(59);
|
4609 |
|
4610 | var _adjustForViewport2 = _interopRequireDefault(_adjustForViewport);
|
4611 |
|
4612 | var _getRegion = __webpack_require__(60);
|
4613 |
|
4614 | var _getRegion2 = _interopRequireDefault(_getRegion);
|
4615 |
|
4616 | var _getElFuturePos = __webpack_require__(61);
|
4617 |
|
4618 | var _getElFuturePos2 = _interopRequireDefault(_getElFuturePos);
|
4619 |
|
4620 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
4621 |
|
4622 |
|
4623 |
|
4624 | function isFailX(elFuturePos, elRegion, visibleRect) {
|
4625 | return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;
|
4626 | } |
4627 |
|
4628 |
|
4629 |
|
4630 |
|
4631 | function isFailY(elFuturePos, elRegion, visibleRect) {
|
4632 | return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom;
|
4633 | }
|
4634 |
|
4635 | function isCompleteFailX(elFuturePos, elRegion, visibleRect) {
|
4636 | return elFuturePos.left > visibleRect.right || elFuturePos.left + elRegion.width < visibleRect.left;
|
4637 | }
|
4638 |
|
4639 | function isCompleteFailY(elFuturePos, elRegion, visibleRect) {
|
4640 | return elFuturePos.top > visibleRect.bottom || elFuturePos.top + elRegion.height < visibleRect.top;
|
4641 | }
|
4642 |
|
4643 | function flip(points, reg, map) {
|
4644 | var ret = [];
|
4645 | _utils2['default'].each(points, function (p) {
|
4646 | ret.push(p.replace(reg, function (m) {
|
4647 | return map[m];
|
4648 | }));
|
4649 | });
|
4650 | return ret;
|
4651 | }
|
4652 |
|
4653 | function flipOffset(offset, index) {
|
4654 | offset[index] = -offset[index];
|
4655 | return offset;
|
4656 | }
|
4657 |
|
4658 | function convertOffset(str, offsetLen) {
|
4659 | var n = void 0;
|
4660 | if (/%$/.test(str)) {
|
4661 | n = parseInt(str.substring(0, str.length - 1), 10) / 100 * offsetLen;
|
4662 | } else {
|
4663 | n = parseInt(str, 10);
|
4664 | }
|
4665 | return n || 0;
|
4666 | }
|
4667 |
|
4668 | function normalizeOffset(offset, el) {
|
4669 | offset[0] = convertOffset(offset[0], el.width);
|
4670 | offset[1] = convertOffset(offset[1], el.height);
|
4671 | }
|
4672 |
|
4673 | |
4674 |
|
4675 |
|
4676 |
|
4677 |
|
4678 | function doAlign(el, tgtRegion, align, isTgtRegionVisible) {
|
4679 | var points = align.points;
|
4680 | var offset = align.offset || [0, 0];
|
4681 | var targetOffset = align.targetOffset || [0, 0];
|
4682 | var overflow = align.overflow;
|
4683 | var source = align.source || el;
|
4684 | offset = [].concat(offset);
|
4685 | targetOffset = [].concat(targetOffset);
|
4686 | overflow = overflow || {};
|
4687 | var newOverflowCfg = {};
|
4688 | var fail = 0;
|
4689 |
|
4690 | var visibleRect = (0, _getVisibleRectForElement2['default'])(source);
|
4691 |
|
4692 | var elRegion = (0, _getRegion2['default'])(source);
|
4693 |
|
4694 | normalizeOffset(offset, elRegion);
|
4695 | normalizeOffset(targetOffset, tgtRegion);
|
4696 |
|
4697 | var elFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, points, offset, targetOffset);
|
4698 |
|
4699 | var newElRegion = _utils2['default'].merge(elRegion, elFuturePos);
|
4700 |
|
4701 |
|
4702 | if (visibleRect && (overflow.adjustX || overflow.adjustY) && isTgtRegionVisible) {
|
4703 | if (overflow.adjustX) {
|
4704 |
|
4705 | if (isFailX(elFuturePos, elRegion, visibleRect)) {
|
4706 |
|
4707 | var newPoints = flip(points, /[lr]/ig, {
|
4708 | l: 'r',
|
4709 | r: 'l'
|
4710 | });
|
4711 |
|
4712 | var newOffset = flipOffset(offset, 0);
|
4713 | var newTargetOffset = flipOffset(targetOffset, 0);
|
4714 | var newElFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, newPoints, newOffset, newTargetOffset);
|
4715 |
|
4716 | if (!isCompleteFailX(newElFuturePos, elRegion, visibleRect)) {
|
4717 | fail = 1;
|
4718 | points = newPoints;
|
4719 | offset = newOffset;
|
4720 | targetOffset = newTargetOffset;
|
4721 | }
|
4722 | }
|
4723 | }
|
4724 |
|
4725 | if (overflow.adjustY) {
|
4726 |
|
4727 | if (isFailY(elFuturePos, elRegion, visibleRect)) {
|
4728 |
|
4729 | var _newPoints = flip(points, /[tb]/ig, {
|
4730 | t: 'b',
|
4731 | b: 't'
|
4732 | });
|
4733 |
|
4734 | var _newOffset = flipOffset(offset, 1);
|
4735 | var _newTargetOffset = flipOffset(targetOffset, 1);
|
4736 | var _newElFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, _newPoints, _newOffset, _newTargetOffset);
|
4737 |
|
4738 | if (!isCompleteFailY(_newElFuturePos, elRegion, visibleRect)) {
|
4739 | fail = 1;
|
4740 | points = _newPoints;
|
4741 | offset = _newOffset;
|
4742 | targetOffset = _newTargetOffset;
|
4743 | }
|
4744 | }
|
4745 | }
|
4746 |
|
4747 |
|
4748 | if (fail) {
|
4749 | elFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, points, offset, targetOffset);
|
4750 | _utils2['default'].mix(newElRegion, elFuturePos);
|
4751 | }
|
4752 | var isStillFailX = isFailX(elFuturePos, elRegion, visibleRect);
|
4753 | var isStillFailY = isFailY(elFuturePos, elRegion, visibleRect);
|
4754 |
|
4755 |
|
4756 | if (isStillFailX || isStillFailY) {
|
4757 | points = align.points;
|
4758 | offset = align.offset || [0, 0];
|
4759 | targetOffset = align.targetOffset || [0, 0];
|
4760 | }
|
4761 |
|
4762 | newOverflowCfg.adjustX = overflow.adjustX && isStillFailX;
|
4763 | newOverflowCfg.adjustY = overflow.adjustY && isStillFailY;
|
4764 |
|
4765 |
|
4766 | if (newOverflowCfg.adjustX || newOverflowCfg.adjustY) {
|
4767 | newElRegion = (0, _adjustForViewport2['default'])(elFuturePos, elRegion, visibleRect, newOverflowCfg);
|
4768 | }
|
4769 | }
|
4770 |
|
4771 |
|
4772 | if (newElRegion.width !== elRegion.width) {
|
4773 | _utils2['default'].css(source, 'width', _utils2['default'].width(source) + newElRegion.width - elRegion.width);
|
4774 | }
|
4775 |
|
4776 | if (newElRegion.height !== elRegion.height) {
|
4777 | _utils2['default'].css(source, 'height', _utils2['default'].height(source) + newElRegion.height - elRegion.height);
|
4778 | }
|
4779 |
|
4780 |
|
4781 |
|
4782 |
|
4783 | _utils2['default'].offset(source, {
|
4784 | left: newElRegion.left,
|
4785 | top: newElRegion.top
|
4786 | }, {
|
4787 | useCssRight: align.useCssRight,
|
4788 | useCssBottom: align.useCssBottom,
|
4789 | useCssTransform: align.useCssTransform,
|
4790 | ignoreShake: align.ignoreShake
|
4791 | });
|
4792 |
|
4793 | return {
|
4794 | points: points,
|
4795 | offset: offset,
|
4796 | targetOffset: targetOffset,
|
4797 | overflow: newOverflowCfg
|
4798 | };
|
4799 | }
|
4800 |
|
4801 | exports['default'] = doAlign;
|
4802 | |
4803 |
|
4804 |
|
4805 |
|
4806 |
|
4807 |
|
4808 |
|
4809 |
|
4810 |
|
4811 | module.exports = exports['default'];
|
4812 |
|
4813 | }),
|
4814 |
|
4815 | (function(module, exports, __webpack_require__) {
|
4816 |
|
4817 | 'use strict';
|
4818 |
|
4819 | Object.defineProperty(exports, "__esModule", {
|
4820 | value: true
|
4821 | });
|
4822 |
|
4823 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
4824 |
|
4825 | var _propertyUtils = __webpack_require__(55);
|
4826 |
|
4827 | var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source;
|
4828 |
|
4829 | var getComputedStyleX = void 0;
|
4830 |
|
4831 |
|
4832 | function forceRelayout(elem) {
|
4833 | var originalStyle = elem.style.display;
|
4834 | elem.style.display = 'none';
|
4835 | elem.offsetHeight;
|
4836 | elem.style.display = originalStyle;
|
4837 | }
|
4838 |
|
4839 | function css(el, name, v) {
|
4840 | var value = v;
|
4841 | if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
|
4842 | for (var i in name) {
|
4843 | if (name.hasOwnProperty(i)) {
|
4844 | css(el, i, name[i]);
|
4845 | }
|
4846 | }
|
4847 | return undefined;
|
4848 | }
|
4849 | if (typeof value !== 'undefined') {
|
4850 | if (typeof value === 'number') {
|
4851 | value = value + 'px';
|
4852 | }
|
4853 | el.style[name] = value;
|
4854 | return undefined;
|
4855 | }
|
4856 | return getComputedStyleX(el, name);
|
4857 | }
|
4858 |
|
4859 | function getClientPosition(elem) {
|
4860 | var box = void 0;
|
4861 | var x = void 0;
|
4862 | var y = void 0;
|
4863 | var doc = elem.ownerDocument;
|
4864 | var body = doc.body;
|
4865 | var docElem = doc && doc.documentElement;
|
4866 |
|
4867 | box = elem.getBoundingClientRect();
|
4868 |
|
4869 |
|
4870 |
|
4871 |
|
4872 |
|
4873 | x = box.left;
|
4874 | y = box.top;
|
4875 |
|
4876 |
|
4877 |
|
4878 |
|
4879 |
|
4880 |
|
4881 |
|
4882 |
|
4883 |
|
4884 |
|
4885 |
|
4886 |
|
4887 |
|
4888 |
|
4889 |
|
4890 |
|
4891 |
|
4892 |
|
4893 |
|
4894 |
|
4895 |
|
4896 | x -= docElem.clientLeft || body.clientLeft || 0;
|
4897 | y -= docElem.clientTop || body.clientTop || 0;
|
4898 |
|
4899 | return {
|
4900 | left: x,
|
4901 | top: y
|
4902 | };
|
4903 | }
|
4904 |
|
4905 | function getScroll(w, top) {
|
4906 | var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];
|
4907 | var method = 'scroll' + (top ? 'Top' : 'Left');
|
4908 | if (typeof ret !== 'number') {
|
4909 | var d = w.document;
|
4910 |
|
4911 | ret = d.documentElement[method];
|
4912 | if (typeof ret !== 'number') {
|
4913 |
|
4914 | ret = d.body[method];
|
4915 | }
|
4916 | }
|
4917 | return ret;
|
4918 | }
|
4919 |
|
4920 | function getScrollLeft(w) {
|
4921 | return getScroll(w);
|
4922 | }
|
4923 |
|
4924 | function getScrollTop(w) {
|
4925 | return getScroll(w, true);
|
4926 | }
|
4927 |
|
4928 | function getOffset(el) {
|
4929 | var pos = getClientPosition(el);
|
4930 | var doc = el.ownerDocument;
|
4931 | var w = doc.defaultView || doc.parentWindow;
|
4932 | pos.left += getScrollLeft(w);
|
4933 | pos.top += getScrollTop(w);
|
4934 | return pos;
|
4935 | }
|
4936 |
|
4937 | |
4938 |
|
4939 |
|
4940 |
|
4941 | function isWindow(obj) {
|
4942 |
|
4943 |
|
4944 | return obj !== null && obj !== undefined && obj == obj.window;
|
4945 | }
|
4946 |
|
4947 | function getDocument(node) {
|
4948 | if (isWindow(node)) {
|
4949 | return node.document;
|
4950 | }
|
4951 | if (node.nodeType === 9) {
|
4952 | return node;
|
4953 | }
|
4954 | return node.ownerDocument;
|
4955 | }
|
4956 |
|
4957 | function _getComputedStyle(elem, name, cs) {
|
4958 | var computedStyle = cs;
|
4959 | var val = '';
|
4960 | var d = getDocument(elem);
|
4961 | computedStyle = computedStyle || d.defaultView.getComputedStyle(elem, null);
|
4962 |
|
4963 |
|
4964 | if (computedStyle) {
|
4965 | val = computedStyle.getPropertyValue(name) || computedStyle[name];
|
4966 | }
|
4967 |
|
4968 | return val;
|
4969 | }
|
4970 |
|
4971 | var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i');
|
4972 | var RE_POS = /^(top|right|bottom|left)$/;
|
4973 | var CURRENT_STYLE = 'currentStyle';
|
4974 | var RUNTIME_STYLE = 'runtimeStyle';
|
4975 | var LEFT = 'left';
|
4976 | var PX = 'px';
|
4977 |
|
4978 | function _getComputedStyleIE(elem, name) {
|
4979 |
|
4980 |
|
4981 | var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];
|
4982 |
|
4983 |
|
4984 |
|
4985 |
|
4986 |
|
4987 |
|
4988 |
|
4989 |
|
4990 |
|
4991 |
|
4992 |
|
4993 | if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {
|
4994 |
|
4995 | var style = elem.style;
|
4996 | var left = style[LEFT];
|
4997 | var rsLeft = elem[RUNTIME_STYLE][LEFT];
|
4998 |
|
4999 |
|
5000 | elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];
|
5001 |
|
5002 |
|
5003 | style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;
|
5004 | ret = style.pixelLeft + PX;
|
5005 |
|
5006 |
|
5007 | style[LEFT] = left;
|
5008 |
|
5009 | elem[RUNTIME_STYLE][LEFT] = rsLeft;
|
5010 | }
|
5011 | return ret === '' ? 'auto' : ret;
|
5012 | }
|
5013 |
|
5014 | if (typeof window !== 'undefined') {
|
5015 | getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;
|
5016 | }
|
5017 |
|
5018 | function getOffsetDirection(dir, option) {
|
5019 | if (dir === 'left') {
|
5020 | return option.useCssRight ? 'right' : dir;
|
5021 | }
|
5022 | return option.useCssBottom ? 'bottom' : dir;
|
5023 | }
|
5024 |
|
5025 | function oppositeOffsetDirection(dir) {
|
5026 | if (dir === 'left') {
|
5027 | return 'right';
|
5028 | } else if (dir === 'right') {
|
5029 | return 'left';
|
5030 | } else if (dir === 'top') {
|
5031 | return 'bottom';
|
5032 | } else if (dir === 'bottom') {
|
5033 | return 'top';
|
5034 | }
|
5035 | }
|
5036 |
|
5037 |
|
5038 | function setLeftTop(elem, offset, option) {
|
5039 |
|
5040 | if (css(elem, 'position') === 'static') {
|
5041 | elem.style.position = 'relative';
|
5042 | }
|
5043 | var presetH = -999;
|
5044 | var presetV = -999;
|
5045 | var horizontalProperty = getOffsetDirection('left', option);
|
5046 | var verticalProperty = getOffsetDirection('top', option);
|
5047 | var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty);
|
5048 | var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty);
|
5049 |
|
5050 | if (horizontalProperty !== 'left') {
|
5051 | presetH = 999;
|
5052 | }
|
5053 |
|
5054 | if (verticalProperty !== 'top') {
|
5055 | presetV = 999;
|
5056 | }
|
5057 | var originalTransition = '';
|
5058 | var originalOffset = getOffset(elem);
|
5059 | if ('left' in offset || 'top' in offset) {
|
5060 | originalTransition = (0, _propertyUtils.getTransitionProperty)(elem) || '';
|
5061 | (0, _propertyUtils.setTransitionProperty)(elem, 'none');
|
5062 | }
|
5063 | if ('left' in offset) {
|
5064 | elem.style[oppositeHorizontalProperty] = '';
|
5065 | elem.style[horizontalProperty] = presetH + 'px';
|
5066 | }
|
5067 | if ('top' in offset) {
|
5068 | elem.style[oppositeVerticalProperty] = '';
|
5069 | elem.style[verticalProperty] = presetV + 'px';
|
5070 | }
|
5071 |
|
5072 | forceRelayout(elem);
|
5073 | var old = getOffset(elem);
|
5074 | var originalStyle = {};
|
5075 | for (var key in offset) {
|
5076 | if (offset.hasOwnProperty(key)) {
|
5077 | var dir = getOffsetDirection(key, option);
|
5078 | var preset = key === 'left' ? presetH : presetV;
|
5079 | var off = originalOffset[key] - old[key];
|
5080 | if (dir === key) {
|
5081 | originalStyle[dir] = preset + off;
|
5082 | } else {
|
5083 | originalStyle[dir] = preset - off;
|
5084 | }
|
5085 | }
|
5086 | }
|
5087 | css(elem, originalStyle);
|
5088 |
|
5089 | forceRelayout(elem);
|
5090 | if ('left' in offset || 'top' in offset) {
|
5091 | (0, _propertyUtils.setTransitionProperty)(elem, originalTransition);
|
5092 | }
|
5093 | var ret = {};
|
5094 | for (var _key in offset) {
|
5095 | if (offset.hasOwnProperty(_key)) {
|
5096 | var _dir = getOffsetDirection(_key, option);
|
5097 | var _off = offset[_key] - originalOffset[_key];
|
5098 | if (_key === _dir) {
|
5099 | ret[_dir] = originalStyle[_dir] + _off;
|
5100 | } else {
|
5101 | ret[_dir] = originalStyle[_dir] - _off;
|
5102 | }
|
5103 | }
|
5104 | }
|
5105 | css(elem, ret);
|
5106 | }
|
5107 |
|
5108 | function setTransform(elem, offset) {
|
5109 | var originalOffset = getOffset(elem);
|
5110 | var originalXY = (0, _propertyUtils.getTransformXY)(elem);
|
5111 | var resultXY = { x: originalXY.x, y: originalXY.y };
|
5112 | if ('left' in offset) {
|
5113 | resultXY.x = originalXY.x + offset.left - originalOffset.left;
|
5114 | }
|
5115 | if ('top' in offset) {
|
5116 | resultXY.y = originalXY.y + offset.top - originalOffset.top;
|
5117 | }
|
5118 | (0, _propertyUtils.setTransformXY)(elem, resultXY);
|
5119 | }
|
5120 |
|
5121 | function setOffset(elem, offset, option) {
|
5122 | if (option.ignoreShake) {
|
5123 | var oriOffset = getOffset(elem);
|
5124 |
|
5125 | var oLeft = oriOffset.left.toFixed(0);
|
5126 | var oTop = oriOffset.top.toFixed(0);
|
5127 | var tLeft = offset.left.toFixed(0);
|
5128 | var tTop = offset.top.toFixed(0);
|
5129 |
|
5130 | if (oLeft === tLeft && oTop === tTop) {
|
5131 | return;
|
5132 | }
|
5133 | }
|
5134 |
|
5135 | if (option.useCssRight || option.useCssBottom) {
|
5136 | setLeftTop(elem, offset, option);
|
5137 | } else if (option.useCssTransform && (0, _propertyUtils.getTransformName)() in document.body.style) {
|
5138 | setTransform(elem, offset, option);
|
5139 | } else {
|
5140 | setLeftTop(elem, offset, option);
|
5141 | }
|
5142 | }
|
5143 |
|
5144 | function each(arr, fn) {
|
5145 | for (var i = 0; i < arr.length; i++) {
|
5146 | fn(arr[i]);
|
5147 | }
|
5148 | }
|
5149 |
|
5150 | function isBorderBoxFn(elem) {
|
5151 | return getComputedStyleX(elem, 'boxSizing') === 'border-box';
|
5152 | }
|
5153 |
|
5154 | var BOX_MODELS = ['margin', 'border', 'padding'];
|
5155 | var CONTENT_INDEX = -1;
|
5156 | var PADDING_INDEX = 2;
|
5157 | var BORDER_INDEX = 1;
|
5158 | var MARGIN_INDEX = 0;
|
5159 |
|
5160 | function swap(elem, options, callback) {
|
5161 | var old = {};
|
5162 | var style = elem.style;
|
5163 | var name = void 0;
|
5164 |
|
5165 |
|
5166 | for (name in options) {
|
5167 | if (options.hasOwnProperty(name)) {
|
5168 | old[name] = style[name];
|
5169 | style[name] = options[name];
|
5170 | }
|
5171 | }
|
5172 |
|
5173 | callback.call(elem);
|
5174 |
|
5175 |
|
5176 | for (name in options) {
|
5177 | if (options.hasOwnProperty(name)) {
|
5178 | style[name] = old[name];
|
5179 | }
|
5180 | }
|
5181 | }
|
5182 |
|
5183 | function getPBMWidth(elem, props, which) {
|
5184 | var value = 0;
|
5185 | var prop = void 0;
|
5186 | var j = void 0;
|
5187 | var i = void 0;
|
5188 | for (j = 0; j < props.length; j++) {
|
5189 | prop = props[j];
|
5190 | if (prop) {
|
5191 | for (i = 0; i < which.length; i++) {
|
5192 | var cssProp = void 0;
|
5193 | if (prop === 'border') {
|
5194 | cssProp = '' + prop + which[i] + 'Width';
|
5195 | } else {
|
5196 | cssProp = prop + which[i];
|
5197 | }
|
5198 | value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;
|
5199 | }
|
5200 | }
|
5201 | }
|
5202 | return value;
|
5203 | }
|
5204 |
|
5205 | var domUtils = {};
|
5206 |
|
5207 | each(['Width', 'Height'], function (name) {
|
5208 | domUtils['doc' + name] = function (refWin) {
|
5209 | var d = refWin.document;
|
5210 | return Math.max(
|
5211 |
|
5212 |
|
5213 | d.documentElement['scroll' + name],
|
5214 |
|
5215 | d.body['scroll' + name], domUtils['viewport' + name](d));
|
5216 | };
|
5217 |
|
5218 | domUtils['viewport' + name] = function (win) {
|
5219 |
|
5220 | var prop = 'client' + name;
|
5221 | var doc = win.document;
|
5222 | var body = doc.body;
|
5223 | var documentElement = doc.documentElement;
|
5224 | var documentElementProp = documentElement[prop];
|
5225 |
|
5226 |
|
5227 | return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;
|
5228 | };
|
5229 | });
|
5230 |
|
5231 | |
5232 |
|
5233 |
|
5234 |
|
5235 |
|
5236 |
|
5237 |
|
5238 |
|
5239 | function getWH(elem, name, ex) {
|
5240 | var extra = ex;
|
5241 | if (isWindow(elem)) {
|
5242 | return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);
|
5243 | } else if (elem.nodeType === 9) {
|
5244 | return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);
|
5245 | }
|
5246 | var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
|
5247 | var borderBoxValue = name === 'width' ? elem.getBoundingClientRect().width : elem.getBoundingClientRect().height;
|
5248 | var computedStyle = getComputedStyleX(elem);
|
5249 | var isBorderBox = isBorderBoxFn(elem, computedStyle);
|
5250 | var cssBoxValue = 0;
|
5251 | if (borderBoxValue === null || borderBoxValue === undefined || borderBoxValue <= 0) {
|
5252 | borderBoxValue = undefined;
|
5253 |
|
5254 | cssBoxValue = getComputedStyleX(elem, name);
|
5255 | if (cssBoxValue === null || cssBoxValue === undefined || Number(cssBoxValue) < 0) {
|
5256 | cssBoxValue = elem.style[name] || 0;
|
5257 | }
|
5258 |
|
5259 | cssBoxValue = parseFloat(cssBoxValue) || 0;
|
5260 | }
|
5261 | if (extra === undefined) {
|
5262 | extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;
|
5263 | }
|
5264 | var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;
|
5265 | var val = borderBoxValue || cssBoxValue;
|
5266 | if (extra === CONTENT_INDEX) {
|
5267 | if (borderBoxValueOrIsBorderBox) {
|
5268 | return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);
|
5269 | }
|
5270 | return cssBoxValue;
|
5271 | } else if (borderBoxValueOrIsBorderBox) {
|
5272 | if (extra === BORDER_INDEX) {
|
5273 | return val;
|
5274 | }
|
5275 | return val + (extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle));
|
5276 | }
|
5277 | return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);
|
5278 | }
|
5279 |
|
5280 | var cssShow = {
|
5281 | position: 'absolute',
|
5282 | visibility: 'hidden',
|
5283 | display: 'block'
|
5284 | };
|
5285 |
|
5286 |
|
5287 | function getWHIgnoreDisplay() {
|
5288 | for (var _len = arguments.length, args = Array(_len), _key2 = 0; _key2 < _len; _key2++) {
|
5289 | args[_key2] = arguments[_key2];
|
5290 | }
|
5291 |
|
5292 | var val = void 0;
|
5293 | var elem = args[0];
|
5294 |
|
5295 |
|
5296 | if (elem.offsetWidth !== 0) {
|
5297 | val = getWH.apply(undefined, args);
|
5298 | } else {
|
5299 | swap(elem, cssShow, function () {
|
5300 | val = getWH.apply(undefined, args);
|
5301 | });
|
5302 | }
|
5303 | return val;
|
5304 | }
|
5305 |
|
5306 | each(['width', 'height'], function (name) {
|
5307 | var first = name.charAt(0).toUpperCase() + name.slice(1);
|
5308 | domUtils['outer' + first] = function (el, includeMargin) {
|
5309 | return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);
|
5310 | };
|
5311 | var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
|
5312 |
|
5313 | domUtils[name] = function (elem, v) {
|
5314 | var val = v;
|
5315 | if (val !== undefined) {
|
5316 | if (elem) {
|
5317 | var computedStyle = getComputedStyleX(elem);
|
5318 | var isBorderBox = isBorderBoxFn(elem);
|
5319 | if (isBorderBox) {
|
5320 | val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);
|
5321 | }
|
5322 | return css(elem, name, val);
|
5323 | }
|
5324 | return undefined;
|
5325 | }
|
5326 | return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);
|
5327 | };
|
5328 | });
|
5329 |
|
5330 | function mix(to, from) {
|
5331 | for (var i in from) {
|
5332 | if (from.hasOwnProperty(i)) {
|
5333 | to[i] = from[i];
|
5334 | }
|
5335 | }
|
5336 | return to;
|
5337 | }
|
5338 |
|
5339 | var utils = {
|
5340 | getWindow: function getWindow(node) {
|
5341 | if (node && node.document && node.setTimeout) {
|
5342 | return node;
|
5343 | }
|
5344 | var doc = node.ownerDocument || node;
|
5345 | return doc.defaultView || doc.parentWindow;
|
5346 | },
|
5347 |
|
5348 | getDocument: getDocument,
|
5349 | offset: function offset(el, value, option) {
|
5350 | if (typeof value !== 'undefined') {
|
5351 | setOffset(el, value, option || {});
|
5352 | } else {
|
5353 | return getOffset(el);
|
5354 | }
|
5355 | },
|
5356 |
|
5357 | isWindow: isWindow,
|
5358 | each: each,
|
5359 | css: css,
|
5360 | clone: function clone(obj) {
|
5361 | var i = void 0;
|
5362 | var ret = {};
|
5363 | for (i in obj) {
|
5364 | if (obj.hasOwnProperty(i)) {
|
5365 | ret[i] = obj[i];
|
5366 | }
|
5367 | }
|
5368 | var overflow = obj.overflow;
|
5369 | if (overflow) {
|
5370 | for (i in obj) {
|
5371 | if (obj.hasOwnProperty(i)) {
|
5372 | ret.overflow[i] = obj.overflow[i];
|
5373 | }
|
5374 | }
|
5375 | }
|
5376 | return ret;
|
5377 | },
|
5378 |
|
5379 | mix: mix,
|
5380 | getWindowScrollLeft: function getWindowScrollLeft(w) {
|
5381 | return getScrollLeft(w);
|
5382 | },
|
5383 | getWindowScrollTop: function getWindowScrollTop(w) {
|
5384 | return getScrollTop(w);
|
5385 | },
|
5386 | merge: function merge() {
|
5387 | var ret = {};
|
5388 |
|
5389 | for (var _len2 = arguments.length, args = Array(_len2), _key3 = 0; _key3 < _len2; _key3++) {
|
5390 | args[_key3] = arguments[_key3];
|
5391 | }
|
5392 |
|
5393 | for (var i = 0; i < args.length; i++) {
|
5394 | utils.mix(ret, args[i]);
|
5395 | }
|
5396 | return ret;
|
5397 | },
|
5398 |
|
5399 | viewportWidth: 0,
|
5400 | viewportHeight: 0
|
5401 | };
|
5402 |
|
5403 | mix(utils, domUtils);
|
5404 |
|
5405 | exports['default'] = utils;
|
5406 | module.exports = exports['default'];
|
5407 |
|
5408 | }),
|
5409 |
|
5410 | (function(module, exports) {
|
5411 |
|
5412 | 'use strict';
|
5413 |
|
5414 | Object.defineProperty(exports, "__esModule", {
|
5415 | value: true
|
5416 | });
|
5417 | exports.getTransformName = getTransformName;
|
5418 | exports.setTransitionProperty = setTransitionProperty;
|
5419 | exports.getTransitionProperty = getTransitionProperty;
|
5420 | exports.getTransformXY = getTransformXY;
|
5421 | exports.setTransformXY = setTransformXY;
|
5422 | var vendorPrefix = void 0;
|
5423 |
|
5424 | var jsCssMap = {
|
5425 | Webkit: '-webkit-',
|
5426 | Moz: '-moz-',
|
5427 |
|
5428 | ms: '-ms-',
|
5429 | O: '-o-'
|
5430 | };
|
5431 |
|
5432 | function getVendorPrefix() {
|
5433 | if (vendorPrefix !== undefined) {
|
5434 | return vendorPrefix;
|
5435 | }
|
5436 | vendorPrefix = '';
|
5437 | var style = document.createElement('p').style;
|
5438 | var testProp = 'Transform';
|
5439 | for (var key in jsCssMap) {
|
5440 | if (key + testProp in style) {
|
5441 | vendorPrefix = key;
|
5442 | }
|
5443 | }
|
5444 | return vendorPrefix;
|
5445 | }
|
5446 |
|
5447 | function getTransitionName() {
|
5448 | return getVendorPrefix() ? getVendorPrefix() + 'TransitionProperty' : 'transitionProperty';
|
5449 | }
|
5450 |
|
5451 | function getTransformName() {
|
5452 | return getVendorPrefix() ? getVendorPrefix() + 'Transform' : 'transform';
|
5453 | }
|
5454 |
|
5455 | function setTransitionProperty(node, value) {
|
5456 | var name = getTransitionName();
|
5457 | if (name) {
|
5458 | node.style[name] = value;
|
5459 | if (name !== 'transitionProperty') {
|
5460 | node.style.transitionProperty = value;
|
5461 | }
|
5462 | }
|
5463 | }
|
5464 |
|
5465 | function setTransform(node, value) {
|
5466 | var name = getTransformName();
|
5467 | if (name) {
|
5468 | node.style[name] = value;
|
5469 | if (name !== 'transform') {
|
5470 | node.style.transform = value;
|
5471 | }
|
5472 | }
|
5473 | }
|
5474 |
|
5475 | function getTransitionProperty(node) {
|
5476 | return node.style.transitionProperty || node.style[getTransitionName()];
|
5477 | }
|
5478 |
|
5479 | function getTransformXY(node) {
|
5480 | var style = window.getComputedStyle(node, null);
|
5481 | var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());
|
5482 | if (transform && transform !== 'none') {
|
5483 | var matrix = transform.replace(/[^0-9\-.,]/g, '').split(',');
|
5484 | return { x: parseFloat(matrix[12] || matrix[4], 0), y: parseFloat(matrix[13] || matrix[5], 0) };
|
5485 | }
|
5486 | return {
|
5487 | x: 0,
|
5488 | y: 0
|
5489 | };
|
5490 | }
|
5491 |
|
5492 | var matrix2d = /matrix\((.*)\)/;
|
5493 | var matrix3d = /matrix3d\((.*)\)/;
|
5494 |
|
5495 | function setTransformXY(node, xy) {
|
5496 | var style = window.getComputedStyle(node, null);
|
5497 | var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());
|
5498 | if (transform && transform !== 'none') {
|
5499 | var arr = void 0;
|
5500 | var match2d = transform.match(matrix2d);
|
5501 | if (match2d) {
|
5502 | match2d = match2d[1];
|
5503 | arr = match2d.split(',').map(function (item) {
|
5504 | return parseFloat(item, 10);
|
5505 | });
|
5506 | arr[4] = xy.x;
|
5507 | arr[5] = xy.y;
|
5508 | setTransform(node, 'matrix(' + arr.join(',') + ')');
|
5509 | } else {
|
5510 | var match3d = transform.match(matrix3d)[1];
|
5511 | arr = match3d.split(',').map(function (item) {
|
5512 | return parseFloat(item, 10);
|
5513 | });
|
5514 | arr[12] = xy.x;
|
5515 | arr[13] = xy.y;
|
5516 | setTransform(node, 'matrix3d(' + arr.join(',') + ')');
|
5517 | }
|
5518 | } else {
|
5519 | setTransform(node, 'translateX(' + xy.x + 'px) translateY(' + xy.y + 'px) translateZ(0)');
|
5520 | }
|
5521 | }
|
5522 |
|
5523 | }),
|
5524 |
|
5525 | (function(module, exports, __webpack_require__) {
|
5526 |
|
5527 | 'use strict';
|
5528 |
|
5529 | Object.defineProperty(exports, "__esModule", {
|
5530 | value: true
|
5531 | });
|
5532 |
|
5533 | var _utils = __webpack_require__(54);
|
5534 |
|
5535 | var _utils2 = _interopRequireDefault(_utils);
|
5536 |
|
5537 | var _getOffsetParent = __webpack_require__(57);
|
5538 |
|
5539 | var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent);
|
5540 |
|
5541 | var _isAncestorFixed = __webpack_require__(58);
|
5542 |
|
5543 | var _isAncestorFixed2 = _interopRequireDefault(_isAncestorFixed);
|
5544 |
|
5545 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5546 |
|
5547 | |
5548 |
|
5549 |
|
5550 | function getVisibleRectForElement(element) {
|
5551 | var visibleRect = {
|
5552 | left: 0,
|
5553 | right: Infinity,
|
5554 | top: 0,
|
5555 | bottom: Infinity
|
5556 | };
|
5557 | var el = (0, _getOffsetParent2['default'])(element);
|
5558 | var doc = _utils2['default'].getDocument(element);
|
5559 | var win = doc.defaultView || doc.parentWindow;
|
5560 | var body = doc.body;
|
5561 | var documentElement = doc.documentElement;
|
5562 |
|
5563 |
|
5564 |
|
5565 | while (el) {
|
5566 |
|
5567 | if ((navigator.userAgent.indexOf('MSIE') === -1 || el.clientWidth !== 0) &&
|
5568 |
|
5569 |
|
5570 |
|
5571 | el !== body && el !== documentElement && _utils2['default'].css(el, 'overflow') !== 'visible') {
|
5572 | var pos = _utils2['default'].offset(el);
|
5573 |
|
5574 | pos.left += el.clientLeft;
|
5575 | pos.top += el.clientTop;
|
5576 | visibleRect.top = Math.max(visibleRect.top, pos.top);
|
5577 | visibleRect.right = Math.min(visibleRect.right,
|
5578 |
|
5579 | pos.left + el.clientWidth);
|
5580 | visibleRect.bottom = Math.min(visibleRect.bottom, pos.top + el.clientHeight);
|
5581 | visibleRect.left = Math.max(visibleRect.left, pos.left);
|
5582 | } else if (el === body || el === documentElement) {
|
5583 | break;
|
5584 | }
|
5585 | el = (0, _getOffsetParent2['default'])(el);
|
5586 | }
|
5587 |
|
5588 |
|
5589 |
|
5590 |
|
5591 | var originalPosition = null;
|
5592 | if (!_utils2['default'].isWindow(element) && element.nodeType !== 9) {
|
5593 | originalPosition = element.style.position;
|
5594 | var position = _utils2['default'].css(element, 'position');
|
5595 | if (position === 'absolute') {
|
5596 | element.style.position = 'fixed';
|
5597 | }
|
5598 | }
|
5599 |
|
5600 | var scrollX = _utils2['default'].getWindowScrollLeft(win);
|
5601 | var scrollY = _utils2['default'].getWindowScrollTop(win);
|
5602 | var viewportWidth = _utils2['default'].viewportWidth(win);
|
5603 | var viewportHeight = _utils2['default'].viewportHeight(win);
|
5604 | var documentWidth = documentElement.scrollWidth;
|
5605 | var documentHeight = documentElement.scrollHeight;
|
5606 |
|
5607 |
|
5608 | if (element.style) {
|
5609 | element.style.position = originalPosition;
|
5610 | }
|
5611 |
|
5612 | if ((0, _isAncestorFixed2['default'])(element)) {
|
5613 |
|
5614 | visibleRect.left = Math.max(visibleRect.left, scrollX);
|
5615 | visibleRect.top = Math.max(visibleRect.top, scrollY);
|
5616 | visibleRect.right = Math.min(visibleRect.right, scrollX + viewportWidth);
|
5617 | visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + viewportHeight);
|
5618 | } else {
|
5619 |
|
5620 | var maxVisibleWidth = Math.max(documentWidth, scrollX + viewportWidth);
|
5621 | visibleRect.right = Math.min(visibleRect.right, maxVisibleWidth);
|
5622 |
|
5623 | var maxVisibleHeight = Math.max(documentHeight, scrollY + viewportHeight);
|
5624 | visibleRect.bottom = Math.min(visibleRect.bottom, maxVisibleHeight);
|
5625 | }
|
5626 |
|
5627 | return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null;
|
5628 | }
|
5629 |
|
5630 | exports['default'] = getVisibleRectForElement;
|
5631 | module.exports = exports['default'];
|
5632 |
|
5633 | }),
|
5634 |
|
5635 | (function(module, exports, __webpack_require__) {
|
5636 |
|
5637 | 'use strict';
|
5638 |
|
5639 | Object.defineProperty(exports, "__esModule", {
|
5640 | value: true
|
5641 | });
|
5642 |
|
5643 | var _utils = __webpack_require__(54);
|
5644 |
|
5645 | var _utils2 = _interopRequireDefault(_utils);
|
5646 |
|
5647 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5648 |
|
5649 | |
5650 |
|
5651 |
|
5652 |
|
5653 | function getOffsetParent(element) {
|
5654 | if (_utils2['default'].isWindow(element) || element.nodeType === 9) {
|
5655 | return null;
|
5656 | }
|
5657 |
|
5658 | |
5659 |
|
5660 |
|
5661 |
|
5662 |
|
5663 |
|
5664 |
|
5665 |
|
5666 |
|
5667 |
|
5668 |
|
5669 |
|
5670 |
|
5671 |
|
5672 | var doc = _utils2['default'].getDocument(element);
|
5673 | var body = doc.body;
|
5674 | var parent = void 0;
|
5675 | var positionStyle = _utils2['default'].css(element, 'position');
|
5676 | var skipStatic = positionStyle === 'fixed' || positionStyle === 'absolute';
|
5677 |
|
5678 | if (!skipStatic) {
|
5679 | return element.nodeName.toLowerCase() === 'html' ? null : element.parentNode;
|
5680 | }
|
5681 |
|
5682 | for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) {
|
5683 | positionStyle = _utils2['default'].css(parent, 'position');
|
5684 | if (positionStyle !== 'static') {
|
5685 | return parent;
|
5686 | }
|
5687 | }
|
5688 | return null;
|
5689 | }
|
5690 |
|
5691 | exports['default'] = getOffsetParent;
|
5692 | module.exports = exports['default'];
|
5693 |
|
5694 | }),
|
5695 |
|
5696 | (function(module, exports, __webpack_require__) {
|
5697 |
|
5698 | 'use strict';
|
5699 |
|
5700 | Object.defineProperty(exports, "__esModule", {
|
5701 | value: true
|
5702 | });
|
5703 | exports['default'] = isAncestorFixed;
|
5704 |
|
5705 | var _utils = __webpack_require__(54);
|
5706 |
|
5707 | var _utils2 = _interopRequireDefault(_utils);
|
5708 |
|
5709 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5710 |
|
5711 | function isAncestorFixed(element) {
|
5712 | if (_utils2['default'].isWindow(element) || element.nodeType === 9) {
|
5713 | return false;
|
5714 | }
|
5715 |
|
5716 | var doc = _utils2['default'].getDocument(element);
|
5717 | var body = doc.body;
|
5718 | var parent = null;
|
5719 | for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) {
|
5720 | var positionStyle = _utils2['default'].css(parent, 'position');
|
5721 | if (positionStyle === 'fixed') {
|
5722 | return true;
|
5723 | }
|
5724 | }
|
5725 | return false;
|
5726 | }
|
5727 | module.exports = exports['default'];
|
5728 |
|
5729 | }),
|
5730 |
|
5731 | (function(module, exports, __webpack_require__) {
|
5732 |
|
5733 | 'use strict';
|
5734 |
|
5735 | Object.defineProperty(exports, "__esModule", {
|
5736 | value: true
|
5737 | });
|
5738 |
|
5739 | var _utils = __webpack_require__(54);
|
5740 |
|
5741 | var _utils2 = _interopRequireDefault(_utils);
|
5742 |
|
5743 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5744 |
|
5745 | function adjustForViewport(elFuturePos, elRegion, visibleRect, overflow) {
|
5746 | var pos = _utils2['default'].clone(elFuturePos);
|
5747 | var size = {
|
5748 | width: elRegion.width,
|
5749 | height: elRegion.height
|
5750 | };
|
5751 |
|
5752 | if (overflow.adjustX && pos.left < visibleRect.left) {
|
5753 | pos.left = visibleRect.left;
|
5754 | }
|
5755 |
|
5756 |
|
5757 | if (overflow.resizeWidth && pos.left >= visibleRect.left && pos.left + size.width > visibleRect.right) {
|
5758 | size.width -= pos.left + size.width - visibleRect.right;
|
5759 | }
|
5760 |
|
5761 |
|
5762 | if (overflow.adjustX && pos.left + size.width > visibleRect.right) {
|
5763 |
|
5764 | pos.left = Math.max(visibleRect.right - size.width, visibleRect.left);
|
5765 | }
|
5766 |
|
5767 |
|
5768 | if (overflow.adjustY && pos.top < visibleRect.top) {
|
5769 | pos.top = visibleRect.top;
|
5770 | }
|
5771 |
|
5772 |
|
5773 | if (overflow.resizeHeight && pos.top >= visibleRect.top && pos.top + size.height > visibleRect.bottom) {
|
5774 | size.height -= pos.top + size.height - visibleRect.bottom;
|
5775 | }
|
5776 |
|
5777 |
|
5778 | if (overflow.adjustY && pos.top + size.height > visibleRect.bottom) {
|
5779 |
|
5780 | pos.top = Math.max(visibleRect.bottom - size.height, visibleRect.top);
|
5781 | }
|
5782 |
|
5783 | return _utils2['default'].mix(pos, size);
|
5784 | }
|
5785 |
|
5786 | exports['default'] = adjustForViewport;
|
5787 | module.exports = exports['default'];
|
5788 |
|
5789 | }),
|
5790 |
|
5791 | (function(module, exports, __webpack_require__) {
|
5792 |
|
5793 | 'use strict';
|
5794 |
|
5795 | Object.defineProperty(exports, "__esModule", {
|
5796 | value: true
|
5797 | });
|
5798 |
|
5799 | var _utils = __webpack_require__(54);
|
5800 |
|
5801 | var _utils2 = _interopRequireDefault(_utils);
|
5802 |
|
5803 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5804 |
|
5805 | function getRegion(node) {
|
5806 | var offset = void 0;
|
5807 | var w = void 0;
|
5808 | var h = void 0;
|
5809 | if (!_utils2['default'].isWindow(node) && node.nodeType !== 9) {
|
5810 | offset = _utils2['default'].offset(node);
|
5811 | w = _utils2['default'].outerWidth(node);
|
5812 | h = _utils2['default'].outerHeight(node);
|
5813 | } else {
|
5814 | var win = _utils2['default'].getWindow(node);
|
5815 | offset = {
|
5816 | left: _utils2['default'].getWindowScrollLeft(win),
|
5817 | top: _utils2['default'].getWindowScrollTop(win)
|
5818 | };
|
5819 | w = _utils2['default'].viewportWidth(win);
|
5820 | h = _utils2['default'].viewportHeight(win);
|
5821 | }
|
5822 | offset.width = w;
|
5823 | offset.height = h;
|
5824 | return offset;
|
5825 | }
|
5826 |
|
5827 | exports['default'] = getRegion;
|
5828 | module.exports = exports['default'];
|
5829 |
|
5830 | }),
|
5831 |
|
5832 | (function(module, exports, __webpack_require__) {
|
5833 |
|
5834 | 'use strict';
|
5835 |
|
5836 | Object.defineProperty(exports, "__esModule", {
|
5837 | value: true
|
5838 | });
|
5839 |
|
5840 | var _getAlignOffset = __webpack_require__(62);
|
5841 |
|
5842 | var _getAlignOffset2 = _interopRequireDefault(_getAlignOffset);
|
5843 |
|
5844 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5845 |
|
5846 | function getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) {
|
5847 | var p1 = (0, _getAlignOffset2['default'])(refNodeRegion, points[1]);
|
5848 | var p2 = (0, _getAlignOffset2['default'])(elRegion, points[0]);
|
5849 | var diff = [p2.left - p1.left, p2.top - p1.top];
|
5850 |
|
5851 | return {
|
5852 | left: elRegion.left - diff[0] + offset[0] - targetOffset[0],
|
5853 | top: elRegion.top - diff[1] + offset[1] - targetOffset[1]
|
5854 | };
|
5855 | }
|
5856 |
|
5857 | exports['default'] = getElFuturePos;
|
5858 | module.exports = exports['default'];
|
5859 |
|
5860 | }),
|
5861 |
|
5862 | (function(module, exports) {
|
5863 |
|
5864 | 'use strict';
|
5865 |
|
5866 | Object.defineProperty(exports, "__esModule", {
|
5867 | value: true
|
5868 | });
|
5869 | |
5870 |
|
5871 |
|
5872 |
|
5873 | function getAlignOffset(region, align) {
|
5874 | var V = align.charAt(0);
|
5875 | var H = align.charAt(1);
|
5876 | var w = region.width;
|
5877 | var h = region.height;
|
5878 |
|
5879 | var x = region.left;
|
5880 | var y = region.top;
|
5881 |
|
5882 | if (V === 'c') {
|
5883 | y += h / 2;
|
5884 | } else if (V === 'b') {
|
5885 | y += h;
|
5886 | }
|
5887 |
|
5888 | if (H === 'c') {
|
5889 | x += w / 2;
|
5890 | } else if (H === 'r') {
|
5891 | x += w;
|
5892 | }
|
5893 |
|
5894 | return {
|
5895 | left: x,
|
5896 | top: y
|
5897 | };
|
5898 | }
|
5899 |
|
5900 | exports['default'] = getAlignOffset;
|
5901 | module.exports = exports['default'];
|
5902 |
|
5903 | }),
|
5904 |
|
5905 | (function(module, exports, __webpack_require__) {
|
5906 |
|
5907 | 'use strict';
|
5908 |
|
5909 | Object.defineProperty(exports, "__esModule", {
|
5910 | value: true
|
5911 | });
|
5912 |
|
5913 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
5914 |
|
5915 | var _utils = __webpack_require__(54);
|
5916 |
|
5917 | var _utils2 = _interopRequireDefault(_utils);
|
5918 |
|
5919 | var _align = __webpack_require__(53);
|
5920 |
|
5921 | var _align2 = _interopRequireDefault(_align);
|
5922 |
|
5923 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5924 |
|
5925 | |
5926 |
|
5927 |
|
5928 |
|
5929 |
|
5930 | function alignPoint(el, tgtPoint, align) {
|
5931 | var pageX = void 0;
|
5932 | var pageY = void 0;
|
5933 |
|
5934 | var doc = _utils2['default'].getDocument(el);
|
5935 | var win = doc.defaultView || doc.parentWindow;
|
5936 |
|
5937 | var scrollX = _utils2['default'].getWindowScrollLeft(win);
|
5938 | var scrollY = _utils2['default'].getWindowScrollTop(win);
|
5939 | var viewportWidth = _utils2['default'].viewportWidth(win);
|
5940 | var viewportHeight = _utils2['default'].viewportHeight(win);
|
5941 |
|
5942 | if ('pageX' in tgtPoint) {
|
5943 | pageX = tgtPoint.pageX;
|
5944 | } else {
|
5945 | pageX = scrollX + tgtPoint.clientX;
|
5946 | }
|
5947 |
|
5948 | if ('pageY' in tgtPoint) {
|
5949 | pageY = tgtPoint.pageY;
|
5950 | } else {
|
5951 | pageY = scrollY + tgtPoint.clientY;
|
5952 | }
|
5953 |
|
5954 | var tgtRegion = {
|
5955 | left: pageX,
|
5956 | top: pageY,
|
5957 | width: 0,
|
5958 | height: 0
|
5959 | };
|
5960 |
|
5961 | var pointInView = pageX >= 0 && pageX <= scrollX + viewportWidth && pageY >= 0 && pageY <= scrollY + viewportHeight;
|
5962 |
|
5963 |
|
5964 | var points = [align.points[0], 'cc'];
|
5965 |
|
5966 | return (0, _align2['default'])(el, tgtRegion, _extends({}, align, { points: points }), pointInView);
|
5967 | }
|
5968 |
|
5969 | exports['default'] = alignPoint;
|
5970 | module.exports = exports['default'];
|
5971 |
|
5972 | }),
|
5973 |
|
5974 | (function(module, exports, __webpack_require__) {
|
5975 |
|
5976 | 'use strict';
|
5977 |
|
5978 | Object.defineProperty(exports, "__esModule", {
|
5979 | value: true
|
5980 | });
|
5981 |
|
5982 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
5983 |
|
5984 | var _classnames = __webpack_require__(5);
|
5985 |
|
5986 | var _classnames2 = _interopRequireDefault(_classnames);
|
5987 |
|
5988 | var _react = __webpack_require__(1);
|
5989 |
|
5990 | var _react2 = _interopRequireDefault(_react);
|
5991 |
|
5992 | var _propTypes = __webpack_require__(6);
|
5993 |
|
5994 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
5995 |
|
5996 | var _Transition = __webpack_require__(12);
|
5997 |
|
5998 | var _Transition2 = _interopRequireDefault(_Transition);
|
5999 |
|
6000 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6001 |
|
6002 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
6003 |
|
6004 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6005 |
|
6006 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
6007 |
|
6008 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
6009 |
|
6010 | var propTypes = {
|
6011 | |
6012 |
|
6013 |
|
6014 | "in": _propTypes2["default"].bool,
|
6015 |
|
6016 | |
6017 |
|
6018 |
|
6019 | unmountOnExit: _propTypes2["default"].bool,
|
6020 |
|
6021 | |
6022 |
|
6023 |
|
6024 |
|
6025 | transitionAppear: _propTypes2["default"].bool,
|
6026 |
|
6027 | |
6028 |
|
6029 |
|
6030 |
|
6031 |
|
6032 | timeout: _propTypes2["default"].number,
|
6033 |
|
6034 | |
6035 |
|
6036 |
|
6037 | onEnter: _propTypes2["default"].func,
|
6038 | |
6039 |
|
6040 |
|
6041 | onEntering: _propTypes2["default"].func,
|
6042 | |
6043 |
|
6044 |
|
6045 | onEntered: _propTypes2["default"].func,
|
6046 | |
6047 |
|
6048 |
|
6049 | onExit: _propTypes2["default"].func,
|
6050 | |
6051 |
|
6052 |
|
6053 | onExiting: _propTypes2["default"].func,
|
6054 | |
6055 |
|
6056 |
|
6057 | onExited: _propTypes2["default"].func
|
6058 | };
|
6059 |
|
6060 | var defaultProps = {
|
6061 | "in": false,
|
6062 | timeout: 300,
|
6063 | unmountOnExit: false,
|
6064 | transitionAppear: false
|
6065 | };
|
6066 |
|
6067 | var Fade = function (_React$Component) {
|
6068 | _inherits(Fade, _React$Component);
|
6069 |
|
6070 | function Fade() {
|
6071 | _classCallCheck(this, Fade);
|
6072 |
|
6073 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
6074 | }
|
6075 |
|
6076 | Fade.prototype.render = function render() {
|
6077 | return _react2["default"].createElement(_Transition2["default"], _extends({}, this.props, {
|
6078 | className: (0, _classnames2["default"])(this.props.className, 'fade'),
|
6079 | enteredClassName: 'in',
|
6080 | enteringClassName: 'in'
|
6081 | }));
|
6082 | };
|
6083 |
|
6084 | return Fade;
|
6085 | }(_react2["default"].Component);
|
6086 |
|
6087 | Fade.propTypes = propTypes;
|
6088 | Fade.defaultProps = defaultProps;
|
6089 |
|
6090 | exports["default"] = Fade;
|
6091 | module.exports = exports['default'];
|
6092 |
|
6093 | }),
|
6094 |
|
6095 | (function(module, exports, __webpack_require__) {
|
6096 |
|
6097 | 'use strict';
|
6098 |
|
6099 | Object.defineProperty(exports, "__esModule", {
|
6100 | value: true
|
6101 | });
|
6102 |
|
6103 | var _Message = __webpack_require__(66);
|
6104 |
|
6105 | var _Message2 = _interopRequireDefault(_Message);
|
6106 |
|
6107 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6108 |
|
6109 | exports["default"] = _Message2["default"];
|
6110 | module.exports = exports['default'];
|
6111 |
|
6112 | }),
|
6113 |
|
6114 | (function(module, exports, __webpack_require__) {
|
6115 |
|
6116 | 'use strict';
|
6117 |
|
6118 | Object.defineProperty(exports, "__esModule", {
|
6119 | value: true
|
6120 | });
|
6121 |
|
6122 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
6123 |
|
6124 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
6125 |
|
6126 | var _react = __webpack_require__(1);
|
6127 |
|
6128 | var _react2 = _interopRequireDefault(_react);
|
6129 |
|
6130 | var _beeNotification = __webpack_require__(67);
|
6131 |
|
6132 | var _beeNotification2 = _interopRequireDefault(_beeNotification);
|
6133 |
|
6134 | var _classnames = __webpack_require__(5);
|
6135 |
|
6136 | var _classnames2 = _interopRequireDefault(_classnames);
|
6137 |
|
6138 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6139 |
|
6140 | var defaultDuration = 1.5;
|
6141 | var defaultTop = 0;
|
6142 | var defaultBottom = 48;
|
6143 | var bottom = 90;
|
6144 | var padding = 30;
|
6145 | var width = 200;
|
6146 | var messageInstance = void 0;
|
6147 | var key = 1;
|
6148 | var clsPrefix = 'u-message';
|
6149 | var noop = function noop() {};
|
6150 |
|
6151 | var positionObj = {
|
6152 | "top": {
|
6153 | messageStyle: {
|
6154 | width: "100%"
|
6155 | },
|
6156 | notificationStyle: {
|
6157 | top: defaultTop,
|
6158 | width: "100%"
|
6159 | },
|
6160 | transitionName: 'top'
|
6161 | },
|
6162 | "bottom": {
|
6163 | messageStyle: {
|
6164 | width: "100%"
|
6165 | },
|
6166 | notificationStyle: {
|
6167 | bottom: defaultBottom,
|
6168 | width: "100%"
|
6169 | },
|
6170 | transitionName: 'bottom'
|
6171 | },
|
6172 | "topRight": {
|
6173 | messageStyle: {
|
6174 | width: width
|
6175 | },
|
6176 | notificationStyle: {
|
6177 | top: padding,
|
6178 | right: padding,
|
6179 | width: width
|
6180 | },
|
6181 | transitionName: 'right'
|
6182 | },
|
6183 | "bottomRight": {
|
6184 | messageStyle: {
|
6185 | width: width
|
6186 | },
|
6187 | notificationStyle: {
|
6188 | bottom: bottom,
|
6189 | right: padding,
|
6190 | width: width
|
6191 | },
|
6192 | transitionName: 'right'
|
6193 | },
|
6194 | "topLeft": {
|
6195 | messageStyle: {
|
6196 | width: width
|
6197 | },
|
6198 | notificationStyle: {
|
6199 | top: padding,
|
6200 | left: padding,
|
6201 | width: width
|
6202 | },
|
6203 | transitionName: 'left'
|
6204 | },
|
6205 | "bottomLeft": {
|
6206 | messageStyle: {
|
6207 | width: width
|
6208 | },
|
6209 | notificationStyle: {
|
6210 | bottom: bottom,
|
6211 | left: padding,
|
6212 | width: width
|
6213 | },
|
6214 | transitionName: 'left'
|
6215 | }
|
6216 | };
|
6217 |
|
6218 | function getMessageInstance() {
|
6219 | var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'top';
|
6220 | var callback = arguments[1];
|
6221 | var keyboard = arguments[2];
|
6222 | var onEscapeKeyUp = arguments[3];
|
6223 |
|
6224 | if (messageInstance) {
|
6225 | callback(messageInstance);
|
6226 | return;
|
6227 | }
|
6228 | var style = positionObj[position].notificationStyle;
|
6229 | var instanceObj = {
|
6230 | clsPrefix: clsPrefix,
|
6231 | transitionName: clsPrefix + '-' + positionObj[position].transitionName,
|
6232 | style: style,
|
6233 | position: ''
|
6234 | };
|
6235 | if (typeof keyboard === 'boolean') {
|
6236 | instanceObj.keyboard = keyboard;
|
6237 | }
|
6238 | if (typeof onEscapeKeyUp === 'function') {
|
6239 | instanceObj.onEscapeKeyUp = onEscapeKeyUp;
|
6240 | }
|
6241 | _beeNotification2["default"].newInstance(instanceObj, function (instance) {
|
6242 | messageInstance = instance;
|
6243 | callback(instance);
|
6244 | });
|
6245 | }
|
6246 |
|
6247 | function notice(content, duration, type, onClose, position, style, keyboard, onEscapeKeyUp, showIcon) {
|
6248 | var iconType = {
|
6249 | info: 'uf uf-i-c-2',
|
6250 | success: 'uf uf-correct',
|
6251 | danger: 'uf uf-close-c',
|
6252 | warning: 'uf uf-exc-t',
|
6253 | light: 'uf uf-notification',
|
6254 | dark: 'uf uf-bubble',
|
6255 | news: 'uf uf-bell',
|
6256 | infolight: 'uf uf-i-c-2',
|
6257 | successlight: 'uf uf-correct',
|
6258 | dangerlight: 'uf uf-close-c',
|
6259 | warninglight: 'uf uf-exc-t'
|
6260 | }[type];
|
6261 |
|
6262 | var positionStyle = positionObj[position].messageStyle;
|
6263 |
|
6264 | getMessageInstance(position, function (instance) {
|
6265 | instance.notice({
|
6266 | key: key,
|
6267 | duration: duration,
|
6268 | color: type,
|
6269 | style: _extends({}, positionStyle, style),
|
6270 | content: _react2["default"].createElement(
|
6271 | 'div',
|
6272 | null,
|
6273 | showIcon ? _react2["default"].createElement(
|
6274 | 'div',
|
6275 | { className: clsPrefix + '-notice-description-icon' },
|
6276 | _react2["default"].createElement('i', { className: (0, _classnames2["default"])(iconType) })
|
6277 | ) : null,
|
6278 | _react2["default"].createElement(
|
6279 | 'div',
|
6280 | { className: clsPrefix + '-notice-description-content' },
|
6281 | content
|
6282 | )
|
6283 | ),
|
6284 | onClose: onClose
|
6285 | });
|
6286 | }, keyboard, onEscapeKeyUp);
|
6287 | return function () {
|
6288 | var target = key++;
|
6289 | return function () {
|
6290 | if (messageInstance) {
|
6291 | messageInstance.removeNotice(target);
|
6292 | }
|
6293 | };
|
6294 | }();
|
6295 | }
|
6296 |
|
6297 | exports["default"] = {
|
6298 | create: function create(obj) {
|
6299 | var content = obj.content || '';
|
6300 | var duration = _typeof(obj.duration) == undefined ? defaultDuration : obj.duration;
|
6301 | var color = obj.color || 'dark';
|
6302 | var onClose = obj.onClose || noop;
|
6303 | var position = obj.position || "top";
|
6304 | var style = obj.style || {};
|
6305 | var showIcon = obj.showIcon || false;
|
6306 | return notice(content, duration, color, onClose, position, style, obj.keyboard, obj.onEscapeKeyUp, showIcon);
|
6307 | },
|
6308 | config: function config(options) {
|
6309 | if (options.top !== undefined) {
|
6310 | defaultTop = options.top;
|
6311 | }
|
6312 | if (options.duration !== undefined) {
|
6313 | defaultDuration = options.duration;
|
6314 | }
|
6315 | if (options.clsPrefix !== undefined) {
|
6316 | clsPrefix = options.clsPrefix;
|
6317 | }
|
6318 | if (options.defaultBottom !== undefined) {
|
6319 | defaultBottom = options.defaultBottom;
|
6320 | }
|
6321 | if (options.bottom !== undefined) {
|
6322 | bottom = options.bottom;
|
6323 | }
|
6324 | if (options.width !== undefined) {
|
6325 | bottom = options.width;
|
6326 | }
|
6327 | },
|
6328 | destroy: function destroy() {
|
6329 | if (messageInstance) {
|
6330 | messageInstance.destroy();
|
6331 | messageInstance = null;
|
6332 | }
|
6333 | }
|
6334 | };
|
6335 | module.exports = exports['default'];
|
6336 |
|
6337 | }),
|
6338 |
|
6339 | (function(module, exports, __webpack_require__) {
|
6340 |
|
6341 | 'use strict';
|
6342 |
|
6343 | Object.defineProperty(exports, "__esModule", {
|
6344 | value: true
|
6345 | });
|
6346 |
|
6347 | var _Notification = __webpack_require__(68);
|
6348 |
|
6349 | var _Notification2 = _interopRequireDefault(_Notification);
|
6350 |
|
6351 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6352 |
|
6353 | exports["default"] = _Notification2["default"];
|
6354 | module.exports = exports['default'];
|
6355 |
|
6356 | }),
|
6357 |
|
6358 | (function(module, exports, __webpack_require__) {
|
6359 |
|
6360 | 'use strict';
|
6361 |
|
6362 | Object.defineProperty(exports, "__esModule", {
|
6363 | value: true
|
6364 | });
|
6365 |
|
6366 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
6367 |
|
6368 | var _react = __webpack_require__(1);
|
6369 |
|
6370 | var _react2 = _interopRequireDefault(_react);
|
6371 |
|
6372 | var _propTypes = __webpack_require__(6);
|
6373 |
|
6374 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
6375 |
|
6376 | var _reactDom = __webpack_require__(2);
|
6377 |
|
6378 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
6379 |
|
6380 | var _beeAnimate = __webpack_require__(69);
|
6381 |
|
6382 | var _beeAnimate2 = _interopRequireDefault(_beeAnimate);
|
6383 |
|
6384 | var _createChainedFunction = __webpack_require__(37);
|
6385 |
|
6386 | var _createChainedFunction2 = _interopRequireDefault(_createChainedFunction);
|
6387 |
|
6388 | var _ownerDocument = __webpack_require__(74);
|
6389 |
|
6390 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
6391 |
|
6392 | var _addEventListener = __webpack_require__(76);
|
6393 |
|
6394 | var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
6395 |
|
6396 | var _classnames = __webpack_require__(5);
|
6397 |
|
6398 | var _classnames2 = _interopRequireDefault(_classnames);
|
6399 |
|
6400 | var _Notice = __webpack_require__(78);
|
6401 |
|
6402 | var _Notice2 = _interopRequireDefault(_Notice);
|
6403 |
|
6404 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6405 |
|
6406 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
6407 |
|
6408 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
6409 |
|
6410 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6411 |
|
6412 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
6413 |
|
6414 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
6415 |
|
6416 | var seed = 0;
|
6417 | var now = Date.now();
|
6418 |
|
6419 | function getUuid() {
|
6420 | return 'uNotification_' + now + '_' + seed++;
|
6421 | }
|
6422 |
|
6423 | var propTypes = {
|
6424 | show: _propTypes2["default"].bool,
|
6425 | clsPrefix: _propTypes2["default"].string,
|
6426 | style: _propTypes2["default"].object,
|
6427 | position: _propTypes2["default"].oneOf(['topRight', 'bottomRight', '']),
|
6428 | transitionName: _propTypes2["default"].string,
|
6429 | keyboard: _propTypes2["default"].bool,
|
6430 | onEscapeKeyUp: _propTypes2["default"].func,
|
6431 | animation: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object])
|
6432 | };
|
6433 |
|
6434 | var defaultProps = {
|
6435 | clsPrefix: 'u-notification',
|
6436 | animation: 'fade',
|
6437 | keyboard: true,
|
6438 | position: 'topRight'
|
6439 | };
|
6440 |
|
6441 | var Notification = function (_Component) {
|
6442 | _inherits(Notification, _Component);
|
6443 |
|
6444 | function Notification(props) {
|
6445 | _classCallCheck(this, Notification);
|
6446 |
|
6447 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
6448 |
|
6449 | _this.handleDocumentKeyUp = function (e) {
|
6450 | if (_this.props.keyboard && e.keyCode === 27 && _this.state.notices.length) {
|
6451 | _this.setState(function (previousState) {
|
6452 | previousState.notices.shift();
|
6453 | return {
|
6454 | notices: previousState.notices
|
6455 | };
|
6456 | });
|
6457 | if (_this.props.onEscapeKeyUp) {
|
6458 | _this.props.onEscapeKeyUp(e);
|
6459 | }
|
6460 | }
|
6461 | };
|
6462 |
|
6463 | _this.state = {
|
6464 | notices: []
|
6465 | };
|
6466 | _this.add = _this.add.bind(_this);
|
6467 | _this.remove = _this.remove.bind(_this);
|
6468 |
|
6469 | return _this;
|
6470 | }
|
6471 |
|
6472 | Notification.prototype.componentDidMount = function componentDidMount() {
|
6473 |
|
6474 | var doc = (0, _ownerDocument2["default"])(this);
|
6475 | this._onDocumentKeyupListener = (0, _addEventListener2["default"])(doc, 'keyup', this.handleDocumentKeyUp);
|
6476 | };
|
6477 |
|
6478 | Notification.prototype.componentWillUnmount = function componentWillUnmount() {
|
6479 | this._onDocumentKeyupListener.remove();
|
6480 | };
|
6481 |
|
6482 | Notification.prototype.getTransitionName = function getTransitionName() {
|
6483 | var props = this.props;
|
6484 | var transitionName = props.transitionName;
|
6485 | if (!transitionName && props.animation) {
|
6486 | transitionName = props.clsPrefix + '-' + props.animation;
|
6487 | }
|
6488 | return transitionName;
|
6489 | };
|
6490 |
|
6491 | Notification.prototype.add = function add(notice) {
|
6492 | var key = notice.key = notice.key || getUuid();
|
6493 | this.setState(function (previousState) {
|
6494 | var notices = previousState.notices;
|
6495 | if (!notices.filter(function (v) {
|
6496 | return v.key === key;
|
6497 | }).length) {
|
6498 | return {
|
6499 | notices: notices.concat(notice)
|
6500 | };
|
6501 | }
|
6502 | });
|
6503 | };
|
6504 |
|
6505 | Notification.prototype.remove = function remove(key) {
|
6506 | this.setState(function (previousState) {
|
6507 | return {
|
6508 | notices: previousState.notices.filter(function (notice) {
|
6509 | return notice.key !== key;
|
6510 | })
|
6511 | };
|
6512 | });
|
6513 | };
|
6514 |
|
6515 | |
6516 |
|
6517 |
|
6518 |
|
6519 |
|
6520 | Notification.prototype.render = function render() {
|
6521 | var _this2 = this,
|
6522 | _classes;
|
6523 |
|
6524 | var _props = this.props,
|
6525 | clsPrefix = _props.clsPrefix,
|
6526 | className = _props.className,
|
6527 | position = _props.position,
|
6528 | style = _props.style;
|
6529 |
|
6530 | var noticeNodes = this.state.notices.map(function (notice) {
|
6531 | var onClose = (0, _createChainedFunction2["default"])(_this2.remove.bind(_this2, notice.key), notice.onClose);
|
6532 | return _react2["default"].createElement(
|
6533 | _Notice2["default"],
|
6534 | _extends({
|
6535 | clsPrefix: clsPrefix
|
6536 | }, notice, {
|
6537 | onClose: onClose
|
6538 | }),
|
6539 | notice.content
|
6540 | );
|
6541 | });
|
6542 | var classes = (_classes = {}, _defineProperty(_classes, clsPrefix, 1), _defineProperty(_classes, className, !!className), _classes);
|
6543 | if (position) {
|
6544 | classes[clsPrefix + '-' + position] = !!position;
|
6545 | }
|
6546 |
|
6547 | return _react2["default"].createElement(
|
6548 | 'div',
|
6549 | { className: (0, _classnames2["default"])(className, classes), style: style },
|
6550 | _react2["default"].createElement(
|
6551 | _beeAnimate2["default"],
|
6552 | { transitionName: this.getTransitionName() },
|
6553 | noticeNodes
|
6554 | )
|
6555 | );
|
6556 | };
|
6557 |
|
6558 | return Notification;
|
6559 | }(_react.Component);
|
6560 |
|
6561 | ;
|
6562 |
|
6563 | Notification.propTypes = propTypes;
|
6564 | Notification.defaultProps = defaultProps;
|
6565 |
|
6566 | Notification.newInstance = function newNotificationInstance(properties, callback) {
|
6567 | if (typeof callback !== 'function') {
|
6568 | console.error('You must introduce callback as the second parameter of Notification.newInstance().');
|
6569 | return;
|
6570 | }
|
6571 | var props = properties || {};
|
6572 | var div = document.createElement('div');
|
6573 | document.body.appendChild(div);
|
6574 |
|
6575 | var called = false;
|
6576 | function ref(notification) {
|
6577 | if (called) {
|
6578 | return;
|
6579 | }
|
6580 | called = true;
|
6581 | callback({
|
6582 | notice: function notice(noticeProps) {
|
6583 | notification.add(noticeProps);
|
6584 | },
|
6585 | removeNotice: function removeNotice(key) {
|
6586 | notification.remove(key);
|
6587 | },
|
6588 |
|
6589 | component: notification,
|
6590 | destroy: function destroy() {
|
6591 | _reactDom2["default"].unmountComponentAtNode(div);
|
6592 | document.body.removeChild(div);
|
6593 | }
|
6594 | });
|
6595 | }
|
6596 | _reactDom2["default"].render(_react2["default"].createElement(Notification, _extends({}, props, { ref: ref })), div);
|
6597 | };
|
6598 |
|
6599 | exports["default"] = Notification;
|
6600 | module.exports = exports['default'];
|
6601 |
|
6602 | }),
|
6603 |
|
6604 | (function(module, exports, __webpack_require__) {
|
6605 |
|
6606 | 'use strict';
|
6607 |
|
6608 | Object.defineProperty(exports, "__esModule", {
|
6609 | value: true
|
6610 | });
|
6611 |
|
6612 | var _Animate = __webpack_require__(70);
|
6613 |
|
6614 | var _Animate2 = _interopRequireDefault(_Animate);
|
6615 |
|
6616 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6617 |
|
6618 | exports["default"] = _Animate2["default"];
|
6619 | module.exports = exports['default'];
|
6620 |
|
6621 | }),
|
6622 |
|
6623 | (function(module, exports, __webpack_require__) {
|
6624 |
|
6625 | 'use strict';
|
6626 |
|
6627 | Object.defineProperty(exports, "__esModule", {
|
6628 | value: true
|
6629 | });
|
6630 |
|
6631 | var _react = __webpack_require__(1);
|
6632 |
|
6633 | var _react2 = _interopRequireDefault(_react);
|
6634 |
|
6635 | var _propTypes = __webpack_require__(6);
|
6636 |
|
6637 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
6638 |
|
6639 | var _ChildrenUtils = __webpack_require__(71);
|
6640 |
|
6641 | var _AnimateChild = __webpack_require__(72);
|
6642 |
|
6643 | var _AnimateChild2 = _interopRequireDefault(_AnimateChild);
|
6644 |
|
6645 | var _util = __webpack_require__(73);
|
6646 |
|
6647 | var _util2 = _interopRequireDefault(_util);
|
6648 |
|
6649 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6650 |
|
6651 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
6652 |
|
6653 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
6654 |
|
6655 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6656 |
|
6657 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
6658 |
|
6659 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
6660 |
|
6661 | var defaultKey = 'u_animate_' + Date.now();
|
6662 |
|
6663 |
|
6664 | function getChildrenFromProps(props) {
|
6665 | var children = props.children;
|
6666 | if (_react2["default"].isValidElement(children)) {
|
6667 | if (!children.key) {
|
6668 | return _react2["default"].cloneElement(children, {
|
6669 | key: defaultKey
|
6670 | });
|
6671 | }
|
6672 | }
|
6673 | return children;
|
6674 | }
|
6675 |
|
6676 | function noop() {}
|
6677 |
|
6678 | var propTypes = {
|
6679 | component: _propTypes2["default"].any,
|
6680 | animation: _propTypes2["default"].object,
|
6681 | transitionName: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]),
|
6682 | transitionEnter: _propTypes2["default"].bool,
|
6683 | transitionAppear: _propTypes2["default"].bool,
|
6684 | exclusive: _propTypes2["default"].bool,
|
6685 | transitionLeave: _propTypes2["default"].bool,
|
6686 | onEnd: _propTypes2["default"].func,
|
6687 | onEnter: _propTypes2["default"].func,
|
6688 | onLeave: _propTypes2["default"].func,
|
6689 | onAppear: _propTypes2["default"].func,
|
6690 | showProp: _propTypes2["default"].string
|
6691 | };
|
6692 |
|
6693 | var defaultProps = {
|
6694 | animation: {},
|
6695 | component: 'span',
|
6696 | transitionEnter: true,
|
6697 | transitionLeave: true,
|
6698 | transitionAppear: false,
|
6699 | onEnd: noop,
|
6700 | onEnter: noop,
|
6701 | onLeave: noop,
|
6702 | onAppear: noop
|
6703 | };
|
6704 |
|
6705 | var Animate = function (_Component) {
|
6706 | _inherits(Animate, _Component);
|
6707 |
|
6708 | function Animate(props) {
|
6709 | _classCallCheck(this, Animate);
|
6710 |
|
6711 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
6712 |
|
6713 | _this.currentlyAnimatingKeys = {};
|
6714 | _this.keysToEnter = [];
|
6715 | _this.keysToLeave = [];
|
6716 | _this.state = {
|
6717 | children: (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(_this.props))
|
6718 | };
|
6719 |
|
6720 | _this.performEnter = _this.performEnter.bind(_this);
|
6721 | _this.performAppear = _this.performAppear.bind(_this);
|
6722 | _this.handleDoneAdding = _this.handleDoneAdding.bind(_this);
|
6723 | _this.performLeave = _this.performLeave.bind(_this);
|
6724 |
|
6725 | _this.performLeave = _this.performLeave.bind(_this);
|
6726 | _this.handleDoneLeaving = _this.handleDoneLeaving.bind(_this);
|
6727 | _this.isValidChildByKey = _this.isValidChildByKey.bind(_this);
|
6728 | _this.stop = _this.stop.bind(_this);
|
6729 | return _this;
|
6730 | }
|
6731 |
|
6732 | Animate.prototype.componentDidMount = function componentDidMount() {
|
6733 | var _this2 = this;
|
6734 |
|
6735 | this.mounted = true;
|
6736 | var showProp = this.props.showProp;
|
6737 | var children = this.state.children;
|
6738 | if (showProp) {
|
6739 | children = children.filter(function (child) {
|
6740 | return !!child.props[showProp];
|
6741 | });
|
6742 | }
|
6743 | children.forEach(function (child) {
|
6744 | if (child) {
|
6745 | _this2.performAppear(child.key);
|
6746 | }
|
6747 | });
|
6748 | };
|
6749 |
|
6750 | Animate.prototype.componentWillUnmount = function componentWillUnmount() {
|
6751 | this.mounted = false;
|
6752 | };
|
6753 |
|
6754 | Animate.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
6755 | var _this3 = this;
|
6756 |
|
6757 | this.nextProps = nextProps;
|
6758 | var nextChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(nextProps));
|
6759 | var props = this.props;
|
6760 |
|
6761 | if (props.exclusive) {
|
6762 | Object.keys(this.currentlyAnimatingKeys).forEach(function (key) {
|
6763 | _this3.stop(key);
|
6764 | });
|
6765 | }
|
6766 | var showProp = props.showProp;
|
6767 | var currentlyAnimatingKeys = this.currentlyAnimatingKeys;
|
6768 |
|
6769 | var currentChildren = props.exclusive ? (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)) : this.state.children;
|
6770 |
|
6771 | var newChildren = [];
|
6772 | if (showProp) {
|
6773 | currentChildren.forEach(function (currentChild) {
|
6774 | var nextChild = currentChild && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, currentChild.key);
|
6775 | var newChild = void 0;
|
6776 | if ((!nextChild || !nextChild.props[showProp]) && currentChild.props[showProp]) {
|
6777 | newChild = _react2["default"].cloneElement(nextChild || currentChild, _defineProperty({}, showProp, true));
|
6778 | } else {
|
6779 | newChild = nextChild;
|
6780 | }
|
6781 | if (newChild) {
|
6782 | newChildren.push(newChild);
|
6783 | }
|
6784 | });
|
6785 | nextChildren.forEach(function (nextChild) {
|
6786 | if (!nextChild || !(0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, nextChild.key)) {
|
6787 | newChildren.push(nextChild);
|
6788 | }
|
6789 | });
|
6790 | } else {
|
6791 | newChildren = (0, _ChildrenUtils.mergeChildren)(currentChildren, nextChildren);
|
6792 | }
|
6793 |
|
6794 |
|
6795 | this.setState({
|
6796 | children: newChildren
|
6797 | });
|
6798 |
|
6799 | nextChildren.forEach(function (child) {
|
6800 | var key = child && child.key;
|
6801 | if (child && currentlyAnimatingKeys[key]) {
|
6802 | return;
|
6803 | }
|
6804 | var hasPrev = child && (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key);
|
6805 | if (showProp) {
|
6806 | var showInNext = child.props[showProp];
|
6807 | if (hasPrev) {
|
6808 | var showInNow = (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp);
|
6809 | if (!showInNow && showInNext) {
|
6810 | _this3.keysToEnter.push(key);
|
6811 | }
|
6812 | } else if (showInNext) {
|
6813 | _this3.keysToEnter.push(key);
|
6814 | }
|
6815 | } else if (!hasPrev) {
|
6816 | _this3.keysToEnter.push(key);
|
6817 | }
|
6818 | });
|
6819 |
|
6820 | currentChildren.forEach(function (child) {
|
6821 | var key = child && child.key;
|
6822 | if (child && currentlyAnimatingKeys[key]) {
|
6823 | return;
|
6824 | }
|
6825 | var hasNext = child && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, key);
|
6826 | if (showProp) {
|
6827 | var showInNow = child.props[showProp];
|
6828 | if (hasNext) {
|
6829 | var showInNext = (0, _ChildrenUtils.findShownChildInChildrenByKey)(nextChildren, key, showProp);
|
6830 | if (!showInNext && showInNow) {
|
6831 | _this3.keysToLeave.push(key);
|
6832 | }
|
6833 | } else if (showInNow) {
|
6834 | _this3.keysToLeave.push(key);
|
6835 | }
|
6836 | } else if (!hasNext) {
|
6837 | _this3.keysToLeave.push(key);
|
6838 | }
|
6839 | });
|
6840 | };
|
6841 |
|
6842 | Animate.prototype.componentDidUpdate = function componentDidUpdate() {
|
6843 | var keysToEnter = this.keysToEnter;
|
6844 | this.keysToEnter = [];
|
6845 | keysToEnter.forEach(this.performEnter);
|
6846 | var keysToLeave = this.keysToLeave;
|
6847 | this.keysToLeave = [];
|
6848 | keysToLeave.forEach(this.performLeave);
|
6849 | };
|
6850 |
|
6851 | Animate.prototype.performEnter = function performEnter(key) {
|
6852 |
|
6853 | if (this.refs[key]) {
|
6854 | this.currentlyAnimatingKeys[key] = true;
|
6855 | this.refs[key].componentWillEnter(this.handleDoneAdding.bind(this, key, 'enter'));
|
6856 | }
|
6857 | };
|
6858 |
|
6859 | Animate.prototype.performAppear = function performAppear(key) {
|
6860 | if (this.refs[key]) {
|
6861 | this.currentlyAnimatingKeys[key] = true;
|
6862 | this.refs[key].componentWillAppear(this.handleDoneAdding.bind(this, key, 'appear'));
|
6863 | }
|
6864 | };
|
6865 |
|
6866 | Animate.prototype.handleDoneAdding = function handleDoneAdding(key, type) {
|
6867 | var props = this.props;
|
6868 | delete this.currentlyAnimatingKeys[key];
|
6869 |
|
6870 | if (props.exclusive && props !== this.nextProps) {
|
6871 | return;
|
6872 | }
|
6873 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props));
|
6874 | if (!this.isValidChildByKey(currentChildren, key)) {
|
6875 |
|
6876 | this.performLeave(key);
|
6877 | } else {
|
6878 | if (type === 'appear') {
|
6879 | if (_util2["default"].allowAppearCallback(props)) {
|
6880 | props.onAppear(key);
|
6881 | props.onEnd(key, true);
|
6882 | }
|
6883 | } else {
|
6884 | if (_util2["default"].allowEnterCallback(props)) {
|
6885 | props.onEnter(key);
|
6886 | props.onEnd(key, true);
|
6887 | }
|
6888 | }
|
6889 | }
|
6890 | };
|
6891 |
|
6892 | Animate.prototype.performLeave = function performLeave(key) {
|
6893 |
|
6894 | if (this.refs[key]) {
|
6895 | this.currentlyAnimatingKeys[key] = true;
|
6896 | this.refs[key].componentWillLeave(this.handleDoneLeaving.bind(this, key));
|
6897 | }
|
6898 | };
|
6899 |
|
6900 | Animate.prototype.handleDoneLeaving = function handleDoneLeaving(key) {
|
6901 | var props = this.props;
|
6902 | delete this.currentlyAnimatingKeys[key];
|
6903 |
|
6904 | if (props.exclusive && props !== this.nextProps) {
|
6905 | return;
|
6906 | }
|
6907 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props));
|
6908 |
|
6909 | if (this.isValidChildByKey(currentChildren, key)) {
|
6910 | this.performEnter(key);
|
6911 | } else {
|
6912 | var end = function end() {
|
6913 | if (_util2["default"].allowLeaveCallback(props)) {
|
6914 | props.onLeave(key);
|
6915 | props.onEnd(key, false);
|
6916 | }
|
6917 | };
|
6918 |
|
6919 | if (this.mounted && !(0, _ChildrenUtils.isSameChildren)(this.state.children, currentChildren, props.showProp)) {
|
6920 | this.setState({
|
6921 | children: currentChildren
|
6922 | }, end);
|
6923 | } else {
|
6924 | end();
|
6925 | }
|
6926 | }
|
6927 | };
|
6928 |
|
6929 | Animate.prototype.isValidChildByKey = function isValidChildByKey(currentChildren, key) {
|
6930 | var showProp = this.props.showProp;
|
6931 | if (showProp) {
|
6932 | return (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp);
|
6933 | }
|
6934 | return (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key);
|
6935 | };
|
6936 |
|
6937 | Animate.prototype.stop = function stop(key) {
|
6938 | delete this.currentlyAnimatingKeys[key];
|
6939 | var component = this.refs[key];
|
6940 | if (component) {
|
6941 | component.stop();
|
6942 | }
|
6943 | };
|
6944 |
|
6945 | Animate.prototype.render = function render() {
|
6946 | var props = this.props;
|
6947 | this.nextProps = props;
|
6948 | var stateChildren = this.state.children;
|
6949 | var children = null;
|
6950 | if (stateChildren) {
|
6951 | children = stateChildren.map(function (child) {
|
6952 | if (child === null || child === undefined) {
|
6953 | return child;
|
6954 | }
|
6955 | if (!child.key) {
|
6956 | throw new Error('must set key for <rc-animate> children');
|
6957 | }
|
6958 | return _react2["default"].createElement(
|
6959 | _AnimateChild2["default"],
|
6960 | {
|
6961 | key: child.key,
|
6962 | ref: child.key,
|
6963 | animation: props.animation,
|
6964 | transitionName: props.transitionName,
|
6965 | transitionEnter: props.transitionEnter,
|
6966 | transitionAppear: props.transitionAppear,
|
6967 | transitionLeave: props.transitionLeave
|
6968 | },
|
6969 | child
|
6970 | );
|
6971 | });
|
6972 | }
|
6973 | var Component = props.component;
|
6974 | if (Component) {
|
6975 | var passedProps = props;
|
6976 | if (typeof Component === 'string') {
|
6977 | passedProps = {
|
6978 | className: props.className,
|
6979 | style: props.style
|
6980 | };
|
6981 | }
|
6982 | return _react2["default"].createElement(
|
6983 | Component,
|
6984 | passedProps,
|
6985 | children
|
6986 | );
|
6987 | }
|
6988 | return children[0] || null;
|
6989 | };
|
6990 |
|
6991 | return Animate;
|
6992 | }(_react.Component);
|
6993 |
|
6994 | ;
|
6995 | Animate.defaultProps = defaultProps;
|
6996 | Animate.propTypes = Animate.propTypes;
|
6997 |
|
6998 | exports["default"] = Animate;
|
6999 | module.exports = exports['default'];
|
7000 |
|
7001 | }),
|
7002 |
|
7003 | (function(module, exports, __webpack_require__) {
|
7004 |
|
7005 | 'use strict';
|
7006 |
|
7007 | Object.defineProperty(exports, "__esModule", {
|
7008 | value: true
|
7009 | });
|
7010 | exports.toArrayChildren = toArrayChildren;
|
7011 | exports.findChildInChildrenByKey = findChildInChildrenByKey;
|
7012 | exports.findShownChildInChildrenByKey = findShownChildInChildrenByKey;
|
7013 | exports.findHiddenChildInChildrenByKey = findHiddenChildInChildrenByKey;
|
7014 | exports.isSameChildren = isSameChildren;
|
7015 | exports.mergeChildren = mergeChildren;
|
7016 |
|
7017 | var _react = __webpack_require__(1);
|
7018 |
|
7019 | var _react2 = _interopRequireDefault(_react);
|
7020 |
|
7021 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7022 |
|
7023 | function toArrayChildren(children) {
|
7024 | var ret = [];
|
7025 | _react2["default"].Children.forEach(children, function (child) {
|
7026 | ret.push(child);
|
7027 | });
|
7028 | return ret;
|
7029 | }
|
7030 |
|
7031 | function findChildInChildrenByKey(children, key) {
|
7032 | var ret = null;
|
7033 | if (children) {
|
7034 | children.forEach(function (child) {
|
7035 | if (ret) {
|
7036 | return;
|
7037 | }
|
7038 | if (child && child.key === key) {
|
7039 | ret = child;
|
7040 | }
|
7041 | });
|
7042 | }
|
7043 | return ret;
|
7044 | }
|
7045 |
|
7046 | function findShownChildInChildrenByKey(children, key, showProp) {
|
7047 | var ret = null;
|
7048 | if (children) {
|
7049 | children.forEach(function (child) {
|
7050 | if (child && child.key === key && child.props[showProp]) {
|
7051 | if (ret) {
|
7052 | throw new Error('two child with same key for <rc-animate> children');
|
7053 | }
|
7054 | ret = child;
|
7055 | }
|
7056 | });
|
7057 | }
|
7058 | return ret;
|
7059 | }
|
7060 |
|
7061 | function findHiddenChildInChildrenByKey(children, key, showProp) {
|
7062 | var found = 0;
|
7063 | if (children) {
|
7064 | children.forEach(function (child) {
|
7065 | if (found) {
|
7066 | return;
|
7067 | }
|
7068 | found = child && child.key === key && !child.props[showProp];
|
7069 | });
|
7070 | }
|
7071 | return found;
|
7072 | }
|
7073 |
|
7074 | function isSameChildren(c1, c2, showProp) {
|
7075 | var same = c1.length === c2.length;
|
7076 | if (same) {
|
7077 | c1.forEach(function (child, index) {
|
7078 | var child2 = c2[index];
|
7079 | if (child && child2) {
|
7080 | if (child && !child2 || !child && child2) {
|
7081 | same = false;
|
7082 | } else if (child.key !== child2.key) {
|
7083 | same = false;
|
7084 | } else if (showProp && child.props[showProp] !== child2.props[showProp]) {
|
7085 | same = false;
|
7086 | }
|
7087 | }
|
7088 | });
|
7089 | }
|
7090 | return same;
|
7091 | }
|
7092 |
|
7093 | function mergeChildren(prev, next) {
|
7094 | var ret = [];
|
7095 |
|
7096 |
|
7097 |
|
7098 | var nextChildrenPending = {};
|
7099 | var pendingChildren = [];
|
7100 | prev.forEach(function (child) {
|
7101 | if (child && findChildInChildrenByKey(next, child.key)) {
|
7102 | if (pendingChildren.length) {
|
7103 | nextChildrenPending[child.key] = pendingChildren;
|
7104 | pendingChildren = [];
|
7105 | }
|
7106 | } else {
|
7107 | pendingChildren.push(child);
|
7108 | }
|
7109 | });
|
7110 |
|
7111 | next.forEach(function (child) {
|
7112 | if (child && nextChildrenPending.hasOwnProperty(child.key)) {
|
7113 | ret = ret.concat(nextChildrenPending[child.key]);
|
7114 | }
|
7115 | ret.push(child);
|
7116 | });
|
7117 |
|
7118 | ret = ret.concat(pendingChildren);
|
7119 |
|
7120 | return ret;
|
7121 | }
|
7122 |
|
7123 | }),
|
7124 |
|
7125 | (function(module, exports, __webpack_require__) {
|
7126 |
|
7127 | 'use strict';
|
7128 |
|
7129 | Object.defineProperty(exports, "__esModule", {
|
7130 | value: true
|
7131 | });
|
7132 |
|
7133 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
7134 |
|
7135 | var _react = __webpack_require__(1);
|
7136 |
|
7137 | var _react2 = _interopRequireDefault(_react);
|
7138 |
|
7139 | var _propTypes = __webpack_require__(6);
|
7140 |
|
7141 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7142 |
|
7143 | var _reactDom = __webpack_require__(2);
|
7144 |
|
7145 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
7146 |
|
7147 | var _tinperBeeCore = __webpack_require__(27);
|
7148 |
|
7149 | var _util = __webpack_require__(73);
|
7150 |
|
7151 | var _util2 = _interopRequireDefault(_util);
|
7152 |
|
7153 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7154 |
|
7155 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
7156 |
|
7157 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7158 |
|
7159 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
7160 |
|
7161 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
7162 |
|
7163 | var transitionMap = {
|
7164 | enter: 'transitionEnter',
|
7165 | appear: 'transitionAppear',
|
7166 | leave: 'transitionLeave'
|
7167 | };
|
7168 |
|
7169 | var propTypes = {
|
7170 | children: _propTypes2["default"].any
|
7171 | };
|
7172 |
|
7173 | var AnimateChild = function (_Component) {
|
7174 | _inherits(AnimateChild, _Component);
|
7175 |
|
7176 | function AnimateChild(props) {
|
7177 | _classCallCheck(this, AnimateChild);
|
7178 |
|
7179 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
7180 |
|
7181 | _this.transition = _this.transition.bind(_this);
|
7182 | _this.stop = _this.stop.bind(_this);
|
7183 | return _this;
|
7184 | }
|
7185 |
|
7186 | AnimateChild.prototype.componentWillUnmount = function componentWillUnmount() {
|
7187 | this.stop();
|
7188 | };
|
7189 |
|
7190 | AnimateChild.prototype.componentWillEnter = function componentWillEnter(done) {
|
7191 | if (_util2["default"].isEnterSupported(this.props)) {
|
7192 | this.transition('enter', done);
|
7193 | } else {
|
7194 | done();
|
7195 | }
|
7196 | };
|
7197 |
|
7198 | AnimateChild.prototype.componentWillAppear = function componentWillAppear(done) {
|
7199 | if (_util2["default"].isAppearSupported(this.props)) {
|
7200 | this.transition('appear', done);
|
7201 | } else {
|
7202 | done();
|
7203 | }
|
7204 | };
|
7205 |
|
7206 | AnimateChild.prototype.componentWillLeave = function componentWillLeave(done) {
|
7207 | if (_util2["default"].isLeaveSupported(this.props)) {
|
7208 | this.transition('leave', done);
|
7209 | } else {
|
7210 |
|
7211 |
|
7212 |
|
7213 | done();
|
7214 | }
|
7215 | };
|
7216 |
|
7217 | AnimateChild.prototype.transition = function transition(animationType, finishCallback) {
|
7218 | var _this2 = this;
|
7219 |
|
7220 | var node = _reactDom2["default"].findDOMNode(this);
|
7221 | var props = this.props;
|
7222 | var transitionName = props.transitionName;
|
7223 | var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object';
|
7224 | this.stop();
|
7225 | var end = function end() {
|
7226 | _this2.stopper = null;
|
7227 | finishCallback();
|
7228 | };
|
7229 | if ((_tinperBeeCore.cssAnimation.isCssAnimationSupported || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) {
|
7230 | var name = nameIsObj ? transitionName[animationType] : transitionName + '-' + animationType;
|
7231 | var activeName = name + '-active';
|
7232 | if (nameIsObj && transitionName[animationType + 'Active']) {
|
7233 | activeName = transitionName[animationType + 'Active'];
|
7234 | }
|
7235 | this.stopper = (0, _tinperBeeCore.cssAnimation)(node, {
|
7236 | name: name,
|
7237 | active: activeName
|
7238 | }, end);
|
7239 | } else {
|
7240 | this.stopper = props.animation[animationType](node, end);
|
7241 | }
|
7242 | };
|
7243 |
|
7244 | AnimateChild.prototype.stop = function stop() {
|
7245 | var stopper = this.stopper;
|
7246 | if (stopper) {
|
7247 | this.stopper = null;
|
7248 | stopper.stop();
|
7249 | }
|
7250 | };
|
7251 |
|
7252 | AnimateChild.prototype.render = function render() {
|
7253 | return this.props.children;
|
7254 | };
|
7255 |
|
7256 | return AnimateChild;
|
7257 | }(_react.Component);
|
7258 |
|
7259 | ;
|
7260 |
|
7261 | AnimateChild.propTypes = propTypes;
|
7262 |
|
7263 | exports["default"] = AnimateChild;
|
7264 | module.exports = exports['default'];
|
7265 |
|
7266 | }),
|
7267 |
|
7268 | (function(module, exports) {
|
7269 |
|
7270 | "use strict";
|
7271 |
|
7272 | Object.defineProperty(exports, "__esModule", {
|
7273 | value: true
|
7274 | });
|
7275 | var util = {
|
7276 | isAppearSupported: function isAppearSupported(props) {
|
7277 | return props.transitionName && props.transitionAppear || props.animation.appear;
|
7278 | },
|
7279 | isEnterSupported: function isEnterSupported(props) {
|
7280 | return props.transitionName && props.transitionEnter || props.animation.enter;
|
7281 | },
|
7282 | isLeaveSupported: function isLeaveSupported(props) {
|
7283 | return props.transitionName && props.transitionLeave || props.animation.leave;
|
7284 | },
|
7285 | allowAppearCallback: function allowAppearCallback(props) {
|
7286 | return props.transitionAppear || props.animation.appear;
|
7287 | },
|
7288 | allowEnterCallback: function allowEnterCallback(props) {
|
7289 | return props.transitionEnter || props.animation.enter;
|
7290 | },
|
7291 | allowLeaveCallback: function allowLeaveCallback(props) {
|
7292 | return props.transitionLeave || props.animation.leave;
|
7293 | }
|
7294 | };
|
7295 | exports["default"] = util;
|
7296 | module.exports = exports["default"];
|
7297 |
|
7298 | }),
|
7299 |
|
7300 | (function(module, exports, __webpack_require__) {
|
7301 |
|
7302 | 'use strict';
|
7303 |
|
7304 | Object.defineProperty(exports, "__esModule", {
|
7305 | value: true
|
7306 | });
|
7307 |
|
7308 | exports["default"] = function (componentOrElement) {
|
7309 | return (0, _ownerDocument2["default"])(_reactDom2["default"].findDOMNode(componentOrElement));
|
7310 | };
|
7311 |
|
7312 | var _reactDom = __webpack_require__(2);
|
7313 |
|
7314 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
7315 |
|
7316 | var _ownerDocument = __webpack_require__(75);
|
7317 |
|
7318 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
7319 |
|
7320 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7321 |
|
7322 | module.exports = exports['default'];
|
7323 |
|
7324 | }),
|
7325 |
|
7326 | (function(module, exports) {
|
7327 |
|
7328 | "use strict";
|
7329 |
|
7330 | exports.__esModule = true;
|
7331 | exports.default = ownerDocument;
|
7332 |
|
7333 | function ownerDocument(node) {
|
7334 | return node && node.ownerDocument || document;
|
7335 | }
|
7336 |
|
7337 | module.exports = exports["default"];
|
7338 |
|
7339 | }),
|
7340 |
|
7341 | (function(module, exports, __webpack_require__) {
|
7342 |
|
7343 | 'use strict';
|
7344 |
|
7345 | Object.defineProperty(exports, "__esModule", {
|
7346 | value: true
|
7347 | });
|
7348 |
|
7349 | exports["default"] = function (node, event, handler, capture) {
|
7350 | (0, _on2["default"])(node, event, handler, capture);
|
7351 |
|
7352 | return {
|
7353 | remove: function remove() {
|
7354 | (0, _off2["default"])(node, event, handler, capture);
|
7355 | }
|
7356 | };
|
7357 | };
|
7358 |
|
7359 | var _on = __webpack_require__(16);
|
7360 |
|
7361 | var _on2 = _interopRequireDefault(_on);
|
7362 |
|
7363 | var _off = __webpack_require__(77);
|
7364 |
|
7365 | var _off2 = _interopRequireDefault(_off);
|
7366 |
|
7367 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7368 |
|
7369 | module.exports = exports['default'];
|
7370 |
|
7371 | }),
|
7372 |
|
7373 | (function(module, exports, __webpack_require__) {
|
7374 |
|
7375 | "use strict";
|
7376 |
|
7377 | var _interopRequireDefault = __webpack_require__(14);
|
7378 |
|
7379 | exports.__esModule = true;
|
7380 | exports.default = void 0;
|
7381 |
|
7382 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
7383 |
|
7384 | var off = function off() {};
|
7385 |
|
7386 | if (_inDOM.default) {
|
7387 | off = function () {
|
7388 | if (document.addEventListener) return function (node, eventName, handler, capture) {
|
7389 | return node.removeEventListener(eventName, handler, capture || false);
|
7390 | };else if (document.attachEvent) return function (node, eventName, handler) {
|
7391 | return node.detachEvent('on' + eventName, handler);
|
7392 | };
|
7393 | }();
|
7394 | }
|
7395 |
|
7396 | var _default = off;
|
7397 | exports.default = _default;
|
7398 | module.exports = exports["default"];
|
7399 |
|
7400 | }),
|
7401 |
|
7402 | (function(module, exports, __webpack_require__) {
|
7403 |
|
7404 | 'use strict';
|
7405 |
|
7406 | Object.defineProperty(exports, "__esModule", {
|
7407 | value: true
|
7408 | });
|
7409 |
|
7410 | var _react = __webpack_require__(1);
|
7411 |
|
7412 | var _react2 = _interopRequireDefault(_react);
|
7413 |
|
7414 | var _classnames = __webpack_require__(5);
|
7415 |
|
7416 | var _classnames2 = _interopRequireDefault(_classnames);
|
7417 |
|
7418 | var _propTypes = __webpack_require__(6);
|
7419 |
|
7420 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7421 |
|
7422 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7423 |
|
7424 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
7425 |
|
7426 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
7427 |
|
7428 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7429 |
|
7430 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
7431 |
|
7432 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
7433 |
|
7434 | var propTypes = {
|
7435 | duration: _propTypes2["default"].number,
|
7436 | onClose: _propTypes2["default"].func,
|
7437 | children: _propTypes2["default"].any,
|
7438 | color: _propTypes2["default"].oneOf(['info', 'success', 'danger', 'warning', 'light', 'dark', 'news', 'infolight', 'successlight', 'dangerlight', 'warninglight']),
|
7439 | title: _propTypes2["default"].any
|
7440 | };
|
7441 |
|
7442 | function noop() {}
|
7443 |
|
7444 | var defaultProps = {
|
7445 | onEnd: noop,
|
7446 | onClose: noop,
|
7447 | duration: 4.5,
|
7448 | closable: true
|
7449 | };
|
7450 |
|
7451 | var Notice = function (_React$Component) {
|
7452 | _inherits(Notice, _React$Component);
|
7453 |
|
7454 | function Notice(props) {
|
7455 | _classCallCheck(this, Notice);
|
7456 |
|
7457 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
7458 |
|
7459 | _this.clearCloseTimer = _this.clearCloseTimer.bind(_this);
|
7460 | _this.close = _this.close.bind(_this);
|
7461 | return _this;
|
7462 | }
|
7463 |
|
7464 | Notice.prototype.componentDidMount = function componentDidMount() {
|
7465 | var _this2 = this;
|
7466 |
|
7467 | if (this.props.duration) {
|
7468 | this.closeTimer = setTimeout(function () {
|
7469 | _this2.close();
|
7470 | }, this.props.duration * 1000);
|
7471 | }
|
7472 | };
|
7473 |
|
7474 | Notice.prototype.componentWillUnmount = function componentWillUnmount() {
|
7475 | this.clearCloseTimer();
|
7476 | };
|
7477 |
|
7478 | Notice.prototype.clearCloseTimer = function clearCloseTimer() {
|
7479 | if (this.closeTimer) {
|
7480 | clearTimeout(this.closeTimer);
|
7481 | this.closeTimer = null;
|
7482 | }
|
7483 | };
|
7484 |
|
7485 | Notice.prototype.close = function close() {
|
7486 | this.clearCloseTimer();
|
7487 | this.props.onClose();
|
7488 | };
|
7489 |
|
7490 | Notice.prototype.render = function render() {
|
7491 | var _classes;
|
7492 |
|
7493 | var _props = this.props,
|
7494 | closable = _props.closable,
|
7495 | clsPrefix = _props.clsPrefix,
|
7496 | className = _props.className,
|
7497 | style = _props.style,
|
7498 | children = _props.children,
|
7499 | color = _props.color,
|
7500 | title = _props.title;
|
7501 |
|
7502 | var componentClass = clsPrefix + '-notice';
|
7503 | var classes = (_classes = {}, _defineProperty(_classes, '' + componentClass, 1), _defineProperty(_classes, componentClass + '-closable', closable), _defineProperty(_classes, className, !!className), _classes);
|
7504 | if (color) {
|
7505 | classes[componentClass + '-' + color] = true;
|
7506 | }
|
7507 | return _react2["default"].createElement(
|
7508 | 'div',
|
7509 | { className: (0, _classnames2["default"])(classes), style: style, onClick: this.close },
|
7510 | _react2["default"].createElement(
|
7511 | 'div',
|
7512 | { className: componentClass + '-content' },
|
7513 | title && _react2["default"].createElement(
|
7514 | 'div',
|
7515 | { className: componentClass + '-title' },
|
7516 | title
|
7517 | ),
|
7518 | _react2["default"].createElement(
|
7519 | 'div',
|
7520 | { className: componentClass + '-description' },
|
7521 | children
|
7522 | )
|
7523 | ),
|
7524 | closable ? _react2["default"].createElement(
|
7525 | 'a',
|
7526 | { tabIndex: '0', onClick: this.close, className: componentClass + '-close' },
|
7527 | _react2["default"].createElement('span', { className: componentClass + '-close-x' })
|
7528 | ) : null
|
7529 | );
|
7530 | };
|
7531 |
|
7532 | return Notice;
|
7533 | }(_react2["default"].Component);
|
7534 |
|
7535 | ;
|
7536 |
|
7537 | Notice.propTypes = propTypes;
|
7538 | Notice.defaultProps = defaultProps;
|
7539 |
|
7540 | exports["default"] = Notice;
|
7541 | module.exports = exports['default'];
|
7542 |
|
7543 | }),
|
7544 |
|
7545 | (function(module, exports, __webpack_require__) {
|
7546 |
|
7547 | 'use strict';
|
7548 |
|
7549 | var deselectCurrent = __webpack_require__(80);
|
7550 |
|
7551 | var defaultMessage = 'Copy to clipboard: #{key}, Enter';
|
7552 |
|
7553 | function format(message) {
|
7554 | var copyKey = (/mac os x/i.test(navigator.userAgent) ? '⌘' : 'Ctrl') + '+C';
|
7555 | return message.replace(/#{\s*key\s*}/g, copyKey);
|
7556 | }
|
7557 |
|
7558 | function copy(text, options) {
|
7559 | var debug, message, reselectPrevious, range, selection, mark, success = false;
|
7560 | if (!options) { options = {}; }
|
7561 | debug = options.debug || false;
|
7562 | try {
|
7563 | reselectPrevious = deselectCurrent();
|
7564 |
|
7565 | range = document.createRange();
|
7566 | selection = document.getSelection();
|
7567 |
|
7568 | mark = document.createElement('span');
|
7569 | mark.textContent = text;
|
7570 |
|
7571 | mark.style.all = 'unset';
|
7572 |
|
7573 | mark.style.position = 'fixed';
|
7574 | mark.style.top = 0;
|
7575 | mark.style.clip = 'rect(0, 0, 0, 0)';
|
7576 |
|
7577 | mark.style.whiteSpace = 'pre';
|
7578 |
|
7579 | mark.style.webkitUserSelect = 'text';
|
7580 | mark.style.MozUserSelect = 'text';
|
7581 | mark.style.msUserSelect = 'text';
|
7582 | mark.style.userSelect = 'text';
|
7583 |
|
7584 | document.body.appendChild(mark);
|
7585 |
|
7586 | range.selectNode(mark);
|
7587 | selection.addRange(range);
|
7588 |
|
7589 | var successful = document.execCommand('copy');
|
7590 | if (!successful) {
|
7591 | throw new Error('copy command was unsuccessful');
|
7592 | }
|
7593 | success = true;
|
7594 | } catch (err) {
|
7595 | debug && console.error('unable to copy using execCommand: ', err);
|
7596 | debug && console.warn('trying IE specific stuff');
|
7597 | try {
|
7598 | window.clipboardData.setData('text', text);
|
7599 | success = true;
|
7600 | } catch (err) {
|
7601 | debug && console.error('unable to copy using clipboardData: ', err);
|
7602 | debug && console.error('falling back to prompt');
|
7603 | message = format('message' in options ? options.message : defaultMessage);
|
7604 | window.prompt(message, text);
|
7605 | }
|
7606 | } finally {
|
7607 | if (selection) {
|
7608 | if (typeof selection.removeRange == 'function') {
|
7609 | selection.removeRange(range);
|
7610 | } else {
|
7611 | selection.removeAllRanges();
|
7612 | }
|
7613 | }
|
7614 |
|
7615 | if (mark) {
|
7616 | document.body.removeChild(mark);
|
7617 | }
|
7618 | reselectPrevious();
|
7619 | }
|
7620 |
|
7621 | return success;
|
7622 | }
|
7623 |
|
7624 | module.exports = copy;
|
7625 |
|
7626 |
|
7627 | }),
|
7628 |
|
7629 | (function(module, exports) {
|
7630 |
|
7631 |
|
7632 | module.exports = function () {
|
7633 | var selection = document.getSelection();
|
7634 | if (!selection.rangeCount) {
|
7635 | return function () {};
|
7636 | }
|
7637 | var active = document.activeElement;
|
7638 |
|
7639 | var ranges = [];
|
7640 | for (var i = 0; i < selection.rangeCount; i++) {
|
7641 | ranges.push(selection.getRangeAt(i));
|
7642 | }
|
7643 |
|
7644 | switch (active.tagName.toUpperCase()) {
|
7645 | case 'INPUT':
|
7646 | case 'TEXTAREA':
|
7647 | active.blur();
|
7648 | break;
|
7649 |
|
7650 | default:
|
7651 | active = null;
|
7652 | break;
|
7653 | }
|
7654 |
|
7655 | selection.removeAllRanges();
|
7656 | return function () {
|
7657 | selection.type === 'Caret' &&
|
7658 | selection.removeAllRanges();
|
7659 |
|
7660 | if (!selection.rangeCount) {
|
7661 | ranges.forEach(function(range) {
|
7662 | selection.addRange(range);
|
7663 | });
|
7664 | }
|
7665 |
|
7666 | active &&
|
7667 | active.focus();
|
7668 | };
|
7669 | };
|
7670 |
|
7671 |
|
7672 | }),
|
7673 |
|
7674 | (function(module, exports, __webpack_require__) {
|
7675 |
|
7676 | 'use strict';
|
7677 |
|
7678 | Object.defineProperty(exports, "__esModule", {
|
7679 | value: true
|
7680 | });
|
7681 |
|
7682 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
7683 |
|
7684 | var _classnames = __webpack_require__(5);
|
7685 |
|
7686 | var _classnames2 = _interopRequireDefault(_classnames);
|
7687 |
|
7688 | var _react = __webpack_require__(1);
|
7689 |
|
7690 | var _react2 = _interopRequireDefault(_react);
|
7691 |
|
7692 | var _propTypes = __webpack_require__(6);
|
7693 |
|
7694 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7695 |
|
7696 | var _tinperBeeCore = __webpack_require__(27);
|
7697 |
|
7698 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7699 |
|
7700 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
7701 |
|
7702 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
7703 |
|
7704 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7705 |
|
7706 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
7707 |
|
7708 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
7709 |
|
7710 | var propTypes = {
|
7711 |
|
7712 | accordion: _propTypes2["default"].bool,
|
7713 |
|
7714 | activeKey: _propTypes2["default"].any,
|
7715 |
|
7716 | defaultActiveKey: _propTypes2["default"].any,
|
7717 |
|
7718 | onSelect: _propTypes2["default"].func,
|
7719 | role: _propTypes2["default"].string
|
7720 | };
|
7721 |
|
7722 | var defaultProps = {
|
7723 | accordion: false,
|
7724 | clsPrefix: 'u-panel-group'
|
7725 | };
|
7726 |
|
7727 |
|
7728 |
|
7729 | var PanelGroup = function (_React$Component) {
|
7730 | _inherits(PanelGroup, _React$Component);
|
7731 |
|
7732 | function PanelGroup(props, context) {
|
7733 | _classCallCheck(this, PanelGroup);
|
7734 |
|
7735 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
7736 |
|
7737 | _this.handleSelect = _this.handleSelect.bind(_this);
|
7738 |
|
7739 | _this.state = {
|
7740 | activeKey: props.defaultActiveKey
|
7741 | };
|
7742 | return _this;
|
7743 | }
|
7744 |
|
7745 | PanelGroup.prototype.handleSelect = function handleSelect(key, e) {
|
7746 | e.preventDefault();
|
7747 |
|
7748 | if (this.props.onSelect) {
|
7749 | this.props.onSelect(key, e);
|
7750 | }
|
7751 |
|
7752 | if (this.state.activeKey === key) {
|
7753 | key = null;
|
7754 | }
|
7755 |
|
7756 | this.setState({ activeKey: key });
|
7757 | };
|
7758 |
|
7759 | PanelGroup.prototype.render = function render() {
|
7760 | var _this2 = this;
|
7761 |
|
7762 | var _props = this.props,
|
7763 | accordion = _props.accordion,
|
7764 | propsActiveKey = _props.activeKey,
|
7765 | className = _props.className,
|
7766 | children = _props.children,
|
7767 | defaultActiveKey = _props.defaultActiveKey,
|
7768 | onSelect = _props.onSelect,
|
7769 | style = _props.style,
|
7770 | clsPrefix = _props.clsPrefix,
|
7771 | others = _objectWithoutProperties(_props, ['accordion', 'activeKey', 'className', 'children', 'defaultActiveKey', 'onSelect', 'style', 'clsPrefix']);
|
7772 |
|
7773 | var activeKey = void 0;
|
7774 | if (accordion) {
|
7775 | activeKey = propsActiveKey != null ? propsActiveKey : this.state.activeKey;
|
7776 | others.role = others.role || 'tablist';
|
7777 | }
|
7778 |
|
7779 | var classes = {};
|
7780 | classes['' + clsPrefix] = true;
|
7781 |
|
7782 | return _react2["default"].createElement(
|
7783 | 'div',
|
7784 | _extends({}, others, {
|
7785 | className: (0, _classnames2["default"])(className, classes)
|
7786 | }),
|
7787 | _react2["default"].Children.map(children, function (child) {
|
7788 | if (!_react2["default"].isValidElement(child)) {
|
7789 | return child;
|
7790 | }
|
7791 | var childProps = {
|
7792 | style: child.props.style
|
7793 | };
|
7794 |
|
7795 | if (accordion) {
|
7796 | _extends(childProps, {
|
7797 | headerRole: 'tab',
|
7798 | panelRole: 'tabpanel',
|
7799 | collapsible: true,
|
7800 | expanded: child.props.eventKey === activeKey,
|
7801 | onSelect: (0, _tinperBeeCore.createChainedFunction)(_this2.handleSelect, child.props.onSelect)
|
7802 | });
|
7803 | }
|
7804 |
|
7805 | return (0, _react.cloneElement)(child, childProps);
|
7806 | })
|
7807 | );
|
7808 | };
|
7809 |
|
7810 | return PanelGroup;
|
7811 | }(_react2["default"].Component);
|
7812 |
|
7813 | PanelGroup.propTypes = propTypes;
|
7814 | PanelGroup.defaultProps = defaultProps;
|
7815 |
|
7816 | exports["default"] = PanelGroup;
|
7817 | module.exports = exports['default'];
|
7818 |
|
7819 | }),
|
7820 |
|
7821 | (function(module, exports, __webpack_require__) {
|
7822 |
|
7823 | 'use strict';
|
7824 |
|
7825 | Object.defineProperty(exports, "__esModule", {
|
7826 | value: true
|
7827 | });
|
7828 |
|
7829 | var _Drawer = __webpack_require__(83);
|
7830 |
|
7831 | var _Drawer2 = _interopRequireDefault(_Drawer);
|
7832 |
|
7833 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7834 |
|
7835 | exports["default"] = _Drawer2["default"];
|
7836 | module.exports = exports['default'];
|
7837 |
|
7838 | }),
|
7839 |
|
7840 | (function(module, exports, __webpack_require__) {
|
7841 |
|
7842 | 'use strict';
|
7843 |
|
7844 | Object.defineProperty(exports, "__esModule", {
|
7845 | value: true
|
7846 | });
|
7847 |
|
7848 | var _react = __webpack_require__(1);
|
7849 |
|
7850 | var _react2 = _interopRequireDefault(_react);
|
7851 |
|
7852 | var _reactDom = __webpack_require__(2);
|
7853 |
|
7854 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
7855 |
|
7856 | var _propTypes = __webpack_require__(6);
|
7857 |
|
7858 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7859 |
|
7860 | var _classnames = __webpack_require__(5);
|
7861 |
|
7862 | var _classnames2 = _interopRequireDefault(_classnames);
|
7863 |
|
7864 | var _common = __webpack_require__(84);
|
7865 |
|
7866 | var _reactTransitionGroup = __webpack_require__(85);
|
7867 |
|
7868 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7869 |
|
7870 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
7871 |
|
7872 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7873 |
|
7874 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
7875 |
|
7876 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
7877 |
|
7878 | var propTypes = {
|
7879 | placement: _propTypes2["default"].oneOf(['left', 'right', 'top', 'bottom']),
|
7880 | hasHeader: _propTypes2["default"].bool,
|
7881 | show: _propTypes2["default"].bool,
|
7882 | title: _propTypes2["default"].string,
|
7883 | className: _propTypes2["default"].string,
|
7884 | showMask: _propTypes2["default"].bool,
|
7885 | maskClosable: _propTypes2["default"].bool,
|
7886 | zIndex: _propTypes2["default"].number,
|
7887 | showClose: _propTypes2["default"].bool,
|
7888 | width: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
|
7889 | height: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
|
7890 | destroyOnClose: _propTypes2["default"].bool,
|
7891 | container: _propTypes2["default"].string
|
7892 | };
|
7893 |
|
7894 | var defaultProps = {
|
7895 | placement: 'left',
|
7896 | hasHeader: true,
|
7897 | show: false,
|
7898 | showMask: true,
|
7899 | maskClosable: true,
|
7900 | zIndex: 100000,
|
7901 | showClose: false,
|
7902 | width: 'auto',
|
7903 | height: 'auto',
|
7904 | destroyOnClose: false,
|
7905 | container: 'body'
|
7906 | };
|
7907 |
|
7908 | var DrawerContext = _react2["default"].createContext(null);
|
7909 |
|
7910 | var Drawer = function (_Component) {
|
7911 | _inherits(Drawer, _Component);
|
7912 |
|
7913 | function Drawer(props) {
|
7914 | _classCallCheck(this, Drawer);
|
7915 |
|
7916 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
7917 |
|
7918 | _this.state = {
|
7919 | showDrawer: true,
|
7920 | width: '0',
|
7921 | push: false
|
7922 | };
|
7923 | _this.drawer = null;
|
7924 | _this.parentDrawer = null;
|
7925 | (0, _common.bindAll)(_this, ['fMaskClick', 'fDrawerTransitionEnd', 'renderMask', 'renderClose', 'fCloseClick', 'renderBody', 'renderAll']);
|
7926 | return _this;
|
7927 | }
|
7928 |
|
7929 | Drawer.prototype.componentDidUpdate = function componentDidUpdate(preProps) {
|
7930 |
|
7931 | if (preProps.show != this.props.show && this.parentDrawer) {
|
7932 | if (this.props.show) {
|
7933 | this.parentDrawer.push();
|
7934 | } else {
|
7935 | this.parentDrawer.pull();
|
7936 | }
|
7937 | }
|
7938 | };
|
7939 |
|
7940 | Drawer.prototype.push = function push() {
|
7941 | this.setState({
|
7942 | push: true
|
7943 | });
|
7944 | };
|
7945 |
|
7946 | Drawer.prototype.pull = function pull() {
|
7947 | this.setState({
|
7948 | push: false
|
7949 | });
|
7950 | };
|
7951 |
|
7952 | Drawer.prototype.fMaskClick = function fMaskClick() {
|
7953 | var maskClosable = this.props.maskClosable;
|
7954 |
|
7955 | if (maskClosable) {
|
7956 | var onClose = this.props.onClose;
|
7957 |
|
7958 | onClose && onClose();
|
7959 | }
|
7960 | };
|
7961 |
|
7962 | Drawer.prototype.fCloseClick = function fCloseClick() {
|
7963 | var onClose = this.props.onClose;
|
7964 |
|
7965 | onClose && onClose();
|
7966 | };
|
7967 |
|
7968 | Drawer.prototype.fDrawerTransitionEnd = function fDrawerTransitionEnd(e) {};
|
7969 |
|
7970 | Drawer.prototype.renderMask = function renderMask() {
|
7971 | var _props = this.props,
|
7972 | show = _props.show,
|
7973 | showMask = _props.showMask,
|
7974 | fMaskClick = _props.fMaskClick;
|
7975 |
|
7976 |
|
7977 | var maskStyle = void 0;
|
7978 | if (show) {
|
7979 | maskStyle = {
|
7980 | opacity: 1,
|
7981 | width: '100%'
|
7982 | };
|
7983 | } else {
|
7984 | maskStyle = {
|
7985 | opacity: 0,
|
7986 | width: 0
|
7987 | };
|
7988 | }
|
7989 | return showMask ? _react2["default"].createElement('div', { className: 'drawer-mask', style: maskStyle, onClick: this.fMaskClick }) : null;
|
7990 | };
|
7991 |
|
7992 | Drawer.prototype.renderClose = function renderClose() {
|
7993 | var showClose = this.props.showClose;
|
7994 |
|
7995 | return showClose ? _react2["default"].createElement(
|
7996 | 'i',
|
7997 | { className: 'drawer-close', onClick: this.fCloseClick },
|
7998 | '\xD7'
|
7999 | ) : null;
|
8000 | };
|
8001 |
|
8002 | Drawer.prototype.renderBody = function renderBody() {
|
8003 | var _this2 = this;
|
8004 |
|
8005 | var _props2 = this.props,
|
8006 | destroyOnClose = _props2.destroyOnClose,
|
8007 | show = _props2.show;
|
8008 |
|
8009 | if (destroyOnClose && !show) {
|
8010 | return null;
|
8011 | }
|
8012 | var _props3 = this.props,
|
8013 | hasHeader = _props3.hasHeader,
|
8014 | title = _props3.title,
|
8015 | children = _props3.children,
|
8016 | width = _props3.width,
|
8017 | height = _props3.height,
|
8018 | placement = _props3.placement;
|
8019 | var push = this.state.push;
|
8020 |
|
8021 |
|
8022 | var drawerClass = (0, _classnames2["default"])('drawer', 'drawer-' + placement);
|
8023 |
|
8024 | var translateHideMap = {
|
8025 | left: 'translateX(-100%)',
|
8026 | right: 'translateX(100%)',
|
8027 | top: 'translateY(-100%)',
|
8028 | bottom: 'translateY(100%)'
|
8029 | };
|
8030 | var translateShow = 'translate(0,0)';
|
8031 | if (push) {
|
8032 | var pushNum = 50;
|
8033 | var translateShowMap = {
|
8034 | left: 'translate(' + pushNum + 'px,0)',
|
8035 | right: 'translate(-' + pushNum + 'px,0)',
|
8036 | top: 'translate(0,' + pushNum + 'px)',
|
8037 | bottom: 'translate(0,-' + pushNum + 'px)'
|
8038 | };
|
8039 | translateShow = translateShowMap[placement];
|
8040 | }
|
8041 | var translate = show ? translateShow : translateHideMap[placement];
|
8042 |
|
8043 | if ((0, _common.isNumber)(width)) {
|
8044 | width = width + 'px';
|
8045 | }
|
8046 | if ((0, _common.isNumber)(height)) {
|
8047 | height = height + 'px';
|
8048 | }
|
8049 | if (placement == 'top' || placement == 'bottom') {
|
8050 | if (width == 'auto') {
|
8051 | width = '100%';
|
8052 | }
|
8053 | }
|
8054 | if (placement == 'left' || placement == 'right') {
|
8055 | if (height == 'auto') {
|
8056 | height = '100%';
|
8057 | }
|
8058 | }
|
8059 | var drawerStyle = {
|
8060 | transform: translate,
|
8061 | WebkitTransform: translate,
|
8062 | width: width,
|
8063 | height: height
|
8064 | };
|
8065 | var closer = this.renderClose();
|
8066 | var header = hasHeader ? _react2["default"].createElement(
|
8067 | 'div',
|
8068 | { className: 'drawer-header' },
|
8069 | _react2["default"].createElement(
|
8070 | 'div',
|
8071 | { className: 'drawer-header-title' },
|
8072 | title
|
8073 | )
|
8074 | ) : '';
|
8075 | return _react2["default"].createElement(
|
8076 | DrawerContext.Provider,
|
8077 | { value: this },
|
8078 | _react2["default"].createElement(
|
8079 | 'div',
|
8080 | { ref: function ref(drawer) {
|
8081 | _this2.drawer = drawer;
|
8082 | }, onTransitionEnd: this.fDrawerTransitionEnd, className: drawerClass, style: drawerStyle },
|
8083 | closer,
|
8084 | header,
|
8085 | _react2["default"].createElement(
|
8086 | 'div',
|
8087 | { className: 'drawer-body' },
|
8088 | children
|
8089 | )
|
8090 | )
|
8091 | );
|
8092 | };
|
8093 |
|
8094 | Drawer.prototype.renderAll = function renderAll(value) {
|
8095 | var _props4 = this.props,
|
8096 | show = _props4.show,
|
8097 | className = _props4.className,
|
8098 | zIndex = _props4.zIndex;
|
8099 |
|
8100 |
|
8101 | var drawercClass = (0, _classnames2["default"])('drawerc', className);
|
8102 |
|
8103 | var drawercStyle = { zIndex: zIndex };
|
8104 | if (show) {
|
8105 | drawercStyle.width = '100%';
|
8106 | } else {
|
8107 | drawercStyle.width = 0;
|
8108 | }
|
8109 |
|
8110 | this.parentDrawer = value;
|
8111 |
|
8112 | return _react2["default"].createElement(
|
8113 | 'div',
|
8114 | { className: drawercClass, style: drawercStyle },
|
8115 | this.renderMask(),
|
8116 | this.renderBody()
|
8117 | );
|
8118 | };
|
8119 |
|
8120 | Drawer.prototype.render = function render() {
|
8121 | var container = this.props.container;
|
8122 |
|
8123 | var conDom = document.querySelector(container);
|
8124 |
|
8125 | return _reactDom2["default"].createPortal(_react2["default"].createElement(
|
8126 | DrawerContext.Consumer,
|
8127 | null,
|
8128 | this.renderAll
|
8129 | ), conDom);
|
8130 | };
|
8131 |
|
8132 | return Drawer;
|
8133 | }(_react.Component);
|
8134 |
|
8135 | Drawer.propTypes = propTypes;
|
8136 | Drawer.defaultProps = defaultProps;
|
8137 |
|
8138 | exports["default"] = Drawer;
|
8139 | module.exports = exports['default'];
|
8140 |
|
8141 | }),
|
8142 |
|
8143 | (function(module, exports) {
|
8144 |
|
8145 | 'use strict';
|
8146 |
|
8147 | Object.defineProperty(exports, "__esModule", {
|
8148 | value: true
|
8149 | });
|
8150 | exports.bindAll = bindAll;
|
8151 | exports.type = type;
|
8152 | exports.isNumber = isNumber;
|
8153 | function bindAll(context, arrFunc) {
|
8154 | arrFunc.forEach(function (item) {
|
8155 | context[item] = context[item].bind(context);
|
8156 | });
|
8157 | }
|
8158 |
|
8159 | function type(obj) {
|
8160 | var toString = Object.prototype.toString;
|
8161 | return toString.call(obj);
|
8162 | }
|
8163 |
|
8164 | function isNumber(obj) {
|
8165 | return type(obj) == '[object Number]';
|
8166 | }
|
8167 |
|
8168 | }),
|
8169 |
|
8170 | (function(module, exports, __webpack_require__) {
|
8171 |
|
8172 | "use strict";
|
8173 |
|
8174 | var _CSSTransition = _interopRequireDefault(__webpack_require__(86));
|
8175 |
|
8176 | var _ReplaceTransition = _interopRequireDefault(__webpack_require__(93));
|
8177 |
|
8178 | var _TransitionGroup = _interopRequireDefault(__webpack_require__(94));
|
8179 |
|
8180 | var _Transition = _interopRequireDefault(__webpack_require__(90));
|
8181 |
|
8182 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8183 |
|
8184 | module.exports = {
|
8185 | Transition: _Transition.default,
|
8186 | TransitionGroup: _TransitionGroup.default,
|
8187 | ReplaceTransition: _ReplaceTransition.default,
|
8188 | CSSTransition: _CSSTransition.default
|
8189 | };
|
8190 |
|
8191 | }),
|
8192 |
|
8193 | (function(module, exports, __webpack_require__) {
|
8194 |
|
8195 | (function(process) {"use strict";
|
8196 |
|
8197 | exports.__esModule = true;
|
8198 | exports.default = void 0;
|
8199 |
|
8200 | var PropTypes = _interopRequireWildcard(__webpack_require__(6));
|
8201 |
|
8202 | var _addClass = _interopRequireDefault(__webpack_require__(87));
|
8203 |
|
8204 | var _removeClass = _interopRequireDefault(__webpack_require__(89));
|
8205 |
|
8206 | var _react = _interopRequireDefault(__webpack_require__(1));
|
8207 |
|
8208 | var _Transition = _interopRequireDefault(__webpack_require__(90));
|
8209 |
|
8210 | var _PropTypes = __webpack_require__(92);
|
8211 |
|
8212 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8213 |
|
8214 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
8215 |
|
8216 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
8217 |
|
8218 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
8219 |
|
8220 | var addClass = function addClass(node, classes) {
|
8221 | return node && classes && classes.split(' ').forEach(function (c) {
|
8222 | return (0, _addClass.default)(node, c);
|
8223 | });
|
8224 | };
|
8225 |
|
8226 | var removeClass = function removeClass(node, classes) {
|
8227 | return node && classes && classes.split(' ').forEach(function (c) {
|
8228 | return (0, _removeClass.default)(node, c);
|
8229 | });
|
8230 | };
|
8231 | |
8232 |
|
8233 |
|
8234 |
|
8235 |
|
8236 |
|
8237 |
|
8238 |
|
8239 |
|
8240 |
|
8241 |
|
8242 |
|
8243 |
|
8244 |
|
8245 |
|
8246 |
|
8247 |
|
8248 |
|
8249 |
|
8250 |
|
8251 |
|
8252 |
|
8253 |
|
8254 |
|
8255 |
|
8256 |
|
8257 |
|
8258 |
|
8259 |
|
8260 |
|
8261 |
|
8262 |
|
8263 |
|
8264 |
|
8265 |
|
8266 |
|
8267 |
|
8268 |
|
8269 |
|
8270 |
|
8271 |
|
8272 |
|
8273 |
|
8274 |
|
8275 |
|
8276 |
|
8277 |
|
8278 |
|
8279 |
|
8280 |
|
8281 |
|
8282 |
|
8283 |
|
8284 |
|
8285 |
|
8286 |
|
8287 |
|
8288 |
|
8289 |
|
8290 |
|
8291 |
|
8292 |
|
8293 | var CSSTransition =
|
8294 |
|
8295 | function (_React$Component) {
|
8296 | _inheritsLoose(CSSTransition, _React$Component);
|
8297 |
|
8298 | function CSSTransition() {
|
8299 | var _this;
|
8300 |
|
8301 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
8302 | args[_key] = arguments[_key];
|
8303 | }
|
8304 |
|
8305 | _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
8306 |
|
8307 | _this.onEnter = function (node, appearing) {
|
8308 | var _this$getClassNames = _this.getClassNames(appearing ? 'appear' : 'enter'),
|
8309 | className = _this$getClassNames.className;
|
8310 |
|
8311 | _this.removeClasses(node, 'exit');
|
8312 |
|
8313 | addClass(node, className);
|
8314 |
|
8315 | if (_this.props.onEnter) {
|
8316 | _this.props.onEnter(node, appearing);
|
8317 | }
|
8318 | };
|
8319 |
|
8320 | _this.onEntering = function (node, appearing) {
|
8321 | var _this$getClassNames2 = _this.getClassNames(appearing ? 'appear' : 'enter'),
|
8322 | activeClassName = _this$getClassNames2.activeClassName;
|
8323 |
|
8324 | _this.reflowAndAddClass(node, activeClassName);
|
8325 |
|
8326 | if (_this.props.onEntering) {
|
8327 | _this.props.onEntering(node, appearing);
|
8328 | }
|
8329 | };
|
8330 |
|
8331 | _this.onEntered = function (node, appearing) {
|
8332 | var _this$getClassNames3 = _this.getClassNames('enter'),
|
8333 | doneClassName = _this$getClassNames3.doneClassName;
|
8334 |
|
8335 | _this.removeClasses(node, appearing ? 'appear' : 'enter');
|
8336 |
|
8337 | addClass(node, doneClassName);
|
8338 |
|
8339 | if (_this.props.onEntered) {
|
8340 | _this.props.onEntered(node, appearing);
|
8341 | }
|
8342 | };
|
8343 |
|
8344 | _this.onExit = function (node) {
|
8345 | var _this$getClassNames4 = _this.getClassNames('exit'),
|
8346 | className = _this$getClassNames4.className;
|
8347 |
|
8348 | _this.removeClasses(node, 'appear');
|
8349 |
|
8350 | _this.removeClasses(node, 'enter');
|
8351 |
|
8352 | addClass(node, className);
|
8353 |
|
8354 | if (_this.props.onExit) {
|
8355 | _this.props.onExit(node);
|
8356 | }
|
8357 | };
|
8358 |
|
8359 | _this.onExiting = function (node) {
|
8360 | var _this$getClassNames5 = _this.getClassNames('exit'),
|
8361 | activeClassName = _this$getClassNames5.activeClassName;
|
8362 |
|
8363 | _this.reflowAndAddClass(node, activeClassName);
|
8364 |
|
8365 | if (_this.props.onExiting) {
|
8366 | _this.props.onExiting(node);
|
8367 | }
|
8368 | };
|
8369 |
|
8370 | _this.onExited = function (node) {
|
8371 | var _this$getClassNames6 = _this.getClassNames('exit'),
|
8372 | doneClassName = _this$getClassNames6.doneClassName;
|
8373 |
|
8374 | _this.removeClasses(node, 'exit');
|
8375 |
|
8376 | addClass(node, doneClassName);
|
8377 |
|
8378 | if (_this.props.onExited) {
|
8379 | _this.props.onExited(node);
|
8380 | }
|
8381 | };
|
8382 |
|
8383 | _this.getClassNames = function (type) {
|
8384 | var classNames = _this.props.classNames;
|
8385 | var className = typeof classNames !== 'string' ? classNames[type] : classNames + '-' + type;
|
8386 | var activeClassName = typeof classNames !== 'string' ? classNames[type + 'Active'] : className + '-active';
|
8387 | var doneClassName = typeof classNames !== 'string' ? classNames[type + 'Done'] : className + '-done';
|
8388 | return {
|
8389 | className: className,
|
8390 | activeClassName: activeClassName,
|
8391 | doneClassName: doneClassName
|
8392 | };
|
8393 | };
|
8394 |
|
8395 | return _this;
|
8396 | }
|
8397 |
|
8398 | var _proto = CSSTransition.prototype;
|
8399 |
|
8400 | _proto.removeClasses = function removeClasses(node, type) {
|
8401 | var _this$getClassNames7 = this.getClassNames(type),
|
8402 | className = _this$getClassNames7.className,
|
8403 | activeClassName = _this$getClassNames7.activeClassName,
|
8404 | doneClassName = _this$getClassNames7.doneClassName;
|
8405 |
|
8406 | className && removeClass(node, className);
|
8407 | activeClassName && removeClass(node, activeClassName);
|
8408 | doneClassName && removeClass(node, doneClassName);
|
8409 | };
|
8410 |
|
8411 | _proto.reflowAndAddClass = function reflowAndAddClass(node, className) {
|
8412 |
|
8413 |
|
8414 | if (className) {
|
8415 |
|
8416 | node && node.scrollTop;
|
8417 |
|
8418 |
|
8419 | addClass(node, className);
|
8420 | }
|
8421 | };
|
8422 |
|
8423 | _proto.render = function render() {
|
8424 | var props = _extends({}, this.props);
|
8425 |
|
8426 | delete props.classNames;
|
8427 | return _react.default.createElement(_Transition.default, _extends({}, props, {
|
8428 | onEnter: this.onEnter,
|
8429 | onEntered: this.onEntered,
|
8430 | onEntering: this.onEntering,
|
8431 | onExit: this.onExit,
|
8432 | onExiting: this.onExiting,
|
8433 | onExited: this.onExited
|
8434 | }));
|
8435 | };
|
8436 |
|
8437 | return CSSTransition;
|
8438 | }(_react.default.Component);
|
8439 |
|
8440 | CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends({}, _Transition.default.propTypes, {
|
8441 | |
8442 |
|
8443 |
|
8444 |
|
8445 |
|
8446 |
|
8447 |
|
8448 |
|
8449 |
|
8450 |
|
8451 |
|
8452 |
|
8453 |
|
8454 |
|
8455 |
|
8456 |
|
8457 |
|
8458 |
|
8459 |
|
8460 |
|
8461 |
|
8462 |
|
8463 |
|
8464 |
|
8465 |
|
8466 |
|
8467 |
|
8468 |
|
8469 |
|
8470 |
|
8471 |
|
8472 |
|
8473 |
|
8474 |
|
8475 |
|
8476 |
|
8477 |
|
8478 |
|
8479 |
|
8480 |
|
8481 |
|
8482 |
|
8483 |
|
8484 |
|
8485 |
|
8486 | classNames: _PropTypes.classNamesShape,
|
8487 |
|
8488 | |
8489 |
|
8490 |
|
8491 |
|
8492 |
|
8493 |
|
8494 | onEnter: PropTypes.func,
|
8495 |
|
8496 | |
8497 |
|
8498 |
|
8499 |
|
8500 |
|
8501 |
|
8502 | onEntering: PropTypes.func,
|
8503 |
|
8504 | |
8505 |
|
8506 |
|
8507 |
|
8508 |
|
8509 |
|
8510 | onEntered: PropTypes.func,
|
8511 |
|
8512 | |
8513 |
|
8514 |
|
8515 |
|
8516 |
|
8517 |
|
8518 | onExit: PropTypes.func,
|
8519 |
|
8520 | |
8521 |
|
8522 |
|
8523 |
|
8524 |
|
8525 | onExiting: PropTypes.func,
|
8526 |
|
8527 | |
8528 |
|
8529 |
|
8530 |
|
8531 |
|
8532 |
|
8533 | onExited: PropTypes.func
|
8534 | }) : {};
|
8535 | var _default = CSSTransition;
|
8536 | exports.default = _default;
|
8537 | module.exports = exports["default"];
|
8538 | }.call(exports, __webpack_require__(33)))
|
8539 |
|
8540 | }),
|
8541 |
|
8542 | (function(module, exports, __webpack_require__) {
|
8543 |
|
8544 | "use strict";
|
8545 |
|
8546 | var _interopRequireDefault = __webpack_require__(14);
|
8547 |
|
8548 | exports.__esModule = true;
|
8549 | exports.default = addClass;
|
8550 |
|
8551 | var _hasClass = _interopRequireDefault(__webpack_require__(88));
|
8552 |
|
8553 | function addClass(element, className) {
|
8554 | if (element.classList) element.classList.add(className);else if (!(0, _hasClass.default)(element, className)) if (typeof element.className === 'string') element.className = element.className + ' ' + className;else element.setAttribute('class', (element.className && element.className.baseVal || '') + ' ' + className);
|
8555 | }
|
8556 |
|
8557 | module.exports = exports["default"];
|
8558 |
|
8559 | }),
|
8560 |
|
8561 | (function(module, exports) {
|
8562 |
|
8563 | "use strict";
|
8564 |
|
8565 | exports.__esModule = true;
|
8566 | exports.default = hasClass;
|
8567 |
|
8568 | function hasClass(element, className) {
|
8569 | if (element.classList) return !!className && element.classList.contains(className);else return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
|
8570 | }
|
8571 |
|
8572 | module.exports = exports["default"];
|
8573 |
|
8574 | }),
|
8575 |
|
8576 | (function(module, exports) {
|
8577 |
|
8578 | 'use strict';
|
8579 |
|
8580 | function replaceClassName(origClass, classToRemove) {
|
8581 | return origClass.replace(new RegExp('(^|\\s)' + classToRemove + '(?:\\s|$)', 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, '');
|
8582 | }
|
8583 |
|
8584 | module.exports = function removeClass(element, className) {
|
8585 | if (element.classList) element.classList.remove(className);else if (typeof element.className === 'string') element.className = replaceClassName(element.className, className);else element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));
|
8586 | };
|
8587 |
|
8588 | }),
|
8589 |
|
8590 | (function(module, exports, __webpack_require__) {
|
8591 |
|
8592 | (function(process) {"use strict";
|
8593 |
|
8594 | exports.__esModule = true;
|
8595 | exports.default = exports.EXITING = exports.ENTERED = exports.ENTERING = exports.EXITED = exports.UNMOUNTED = void 0;
|
8596 |
|
8597 | var PropTypes = _interopRequireWildcard(__webpack_require__(6));
|
8598 |
|
8599 | var _react = _interopRequireDefault(__webpack_require__(1));
|
8600 |
|
8601 | var _reactDom = _interopRequireDefault(__webpack_require__(2));
|
8602 |
|
8603 | var _reactLifecyclesCompat = __webpack_require__(91);
|
8604 |
|
8605 | var _PropTypes = __webpack_require__(92);
|
8606 |
|
8607 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8608 |
|
8609 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
8610 |
|
8611 | function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
8612 |
|
8613 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
8614 |
|
8615 | var UNMOUNTED = 'unmounted';
|
8616 | exports.UNMOUNTED = UNMOUNTED;
|
8617 | var EXITED = 'exited';
|
8618 | exports.EXITED = EXITED;
|
8619 | var ENTERING = 'entering';
|
8620 | exports.ENTERING = ENTERING;
|
8621 | var ENTERED = 'entered';
|
8622 | exports.ENTERED = ENTERED;
|
8623 | var EXITING = 'exiting';
|
8624 | |
8625 |
|
8626 |
|
8627 |
|
8628 |
|
8629 |
|
8630 |
|
8631 |
|
8632 |
|
8633 |
|
8634 |
|
8635 |
|
8636 |
|
8637 |
|
8638 |
|
8639 |
|
8640 |
|
8641 |
|
8642 |
|
8643 |
|
8644 |
|
8645 |
|
8646 |
|
8647 |
|
8648 |
|
8649 |
|
8650 |
|
8651 |
|
8652 |
|
8653 |
|
8654 |
|
8655 |
|
8656 |
|
8657 |
|
8658 |
|
8659 |
|
8660 |
|
8661 |
|
8662 |
|
8663 |
|
8664 |
|
8665 |
|
8666 |
|
8667 |
|
8668 |
|
8669 |
|
8670 |
|
8671 |
|
8672 |
|
8673 |
|
8674 |
|
8675 |
|
8676 |
|
8677 |
|
8678 |
|
8679 |
|
8680 |
|
8681 |
|
8682 |
|
8683 |
|
8684 |
|
8685 |
|
8686 |
|
8687 |
|
8688 |
|
8689 |
|
8690 |
|
8691 |
|
8692 |
|
8693 |
|
8694 |
|
8695 |
|
8696 |
|
8697 |
|
8698 |
|
8699 |
|
8700 |
|
8701 |
|
8702 |
|
8703 |
|
8704 |
|
8705 |
|
8706 |
|
8707 |
|
8708 |
|
8709 |
|
8710 |
|
8711 |
|
8712 |
|
8713 |
|
8714 | exports.EXITING = EXITING;
|
8715 |
|
8716 | var Transition =
|
8717 |
|
8718 | function (_React$Component) {
|
8719 | _inheritsLoose(Transition, _React$Component);
|
8720 |
|
8721 | function Transition(props, context) {
|
8722 | var _this;
|
8723 |
|
8724 | _this = _React$Component.call(this, props, context) || this;
|
8725 | var parentGroup = context.transitionGroup;
|
8726 |
|
8727 | var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
|
8728 | var initialStatus;
|
8729 | _this.appearStatus = null;
|
8730 |
|
8731 | if (props.in) {
|
8732 | if (appear) {
|
8733 | initialStatus = EXITED;
|
8734 | _this.appearStatus = ENTERING;
|
8735 | } else {
|
8736 | initialStatus = ENTERED;
|
8737 | }
|
8738 | } else {
|
8739 | if (props.unmountOnExit || props.mountOnEnter) {
|
8740 | initialStatus = UNMOUNTED;
|
8741 | } else {
|
8742 | initialStatus = EXITED;
|
8743 | }
|
8744 | }
|
8745 |
|
8746 | _this.state = {
|
8747 | status: initialStatus
|
8748 | };
|
8749 | _this.nextCallback = null;
|
8750 | return _this;
|
8751 | }
|
8752 |
|
8753 | var _proto = Transition.prototype;
|
8754 |
|
8755 | _proto.getChildContext = function getChildContext() {
|
8756 | return {
|
8757 | transitionGroup: null
|
8758 |
|
8759 | };
|
8760 | };
|
8761 |
|
8762 | Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
|
8763 | var nextIn = _ref.in;
|
8764 |
|
8765 | if (nextIn && prevState.status === UNMOUNTED) {
|
8766 | return {
|
8767 | status: EXITED
|
8768 | };
|
8769 | }
|
8770 |
|
8771 | return null;
|
8772 | };
|
8773 |
|
8774 |
|
8775 |
|
8776 |
|
8777 |
|
8778 |
|
8779 |
|
8780 |
|
8781 |
|
8782 |
|
8783 |
|
8784 |
|
8785 |
|
8786 |
|
8787 |
|
8788 |
|
8789 |
|
8790 | _proto.componentDidMount = function componentDidMount() {
|
8791 | this.updateStatus(true, this.appearStatus);
|
8792 | };
|
8793 |
|
8794 | _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
8795 | var nextStatus = null;
|
8796 |
|
8797 | if (prevProps !== this.props) {
|
8798 | var status = this.state.status;
|
8799 |
|
8800 | if (this.props.in) {
|
8801 | if (status !== ENTERING && status !== ENTERED) {
|
8802 | nextStatus = ENTERING;
|
8803 | }
|
8804 | } else {
|
8805 | if (status === ENTERING || status === ENTERED) {
|
8806 | nextStatus = EXITING;
|
8807 | }
|
8808 | }
|
8809 | }
|
8810 |
|
8811 | this.updateStatus(false, nextStatus);
|
8812 | };
|
8813 |
|
8814 | _proto.componentWillUnmount = function componentWillUnmount() {
|
8815 | this.cancelNextCallback();
|
8816 | };
|
8817 |
|
8818 | _proto.getTimeouts = function getTimeouts() {
|
8819 | var timeout = this.props.timeout;
|
8820 | var exit, enter, appear;
|
8821 | exit = enter = appear = timeout;
|
8822 |
|
8823 | if (timeout != null && typeof timeout !== 'number') {
|
8824 | exit = timeout.exit;
|
8825 | enter = timeout.enter;
|
8826 |
|
8827 | appear = timeout.appear !== undefined ? timeout.appear : enter;
|
8828 | }
|
8829 |
|
8830 | return {
|
8831 | exit: exit,
|
8832 | enter: enter,
|
8833 | appear: appear
|
8834 | };
|
8835 | };
|
8836 |
|
8837 | _proto.updateStatus = function updateStatus(mounting, nextStatus) {
|
8838 | if (mounting === void 0) {
|
8839 | mounting = false;
|
8840 | }
|
8841 |
|
8842 | if (nextStatus !== null) {
|
8843 |
|
8844 | this.cancelNextCallback();
|
8845 |
|
8846 | var node = _reactDom.default.findDOMNode(this);
|
8847 |
|
8848 | if (nextStatus === ENTERING) {
|
8849 | this.performEnter(node, mounting);
|
8850 | } else {
|
8851 | this.performExit(node);
|
8852 | }
|
8853 | } else if (this.props.unmountOnExit && this.state.status === EXITED) {
|
8854 | this.setState({
|
8855 | status: UNMOUNTED
|
8856 | });
|
8857 | }
|
8858 | };
|
8859 |
|
8860 | _proto.performEnter = function performEnter(node, mounting) {
|
8861 | var _this2 = this;
|
8862 |
|
8863 | var enter = this.props.enter;
|
8864 | var appearing = this.context.transitionGroup ? this.context.transitionGroup.isMounting : mounting;
|
8865 | var timeouts = this.getTimeouts();
|
8866 | var enterTimeout = appearing ? timeouts.appear : timeouts.enter;
|
8867 |
|
8868 |
|
8869 | if (!mounting && !enter) {
|
8870 | this.safeSetState({
|
8871 | status: ENTERED
|
8872 | }, function () {
|
8873 | _this2.props.onEntered(node);
|
8874 | });
|
8875 | return;
|
8876 | }
|
8877 |
|
8878 | this.props.onEnter(node, appearing);
|
8879 | this.safeSetState({
|
8880 | status: ENTERING
|
8881 | }, function () {
|
8882 | _this2.props.onEntering(node, appearing);
|
8883 |
|
8884 | _this2.onTransitionEnd(node, enterTimeout, function () {
|
8885 | _this2.safeSetState({
|
8886 | status: ENTERED
|
8887 | }, function () {
|
8888 | _this2.props.onEntered(node, appearing);
|
8889 | });
|
8890 | });
|
8891 | });
|
8892 | };
|
8893 |
|
8894 | _proto.performExit = function performExit(node) {
|
8895 | var _this3 = this;
|
8896 |
|
8897 | var exit = this.props.exit;
|
8898 | var timeouts = this.getTimeouts();
|
8899 |
|
8900 | if (!exit) {
|
8901 | this.safeSetState({
|
8902 | status: EXITED
|
8903 | }, function () {
|
8904 | _this3.props.onExited(node);
|
8905 | });
|
8906 | return;
|
8907 | }
|
8908 |
|
8909 | this.props.onExit(node);
|
8910 | this.safeSetState({
|
8911 | status: EXITING
|
8912 | }, function () {
|
8913 | _this3.props.onExiting(node);
|
8914 |
|
8915 | _this3.onTransitionEnd(node, timeouts.exit, function () {
|
8916 | _this3.safeSetState({
|
8917 | status: EXITED
|
8918 | }, function () {
|
8919 | _this3.props.onExited(node);
|
8920 | });
|
8921 | });
|
8922 | });
|
8923 | };
|
8924 |
|
8925 | _proto.cancelNextCallback = function cancelNextCallback() {
|
8926 | if (this.nextCallback !== null) {
|
8927 | this.nextCallback.cancel();
|
8928 | this.nextCallback = null;
|
8929 | }
|
8930 | };
|
8931 |
|
8932 | _proto.safeSetState = function safeSetState(nextState, callback) {
|
8933 |
|
8934 |
|
8935 |
|
8936 | callback = this.setNextCallback(callback);
|
8937 | this.setState(nextState, callback);
|
8938 | };
|
8939 |
|
8940 | _proto.setNextCallback = function setNextCallback(callback) {
|
8941 | var _this4 = this;
|
8942 |
|
8943 | var active = true;
|
8944 |
|
8945 | this.nextCallback = function (event) {
|
8946 | if (active) {
|
8947 | active = false;
|
8948 | _this4.nextCallback = null;
|
8949 | callback(event);
|
8950 | }
|
8951 | };
|
8952 |
|
8953 | this.nextCallback.cancel = function () {
|
8954 | active = false;
|
8955 | };
|
8956 |
|
8957 | return this.nextCallback;
|
8958 | };
|
8959 |
|
8960 | _proto.onTransitionEnd = function onTransitionEnd(node, timeout, handler) {
|
8961 | this.setNextCallback(handler);
|
8962 | var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener;
|
8963 |
|
8964 | if (!node || doesNotHaveTimeoutOrListener) {
|
8965 | setTimeout(this.nextCallback, 0);
|
8966 | return;
|
8967 | }
|
8968 |
|
8969 | if (this.props.addEndListener) {
|
8970 | this.props.addEndListener(node, this.nextCallback);
|
8971 | }
|
8972 |
|
8973 | if (timeout != null) {
|
8974 | setTimeout(this.nextCallback, timeout);
|
8975 | }
|
8976 | };
|
8977 |
|
8978 | _proto.render = function render() {
|
8979 | var status = this.state.status;
|
8980 |
|
8981 | if (status === UNMOUNTED) {
|
8982 | return null;
|
8983 | }
|
8984 |
|
8985 | var _this$props = this.props,
|
8986 | children = _this$props.children,
|
8987 | childProps = _objectWithoutPropertiesLoose(_this$props, ["children"]);
|
8988 |
|
8989 |
|
8990 | delete childProps.in;
|
8991 | delete childProps.mountOnEnter;
|
8992 | delete childProps.unmountOnExit;
|
8993 | delete childProps.appear;
|
8994 | delete childProps.enter;
|
8995 | delete childProps.exit;
|
8996 | delete childProps.timeout;
|
8997 | delete childProps.addEndListener;
|
8998 | delete childProps.onEnter;
|
8999 | delete childProps.onEntering;
|
9000 | delete childProps.onEntered;
|
9001 | delete childProps.onExit;
|
9002 | delete childProps.onExiting;
|
9003 | delete childProps.onExited;
|
9004 |
|
9005 | if (typeof children === 'function') {
|
9006 | return children(status, childProps);
|
9007 | }
|
9008 |
|
9009 | var child = _react.default.Children.only(children);
|
9010 |
|
9011 | return _react.default.cloneElement(child, childProps);
|
9012 | };
|
9013 |
|
9014 | return Transition;
|
9015 | }(_react.default.Component);
|
9016 |
|
9017 | Transition.contextTypes = {
|
9018 | transitionGroup: PropTypes.object
|
9019 | };
|
9020 | Transition.childContextTypes = {
|
9021 | transitionGroup: function transitionGroup() {}
|
9022 | };
|
9023 | Transition.propTypes = process.env.NODE_ENV !== "production" ? {
|
9024 | |
9025 |
|
9026 |
|
9027 |
|
9028 |
|
9029 |
|
9030 |
|
9031 |
|
9032 |
|
9033 |
|
9034 |
|
9035 |
|
9036 |
|
9037 |
|
9038 | children: PropTypes.oneOfType([PropTypes.func.isRequired, PropTypes.element.isRequired]).isRequired,
|
9039 |
|
9040 | |
9041 |
|
9042 |
|
9043 | in: PropTypes.bool,
|
9044 |
|
9045 | |
9046 |
|
9047 |
|
9048 |
|
9049 |
|
9050 |
|
9051 | mountOnEnter: PropTypes.bool,
|
9052 |
|
9053 | |
9054 |
|
9055 |
|
9056 |
|
9057 | unmountOnExit: PropTypes.bool,
|
9058 |
|
9059 | |
9060 |
|
9061 |
|
9062 |
|
9063 |
|
9064 |
|
9065 |
|
9066 | appear: PropTypes.bool,
|
9067 |
|
9068 | |
9069 |
|
9070 |
|
9071 | enter: PropTypes.bool,
|
9072 |
|
9073 | |
9074 |
|
9075 |
|
9076 | exit: PropTypes.bool,
|
9077 |
|
9078 | |
9079 |
|
9080 |
|
9081 |
|
9082 |
|
9083 |
|
9084 |
|
9085 |
|
9086 |
|
9087 |
|
9088 |
|
9089 |
|
9090 |
|
9091 |
|
9092 |
|
9093 |
|
9094 |
|
9095 |
|
9096 |
|
9097 |
|
9098 |
|
9099 |
|
9100 |
|
9101 |
|
9102 |
|
9103 |
|
9104 | timeout: function timeout(props) {
|
9105 | var pt = process.env.NODE_ENV !== "production" ? _PropTypes.timeoutsShape : {};;
|
9106 | if (!props.addEndListener) pt = pt.isRequired;
|
9107 |
|
9108 | for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
9109 | args[_key - 1] = arguments[_key];
|
9110 | }
|
9111 |
|
9112 | return pt.apply(void 0, [props].concat(args));
|
9113 | },
|
9114 |
|
9115 | |
9116 |
|
9117 |
|
9118 |
|
9119 |
|
9120 |
|
9121 |
|
9122 |
|
9123 |
|
9124 |
|
9125 |
|
9126 |
|
9127 | addEndListener: PropTypes.func,
|
9128 |
|
9129 | |
9130 |
|
9131 |
|
9132 |
|
9133 |
|
9134 |
|
9135 | onEnter: PropTypes.func,
|
9136 |
|
9137 | |
9138 |
|
9139 |
|
9140 |
|
9141 |
|
9142 |
|
9143 | onEntering: PropTypes.func,
|
9144 |
|
9145 | |
9146 |
|
9147 |
|
9148 |
|
9149 |
|
9150 |
|
9151 | onEntered: PropTypes.func,
|
9152 |
|
9153 | |
9154 |
|
9155 |
|
9156 |
|
9157 |
|
9158 | onExit: PropTypes.func,
|
9159 |
|
9160 | |
9161 |
|
9162 |
|
9163 |
|
9164 |
|
9165 | onExiting: PropTypes.func,
|
9166 |
|
9167 | |
9168 |
|
9169 |
|
9170 |
|
9171 |
|
9172 | onExited: PropTypes.func
|
9173 |
|
9174 | } : {};
|
9175 |
|
9176 | function noop() {}
|
9177 |
|
9178 | Transition.defaultProps = {
|
9179 | in: false,
|
9180 | mountOnEnter: false,
|
9181 | unmountOnExit: false,
|
9182 | appear: false,
|
9183 | enter: true,
|
9184 | exit: true,
|
9185 | onEnter: noop,
|
9186 | onEntering: noop,
|
9187 | onEntered: noop,
|
9188 | onExit: noop,
|
9189 | onExiting: noop,
|
9190 | onExited: noop
|
9191 | };
|
9192 | Transition.UNMOUNTED = 0;
|
9193 | Transition.EXITED = 1;
|
9194 | Transition.ENTERING = 2;
|
9195 | Transition.ENTERED = 3;
|
9196 | Transition.EXITING = 4;
|
9197 |
|
9198 | var _default = (0, _reactLifecyclesCompat.polyfill)(Transition);
|
9199 |
|
9200 | exports.default = _default;
|
9201 | }.call(exports, __webpack_require__(33)))
|
9202 |
|
9203 | }),
|
9204 |
|
9205 | (function(module, exports) {
|
9206 |
|
9207 | 'use strict';
|
9208 |
|
9209 | Object.defineProperty(exports, '__esModule', { value: true });
|
9210 |
|
9211 | |
9212 |
|
9213 |
|
9214 |
|
9215 |
|
9216 |
|
9217 |
|
9218 | function componentWillMount() {
|
9219 |
|
9220 | var state = this.constructor.getDerivedStateFromProps(this.props, this.state);
|
9221 | if (state !== null && state !== undefined) {
|
9222 | this.setState(state);
|
9223 | }
|
9224 | }
|
9225 |
|
9226 | function componentWillReceiveProps(nextProps) {
|
9227 |
|
9228 |
|
9229 | function updater(prevState) {
|
9230 | var state = this.constructor.getDerivedStateFromProps(nextProps, prevState);
|
9231 | return state !== null && state !== undefined ? state : null;
|
9232 | }
|
9233 |
|
9234 | this.setState(updater.bind(this));
|
9235 | }
|
9236 |
|
9237 | function componentWillUpdate(nextProps, nextState) {
|
9238 | try {
|
9239 | var prevProps = this.props;
|
9240 | var prevState = this.state;
|
9241 | this.props = nextProps;
|
9242 | this.state = nextState;
|
9243 | this.__reactInternalSnapshotFlag = true;
|
9244 | this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(
|
9245 | prevProps,
|
9246 | prevState
|
9247 | );
|
9248 | } finally {
|
9249 | this.props = prevProps;
|
9250 | this.state = prevState;
|
9251 | }
|
9252 | }
|
9253 |
|
9254 |
|
9255 |
|
9256 | componentWillMount.__suppressDeprecationWarning = true;
|
9257 | componentWillReceiveProps.__suppressDeprecationWarning = true;
|
9258 | componentWillUpdate.__suppressDeprecationWarning = true;
|
9259 |
|
9260 | function polyfill(Component) {
|
9261 | var prototype = Component.prototype;
|
9262 |
|
9263 | if (!prototype || !prototype.isReactComponent) {
|
9264 | throw new Error('Can only polyfill class components');
|
9265 | }
|
9266 |
|
9267 | if (
|
9268 | typeof Component.getDerivedStateFromProps !== 'function' &&
|
9269 | typeof prototype.getSnapshotBeforeUpdate !== 'function'
|
9270 | ) {
|
9271 | return Component;
|
9272 | }
|
9273 |
|
9274 |
|
9275 |
|
9276 |
|
9277 | var foundWillMountName = null;
|
9278 | var foundWillReceivePropsName = null;
|
9279 | var foundWillUpdateName = null;
|
9280 | if (typeof prototype.componentWillMount === 'function') {
|
9281 | foundWillMountName = 'componentWillMount';
|
9282 | } else if (typeof prototype.UNSAFE_componentWillMount === 'function') {
|
9283 | foundWillMountName = 'UNSAFE_componentWillMount';
|
9284 | }
|
9285 | if (typeof prototype.componentWillReceiveProps === 'function') {
|
9286 | foundWillReceivePropsName = 'componentWillReceiveProps';
|
9287 | } else if (typeof prototype.UNSAFE_componentWillReceiveProps === 'function') {
|
9288 | foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
|
9289 | }
|
9290 | if (typeof prototype.componentWillUpdate === 'function') {
|
9291 | foundWillUpdateName = 'componentWillUpdate';
|
9292 | } else if (typeof prototype.UNSAFE_componentWillUpdate === 'function') {
|
9293 | foundWillUpdateName = 'UNSAFE_componentWillUpdate';
|
9294 | }
|
9295 | if (
|
9296 | foundWillMountName !== null ||
|
9297 | foundWillReceivePropsName !== null ||
|
9298 | foundWillUpdateName !== null
|
9299 | ) {
|
9300 | var componentName = Component.displayName || Component.name;
|
9301 | var newApiName =
|
9302 | typeof Component.getDerivedStateFromProps === 'function'
|
9303 | ? 'getDerivedStateFromProps()'
|
9304 | : 'getSnapshotBeforeUpdate()';
|
9305 |
|
9306 | throw Error(
|
9307 | 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
|
9308 | componentName +
|
9309 | ' uses ' +
|
9310 | newApiName +
|
9311 | ' but also contains the following legacy lifecycles:' +
|
9312 | (foundWillMountName !== null ? '\n ' + foundWillMountName : '') +
|
9313 | (foundWillReceivePropsName !== null
|
9314 | ? '\n ' + foundWillReceivePropsName
|
9315 | : '') +
|
9316 | (foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : '') +
|
9317 | '\n\nThe above lifecycles should be removed. Learn more about this warning here:\n' +
|
9318 | 'https://fb.me/react-async-component-lifecycle-hooks'
|
9319 | );
|
9320 | }
|
9321 |
|
9322 |
|
9323 |
|
9324 |
|
9325 | if (typeof Component.getDerivedStateFromProps === 'function') {
|
9326 | prototype.componentWillMount = componentWillMount;
|
9327 | prototype.componentWillReceiveProps = componentWillReceiveProps;
|
9328 | }
|
9329 |
|
9330 |
|
9331 |
|
9332 |
|
9333 | if (typeof prototype.getSnapshotBeforeUpdate === 'function') {
|
9334 | if (typeof prototype.componentDidUpdate !== 'function') {
|
9335 | throw new Error(
|
9336 | 'Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype'
|
9337 | );
|
9338 | }
|
9339 |
|
9340 | prototype.componentWillUpdate = componentWillUpdate;
|
9341 |
|
9342 | var componentDidUpdate = prototype.componentDidUpdate;
|
9343 |
|
9344 | prototype.componentDidUpdate = function componentDidUpdatePolyfill(
|
9345 | prevProps,
|
9346 | prevState,
|
9347 | maybeSnapshot
|
9348 | ) {
|
9349 |
|
9350 |
|
9351 |
|
9352 |
|
9353 |
|
9354 |
|
9355 |
|
9356 |
|
9357 | var snapshot = this.__reactInternalSnapshotFlag
|
9358 | ? this.__reactInternalSnapshot
|
9359 | : maybeSnapshot;
|
9360 |
|
9361 | componentDidUpdate.call(this, prevProps, prevState, snapshot);
|
9362 | };
|
9363 | }
|
9364 |
|
9365 | return Component;
|
9366 | }
|
9367 |
|
9368 | exports.polyfill = polyfill;
|
9369 |
|
9370 |
|
9371 | }),
|
9372 |
|
9373 | (function(module, exports, __webpack_require__) {
|
9374 |
|
9375 | (function(process) {"use strict";
|
9376 |
|
9377 | exports.__esModule = true;
|
9378 | exports.classNamesShape = exports.timeoutsShape = void 0;
|
9379 |
|
9380 | var _propTypes = _interopRequireDefault(__webpack_require__(6));
|
9381 |
|
9382 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9383 |
|
9384 | var timeoutsShape = process.env.NODE_ENV !== 'production' ? _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
9385 | enter: _propTypes.default.number,
|
9386 | exit: _propTypes.default.number,
|
9387 | appear: _propTypes.default.number
|
9388 | }).isRequired]) : null;
|
9389 | exports.timeoutsShape = timeoutsShape;
|
9390 | var classNamesShape = process.env.NODE_ENV !== 'production' ? _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.shape({
|
9391 | enter: _propTypes.default.string,
|
9392 | exit: _propTypes.default.string,
|
9393 | active: _propTypes.default.string
|
9394 | }), _propTypes.default.shape({
|
9395 | enter: _propTypes.default.string,
|
9396 | enterDone: _propTypes.default.string,
|
9397 | enterActive: _propTypes.default.string,
|
9398 | exit: _propTypes.default.string,
|
9399 | exitDone: _propTypes.default.string,
|
9400 | exitActive: _propTypes.default.string
|
9401 | })]) : null;
|
9402 | exports.classNamesShape = classNamesShape;
|
9403 | }.call(exports, __webpack_require__(33)))
|
9404 |
|
9405 | }),
|
9406 |
|
9407 | (function(module, exports, __webpack_require__) {
|
9408 |
|
9409 | (function(process) {"use strict";
|
9410 |
|
9411 | exports.__esModule = true;
|
9412 | exports.default = void 0;
|
9413 |
|
9414 | var _propTypes = _interopRequireDefault(__webpack_require__(6));
|
9415 |
|
9416 | var _react = _interopRequireDefault(__webpack_require__(1));
|
9417 |
|
9418 | var _reactDom = __webpack_require__(2);
|
9419 |
|
9420 | var _TransitionGroup = _interopRequireDefault(__webpack_require__(94));
|
9421 |
|
9422 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9423 |
|
9424 | function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
9425 |
|
9426 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
9427 |
|
9428 | |
9429 |
|
9430 |
|
9431 |
|
9432 |
|
9433 |
|
9434 |
|
9435 |
|
9436 |
|
9437 |
|
9438 |
|
9439 | var ReplaceTransition =
|
9440 |
|
9441 | function (_React$Component) {
|
9442 | _inheritsLoose(ReplaceTransition, _React$Component);
|
9443 |
|
9444 | function ReplaceTransition() {
|
9445 | var _this;
|
9446 |
|
9447 | for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
|
9448 | _args[_key] = arguments[_key];
|
9449 | }
|
9450 |
|
9451 | _this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this;
|
9452 |
|
9453 | _this.handleEnter = function () {
|
9454 | for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
9455 | args[_key2] = arguments[_key2];
|
9456 | }
|
9457 |
|
9458 | return _this.handleLifecycle('onEnter', 0, args);
|
9459 | };
|
9460 |
|
9461 | _this.handleEntering = function () {
|
9462 | for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
9463 | args[_key3] = arguments[_key3];
|
9464 | }
|
9465 |
|
9466 | return _this.handleLifecycle('onEntering', 0, args);
|
9467 | };
|
9468 |
|
9469 | _this.handleEntered = function () {
|
9470 | for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
9471 | args[_key4] = arguments[_key4];
|
9472 | }
|
9473 |
|
9474 | return _this.handleLifecycle('onEntered', 0, args);
|
9475 | };
|
9476 |
|
9477 | _this.handleExit = function () {
|
9478 | for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
9479 | args[_key5] = arguments[_key5];
|
9480 | }
|
9481 |
|
9482 | return _this.handleLifecycle('onExit', 1, args);
|
9483 | };
|
9484 |
|
9485 | _this.handleExiting = function () {
|
9486 | for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
9487 | args[_key6] = arguments[_key6];
|
9488 | }
|
9489 |
|
9490 | return _this.handleLifecycle('onExiting', 1, args);
|
9491 | };
|
9492 |
|
9493 | _this.handleExited = function () {
|
9494 | for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
9495 | args[_key7] = arguments[_key7];
|
9496 | }
|
9497 |
|
9498 | return _this.handleLifecycle('onExited', 1, args);
|
9499 | };
|
9500 |
|
9501 | return _this;
|
9502 | }
|
9503 |
|
9504 | var _proto = ReplaceTransition.prototype;
|
9505 |
|
9506 | _proto.handleLifecycle = function handleLifecycle(handler, idx, originalArgs) {
|
9507 | var _child$props;
|
9508 |
|
9509 | var children = this.props.children;
|
9510 |
|
9511 | var child = _react.default.Children.toArray(children)[idx];
|
9512 |
|
9513 | if (child.props[handler]) (_child$props = child.props)[handler].apply(_child$props, originalArgs);
|
9514 | if (this.props[handler]) this.props[handler]((0, _reactDom.findDOMNode)(this));
|
9515 | };
|
9516 |
|
9517 | _proto.render = function render() {
|
9518 | var _this$props = this.props,
|
9519 | children = _this$props.children,
|
9520 | inProp = _this$props.in,
|
9521 | props = _objectWithoutPropertiesLoose(_this$props, ["children", "in"]);
|
9522 |
|
9523 | var _React$Children$toArr = _react.default.Children.toArray(children),
|
9524 | first = _React$Children$toArr[0],
|
9525 | second = _React$Children$toArr[1];
|
9526 |
|
9527 | delete props.onEnter;
|
9528 | delete props.onEntering;
|
9529 | delete props.onEntered;
|
9530 | delete props.onExit;
|
9531 | delete props.onExiting;
|
9532 | delete props.onExited;
|
9533 | return _react.default.createElement(_TransitionGroup.default, props, inProp ? _react.default.cloneElement(first, {
|
9534 | key: 'first',
|
9535 | onEnter: this.handleEnter,
|
9536 | onEntering: this.handleEntering,
|
9537 | onEntered: this.handleEntered
|
9538 | }) : _react.default.cloneElement(second, {
|
9539 | key: 'second',
|
9540 | onEnter: this.handleExit,
|
9541 | onEntering: this.handleExiting,
|
9542 | onEntered: this.handleExited
|
9543 | }));
|
9544 | };
|
9545 |
|
9546 | return ReplaceTransition;
|
9547 | }(_react.default.Component);
|
9548 |
|
9549 | ReplaceTransition.propTypes = process.env.NODE_ENV !== "production" ? {
|
9550 | in: _propTypes.default.bool.isRequired,
|
9551 | children: function children(props, propName) {
|
9552 | if (_react.default.Children.count(props[propName]) !== 2) return new Error("\"" + propName + "\" must be exactly two transition components.");
|
9553 | return null;
|
9554 | }
|
9555 | } : {};
|
9556 | var _default = ReplaceTransition;
|
9557 | exports.default = _default;
|
9558 | module.exports = exports["default"];
|
9559 | }.call(exports, __webpack_require__(33)))
|
9560 |
|
9561 | }),
|
9562 |
|
9563 | (function(module, exports, __webpack_require__) {
|
9564 |
|
9565 | (function(process) {"use strict";
|
9566 |
|
9567 | exports.__esModule = true;
|
9568 | exports.default = void 0;
|
9569 |
|
9570 | var _propTypes = _interopRequireDefault(__webpack_require__(6));
|
9571 |
|
9572 | var _react = _interopRequireDefault(__webpack_require__(1));
|
9573 |
|
9574 | var _reactLifecyclesCompat = __webpack_require__(91);
|
9575 |
|
9576 | var _ChildMapping = __webpack_require__(95);
|
9577 |
|
9578 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9579 |
|
9580 | function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
9581 |
|
9582 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
9583 |
|
9584 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
9585 |
|
9586 | function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
9587 |
|
9588 | var values = Object.values || function (obj) {
|
9589 | return Object.keys(obj).map(function (k) {
|
9590 | return obj[k];
|
9591 | });
|
9592 | };
|
9593 |
|
9594 | var defaultProps = {
|
9595 | component: 'div',
|
9596 | childFactory: function childFactory(child) {
|
9597 | return child;
|
9598 | }
|
9599 | |
9600 |
|
9601 |
|
9602 |
|
9603 |
|
9604 |
|
9605 |
|
9606 |
|
9607 |
|
9608 |
|
9609 |
|
9610 |
|
9611 |
|
9612 |
|
9613 |
|
9614 | };
|
9615 |
|
9616 | var TransitionGroup =
|
9617 |
|
9618 | function (_React$Component) {
|
9619 | _inheritsLoose(TransitionGroup, _React$Component);
|
9620 |
|
9621 | function TransitionGroup(props, context) {
|
9622 | var _this;
|
9623 |
|
9624 | _this = _React$Component.call(this, props, context) || this;
|
9625 |
|
9626 | var handleExited = _this.handleExited.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
9627 |
|
9628 |
|
9629 | _this.state = {
|
9630 | handleExited: handleExited,
|
9631 | firstRender: true
|
9632 | };
|
9633 | return _this;
|
9634 | }
|
9635 |
|
9636 | var _proto = TransitionGroup.prototype;
|
9637 |
|
9638 | _proto.getChildContext = function getChildContext() {
|
9639 | return {
|
9640 | transitionGroup: {
|
9641 | isMounting: !this.appeared
|
9642 | }
|
9643 | };
|
9644 | };
|
9645 |
|
9646 | _proto.componentDidMount = function componentDidMount() {
|
9647 | this.appeared = true;
|
9648 | this.mounted = true;
|
9649 | };
|
9650 |
|
9651 | _proto.componentWillUnmount = function componentWillUnmount() {
|
9652 | this.mounted = false;
|
9653 | };
|
9654 |
|
9655 | TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {
|
9656 | var prevChildMapping = _ref.children,
|
9657 | handleExited = _ref.handleExited,
|
9658 | firstRender = _ref.firstRender;
|
9659 | return {
|
9660 | children: firstRender ? (0, _ChildMapping.getInitialChildMapping)(nextProps, handleExited) : (0, _ChildMapping.getNextChildMapping)(nextProps, prevChildMapping, handleExited),
|
9661 | firstRender: false
|
9662 | };
|
9663 | };
|
9664 |
|
9665 | _proto.handleExited = function handleExited(child, node) {
|
9666 | var currentChildMapping = (0, _ChildMapping.getChildMapping)(this.props.children);
|
9667 | if (child.key in currentChildMapping) return;
|
9668 |
|
9669 | if (child.props.onExited) {
|
9670 | child.props.onExited(node);
|
9671 | }
|
9672 |
|
9673 | if (this.mounted) {
|
9674 | this.setState(function (state) {
|
9675 | var children = _extends({}, state.children);
|
9676 |
|
9677 | delete children[child.key];
|
9678 | return {
|
9679 | children: children
|
9680 | };
|
9681 | });
|
9682 | }
|
9683 | };
|
9684 |
|
9685 | _proto.render = function render() {
|
9686 | var _this$props = this.props,
|
9687 | Component = _this$props.component,
|
9688 | childFactory = _this$props.childFactory,
|
9689 | props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]);
|
9690 |
|
9691 | var children = values(this.state.children).map(childFactory);
|
9692 | delete props.appear;
|
9693 | delete props.enter;
|
9694 | delete props.exit;
|
9695 |
|
9696 | if (Component === null) {
|
9697 | return children;
|
9698 | }
|
9699 |
|
9700 | return _react.default.createElement(Component, props, children);
|
9701 | };
|
9702 |
|
9703 | return TransitionGroup;
|
9704 | }(_react.default.Component);
|
9705 |
|
9706 | TransitionGroup.childContextTypes = {
|
9707 | transitionGroup: _propTypes.default.object.isRequired
|
9708 | };
|
9709 | TransitionGroup.propTypes = process.env.NODE_ENV !== "production" ? {
|
9710 | |
9711 |
|
9712 |
|
9713 |
|
9714 |
|
9715 |
|
9716 |
|
9717 | component: _propTypes.default.any,
|
9718 |
|
9719 | |
9720 |
|
9721 |
|
9722 |
|
9723 |
|
9724 |
|
9725 |
|
9726 |
|
9727 |
|
9728 |
|
9729 |
|
9730 |
|
9731 |
|
9732 | children: _propTypes.default.node,
|
9733 |
|
9734 | |
9735 |
|
9736 |
|
9737 |
|
9738 |
|
9739 | appear: _propTypes.default.bool,
|
9740 |
|
9741 | |
9742 |
|
9743 |
|
9744 |
|
9745 |
|
9746 | enter: _propTypes.default.bool,
|
9747 |
|
9748 | |
9749 |
|
9750 |
|
9751 |
|
9752 |
|
9753 | exit: _propTypes.default.bool,
|
9754 |
|
9755 | |
9756 |
|
9757 |
|
9758 |
|
9759 |
|
9760 |
|
9761 |
|
9762 |
|
9763 |
|
9764 |
|
9765 | childFactory: _propTypes.default.func
|
9766 | } : {};
|
9767 | TransitionGroup.defaultProps = defaultProps;
|
9768 |
|
9769 | var _default = (0, _reactLifecyclesCompat.polyfill)(TransitionGroup);
|
9770 |
|
9771 | exports.default = _default;
|
9772 | module.exports = exports["default"];
|
9773 | }.call(exports, __webpack_require__(33)))
|
9774 |
|
9775 | }),
|
9776 |
|
9777 | (function(module, exports, __webpack_require__) {
|
9778 |
|
9779 | "use strict";
|
9780 |
|
9781 | exports.__esModule = true;
|
9782 | exports.getChildMapping = getChildMapping;
|
9783 | exports.mergeChildMappings = mergeChildMappings;
|
9784 | exports.getInitialChildMapping = getInitialChildMapping;
|
9785 | exports.getNextChildMapping = getNextChildMapping;
|
9786 |
|
9787 | var _react = __webpack_require__(1);
|
9788 |
|
9789 | |
9790 |
|
9791 |
|
9792 |
|
9793 |
|
9794 |
|
9795 | function getChildMapping(children, mapFn) {
|
9796 | var mapper = function mapper(child) {
|
9797 | return mapFn && (0, _react.isValidElement)(child) ? mapFn(child) : child;
|
9798 | };
|
9799 |
|
9800 | var result = Object.create(null);
|
9801 | if (children) _react.Children.map(children, function (c) {
|
9802 | return c;
|
9803 | }).forEach(function (child) {
|
9804 |
|
9805 | result[child.key] = mapper(child);
|
9806 | });
|
9807 | return result;
|
9808 | }
|
9809 | |
9810 |
|
9811 |
|
9812 |
|
9813 |
|
9814 |
|
9815 |
|
9816 |
|
9817 |
|
9818 |
|
9819 |
|
9820 |
|
9821 |
|
9822 |
|
9823 |
|
9824 |
|
9825 |
|
9826 |
|
9827 |
|
9828 | function mergeChildMappings(prev, next) {
|
9829 | prev = prev || {};
|
9830 | next = next || {};
|
9831 |
|
9832 | function getValueForKey(key) {
|
9833 | return key in next ? next[key] : prev[key];
|
9834 | }
|
9835 |
|
9836 |
|
9837 |
|
9838 | var nextKeysPending = Object.create(null);
|
9839 | var pendingKeys = [];
|
9840 |
|
9841 | for (var prevKey in prev) {
|
9842 | if (prevKey in next) {
|
9843 | if (pendingKeys.length) {
|
9844 | nextKeysPending[prevKey] = pendingKeys;
|
9845 | pendingKeys = [];
|
9846 | }
|
9847 | } else {
|
9848 | pendingKeys.push(prevKey);
|
9849 | }
|
9850 | }
|
9851 |
|
9852 | var i;
|
9853 | var childMapping = {};
|
9854 |
|
9855 | for (var nextKey in next) {
|
9856 | if (nextKeysPending[nextKey]) {
|
9857 | for (i = 0; i < nextKeysPending[nextKey].length; i++) {
|
9858 | var pendingNextKey = nextKeysPending[nextKey][i];
|
9859 | childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
|
9860 | }
|
9861 | }
|
9862 |
|
9863 | childMapping[nextKey] = getValueForKey(nextKey);
|
9864 | }
|
9865 |
|
9866 |
|
9867 | for (i = 0; i < pendingKeys.length; i++) {
|
9868 | childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
|
9869 | }
|
9870 |
|
9871 | return childMapping;
|
9872 | }
|
9873 |
|
9874 | function getProp(child, prop, props) {
|
9875 | return props[prop] != null ? props[prop] : child.props[prop];
|
9876 | }
|
9877 |
|
9878 | function getInitialChildMapping(props, onExited) {
|
9879 | return getChildMapping(props.children, function (child) {
|
9880 | return (0, _react.cloneElement)(child, {
|
9881 | onExited: onExited.bind(null, child),
|
9882 | in: true,
|
9883 | appear: getProp(child, 'appear', props),
|
9884 | enter: getProp(child, 'enter', props),
|
9885 | exit: getProp(child, 'exit', props)
|
9886 | });
|
9887 | });
|
9888 | }
|
9889 |
|
9890 | function getNextChildMapping(nextProps, prevChildMapping, onExited) {
|
9891 | var nextChildMapping = getChildMapping(nextProps.children);
|
9892 | var children = mergeChildMappings(prevChildMapping, nextChildMapping);
|
9893 | Object.keys(children).forEach(function (key) {
|
9894 | var child = children[key];
|
9895 | if (!(0, _react.isValidElement)(child)) return;
|
9896 | var hasPrev = key in prevChildMapping;
|
9897 | var hasNext = key in nextChildMapping;
|
9898 | var prevChild = prevChildMapping[key];
|
9899 | var isLeaving = (0, _react.isValidElement)(prevChild) && !prevChild.props.in;
|
9900 |
|
9901 | if (hasNext && (!hasPrev || isLeaving)) {
|
9902 |
|
9903 | children[key] = (0, _react.cloneElement)(child, {
|
9904 | onExited: onExited.bind(null, child),
|
9905 | in: true,
|
9906 | exit: getProp(child, 'exit', nextProps),
|
9907 | enter: getProp(child, 'enter', nextProps)
|
9908 | });
|
9909 | } else if (!hasNext && hasPrev && !isLeaving) {
|
9910 |
|
9911 |
|
9912 | children[key] = (0, _react.cloneElement)(child, {
|
9913 | in: false
|
9914 | });
|
9915 | } else if (hasNext && hasPrev && (0, _react.isValidElement)(prevChild)) {
|
9916 |
|
9917 |
|
9918 |
|
9919 | children[key] = (0, _react.cloneElement)(child, {
|
9920 | onExited: onExited.bind(null, child),
|
9921 | in: prevChild.props.in,
|
9922 | exit: getProp(child, 'exit', nextProps),
|
9923 | enter: getProp(child, 'enter', nextProps)
|
9924 | });
|
9925 | }
|
9926 | });
|
9927 | return children;
|
9928 | }
|
9929 |
|
9930 | }),
|
9931 |
|
9932 | (function(module, exports, __webpack_require__) {
|
9933 |
|
9934 | 'use strict';
|
9935 |
|
9936 | Object.defineProperty(exports, "__esModule", {
|
9937 | value: true
|
9938 | });
|
9939 |
|
9940 | var _Clipboard = __webpack_require__(97);
|
9941 |
|
9942 | var _Clipboard2 = _interopRequireDefault(_Clipboard);
|
9943 |
|
9944 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
9945 |
|
9946 | exports["default"] = _Clipboard2["default"];
|
9947 | module.exports = exports['default'];
|
9948 |
|
9949 | }),
|
9950 |
|
9951 | (function(module, exports, __webpack_require__) {
|
9952 |
|
9953 | 'use strict';
|
9954 |
|
9955 | Object.defineProperty(exports, "__esModule", {
|
9956 | value: true
|
9957 | });
|
9958 |
|
9959 | var _react = __webpack_require__(1);
|
9960 |
|
9961 | var _react2 = _interopRequireDefault(_react);
|
9962 |
|
9963 | var _clipboard = __webpack_require__(98);
|
9964 |
|
9965 | var _clipboard2 = _interopRequireDefault(_clipboard);
|
9966 |
|
9967 | var _classnames = __webpack_require__(5);
|
9968 |
|
9969 | var _classnames2 = _interopRequireDefault(_classnames);
|
9970 |
|
9971 | var _beeIcon = __webpack_require__(106);
|
9972 |
|
9973 | var _beeIcon2 = _interopRequireDefault(_beeIcon);
|
9974 |
|
9975 | var _reactDom = __webpack_require__(2);
|
9976 |
|
9977 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
9978 |
|
9979 | var _beeTooltip = __webpack_require__(108);
|
9980 |
|
9981 | var _beeTooltip2 = _interopRequireDefault(_beeTooltip);
|
9982 |
|
9983 | var _propTypes = __webpack_require__(6);
|
9984 |
|
9985 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
9986 |
|
9987 | var _tool = __webpack_require__(132);
|
9988 |
|
9989 | var _i18n = __webpack_require__(133);
|
9990 |
|
9991 | var _i18n2 = _interopRequireDefault(_i18n);
|
9992 |
|
9993 | var _beeModal = __webpack_require__(134);
|
9994 |
|
9995 | var _beeModal2 = _interopRequireDefault(_beeModal);
|
9996 |
|
9997 | var _beeFormControl = __webpack_require__(153);
|
9998 |
|
9999 | var _beeFormControl2 = _interopRequireDefault(_beeFormControl);
|
10000 |
|
10001 | var _beeButton = __webpack_require__(155);
|
10002 |
|
10003 | var _beeButton2 = _interopRequireDefault(_beeButton);
|
10004 |
|
10005 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
10006 |
|
10007 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
10008 |
|
10009 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
10010 |
|
10011 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
10012 |
|
10013 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
10014 |
|
10015 |
|
10016 |
|
10017 | var propTypes = {
|
10018 | action: _propTypes2["default"].oneOf(['copy', 'cut', null]),
|
10019 | text: _propTypes2["default"].string,
|
10020 | success: _propTypes2["default"].func,
|
10021 | error: _propTypes2["default"].func,
|
10022 | locale: _propTypes2["default"].object
|
10023 | };
|
10024 | var defaultProps = {
|
10025 | action: 'copy',
|
10026 | text: '',
|
10027 | target: '',
|
10028 | success: function success() {},
|
10029 | error: function error() {},
|
10030 | locale: {}
|
10031 | };
|
10032 |
|
10033 | var Clipboard = function (_Component) {
|
10034 | _inherits(Clipboard, _Component);
|
10035 |
|
10036 | function Clipboard(props, context) {
|
10037 | _classCallCheck(this, Clipboard);
|
10038 |
|
10039 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
10040 |
|
10041 | _this.blur = function () {
|
10042 | _this.setState({
|
10043 | currect: false,
|
10044 | ready: false
|
10045 | });
|
10046 | };
|
10047 |
|
10048 | _this.close = function () {
|
10049 | _this.setState({
|
10050 | modalShow: false
|
10051 | });
|
10052 | };
|
10053 |
|
10054 | _this.state = {
|
10055 | currect: false,
|
10056 | html: '',
|
10057 | ready: false,
|
10058 | id: 'id' + Math.round(Math.random() * 1000 + 1) + new Date().getTime(),
|
10059 | modalShow: false
|
10060 | };
|
10061 | return _this;
|
10062 | }
|
10063 |
|
10064 | Clipboard.prototype.componentWillMount = function componentWillMount() {
|
10065 | var self = this;
|
10066 | var _props = this.props,
|
10067 | success = _props.success,
|
10068 | error = _props.error;
|
10069 |
|
10070 |
|
10071 | var id = this.state.id;
|
10072 | var cb = new _clipboard2["default"]('#' + id);
|
10073 | cb.on('success', function (e) {
|
10074 | self.setState({
|
10075 | currect: true,
|
10076 | ready: true
|
10077 | });
|
10078 | e.clearSelection();
|
10079 | if (success instanceof Function) success();
|
10080 | });
|
10081 | cb.on('error', function (e) {
|
10082 | self.setState({
|
10083 | modalShow: true,
|
10084 | html: e.text
|
10085 | });
|
10086 | _reactDom2["default"].findDOMNode(self.refs.text).select();
|
10087 | if (error instanceof Function) error();
|
10088 | });
|
10089 | };
|
10090 |
|
10091 | Clipboard.prototype.render = function render() {
|
10092 | var _props2 = this.props,
|
10093 | action = _props2.action,
|
10094 | text = _props2.text,
|
10095 | target = _props2.target;
|
10096 |
|
10097 | if (text) action = 'copy';
|
10098 |
|
10099 | var locale = (0, _tool.getComponentLocale)(this.props, this.context, 'Clipboard', function () {
|
10100 | return _i18n2["default"];
|
10101 | });
|
10102 | var tootipContent = locale[action];
|
10103 | if (this.state.ready) {
|
10104 | tootipContent = locale[action + 'Ready'];
|
10105 | }
|
10106 |
|
10107 | return _react2["default"].createElement(
|
10108 | _beeTooltip2["default"],
|
10109 | {
|
10110 | positionTop: '20px',
|
10111 | overlay: tootipContent,
|
10112 | placement: 'top' },
|
10113 | _react2["default"].createElement(
|
10114 | 'span',
|
10115 | {
|
10116 | onMouseOut: this.blur,
|
10117 | className: 'u-clipboard',
|
10118 | id: this.state.id,
|
10119 | 'data-clipboard-action': action,
|
10120 | 'data-clipboard-target': target,
|
10121 | 'data-clipboard-text': text },
|
10122 | this.props.children ? this.props.children : _react2["default"].createElement(_beeIcon2["default"], {
|
10123 | className: (0, _classnames2["default"])({
|
10124 | 'uf-correct': this.state.currect,
|
10125 | 'uf-copy': !this.state.currect
|
10126 | })
|
10127 | }),
|
10128 | _react2["default"].createElement(
|
10129 | _beeModal2["default"],
|
10130 | { show: this.state.modalShow, onHide: this.close },
|
10131 | _react2["default"].createElement(
|
10132 | _beeModal2["default"].Header,
|
10133 | { closeButton: true },
|
10134 | _react2["default"].createElement(
|
10135 | _beeModal2["default"].Title,
|
10136 | null,
|
10137 | ' Ctrl+C ',
|
10138 | locale['copyToClipboard'],
|
10139 | ' '
|
10140 | )
|
10141 | ),
|
10142 | _react2["default"].createElement(
|
10143 | _beeModal2["default"].Body,
|
10144 | null,
|
10145 | _react2["default"].createElement(_beeFormControl2["default"], { ref: 'text', type: 'text', readOnly: true, value: this.state.html })
|
10146 | ),
|
10147 | _react2["default"].createElement(
|
10148 | _beeModal2["default"].Footer,
|
10149 | null,
|
10150 | _react2["default"].createElement(
|
10151 | _beeButton2["default"],
|
10152 | { onClick: this.close },
|
10153 | ' ',
|
10154 | locale['close'],
|
10155 | ' '
|
10156 | )
|
10157 | )
|
10158 | )
|
10159 | )
|
10160 | );
|
10161 | };
|
10162 |
|
10163 | return Clipboard;
|
10164 | }(_react.Component);
|
10165 |
|
10166 | ;
|
10167 | Clipboard.propTypes = propTypes;
|
10168 | Clipboard.defaultProps = defaultProps;
|
10169 | exports["default"] = Clipboard;
|
10170 | module.exports = exports['default'];
|
10171 |
|
10172 | }),
|
10173 |
|
10174 | (function(module, exports, __webpack_require__) {
|
10175 |
|
10176 | var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
|
10177 | if (true) {
|
10178 | !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, __webpack_require__(99), __webpack_require__(101), __webpack_require__(102)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
10179 | } else if (typeof exports !== "undefined") {
|
10180 | factory(module, require('./clipboard-action'), require('tiny-emitter'), require('good-listener'));
|
10181 | } else {
|
10182 | var mod = {
|
10183 | exports: {}
|
10184 | };
|
10185 | factory(mod, global.clipboardAction, global.tinyEmitter, global.goodListener);
|
10186 | global.clipboard = mod.exports;
|
10187 | }
|
10188 | })(this, function (module, _clipboardAction, _tinyEmitter, _goodListener) {
|
10189 | 'use strict';
|
10190 |
|
10191 | var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
|
10192 |
|
10193 | var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
|
10194 |
|
10195 | var _goodListener2 = _interopRequireDefault(_goodListener);
|
10196 |
|
10197 | function _interopRequireDefault(obj) {
|
10198 | return obj && obj.__esModule ? obj : {
|
10199 | default: obj
|
10200 | };
|
10201 | }
|
10202 |
|
10203 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
10204 | return typeof obj;
|
10205 | } : function (obj) {
|
10206 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
10207 | };
|
10208 |
|
10209 | function _classCallCheck(instance, Constructor) {
|
10210 | if (!(instance instanceof Constructor)) {
|
10211 | throw new TypeError("Cannot call a class as a function");
|
10212 | }
|
10213 | }
|
10214 |
|
10215 | var _createClass = function () {
|
10216 | function defineProperties(target, props) {
|
10217 | for (var i = 0; i < props.length; i++) {
|
10218 | var descriptor = props[i];
|
10219 | descriptor.enumerable = descriptor.enumerable || false;
|
10220 | descriptor.configurable = true;
|
10221 | if ("value" in descriptor) descriptor.writable = true;
|
10222 | Object.defineProperty(target, descriptor.key, descriptor);
|
10223 | }
|
10224 | }
|
10225 |
|
10226 | return function (Constructor, protoProps, staticProps) {
|
10227 | if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
10228 | if (staticProps) defineProperties(Constructor, staticProps);
|
10229 | return Constructor;
|
10230 | };
|
10231 | }();
|
10232 |
|
10233 | function _possibleConstructorReturn(self, call) {
|
10234 | if (!self) {
|
10235 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
10236 | }
|
10237 |
|
10238 | return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
10239 | }
|
10240 |
|
10241 | function _inherits(subClass, superClass) {
|
10242 | if (typeof superClass !== "function" && superClass !== null) {
|
10243 | throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
10244 | }
|
10245 |
|
10246 | subClass.prototype = Object.create(superClass && superClass.prototype, {
|
10247 | constructor: {
|
10248 | value: subClass,
|
10249 | enumerable: false,
|
10250 | writable: true,
|
10251 | configurable: true
|
10252 | }
|
10253 | });
|
10254 | if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
10255 | }
|
10256 |
|
10257 | var Clipboard = function (_Emitter) {
|
10258 | _inherits(Clipboard, _Emitter);
|
10259 |
|
10260 | |
10261 |
|
10262 |
|
10263 |
|
10264 | function Clipboard(trigger, options) {
|
10265 | _classCallCheck(this, Clipboard);
|
10266 |
|
10267 | var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
|
10268 |
|
10269 | _this.resolveOptions(options);
|
10270 | _this.listenClick(trigger);
|
10271 | return _this;
|
10272 | }
|
10273 |
|
10274 | |
10275 |
|
10276 |
|
10277 |
|
10278 |
|
10279 |
|
10280 |
|
10281 | _createClass(Clipboard, [{
|
10282 | key: 'resolveOptions',
|
10283 | value: function resolveOptions() {
|
10284 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
10285 |
|
10286 | this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
|
10287 | this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
|
10288 | this.text = typeof options.text === 'function' ? options.text : this.defaultText;
|
10289 | this.container = _typeof(options.container) === 'object' ? options.container : document.body;
|
10290 | }
|
10291 | }, {
|
10292 | key: 'listenClick',
|
10293 | value: function listenClick(trigger) {
|
10294 | var _this2 = this;
|
10295 |
|
10296 | this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
|
10297 | return _this2.onClick(e);
|
10298 | });
|
10299 | }
|
10300 | }, {
|
10301 | key: 'onClick',
|
10302 | value: function onClick(e) {
|
10303 | var trigger = e.delegateTarget || e.currentTarget;
|
10304 |
|
10305 | if (this.clipboardAction) {
|
10306 | this.clipboardAction = null;
|
10307 | }
|
10308 |
|
10309 | this.clipboardAction = new _clipboardAction2.default({
|
10310 | action: this.action(trigger),
|
10311 | target: this.target(trigger),
|
10312 | text: this.text(trigger),
|
10313 | container: this.container,
|
10314 | trigger: trigger,
|
10315 | emitter: this
|
10316 | });
|
10317 | }
|
10318 | }, {
|
10319 | key: 'defaultAction',
|
10320 | value: function defaultAction(trigger) {
|
10321 | return getAttributeValue('action', trigger);
|
10322 | }
|
10323 | }, {
|
10324 | key: 'defaultTarget',
|
10325 | value: function defaultTarget(trigger) {
|
10326 | var selector = getAttributeValue('target', trigger);
|
10327 |
|
10328 | if (selector) {
|
10329 | return document.querySelector(selector);
|
10330 | }
|
10331 | }
|
10332 | }, {
|
10333 | key: 'defaultText',
|
10334 | value: function defaultText(trigger) {
|
10335 | return getAttributeValue('text', trigger);
|
10336 | }
|
10337 | }, {
|
10338 | key: 'destroy',
|
10339 | value: function destroy() {
|
10340 | this.listener.destroy();
|
10341 |
|
10342 | if (this.clipboardAction) {
|
10343 | this.clipboardAction.destroy();
|
10344 | this.clipboardAction = null;
|
10345 | }
|
10346 | }
|
10347 | }], [{
|
10348 | key: 'isSupported',
|
10349 | value: function isSupported() {
|
10350 | var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
|
10351 |
|
10352 | var actions = typeof action === 'string' ? [action] : action;
|
10353 | var support = !!document.queryCommandSupported;
|
10354 |
|
10355 | actions.forEach(function (action) {
|
10356 | support = support && !!document.queryCommandSupported(action);
|
10357 | });
|
10358 |
|
10359 | return support;
|
10360 | }
|
10361 | }]);
|
10362 |
|
10363 | return Clipboard;
|
10364 | }(_tinyEmitter2.default);
|
10365 |
|
10366 | |
10367 |
|
10368 |
|
10369 |
|
10370 |
|
10371 | function getAttributeValue(suffix, element) {
|
10372 | var attribute = 'data-clipboard-' + suffix;
|
10373 |
|
10374 | if (!element.hasAttribute(attribute)) {
|
10375 | return;
|
10376 | }
|
10377 |
|
10378 | return element.getAttribute(attribute);
|
10379 | }
|
10380 |
|
10381 | module.exports = Clipboard;
|
10382 | });
|
10383 |
|
10384 | }),
|
10385 |
|
10386 | (function(module, exports, __webpack_require__) {
|
10387 |
|
10388 | var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
|
10389 | if (true) {
|
10390 | !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, __webpack_require__(100)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
10391 | } else if (typeof exports !== "undefined") {
|
10392 | factory(module, require('select'));
|
10393 | } else {
|
10394 | var mod = {
|
10395 | exports: {}
|
10396 | };
|
10397 | factory(mod, global.select);
|
10398 | global.clipboardAction = mod.exports;
|
10399 | }
|
10400 | })(this, function (module, _select) {
|
10401 | 'use strict';
|
10402 |
|
10403 | var _select2 = _interopRequireDefault(_select);
|
10404 |
|
10405 | function _interopRequireDefault(obj) {
|
10406 | return obj && obj.__esModule ? obj : {
|
10407 | default: obj
|
10408 | };
|
10409 | }
|
10410 |
|
10411 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
10412 | return typeof obj;
|
10413 | } : function (obj) {
|
10414 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
10415 | };
|
10416 |
|
10417 | function _classCallCheck(instance, Constructor) {
|
10418 | if (!(instance instanceof Constructor)) {
|
10419 | throw new TypeError("Cannot call a class as a function");
|
10420 | }
|
10421 | }
|
10422 |
|
10423 | var _createClass = function () {
|
10424 | function defineProperties(target, props) {
|
10425 | for (var i = 0; i < props.length; i++) {
|
10426 | var descriptor = props[i];
|
10427 | descriptor.enumerable = descriptor.enumerable || false;
|
10428 | descriptor.configurable = true;
|
10429 | if ("value" in descriptor) descriptor.writable = true;
|
10430 | Object.defineProperty(target, descriptor.key, descriptor);
|
10431 | }
|
10432 | }
|
10433 |
|
10434 | return function (Constructor, protoProps, staticProps) {
|
10435 | if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
10436 | if (staticProps) defineProperties(Constructor, staticProps);
|
10437 | return Constructor;
|
10438 | };
|
10439 | }();
|
10440 |
|
10441 | var ClipboardAction = function () {
|
10442 | |
10443 |
|
10444 |
|
10445 | function ClipboardAction(options) {
|
10446 | _classCallCheck(this, ClipboardAction);
|
10447 |
|
10448 | this.resolveOptions(options);
|
10449 | this.initSelection();
|
10450 | }
|
10451 |
|
10452 | |
10453 |
|
10454 |
|
10455 |
|
10456 |
|
10457 |
|
10458 | _createClass(ClipboardAction, [{
|
10459 | key: 'resolveOptions',
|
10460 | value: function resolveOptions() {
|
10461 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
10462 |
|
10463 | this.action = options.action;
|
10464 | this.container = options.container;
|
10465 | this.emitter = options.emitter;
|
10466 | this.target = options.target;
|
10467 | this.text = options.text;
|
10468 | this.trigger = options.trigger;
|
10469 |
|
10470 | this.selectedText = '';
|
10471 | }
|
10472 | }, {
|
10473 | key: 'initSelection',
|
10474 | value: function initSelection() {
|
10475 | if (this.text) {
|
10476 | this.selectFake();
|
10477 | } else if (this.target) {
|
10478 | this.selectTarget();
|
10479 | }
|
10480 | }
|
10481 | }, {
|
10482 | key: 'selectFake',
|
10483 | value: function selectFake() {
|
10484 | var _this = this;
|
10485 |
|
10486 | var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
|
10487 |
|
10488 | this.removeFake();
|
10489 |
|
10490 | this.fakeHandlerCallback = function () {
|
10491 | return _this.removeFake();
|
10492 | };
|
10493 | this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
|
10494 |
|
10495 | this.fakeElem = document.createElement('textarea');
|
10496 |
|
10497 | this.fakeElem.style.fontSize = '12pt';
|
10498 |
|
10499 | this.fakeElem.style.border = '0';
|
10500 | this.fakeElem.style.padding = '0';
|
10501 | this.fakeElem.style.margin = '0';
|
10502 |
|
10503 | this.fakeElem.style.position = 'absolute';
|
10504 | this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
|
10505 |
|
10506 | var yPosition = window.pageYOffset || document.documentElement.scrollTop;
|
10507 | this.fakeElem.style.top = yPosition + 'px';
|
10508 |
|
10509 | this.fakeElem.setAttribute('readonly', '');
|
10510 | this.fakeElem.value = this.text;
|
10511 |
|
10512 | this.container.appendChild(this.fakeElem);
|
10513 |
|
10514 | this.selectedText = (0, _select2.default)(this.fakeElem);
|
10515 | this.copyText();
|
10516 | }
|
10517 | }, {
|
10518 | key: 'removeFake',
|
10519 | value: function removeFake() {
|
10520 | if (this.fakeHandler) {
|
10521 | this.container.removeEventListener('click', this.fakeHandlerCallback);
|
10522 | this.fakeHandler = null;
|
10523 | this.fakeHandlerCallback = null;
|
10524 | }
|
10525 |
|
10526 | if (this.fakeElem) {
|
10527 | this.container.removeChild(this.fakeElem);
|
10528 | this.fakeElem = null;
|
10529 | }
|
10530 | }
|
10531 | }, {
|
10532 | key: 'selectTarget',
|
10533 | value: function selectTarget() {
|
10534 | this.selectedText = (0, _select2.default)(this.target);
|
10535 | this.copyText();
|
10536 | }
|
10537 | }, {
|
10538 | key: 'copyText',
|
10539 | value: function copyText() {
|
10540 | var succeeded = void 0;
|
10541 |
|
10542 | try {
|
10543 | succeeded = document.execCommand(this.action);
|
10544 | } catch (err) {
|
10545 | succeeded = false;
|
10546 | }
|
10547 |
|
10548 | this.handleResult(succeeded);
|
10549 | }
|
10550 | }, {
|
10551 | key: 'handleResult',
|
10552 | value: function handleResult(succeeded) {
|
10553 | this.emitter.emit(succeeded ? 'success' : 'error', {
|
10554 | action: this.action,
|
10555 | text: this.selectedText,
|
10556 | trigger: this.trigger,
|
10557 | clearSelection: this.clearSelection.bind(this)
|
10558 | });
|
10559 | }
|
10560 | }, {
|
10561 | key: 'clearSelection',
|
10562 | value: function clearSelection() {
|
10563 | if (this.trigger) {
|
10564 | this.trigger.focus();
|
10565 | }
|
10566 |
|
10567 | window.getSelection().removeAllRanges();
|
10568 | }
|
10569 | }, {
|
10570 | key: 'destroy',
|
10571 | value: function destroy() {
|
10572 | this.removeFake();
|
10573 | }
|
10574 | }, {
|
10575 | key: 'action',
|
10576 | set: function set() {
|
10577 | var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
|
10578 |
|
10579 | this._action = action;
|
10580 |
|
10581 | if (this._action !== 'copy' && this._action !== 'cut') {
|
10582 | throw new Error('Invalid "action" value, use either "copy" or "cut"');
|
10583 | }
|
10584 | },
|
10585 | get: function get() {
|
10586 | return this._action;
|
10587 | }
|
10588 | }, {
|
10589 | key: 'target',
|
10590 | set: function set(target) {
|
10591 | if (target !== undefined) {
|
10592 | if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
|
10593 | if (this.action === 'copy' && target.hasAttribute('disabled')) {
|
10594 | throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
|
10595 | }
|
10596 |
|
10597 | if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
|
10598 | throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
|
10599 | }
|
10600 |
|
10601 | this._target = target;
|
10602 | } else {
|
10603 | throw new Error('Invalid "target" value, use a valid Element');
|
10604 | }
|
10605 | }
|
10606 | },
|
10607 | get: function get() {
|
10608 | return this._target;
|
10609 | }
|
10610 | }]);
|
10611 |
|
10612 | return ClipboardAction;
|
10613 | }();
|
10614 |
|
10615 | module.exports = ClipboardAction;
|
10616 | });
|
10617 |
|
10618 | }),
|
10619 |
|
10620 | (function(module, exports) {
|
10621 |
|
10622 | function select(element) {
|
10623 | var selectedText;
|
10624 |
|
10625 | if (element.nodeName === 'SELECT') {
|
10626 | element.focus();
|
10627 |
|
10628 | selectedText = element.value;
|
10629 | }
|
10630 | else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
|
10631 | var isReadOnly = element.hasAttribute('readonly');
|
10632 |
|
10633 | if (!isReadOnly) {
|
10634 | element.setAttribute('readonly', '');
|
10635 | }
|
10636 |
|
10637 | element.select();
|
10638 | element.setSelectionRange(0, element.value.length);
|
10639 |
|
10640 | if (!isReadOnly) {
|
10641 | element.removeAttribute('readonly');
|
10642 | }
|
10643 |
|
10644 | selectedText = element.value;
|
10645 | }
|
10646 | else {
|
10647 | if (element.hasAttribute('contenteditable')) {
|
10648 | element.focus();
|
10649 | }
|
10650 |
|
10651 | var selection = window.getSelection();
|
10652 | var range = document.createRange();
|
10653 |
|
10654 | range.selectNodeContents(element);
|
10655 | selection.removeAllRanges();
|
10656 | selection.addRange(range);
|
10657 |
|
10658 | selectedText = selection.toString();
|
10659 | }
|
10660 |
|
10661 | return selectedText;
|
10662 | }
|
10663 |
|
10664 | module.exports = select;
|
10665 |
|
10666 |
|
10667 | }),
|
10668 |
|
10669 | (function(module, exports) {
|
10670 |
|
10671 | function E () {
|
10672 |
|
10673 |
|
10674 | }
|
10675 |
|
10676 | E.prototype = {
|
10677 | on: function (name, callback, ctx) {
|
10678 | var e = this.e || (this.e = {});
|
10679 |
|
10680 | (e[name] || (e[name] = [])).push({
|
10681 | fn: callback,
|
10682 | ctx: ctx
|
10683 | });
|
10684 |
|
10685 | return this;
|
10686 | },
|
10687 |
|
10688 | once: function (name, callback, ctx) {
|
10689 | var self = this;
|
10690 | function listener () {
|
10691 | self.off(name, listener);
|
10692 | callback.apply(ctx, arguments);
|
10693 | };
|
10694 |
|
10695 | listener._ = callback
|
10696 | return this.on(name, listener, ctx);
|
10697 | },
|
10698 |
|
10699 | emit: function (name) {
|
10700 | var data = [].slice.call(arguments, 1);
|
10701 | var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
|
10702 | var i = 0;
|
10703 | var len = evtArr.length;
|
10704 |
|
10705 | for (i; i < len; i++) {
|
10706 | evtArr[i].fn.apply(evtArr[i].ctx, data);
|
10707 | }
|
10708 |
|
10709 | return this;
|
10710 | },
|
10711 |
|
10712 | off: function (name, callback) {
|
10713 | var e = this.e || (this.e = {});
|
10714 | var evts = e[name];
|
10715 | var liveEvents = [];
|
10716 |
|
10717 | if (evts && callback) {
|
10718 | for (var i = 0, len = evts.length; i < len; i++) {
|
10719 | if (evts[i].fn !== callback && evts[i].fn._ !== callback)
|
10720 | liveEvents.push(evts[i]);
|
10721 | }
|
10722 | }
|
10723 |
|
10724 |
|
10725 |
|
10726 |
|
10727 |
|
10728 | (liveEvents.length)
|
10729 | ? e[name] = liveEvents
|
10730 | : delete e[name];
|
10731 |
|
10732 | return this;
|
10733 | }
|
10734 | };
|
10735 |
|
10736 | module.exports = E;
|
10737 | module.exports.TinyEmitter = E;
|
10738 |
|
10739 |
|
10740 | }),
|
10741 |
|
10742 | (function(module, exports, __webpack_require__) {
|
10743 |
|
10744 | var is = __webpack_require__(103);
|
10745 | var delegate = __webpack_require__(104);
|
10746 |
|
10747 | |
10748 |
|
10749 |
|
10750 |
|
10751 |
|
10752 |
|
10753 |
|
10754 |
|
10755 |
|
10756 | function listen(target, type, callback) {
|
10757 | if (!target && !type && !callback) {
|
10758 | throw new Error('Missing required arguments');
|
10759 | }
|
10760 |
|
10761 | if (!is.string(type)) {
|
10762 | throw new TypeError('Second argument must be a String');
|
10763 | }
|
10764 |
|
10765 | if (!is.fn(callback)) {
|
10766 | throw new TypeError('Third argument must be a Function');
|
10767 | }
|
10768 |
|
10769 | if (is.node(target)) {
|
10770 | return listenNode(target, type, callback);
|
10771 | }
|
10772 | else if (is.nodeList(target)) {
|
10773 | return listenNodeList(target, type, callback);
|
10774 | }
|
10775 | else if (is.string(target)) {
|
10776 | return listenSelector(target, type, callback);
|
10777 | }
|
10778 | else {
|
10779 | throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
|
10780 | }
|
10781 | }
|
10782 |
|
10783 | |
10784 |
|
10785 |
|
10786 |
|
10787 |
|
10788 |
|
10789 |
|
10790 |
|
10791 |
|
10792 | function listenNode(node, type, callback) {
|
10793 | node.addEventListener(type, callback);
|
10794 |
|
10795 | return {
|
10796 | destroy: function() {
|
10797 | node.removeEventListener(type, callback);
|
10798 | }
|
10799 | }
|
10800 | }
|
10801 |
|
10802 | |
10803 |
|
10804 |
|
10805 |
|
10806 |
|
10807 |
|
10808 |
|
10809 |
|
10810 |
|
10811 | function listenNodeList(nodeList, type, callback) {
|
10812 | Array.prototype.forEach.call(nodeList, function(node) {
|
10813 | node.addEventListener(type, callback);
|
10814 | });
|
10815 |
|
10816 | return {
|
10817 | destroy: function() {
|
10818 | Array.prototype.forEach.call(nodeList, function(node) {
|
10819 | node.removeEventListener(type, callback);
|
10820 | });
|
10821 | }
|
10822 | }
|
10823 | }
|
10824 |
|
10825 | |
10826 |
|
10827 |
|
10828 |
|
10829 |
|
10830 |
|
10831 |
|
10832 |
|
10833 |
|
10834 | function listenSelector(selector, type, callback) {
|
10835 | return delegate(document.body, selector, type, callback);
|
10836 | }
|
10837 |
|
10838 | module.exports = listen;
|
10839 |
|
10840 |
|
10841 | }),
|
10842 |
|
10843 | (function(module, exports) {
|
10844 |
|
10845 | |
10846 |
|
10847 |
|
10848 |
|
10849 |
|
10850 |
|
10851 | exports.node = function(value) {
|
10852 | return value !== undefined
|
10853 | && value instanceof HTMLElement
|
10854 | && value.nodeType === 1;
|
10855 | };
|
10856 |
|
10857 | |
10858 |
|
10859 |
|
10860 |
|
10861 |
|
10862 |
|
10863 | exports.nodeList = function(value) {
|
10864 | var type = Object.prototype.toString.call(value);
|
10865 |
|
10866 | return value !== undefined
|
10867 | && (type === '[object NodeList]' || type === '[object HTMLCollection]')
|
10868 | && ('length' in value)
|
10869 | && (value.length === 0 || exports.node(value[0]));
|
10870 | };
|
10871 |
|
10872 | |
10873 |
|
10874 |
|
10875 |
|
10876 |
|
10877 |
|
10878 | exports.string = function(value) {
|
10879 | return typeof value === 'string'
|
10880 | || value instanceof String;
|
10881 | };
|
10882 |
|
10883 | |
10884 |
|
10885 |
|
10886 |
|
10887 |
|
10888 |
|
10889 | exports.fn = function(value) {
|
10890 | var type = Object.prototype.toString.call(value);
|
10891 |
|
10892 | return type === '[object Function]';
|
10893 | };
|
10894 |
|
10895 |
|
10896 | }),
|
10897 |
|
10898 | (function(module, exports, __webpack_require__) {
|
10899 |
|
10900 | var closest = __webpack_require__(105);
|
10901 |
|
10902 | |
10903 |
|
10904 |
|
10905 |
|
10906 |
|
10907 |
|
10908 |
|
10909 |
|
10910 |
|
10911 |
|
10912 | function _delegate(element, selector, type, callback, useCapture) {
|
10913 | var listenerFn = listener.apply(this, arguments);
|
10914 |
|
10915 | element.addEventListener(type, listenerFn, useCapture);
|
10916 |
|
10917 | return {
|
10918 | destroy: function() {
|
10919 | element.removeEventListener(type, listenerFn, useCapture);
|
10920 | }
|
10921 | }
|
10922 | }
|
10923 |
|
10924 | |
10925 |
|
10926 |
|
10927 |
|
10928 |
|
10929 |
|
10930 |
|
10931 |
|
10932 |
|
10933 |
|
10934 | function delegate(elements, selector, type, callback, useCapture) {
|
10935 |
|
10936 | if (typeof elements.addEventListener === 'function') {
|
10937 | return _delegate.apply(null, arguments);
|
10938 | }
|
10939 |
|
10940 |
|
10941 | if (typeof type === 'function') {
|
10942 |
|
10943 |
|
10944 | return _delegate.bind(null, document).apply(null, arguments);
|
10945 | }
|
10946 |
|
10947 |
|
10948 | if (typeof elements === 'string') {
|
10949 | elements = document.querySelectorAll(elements);
|
10950 | }
|
10951 |
|
10952 |
|
10953 | return Array.prototype.map.call(elements, function (element) {
|
10954 | return _delegate(element, selector, type, callback, useCapture);
|
10955 | });
|
10956 | }
|
10957 |
|
10958 | |
10959 |
|
10960 |
|
10961 |
|
10962 |
|
10963 |
|
10964 |
|
10965 |
|
10966 |
|
10967 | function listener(element, selector, type, callback) {
|
10968 | return function(e) {
|
10969 | e.delegateTarget = closest(e.target, selector);
|
10970 |
|
10971 | if (e.delegateTarget) {
|
10972 | callback.call(element, e);
|
10973 | }
|
10974 | }
|
10975 | }
|
10976 |
|
10977 | module.exports = delegate;
|
10978 |
|
10979 |
|
10980 | }),
|
10981 |
|
10982 | (function(module, exports) {
|
10983 |
|
10984 | var DOCUMENT_NODE_TYPE = 9;
|
10985 |
|
10986 | |
10987 |
|
10988 |
|
10989 | if (typeof Element !== 'undefined' && !Element.prototype.matches) {
|
10990 | var proto = Element.prototype;
|
10991 |
|
10992 | proto.matches = proto.matchesSelector ||
|
10993 | proto.mozMatchesSelector ||
|
10994 | proto.msMatchesSelector ||
|
10995 | proto.oMatchesSelector ||
|
10996 | proto.webkitMatchesSelector;
|
10997 | }
|
10998 |
|
10999 | |
11000 |
|
11001 |
|
11002 |
|
11003 |
|
11004 |
|
11005 |
|
11006 | function closest (element, selector) {
|
11007 | while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
|
11008 | if (typeof element.matches === 'function' &&
|
11009 | element.matches(selector)) {
|
11010 | return element;
|
11011 | }
|
11012 | element = element.parentNode;
|
11013 | }
|
11014 | }
|
11015 |
|
11016 | module.exports = closest;
|
11017 |
|
11018 |
|
11019 | }),
|
11020 |
|
11021 | (function(module, exports, __webpack_require__) {
|
11022 |
|
11023 | 'use strict';
|
11024 |
|
11025 | Object.defineProperty(exports, "__esModule", {
|
11026 | value: true
|
11027 | });
|
11028 |
|
11029 | var _Icon = __webpack_require__(107);
|
11030 |
|
11031 | var _Icon2 = _interopRequireDefault(_Icon);
|
11032 |
|
11033 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
11034 |
|
11035 | exports["default"] = _Icon2["default"];
|
11036 | module.exports = exports['default'];
|
11037 |
|
11038 | }),
|
11039 |
|
11040 | (function(module, exports, __webpack_require__) {
|
11041 |
|
11042 | 'use strict';
|
11043 |
|
11044 | Object.defineProperty(exports, "__esModule", {
|
11045 | value: true
|
11046 | });
|
11047 |
|
11048 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
11049 |
|
11050 | var _react = __webpack_require__(1);
|
11051 |
|
11052 | var _react2 = _interopRequireDefault(_react);
|
11053 |
|
11054 | var _classnames = __webpack_require__(5);
|
11055 |
|
11056 | var _classnames2 = _interopRequireDefault(_classnames);
|
11057 |
|
11058 | var _propTypes = __webpack_require__(6);
|
11059 |
|
11060 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
11061 |
|
11062 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
11063 |
|
11064 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
11065 |
|
11066 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
11067 |
|
11068 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
11069 |
|
11070 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
11071 |
|
11072 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
11073 |
|
11074 | var propTypes = {
|
11075 | type: _propTypes2["default"].string
|
11076 |
|
11077 | };
|
11078 | |
11079 |
|
11080 |
|
11081 | var defaultProps = {
|
11082 | clsPrefix: 'uf'
|
11083 | };
|
11084 |
|
11085 | var Icon = function (_Component) {
|
11086 | _inherits(Icon, _Component);
|
11087 |
|
11088 | function Icon(props) {
|
11089 | _classCallCheck(this, Icon);
|
11090 |
|
11091 | return _possibleConstructorReturn(this, _Component.call(this, props));
|
11092 | }
|
11093 |
|
11094 | Icon.prototype.render = function render() {
|
11095 | var _props = this.props,
|
11096 | type = _props.type,
|
11097 | className = _props.className,
|
11098 | clsPrefix = _props.clsPrefix,
|
11099 | others = _objectWithoutProperties(_props, ['type', 'className', 'clsPrefix']);
|
11100 |
|
11101 | var clsObj = {};
|
11102 |
|
11103 | var classNames = (0, _classnames2["default"])(clsPrefix, type);
|
11104 |
|
11105 | return _react2["default"].createElement('i', _extends({}, others, { className: (0, _classnames2["default"])(classNames, className) }));
|
11106 | };
|
11107 |
|
11108 | return Icon;
|
11109 | }(_react.Component);
|
11110 |
|
11111 | Icon.defaultProps = defaultProps;
|
11112 | Icon.propTypes = propTypes;
|
11113 |
|
11114 | exports["default"] = Icon;
|
11115 | module.exports = exports['default'];
|
11116 |
|
11117 | }),
|
11118 |
|
11119 | (function(module, exports, __webpack_require__) {
|
11120 |
|
11121 | 'use strict';
|
11122 |
|
11123 | Object.defineProperty(exports, "__esModule", {
|
11124 | value: true
|
11125 | });
|
11126 |
|
11127 | var _Tooltip = __webpack_require__(109);
|
11128 |
|
11129 | var _Tooltip2 = _interopRequireDefault(_Tooltip);
|
11130 |
|
11131 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
11132 |
|
11133 | exports["default"] = _Tooltip2["default"];
|
11134 | module.exports = exports['default'];
|
11135 |
|
11136 | }),
|
11137 |
|
11138 | (function(module, exports, __webpack_require__) {
|
11139 |
|
11140 | 'use strict';
|
11141 |
|
11142 | Object.defineProperty(exports, "__esModule", {
|
11143 | value: true
|
11144 | });
|
11145 |
|
11146 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
11147 |
|
11148 | var _classnames = __webpack_require__(5);
|
11149 |
|
11150 | var _classnames2 = _interopRequireDefault(_classnames);
|
11151 |
|
11152 | var _react = __webpack_require__(1);
|
11153 |
|
11154 | var _react2 = _interopRequireDefault(_react);
|
11155 |
|
11156 | var _propTypes = __webpack_require__(6);
|
11157 |
|
11158 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
11159 |
|
11160 | var _OverlayTrigger = __webpack_require__(110);
|
11161 |
|
11162 | var _OverlayTrigger2 = _interopRequireDefault(_OverlayTrigger);
|
11163 |
|
11164 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
11165 |
|
11166 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
11167 |
|
11168 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
11169 |
|
11170 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
11171 |
|
11172 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
11173 |
|
11174 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
11175 |
|
11176 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
11177 |
|
11178 | var propTypes = {
|
11179 | |
11180 |
|
11181 |
|
11182 | id: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
|
11183 | inverse: _propTypes2["default"].bool,
|
11184 | visible: _propTypes2["default"].bool,
|
11185 | onVisibleChange: _propTypes2["default"].func,
|
11186 | |
11187 |
|
11188 |
|
11189 | placement: _propTypes2["default"].oneOf(['top', 'right', 'bottom', 'left']),
|
11190 |
|
11191 | |
11192 |
|
11193 |
|
11194 | positionTop: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string]),
|
11195 | |
11196 |
|
11197 |
|
11198 | positionLeft: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string]),
|
11199 |
|
11200 | |
11201 |
|
11202 |
|
11203 | arrowOffsetTop: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string]),
|
11204 | |
11205 |
|
11206 |
|
11207 | arrowOffsetLeft: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string])
|
11208 | };
|
11209 |
|
11210 | var defaultProps = {
|
11211 | placement: 'right',
|
11212 | clsPrefix: 'u-tooltip'
|
11213 | };
|
11214 | function OverlayNode(props) {
|
11215 | var className = props.className,
|
11216 | classNames = props.classNames,
|
11217 | style = props.style,
|
11218 | overlay = props.overlay,
|
11219 | arrowOffsetTop = props.arrowOffsetTop,
|
11220 | arrowOffsetLeft = props.arrowOffsetLeft;
|
11221 |
|
11222 | return _react2["default"].createElement(
|
11223 | 'div',
|
11224 | {
|
11225 | className: (0, _classnames2["default"])(className, classNames),
|
11226 | onMouseEnter: props.onMouseEnter,
|
11227 | onMouseLeave: props.onMouseLeave,
|
11228 | style: style
|
11229 | },
|
11230 | overlay ? _react2["default"].createElement('div', { className: 'tooltip-arrow', style: {
|
11231 | top: arrowOffsetTop,
|
11232 | left: arrowOffsetLeft
|
11233 | } }) : '',
|
11234 | overlay ? _react2["default"].createElement(
|
11235 | 'div',
|
11236 | { className: 'tooltip-inner' },
|
11237 | overlay
|
11238 | ) : ''
|
11239 | );
|
11240 | }
|
11241 |
|
11242 | var Tooltip = function (_React$Component) {
|
11243 | _inherits(Tooltip, _React$Component);
|
11244 |
|
11245 | function Tooltip(props) {
|
11246 | _classCallCheck(this, Tooltip);
|
11247 |
|
11248 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
11249 |
|
11250 | _this.onMouseEnter = function () {
|
11251 | _this.setState({
|
11252 | isHoverShow: true
|
11253 | });
|
11254 | };
|
11255 |
|
11256 | _this.onMouseLeave = function () {
|
11257 | _this.setState({
|
11258 | isHoverShow: false
|
11259 | });
|
11260 | };
|
11261 |
|
11262 | var initState = {
|
11263 | isHoverShow: false
|
11264 | };
|
11265 | if ('visible' in props) {
|
11266 | _extends(initState, {
|
11267 | visible: props.visible
|
11268 | });
|
11269 | }
|
11270 | _this.state = initState;
|
11271 | return _this;
|
11272 | }
|
11273 |
|
11274 | Tooltip.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
11275 | var _props = this.props,
|
11276 | visible = _props.visible,
|
11277 | onVisibleChange = _props.onVisibleChange;
|
11278 |
|
11279 | if ('visible' in this.props && prevProps.visible !== visible) {
|
11280 | this.setState({
|
11281 | visible: visible
|
11282 | });
|
11283 | onVisibleChange && onVisibleChange(visible);
|
11284 | }
|
11285 | };
|
11286 |
|
11287 | |
11288 |
|
11289 |
|
11290 |
|
11291 |
|
11292 | |
11293 |
|
11294 |
|
11295 |
|
11296 |
|
11297 | Tooltip.prototype.render = function render() {
|
11298 | var _classes,
|
11299 | _this2 = this;
|
11300 |
|
11301 | var _props2 = this.props,
|
11302 | placement = _props2.placement,
|
11303 | positionTop = _props2.positionTop,
|
11304 | positionLeft = _props2.positionLeft,
|
11305 | arrowOffsetTop = _props2.arrowOffsetTop,
|
11306 | arrowOffsetLeft = _props2.arrowOffsetLeft,
|
11307 | className = _props2.className,
|
11308 | style = _props2.style,
|
11309 | children = _props2.children,
|
11310 | clsPrefix = _props2.clsPrefix,
|
11311 | overlay = _props2.overlay,
|
11312 | inverse = _props2.inverse,
|
11313 | others = _objectWithoutProperties(_props2, ['placement', 'positionTop', 'positionLeft', 'arrowOffsetTop', 'arrowOffsetLeft', 'className', 'style', 'children', 'clsPrefix', 'overlay', 'inverse']);
|
11314 |
|
11315 | var classes = (_classes = {}, _defineProperty(_classes, placement, true), _defineProperty(_classes, 'inverse', inverse), _classes);
|
11316 |
|
11317 | var outerStyle = _extends({
|
11318 | top: positionTop,
|
11319 | left: positionLeft
|
11320 | }, style);
|
11321 |
|
11322 | var arrowStyle = {
|
11323 | top: arrowOffsetTop,
|
11324 | left: arrowOffsetLeft
|
11325 | };
|
11326 |
|
11327 | var classNames = (0, _classnames2["default"])(clsPrefix, classes);
|
11328 |
|
11329 | var overlayNode = _react2["default"].createElement(OverlayNode, {
|
11330 | className: className,
|
11331 | classNames: classNames,
|
11332 | overlay: overlay,
|
11333 | onMouseEnter: this.onMouseEnter,
|
11334 | onMouseLeave: this.onMouseLeave,
|
11335 | style: true,
|
11336 | arrowOffsetTop: true,
|
11337 | arrowOffsetLeft: true
|
11338 | });
|
11339 | return 'visible' in this.props ? _react2["default"].createElement(
|
11340 | _OverlayTrigger2["default"],
|
11341 | _extends({ visible: this.state.visible, ref: function ref(_ref) {
|
11342 | return _this2.trigger = _ref;
|
11343 | }, shouldUpdatePosition: true, placement: placement }, others, { overlay: overlayNode }),
|
11344 | children
|
11345 | ) : _react2["default"].createElement(
|
11346 | _OverlayTrigger2["default"],
|
11347 | _extends({ isHoverShow: this.state.isHoverShow, ref: function ref(_ref2) {
|
11348 | return _this2.trigger = _ref2;
|
11349 | }, shouldUpdatePosition: true, placement: placement }, others, { overlay: overlayNode }),
|
11350 | children
|
11351 | );
|
11352 | };
|
11353 |
|
11354 | return Tooltip;
|
11355 | }(_react2["default"].Component);
|
11356 |
|
11357 | Tooltip.propTypes = propTypes;
|
11358 | Tooltip.defaultProps = defaultProps;
|
11359 |
|
11360 | exports["default"] = Tooltip;
|
11361 | module.exports = exports['default'];
|
11362 |
|
11363 | }),
|
11364 |
|
11365 | (function(module, exports, __webpack_require__) {
|
11366 |
|
11367 | 'use strict';
|
11368 |
|
11369 | Object.defineProperty(exports, "__esModule", {
|
11370 | value: true
|
11371 | });
|
11372 |
|
11373 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
11374 |
|
11375 | var _contains = __webpack_require__(111);
|
11376 |
|
11377 | var _contains2 = _interopRequireDefault(_contains);
|
11378 |
|
11379 | var _react = __webpack_require__(1);
|
11380 |
|
11381 | var _react2 = _interopRequireDefault(_react);
|
11382 |
|
11383 | var _propTypes = __webpack_require__(6);
|
11384 |
|
11385 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
11386 |
|
11387 | var _reactDom = __webpack_require__(2);
|
11388 |
|
11389 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
11390 |
|
11391 | var _warning = __webpack_require__(32);
|
11392 |
|
11393 | var _warning2 = _interopRequireDefault(_warning);
|
11394 |
|
11395 | var _Portal = __webpack_require__(112);
|
11396 |
|
11397 | var _Portal2 = _interopRequireDefault(_Portal);
|
11398 |
|
11399 | var _Overlay = __webpack_require__(114);
|
11400 |
|
11401 | var _Overlay2 = _interopRequireDefault(_Overlay);
|
11402 |
|
11403 | var _createChainedFunction = __webpack_require__(131);
|
11404 |
|
11405 | var _createChainedFunction2 = _interopRequireDefault(_createChainedFunction);
|
11406 |
|
11407 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
11408 |
|
11409 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
11410 |
|
11411 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
11412 |
|
11413 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
11414 |
|
11415 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
11416 |
|
11417 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
11418 |
|
11419 | var isReact16 = _reactDom2["default"].createPortal !== undefined;
|
11420 | var createPortal = isReact16 ? _reactDom2["default"].createPortal : _reactDom2["default"].unstable_renderSubtreeIntoContainer;
|
11421 |
|
11422 | |
11423 |
|
11424 |
|
11425 |
|
11426 |
|
11427 |
|
11428 |
|
11429 | function isOneOf(one, of) {
|
11430 | if (Array.isArray(of)) {
|
11431 | return of.indexOf(one) >= 0;
|
11432 | }
|
11433 | return one === of;
|
11434 | }
|
11435 |
|
11436 | var triggerType = _propTypes2["default"].oneOf(['click', 'hover', 'focus']);
|
11437 |
|
11438 | var propTypes = _extends({}, _Portal2["default"].propTypes, _Overlay2["default"].propTypes, {
|
11439 |
|
11440 | |
11441 |
|
11442 |
|
11443 | trigger: _propTypes2["default"].oneOfType([triggerType, _propTypes2["default"].arrayOf(triggerType)]),
|
11444 |
|
11445 | |
11446 |
|
11447 |
|
11448 | delay: _propTypes2["default"].number,
|
11449 | |
11450 |
|
11451 |
|
11452 | delayShow: _propTypes2["default"].number,
|
11453 | |
11454 |
|
11455 |
|
11456 | delayHide: _propTypes2["default"].number,
|
11457 |
|
11458 |
|
11459 | |
11460 |
|
11461 |
|
11462 | defaultOverlayShown: _propTypes2["default"].bool,
|
11463 | visible: _propTypes2["default"].bool,
|
11464 |
|
11465 | |
11466 |
|
11467 |
|
11468 | overlay: _propTypes2["default"].node.isRequired,
|
11469 |
|
11470 | |
11471 |
|
11472 |
|
11473 | onBlur: _propTypes2["default"].func,
|
11474 | |
11475 |
|
11476 |
|
11477 | onClick: _propTypes2["default"].func,
|
11478 | |
11479 |
|
11480 |
|
11481 | onFocus: _propTypes2["default"].func,
|
11482 | |
11483 |
|
11484 |
|
11485 | onMouseOut: _propTypes2["default"].func,
|
11486 | |
11487 |
|
11488 |
|
11489 | onMouseOver: _propTypes2["default"].func,
|
11490 |
|
11491 |
|
11492 | |
11493 |
|
11494 |
|
11495 | target: _propTypes2["default"].oneOf([null]),
|
11496 | |
11497 |
|
11498 |
|
11499 | onHide: _propTypes2["default"].oneOf([null]),
|
11500 | |
11501 |
|
11502 |
|
11503 | show: _propTypes2["default"].oneOf([null])
|
11504 | });
|
11505 |
|
11506 | var defaultProps = {
|
11507 | defaultOverlayShown: false,
|
11508 | trigger: ['hover', 'focus']
|
11509 | };
|
11510 |
|
11511 | var OverlayTrigger = function (_Component) {
|
11512 | _inherits(OverlayTrigger, _Component);
|
11513 |
|
11514 | function OverlayTrigger(props, context) {
|
11515 | _classCallCheck(this, OverlayTrigger);
|
11516 |
|
11517 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
11518 |
|
11519 | _this.handleToggle = _this.handleToggle.bind(_this);
|
11520 | _this.handleDelayedShow = _this.handleDelayedShow.bind(_this);
|
11521 | _this.handleDelayedHide = _this.handleDelayedHide.bind(_this);
|
11522 | _this.handleHide = _this.handleHide.bind(_this);
|
11523 | _this.makeOverlay = _this.makeOverlay.bind(_this);
|
11524 |
|
11525 | _this.handleMouseOver = function (e) {
|
11526 | return _this.handleMouseOverOut(_this.handleDelayedShow, e);
|
11527 | };
|
11528 | _this.handleMouseOut = function (e) {
|
11529 | return _this.handleMouseOverOut(_this.handleDelayedHide, e);
|
11530 | };
|
11531 |
|
11532 | _this._mountNode = null;
|
11533 |
|
11534 | var visible = void 0;
|
11535 | if ('visible' in props) {
|
11536 | visible = !!props.visible;
|
11537 | } else {
|
11538 | visible = !!props.defaultOverlayShown;
|
11539 | }
|
11540 |
|
11541 | _this.state = {
|
11542 | show: visible
|
11543 | };
|
11544 | return _this;
|
11545 | }
|
11546 |
|
11547 | OverlayTrigger.prototype.componentDidMount = function componentDidMount() {
|
11548 | this._mountNode = document.createElement('div');
|
11549 | !isReact16 && this.renderOverlay();
|
11550 | };
|
11551 |
|
11552 | OverlayTrigger.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
11553 | !isReact16 && this.renderOverlay();
|
11554 | if ('visible' in this.props && prevProps.visible !== this.props.visible) {
|
11555 | this.setState({
|
11556 | show: this.props.visible
|
11557 | });
|
11558 | }
|
11559 | if ('isHoverShow' in this.props && prevProps.isHoverShow !== this.props.isHoverShow) {
|
11560 | this.setState({
|
11561 | show: this.props.isHoverShow
|
11562 | });
|
11563 | }
|
11564 | };
|
11565 |
|
11566 | OverlayTrigger.prototype.componentWillUnmount = function componentWillUnmount() {
|
11567 | !isReact16 && _reactDom2["default"].unmountComponentAtNode(this._mountNode);
|
11568 | this._mountNode = null;
|
11569 |
|
11570 | this._hoverShowDelay && clearTimeout(this._hoverShowDelay);
|
11571 | this._hoverShowDelay && clearTimeout(this._hoverHideDelay);
|
11572 | };
|
11573 |
|
11574 | OverlayTrigger.prototype.handleToggle = function handleToggle() {
|
11575 | if (this.state.show) {
|
11576 | this.hide();
|
11577 | } else {
|
11578 | this.show();
|
11579 | }
|
11580 | };
|
11581 |
|
11582 | OverlayTrigger.prototype.handleDelayedShow = function handleDelayedShow() {
|
11583 | var _this2 = this;
|
11584 |
|
11585 | if (this._hoverHideDelay != null) {
|
11586 | clearTimeout(this._hoverHideDelay);
|
11587 | this._hoverHideDelay = null;
|
11588 | return;
|
11589 | }
|
11590 |
|
11591 | if (this.state.show || this._hoverShowDelay != null) {
|
11592 | return;
|
11593 | }
|
11594 |
|
11595 | var delay = this.props.delayShow != null ? this.props.delayShow : this.props.delay;
|
11596 |
|
11597 | if (!delay) {
|
11598 | this.show();
|
11599 | return;
|
11600 | }
|
11601 |
|
11602 | this._hoverShowDelay = setTimeout(function () {
|
11603 | _this2._hoverShowDelay = null;
|
11604 | _this2.show();
|
11605 | }, delay);
|
11606 | };
|
11607 |
|
11608 | OverlayTrigger.prototype.handleDelayedHide = function handleDelayedHide() {
|
11609 | var _this3 = this;
|
11610 |
|
11611 | if (this._hoverShowDelay != null) {
|
11612 | clearTimeout(this._hoverShowDelay);
|
11613 | this._hoverShowDelay = null;
|
11614 | return;
|
11615 | }
|
11616 |
|
11617 | if (!this.state.show || this._hoverHideDelay != null) {
|
11618 | return;
|
11619 | }
|
11620 |
|
11621 | var delay = this.props.delayHide != null ? this.props.delayHide : this.props.delay;
|
11622 |
|
11623 | if (!delay) {
|
11624 | this.hide();
|
11625 | return;
|
11626 | }
|
11627 |
|
11628 | this._hoverHideDelay = setTimeout(function () {
|
11629 | _this3._hoverHideDelay = null;
|
11630 | _this3.hide();
|
11631 | }, delay);
|
11632 | };
|
11633 |
|
11634 |
|
11635 |
|
11636 |
|
11637 |
|
11638 |
|
11639 |
|
11640 | OverlayTrigger.prototype.handleMouseOverOut = function handleMouseOverOut(handler, e) {
|
11641 | var target = e.currentTarget;
|
11642 | var related = e.relatedTarget || e.nativeEvent.toElement;
|
11643 |
|
11644 | if (!related || related !== target && !(0, _contains2["default"])(target, related)) {
|
11645 | handler(e);
|
11646 | }
|
11647 | };
|
11648 |
|
11649 | OverlayTrigger.prototype.handleHide = function handleHide() {
|
11650 | this.hide();
|
11651 | };
|
11652 |
|
11653 | OverlayTrigger.prototype.show = function show() {
|
11654 | this.setState({ show: true });
|
11655 | };
|
11656 |
|
11657 | OverlayTrigger.prototype.hide = function hide() {
|
11658 | this.setState({ show: false });
|
11659 | };
|
11660 |
|
11661 | OverlayTrigger.prototype.makeOverlay = function makeOverlay(overlay, props) {
|
11662 | return _react2["default"].createElement(
|
11663 | _Overlay2["default"],
|
11664 | _extends({}, props, {
|
11665 | show: this.state.show,
|
11666 | onHide: this.handleHide,
|
11667 | target: this
|
11668 | }),
|
11669 | overlay
|
11670 | );
|
11671 | };
|
11672 |
|
11673 | OverlayTrigger.prototype.renderOverlay = function renderOverlay() {
|
11674 | _reactDom2["default"].unstable_renderSubtreeIntoContainer(this, this._overlay, this._mountNode);
|
11675 | };
|
11676 |
|
11677 | OverlayTrigger.prototype.render = function render() {
|
11678 | var _props = this.props,
|
11679 | trigger = _props.trigger,
|
11680 | overlay = _props.overlay,
|
11681 | children = _props.children,
|
11682 | onBlur = _props.onBlur,
|
11683 | onClick = _props.onClick,
|
11684 | onFocus = _props.onFocus,
|
11685 | onMouseOut = _props.onMouseOut,
|
11686 | onMouseOver = _props.onMouseOver,
|
11687 | props = _objectWithoutProperties(_props, ['trigger', 'overlay', 'children', 'onBlur', 'onClick', 'onFocus', 'onMouseOut', 'onMouseOver']);
|
11688 |
|
11689 | delete props.delay;
|
11690 | delete props.delayShow;
|
11691 | delete props.delayHide;
|
11692 | delete props.defaultOverlayShown;
|
11693 |
|
11694 | var child = _react2["default"].Children.only(children);
|
11695 | var childProps = child.props;
|
11696 |
|
11697 | var triggerProps = {
|
11698 | 'aria-describedby': overlay.props.id
|
11699 | };
|
11700 |
|
11701 |
|
11702 |
|
11703 | triggerProps.onClick = (0, _createChainedFunction2["default"])(childProps.onClick, onClick);
|
11704 |
|
11705 | if (isOneOf('click', trigger) && !('visible' in this.props)) {
|
11706 | triggerProps.onClick = (0, _createChainedFunction2["default"])(triggerProps.onClick, this.handleToggle);
|
11707 | }
|
11708 |
|
11709 | if (isOneOf('hover', trigger) && !('visible' in this.props)) {
|
11710 | (0, _warning2["default"])(!(trigger === 'hover'), '[react-bootstrap] Specifying only the `"hover"` trigger limits the ' + 'visibility of the overlay to just mouse users. Consider also ' + 'including the `"focus"` trigger so that touch and keyboard only ' + 'users can see the overlay as well.');
|
11711 |
|
11712 | triggerProps.onMouseOver = (0, _createChainedFunction2["default"])(childProps.onMouseOver, onMouseOver, this.handleMouseOver);
|
11713 | triggerProps.onMouseOut = (0, _createChainedFunction2["default"])(childProps.onMouseOut, onMouseOut, this.handleMouseOut);
|
11714 | }
|
11715 |
|
11716 | if (isOneOf('focus', trigger) && !('visible' in this.props)) {
|
11717 | triggerProps.onFocus = (0, _createChainedFunction2["default"])(childProps.onFocus, onFocus, this.handleDelayedShow);
|
11718 | triggerProps.onBlur = (0, _createChainedFunction2["default"])(childProps.onBlur, onBlur, this.handleDelayedHide);
|
11719 | }
|
11720 |
|
11721 | this._overlay = this.makeOverlay(overlay, props);
|
11722 |
|
11723 | if (!isReact16) {
|
11724 | return (0, _react.cloneElement)(child, triggerProps);
|
11725 | }
|
11726 | triggerProps.key = 'overlay';
|
11727 |
|
11728 | var portal = _react2["default"].createElement(
|
11729 | _Portal2["default"],
|
11730 | {
|
11731 | key: 'portal',
|
11732 | container: props.container },
|
11733 | this._overlay
|
11734 | );
|
11735 |
|
11736 | return [(0, _react.cloneElement)(child, triggerProps), portal];
|
11737 | };
|
11738 |
|
11739 | return OverlayTrigger;
|
11740 | }(_react.Component);
|
11741 |
|
11742 | OverlayTrigger.propTypes = propTypes;
|
11743 | OverlayTrigger.defaultProps = defaultProps;
|
11744 |
|
11745 | exports["default"] = OverlayTrigger;
|
11746 | module.exports = exports['default'];
|
11747 |
|
11748 | }),
|
11749 |
|
11750 | (function(module, exports, __webpack_require__) {
|
11751 |
|
11752 | "use strict";
|
11753 |
|
11754 | var _interopRequireDefault = __webpack_require__(14);
|
11755 |
|
11756 | exports.__esModule = true;
|
11757 | exports.default = void 0;
|
11758 |
|
11759 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
11760 |
|
11761 | var _default = function () {
|
11762 |
|
11763 |
|
11764 | return _inDOM.default ? function (context, node) {
|
11765 | if (context.contains) {
|
11766 | return context.contains(node);
|
11767 | } else if (context.compareDocumentPosition) {
|
11768 | return context === node || !!(context.compareDocumentPosition(node) & 16);
|
11769 | } else {
|
11770 | return fallback(context, node);
|
11771 | }
|
11772 | } : fallback;
|
11773 | }();
|
11774 |
|
11775 | exports.default = _default;
|
11776 |
|
11777 | function fallback(context, node) {
|
11778 | if (node) do {
|
11779 | if (node === context) return true;
|
11780 | } while (node = node.parentNode);
|
11781 | return false;
|
11782 | }
|
11783 |
|
11784 | module.exports = exports["default"];
|
11785 |
|
11786 | }),
|
11787 |
|
11788 | (function(module, exports, __webpack_require__) {
|
11789 |
|
11790 | 'use strict';
|
11791 |
|
11792 | Object.defineProperty(exports, "__esModule", {
|
11793 | value: true
|
11794 | });
|
11795 |
|
11796 | var _react = __webpack_require__(1);
|
11797 |
|
11798 | var _react2 = _interopRequireDefault(_react);
|
11799 |
|
11800 | var _reactDom = __webpack_require__(2);
|
11801 |
|
11802 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
11803 |
|
11804 | var _propTypes = __webpack_require__(6);
|
11805 |
|
11806 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
11807 |
|
11808 | var _ownerDocument = __webpack_require__(74);
|
11809 |
|
11810 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
11811 |
|
11812 | var _getContainer = __webpack_require__(113);
|
11813 |
|
11814 | var _getContainer2 = _interopRequireDefault(_getContainer);
|
11815 |
|
11816 | var _tinperBeeCore = __webpack_require__(27);
|
11817 |
|
11818 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
11819 |
|
11820 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
11821 |
|
11822 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
11823 |
|
11824 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
11825 |
|
11826 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
11827 |
|
11828 | var isReact16 = _reactDom2["default"].createPortal !== undefined;
|
11829 | var createPortal = isReact16 ? _reactDom2["default"].createPortal : _reactDom2["default"].unstable_renderSubtreeIntoContainer;
|
11830 |
|
11831 | var propTypes = {
|
11832 | |
11833 |
|
11834 |
|
11835 | container: _propTypes2["default"].oneOfType([_tinperBeeCore.componentOrElement, _propTypes2["default"].func])
|
11836 | };
|
11837 |
|
11838 | var defaultProps = {};
|
11839 |
|
11840 | |
11841 |
|
11842 |
|
11843 |
|
11844 | var Portal = function (_Component) {
|
11845 | _inherits(Portal, _Component);
|
11846 |
|
11847 | function Portal(props) {
|
11848 | _classCallCheck(this, Portal);
|
11849 |
|
11850 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
11851 |
|
11852 | _this.getMountNode = _this.getMountNode.bind(_this);
|
11853 | _this.getOverlayDOMNode = _this.getOverlayDOMNode.bind(_this);
|
11854 | _this.mountOverlayTarget = _this.mountOverlayTarget.bind(_this);
|
11855 | _this.unmountOverlayTarget = _this.unmountOverlayTarget.bind(_this);
|
11856 | _this.renderOverlay = _this.renderOverlay.bind(_this);
|
11857 | _this.unrenderOverlay = _this.unrenderOverlay.bind(_this);
|
11858 |
|
11859 | _this.overlayTarget = isReact16 ? document.createElement('div') : null;
|
11860 | return _this;
|
11861 | }
|
11862 |
|
11863 | Portal.prototype.componentDidMount = function componentDidMount() {
|
11864 | if (isReact16) {
|
11865 | this.portalContainerNode = (0, _getContainer2["default"])(this.props.container, (0, _ownerDocument2["default"])(this).body);
|
11866 | this.portalContainerNode.appendChild(this.overlayTarget);
|
11867 | } else {
|
11868 | this.renderOverlay();
|
11869 | }
|
11870 |
|
11871 | this.mounted = true;
|
11872 | };
|
11873 |
|
11874 | Portal.prototype.componentDidUpdate = function componentDidUpdate() {
|
11875 | if (isReact16) {
|
11876 | var overlay = !this.props.children ? null : _react2["default"].Children.only(this.props.children);
|
11877 | if (overlay === null) {
|
11878 | this.unrenderOverlay();
|
11879 | this.unmountOverlayTarget();
|
11880 | } else {}
|
11881 | } else {
|
11882 | this.renderOverlay();
|
11883 | }
|
11884 | };
|
11885 |
|
11886 |
|
11887 |
|
11888 | Portal.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
11889 | if (this.overlayTarget && nextProps.container !== this.props.container) {
|
11890 | this.portalContainerNode.removeChild(this.overlayTarget);
|
11891 | this.portalContainerNode = (0, _getContainer2["default"])(nextProps.container, (0, _ownerDocument2["default"])(this).body);
|
11892 | this.portalContainerNode.appendChild(this.overlayTarget);
|
11893 | }
|
11894 | };
|
11895 |
|
11896 | Portal.prototype.componentWillUnmount = function componentWillUnmount() {
|
11897 | this.unrenderOverlay();
|
11898 | this.unmountOverlayTarget();
|
11899 |
|
11900 | this.mounted = false;
|
11901 | };
|
11902 |
|
11903 | Portal.prototype.getMountNode = function getMountNode() {
|
11904 | return this.overlayTarget;
|
11905 | };
|
11906 |
|
11907 | Portal.prototype.getOverlayDOMNode = function getOverlayDOMNode() {
|
11908 | if (!this.mounted) {
|
11909 | throw new Error('getOverlayDOMNode(): A component must be mounted to have a DOM node.');
|
11910 | }
|
11911 |
|
11912 | if (this.overlayInstance) {
|
11913 | return _reactDom2["default"].findDOMNode(this.overlayInstance);
|
11914 | }
|
11915 |
|
11916 | return null;
|
11917 | };
|
11918 |
|
11919 | |
11920 |
|
11921 |
|
11922 |
|
11923 | Portal.prototype.mountOverlayTarget = function mountOverlayTarget() {
|
11924 | if (!this.overlayTarget) {
|
11925 | this.overlayTarget = document.createElement('div');
|
11926 | this.portalContainerNode = (0, _getContainer2["default"])(this.props.container, (0, _ownerDocument2["default"])(this).body);
|
11927 | this.portalContainerNode.appendChild(this.overlayTarget);
|
11928 | }
|
11929 | };
|
11930 | |
11931 |
|
11932 |
|
11933 |
|
11934 |
|
11935 | Portal.prototype.unmountOverlayTarget = function unmountOverlayTarget() {
|
11936 | if (this.overlayTarget) {
|
11937 | this.portalContainerNode.removeChild(this.overlayTarget);
|
11938 | this.overlayTarget = null;
|
11939 | }
|
11940 | this.portalContainerNode = null;
|
11941 | };
|
11942 | |
11943 |
|
11944 |
|
11945 |
|
11946 |
|
11947 | Portal.prototype.renderOverlay = function renderOverlay() {
|
11948 |
|
11949 | var overlay = !this.props.children ? null : _react2["default"].Children.only(this.props.children);
|
11950 |
|
11951 |
|
11952 | if (overlay !== null) {
|
11953 | this.mountOverlayTarget();
|
11954 | this.overlayInstance = _reactDom2["default"].unstable_renderSubtreeIntoContainer(this, overlay, this.overlayTarget);
|
11955 | } else {
|
11956 |
|
11957 | this.unrenderOverlay();
|
11958 | this.unmountOverlayTarget();
|
11959 | }
|
11960 | };
|
11961 | |
11962 |
|
11963 |
|
11964 |
|
11965 |
|
11966 | Portal.prototype.unrenderOverlay = function unrenderOverlay() {
|
11967 | if (this.overlayTarget) {
|
11968 | !isReact16 && _reactDom2["default"].unmountComponentAtNode(this.overlayTarget);
|
11969 | this.overlayInstance = null;
|
11970 | }
|
11971 | };
|
11972 |
|
11973 | Portal.prototype.render = function render() {
|
11974 | if (!isReact16) {
|
11975 | return null;
|
11976 | }
|
11977 |
|
11978 | var overlay = !this.props.children ? null : _react2["default"].Children.only(this.props.children);
|
11979 |
|
11980 | return _reactDom2["default"].createPortal(overlay, this.overlayTarget);
|
11981 | };
|
11982 |
|
11983 | return Portal;
|
11984 | }(_react.Component);
|
11985 |
|
11986 | ;
|
11987 |
|
11988 | Portal.propTypes = propTypes;
|
11989 | Portal.defaultProps = defaultProps;
|
11990 |
|
11991 | exports["default"] = Portal;
|
11992 | module.exports = exports['default'];
|
11993 |
|
11994 | }),
|
11995 |
|
11996 | (function(module, exports, __webpack_require__) {
|
11997 |
|
11998 | 'use strict';
|
11999 |
|
12000 | Object.defineProperty(exports, "__esModule", {
|
12001 | value: true
|
12002 | });
|
12003 | exports["default"] = getContainer;
|
12004 |
|
12005 | var _reactDom = __webpack_require__(2);
|
12006 |
|
12007 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
12008 |
|
12009 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
12010 |
|
12011 | |
12012 |
|
12013 |
|
12014 |
|
12015 |
|
12016 |
|
12017 | function getContainer(container, defaultContainer) {
|
12018 | container = typeof container === 'function' ? container() : container;
|
12019 | return _reactDom2["default"].findDOMNode(container) || defaultContainer;
|
12020 | }
|
12021 | module.exports = exports['default'];
|
12022 |
|
12023 | }),
|
12024 |
|
12025 | (function(module, exports, __webpack_require__) {
|
12026 |
|
12027 | 'use strict';
|
12028 |
|
12029 | Object.defineProperty(exports, "__esModule", {
|
12030 | value: true
|
12031 | });
|
12032 |
|
12033 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
12034 |
|
12035 | var _classnames = __webpack_require__(5);
|
12036 |
|
12037 | var _classnames2 = _interopRequireDefault(_classnames);
|
12038 |
|
12039 | var _react = __webpack_require__(1);
|
12040 |
|
12041 | var _react2 = _interopRequireDefault(_react);
|
12042 |
|
12043 | var _propTypes = __webpack_require__(6);
|
12044 |
|
12045 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
12046 |
|
12047 | var _BaseOverlay = __webpack_require__(115);
|
12048 |
|
12049 | var _BaseOverlay2 = _interopRequireDefault(_BaseOverlay);
|
12050 |
|
12051 | var _tinperBeeCore = __webpack_require__(27);
|
12052 |
|
12053 | var _Fade = __webpack_require__(129);
|
12054 |
|
12055 | var _Fade2 = _interopRequireDefault(_Fade);
|
12056 |
|
12057 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
12058 |
|
12059 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
12060 |
|
12061 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
12062 |
|
12063 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
12064 |
|
12065 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
12066 |
|
12067 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
12068 |
|
12069 | var propTypes = _extends({}, _BaseOverlay2["default"].propTypes, {
|
12070 |
|
12071 | |
12072 |
|
12073 |
|
12074 | show: _propTypes2["default"].bool,
|
12075 | |
12076 |
|
12077 |
|
12078 | rootClose: _propTypes2["default"].bool,
|
12079 | |
12080 |
|
12081 |
|
12082 | onHide: _propTypes2["default"].func,
|
12083 |
|
12084 | |
12085 |
|
12086 |
|
12087 | animation: _propTypes2["default"].oneOfType([_tinperBeeCore.elementType, _propTypes2["default"].func]),
|
12088 |
|
12089 | |
12090 |
|
12091 |
|
12092 | onEnter: _propTypes2["default"].func,
|
12093 |
|
12094 | |
12095 |
|
12096 |
|
12097 | onEntering: _propTypes2["default"].func,
|
12098 |
|
12099 | |
12100 |
|
12101 |
|
12102 | onEntered: _propTypes2["default"].func,
|
12103 |
|
12104 | |
12105 |
|
12106 |
|
12107 | onExit: _propTypes2["default"].func,
|
12108 |
|
12109 | |
12110 |
|
12111 |
|
12112 | onExiting: _propTypes2["default"].func,
|
12113 |
|
12114 | |
12115 |
|
12116 |
|
12117 | onExited: _propTypes2["default"].func,
|
12118 |
|
12119 | |
12120 |
|
12121 |
|
12122 | placement: _propTypes2["default"].oneOf(['top', 'right', 'bottom', 'left']),
|
12123 |
|
12124 | |
12125 |
|
12126 |
|
12127 | secondPlacement: _propTypes2["default"].oneOf(['top', 'right', 'bottom', 'left'])
|
12128 | });
|
12129 |
|
12130 | var defaultProps = {
|
12131 | animation: _Fade2["default"],
|
12132 | rootClose: false,
|
12133 | show: false,
|
12134 | placement: 'right'
|
12135 | };
|
12136 |
|
12137 | var Overlay = function (_Component) {
|
12138 | _inherits(Overlay, _Component);
|
12139 |
|
12140 | function Overlay() {
|
12141 | _classCallCheck(this, Overlay);
|
12142 |
|
12143 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
12144 | }
|
12145 |
|
12146 | Overlay.prototype.render = function render() {
|
12147 | var _props = this.props,
|
12148 | animation = _props.animation,
|
12149 | children = _props.children,
|
12150 | props = _objectWithoutProperties(_props, ['animation', 'children']);
|
12151 |
|
12152 | var transition = animation === true ? _Fade2["default"] : animation || null;
|
12153 |
|
12154 | var child = void 0;
|
12155 |
|
12156 | if (!transition) {
|
12157 | child = (0, _react.cloneElement)(children, {
|
12158 | className: (0, _classnames2["default"])(children.props.className, 'in')
|
12159 | });
|
12160 | } else {
|
12161 | child = children;
|
12162 | }
|
12163 |
|
12164 | return _react2["default"].createElement(
|
12165 | _BaseOverlay2["default"],
|
12166 | _extends({}, props, {
|
12167 | transition: transition
|
12168 | }),
|
12169 | child
|
12170 | );
|
12171 | };
|
12172 |
|
12173 | return Overlay;
|
12174 | }(_react.Component);
|
12175 |
|
12176 | Overlay.propTypes = propTypes;
|
12177 | Overlay.defaultProps = defaultProps;
|
12178 |
|
12179 | exports["default"] = Overlay;
|
12180 | module.exports = exports['default'];
|
12181 |
|
12182 | }),
|
12183 |
|
12184 | (function(module, exports, __webpack_require__) {
|
12185 |
|
12186 | 'use strict';
|
12187 |
|
12188 | Object.defineProperty(exports, "__esModule", {
|
12189 | value: true
|
12190 | });
|
12191 |
|
12192 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
12193 |
|
12194 | var _react = __webpack_require__(1);
|
12195 |
|
12196 | var _react2 = _interopRequireDefault(_react);
|
12197 |
|
12198 | var _reactDom = __webpack_require__(2);
|
12199 |
|
12200 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
12201 |
|
12202 | var _propTypes = __webpack_require__(6);
|
12203 |
|
12204 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
12205 |
|
12206 | var _Portal = __webpack_require__(112);
|
12207 |
|
12208 | var _Portal2 = _interopRequireDefault(_Portal);
|
12209 |
|
12210 | var _Position = __webpack_require__(116);
|
12211 |
|
12212 | var _Position2 = _interopRequireDefault(_Position);
|
12213 |
|
12214 | var _RootCloseWrapper = __webpack_require__(128);
|
12215 |
|
12216 | var _RootCloseWrapper2 = _interopRequireDefault(_RootCloseWrapper);
|
12217 |
|
12218 | var _tinperBeeCore = __webpack_require__(27);
|
12219 |
|
12220 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
12221 |
|
12222 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
12223 |
|
12224 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
12225 |
|
12226 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
12227 |
|
12228 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
12229 |
|
12230 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
12231 |
|
12232 | var isReact16 = _reactDom2["default"].createPortal !== undefined;
|
12233 |
|
12234 | var propTypes = _extends({}, _Position2["default"].propTypes, {
|
12235 |
|
12236 | |
12237 |
|
12238 |
|
12239 | show: _propTypes2["default"].bool,
|
12240 |
|
12241 | |
12242 |
|
12243 |
|
12244 | rootClose: _propTypes2["default"].bool,
|
12245 |
|
12246 | |
12247 |
|
12248 |
|
12249 |
|
12250 | onHide: function onHide(props) {
|
12251 | var propType = _propTypes2["default"].func;
|
12252 | if (props.rootClose) {
|
12253 | propType = propType.isRequired;
|
12254 | }
|
12255 |
|
12256 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
12257 | args[_key - 1] = arguments[_key];
|
12258 | }
|
12259 |
|
12260 | return propType.apply(undefined, [props].concat(args));
|
12261 | },
|
12262 |
|
12263 |
|
12264 | |
12265 |
|
12266 |
|
12267 | transition: _propTypes2["default"].oneOfType([_tinperBeeCore.elementType, _propTypes2["default"].func]),
|
12268 |
|
12269 | |
12270 |
|
12271 |
|
12272 | onEnter: _propTypes2["default"].func,
|
12273 |
|
12274 | |
12275 |
|
12276 |
|
12277 | onEntering: _propTypes2["default"].func,
|
12278 |
|
12279 | |
12280 |
|
12281 |
|
12282 | onEntered: _propTypes2["default"].func,
|
12283 |
|
12284 | |
12285 |
|
12286 |
|
12287 | onExit: _propTypes2["default"].func,
|
12288 |
|
12289 | |
12290 |
|
12291 |
|
12292 | onExiting: _propTypes2["default"].func,
|
12293 |
|
12294 | |
12295 |
|
12296 |
|
12297 | onExited: _propTypes2["default"].func
|
12298 | });
|
12299 |
|
12300 | function noop() {}
|
12301 |
|
12302 | var defaultProps = {
|
12303 | show: false,
|
12304 | rootClose: true
|
12305 | };
|
12306 |
|
12307 | |
12308 |
|
12309 |
|
12310 |
|
12311 | var BaseOverlay = function (_Component) {
|
12312 | _inherits(BaseOverlay, _Component);
|
12313 |
|
12314 | function BaseOverlay(props, context) {
|
12315 | _classCallCheck(this, BaseOverlay);
|
12316 |
|
12317 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
12318 |
|
12319 | _this.state = { exited: !props.show };
|
12320 | _this.onHiddenListener = _this.handleHidden.bind(_this);
|
12321 | return _this;
|
12322 | }
|
12323 |
|
12324 | BaseOverlay.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
12325 | if (nextProps.show) {
|
12326 | this.setState({ exited: false });
|
12327 | } else if (!nextProps.transition) {
|
12328 |
|
12329 | this.setState({ exited: true });
|
12330 | }
|
12331 | };
|
12332 |
|
12333 | BaseOverlay.prototype.handleHidden = function handleHidden() {
|
12334 | this.setState({ exited: true });
|
12335 |
|
12336 | if (this.props.onExited) {
|
12337 | var _props;
|
12338 |
|
12339 | (_props = this.props).onExited.apply(_props, arguments);
|
12340 | }
|
12341 | };
|
12342 |
|
12343 | BaseOverlay.prototype.render = function render() {
|
12344 | var _props2 = this.props,
|
12345 | container = _props2.container,
|
12346 | containerPadding = _props2.containerPadding,
|
12347 | target = _props2.target,
|
12348 | placement = _props2.placement,
|
12349 | secondPlacement = _props2.secondPlacement,
|
12350 | shouldUpdatePosition = _props2.shouldUpdatePosition,
|
12351 | rootClose = _props2.rootClose,
|
12352 | positionLeft = _props2.positionLeft,
|
12353 | positionTop = _props2.positionTop,
|
12354 | children = _props2.children,
|
12355 | Transition = _props2.transition,
|
12356 | props = _objectWithoutProperties(_props2, ['container', 'containerPadding', 'target', 'placement', 'secondPlacement', 'shouldUpdatePosition', 'rootClose', 'positionLeft', 'positionTop', 'children', 'transition']);
|
12357 |
|
12358 |
|
12359 |
|
12360 |
|
12361 | var mountOverlay = props.show || Transition && !this.state.exited;
|
12362 | if (!mountOverlay) {
|
12363 |
|
12364 | return null;
|
12365 | }
|
12366 |
|
12367 | var child = children;
|
12368 |
|
12369 |
|
12370 |
|
12371 | child = _react2["default"].createElement(
|
12372 | _Position2["default"],
|
12373 | {
|
12374 | container: container,
|
12375 | containerPadding: containerPadding,
|
12376 | target: target,
|
12377 | positionLeft: positionLeft,
|
12378 | positionTop: positionTop,
|
12379 | placement: placement,
|
12380 | secondPlacement: secondPlacement,
|
12381 | shouldUpdatePosition: shouldUpdatePosition },
|
12382 | child
|
12383 | );
|
12384 |
|
12385 | if (Transition) {
|
12386 | var onExit = props.onExit,
|
12387 | onExiting = props.onExiting,
|
12388 | onEnter = props.onEnter,
|
12389 | onEntering = props.onEntering,
|
12390 | onEntered = props.onEntered;
|
12391 |
|
12392 |
|
12393 |
|
12394 |
|
12395 | child = _react2["default"].createElement(
|
12396 | Transition,
|
12397 | {
|
12398 | 'in': props.show,
|
12399 | transitionAppear: true,
|
12400 | onExit: onExit,
|
12401 | onExiting: onExiting,
|
12402 | onExited: this.onHiddenListener,
|
12403 | onEnter: onEnter,
|
12404 | onEntering: onEntering,
|
12405 | onEntered: onEntered
|
12406 | },
|
12407 | child
|
12408 | );
|
12409 | }
|
12410 |
|
12411 |
|
12412 | if (rootClose) {
|
12413 | child = _react2["default"].createElement(
|
12414 | _RootCloseWrapper2["default"],
|
12415 | { onRootClose: props.onHide },
|
12416 | child
|
12417 | );
|
12418 | }
|
12419 |
|
12420 | if (isReact16) {
|
12421 | return child;
|
12422 | } else {
|
12423 | return _react2["default"].createElement(
|
12424 | _Portal2["default"],
|
12425 | { container: container },
|
12426 | child
|
12427 | );
|
12428 | }
|
12429 | };
|
12430 |
|
12431 | return BaseOverlay;
|
12432 | }(_react.Component);
|
12433 |
|
12434 | BaseOverlay.propTypes = propTypes;
|
12435 | BaseOverlay.defaultProps = defaultProps;
|
12436 |
|
12437 | exports["default"] = BaseOverlay;
|
12438 | module.exports = exports['default'];
|
12439 |
|
12440 | }),
|
12441 |
|
12442 | (function(module, exports, __webpack_require__) {
|
12443 |
|
12444 | 'use strict';
|
12445 |
|
12446 | Object.defineProperty(exports, "__esModule", {
|
12447 | value: true
|
12448 | });
|
12449 |
|
12450 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
12451 |
|
12452 | var _classnames = __webpack_require__(5);
|
12453 |
|
12454 | var _classnames2 = _interopRequireDefault(_classnames);
|
12455 |
|
12456 | var _react = __webpack_require__(1);
|
12457 |
|
12458 | var _react2 = _interopRequireDefault(_react);
|
12459 |
|
12460 | var _propTypes = __webpack_require__(6);
|
12461 |
|
12462 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
12463 |
|
12464 | var _reactDom = __webpack_require__(2);
|
12465 |
|
12466 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
12467 |
|
12468 | var _tinperBeeCore = __webpack_require__(27);
|
12469 |
|
12470 | var _requestAnimationFrame = __webpack_require__(117);
|
12471 |
|
12472 | var _requestAnimationFrame2 = _interopRequireDefault(_requestAnimationFrame);
|
12473 |
|
12474 | var _calculatePosition = __webpack_require__(118);
|
12475 |
|
12476 | var _calculatePosition2 = _interopRequireDefault(_calculatePosition);
|
12477 |
|
12478 | var _getContainer = __webpack_require__(113);
|
12479 |
|
12480 | var _getContainer2 = _interopRequireDefault(_getContainer);
|
12481 |
|
12482 | var _ownerDocument = __webpack_require__(74);
|
12483 |
|
12484 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
12485 |
|
12486 | var _ownerWindow = __webpack_require__(126);
|
12487 |
|
12488 | var _ownerWindow2 = _interopRequireDefault(_ownerWindow);
|
12489 |
|
12490 | var _addEventListener = __webpack_require__(76);
|
12491 |
|
12492 | var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
12493 |
|
12494 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
12495 |
|
12496 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
12497 |
|
12498 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
12499 |
|
12500 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
12501 |
|
12502 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
12503 |
|
12504 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
12505 |
|
12506 | var propTypes = {
|
12507 | |
12508 |
|
12509 |
|
12510 | target: _propTypes2["default"].oneOfType([_tinperBeeCore.componentOrElement, _propTypes2["default"].func]),
|
12511 |
|
12512 | |
12513 |
|
12514 |
|
12515 | container: _propTypes2["default"].oneOfType([_tinperBeeCore.componentOrElement, _propTypes2["default"].func]),
|
12516 | |
12517 |
|
12518 |
|
12519 | containerPadding: _propTypes2["default"].number,
|
12520 | |
12521 |
|
12522 |
|
12523 | placement: _propTypes2["default"].oneOf(['top', 'right', 'bottom', 'left']),
|
12524 |
|
12525 | |
12526 |
|
12527 |
|
12528 | secondPlacement: _propTypes2["default"].oneOf(['top', 'right', 'bottom', 'left']),
|
12529 |
|
12530 | |
12531 |
|
12532 |
|
12533 | shouldUpdatePosition: _propTypes2["default"].bool
|
12534 | };
|
12535 |
|
12536 | var defaultProps = {
|
12537 | containerPadding: 0,
|
12538 | placement: 'right',
|
12539 | shouldUpdatePosition: false
|
12540 | };
|
12541 |
|
12542 | |
12543 |
|
12544 |
|
12545 |
|
12546 | var Position = function (_Component) {
|
12547 | _inherits(Position, _Component);
|
12548 |
|
12549 | function Position(props, context) {
|
12550 | _classCallCheck(this, Position);
|
12551 |
|
12552 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
12553 |
|
12554 | _this.state = {
|
12555 | positionLeft: 0,
|
12556 | positionTop: 0,
|
12557 | arrowOffsetLeft: null,
|
12558 | arrowOffsetTop: null
|
12559 | };
|
12560 |
|
12561 | _this.needsFlush = false;
|
12562 | _this.lastTarget = null;
|
12563 |
|
12564 | _this.getTarget = _this.getTarget.bind(_this);
|
12565 | _this.maybeUpdatePosition = _this.maybeUpdatePosition.bind(_this);
|
12566 | _this.updatePosition = _this.updatePosition.bind(_this);
|
12567 | _this.onWindowResize = _this.onWindowResize.bind(_this);
|
12568 | return _this;
|
12569 | }
|
12570 |
|
12571 | Position.prototype.componentDidMount = function componentDidMount() {
|
12572 | var _this2 = this;
|
12573 |
|
12574 | this._isMounted = true;
|
12575 |
|
12576 | this._windowResizeListener = (0, _addEventListener2["default"])((0, _ownerWindow2["default"])(this), 'resize', function () {
|
12577 | return _this2.onWindowResize();
|
12578 | });
|
12579 |
|
12580 | this.updatePosition(this.getTarget());
|
12581 | };
|
12582 |
|
12583 | Position.prototype.componentWillReceiveProps = function componentWillReceiveProps() {
|
12584 | this.needsFlush = true;
|
12585 | };
|
12586 |
|
12587 | Position.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
12588 | if (this.needsFlush) {
|
12589 | this.needsFlush = false;
|
12590 |
|
12591 | this.maybeUpdatePosition();
|
12592 | }
|
12593 | };
|
12594 |
|
12595 | Position.prototype.componentWillUnmount = function componentWillUnmount() {
|
12596 | this._isMounted = false;
|
12597 |
|
12598 | if (this._windowResizeListener) {
|
12599 | this._windowResizeListener.remove();
|
12600 | }
|
12601 | };
|
12602 |
|
12603 | |
12604 |
|
12605 |
|
12606 |
|
12607 |
|
12608 | Position.prototype.getTarget = function getTarget() {
|
12609 | var target = this.props.target;
|
12610 |
|
12611 | var targetElement = typeof target === 'function' ? target() : target;
|
12612 | return targetElement && _reactDom2["default"].findDOMNode(targetElement) || null;
|
12613 | };
|
12614 |
|
12615 | |
12616 |
|
12617 |
|
12618 |
|
12619 |
|
12620 | Position.prototype.maybeUpdatePosition = function maybeUpdatePosition(placementChanged) {
|
12621 | var target = this.getTarget();
|
12622 | if (!this.props.shouldUpdatePosition && target === this.lastTarget && !placementChanged) {
|
12623 | return;
|
12624 | }
|
12625 |
|
12626 | this.updatePosition(target);
|
12627 | };
|
12628 |
|
12629 | Position.prototype.onWindowResize = function onWindowResize() {
|
12630 | var _this3 = this;
|
12631 |
|
12632 | (0, _requestAnimationFrame2["default"])(function () {
|
12633 | return _this3.updatePosition(_this3.getTarget());
|
12634 | });
|
12635 | };
|
12636 |
|
12637 | |
12638 |
|
12639 |
|
12640 |
|
12641 | Position.prototype.updatePosition = function updatePosition(target) {
|
12642 | var _props = this.props,
|
12643 | placement = _props.placement,
|
12644 | secondPlacement = _props.secondPlacement;
|
12645 |
|
12646 |
|
12647 | if (!this._isMounted) {
|
12648 | return;
|
12649 | }
|
12650 | this.lastTarget = target;
|
12651 |
|
12652 | if (!target) {
|
12653 | this.setState({
|
12654 | positionLeft: 0,
|
12655 | positionTop: 0,
|
12656 | arrowOffsetLeft: null,
|
12657 | arrowOffsetTop: null
|
12658 | });
|
12659 |
|
12660 | return;
|
12661 | }
|
12662 |
|
12663 | var overlay = _reactDom2["default"].findDOMNode(this);
|
12664 | var container = (0, _getContainer2["default"])(this.props.container, (0, _ownerDocument2["default"])(this).body);
|
12665 |
|
12666 |
|
12667 | if ("secondPlacement" in this.props && secondPlacement) {
|
12668 | var initPosition = (0, _calculatePosition2["default"])(placement, overlay, target, container, this.props.containerPadding);
|
12669 | if (initPosition.inverseArrow) {
|
12670 | var secondPosition = (0, _calculatePosition2["default"])(secondPlacement, overlay, target, container, this.props.containerPadding);
|
12671 |
|
12672 | if (secondPosition.inverseArrow) {
|
12673 | this.setState(_extends({}, initPosition, {
|
12674 | renderPlacement: placement
|
12675 | }));
|
12676 | } else {
|
12677 | this.setState(_extends({}, secondPosition, {
|
12678 | renderPlacement: secondPlacement
|
12679 | }));
|
12680 | }
|
12681 | } else {
|
12682 | this.setState(_extends({}, initPosition, {
|
12683 | renderPlacement: placement
|
12684 | }));
|
12685 | }
|
12686 | } else {
|
12687 | this.setState((0, _calculatePosition2["default"])(placement, overlay, target, container, this.props.containerPadding));
|
12688 | }
|
12689 | };
|
12690 |
|
12691 | Position.prototype.render = function render() {
|
12692 | var _props2 = this.props,
|
12693 | children = _props2.children,
|
12694 | className = _props2.className,
|
12695 | props = _objectWithoutProperties(_props2, ['children', 'className']);
|
12696 |
|
12697 | var _state = this.state,
|
12698 | positionLeft = _state.positionLeft,
|
12699 | positionTop = _state.positionTop,
|
12700 | inverseArrow = _state.inverseArrow,
|
12701 | width = _state.width,
|
12702 | arrowPosition = _objectWithoutProperties(_state, ['positionLeft', 'positionTop', 'inverseArrow', 'width']);
|
12703 |
|
12704 |
|
12705 |
|
12706 |
|
12707 | delete props.target;
|
12708 | delete props.container;
|
12709 | delete props.containerPadding;
|
12710 | delete props.shouldUpdatePosition;
|
12711 |
|
12712 | var child = _react2["default"].Children.only(children);
|
12713 | return (0, _react.cloneElement)(child, _extends({
|
12714 | className: (0, _classnames2["default"])(className, child.props.className, { 'inverse-arrow': inverseArrow })
|
12715 | }, arrowPosition, {
|
12716 | style: _extends({}, child.props.style, {
|
12717 | width: width,
|
12718 | left: positionLeft,
|
12719 | top: positionTop
|
12720 | })
|
12721 | }));
|
12722 | };
|
12723 |
|
12724 | return Position;
|
12725 | }(_react.Component);
|
12726 |
|
12727 | Position.propTypes = propTypes;
|
12728 | Position.defaultProps = defaultProps;
|
12729 |
|
12730 | exports["default"] = Position;
|
12731 | module.exports = exports['default'];
|
12732 |
|
12733 | }),
|
12734 |
|
12735 | (function(module, exports, __webpack_require__) {
|
12736 |
|
12737 | "use strict";
|
12738 |
|
12739 | var _interopRequireDefault = __webpack_require__(14);
|
12740 |
|
12741 | exports.__esModule = true;
|
12742 | exports.default = void 0;
|
12743 |
|
12744 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
12745 |
|
12746 | var vendors = ['', 'webkit', 'moz', 'o', 'ms'];
|
12747 | var cancel = 'clearTimeout';
|
12748 | var raf = fallback;
|
12749 | var compatRaf;
|
12750 |
|
12751 | var getKey = function getKey(vendor, k) {
|
12752 | return vendor + (!vendor ? k : k[0].toUpperCase() + k.substr(1)) + 'AnimationFrame';
|
12753 | };
|
12754 |
|
12755 | if (_inDOM.default) {
|
12756 | vendors.some(function (vendor) {
|
12757 | var rafKey = getKey(vendor, 'request');
|
12758 |
|
12759 | if (rafKey in window) {
|
12760 | cancel = getKey(vendor, 'cancel');
|
12761 | return raf = function raf(cb) {
|
12762 | return window[rafKey](cb);
|
12763 | };
|
12764 | }
|
12765 | });
|
12766 | }
|
12767 |
|
12768 |
|
12769 |
|
12770 | var prev = new Date().getTime();
|
12771 |
|
12772 | function fallback(fn) {
|
12773 | var curr = new Date().getTime(),
|
12774 | ms = Math.max(0, 16 - (curr - prev)),
|
12775 | req = setTimeout(fn, ms);
|
12776 | prev = curr;
|
12777 | return req;
|
12778 | }
|
12779 |
|
12780 | compatRaf = function compatRaf(cb) {
|
12781 | return raf(cb);
|
12782 | };
|
12783 |
|
12784 | compatRaf.cancel = function (id) {
|
12785 | window[cancel] && typeof window[cancel] === 'function' && window[cancel](id);
|
12786 | };
|
12787 |
|
12788 | var _default = compatRaf;
|
12789 | exports.default = _default;
|
12790 | module.exports = exports["default"];
|
12791 |
|
12792 | }),
|
12793 |
|
12794 | (function(module, exports, __webpack_require__) {
|
12795 |
|
12796 | 'use strict';
|
12797 |
|
12798 | Object.defineProperty(exports, "__esModule", {
|
12799 | value: true
|
12800 | });
|
12801 | exports["default"] = calculatePosition;
|
12802 |
|
12803 | var _offset = __webpack_require__(119);
|
12804 |
|
12805 | var _offset2 = _interopRequireDefault(_offset);
|
12806 |
|
12807 | var _position = __webpack_require__(121);
|
12808 |
|
12809 | var _position2 = _interopRequireDefault(_position);
|
12810 |
|
12811 | var _scrollTop = __webpack_require__(124);
|
12812 |
|
12813 | var _scrollTop2 = _interopRequireDefault(_scrollTop);
|
12814 |
|
12815 | var _ownerDocument = __webpack_require__(74);
|
12816 |
|
12817 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
12818 |
|
12819 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
12820 |
|
12821 | function getContainerDimensions(containerNode) {
|
12822 | var width = void 0,
|
12823 | height = void 0,
|
12824 | scroll = void 0;
|
12825 |
|
12826 | if (containerNode.tagName === 'BODY') {
|
12827 | width = document.body.scrollWidth;
|
12828 | height = document.body.scrollHeight;
|
12829 |
|
12830 | scroll = (0, _scrollTop2["default"])((0, _ownerDocument2["default"])(containerNode).documentElement) || (0, _scrollTop2["default"])(containerNode);
|
12831 | } else {
|
12832 | var _getOffset = (0, _offset2["default"])(containerNode);
|
12833 |
|
12834 | width = _getOffset.width;
|
12835 | height = _getOffset.height;
|
12836 |
|
12837 | scroll = (0, _scrollTop2["default"])(containerNode);
|
12838 | }
|
12839 |
|
12840 | return { width: width, height: height, scroll: scroll };
|
12841 | }
|
12842 |
|
12843 | function getTopDelta(top, overlayHeight, container, padding) {
|
12844 | var containerDimensions = getContainerDimensions(container);
|
12845 | var containerScroll = containerDimensions.scroll;
|
12846 | var containerHeight = containerDimensions.height;
|
12847 |
|
12848 | var topEdgeOffset = top - padding - containerScroll;
|
12849 | var bottomEdgeOffset = top + padding - containerScroll + overlayHeight;
|
12850 |
|
12851 | if (topEdgeOffset < 0) {
|
12852 | return -topEdgeOffset;
|
12853 | } else if (bottomEdgeOffset > containerHeight) {
|
12854 | return containerHeight - bottomEdgeOffset;
|
12855 | } else {
|
12856 | return 0;
|
12857 | }
|
12858 | }
|
12859 |
|
12860 | function getLeftDelta(left, overlayWidth, container, padding) {
|
12861 | var containerDimensions = getContainerDimensions(container);
|
12862 | var containerWidth = containerDimensions.width;
|
12863 |
|
12864 | var leftEdgeOffset = left - padding;
|
12865 | var rightEdgeOffset = left + padding + overlayWidth;
|
12866 |
|
12867 | if (leftEdgeOffset < 0) {
|
12868 | return -leftEdgeOffset;
|
12869 | } else if (rightEdgeOffset > containerWidth) {
|
12870 | return containerWidth - rightEdgeOffset;
|
12871 | }
|
12872 |
|
12873 | return 0;
|
12874 | }
|
12875 |
|
12876 | function calculatePosition(placement, overlayNode, target, container, padding) {
|
12877 | var childOffset = container.tagName === 'BODY' ? (0, _offset2["default"])(target) : (0, _position2["default"])(target, container);
|
12878 |
|
12879 | var _getOffset2 = (0, _offset2["default"])(overlayNode),
|
12880 | overlayHeight = _getOffset2.height,
|
12881 | overlayWidth = _getOffset2.width;
|
12882 |
|
12883 | var positionLeft = void 0,
|
12884 | positionTop = void 0,
|
12885 | arrowOffsetLeft = void 0,
|
12886 | arrowOffsetTop = void 0,
|
12887 | inverseArrow = void 0;
|
12888 |
|
12889 | if (/^left|^right/.test(placement)) {
|
12890 | positionTop = childOffset.top + (childOffset.height - overlayHeight) / 2;
|
12891 |
|
12892 | if (/left/.test(placement)) {
|
12893 | positionLeft = childOffset.left - overlayWidth;
|
12894 | } else {
|
12895 | positionLeft = childOffset.left + childOffset.width;
|
12896 | }
|
12897 |
|
12898 | if (/Top/.test(placement)) {
|
12899 | positionTop = childOffset.top;
|
12900 | } else if (/Bottom/.test(placement)) {
|
12901 | positionTop = childOffset.top + childOffset.height - overlayHeight;
|
12902 | }
|
12903 |
|
12904 | var topDelta = getTopDelta(positionTop, overlayHeight, container, padding);
|
12905 | var leftDelta = getLeftDelta(positionLeft, overlayWidth, container, padding);
|
12906 |
|
12907 | if (leftDelta > 0) {
|
12908 | inverseArrow = true;
|
12909 | positionLeft = childOffset.left + childOffset.width + 6;
|
12910 | } else if (leftDelta < 0) {
|
12911 | inverseArrow = true;
|
12912 | positionLeft = childOffset.left - overlayWidth - 6;
|
12913 | } else {
|
12914 | positionLeft += leftDelta;
|
12915 | }
|
12916 | positionTop += topDelta;
|
12917 | arrowOffsetTop = 50 * (1 - 2 * topDelta / overlayHeight) + '%';
|
12918 | arrowOffsetLeft = void 0;
|
12919 | } else if (/^top|^bottom/.test(placement)) {
|
12920 | positionLeft = childOffset.left + (childOffset.width - overlayWidth) / 2;
|
12921 |
|
12922 | if (/top/.test(placement)) {
|
12923 | positionTop = childOffset.top - overlayHeight;
|
12924 | } else {
|
12925 | positionTop = childOffset.top + childOffset.height;
|
12926 | }
|
12927 |
|
12928 | if (/Left/.test(placement)) {
|
12929 | positionLeft = childOffset.left;
|
12930 | } else if (/Right/.test(placement)) {
|
12931 | positionLeft = childOffset.left + (childOffset.width - overlayWidth);
|
12932 | }
|
12933 |
|
12934 | var _leftDelta = getLeftDelta(positionLeft, overlayWidth, container, padding);
|
12935 | var _topDelta = getTopDelta(positionTop, overlayHeight, container, padding);
|
12936 | positionLeft += _leftDelta;
|
12937 | arrowOffsetLeft = 50 * (1 - 2 * _leftDelta / overlayWidth) + '%';
|
12938 | arrowOffsetTop = void 0;
|
12939 | if (_topDelta > 0) {
|
12940 | inverseArrow = true;
|
12941 | positionTop = childOffset.top + childOffset.height + 6;
|
12942 | } else if (_topDelta < 0) {
|
12943 | inverseArrow = true;
|
12944 | positionTop = childOffset.top - overlayHeight - 6;
|
12945 | } else {
|
12946 | positionTop += _topDelta;
|
12947 | }
|
12948 |
|
12949 |
|
12950 |
|
12951 |
|
12952 |
|
12953 |
|
12954 |
|
12955 |
|
12956 |
|
12957 |
|
12958 |
|
12959 |
|
12960 | } else {
|
12961 | throw new Error('calcOverlayPosition(): No such placement of "' + placement + '" found.');
|
12962 | }
|
12963 |
|
12964 | return { positionLeft: positionLeft, positionTop: positionTop, arrowOffsetLeft: arrowOffsetLeft, arrowOffsetTop: arrowOffsetTop, inverseArrow: inverseArrow, width: overlayWidth };
|
12965 | }
|
12966 | module.exports = exports['default'];
|
12967 |
|
12968 | }),
|
12969 |
|
12970 | (function(module, exports, __webpack_require__) {
|
12971 |
|
12972 | "use strict";
|
12973 |
|
12974 | var _interopRequireDefault = __webpack_require__(14);
|
12975 |
|
12976 | exports.__esModule = true;
|
12977 | exports.default = offset;
|
12978 |
|
12979 | var _contains = _interopRequireDefault(__webpack_require__(111));
|
12980 |
|
12981 | var _isWindow = _interopRequireDefault(__webpack_require__(120));
|
12982 |
|
12983 | var _ownerDocument = _interopRequireDefault(__webpack_require__(75));
|
12984 |
|
12985 | function offset(node) {
|
12986 | var doc = (0, _ownerDocument.default)(node),
|
12987 | win = (0, _isWindow.default)(doc),
|
12988 | docElem = doc && doc.documentElement,
|
12989 | box = {
|
12990 | top: 0,
|
12991 | left: 0,
|
12992 | height: 0,
|
12993 | width: 0
|
12994 | };
|
12995 | if (!doc) return;
|
12996 |
|
12997 | if (!(0, _contains.default)(docElem, node)) return box;
|
12998 | if (node.getBoundingClientRect !== undefined) box = node.getBoundingClientRect();
|
12999 |
|
13000 | box = {
|
13001 | top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0),
|
13002 | left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0),
|
13003 | width: (box.width == null ? node.offsetWidth : box.width) || 0,
|
13004 | height: (box.height == null ? node.offsetHeight : box.height) || 0
|
13005 | };
|
13006 | return box;
|
13007 | }
|
13008 |
|
13009 | module.exports = exports["default"];
|
13010 |
|
13011 | }),
|
13012 |
|
13013 | (function(module, exports) {
|
13014 |
|
13015 | "use strict";
|
13016 |
|
13017 | exports.__esModule = true;
|
13018 | exports.default = getWindow;
|
13019 |
|
13020 | function getWindow(node) {
|
13021 | return node === node.window ? node : node.nodeType === 9 ? node.defaultView || node.parentWindow : false;
|
13022 | }
|
13023 |
|
13024 | module.exports = exports["default"];
|
13025 |
|
13026 | }),
|
13027 |
|
13028 | (function(module, exports, __webpack_require__) {
|
13029 |
|
13030 | "use strict";
|
13031 |
|
13032 | var _interopRequireDefault = __webpack_require__(14);
|
13033 |
|
13034 | exports.__esModule = true;
|
13035 | exports.default = position;
|
13036 |
|
13037 | var _extends2 = _interopRequireDefault(__webpack_require__(122));
|
13038 |
|
13039 | var _offset = _interopRequireDefault(__webpack_require__(119));
|
13040 |
|
13041 | var _offsetParent = _interopRequireDefault(__webpack_require__(123));
|
13042 |
|
13043 | var _scrollTop = _interopRequireDefault(__webpack_require__(124));
|
13044 |
|
13045 | var _scrollLeft = _interopRequireDefault(__webpack_require__(125));
|
13046 |
|
13047 | var _style = _interopRequireDefault(__webpack_require__(18));
|
13048 |
|
13049 | function nodeName(node) {
|
13050 | return node.nodeName && node.nodeName.toLowerCase();
|
13051 | }
|
13052 |
|
13053 | function position(node, offsetParent) {
|
13054 | var parentOffset = {
|
13055 | top: 0,
|
13056 | left: 0
|
13057 | },
|
13058 | offset;
|
13059 |
|
13060 |
|
13061 | if ((0, _style.default)(node, 'position') === 'fixed') {
|
13062 | offset = node.getBoundingClientRect();
|
13063 | } else {
|
13064 | offsetParent = offsetParent || (0, _offsetParent.default)(node);
|
13065 | offset = (0, _offset.default)(node);
|
13066 | if (nodeName(offsetParent) !== 'html') parentOffset = (0, _offset.default)(offsetParent);
|
13067 | parentOffset.top += parseInt((0, _style.default)(offsetParent, 'borderTopWidth'), 10) - (0, _scrollTop.default)(offsetParent) || 0;
|
13068 | parentOffset.left += parseInt((0, _style.default)(offsetParent, 'borderLeftWidth'), 10) - (0, _scrollLeft.default)(offsetParent) || 0;
|
13069 | }
|
13070 |
|
13071 |
|
13072 | return (0, _extends2.default)({}, offset, {
|
13073 | top: offset.top - parentOffset.top - (parseInt((0, _style.default)(node, 'marginTop'), 10) || 0),
|
13074 | left: offset.left - parentOffset.left - (parseInt((0, _style.default)(node, 'marginLeft'), 10) || 0)
|
13075 | });
|
13076 | }
|
13077 |
|
13078 | module.exports = exports["default"];
|
13079 |
|
13080 | }),
|
13081 |
|
13082 | (function(module, exports) {
|
13083 |
|
13084 | function _extends() {
|
13085 | module.exports = _extends = Object.assign || function (target) {
|
13086 | for (var i = 1; i < arguments.length; i++) {
|
13087 | var source = arguments[i];
|
13088 |
|
13089 | for (var key in source) {
|
13090 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
13091 | target[key] = source[key];
|
13092 | }
|
13093 | }
|
13094 | }
|
13095 |
|
13096 | return target;
|
13097 | };
|
13098 |
|
13099 | return _extends.apply(this, arguments);
|
13100 | }
|
13101 |
|
13102 | module.exports = _extends;
|
13103 |
|
13104 | }),
|
13105 |
|
13106 | (function(module, exports, __webpack_require__) {
|
13107 |
|
13108 | "use strict";
|
13109 |
|
13110 | var _interopRequireDefault = __webpack_require__(14);
|
13111 |
|
13112 | exports.__esModule = true;
|
13113 | exports.default = offsetParent;
|
13114 |
|
13115 | var _ownerDocument = _interopRequireDefault(__webpack_require__(75));
|
13116 |
|
13117 | var _style = _interopRequireDefault(__webpack_require__(18));
|
13118 |
|
13119 | function nodeName(node) {
|
13120 | return node.nodeName && node.nodeName.toLowerCase();
|
13121 | }
|
13122 |
|
13123 | function offsetParent(node) {
|
13124 | var doc = (0, _ownerDocument.default)(node),
|
13125 | offsetParent = node && node.offsetParent;
|
13126 |
|
13127 | while (offsetParent && nodeName(node) !== 'html' && (0, _style.default)(offsetParent, 'position') === 'static') {
|
13128 | offsetParent = offsetParent.offsetParent;
|
13129 | }
|
13130 |
|
13131 | return offsetParent || doc.documentElement;
|
13132 | }
|
13133 |
|
13134 | module.exports = exports["default"];
|
13135 |
|
13136 | }),
|
13137 |
|
13138 | (function(module, exports, __webpack_require__) {
|
13139 |
|
13140 | "use strict";
|
13141 |
|
13142 | var _interopRequireDefault = __webpack_require__(14);
|
13143 |
|
13144 | exports.__esModule = true;
|
13145 | exports.default = scrollTop;
|
13146 |
|
13147 | var _isWindow = _interopRequireDefault(__webpack_require__(120));
|
13148 |
|
13149 | function scrollTop(node, val) {
|
13150 | var win = (0, _isWindow.default)(node);
|
13151 | if (val === undefined) return win ? 'pageYOffset' in win ? win.pageYOffset : win.document.documentElement.scrollTop : node.scrollTop;
|
13152 | if (win) win.scrollTo('pageXOffset' in win ? win.pageXOffset : win.document.documentElement.scrollLeft, val);else node.scrollTop = val;
|
13153 | }
|
13154 |
|
13155 | module.exports = exports["default"];
|
13156 |
|
13157 | }),
|
13158 |
|
13159 | (function(module, exports, __webpack_require__) {
|
13160 |
|
13161 | "use strict";
|
13162 |
|
13163 | var _interopRequireDefault = __webpack_require__(14);
|
13164 |
|
13165 | exports.__esModule = true;
|
13166 | exports.default = scrollTop;
|
13167 |
|
13168 | var _isWindow = _interopRequireDefault(__webpack_require__(120));
|
13169 |
|
13170 | function scrollTop(node, val) {
|
13171 | var win = (0, _isWindow.default)(node);
|
13172 | if (val === undefined) return win ? 'pageXOffset' in win ? win.pageXOffset : win.document.documentElement.scrollLeft : node.scrollLeft;
|
13173 | if (win) win.scrollTo(val, 'pageYOffset' in win ? win.pageYOffset : win.document.documentElement.scrollTop);else node.scrollLeft = val;
|
13174 | }
|
13175 |
|
13176 | module.exports = exports["default"];
|
13177 |
|
13178 | }),
|
13179 |
|
13180 | (function(module, exports, __webpack_require__) {
|
13181 |
|
13182 | 'use strict';
|
13183 |
|
13184 | Object.defineProperty(exports, "__esModule", {
|
13185 | value: true
|
13186 | });
|
13187 |
|
13188 | exports["default"] = function (componentOrElement) {
|
13189 | return (0, _ownerWindow2["default"])(_reactDom2["default"].findDOMNode(componentOrElement));
|
13190 | };
|
13191 |
|
13192 | var _reactDom = __webpack_require__(2);
|
13193 |
|
13194 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
13195 |
|
13196 | var _ownerWindow = __webpack_require__(127);
|
13197 |
|
13198 | var _ownerWindow2 = _interopRequireDefault(_ownerWindow);
|
13199 |
|
13200 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
13201 |
|
13202 | module.exports = exports['default'];
|
13203 |
|
13204 | }),
|
13205 |
|
13206 | (function(module, exports, __webpack_require__) {
|
13207 |
|
13208 | "use strict";
|
13209 |
|
13210 | var _interopRequireDefault = __webpack_require__(14);
|
13211 |
|
13212 | exports.__esModule = true;
|
13213 | exports.default = ownerWindow;
|
13214 |
|
13215 | var _ownerDocument = _interopRequireDefault(__webpack_require__(75));
|
13216 |
|
13217 | function ownerWindow(node) {
|
13218 | var doc = (0, _ownerDocument.default)(node);
|
13219 | return doc && doc.defaultView || doc.parentWindow;
|
13220 | }
|
13221 |
|
13222 | module.exports = exports["default"];
|
13223 |
|
13224 | }),
|
13225 |
|
13226 | (function(module, exports, __webpack_require__) {
|
13227 |
|
13228 | 'use strict';
|
13229 |
|
13230 | Object.defineProperty(exports, "__esModule", {
|
13231 | value: true
|
13232 | });
|
13233 |
|
13234 | var _contains = __webpack_require__(111);
|
13235 |
|
13236 | var _contains2 = _interopRequireDefault(_contains);
|
13237 |
|
13238 | var _react = __webpack_require__(1);
|
13239 |
|
13240 | var _react2 = _interopRequireDefault(_react);
|
13241 |
|
13242 | var _propTypes = __webpack_require__(6);
|
13243 |
|
13244 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
13245 |
|
13246 | var _reactDom = __webpack_require__(2);
|
13247 |
|
13248 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
13249 |
|
13250 | var _addEventListener = __webpack_require__(76);
|
13251 |
|
13252 | var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
13253 |
|
13254 | var _ownerDocument = __webpack_require__(74);
|
13255 |
|
13256 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
13257 |
|
13258 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
13259 |
|
13260 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
13261 |
|
13262 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
13263 |
|
13264 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
13265 |
|
13266 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
13267 |
|
13268 | var propTypes = {
|
13269 | onRootClose: _propTypes2["default"].func,
|
13270 | children: _propTypes2["default"].element,
|
13271 | |
13272 |
|
13273 |
|
13274 | disabled: _propTypes2["default"].bool,
|
13275 | |
13276 |
|
13277 |
|
13278 | event: _propTypes2["default"].oneOf(['click', 'mousedown'])
|
13279 | };
|
13280 |
|
13281 | var defaultProps = {
|
13282 | event: 'click'
|
13283 | };
|
13284 |
|
13285 | function isLeftClickEvent(event) {
|
13286 | return event.button === 0;
|
13287 | }
|
13288 |
|
13289 | function isModifiedEvent(event) {
|
13290 | return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
13291 | }
|
13292 |
|
13293 | var RootCloseWrapper = function (_Component) {
|
13294 | _inherits(RootCloseWrapper, _Component);
|
13295 |
|
13296 | function RootCloseWrapper(props, context) {
|
13297 | _classCallCheck(this, RootCloseWrapper);
|
13298 |
|
13299 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
13300 |
|
13301 | _this.handleMouseCapture = function (e) {
|
13302 | _this.preventMouseRootClose = isModifiedEvent(e) || !isLeftClickEvent(e) || (0, _contains2["default"])(_reactDom2["default"].findDOMNode(_this), e.target);
|
13303 | };
|
13304 |
|
13305 | _this.handleMouse = function () {
|
13306 | if (!_this.preventMouseRootClose && _this.props.onRootClose) {
|
13307 | _this.props.onRootClose();
|
13308 | }
|
13309 | };
|
13310 |
|
13311 | _this.handleKeyUp = function (e) {
|
13312 | if (e.keyCode === 27 && _this.props.onRootClose) {
|
13313 | _this.props.onRootClose();
|
13314 | }
|
13315 | };
|
13316 |
|
13317 | _this.preventMouseRootClose = false;
|
13318 |
|
13319 | _this.addEventListeners = _this.addEventListeners.bind(_this);
|
13320 | _this.removeEventListeners = _this.removeEventListeners.bind(_this);
|
13321 |
|
13322 | return _this;
|
13323 | }
|
13324 |
|
13325 | RootCloseWrapper.prototype.componentDidMount = function componentDidMount() {
|
13326 | if (!this.props.disabled) {
|
13327 | this.addEventListeners();
|
13328 | }
|
13329 | };
|
13330 |
|
13331 | RootCloseWrapper.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
13332 | if (!this.props.disabled && prevProps.disabled) {
|
13333 | this.addEventListeners();
|
13334 | } else if (this.props.disabled && !prevProps.disabled) {
|
13335 | this.removeEventListeners();
|
13336 | }
|
13337 | };
|
13338 |
|
13339 | RootCloseWrapper.prototype.componentWillUnmount = function componentWillUnmount() {
|
13340 | if (!this.props.disabled) {
|
13341 | this.removeEventListeners();
|
13342 | }
|
13343 | };
|
13344 |
|
13345 | RootCloseWrapper.prototype.addEventListeners = function addEventListeners() {
|
13346 | var event = this.props.event;
|
13347 |
|
13348 | var doc = (0, _ownerDocument2["default"])(this);
|
13349 |
|
13350 |
|
13351 | this.documentMouseCaptureListener = (0, _addEventListener2["default"])(doc, event, this.handleMouseCapture, true);
|
13352 |
|
13353 | this.documentMouseListener = (0, _addEventListener2["default"])(doc, event, this.handleMouse);
|
13354 |
|
13355 | this.documentKeyupListener = (0, _addEventListener2["default"])(doc, 'keyup', this.handleKeyUp);
|
13356 | };
|
13357 |
|
13358 | RootCloseWrapper.prototype.removeEventListeners = function removeEventListeners() {
|
13359 | if (this.documentMouseCaptureListener) {
|
13360 | this.documentMouseCaptureListener.remove();
|
13361 | }
|
13362 |
|
13363 | if (this.documentMouseListener) {
|
13364 | this.documentMouseListener.remove();
|
13365 | }
|
13366 |
|
13367 | if (this.documentKeyupListener) {
|
13368 | this.documentKeyupListener.remove();
|
13369 | }
|
13370 | };
|
13371 |
|
13372 | RootCloseWrapper.prototype.render = function render() {
|
13373 | return this.props.children;
|
13374 | };
|
13375 |
|
13376 | return RootCloseWrapper;
|
13377 | }(_react.Component);
|
13378 |
|
13379 | RootCloseWrapper.propTypes = propTypes;
|
13380 |
|
13381 | RootCloseWrapper.defaultProps = defaultProps;
|
13382 |
|
13383 | exports["default"] = RootCloseWrapper;
|
13384 | module.exports = exports['default'];
|
13385 |
|
13386 | }),
|
13387 |
|
13388 | (function(module, exports, __webpack_require__) {
|
13389 |
|
13390 | 'use strict';
|
13391 |
|
13392 | Object.defineProperty(exports, "__esModule", {
|
13393 | value: true
|
13394 | });
|
13395 |
|
13396 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
13397 |
|
13398 | var _classnames = __webpack_require__(5);
|
13399 |
|
13400 | var _classnames2 = _interopRequireDefault(_classnames);
|
13401 |
|
13402 | var _propTypes = __webpack_require__(6);
|
13403 |
|
13404 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
13405 |
|
13406 | var _react = __webpack_require__(1);
|
13407 |
|
13408 | var _react2 = _interopRequireDefault(_react);
|
13409 |
|
13410 | var _Transition = __webpack_require__(130);
|
13411 |
|
13412 | var _Transition2 = _interopRequireDefault(_Transition);
|
13413 |
|
13414 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
13415 |
|
13416 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
13417 |
|
13418 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
13419 |
|
13420 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
13421 |
|
13422 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
13423 |
|
13424 | var propTypes = {
|
13425 | |
13426 |
|
13427 |
|
13428 | "in": _propTypes2["default"].bool,
|
13429 |
|
13430 | |
13431 |
|
13432 |
|
13433 | unmountOnExit: _propTypes2["default"].bool,
|
13434 |
|
13435 | |
13436 |
|
13437 |
|
13438 |
|
13439 | transitionAppear: _propTypes2["default"].bool,
|
13440 |
|
13441 | |
13442 |
|
13443 |
|
13444 |
|
13445 |
|
13446 | timeout: _propTypes2["default"].number,
|
13447 |
|
13448 | |
13449 |
|
13450 |
|
13451 | onEnter: _propTypes2["default"].func,
|
13452 | |
13453 |
|
13454 |
|
13455 | onEntering: _propTypes2["default"].func,
|
13456 | |
13457 |
|
13458 |
|
13459 | onEntered: _propTypes2["default"].func,
|
13460 | |
13461 |
|
13462 |
|
13463 | onExit: _propTypes2["default"].func,
|
13464 | |
13465 |
|
13466 |
|
13467 | onExiting: _propTypes2["default"].func,
|
13468 | |
13469 |
|
13470 |
|
13471 | onExited: _propTypes2["default"].func
|
13472 | };
|
13473 |
|
13474 | var defaultProps = {
|
13475 | "in": false,
|
13476 | timeout: 300,
|
13477 | unmountOnExit: false,
|
13478 | transitionAppear: false
|
13479 | };
|
13480 |
|
13481 | var Fade = function (_React$Component) {
|
13482 | _inherits(Fade, _React$Component);
|
13483 |
|
13484 | function Fade() {
|
13485 | _classCallCheck(this, Fade);
|
13486 |
|
13487 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
13488 | }
|
13489 |
|
13490 | Fade.prototype.render = function render() {
|
13491 | return _react2["default"].createElement(_Transition2["default"], _extends({}, this.props, {
|
13492 | className: (0, _classnames2["default"])(this.props.className, 'fade'),
|
13493 | enteredClassName: 'in',
|
13494 | enteringClassName: 'in'
|
13495 | }));
|
13496 | };
|
13497 |
|
13498 | return Fade;
|
13499 | }(_react2["default"].Component);
|
13500 |
|
13501 | Fade.propTypes = propTypes;
|
13502 | Fade.defaultProps = defaultProps;
|
13503 |
|
13504 | exports["default"] = Fade;
|
13505 | module.exports = exports['default'];
|
13506 |
|
13507 | }),
|
13508 |
|
13509 | (function(module, exports, __webpack_require__) {
|
13510 |
|
13511 | 'use strict';
|
13512 |
|
13513 | Object.defineProperty(exports, "__esModule", {
|
13514 | value: true
|
13515 | });
|
13516 | exports.EXITING = exports.ENTERED = exports.ENTERING = exports.EXITED = exports.UNMOUNTED = undefined;
|
13517 |
|
13518 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
13519 |
|
13520 | var _react = __webpack_require__(1);
|
13521 |
|
13522 | var _react2 = _interopRequireDefault(_react);
|
13523 |
|
13524 | var _propTypes = __webpack_require__(6);
|
13525 |
|
13526 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
13527 |
|
13528 | var _reactDom = __webpack_require__(2);
|
13529 |
|
13530 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
13531 |
|
13532 | var _properties = __webpack_require__(13);
|
13533 |
|
13534 | var _properties2 = _interopRequireDefault(_properties);
|
13535 |
|
13536 | var _on = __webpack_require__(16);
|
13537 |
|
13538 | var _on2 = _interopRequireDefault(_on);
|
13539 |
|
13540 | var _classnames = __webpack_require__(5);
|
13541 |
|
13542 | var _classnames2 = _interopRequireDefault(_classnames);
|
13543 |
|
13544 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
13545 |
|
13546 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
13547 |
|
13548 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
13549 |
|
13550 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
13551 |
|
13552 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
13553 |
|
13554 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
13555 |
|
13556 | var transitionEndEvent = _properties2["default"].end;
|
13557 |
|
13558 |
|
13559 | var UNMOUNTED = exports.UNMOUNTED = 0;
|
13560 | var EXITED = exports.EXITED = 1;
|
13561 | var ENTERING = exports.ENTERING = 2;
|
13562 | var ENTERED = exports.ENTERED = 3;
|
13563 | var EXITING = exports.EXITING = 4;
|
13564 |
|
13565 | var propTypes = {
|
13566 | |
13567 |
|
13568 |
|
13569 | "in": _propTypes2["default"].bool,
|
13570 |
|
13571 | |
13572 |
|
13573 |
|
13574 | unmountOnExit: _propTypes2["default"].bool,
|
13575 |
|
13576 | |
13577 |
|
13578 |
|
13579 | transitionAppear: _propTypes2["default"].bool,
|
13580 |
|
13581 | |
13582 |
|
13583 |
|
13584 | timeout: _propTypes2["default"].number,
|
13585 |
|
13586 | |
13587 |
|
13588 |
|
13589 | exitedClassName: _propTypes2["default"].string,
|
13590 | |
13591 |
|
13592 |
|
13593 | exitingClassName: _propTypes2["default"].string,
|
13594 | |
13595 |
|
13596 |
|
13597 | enteredClassName: _propTypes2["default"].string,
|
13598 | |
13599 |
|
13600 |
|
13601 | enteringClassName: _propTypes2["default"].string,
|
13602 |
|
13603 | |
13604 |
|
13605 |
|
13606 | onEnter: _propTypes2["default"].func,
|
13607 | |
13608 |
|
13609 |
|
13610 | onEntering: _propTypes2["default"].func,
|
13611 | |
13612 |
|
13613 |
|
13614 | onEntered: _propTypes2["default"].func,
|
13615 | |
13616 |
|
13617 |
|
13618 | onExit: _propTypes2["default"].func,
|
13619 | |
13620 |
|
13621 |
|
13622 | onExiting: _propTypes2["default"].func,
|
13623 | |
13624 |
|
13625 |
|
13626 | onExited: _propTypes2["default"].func
|
13627 | };
|
13628 |
|
13629 | function noop() {}
|
13630 |
|
13631 | var defaultProps = {
|
13632 | "in": false,
|
13633 | unmountOnExit: false,
|
13634 | transitionAppear: false,
|
13635 | timeout: 5000,
|
13636 | onEnter: noop,
|
13637 | onEntering: noop,
|
13638 | onEntered: noop,
|
13639 | onExit: noop,
|
13640 | onExiting: noop,
|
13641 | onExited: noop
|
13642 | };
|
13643 |
|
13644 | |
13645 |
|
13646 |
|
13647 |
|
13648 | var Transition = function (_Component) {
|
13649 | _inherits(Transition, _Component);
|
13650 |
|
13651 | function Transition(props, context) {
|
13652 | _classCallCheck(this, Transition);
|
13653 |
|
13654 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
13655 |
|
13656 | var initialStatus = void 0;
|
13657 | if (props["in"]) {
|
13658 |
|
13659 | initialStatus = props.transitionAppear ? EXITED : ENTERED;
|
13660 | } else {
|
13661 | initialStatus = props.unmountOnExit ? UNMOUNTED : EXITED;
|
13662 | }
|
13663 | _this.state = { status: initialStatus };
|
13664 |
|
13665 | _this.nextCallback = null;
|
13666 |
|
13667 | _this.performEnter = _this.performEnter.bind(_this);
|
13668 | _this.performExit = _this.performExit.bind(_this);
|
13669 | _this.cancelNextCallback = _this.cancelNextCallback.bind(_this);
|
13670 | _this.onTransitionEnd = _this.onTransitionEnd.bind(_this);
|
13671 | _this.safeSetState = _this.safeSetState.bind(_this);
|
13672 | _this.setNextCallback = _this.setNextCallback.bind(_this);
|
13673 |
|
13674 | return _this;
|
13675 | }
|
13676 |
|
13677 | Transition.prototype.componentDidMount = function componentDidMount() {
|
13678 | if (this.props.transitionAppear && this.props["in"]) {
|
13679 | this.performEnter(this.props);
|
13680 | }
|
13681 | };
|
13682 |
|
13683 | Transition.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
13684 | if (nextProps["in"] && this.props.unmountOnExit) {
|
13685 | if (this.state.status === UNMOUNTED) {
|
13686 |
|
13687 | this.setState({ status: EXITED });
|
13688 | }
|
13689 | } else {
|
13690 | this._needsUpdate = true;
|
13691 | }
|
13692 | };
|
13693 |
|
13694 | Transition.prototype.componentDidUpdate = function componentDidUpdate() {
|
13695 | var status = this.state.status;
|
13696 |
|
13697 | if (this.props.unmountOnExit && status === EXITED) {
|
13698 |
|
13699 | if (this.props["in"]) {
|
13700 | this.performEnter(this.props);
|
13701 | } else {
|
13702 | this.setState({ status: UNMOUNTED });
|
13703 | }
|
13704 |
|
13705 | return;
|
13706 | }
|
13707 |
|
13708 |
|
13709 | if (this._needsUpdate) {
|
13710 | this._needsUpdate = false;
|
13711 |
|
13712 | if (this.props["in"]) {
|
13713 | if (status === EXITING) {
|
13714 | this.performEnter(this.props);
|
13715 | } else if (status === EXITED) {
|
13716 | this.performEnter(this.props);
|
13717 | }
|
13718 |
|
13719 | } else {
|
13720 | if (status === ENTERING || status === ENTERED) {
|
13721 | this.performExit(this.props);
|
13722 | }
|
13723 |
|
13724 | }
|
13725 | }
|
13726 | };
|
13727 |
|
13728 | Transition.prototype.componentWillUnmount = function componentWillUnmount() {
|
13729 | this.cancelNextCallback();
|
13730 | };
|
13731 |
|
13732 | Transition.prototype.performEnter = function performEnter(props) {
|
13733 | var _this2 = this;
|
13734 |
|
13735 | this.cancelNextCallback();
|
13736 | var node = _reactDom2["default"].findDOMNode(this);
|
13737 |
|
13738 |
|
13739 | props.onEnter(node);
|
13740 |
|
13741 | this.safeSetState({ status: ENTERING }, function () {
|
13742 | _this2.props.onEntering(node);
|
13743 |
|
13744 | _this2.onTransitionEnd(node, function () {
|
13745 | _this2.safeSetState({ status: ENTERED }, function () {
|
13746 | _this2.props.onEntered(node);
|
13747 | });
|
13748 | });
|
13749 | });
|
13750 | };
|
13751 |
|
13752 | Transition.prototype.performExit = function performExit(props) {
|
13753 | var _this3 = this;
|
13754 |
|
13755 | this.cancelNextCallback();
|
13756 | var node = _reactDom2["default"].findDOMNode(this);
|
13757 |
|
13758 | props.onExit(node);
|
13759 |
|
13760 | this.safeSetState({ status: EXITING }, function () {
|
13761 | _this3.props.onExiting(node);
|
13762 |
|
13763 | _this3.onTransitionEnd(node, function () {
|
13764 | _this3.safeSetState({ status: EXITED }, function () {
|
13765 | _this3.props.onExited(node);
|
13766 | });
|
13767 | });
|
13768 | });
|
13769 | };
|
13770 |
|
13771 | Transition.prototype.cancelNextCallback = function cancelNextCallback() {
|
13772 | if (this.nextCallback !== null) {
|
13773 | this.nextCallback.cancel();
|
13774 | this.nextCallback = null;
|
13775 | }
|
13776 | };
|
13777 |
|
13778 | Transition.prototype.safeSetState = function safeSetState(nextState, callback) {
|
13779 |
|
13780 | this.setState(nextState, this.setNextCallback(callback));
|
13781 | };
|
13782 |
|
13783 | Transition.prototype.setNextCallback = function setNextCallback(callback) {
|
13784 | var _this4 = this;
|
13785 |
|
13786 | var active = true;
|
13787 |
|
13788 | this.nextCallback = function (event) {
|
13789 | if (active) {
|
13790 | active = false;
|
13791 | _this4.nextCallback = null;
|
13792 |
|
13793 | callback(event);
|
13794 | }
|
13795 | };
|
13796 |
|
13797 | this.nextCallback.cancel = function () {
|
13798 | active = false;
|
13799 | };
|
13800 |
|
13801 | return this.nextCallback;
|
13802 | };
|
13803 |
|
13804 | Transition.prototype.onTransitionEnd = function onTransitionEnd(node, handler) {
|
13805 | this.setNextCallback(handler);
|
13806 |
|
13807 | if (node) {
|
13808 | (0, _on2["default"])(node, transitionEndEvent, this.nextCallback);
|
13809 | setTimeout(this.nextCallback, this.props.timeout);
|
13810 | } else {
|
13811 | setTimeout(this.nextCallback, 0);
|
13812 | }
|
13813 | };
|
13814 |
|
13815 | Transition.prototype.render = function render() {
|
13816 | var status = this.state.status;
|
13817 | if (status === UNMOUNTED) {
|
13818 | return null;
|
13819 | }
|
13820 |
|
13821 | var _props = this.props,
|
13822 | children = _props.children,
|
13823 | className = _props.className,
|
13824 | childProps = _objectWithoutProperties(_props, ['children', 'className']);
|
13825 |
|
13826 | Object.keys(Transition.propTypes).forEach(function (key) {
|
13827 | return delete childProps[key];
|
13828 | });
|
13829 |
|
13830 | var transitionClassName = void 0;
|
13831 | if (status === EXITED) {
|
13832 | transitionClassName = this.props.exitedClassName;
|
13833 | } else if (status === ENTERING) {
|
13834 | transitionClassName = this.props.enteringClassName;
|
13835 | } else if (status === ENTERED) {
|
13836 | transitionClassName = this.props.enteredClassName;
|
13837 | } else if (status === EXITING) {
|
13838 | transitionClassName = this.props.exitingClassName;
|
13839 | }
|
13840 |
|
13841 | var child = _react2["default"].Children.only(children);
|
13842 | return _react2["default"].cloneElement(child, _extends({}, childProps, {
|
13843 | className: (0, _classnames2["default"])(child.props.className, className, transitionClassName)
|
13844 | }));
|
13845 | };
|
13846 |
|
13847 | return Transition;
|
13848 | }(_react.Component);
|
13849 |
|
13850 | Transition.propTypes = propTypes;
|
13851 |
|
13852 | Transition.defaultProps = defaultProps;
|
13853 |
|
13854 | exports["default"] = Transition;
|
13855 |
|
13856 | }),
|
13857 |
|
13858 | (function(module, exports) {
|
13859 |
|
13860 | 'use strict';
|
13861 |
|
13862 | Object.defineProperty(exports, "__esModule", {
|
13863 | value: true
|
13864 | });
|
13865 | |
13866 |
|
13867 |
|
13868 |
|
13869 |
|
13870 |
|
13871 |
|
13872 |
|
13873 |
|
13874 | function createChainedFunction() {
|
13875 | for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
|
13876 | funcs[_key] = arguments[_key];
|
13877 | }
|
13878 |
|
13879 | return funcs.filter(function (f) {
|
13880 | return f != null;
|
13881 | }).reduce(function (acc, f) {
|
13882 | if (typeof f !== 'function') {
|
13883 | throw new Error('Invalid Argument Type, must only provide functions, undefined, or null.');
|
13884 | }
|
13885 |
|
13886 | if (acc === null) {
|
13887 | return f;
|
13888 | }
|
13889 |
|
13890 | return function chainedFunction() {
|
13891 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
13892 | args[_key2] = arguments[_key2];
|
13893 | }
|
13894 |
|
13895 | acc.apply(this, args);
|
13896 | f.apply(this, args);
|
13897 | };
|
13898 | }, null);
|
13899 | }
|
13900 |
|
13901 | exports["default"] = createChainedFunction;
|
13902 | module.exports = exports['default'];
|
13903 |
|
13904 | }),
|
13905 |
|
13906 | (function(module, exports) {
|
13907 |
|
13908 | 'use strict';
|
13909 |
|
13910 | Object.defineProperty(exports, "__esModule", {
|
13911 | value: true
|
13912 | });
|
13913 |
|
13914 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
13915 |
|
13916 | exports.getComponentLocale = getComponentLocale;
|
13917 | exports.getLocaleCode = getLocaleCode;
|
13918 | function getComponentLocale(props, context, componentName, getDefaultLocale) {
|
13919 | var locale = {};
|
13920 | if (context && context.beeLocale && context.beeLocale[componentName]) {
|
13921 | locale = context.beeLocale[componentName];
|
13922 | } else {
|
13923 | var defaultLocale = getDefaultLocale();
|
13924 |
|
13925 | locale = defaultLocale["default"] || defaultLocale;
|
13926 | }
|
13927 |
|
13928 | var result = _extends({}, locale, props.locale);
|
13929 | if (props.locale) {
|
13930 | result.lang = _extends({}, locale.lang, props.locale.lang);
|
13931 | } else {
|
13932 | result.lang = _extends({}, locale.lang);
|
13933 | }
|
13934 |
|
13935 | return result;
|
13936 | }
|
13937 |
|
13938 | function getLocaleCode(context) {
|
13939 | var localeCode = context.beeLocale && context.beeLocale.lang;
|
13940 |
|
13941 | if (context.beeLocale && context.beeLocale.exist && !localeCode) {
|
13942 | return 'zh-cn';
|
13943 | }
|
13944 | return localeCode;
|
13945 | }
|
13946 |
|
13947 | }),
|
13948 |
|
13949 | (function(module, exports) {
|
13950 |
|
13951 | 'use strict';
|
13952 |
|
13953 | module.exports = {
|
13954 | 'lang': 'zh-cn',
|
13955 | 'copy': '复制',
|
13956 | 'cut': '剪切',
|
13957 | 'copyReady': '已复制',
|
13958 | 'cutReady': '已剪切',
|
13959 | 'copyToClipboard': '复制到剪切板',
|
13960 | 'close': '关闭',
|
13961 |
|
13962 | 'en-us': {
|
13963 | 'copy': 'copy',
|
13964 | 'cut': 'cut',
|
13965 | 'copyReady': 'copied',
|
13966 | 'cutReady': 'cut',
|
13967 | 'copyToClipboard': 'copy to clipboard',
|
13968 | 'close': 'close'
|
13969 | },
|
13970 | 'zh-tw': {
|
13971 | 'copy': '複製',
|
13972 | 'cut': '剪切',
|
13973 | 'copyReady': '已複製',
|
13974 | 'cutReady': '已剪切',
|
13975 | 'copyToClipboard': '複製到剪切板',
|
13976 | 'close': '關閉'
|
13977 | }
|
13978 | };
|
13979 |
|
13980 | }),
|
13981 |
|
13982 | (function(module, exports, __webpack_require__) {
|
13983 |
|
13984 | 'use strict';
|
13985 |
|
13986 | Object.defineProperty(exports, "__esModule", {
|
13987 | value: true
|
13988 | });
|
13989 |
|
13990 | var _Modal = __webpack_require__(135);
|
13991 |
|
13992 | var _Modal2 = _interopRequireDefault(_Modal);
|
13993 |
|
13994 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
13995 |
|
13996 | exports["default"] = _Modal2["default"];
|
13997 | module.exports = exports['default'];
|
13998 |
|
13999 | }),
|
14000 |
|
14001 | (function(module, exports, __webpack_require__) {
|
14002 |
|
14003 | 'use strict';
|
14004 |
|
14005 | Object.defineProperty(exports, "__esModule", {
|
14006 | value: true
|
14007 | });
|
14008 |
|
14009 | var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
14010 |
|
14011 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
14012 |
|
14013 | var _classnames = __webpack_require__(5);
|
14014 |
|
14015 | var _classnames2 = _interopRequireDefault(_classnames);
|
14016 |
|
14017 | var _events = __webpack_require__(136);
|
14018 |
|
14019 | var _events2 = _interopRequireDefault(_events);
|
14020 |
|
14021 | var _ownerDocument = __webpack_require__(75);
|
14022 |
|
14023 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
14024 |
|
14025 | var _inDOM = __webpack_require__(15);
|
14026 |
|
14027 | var _inDOM2 = _interopRequireDefault(_inDOM);
|
14028 |
|
14029 | var _scrollbarSize = __webpack_require__(140);
|
14030 |
|
14031 | var _scrollbarSize2 = _interopRequireDefault(_scrollbarSize);
|
14032 |
|
14033 | var _react = __webpack_require__(1);
|
14034 |
|
14035 | var _react2 = _interopRequireDefault(_react);
|
14036 |
|
14037 | var _reactDom = __webpack_require__(2);
|
14038 |
|
14039 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
14040 |
|
14041 | var _Modal = __webpack_require__(141);
|
14042 |
|
14043 | var _Modal2 = _interopRequireDefault(_Modal);
|
14044 |
|
14045 | var _isOverflowing = __webpack_require__(144);
|
14046 |
|
14047 | var _isOverflowing2 = _interopRequireDefault(_isOverflowing);
|
14048 |
|
14049 | var _tinperBeeCore = __webpack_require__(27);
|
14050 |
|
14051 | var _beeTransition = __webpack_require__(11);
|
14052 |
|
14053 | var _ModalBody = __webpack_require__(148);
|
14054 |
|
14055 | var _ModalBody2 = _interopRequireDefault(_ModalBody);
|
14056 |
|
14057 | var _ModalDialog = __webpack_require__(149);
|
14058 |
|
14059 | var _ModalDialog2 = _interopRequireDefault(_ModalDialog);
|
14060 |
|
14061 | var _ModalFooter = __webpack_require__(150);
|
14062 |
|
14063 | var _ModalFooter2 = _interopRequireDefault(_ModalFooter);
|
14064 |
|
14065 | var _ModalHeader = __webpack_require__(151);
|
14066 |
|
14067 | var _ModalHeader2 = _interopRequireDefault(_ModalHeader);
|
14068 |
|
14069 | var _ModalTitle = __webpack_require__(152);
|
14070 |
|
14071 | var _ModalTitle2 = _interopRequireDefault(_ModalTitle);
|
14072 |
|
14073 | var _propTypes = __webpack_require__(6);
|
14074 |
|
14075 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
14076 |
|
14077 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
14078 |
|
14079 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
14080 |
|
14081 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
14082 |
|
14083 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
14084 |
|
14085 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
14086 |
|
14087 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
14088 |
|
14089 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
14090 |
|
14091 | var propTypes = _extends({}, _Modal2["default"].propTypes, _ModalDialog2["default"].propTypes, {
|
14092 |
|
14093 | |
14094 |
|
14095 |
|
14096 | backdrop: _propTypes2["default"].oneOf(['static', true, false]),
|
14097 |
|
14098 | |
14099 |
|
14100 |
|
14101 | backdropClosable: _propTypes2["default"].bool,
|
14102 | |
14103 |
|
14104 |
|
14105 | keyboard: _propTypes2["default"].bool,
|
14106 |
|
14107 | |
14108 |
|
14109 |
|
14110 | animation: _propTypes2["default"].bool,
|
14111 |
|
14112 | |
14113 |
|
14114 |
|
14115 | dialogComponentClass: _tinperBeeCore.elementType,
|
14116 |
|
14117 | |
14118 |
|
14119 |
|
14120 | autoFocus: _propTypes2["default"].bool,
|
14121 |
|
14122 | |
14123 |
|
14124 |
|
14125 | enforceFocus: _propTypes2["default"].bool,
|
14126 |
|
14127 | |
14128 |
|
14129 |
|
14130 | show: _propTypes2["default"].bool,
|
14131 |
|
14132 | |
14133 |
|
14134 |
|
14135 | onHide: _propTypes2["default"].func,
|
14136 |
|
14137 | onEnter: _propTypes2["default"].func,
|
14138 |
|
14139 | onEntering: _propTypes2["default"].func,
|
14140 |
|
14141 | onEntered: _propTypes2["default"].func,
|
14142 |
|
14143 | onExit: _propTypes2["default"].func,
|
14144 |
|
14145 | onExiting: _propTypes2["default"].func,
|
14146 |
|
14147 | onExited: _propTypes2["default"].func,
|
14148 |
|
14149 | |
14150 |
|
14151 |
|
14152 | container: _Modal2["default"].propTypes.container,
|
14153 |
|
14154 | |
14155 |
|
14156 |
|
14157 | size: _propTypes2["default"].oneOf(["sm", "lg", "xlg", ""]),
|
14158 | |
14159 |
|
14160 |
|
14161 | width: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string])
|
14162 | });
|
14163 |
|
14164 | var defaultProps = _extends({}, _Modal2["default"].defaultProps, {
|
14165 | backdropClosable: true,
|
14166 | animation: true,
|
14167 | dialogComponentClass: _ModalDialog2["default"],
|
14168 | clsPrefix: 'u-modal'
|
14169 | });
|
14170 |
|
14171 | var childContextTypes = {
|
14172 | $u_modal: _propTypes2["default"].shape({
|
14173 | onHide: _propTypes2["default"].func
|
14174 | })
|
14175 | };
|
14176 |
|
14177 | var Modal = function (_React$Component) {
|
14178 | _inherits(Modal, _React$Component);
|
14179 |
|
14180 | function Modal(props, context) {
|
14181 | _classCallCheck(this, Modal);
|
14182 |
|
14183 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
14184 |
|
14185 | _this.handleEntering = _this.handleEntering.bind(_this);
|
14186 | _this.handleExited = _this.handleExited.bind(_this);
|
14187 | _this.handleWindowResize = _this.handleWindowResize.bind(_this);
|
14188 | _this.handleDialogClick = _this.handleDialogClick.bind(_this);
|
14189 |
|
14190 | _this.state = {
|
14191 | style: {}
|
14192 | };
|
14193 | return _this;
|
14194 | }
|
14195 |
|
14196 | Modal.prototype.getChildContext = function getChildContext() {
|
14197 | return {
|
14198 | $u_modal: {
|
14199 | onHide: this.props.onHide
|
14200 | }
|
14201 | };
|
14202 | };
|
14203 |
|
14204 | Modal.prototype.componentWillUnmount = function componentWillUnmount() {
|
14205 |
|
14206 | this.handleExited();
|
14207 | };
|
14208 |
|
14209 | Modal.prototype.handleEntering = function handleEntering() {
|
14210 |
|
14211 | _events2["default"].on(window, 'resize', this.handleWindowResize);
|
14212 | this.updateStyle();
|
14213 | };
|
14214 |
|
14215 | Modal.prototype.handleExited = function handleExited() {
|
14216 |
|
14217 | _events2["default"].off(window, 'resize', this.handleWindowResize);
|
14218 | };
|
14219 |
|
14220 | Modal.prototype.handleWindowResize = function handleWindowResize() {
|
14221 | this.updateStyle();
|
14222 | };
|
14223 |
|
14224 | Modal.prototype.handleDialogClick = function handleDialogClick(e) {
|
14225 | if (e.target !== e.currentTarget) {
|
14226 | return;
|
14227 | }
|
14228 |
|
14229 | this.props.onHide();
|
14230 | };
|
14231 |
|
14232 | Modal.prototype.updateStyle = function updateStyle() {
|
14233 | if (!_inDOM2["default"] || !this._modal) {
|
14234 | return;
|
14235 | }
|
14236 |
|
14237 | var dialogNode = this._modal.getDialogElement();
|
14238 | var dialogHeight = dialogNode.scrollHeight;
|
14239 |
|
14240 | var document = (0, _ownerDocument2["default"])(dialogNode);
|
14241 | var bodyIsOverflowing = (0, _isOverflowing2["default"])(_reactDom2["default"].findDOMNode(this.props.container || document.body));
|
14242 | var modalIsOverflowing = dialogHeight > document.documentElement.clientHeight;
|
14243 |
|
14244 | this.setState({
|
14245 | style: {
|
14246 | paddingRight: bodyIsOverflowing && !modalIsOverflowing ? (0, _scrollbarSize2["default"])() : undefined,
|
14247 | paddingLeft: !bodyIsOverflowing && modalIsOverflowing ? (0, _scrollbarSize2["default"])() : undefined
|
14248 | }
|
14249 | });
|
14250 | };
|
14251 |
|
14252 | Modal.prototype.render = function render() {
|
14253 | var _this2 = this;
|
14254 |
|
14255 | var _props = this.props,
|
14256 | backdrop = _props.backdrop,
|
14257 | backdropClosable = _props.backdropClosable,
|
14258 | animation = _props.animation,
|
14259 | show = _props.show,
|
14260 | Dialog = _props.dialogComponentClass,
|
14261 | className = _props.className,
|
14262 | clsPrefix = _props.clsPrefix,
|
14263 | _props$style = _props.style,
|
14264 | style = _props$style === undefined ? {} : _props$style,
|
14265 | size = _props.size,
|
14266 | width = _props.width,
|
14267 | children = _props.children,
|
14268 | onEntering = _props.onEntering,
|
14269 | onExited = _props.onExited,
|
14270 | props = _objectWithoutProperties(_props, ['backdrop', 'backdropClosable', 'animation', 'show', 'dialogComponentClass', 'className', 'clsPrefix', 'style', 'size', 'width', 'children', 'onEntering', 'onExited']);
|
14271 |
|
14272 | var _splitComponent = (0, _tinperBeeCore.splitComponent)(props, _Modal2["default"]),
|
14273 | _splitComponent2 = _slicedToArray(_splitComponent, 2),
|
14274 | baseModalProps = _splitComponent2[0],
|
14275 | dialogProps = _splitComponent2[1];
|
14276 |
|
14277 | var inClassName = show && !animation && 'in';
|
14278 |
|
14279 | var backdropClasses = _defineProperty({}, clsPrefix + '-backdrop', true);
|
14280 | var containerClasses = _defineProperty({}, clsPrefix + '-open', true);
|
14281 | if (Number(width)) width += 'px';
|
14282 |
|
14283 | var styleRes = _extends({}, this.state.style, style);
|
14284 | if (width) {
|
14285 | _extends(styleRes, { width: width });
|
14286 | }
|
14287 | return _react2["default"].createElement(
|
14288 | _Modal2["default"],
|
14289 | _extends({}, baseModalProps, {
|
14290 | ref: function ref(c) {
|
14291 | _this2._modal = c;
|
14292 | },
|
14293 | show: show,
|
14294 | onEntering: (0, _tinperBeeCore.createChainedFunction)(onEntering, this.handleEntering),
|
14295 | onExited: (0, _tinperBeeCore.createChainedFunction)(onExited, this.handleExited),
|
14296 | backdrop: backdrop,
|
14297 | backdropClassName: (0, _classnames2["default"])(backdropClasses, inClassName),
|
14298 | containerClassName: (0, _classnames2["default"])(containerClasses),
|
14299 | transition: animation ? _beeTransition.Fade : undefined,
|
14300 | dialogTransitionTimeout: Modal.TRANSITION_DURATION,
|
14301 | backdropTransitionTimeout: Modal.BACKDROP_TRANSITION_DURATION
|
14302 | }),
|
14303 | _react2["default"].createElement(
|
14304 | Dialog,
|
14305 | _extends({}, dialogProps, {
|
14306 | style: styleRes,
|
14307 | className: (0, _classnames2["default"])(className, inClassName),
|
14308 | onClick: backdrop === true && !!backdropClosable ? this.handleDialogClick : null,
|
14309 | size: size
|
14310 | }),
|
14311 | children
|
14312 | )
|
14313 | );
|
14314 | };
|
14315 |
|
14316 | return Modal;
|
14317 | }(_react2["default"].Component);
|
14318 |
|
14319 | Modal.propTypes = propTypes;
|
14320 | Modal.defaultProps = defaultProps;
|
14321 | Modal.childContextTypes = childContextTypes;
|
14322 |
|
14323 | Modal.Body = _ModalBody2["default"];
|
14324 | Modal.Header = _ModalHeader2["default"];
|
14325 | Modal.Title = _ModalTitle2["default"];
|
14326 | Modal.Footer = _ModalFooter2["default"];
|
14327 |
|
14328 | Modal.Dialog = _ModalDialog2["default"];
|
14329 |
|
14330 | Modal.TRANSITION_DURATION = 200000;
|
14331 | Modal.BACKDROP_TRANSITION_DURATION = 10000;
|
14332 |
|
14333 | exports["default"] = Modal;
|
14334 | module.exports = exports['default'];
|
14335 |
|
14336 | }),
|
14337 |
|
14338 | (function(module, exports, __webpack_require__) {
|
14339 |
|
14340 | "use strict";
|
14341 |
|
14342 | var _interopRequireDefault = __webpack_require__(14);
|
14343 |
|
14344 | exports.__esModule = true;
|
14345 | exports.default = void 0;
|
14346 |
|
14347 | var _on = _interopRequireDefault(__webpack_require__(16));
|
14348 |
|
14349 | exports.on = _on.default;
|
14350 |
|
14351 | var _off = _interopRequireDefault(__webpack_require__(77));
|
14352 |
|
14353 | exports.off = _off.default;
|
14354 |
|
14355 | var _filter = _interopRequireDefault(__webpack_require__(137));
|
14356 |
|
14357 | exports.filter = _filter.default;
|
14358 |
|
14359 | var _listen = _interopRequireDefault(__webpack_require__(139));
|
14360 |
|
14361 | exports.listen = _listen.default;
|
14362 | var _default = {
|
14363 | on: _on.default,
|
14364 | off: _off.default,
|
14365 | filter: _filter.default,
|
14366 | listen: _listen.default
|
14367 | };
|
14368 | exports.default = _default;
|
14369 |
|
14370 | }),
|
14371 |
|
14372 | (function(module, exports, __webpack_require__) {
|
14373 |
|
14374 | "use strict";
|
14375 |
|
14376 | var _interopRequireDefault = __webpack_require__(14);
|
14377 |
|
14378 | exports.__esModule = true;
|
14379 | exports.default = filterEvents;
|
14380 |
|
14381 | var _contains = _interopRequireDefault(__webpack_require__(111));
|
14382 |
|
14383 | var _querySelectorAll = _interopRequireDefault(__webpack_require__(138));
|
14384 |
|
14385 | function filterEvents(selector, handler) {
|
14386 | return function filterHandler(e) {
|
14387 | var top = e.currentTarget,
|
14388 | target = e.target,
|
14389 | matches = (0, _querySelectorAll.default)(top, selector);
|
14390 | if (matches.some(function (match) {
|
14391 | return (0, _contains.default)(match, target);
|
14392 | })) handler.call(this, e);
|
14393 | };
|
14394 | }
|
14395 |
|
14396 | module.exports = exports["default"];
|
14397 |
|
14398 | }),
|
14399 |
|
14400 | (function(module, exports) {
|
14401 |
|
14402 | "use strict";
|
14403 |
|
14404 | exports.__esModule = true;
|
14405 | exports.default = qsa;
|
14406 |
|
14407 |
|
14408 |
|
14409 | var simpleSelectorRE = /^[\w-]*$/;
|
14410 | var toArray = Function.prototype.bind.call(Function.prototype.call, [].slice);
|
14411 |
|
14412 | function qsa(element, selector) {
|
14413 | var maybeID = selector[0] === '#',
|
14414 | maybeClass = selector[0] === '.',
|
14415 | nameOnly = maybeID || maybeClass ? selector.slice(1) : selector,
|
14416 | isSimple = simpleSelectorRE.test(nameOnly),
|
14417 | found;
|
14418 |
|
14419 | if (isSimple) {
|
14420 | if (maybeID) {
|
14421 | element = element.getElementById ? element : document;
|
14422 | return (found = element.getElementById(nameOnly)) ? [found] : [];
|
14423 | }
|
14424 |
|
14425 | if (element.getElementsByClassName && maybeClass) return toArray(element.getElementsByClassName(nameOnly));
|
14426 | return toArray(element.getElementsByTagName(selector));
|
14427 | }
|
14428 |
|
14429 | return toArray(element.querySelectorAll(selector));
|
14430 | }
|
14431 |
|
14432 | module.exports = exports["default"];
|
14433 |
|
14434 | }),
|
14435 |
|
14436 | (function(module, exports, __webpack_require__) {
|
14437 |
|
14438 | "use strict";
|
14439 |
|
14440 | var _interopRequireDefault = __webpack_require__(14);
|
14441 |
|
14442 | exports.__esModule = true;
|
14443 | exports.default = void 0;
|
14444 |
|
14445 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
14446 |
|
14447 | var _on = _interopRequireDefault(__webpack_require__(16));
|
14448 |
|
14449 | var _off = _interopRequireDefault(__webpack_require__(77));
|
14450 |
|
14451 | var listen = function listen() {};
|
14452 |
|
14453 | if (_inDOM.default) {
|
14454 | listen = function listen(node, eventName, handler, capture) {
|
14455 | (0, _on.default)(node, eventName, handler, capture);
|
14456 | return function () {
|
14457 | (0, _off.default)(node, eventName, handler, capture);
|
14458 | };
|
14459 | };
|
14460 | }
|
14461 |
|
14462 | var _default = listen;
|
14463 | exports.default = _default;
|
14464 | module.exports = exports["default"];
|
14465 |
|
14466 | }),
|
14467 |
|
14468 | (function(module, exports, __webpack_require__) {
|
14469 |
|
14470 | "use strict";
|
14471 |
|
14472 | var _interopRequireDefault = __webpack_require__(14);
|
14473 |
|
14474 | exports.__esModule = true;
|
14475 | exports.default = scrollbarSize;
|
14476 |
|
14477 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
14478 |
|
14479 | var size;
|
14480 |
|
14481 | function scrollbarSize(recalc) {
|
14482 | if (!size && size !== 0 || recalc) {
|
14483 | if (_inDOM.default) {
|
14484 | var scrollDiv = document.createElement('div');
|
14485 | scrollDiv.style.position = 'absolute';
|
14486 | scrollDiv.style.top = '-9999px';
|
14487 | scrollDiv.style.width = '50px';
|
14488 | scrollDiv.style.height = '50px';
|
14489 | scrollDiv.style.overflow = 'scroll';
|
14490 | document.body.appendChild(scrollDiv);
|
14491 | size = scrollDiv.offsetWidth - scrollDiv.clientWidth;
|
14492 | document.body.removeChild(scrollDiv);
|
14493 | }
|
14494 | }
|
14495 |
|
14496 | return size;
|
14497 | }
|
14498 |
|
14499 | module.exports = exports["default"];
|
14500 |
|
14501 | }),
|
14502 |
|
14503 | (function(module, exports, __webpack_require__) {
|
14504 |
|
14505 | 'use strict';
|
14506 |
|
14507 | Object.defineProperty(exports, "__esModule", {
|
14508 | value: true
|
14509 | });
|
14510 |
|
14511 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
14512 |
|
14513 |
|
14514 | var _react = __webpack_require__(1);
|
14515 |
|
14516 | var _react2 = _interopRequireDefault(_react);
|
14517 |
|
14518 | var _propTypes = __webpack_require__(6);
|
14519 |
|
14520 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
14521 |
|
14522 | var _warning = __webpack_require__(32);
|
14523 |
|
14524 | var _warning2 = _interopRequireDefault(_warning);
|
14525 |
|
14526 | var _tinperBeeCore = __webpack_require__(27);
|
14527 |
|
14528 | var _Portal = __webpack_require__(112);
|
14529 |
|
14530 | var _Portal2 = _interopRequireDefault(_Portal);
|
14531 |
|
14532 | var _ModalManager = __webpack_require__(142);
|
14533 |
|
14534 | var _ModalManager2 = _interopRequireDefault(_ModalManager);
|
14535 |
|
14536 | var _ownerDocument = __webpack_require__(74);
|
14537 |
|
14538 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
14539 |
|
14540 | var _addEventListener = __webpack_require__(76);
|
14541 |
|
14542 | var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
14543 |
|
14544 | var _addFocusListener = __webpack_require__(146);
|
14545 |
|
14546 | var _addFocusListener2 = _interopRequireDefault(_addFocusListener);
|
14547 |
|
14548 | var _inDOM = __webpack_require__(15);
|
14549 |
|
14550 | var _inDOM2 = _interopRequireDefault(_inDOM);
|
14551 |
|
14552 | var _activeElement = __webpack_require__(147);
|
14553 |
|
14554 | var _activeElement2 = _interopRequireDefault(_activeElement);
|
14555 |
|
14556 | var _contains = __webpack_require__(111);
|
14557 |
|
14558 | var _contains2 = _interopRequireDefault(_contains);
|
14559 |
|
14560 | var _getContainer = __webpack_require__(113);
|
14561 |
|
14562 | var _getContainer2 = _interopRequireDefault(_getContainer);
|
14563 |
|
14564 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
14565 |
|
14566 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
14567 |
|
14568 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
14569 |
|
14570 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
14571 |
|
14572 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
14573 |
|
14574 | var modalManager = new _ModalManager2["default"]();
|
14575 |
|
14576 | |
14577 |
|
14578 |
|
14579 |
|
14580 | var propTypes = _extends({}, _Portal2["default"].propTypes, {
|
14581 |
|
14582 | |
14583 |
|
14584 |
|
14585 | show: _propTypes2["default"].bool,
|
14586 |
|
14587 | |
14588 |
|
14589 |
|
14590 | container: _propTypes2["default"].oneOfType([_tinperBeeCore.componentOrElement, _propTypes2["default"].func]),
|
14591 |
|
14592 | |
14593 |
|
14594 |
|
14595 | onShow: _propTypes2["default"].func,
|
14596 |
|
14597 | |
14598 |
|
14599 |
|
14600 | onHide: _propTypes2["default"].func,
|
14601 |
|
14602 | |
14603 |
|
14604 |
|
14605 | backdrop: _propTypes2["default"].oneOfType([_propTypes2["default"].bool, _propTypes2["default"].oneOf(['static'])]),
|
14606 |
|
14607 | |
14608 |
|
14609 |
|
14610 | renderBackdrop: _propTypes2["default"].func,
|
14611 |
|
14612 | |
14613 |
|
14614 |
|
14615 | onEscapeKeyUp: _propTypes2["default"].func,
|
14616 |
|
14617 | |
14618 |
|
14619 |
|
14620 | onBackdropClick: _propTypes2["default"].func,
|
14621 |
|
14622 | |
14623 |
|
14624 |
|
14625 | backdropStyle: _propTypes2["default"].object,
|
14626 |
|
14627 | |
14628 |
|
14629 |
|
14630 | backdropClassName: _propTypes2["default"].string,
|
14631 |
|
14632 | |
14633 |
|
14634 |
|
14635 | containerClassName: _propTypes2["default"].string,
|
14636 |
|
14637 | |
14638 |
|
14639 |
|
14640 | keyboard: _propTypes2["default"].bool,
|
14641 |
|
14642 | |
14643 |
|
14644 |
|
14645 | transition: _tinperBeeCore.elementType,
|
14646 |
|
14647 | |
14648 |
|
14649 |
|
14650 | dialogTransitionTimeout: _propTypes2["default"].number,
|
14651 |
|
14652 | |
14653 |
|
14654 |
|
14655 | backdropTransitionTimeout: _propTypes2["default"].number,
|
14656 |
|
14657 | |
14658 |
|
14659 |
|
14660 | autoFocus: _propTypes2["default"].bool,
|
14661 |
|
14662 | |
14663 |
|
14664 |
|
14665 | enforceFocus: _propTypes2["default"].bool,
|
14666 |
|
14667 | |
14668 |
|
14669 |
|
14670 | onEnter: _propTypes2["default"].func,
|
14671 |
|
14672 | |
14673 |
|
14674 |
|
14675 | onEntering: _propTypes2["default"].func,
|
14676 |
|
14677 | |
14678 |
|
14679 |
|
14680 | onEntered: _propTypes2["default"].func,
|
14681 |
|
14682 | |
14683 |
|
14684 |
|
14685 | onExit: _propTypes2["default"].func,
|
14686 |
|
14687 | |
14688 |
|
14689 |
|
14690 | onExiting: _propTypes2["default"].func,
|
14691 |
|
14692 | |
14693 |
|
14694 |
|
14695 | onExited: _propTypes2["default"].func,
|
14696 |
|
14697 | |
14698 |
|
14699 |
|
14700 | manager: _propTypes2["default"].object.isRequired
|
14701 | });
|
14702 |
|
14703 | var defaultProps = {
|
14704 | show: false,
|
14705 | backdrop: true,
|
14706 | keyboard: true,
|
14707 | autoFocus: true,
|
14708 | enforceFocus: true,
|
14709 | onHide: function onHide() {},
|
14710 | manager: modalManager,
|
14711 | renderBackdrop: function renderBackdrop(props) {
|
14712 | return _react2["default"].createElement('div', props);
|
14713 | }
|
14714 | };
|
14715 |
|
14716 | var BaseModal = function (_Component) {
|
14717 | _inherits(BaseModal, _Component);
|
14718 |
|
14719 | function BaseModal(props, content) {
|
14720 | _classCallCheck(this, BaseModal);
|
14721 |
|
14722 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
14723 |
|
14724 | _this.state = {
|
14725 | exited: !_this.props.show
|
14726 | };
|
14727 |
|
14728 | _this.onShow = _this.onShow.bind(_this);
|
14729 | _this.onHide = _this.onHide.bind(_this);
|
14730 | _this.setMountNode = _this.setMountNode.bind(_this);
|
14731 | _this.handleHidden = _this.handleHidden.bind(_this);
|
14732 | _this.handleBackdropClick = _this.handleBackdropClick.bind(_this);
|
14733 | _this.handleDocumentKeyUp = _this.handleDocumentKeyUp.bind(_this);
|
14734 | _this.checkForFocus = _this.checkForFocus.bind(_this);
|
14735 | _this.focus = _this.focus.bind(_this);
|
14736 | _this.restoreLastFocus = _this.restoreLastFocus.bind(_this);
|
14737 | _this.enforceFocus = _this.enforceFocus.bind(_this);
|
14738 | _this.getDialogElement = _this.getDialogElement.bind(_this);
|
14739 | _this.isTopModal = _this.isTopModal.bind(_this);
|
14740 | _this.renderBackdrop = _this.renderBackdrop.bind(_this);
|
14741 | return _this;
|
14742 | }
|
14743 |
|
14744 | BaseModal.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
14745 | if (nextProps.show) {
|
14746 | this.setState({ exited: false });
|
14747 | } else if (!nextProps.transition) {
|
14748 |
|
14749 | this.setState({ exited: true });
|
14750 | }
|
14751 | };
|
14752 |
|
14753 | BaseModal.prototype.componentWillUpdate = function componentWillUpdate(nextProps) {
|
14754 | if (!this.props.show && nextProps.show) {
|
14755 | this.checkForFocus();
|
14756 | }
|
14757 | };
|
14758 |
|
14759 | BaseModal.prototype.componentDidMount = function componentDidMount() {
|
14760 | if (this.props.show) {
|
14761 | this.onShow();
|
14762 | }
|
14763 | this.mounted = true;
|
14764 | };
|
14765 |
|
14766 | BaseModal.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
14767 | var transition = this.props.transition;
|
14768 |
|
14769 |
|
14770 | if (prevProps.show && !this.props.show && !transition) {
|
14771 |
|
14772 | this.onHide();
|
14773 | } else if (!prevProps.show && this.props.show) {
|
14774 | this.onShow();
|
14775 | }
|
14776 | };
|
14777 |
|
14778 | BaseModal.prototype.componentWillUnmount = function componentWillUnmount() {
|
14779 | var _props = this.props,
|
14780 | show = _props.show,
|
14781 | transition = _props.transition;
|
14782 |
|
14783 |
|
14784 | if (show || transition && !this.state.exited) {
|
14785 | this.onHide();
|
14786 | }
|
14787 |
|
14788 | this.mounted = false;
|
14789 | };
|
14790 |
|
14791 | BaseModal.prototype.onShow = function onShow() {
|
14792 | var doc = (0, _ownerDocument2["default"])(this);
|
14793 | var container = (0, _getContainer2["default"])(this.props.container, doc.body);
|
14794 |
|
14795 | this.props.manager.add(this, container, this.props.containerClassName);
|
14796 |
|
14797 | this._onDocumentKeyupListener = (0, _addEventListener2["default"])(doc, 'keyup', this.handleDocumentKeyUp);
|
14798 |
|
14799 | this._onFocusinListener = (0, _addFocusListener2["default"])(this.enforceFocus);
|
14800 |
|
14801 | this.focus();
|
14802 |
|
14803 | if (this.props.onShow) {
|
14804 | this.props.onShow();
|
14805 | }
|
14806 | };
|
14807 |
|
14808 | BaseModal.prototype.onHide = function onHide() {
|
14809 | this.props.manager.remove(this);
|
14810 |
|
14811 | this._onDocumentKeyupListener.remove();
|
14812 |
|
14813 | this._onFocusinListener.remove();
|
14814 |
|
14815 | this.restoreLastFocus();
|
14816 | };
|
14817 |
|
14818 | BaseModal.prototype.setMountNode = function setMountNode(ref) {
|
14819 | this.mountNode = ref ? ref.getMountNode() : ref;
|
14820 | };
|
14821 |
|
14822 | BaseModal.prototype.handleHidden = function handleHidden() {
|
14823 | this.setState({ exited: true });
|
14824 | this.onHide();
|
14825 |
|
14826 | if (this.props.onExited) {
|
14827 | var _props2;
|
14828 |
|
14829 | (_props2 = this.props).onExited.apply(_props2, arguments);
|
14830 | }
|
14831 | };
|
14832 |
|
14833 | BaseModal.prototype.handleBackdropClick = function handleBackdropClick(e) {
|
14834 | if (e.target !== e.currentTarget) {
|
14835 | return;
|
14836 | }
|
14837 |
|
14838 | if (this.props.onBackdropClick) {
|
14839 | this.props.onBackdropClick(e);
|
14840 | }
|
14841 |
|
14842 | if (this.props.backdrop === true) {
|
14843 | this.props.onHide();
|
14844 | }
|
14845 | };
|
14846 |
|
14847 | BaseModal.prototype.handleDocumentKeyUp = function handleDocumentKeyUp(e) {
|
14848 | if (this.props.keyboard && e.keyCode === 27 && this.isTopModal()) {
|
14849 | if (this.props.onEscapeKeyUp) {
|
14850 | this.props.onEscapeKeyUp(e);
|
14851 | }
|
14852 | this.props.onHide();
|
14853 | }
|
14854 | };
|
14855 |
|
14856 | BaseModal.prototype.checkForFocus = function checkForFocus() {
|
14857 | if (_inDOM2["default"]) {
|
14858 | this.lastFocus = (0, _activeElement2["default"])();
|
14859 | }
|
14860 | };
|
14861 |
|
14862 | BaseModal.prototype.focus = function focus() {
|
14863 | var autoFocus = this.props.autoFocus;
|
14864 | var modalContent = this.getDialogElement();
|
14865 | var current = (0, _activeElement2["default"])((0, _ownerDocument2["default"])(this));
|
14866 | var focusInModal = current && (0, _contains2["default"])(modalContent, current);
|
14867 |
|
14868 | if (modalContent && autoFocus && !focusInModal) {
|
14869 | this.lastFocus = current;
|
14870 |
|
14871 | if (!modalContent.hasAttribute('tabIndex')) {
|
14872 | modalContent.setAttribute('tabIndex', -1);
|
14873 | (0, _warning2["default"])(false, 'The modal content node does not accept focus. ' + 'For the benefit of assistive technologies, the tabIndex of the node is being set to "-1".');
|
14874 | }
|
14875 |
|
14876 | modalContent.focus();
|
14877 | }
|
14878 | };
|
14879 |
|
14880 | BaseModal.prototype.restoreLastFocus = function restoreLastFocus() {
|
14881 |
|
14882 | if (this.lastFocus && this.lastFocus.focus) {
|
14883 | this.lastFocus.focus();
|
14884 | this.lastFocus = null;
|
14885 | }
|
14886 | };
|
14887 |
|
14888 | BaseModal.prototype.enforceFocus = function enforceFocus() {
|
14889 | var enforceFocus = this.props.enforceFocus;
|
14890 |
|
14891 |
|
14892 | if (!enforceFocus || !this.mounted || !this.isTopModal()) {
|
14893 | return;
|
14894 | }
|
14895 |
|
14896 | var active = (0, _activeElement2["default"])((0, _ownerDocument2["default"])(this));
|
14897 | var modal = this.getDialogElement();
|
14898 |
|
14899 | if (modal && modal !== active && !(0, _contains2["default"])(modal, active)) {
|
14900 | modal.focus();
|
14901 | }
|
14902 | };
|
14903 |
|
14904 |
|
14905 |
|
14906 |
|
14907 | BaseModal.prototype.getDialogElement = function getDialogElement() {
|
14908 | var node = this.refs.modal;
|
14909 | return node && node.lastChild;
|
14910 | };
|
14911 |
|
14912 | BaseModal.prototype.isTopModal = function isTopModal() {
|
14913 | return this.props.manager.isTopModal(this);
|
14914 | };
|
14915 |
|
14916 | BaseModal.prototype.renderBackdrop = function renderBackdrop() {
|
14917 | var _this2 = this;
|
14918 |
|
14919 | var _props3 = this.props,
|
14920 | backdropStyle = _props3.backdropStyle,
|
14921 | backdropClassName = _props3.backdropClassName,
|
14922 | renderBackdrop = _props3.renderBackdrop,
|
14923 | Transition = _props3.transition,
|
14924 | backdropTransitionTimeout = _props3.backdropTransitionTimeout;
|
14925 |
|
14926 |
|
14927 | var backdropRef = function backdropRef(ref) {
|
14928 | return _this2.backdrop = ref;
|
14929 | };
|
14930 |
|
14931 | var backdrop = _react2["default"].createElement('div', {
|
14932 | ref: backdropRef,
|
14933 | style: this.props.backdropStyle,
|
14934 | className: this.props.backdropClassName,
|
14935 | onClick: this.handleBackdropClick
|
14936 | });
|
14937 |
|
14938 | if (Transition) {
|
14939 | backdrop = _react2["default"].createElement(
|
14940 | Transition,
|
14941 | { transitionAppear: true,
|
14942 | 'in': this.props.show,
|
14943 | timeout: backdropTransitionTimeout
|
14944 | },
|
14945 | renderBackdrop({
|
14946 | ref: backdropRef,
|
14947 | style: backdropStyle,
|
14948 | className: backdropClassName,
|
14949 | onClick: this.handleBackdropClick
|
14950 | })
|
14951 | );
|
14952 | }
|
14953 |
|
14954 | return backdrop;
|
14955 | };
|
14956 |
|
14957 | BaseModal.prototype.render = function render() {
|
14958 | var _props4 = this.props,
|
14959 | show = _props4.show,
|
14960 | container = _props4.container,
|
14961 | children = _props4.children,
|
14962 | Transition = _props4.transition,
|
14963 | backdrop = _props4.backdrop,
|
14964 | dialogTransitionTimeout = _props4.dialogTransitionTimeout,
|
14965 | className = _props4.className,
|
14966 | style = _props4.style,
|
14967 | onExit = _props4.onExit,
|
14968 | onExiting = _props4.onExiting,
|
14969 | onEnter = _props4.onEnter,
|
14970 | onEntering = _props4.onEntering,
|
14971 | onEntered = _props4.onEntered;
|
14972 |
|
14973 |
|
14974 | var dialog = _react2["default"].Children.only(children);
|
14975 |
|
14976 | var mountModal = show || Transition && !this.state.exited;
|
14977 | if (!mountModal) {
|
14978 | return null;
|
14979 | }
|
14980 |
|
14981 | var _dialog$props = dialog.props,
|
14982 | role = _dialog$props.role,
|
14983 | tabIndex = _dialog$props.tabIndex;
|
14984 |
|
14985 |
|
14986 | if (role === undefined || tabIndex === undefined) {
|
14987 | dialog = (0, _react.cloneElement)(dialog, {
|
14988 | role: role === undefined ? 'document' : role,
|
14989 | tabIndex: tabIndex == null ? '-1' : tabIndex
|
14990 | });
|
14991 | }
|
14992 |
|
14993 | if (Transition) {
|
14994 | dialog = _react2["default"].createElement(
|
14995 | Transition,
|
14996 | {
|
14997 | transitionAppear: true,
|
14998 | unmountOnExit: true,
|
14999 | 'in': show,
|
15000 | timeout: dialogTransitionTimeout,
|
15001 | onExit: onExit,
|
15002 | onExiting: onExiting,
|
15003 | onExited: this.handleHidden,
|
15004 | onEnter: onEnter,
|
15005 | onEntering: onEntering,
|
15006 | onEntered: onEntered
|
15007 | },
|
15008 | dialog
|
15009 | );
|
15010 | }
|
15011 |
|
15012 | return _react2["default"].createElement(
|
15013 | _Portal2["default"],
|
15014 | {
|
15015 | ref: this.setMountNode,
|
15016 | container: container
|
15017 | },
|
15018 | _react2["default"].createElement(
|
15019 | 'div',
|
15020 | {
|
15021 | ref: 'modal',
|
15022 | role: role || 'dialog',
|
15023 | style: style,
|
15024 | className: className
|
15025 | },
|
15026 | backdrop && this.renderBackdrop(),
|
15027 | dialog
|
15028 | )
|
15029 | );
|
15030 | };
|
15031 |
|
15032 | return BaseModal;
|
15033 | }(_react.Component);
|
15034 |
|
15035 | ;
|
15036 |
|
15037 | BaseModal.Manager = _ModalManager2["default"];
|
15038 |
|
15039 | BaseModal.propTypes = propTypes;
|
15040 | BaseModal.defaultProps = defaultProps;
|
15041 |
|
15042 | exports["default"] = BaseModal;
|
15043 | module.exports = exports['default'];
|
15044 |
|
15045 | }),
|
15046 |
|
15047 | (function(module, exports, __webpack_require__) {
|
15048 |
|
15049 | 'use strict';
|
15050 |
|
15051 | Object.defineProperty(exports, "__esModule", {
|
15052 | value: true
|
15053 | });
|
15054 |
|
15055 | var _style = __webpack_require__(18);
|
15056 |
|
15057 | var _style2 = _interopRequireDefault(_style);
|
15058 |
|
15059 | var _class = __webpack_require__(143);
|
15060 |
|
15061 | var _class2 = _interopRequireDefault(_class);
|
15062 |
|
15063 | var _scrollbarSize = __webpack_require__(140);
|
15064 |
|
15065 | var _scrollbarSize2 = _interopRequireDefault(_scrollbarSize);
|
15066 |
|
15067 | var _isOverflowing = __webpack_require__(144);
|
15068 |
|
15069 | var _isOverflowing2 = _interopRequireDefault(_isOverflowing);
|
15070 |
|
15071 | var _manageAriaHidden = __webpack_require__(145);
|
15072 |
|
15073 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15074 |
|
15075 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15076 |
|
15077 | function findIndexOf(arr, cb) {
|
15078 | var idx = -1;
|
15079 | arr.some(function (d, i) {
|
15080 | if (cb(d, i)) {
|
15081 | idx = i;
|
15082 | return true;
|
15083 | }
|
15084 | });
|
15085 | return idx;
|
15086 | }
|
15087 |
|
15088 |
|
15089 | function findContainer(data, modal) {
|
15090 | return findIndexOf(data, function (d) {
|
15091 | return d.modals.indexOf(modal) !== -1;
|
15092 | });
|
15093 | }
|
15094 |
|
15095 |
|
15096 | function setContainerStyle(state, container) {
|
15097 | var style = { overflow: 'hidden' };
|
15098 |
|
15099 | state.style = {
|
15100 | overflow: container.style.overflow,
|
15101 | paddingRight: container.style.paddingRight
|
15102 | };
|
15103 |
|
15104 | if (state.overflowing) {
|
15105 |
|
15106 | style.paddingRight = parseInt((0, _style2["default"])(container, 'paddingRight') || 0, 10) + (0, _scrollbarSize2["default"])() + 'px';
|
15107 | }
|
15108 |
|
15109 | (0, _style2["default"])(container, style);
|
15110 | }
|
15111 |
|
15112 | function removeContainerStyle(_ref, container) {
|
15113 | var style = _ref.style;
|
15114 |
|
15115 |
|
15116 | Object.keys(style).forEach(function (key) {
|
15117 | return container.style[key] = style[key];
|
15118 | });
|
15119 | }
|
15120 | |
15121 |
|
15122 |
|
15123 |
|
15124 | var ModalManager = function () {
|
15125 | function ModalManager() {
|
15126 | var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
15127 | _ref2$hideSiblingNode = _ref2.hideSiblingNodes,
|
15128 | hideSiblingNodes = _ref2$hideSiblingNode === undefined ? true : _ref2$hideSiblingNode,
|
15129 | _ref2$handleContainer = _ref2.handleContainerOverflow,
|
15130 | handleContainerOverflow = _ref2$handleContainer === undefined ? true : _ref2$handleContainer;
|
15131 |
|
15132 | _classCallCheck(this, ModalManager);
|
15133 |
|
15134 | this.hideSiblingNodes = hideSiblingNodes;
|
15135 | this.handleContainerOverflow = handleContainerOverflow;
|
15136 | this.modals = [];
|
15137 | this.containers = [];
|
15138 | this.data = [];
|
15139 | }
|
15140 |
|
15141 | ModalManager.prototype.add = function add(modal, container, className) {
|
15142 | var modalIdx = this.modals.indexOf(modal);
|
15143 | var containerIdx = this.containers.indexOf(container);
|
15144 |
|
15145 | if (modalIdx !== -1) {
|
15146 | return modalIdx;
|
15147 | }
|
15148 |
|
15149 | modalIdx = this.modals.length;
|
15150 | this.modals.push(modal);
|
15151 |
|
15152 | if (this.hideSiblingNodes) {
|
15153 | (0, _manageAriaHidden.hideSiblings)(container, modal.mountNode);
|
15154 | }
|
15155 |
|
15156 | if (containerIdx !== -1) {
|
15157 | this.data[containerIdx].modals.push(modal);
|
15158 | return modalIdx;
|
15159 | }
|
15160 |
|
15161 | var data = {
|
15162 | modals: [modal],
|
15163 |
|
15164 | classes: className ? className.split(/\s+/) : [],
|
15165 |
|
15166 | overflowing: (0, _isOverflowing2["default"])(container)
|
15167 | };
|
15168 |
|
15169 | if (this.handleContainerOverflow) {
|
15170 | setContainerStyle(data, container);
|
15171 | }
|
15172 |
|
15173 | data.classes.forEach(_class2["default"].addClass.bind(null, container));
|
15174 |
|
15175 | this.containers.push(container);
|
15176 | this.data.push(data);
|
15177 |
|
15178 | return modalIdx;
|
15179 | };
|
15180 |
|
15181 | ModalManager.prototype.remove = function remove(modal) {
|
15182 | var modalIdx = this.modals.indexOf(modal);
|
15183 |
|
15184 | if (modalIdx === -1) {
|
15185 | return;
|
15186 | }
|
15187 |
|
15188 | var containerIdx = findContainer(this.data, modal);
|
15189 | var data = this.data[containerIdx];
|
15190 | var container = this.containers[containerIdx];
|
15191 |
|
15192 | data.modals.splice(data.modals.indexOf(modal), 1);
|
15193 |
|
15194 | this.modals.splice(modalIdx, 1);
|
15195 |
|
15196 |
|
15197 |
|
15198 | if (data.modals.length === 0) {
|
15199 | data.classes.forEach(_class2["default"].removeClass.bind(null, container));
|
15200 |
|
15201 | if (this.handleContainerOverflow) {
|
15202 | removeContainerStyle(data, container);
|
15203 | }
|
15204 |
|
15205 | if (this.hideSiblingNodes) {
|
15206 | (0, _manageAriaHidden.showSiblings)(container, modal.mountNode);
|
15207 | }
|
15208 | this.containers.splice(containerIdx, 1);
|
15209 | this.data.splice(containerIdx, 1);
|
15210 | } else if (this.hideSiblingNodes) {
|
15211 |
|
15212 | (0, _manageAriaHidden.ariaHidden)(false, data.modals[data.modals.length - 1].mountNode);
|
15213 | }
|
15214 | };
|
15215 |
|
15216 | ModalManager.prototype.isTopModal = function isTopModal(modal) {
|
15217 | return !!this.modals.length && this.modals[this.modals.length - 1] === modal;
|
15218 | };
|
15219 |
|
15220 | return ModalManager;
|
15221 | }();
|
15222 |
|
15223 | exports["default"] = ModalManager;
|
15224 | module.exports = exports['default'];
|
15225 |
|
15226 | }),
|
15227 |
|
15228 | (function(module, exports, __webpack_require__) {
|
15229 |
|
15230 | "use strict";
|
15231 |
|
15232 | var _interopRequireDefault = __webpack_require__(14);
|
15233 |
|
15234 | exports.__esModule = true;
|
15235 | exports.default = void 0;
|
15236 |
|
15237 | var _addClass = _interopRequireDefault(__webpack_require__(87));
|
15238 |
|
15239 | exports.addClass = _addClass.default;
|
15240 |
|
15241 | var _removeClass = _interopRequireDefault(__webpack_require__(89));
|
15242 |
|
15243 | exports.removeClass = _removeClass.default;
|
15244 |
|
15245 | var _hasClass = _interopRequireDefault(__webpack_require__(88));
|
15246 |
|
15247 | exports.hasClass = _hasClass.default;
|
15248 | var _default = {
|
15249 | addClass: _addClass.default,
|
15250 | removeClass: _removeClass.default,
|
15251 | hasClass: _hasClass.default
|
15252 | };
|
15253 | exports.default = _default;
|
15254 |
|
15255 | }),
|
15256 |
|
15257 | (function(module, exports, __webpack_require__) {
|
15258 |
|
15259 | 'use strict';
|
15260 |
|
15261 | Object.defineProperty(exports, "__esModule", {
|
15262 | value: true
|
15263 | });
|
15264 | exports["default"] = isOverflowing;
|
15265 |
|
15266 | var _isWindow = __webpack_require__(120);
|
15267 |
|
15268 | var _isWindow2 = _interopRequireDefault(_isWindow);
|
15269 |
|
15270 | var _ownerDocument = __webpack_require__(75);
|
15271 |
|
15272 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
15273 |
|
15274 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15275 |
|
15276 | function isBody(node) {
|
15277 | return node && node.tagName.toLowerCase() === 'body';
|
15278 | }
|
15279 |
|
15280 | function bodyIsOverflowing(node) {
|
15281 | var doc = (0, _ownerDocument2["default"])(node);
|
15282 | var win = (0, _isWindow2["default"])(doc);
|
15283 | var fullWidth = win.innerWidth;
|
15284 |
|
15285 |
|
15286 | if (!fullWidth) {
|
15287 | var documentElementRect = doc.documentElement.getBoundingClientRect();
|
15288 | fullWidth = documentElementRect.right - Math.abs(documentElementRect.left);
|
15289 | }
|
15290 |
|
15291 | return doc.body.clientWidth < fullWidth;
|
15292 | }
|
15293 |
|
15294 | function isOverflowing(container) {
|
15295 | var win = (0, _isWindow2["default"])(container);
|
15296 |
|
15297 | return win || isBody(container) ? bodyIsOverflowing(container) : container.scrollHeight > container.clientHeight;
|
15298 | }
|
15299 | module.exports = exports['default'];
|
15300 |
|
15301 | }),
|
15302 |
|
15303 | (function(module, exports) {
|
15304 |
|
15305 | 'use strict';
|
15306 |
|
15307 | Object.defineProperty(exports, "__esModule", {
|
15308 | value: true
|
15309 | });
|
15310 | exports.ariaHidden = ariaHidden;
|
15311 | exports.hideSiblings = hideSiblings;
|
15312 | exports.showSiblings = showSiblings;
|
15313 |
|
15314 | var BLACKLIST = ['template', 'script', 'style'];
|
15315 |
|
15316 | var isHidable = function isHidable(_ref) {
|
15317 | var nodeType = _ref.nodeType,
|
15318 | tagName = _ref.tagName;
|
15319 | return nodeType === 1 && BLACKLIST.indexOf(tagName.toLowerCase()) === -1;
|
15320 | };
|
15321 |
|
15322 | var siblings = function siblings(container, mount, cb) {
|
15323 | mount = [].concat(mount);
|
15324 |
|
15325 | [].forEach.call(container.children, function (node) {
|
15326 | if (mount.indexOf(node) === -1 && isHidable(node)) {
|
15327 | cb(node);
|
15328 | }
|
15329 | });
|
15330 | };
|
15331 |
|
15332 | function ariaHidden(show, node) {
|
15333 | if (!node) {
|
15334 | return;
|
15335 | }
|
15336 | if (show) {
|
15337 | node.setAttribute('aria-hidden', 'true');
|
15338 | } else {
|
15339 | node.removeAttribute('aria-hidden');
|
15340 | }
|
15341 | }
|
15342 |
|
15343 | function hideSiblings(container, mountNode) {
|
15344 | siblings(container, mountNode, function (node) {
|
15345 | return ariaHidden(true, node);
|
15346 | });
|
15347 | }
|
15348 |
|
15349 | function showSiblings(container, mountNode) {
|
15350 | siblings(container, mountNode, function (node) {
|
15351 | return ariaHidden(false, node);
|
15352 | });
|
15353 | }
|
15354 |
|
15355 | }),
|
15356 |
|
15357 | (function(module, exports) {
|
15358 |
|
15359 | 'use strict';
|
15360 |
|
15361 | Object.defineProperty(exports, "__esModule", {
|
15362 | value: true
|
15363 | });
|
15364 | exports["default"] = addFocusListener;
|
15365 | |
15366 |
|
15367 |
|
15368 |
|
15369 |
|
15370 |
|
15371 | function addFocusListener(handler) {
|
15372 | var useFocusin = !document.addEventListener;
|
15373 | var remove = void 0;
|
15374 |
|
15375 | if (useFocusin) {
|
15376 | document.attachEvent('onfocusin', handler);
|
15377 | remove = function remove() {
|
15378 | return document.detachEvent('onfocusin', handler);
|
15379 | };
|
15380 | } else {
|
15381 | document.addEventListener('focus', handler, true);
|
15382 | remove = function remove() {
|
15383 | return document.removeEventListener('focus', handler, true);
|
15384 | };
|
15385 | }
|
15386 |
|
15387 | return { remove: remove };
|
15388 | }
|
15389 | module.exports = exports['default'];
|
15390 |
|
15391 | }),
|
15392 |
|
15393 | (function(module, exports, __webpack_require__) {
|
15394 |
|
15395 | "use strict";
|
15396 |
|
15397 | var _interopRequireDefault = __webpack_require__(14);
|
15398 |
|
15399 | exports.__esModule = true;
|
15400 | exports.default = activeElement;
|
15401 |
|
15402 | var _ownerDocument = _interopRequireDefault(__webpack_require__(75));
|
15403 |
|
15404 | function activeElement(doc) {
|
15405 | if (doc === void 0) {
|
15406 | doc = (0, _ownerDocument.default)();
|
15407 | }
|
15408 |
|
15409 | try {
|
15410 | return doc.activeElement;
|
15411 | } catch (e) {
|
15412 |
|
15413 | }
|
15414 | }
|
15415 |
|
15416 | module.exports = exports["default"];
|
15417 |
|
15418 | }),
|
15419 |
|
15420 | (function(module, exports, __webpack_require__) {
|
15421 |
|
15422 | 'use strict';
|
15423 |
|
15424 | Object.defineProperty(exports, "__esModule", {
|
15425 | value: true
|
15426 | });
|
15427 |
|
15428 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
15429 |
|
15430 | var _classnames = __webpack_require__(5);
|
15431 |
|
15432 | var _classnames2 = _interopRequireDefault(_classnames);
|
15433 |
|
15434 | var _react = __webpack_require__(1);
|
15435 |
|
15436 | var _react2 = _interopRequireDefault(_react);
|
15437 |
|
15438 | var _tinperBeeCore = __webpack_require__(27);
|
15439 |
|
15440 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15441 |
|
15442 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
15443 |
|
15444 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
15445 |
|
15446 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15447 |
|
15448 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
15449 |
|
15450 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
15451 |
|
15452 | var propTypes = {
|
15453 | componentClass: _tinperBeeCore.elementType
|
15454 | };
|
15455 |
|
15456 | var defaultProps = {
|
15457 | componentClass: 'div',
|
15458 | clsPrefix: 'u-modal-body'
|
15459 | };
|
15460 |
|
15461 | var ModalBody = function (_React$Component) {
|
15462 | _inherits(ModalBody, _React$Component);
|
15463 |
|
15464 | function ModalBody() {
|
15465 | _classCallCheck(this, ModalBody);
|
15466 |
|
15467 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
15468 | }
|
15469 |
|
15470 | ModalBody.prototype.render = function render() {
|
15471 | var _props = this.props,
|
15472 | Component = _props.componentClass,
|
15473 | clsPrefix = _props.clsPrefix,
|
15474 | className = _props.className,
|
15475 | props = _objectWithoutProperties(_props, ['componentClass', 'clsPrefix', 'className']);
|
15476 |
|
15477 | var classes = {};
|
15478 | classes['' + clsPrefix] = true;
|
15479 |
|
15480 | return _react2["default"].createElement(Component, _extends({}, props, {
|
15481 | className: (0, _classnames2["default"])(className, classes)
|
15482 | }));
|
15483 | };
|
15484 |
|
15485 | return ModalBody;
|
15486 | }(_react2["default"].Component);
|
15487 |
|
15488 | ModalBody.propTypes = propTypes;
|
15489 | ModalBody.defaultProps = defaultProps;
|
15490 |
|
15491 | exports["default"] = ModalBody;
|
15492 | module.exports = exports['default'];
|
15493 |
|
15494 | }),
|
15495 |
|
15496 | (function(module, exports, __webpack_require__) {
|
15497 |
|
15498 | 'use strict';
|
15499 |
|
15500 | Object.defineProperty(exports, "__esModule", {
|
15501 | value: true
|
15502 | });
|
15503 |
|
15504 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
15505 |
|
15506 | var _classnames = __webpack_require__(5);
|
15507 |
|
15508 | var _classnames2 = _interopRequireDefault(_classnames);
|
15509 |
|
15510 | var _react = __webpack_require__(1);
|
15511 |
|
15512 | var _react2 = _interopRequireDefault(_react);
|
15513 |
|
15514 | var _propTypes = __webpack_require__(6);
|
15515 |
|
15516 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
15517 |
|
15518 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15519 |
|
15520 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
15521 |
|
15522 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
15523 |
|
15524 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
15525 |
|
15526 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15527 |
|
15528 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
15529 |
|
15530 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
15531 |
|
15532 | var propTypes = {
|
15533 | |
15534 |
|
15535 |
|
15536 | dialogClassName: _propTypes2["default"].string,
|
15537 | contentStyle: _propTypes2["default"].object
|
15538 |
|
15539 | };
|
15540 |
|
15541 | var defaultProps = {
|
15542 | clsPrefix: 'u-modal'
|
15543 | };
|
15544 |
|
15545 | var ModalDialog = function (_React$Component) {
|
15546 | _inherits(ModalDialog, _React$Component);
|
15547 |
|
15548 | function ModalDialog() {
|
15549 | _classCallCheck(this, ModalDialog);
|
15550 |
|
15551 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
15552 | }
|
15553 |
|
15554 | ModalDialog.prototype.render = function render() {
|
15555 | var _dialogClasses;
|
15556 |
|
15557 | var _props = this.props,
|
15558 | dialogClassName = _props.dialogClassName,
|
15559 | className = _props.className,
|
15560 | clsPrefix = _props.clsPrefix,
|
15561 | size = _props.size,
|
15562 | style = _props.style,
|
15563 | contentStyle = _props.contentStyle,
|
15564 | children = _props.children,
|
15565 | props = _objectWithoutProperties(_props, ['dialogClassName', 'className', 'clsPrefix', 'size', 'style', 'contentStyle', 'children']);
|
15566 |
|
15567 |
|
15568 |
|
15569 |
|
15570 | var uClassName = _defineProperty({}, '' + clsPrefix, true);
|
15571 |
|
15572 | var modalStyle = { display: 'block' };
|
15573 |
|
15574 | var dialogClasses = (_dialogClasses = {}, _defineProperty(_dialogClasses, uClassName, false), _defineProperty(_dialogClasses, clsPrefix + '-dialog', true), _dialogClasses);
|
15575 | if (size) {
|
15576 | dialogClasses[clsPrefix + '-' + size] = true;
|
15577 | }
|
15578 |
|
15579 | return _react2["default"].createElement(
|
15580 | 'div',
|
15581 | _extends({}, props, {
|
15582 | tabIndex: '-1',
|
15583 | role: 'dialog',
|
15584 | style: modalStyle,
|
15585 | className: (0, _classnames2["default"])(className, uClassName)
|
15586 | }),
|
15587 | _react2["default"].createElement(
|
15588 | 'div',
|
15589 | { className: (0, _classnames2["default"])(dialogClassName, dialogClasses), style: style },
|
15590 | _react2["default"].createElement(
|
15591 | 'div',
|
15592 | { style: contentStyle, className: (0, _classnames2["default"])([clsPrefix + '-content']), role: 'document' },
|
15593 | children
|
15594 | )
|
15595 | )
|
15596 | );
|
15597 | };
|
15598 |
|
15599 | return ModalDialog;
|
15600 | }(_react2["default"].Component);
|
15601 |
|
15602 | ModalDialog.propTypes = propTypes;
|
15603 | ModalDialog.defaultProps = defaultProps;
|
15604 |
|
15605 | exports["default"] = ModalDialog;
|
15606 | module.exports = exports['default'];
|
15607 |
|
15608 | }),
|
15609 |
|
15610 | (function(module, exports, __webpack_require__) {
|
15611 |
|
15612 | 'use strict';
|
15613 |
|
15614 | Object.defineProperty(exports, "__esModule", {
|
15615 | value: true
|
15616 | });
|
15617 |
|
15618 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
15619 |
|
15620 | var _classnames = __webpack_require__(5);
|
15621 |
|
15622 | var _classnames2 = _interopRequireDefault(_classnames);
|
15623 |
|
15624 | var _react = __webpack_require__(1);
|
15625 |
|
15626 | var _react2 = _interopRequireDefault(_react);
|
15627 |
|
15628 | var _tinperBeeCore = __webpack_require__(27);
|
15629 |
|
15630 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15631 |
|
15632 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
15633 |
|
15634 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
15635 |
|
15636 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15637 |
|
15638 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
15639 |
|
15640 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
15641 |
|
15642 | var propTypes = {
|
15643 | componentClass: _tinperBeeCore.elementType
|
15644 | };
|
15645 |
|
15646 | var defaultProps = {
|
15647 | componentClass: 'div',
|
15648 | clsPrefix: 'u-modal-footer'
|
15649 | };
|
15650 |
|
15651 | var ModalFooter = function (_React$Component) {
|
15652 | _inherits(ModalFooter, _React$Component);
|
15653 |
|
15654 | function ModalFooter() {
|
15655 | _classCallCheck(this, ModalFooter);
|
15656 |
|
15657 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
15658 | }
|
15659 |
|
15660 | ModalFooter.prototype.render = function render() {
|
15661 | var _props = this.props,
|
15662 | Component = _props.componentClass,
|
15663 | clsPrefix = _props.clsPrefix,
|
15664 | className = _props.className,
|
15665 | props = _objectWithoutProperties(_props, ['componentClass', 'clsPrefix', 'className']);
|
15666 |
|
15667 | var classes = {};
|
15668 | classes['' + clsPrefix] = true;
|
15669 |
|
15670 | return _react2["default"].createElement(Component, _extends({}, props, {
|
15671 | className: (0, _classnames2["default"])(className, classes)
|
15672 | }));
|
15673 | };
|
15674 |
|
15675 | return ModalFooter;
|
15676 | }(_react2["default"].Component);
|
15677 |
|
15678 | ModalFooter.propTypes = propTypes;
|
15679 | ModalFooter.defaultProps = defaultProps;
|
15680 |
|
15681 | exports["default"] = ModalFooter;
|
15682 | module.exports = exports['default'];
|
15683 |
|
15684 | }),
|
15685 |
|
15686 | (function(module, exports, __webpack_require__) {
|
15687 |
|
15688 | 'use strict';
|
15689 |
|
15690 | Object.defineProperty(exports, "__esModule", {
|
15691 | value: true
|
15692 | });
|
15693 |
|
15694 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
15695 |
|
15696 | var _classnames = __webpack_require__(5);
|
15697 |
|
15698 | var _classnames2 = _interopRequireDefault(_classnames);
|
15699 |
|
15700 | var _react = __webpack_require__(1);
|
15701 |
|
15702 | var _react2 = _interopRequireDefault(_react);
|
15703 |
|
15704 | var _propTypes = __webpack_require__(6);
|
15705 |
|
15706 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
15707 |
|
15708 | var _tinperBeeCore = __webpack_require__(27);
|
15709 |
|
15710 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15711 |
|
15712 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
15713 |
|
15714 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
15715 |
|
15716 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15717 |
|
15718 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
15719 |
|
15720 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
15721 |
|
15722 | var propTypes = {
|
15723 |
|
15724 | |
15725 |
|
15726 |
|
15727 | closeButton: _propTypes2["default"].bool,
|
15728 |
|
15729 | |
15730 |
|
15731 |
|
15732 | onHide: _propTypes2["default"].func
|
15733 | };
|
15734 |
|
15735 | var defaultProps = {
|
15736 | 'aria-label': 'Close',
|
15737 | closeButton: false,
|
15738 | clsPrefix: 'u-modal-header'
|
15739 | };
|
15740 |
|
15741 | var contextTypes = {
|
15742 | $u_modal: _propTypes2["default"].shape({
|
15743 | onHide: _propTypes2["default"].func
|
15744 | })
|
15745 | };
|
15746 |
|
15747 | var ModalHeader = function (_React$Component) {
|
15748 | _inherits(ModalHeader, _React$Component);
|
15749 |
|
15750 | function ModalHeader() {
|
15751 | _classCallCheck(this, ModalHeader);
|
15752 |
|
15753 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
15754 | }
|
15755 |
|
15756 | ModalHeader.prototype.render = function render() {
|
15757 | var _props = this.props,
|
15758 | label = _props['aria-label'],
|
15759 | closeButton = _props.closeButton,
|
15760 | onHide = _props.onHide,
|
15761 | className = _props.className,
|
15762 | clsPrefix = _props.clsPrefix,
|
15763 | children = _props.children,
|
15764 | props = _objectWithoutProperties(_props, ['aria-label', 'closeButton', 'onHide', 'className', 'clsPrefix', 'children']);
|
15765 |
|
15766 | var modal = this.context.$u_modal;
|
15767 |
|
15768 | var classes = {};
|
15769 | classes['' + clsPrefix] = true;
|
15770 |
|
15771 | return _react2["default"].createElement(
|
15772 | 'div',
|
15773 | _extends({}, props, {
|
15774 | className: (0, _classnames2["default"])(className, classes)
|
15775 | }),
|
15776 | closeButton && _react2["default"].createElement(
|
15777 | 'button',
|
15778 | {
|
15779 | type: 'button',
|
15780 | className: 'u-close',
|
15781 | 'aria-label': label,
|
15782 | onClick: (0, _tinperBeeCore.createChainedFunction)(modal.onHide, onHide)
|
15783 | },
|
15784 | _react2["default"].createElement(
|
15785 | 'span',
|
15786 | { 'aria-hidden': 'true' },
|
15787 | _react2["default"].createElement('i', { className: 'uf uf-close' })
|
15788 | )
|
15789 | ),
|
15790 | children
|
15791 | );
|
15792 | };
|
15793 |
|
15794 | return ModalHeader;
|
15795 | }(_react2["default"].Component);
|
15796 |
|
15797 | ModalHeader.propTypes = propTypes;
|
15798 | ModalHeader.defaultProps = defaultProps;
|
15799 | ModalHeader.contextTypes = contextTypes;
|
15800 |
|
15801 | exports["default"] = ModalHeader;
|
15802 | module.exports = exports['default'];
|
15803 |
|
15804 | }),
|
15805 |
|
15806 | (function(module, exports, __webpack_require__) {
|
15807 |
|
15808 | 'use strict';
|
15809 |
|
15810 | Object.defineProperty(exports, "__esModule", {
|
15811 | value: true
|
15812 | });
|
15813 |
|
15814 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
15815 |
|
15816 | var _classnames = __webpack_require__(5);
|
15817 |
|
15818 | var _classnames2 = _interopRequireDefault(_classnames);
|
15819 |
|
15820 | var _react = __webpack_require__(1);
|
15821 |
|
15822 | var _react2 = _interopRequireDefault(_react);
|
15823 |
|
15824 | var _tinperBeeCore = __webpack_require__(27);
|
15825 |
|
15826 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15827 |
|
15828 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
15829 |
|
15830 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
15831 |
|
15832 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15833 |
|
15834 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
15835 |
|
15836 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
15837 |
|
15838 | var propTypes = {
|
15839 | componentClass: _tinperBeeCore.elementType
|
15840 | };
|
15841 |
|
15842 | var defaultProps = {
|
15843 | componentClass: 'h4',
|
15844 | clsPrefix: 'u-modal-title'
|
15845 | };
|
15846 |
|
15847 | var ModalTitle = function (_React$Component) {
|
15848 | _inherits(ModalTitle, _React$Component);
|
15849 |
|
15850 | function ModalTitle() {
|
15851 | _classCallCheck(this, ModalTitle);
|
15852 |
|
15853 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
15854 | }
|
15855 |
|
15856 | ModalTitle.prototype.render = function render() {
|
15857 | var _props = this.props,
|
15858 | Component = _props.componentClass,
|
15859 | className = _props.className,
|
15860 | clsPrefix = _props.clsPrefix,
|
15861 | props = _objectWithoutProperties(_props, ['componentClass', 'className', 'clsPrefix']);
|
15862 |
|
15863 | var classes = {};
|
15864 | classes['' + clsPrefix] = true;
|
15865 |
|
15866 | return _react2["default"].createElement(Component, _extends({}, props, {
|
15867 | className: (0, _classnames2["default"])(className, classes)
|
15868 | }));
|
15869 | };
|
15870 |
|
15871 | return ModalTitle;
|
15872 | }(_react2["default"].Component);
|
15873 |
|
15874 | ModalTitle.propTypes = propTypes;
|
15875 | ModalTitle.defaultProps = defaultProps;
|
15876 |
|
15877 | exports["default"] = ModalTitle;
|
15878 | module.exports = exports['default'];
|
15879 |
|
15880 | }),
|
15881 |
|
15882 | (function(module, exports, __webpack_require__) {
|
15883 |
|
15884 | 'use strict';
|
15885 |
|
15886 | Object.defineProperty(exports, "__esModule", {
|
15887 | value: true
|
15888 | });
|
15889 |
|
15890 | var _FormControl = __webpack_require__(154);
|
15891 |
|
15892 | var _FormControl2 = _interopRequireDefault(_FormControl);
|
15893 |
|
15894 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15895 |
|
15896 | exports["default"] = _FormControl2["default"];
|
15897 | module.exports = exports['default'];
|
15898 |
|
15899 | }),
|
15900 |
|
15901 | (function(module, exports, __webpack_require__) {
|
15902 |
|
15903 | 'use strict';
|
15904 |
|
15905 | Object.defineProperty(exports, "__esModule", {
|
15906 | value: true
|
15907 | });
|
15908 |
|
15909 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
15910 |
|
15911 | var _react = __webpack_require__(1);
|
15912 |
|
15913 | var _react2 = _interopRequireDefault(_react);
|
15914 |
|
15915 | var _classnames = __webpack_require__(5);
|
15916 |
|
15917 | var _classnames2 = _interopRequireDefault(_classnames);
|
15918 |
|
15919 | var _beeIcon = __webpack_require__(106);
|
15920 |
|
15921 | var _beeIcon2 = _interopRequireDefault(_beeIcon);
|
15922 |
|
15923 | var _propTypes = __webpack_require__(6);
|
15924 |
|
15925 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
15926 |
|
15927 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15928 |
|
15929 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
15930 |
|
15931 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
15932 |
|
15933 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15934 |
|
15935 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
15936 |
|
15937 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
15938 |
|
15939 | var propTypes = {
|
15940 | componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string]),
|
15941 | type: _propTypes2["default"].string,
|
15942 | size: _propTypes2["default"].oneOf(['sm', 'md', 'lg']),
|
15943 | onSearch: _propTypes2["default"].func,
|
15944 | onChange: _propTypes2["default"].func,
|
15945 | onBlur: _propTypes2["default"].func,
|
15946 | showClose: _propTypes2["default"].bool,
|
15947 | focusSelect: _propTypes2["default"].bool
|
15948 | };
|
15949 |
|
15950 | var defaultProps = {
|
15951 | componentClass: 'input',
|
15952 | clsPrefix: 'u-form-control',
|
15953 | type: 'text',
|
15954 | size: 'md'
|
15955 | };
|
15956 |
|
15957 | var FormControl = function (_React$Component) {
|
15958 | _inherits(FormControl, _React$Component);
|
15959 |
|
15960 | function FormControl(props) {
|
15961 | _classCallCheck(this, FormControl);
|
15962 |
|
15963 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
15964 |
|
15965 | _this.handleSearchChange = function (e) {
|
15966 | var onChange = _this.props.onChange;
|
15967 |
|
15968 | var value = _this.input.value;
|
15969 | _this.setState({
|
15970 | value: value,
|
15971 | showSearch: value == null || value === ""
|
15972 | });
|
15973 | if (onChange) {
|
15974 | onChange(value, e);
|
15975 | }
|
15976 | };
|
15977 |
|
15978 | _this.handleChange = function (e) {
|
15979 | var onChange = _this.props.onChange;
|
15980 |
|
15981 | var value = _this.input.value;
|
15982 | _this.setState({
|
15983 | showClose: true
|
15984 | });
|
15985 | if (onChange) {
|
15986 | onChange(value, e);
|
15987 | }
|
15988 | };
|
15989 |
|
15990 | _this.clearValue = function () {
|
15991 | var onChange = _this.props.onChange;
|
15992 |
|
15993 | _this.setState({
|
15994 | showSearch: true,
|
15995 | value: "",
|
15996 | showClose: false
|
15997 | });
|
15998 | if (onChange) {
|
15999 | onChange("");
|
16000 | }
|
16001 | _this.input.focus();
|
16002 | };
|
16003 |
|
16004 | _this.handleKeyDown = function (e) {
|
16005 | var _this$props = _this.props,
|
16006 | onSearch = _this$props.onSearch,
|
16007 | type = _this$props.type;
|
16008 |
|
16009 | if (e.keyCode === 13 && type === "search") {
|
16010 | if (onSearch) {
|
16011 | onSearch(_this.input.value);
|
16012 | }
|
16013 | }
|
16014 | };
|
16015 |
|
16016 | _this.handleSearch = function (e) {
|
16017 | var onSearch = _this.props.onSearch;
|
16018 |
|
16019 | if (onSearch) onSearch(_this.input.value);
|
16020 | };
|
16021 |
|
16022 | _this.handleBlur = function (e) {
|
16023 | var value = _this.state.value;
|
16024 | var onBlur = _this.props.onBlur;
|
16025 |
|
16026 |
|
16027 | if (onBlur) {
|
16028 | onBlur(value, e);
|
16029 | }
|
16030 | };
|
16031 |
|
16032 | _this.handleFocus = function (e) {
|
16033 | var value = _this.state.value;
|
16034 | var onFocus = _this.props.onFocus;
|
16035 |
|
16036 | if (_this.props.focusSelect) {
|
16037 | _this.input.select();
|
16038 | }
|
16039 | if (onFocus) {
|
16040 | onFocus(value, e);
|
16041 | }
|
16042 | };
|
16043 |
|
16044 | _this.renderInput = function () {
|
16045 | var _this$props2 = _this.props,
|
16046 | Component = _this$props2.componentClass,
|
16047 | type = _this$props2.type,
|
16048 | className = _this$props2.className,
|
16049 | size = _this$props2.size,
|
16050 | clsPrefix = _this$props2.clsPrefix,
|
16051 | value = _this$props2.value,
|
16052 | onChange = _this$props2.onChange,
|
16053 | onSearch = _this$props2.onSearch,
|
16054 | onBlur = _this$props2.onBlur,
|
16055 | showClose = _this$props2.showClose,
|
16056 | focusSelect = _this$props2.focusSelect,
|
16057 | others = _objectWithoutProperties(_this$props2, ['componentClass', 'type', 'className', 'size', 'clsPrefix', 'value', 'onChange', 'onSearch', 'onBlur', 'showClose', 'focusSelect']);
|
16058 |
|
16059 |
|
16060 |
|
16061 | var classes = {};
|
16062 | if (size) {
|
16063 | classes['' + size] = true;
|
16064 | }
|
16065 |
|
16066 | var classNames = void 0;
|
16067 | if (type !== 'file') {
|
16068 | classNames = (0, _classnames2["default"])(clsPrefix, classes);
|
16069 | }
|
16070 |
|
16071 | return showClose ? _react2["default"].createElement(
|
16072 | 'div',
|
16073 | { className: (0, _classnames2["default"])(clsPrefix + '-close', clsPrefix + '-affix-wrapper', className) },
|
16074 | _react2["default"].createElement(Component, _extends({}, others, {
|
16075 | type: type,
|
16076 | ref: function ref(el) {
|
16077 | return _this.input = el;
|
16078 | },
|
16079 | value: value,
|
16080 | onChange: _this.handleChange,
|
16081 | onBlur: _this.handleBlur,
|
16082 | onFocus: _this.handleFocus,
|
16083 | className: (0, _classnames2["default"])(className, classNames)
|
16084 | })),
|
16085 | _react2["default"].createElement(
|
16086 | 'div',
|
16087 | { className: clsPrefix + '-suffix' },
|
16088 | _this.state.showClose ? _react2["default"].createElement(_beeIcon2["default"], { onClick: _this.clearValue, type: 'uf-close-c' }) : ''
|
16089 | )
|
16090 | ) : _react2["default"].createElement(Component, _extends({}, others, {
|
16091 | type: type,
|
16092 | ref: function ref(el) {
|
16093 | return _this.input = el;
|
16094 | },
|
16095 | value: value,
|
16096 | onChange: _this.handleChange,
|
16097 | onBlur: _this.handleBlur,
|
16098 | onFocus: _this.handleFocus,
|
16099 | className: (0, _classnames2["default"])(className, classNames)
|
16100 | }));
|
16101 | };
|
16102 |
|
16103 | _this.renderSearch = function () {
|
16104 | var _this$props3 = _this.props,
|
16105 | Component = _this$props3.componentClass,
|
16106 | type = _this$props3.type,
|
16107 | className = _this$props3.className,
|
16108 | size = _this$props3.size,
|
16109 | clsPrefix = _this$props3.clsPrefix,
|
16110 | value = _this$props3.value,
|
16111 | onChange = _this$props3.onChange,
|
16112 | onSearch = _this$props3.onSearch,
|
16113 | onBlur = _this$props3.onBlur,
|
16114 | others = _objectWithoutProperties(_this$props3, ['componentClass', 'type', 'className', 'size', 'clsPrefix', 'value', 'onChange', 'onSearch', 'onBlur']);
|
16115 |
|
16116 |
|
16117 |
|
16118 | var classes = {};
|
16119 | if (size) {
|
16120 | classes['' + size] = true;
|
16121 | }
|
16122 | classes[clsPrefix + '-search'] = true;
|
16123 |
|
16124 | if (type === "search") {
|
16125 | return _react2["default"].createElement(
|
16126 | 'div',
|
16127 | { className: (0, _classnames2["default"])(clsPrefix + '-search', clsPrefix + '-affix-wrapper', className) },
|
16128 | _react2["default"].createElement(Component, _extends({}, others, {
|
16129 | type: type,
|
16130 | ref: function ref(el) {
|
16131 | return _this.input = el;
|
16132 | },
|
16133 | onChange: _this.handleSearchChange,
|
16134 | value: value,
|
16135 | onKeyDown: _this.handleKeyDown,
|
16136 | onBlur: _this.handleBlur,
|
16137 | onFocus: _this.handleFocus,
|
16138 | className: (0, _classnames2["default"])(className, clsPrefix, classes)
|
16139 | })),
|
16140 | _react2["default"].createElement(
|
16141 | 'div',
|
16142 | { className: clsPrefix + '-suffix' },
|
16143 | _react2["default"].createElement(_beeIcon2["default"], { type: 'uf-search', onClick: _this.handleSearch })
|
16144 | )
|
16145 | );
|
16146 | }
|
16147 | };
|
16148 |
|
16149 | _this.state = {
|
16150 | showSearch: !props.value,
|
16151 | value: props.value == null ? "" : props.value,
|
16152 | showClose: false
|
16153 | };
|
16154 | _this.input = {};
|
16155 | return _this;
|
16156 | }
|
16157 |
|
16158 | FormControl.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProp) {
|
16159 | if (nextProp.value !== this.state.value) {
|
16160 | this.setState({ value: nextProp.value });
|
16161 | }
|
16162 | };
|
16163 |
|
16164 | FormControl.prototype.render = function render() {
|
16165 |
|
16166 | if (this.props.type === "search") {
|
16167 | return this.renderSearch();
|
16168 | }
|
16169 |
|
16170 | return this.renderInput();
|
16171 | };
|
16172 |
|
16173 | return FormControl;
|
16174 | }(_react2["default"].Component);
|
16175 |
|
16176 | FormControl.propTypes = propTypes;
|
16177 | FormControl.defaultProps = defaultProps;
|
16178 |
|
16179 | exports["default"] = FormControl;
|
16180 | module.exports = exports['default'];
|
16181 |
|
16182 | }),
|
16183 |
|
16184 | (function(module, exports, __webpack_require__) {
|
16185 |
|
16186 | 'use strict';
|
16187 |
|
16188 | Object.defineProperty(exports, "__esModule", {
|
16189 | value: true
|
16190 | });
|
16191 |
|
16192 | var _Button = __webpack_require__(156);
|
16193 |
|
16194 | var _Button2 = _interopRequireDefault(_Button);
|
16195 |
|
16196 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
16197 |
|
16198 | exports["default"] = _Button2["default"];
|
16199 | module.exports = exports['default'];
|
16200 |
|
16201 | }),
|
16202 |
|
16203 | (function(module, exports, __webpack_require__) {
|
16204 |
|
16205 | 'use strict';
|
16206 |
|
16207 | Object.defineProperty(exports, "__esModule", {
|
16208 | value: true
|
16209 | });
|
16210 |
|
16211 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
16212 |
|
16213 | var _react = __webpack_require__(1);
|
16214 |
|
16215 | var _react2 = _interopRequireDefault(_react);
|
16216 |
|
16217 | var _reactDom = __webpack_require__(2);
|
16218 |
|
16219 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
16220 |
|
16221 | var _propTypes = __webpack_require__(6);
|
16222 |
|
16223 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
16224 |
|
16225 | var _classnames = __webpack_require__(5);
|
16226 |
|
16227 | var _classnames2 = _interopRequireDefault(_classnames);
|
16228 |
|
16229 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
16230 |
|
16231 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
16232 |
|
16233 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
16234 |
|
16235 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16236 |
|
16237 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
16238 |
|
16239 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
16240 |
|
16241 | var propTypes = {
|
16242 | |
16243 |
|
16244 |
|
16245 | size: _propTypes2["default"].oneOf(['sm', 'md', 'xg', 'lg']),
|
16246 | |
16247 |
|
16248 |
|
16249 | style: _propTypes2["default"].object,
|
16250 | |
16251 |
|
16252 |
|
16253 | shape: _propTypes2["default"].oneOf(['block', 'round', 'border', 'squared', 'floating', 'pillRight', 'pillLeft', 'icon']),
|
16254 |
|
16255 | bordered: _propTypes2["default"].bool,
|
16256 | |
16257 |
|
16258 |
|
16259 | colors: _propTypes2["default"].oneOf(['primary', 'secondary', 'accent', 'success', 'info', 'warning', 'danger', 'dark', 'light', 'default']),
|
16260 | |
16261 |
|
16262 |
|
16263 |
|
16264 | disabled: _propTypes2["default"].bool,
|
16265 | |
16266 |
|
16267 |
|
16268 |
|
16269 | className: _propTypes2["default"].string,
|
16270 |
|
16271 | |
16272 |
|
16273 |
|
16274 |
|
16275 | htmlType: _propTypes2["default"].oneOf(['submit', 'button', 'reset']),
|
16276 | isSubmit: _propTypes2["default"].bool
|
16277 | };
|
16278 |
|
16279 | var defaultProps = {
|
16280 | disabled: false,
|
16281 | htmlType: 'button',
|
16282 | clsPrefix: 'u-button',
|
16283 | bordered: false,
|
16284 | isSubmit: false
|
16285 | };
|
16286 |
|
16287 | var sizeMap = {
|
16288 | sm: 'sm',
|
16289 | md: 'md',
|
16290 | xg: 'xg',
|
16291 | lg: 'lg'
|
16292 | },
|
16293 | colorsMap = {
|
16294 | primary: 'primary',
|
16295 | secondary: 'secondary',
|
16296 | accent: 'accent',
|
16297 | success: 'success',
|
16298 | info: 'info',
|
16299 | warning: 'warning',
|
16300 | danger: 'danger',
|
16301 | dark: 'dark',
|
16302 | light: 'light'
|
16303 | },
|
16304 | shapeMap = {
|
16305 | block: 'block',
|
16306 | round: 'round',
|
16307 | border: 'border',
|
16308 | squared: 'squared',
|
16309 | floating: 'floating',
|
16310 | pillRight: 'pill-right',
|
16311 | pillLeft: 'pill-left',
|
16312 | icon: 'icon'
|
16313 | };
|
16314 |
|
16315 | var Button = function (_Component) {
|
16316 | _inherits(Button, _Component);
|
16317 |
|
16318 | function Button(props) {
|
16319 | _classCallCheck(this, Button);
|
16320 |
|
16321 | return _possibleConstructorReturn(this, _Component.call(this, props));
|
16322 | }
|
16323 |
|
16324 | Button.prototype.render = function render() {
|
16325 | var _props = this.props,
|
16326 | colors = _props.colors,
|
16327 | shape = _props.shape,
|
16328 | disabled = _props.disabled,
|
16329 | className = _props.className,
|
16330 | size = _props.size,
|
16331 | bordered = _props.bordered,
|
16332 | children = _props.children,
|
16333 | htmlType = _props.htmlType,
|
16334 | clsPrefix = _props.clsPrefix,
|
16335 | isSubmit = _props.isSubmit,
|
16336 | others = _objectWithoutProperties(_props, ['colors', 'shape', 'disabled', 'className', 'size', 'bordered', 'children', 'htmlType', 'clsPrefix', 'isSubmit']);
|
16337 |
|
16338 | var clsObj = {};
|
16339 | if (className) {
|
16340 | clsObj[className] = true;
|
16341 | }
|
16342 | if (sizeMap[size]) {
|
16343 | clsObj[clsPrefix + '-' + sizeMap[size]] = true;
|
16344 | }
|
16345 |
|
16346 | if (shapeMap[shape]) {
|
16347 | clsObj[clsPrefix + '-' + shapeMap[shape]] = true;
|
16348 | }
|
16349 | if (colorsMap[colors]) {
|
16350 | clsObj[clsPrefix + '-' + colorsMap[colors]] = true;
|
16351 | }
|
16352 |
|
16353 | var classes = (0, _classnames2["default"])(clsPrefix, clsObj);
|
16354 | return _react2["default"].createElement(
|
16355 | 'button',
|
16356 | _extends({
|
16357 | type: htmlType,
|
16358 | className: classes,
|
16359 | disabled: disabled
|
16360 | }, others),
|
16361 | this.props.children
|
16362 | );
|
16363 | };
|
16364 |
|
16365 | return Button;
|
16366 | }(_react.Component);
|
16367 |
|
16368 | Button.propTypes = propTypes;
|
16369 | Button.defaultProps = defaultProps;
|
16370 |
|
16371 | exports["default"] = Button;
|
16372 | module.exports = exports['default'];
|
16373 |
|
16374 | }),
|
16375 |
|
16376 | (function(module, exports, __webpack_require__) {
|
16377 |
|
16378 | 'use strict';
|
16379 |
|
16380 | Object.defineProperty(exports, "__esModule", {
|
16381 | value: true
|
16382 | });
|
16383 |
|
16384 | var _RadioGroup = __webpack_require__(158);
|
16385 |
|
16386 | var _RadioGroup2 = _interopRequireDefault(_RadioGroup);
|
16387 |
|
16388 | var _Radio = __webpack_require__(159);
|
16389 |
|
16390 | var _Radio2 = _interopRequireDefault(_Radio);
|
16391 |
|
16392 | var _RadioButton = __webpack_require__(160);
|
16393 |
|
16394 | var _RadioButton2 = _interopRequireDefault(_RadioButton);
|
16395 |
|
16396 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
16397 |
|
16398 | _Radio2['default'].RadioGroup = _RadioGroup2['default'];
|
16399 | _Radio2['default'].RadioButton = _RadioButton2['default'];
|
16400 |
|
16401 | exports['default'] = _Radio2['default'];
|
16402 | module.exports = exports['default'];
|
16403 |
|
16404 | }),
|
16405 |
|
16406 | (function(module, exports, __webpack_require__) {
|
16407 |
|
16408 | 'use strict';
|
16409 |
|
16410 | Object.defineProperty(exports, "__esModule", {
|
16411 | value: true
|
16412 | });
|
16413 |
|
16414 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
16415 |
|
16416 | var _react = __webpack_require__(1);
|
16417 |
|
16418 | var _react2 = _interopRequireDefault(_react);
|
16419 |
|
16420 | var _classnames = __webpack_require__(5);
|
16421 |
|
16422 | var _classnames2 = _interopRequireDefault(_classnames);
|
16423 |
|
16424 | var _propTypes = __webpack_require__(6);
|
16425 |
|
16426 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
16427 |
|
16428 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
16429 |
|
16430 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
16431 |
|
16432 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
16433 |
|
16434 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16435 |
|
16436 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
16437 |
|
16438 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
16439 |
|
16440 | var propTypes = {
|
16441 | name: _propTypes2['default'].string,
|
16442 | |
16443 |
|
16444 |
|
16445 | defaultValue: _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].number, _propTypes2['default'].bool]),
|
16446 | |
16447 |
|
16448 |
|
16449 | selectedValue: _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].number, _propTypes2['default'].bool]),
|
16450 | |
16451 |
|
16452 |
|
16453 | value: _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].number, _propTypes2['default'].bool]),
|
16454 | |
16455 |
|
16456 |
|
16457 | onChange: _propTypes2['default'].func,
|
16458 | |
16459 |
|
16460 |
|
16461 | size: _propTypes2['default'].oneOf(['lg', 'sm']),
|
16462 |
|
16463 | children: _propTypes2['default'].node.isRequired,
|
16464 |
|
16465 | Component: _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].func, _propTypes2['default'].object])
|
16466 | };
|
16467 |
|
16468 | var defaultProps = {
|
16469 | Component: 'div',
|
16470 | clsPrefix: 'u-radio-group',
|
16471 | defaultValue: ''
|
16472 | };
|
16473 |
|
16474 | |
16475 |
|
16476 |
|
16477 | var childContextTypes = {
|
16478 | radioGroup: _propTypes2['default'].object
|
16479 | };
|
16480 |
|
16481 | var RadioGroup = function (_React$Component) {
|
16482 | _inherits(RadioGroup, _React$Component);
|
16483 |
|
16484 | function RadioGroup(props, context) {
|
16485 | _classCallCheck(this, RadioGroup);
|
16486 |
|
16487 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
16488 |
|
16489 | _this.getValues = function () {
|
16490 | var array = [];
|
16491 | var children = _this.props.children;
|
16492 | if (!children) {
|
16493 | console.error('RadioGroup must have child nodes');
|
16494 | return array;
|
16495 | }
|
16496 | if (children.length > 1) {
|
16497 | children.map(function (item) {
|
16498 | array.push(item.props.value);
|
16499 | });
|
16500 | } else if (children.length === 1) {
|
16501 | array.push(children[0].props.value);
|
16502 | } else {
|
16503 | array.push(children.props.value);
|
16504 | }
|
16505 | return array;
|
16506 | };
|
16507 |
|
16508 | _this.handleChange = function (value) {
|
16509 | var onChange = _this.props.onChange;
|
16510 |
|
16511 | _this.setState({
|
16512 | selectedValue: value
|
16513 | });
|
16514 | onChange && onChange(value);
|
16515 | };
|
16516 |
|
16517 | _this.state = {
|
16518 | focusvalue: '',
|
16519 | selectedValue: props.value ? props.value : props.selectedValue ? props.selectedValue : props.defaultValue
|
16520 | };
|
16521 | return _this;
|
16522 | }
|
16523 |
|
16524 | RadioGroup.prototype.componentDidMount = function componentDidMount() {
|
16525 | var array = this.getValues();
|
16526 | if (array.indexOf(this.props.selectedValue) == -1) {
|
16527 | this.setState({
|
16528 | focusvalue: array[0]
|
16529 | });
|
16530 | }
|
16531 | };
|
16532 |
|
16533 | RadioGroup.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
16534 | var array = this.getValues();
|
16535 | if (array.indexOf(this.props.selectedValue) == -1 || array.indexOf(this.props.value) == -1) {
|
16536 | this.setState({
|
16537 | focusvalue: array[0]
|
16538 | });
|
16539 | } else {
|
16540 | this.setState({
|
16541 | focusvalue: ''
|
16542 | });
|
16543 | }
|
16544 | if ('selectedValue' in nextProps || 'value' in nextProps) {
|
16545 | this.setState({
|
16546 | selectedValue: typeof nextProps.selectedValue !== 'undifined' ? nextProps.selectedValue : nextProps.value
|
16547 | });
|
16548 | }
|
16549 | };
|
16550 |
|
16551 | |
16552 |
|
16553 |
|
16554 |
|
16555 | RadioGroup.prototype.getChildContext = function getChildContext() {
|
16556 | var _props = this.props,
|
16557 | name = _props.name,
|
16558 | size = _props.size;
|
16559 | var selectedValue = this.state.selectedValue;
|
16560 |
|
16561 | var onChange = this.handleChange;
|
16562 | return {
|
16563 | radioGroup: {
|
16564 | name: name, selectedValue: selectedValue, onChange: onChange, size: size, focusvalue: this.state.focusvalue
|
16565 | }
|
16566 | };
|
16567 | };
|
16568 |
|
16569 | RadioGroup.prototype.render = function render() {
|
16570 | var _props2 = this.props,
|
16571 | Component = _props2.Component,
|
16572 | name = _props2.name,
|
16573 | selectedValue = _props2.selectedValue,
|
16574 | onChange = _props2.onChange,
|
16575 | children = _props2.children,
|
16576 | size = _props2.size,
|
16577 | clsPrefix = _props2.clsPrefix,
|
16578 | className = _props2.className,
|
16579 | focusvalue = _props2.focusvalue,
|
16580 | others = _objectWithoutProperties(_props2, ['Component', 'name', 'selectedValue', 'onChange', 'children', 'size', 'clsPrefix', 'className', 'focusvalue']);
|
16581 |
|
16582 | return _react2['default'].createElement(
|
16583 | Component,
|
16584 | _extends({ className: (0, _classnames2['default'])(clsPrefix, className) }, others, { focusvalue: this.state.focusvalue }),
|
16585 | children
|
16586 | );
|
16587 | };
|
16588 |
|
16589 | return RadioGroup;
|
16590 | }(_react2['default'].Component);
|
16591 |
|
16592 | RadioGroup.childContextTypes = childContextTypes;
|
16593 | RadioGroup.propTypes = propTypes;
|
16594 | RadioGroup.defaultProps = defaultProps;
|
16595 | exports['default'] = RadioGroup;
|
16596 | module.exports = exports['default'];
|
16597 |
|
16598 | }),
|
16599 |
|
16600 | (function(module, exports, __webpack_require__) {
|
16601 |
|
16602 | 'use strict';
|
16603 |
|
16604 | Object.defineProperty(exports, "__esModule", {
|
16605 | value: true
|
16606 | });
|
16607 |
|
16608 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
16609 |
|
16610 | var _classnames = __webpack_require__(5);
|
16611 |
|
16612 | var _classnames2 = _interopRequireDefault(_classnames);
|
16613 |
|
16614 | var _react = __webpack_require__(1);
|
16615 |
|
16616 | var _react2 = _interopRequireDefault(_react);
|
16617 |
|
16618 | var _propTypes = __webpack_require__(6);
|
16619 |
|
16620 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
16621 |
|
16622 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
16623 |
|
16624 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
16625 |
|
16626 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
16627 |
|
16628 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16629 |
|
16630 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
16631 |
|
16632 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
16633 |
|
16634 | var propTypes = {
|
16635 | |
16636 |
|
16637 |
|
16638 | colors: _propTypes2['default'].oneOf(['', 'dark', 'success', 'info', 'warning', 'danger', 'primary']),
|
16639 | |
16640 |
|
16641 |
|
16642 | size: _propTypes2['default'].oneOf(['lg', 'sm']),
|
16643 | |
16644 |
|
16645 |
|
16646 | disabled: _propTypes2['default'].bool,
|
16647 | |
16648 |
|
16649 |
|
16650 | inverse: _propTypes2['default'].bool
|
16651 | };
|
16652 |
|
16653 | var defaultProps = {
|
16654 | inverse: false,
|
16655 | disabled: false,
|
16656 | clsPrefix: 'u-radio'
|
16657 | };
|
16658 |
|
16659 | |
16660 |
|
16661 |
|
16662 | var contextTypes = {
|
16663 | radioGroup: _propTypes2['default'].object
|
16664 | };
|
16665 |
|
16666 | var Radio = function (_React$Component) {
|
16667 | _inherits(Radio, _React$Component);
|
16668 |
|
16669 | function Radio(props, context) {
|
16670 | _classCallCheck(this, Radio);
|
16671 |
|
16672 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
16673 |
|
16674 | _this.handleClick = _this.handleClick.bind(_this);
|
16675 |
|
16676 | return _this;
|
16677 | }
|
16678 |
|
16679 | Radio.prototype.handleClick = function handleClick(event) {
|
16680 | var onChange = this.context.radioGroup.onChange;
|
16681 |
|
16682 | if (this.props.disabled) {
|
16683 | return;
|
16684 | }
|
16685 | if (onChange) {
|
16686 | onChange(this.props.value);
|
16687 | }
|
16688 | };
|
16689 |
|
16690 | Radio.prototype.render = function render() {
|
16691 | var _context$radioGroup = this.context.radioGroup,
|
16692 | name = _context$radioGroup.name,
|
16693 | selectedValue = _context$radioGroup.selectedValue,
|
16694 | size = _context$radioGroup.size,
|
16695 | focusvalue = _context$radioGroup.focusvalue;
|
16696 | |
16697 |
|
16698 |
|
16699 |
|
16700 | var _props = this.props,
|
16701 | inverse = _props.inverse,
|
16702 | disabled = _props.disabled,
|
16703 | colors = _props.colors,
|
16704 | className = _props.className,
|
16705 | children = _props.children,
|
16706 | clsPrefix = _props.clsPrefix,
|
16707 | style = _props.style,
|
16708 | others = _objectWithoutProperties(_props, ['inverse', 'disabled', 'colors', 'className', 'children', 'clsPrefix', 'style']);
|
16709 |
|
16710 | var optional = {};
|
16711 | |
16712 |
|
16713 |
|
16714 | if (selectedValue !== undefined) {
|
16715 | optional.checked = this.props.value === selectedValue;
|
16716 | }
|
16717 |
|
16718 | var classes = {
|
16719 | 'is-checked': optional.checked,
|
16720 | disabled: disabled
|
16721 | };
|
16722 |
|
16723 | if (colors) {
|
16724 | classes[clsPrefix + '-' + colors] = true;
|
16725 | }
|
16726 | if (size) {
|
16727 | classes[clsPrefix + '-' + size] = true;
|
16728 | }
|
16729 | if (inverse) {
|
16730 | classes[clsPrefix + '-inverse'] = true;
|
16731 | }
|
16732 | if (children == null) {
|
16733 | classes[clsPrefix + '-noContent'] = true;
|
16734 | }
|
16735 | var classNames = (0, _classnames2['default'])(clsPrefix, classes);
|
16736 | var tabIndex = optional.checked ? 0 : -1;
|
16737 | if (focusvalue && focusvalue == this.props.value) {
|
16738 | tabIndex = 0;
|
16739 | }
|
16740 | var input = _react2['default'].createElement('input', _extends({}, others, {
|
16741 | type: 'radio',
|
16742 | name: name,
|
16743 | disabled: this.props.disabled,
|
16744 | tabIndex: tabIndex
|
16745 | }));
|
16746 | return _react2['default'].createElement(
|
16747 | 'label',
|
16748 | { style: style, onClick: this.handleClick, className: (0, _classnames2['default'])(className, classNames) },
|
16749 | input,
|
16750 | _react2['default'].createElement(
|
16751 | 'label',
|
16752 | { className: clsPrefix + '-label' },
|
16753 | children
|
16754 | )
|
16755 | );
|
16756 | };
|
16757 |
|
16758 | return Radio;
|
16759 | }(_react2['default'].Component);
|
16760 |
|
16761 | Radio.contextTypes = contextTypes;
|
16762 | Radio.propTypes = propTypes;
|
16763 | Radio.defaultProps = defaultProps;
|
16764 |
|
16765 | exports['default'] = Radio;
|
16766 | module.exports = exports['default'];
|
16767 |
|
16768 | }),
|
16769 |
|
16770 | (function(module, exports, __webpack_require__) {
|
16771 |
|
16772 | 'use strict';
|
16773 |
|
16774 | Object.defineProperty(exports, "__esModule", {
|
16775 | value: true
|
16776 | });
|
16777 |
|
16778 | var _react = __webpack_require__(1);
|
16779 |
|
16780 | var _react2 = _interopRequireDefault(_react);
|
16781 |
|
16782 | var _Radio = __webpack_require__(159);
|
16783 |
|
16784 | var _Radio2 = _interopRequireDefault(_Radio);
|
16785 |
|
16786 | var _propTypes = __webpack_require__(6);
|
16787 |
|
16788 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
16789 |
|
16790 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
16791 |
|
16792 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
16793 |
|
16794 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16795 |
|
16796 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
16797 |
|
16798 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
16799 |
|
16800 | var propTypes = {
|
16801 | value: _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].number]),
|
16802 | style: _propTypes2['default'].object
|
16803 | };
|
16804 | var defaultProps = {
|
16805 | clsPrefix: "u-radio-button"
|
16806 | };
|
16807 |
|
16808 | var RadioButton = function (_Component) {
|
16809 | _inherits(RadioButton, _Component);
|
16810 |
|
16811 | function RadioButton() {
|
16812 | _classCallCheck(this, RadioButton);
|
16813 |
|
16814 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
16815 | }
|
16816 |
|
16817 | RadioButton.prototype.render = function render() {
|
16818 | return _react2['default'].createElement(_Radio2['default'], this.props);
|
16819 | };
|
16820 |
|
16821 | return RadioButton;
|
16822 | }(_react.Component);
|
16823 |
|
16824 | RadioButton.propTypes = propTypes;
|
16825 | RadioButton.defaultProps = defaultProps;
|
16826 | exports['default'] = RadioButton;
|
16827 | module.exports = exports['default'];
|
16828 |
|
16829 | }),
|
16830 |
|
16831 | (function(module, exports, __webpack_require__) {
|
16832 |
|
16833 | 'use strict';
|
16834 |
|
16835 | Object.defineProperty(exports, "__esModule", {
|
16836 | value: true
|
16837 | });
|
16838 |
|
16839 | var _react = __webpack_require__(1);
|
16840 |
|
16841 | var _react2 = _interopRequireDefault(_react);
|
16842 |
|
16843 | var _src = __webpack_require__(157);
|
16844 |
|
16845 | var _src2 = _interopRequireDefault(_src);
|
16846 |
|
16847 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
16848 |
|
16849 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
16850 |
|
16851 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16852 |
|
16853 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
16854 |
|
16855 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } |
16856 |
|
16857 |
|
16858 |
|
16859 |
|
16860 | var Demo1 = function (_Component) {
|
16861 | _inherits(Demo1, _Component);
|
16862 |
|
16863 | function Demo1(props) {
|
16864 | _classCallCheck(this, Demo1);
|
16865 |
|
16866 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
16867 |
|
16868 | _this.handleChange = function (value) {
|
16869 | console.log('onChange:', value);
|
16870 | };
|
16871 |
|
16872 | return _this;
|
16873 | }
|
16874 |
|
16875 | Demo1.prototype.render = function render() {
|
16876 | return _react2['default'].createElement(
|
16877 | _src2['default'].RadioGroup,
|
16878 | {
|
16879 | name: 'fruits',
|
16880 | defaultValue: '1',
|
16881 | onChange: this.handleChange
|
16882 | },
|
16883 | _react2['default'].createElement(
|
16884 | _src2['default'],
|
16885 | { value: '1', disabled: true },
|
16886 | '\u82F9\u679C'
|
16887 | ),
|
16888 | _react2['default'].createElement(
|
16889 | _src2['default'],
|
16890 | { value: '2', disabled: true },
|
16891 | '\u9999\u8549'
|
16892 | ),
|
16893 | _react2['default'].createElement(
|
16894 | _src2['default'],
|
16895 | { value: '3' },
|
16896 | '\u8461\u8404'
|
16897 | ),
|
16898 | _react2['default'].createElement(
|
16899 | _src2['default'],
|
16900 | { value: '4' },
|
16901 | '\u83E0\u841D'
|
16902 | ),
|
16903 | _react2['default'].createElement(
|
16904 | _src2['default'],
|
16905 | { value: '5' },
|
16906 | '\u68A8'
|
16907 | ),
|
16908 | _react2['default'].createElement(
|
16909 | _src2['default'],
|
16910 | { value: '6' },
|
16911 | '\u77F3\u69B4'
|
16912 | )
|
16913 | );
|
16914 | };
|
16915 |
|
16916 | return Demo1;
|
16917 | }(_react.Component);
|
16918 |
|
16919 | ;
|
16920 |
|
16921 | exports['default'] = Demo1;
|
16922 | module.exports = exports['default'];
|
16923 |
|
16924 | }),
|
16925 |
|
16926 | (function(module, exports, __webpack_require__) {
|
16927 |
|
16928 | 'use strict';
|
16929 |
|
16930 | Object.defineProperty(exports, "__esModule", {
|
16931 | value: true
|
16932 | });
|
16933 |
|
16934 | var _react = __webpack_require__(1);
|
16935 |
|
16936 | var _react2 = _interopRequireDefault(_react);
|
16937 |
|
16938 | var _src = __webpack_require__(157);
|
16939 |
|
16940 | var _src2 = _interopRequireDefault(_src);
|
16941 |
|
16942 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
16943 |
|
16944 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
16945 |
|
16946 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16947 |
|
16948 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
16949 |
|
16950 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } |
16951 |
|
16952 |
|
16953 |
|
16954 |
|
16955 | var Demo2 = function (_Component) {
|
16956 | _inherits(Demo2, _Component);
|
16957 |
|
16958 | function Demo2(props) {
|
16959 | _classCallCheck(this, Demo2);
|
16960 |
|
16961 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
16962 |
|
16963 | _this.state = {
|
16964 | selectedValue: '3'
|
16965 | };
|
16966 | return _this;
|
16967 | }
|
16968 |
|
16969 | Demo2.prototype.handleChange = function handleChange(value) {
|
16970 | this.setState({ selectedValue: value });
|
16971 | };
|
16972 |
|
16973 | Demo2.prototype.render = function render() {
|
16974 | return _react2['default'].createElement(
|
16975 | _src2['default'].RadioGroup,
|
16976 | {
|
16977 | name: 'color',
|
16978 | selectedValue: this.state.selectedValue,
|
16979 | onChange: this.handleChange.bind(this) },
|
16980 | _react2['default'].createElement(
|
16981 | _src2['default'],
|
16982 | { colors: 'primary', value: '1' },
|
16983 | '\u82F9\u679C'
|
16984 | ),
|
16985 | _react2['default'].createElement(
|
16986 | _src2['default'],
|
16987 | { colors: 'success', value: '2' },
|
16988 | '\u9999\u8549'
|
16989 | ),
|
16990 | _react2['default'].createElement(
|
16991 | _src2['default'],
|
16992 | { colors: 'info', value: '3' },
|
16993 | '\u8461\u8404'
|
16994 | ),
|
16995 | _react2['default'].createElement(
|
16996 | _src2['default'],
|
16997 | { colors: 'warning', value: '4' },
|
16998 | '\u83E0\u841D'
|
16999 | ),
|
17000 | _react2['default'].createElement(
|
17001 | _src2['default'],
|
17002 | { colors: 'danger', value: '5' },
|
17003 | '\u68A8'
|
17004 | ),
|
17005 | _react2['default'].createElement(
|
17006 | _src2['default'],
|
17007 | { colors: 'dark', value: '6' },
|
17008 | '\u77F3\u69B4'
|
17009 | )
|
17010 | );
|
17011 | };
|
17012 |
|
17013 | return Demo2;
|
17014 | }(_react.Component);
|
17015 |
|
17016 | ;
|
17017 |
|
17018 | exports['default'] = Demo2;
|
17019 | module.exports = exports['default'];
|
17020 |
|
17021 | }),
|
17022 |
|
17023 | (function(module, exports, __webpack_require__) {
|
17024 |
|
17025 | 'use strict';
|
17026 |
|
17027 | Object.defineProperty(exports, "__esModule", {
|
17028 | value: true
|
17029 | });
|
17030 |
|
17031 | var _react = __webpack_require__(1);
|
17032 |
|
17033 | var _react2 = _interopRequireDefault(_react);
|
17034 |
|
17035 | var _src = __webpack_require__(157);
|
17036 |
|
17037 | var _src2 = _interopRequireDefault(_src);
|
17038 |
|
17039 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
17040 |
|
17041 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
17042 |
|
17043 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
17044 |
|
17045 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
17046 |
|
17047 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } |
17048 |
|
17049 |
|
17050 |
|
17051 |
|
17052 | var Demo3 = function (_Component) {
|
17053 | _inherits(Demo3, _Component);
|
17054 |
|
17055 | function Demo3(props) {
|
17056 | _classCallCheck(this, Demo3);
|
17057 |
|
17058 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
17059 |
|
17060 | _this.state = {
|
17061 | selectedValue: '1'
|
17062 | };
|
17063 | return _this;
|
17064 | }
|
17065 |
|
17066 | Demo3.prototype.handleChange = function handleChange(value) {
|
17067 | this.setState({ selectedValue: value });
|
17068 | };
|
17069 |
|
17070 | Demo3.prototype.render = function render() {
|
17071 | var radioStyle = {
|
17072 | display: 'block'
|
17073 | };
|
17074 | return _react2['default'].createElement(
|
17075 | 'div',
|
17076 | { className: 'demo3' },
|
17077 | _react2['default'].createElement(
|
17078 | _src2['default'].RadioGroup,
|
17079 | {
|
17080 | name: 'team',
|
17081 | selectedValue: this.state.selectedValue,
|
17082 | onChange: this.handleChange.bind(this) },
|
17083 | _react2['default'].createElement(
|
17084 | _src2['default'],
|
17085 | { style: radioStyle, value: '1' },
|
17086 | '\u82F9\u679C'
|
17087 | ),
|
17088 | _react2['default'].createElement(
|
17089 | _src2['default'],
|
17090 | { style: radioStyle, value: '2' },
|
17091 | '\u9999\u8549'
|
17092 | ),
|
17093 | _react2['default'].createElement(
|
17094 | _src2['default'],
|
17095 | { style: radioStyle, value: '3' },
|
17096 | '\u8461\u8404'
|
17097 | ),
|
17098 | _react2['default'].createElement(
|
17099 | _src2['default'],
|
17100 | { style: radioStyle, value: '4' },
|
17101 | '\u83E0\u841D'
|
17102 | ),
|
17103 | _react2['default'].createElement(
|
17104 | _src2['default'],
|
17105 | { style: radioStyle, value: '5' },
|
17106 | '\u68A8'
|
17107 | ),
|
17108 | _react2['default'].createElement(
|
17109 | _src2['default'],
|
17110 | { style: radioStyle, value: '6' },
|
17111 | '\u77F3\u69B4'
|
17112 | )
|
17113 | )
|
17114 | );
|
17115 | };
|
17116 |
|
17117 | return Demo3;
|
17118 | }(_react.Component);
|
17119 |
|
17120 | ;
|
17121 |
|
17122 | exports['default'] = Demo3;
|
17123 | module.exports = exports['default'];
|
17124 |
|
17125 | }),
|
17126 |
|
17127 | (function(module, exports, __webpack_require__) {
|
17128 |
|
17129 | 'use strict';
|
17130 |
|
17131 | Object.defineProperty(exports, "__esModule", {
|
17132 | value: true
|
17133 | });
|
17134 |
|
17135 | var _react = __webpack_require__(1);
|
17136 |
|
17137 | var _react2 = _interopRequireDefault(_react);
|
17138 |
|
17139 | var _src = __webpack_require__(157);
|
17140 |
|
17141 | var _src2 = _interopRequireDefault(_src);
|
17142 |
|
17143 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
17144 |
|
17145 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
17146 |
|
17147 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
17148 |
|
17149 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
17150 |
|
17151 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } |
17152 |
|
17153 |
|
17154 |
|
17155 |
|
17156 | var RadioGroup = _src2['default'].RadioGroup;
|
17157 |
|
17158 | var Demo4 = function (_Component) {
|
17159 | _inherits(Demo4, _Component);
|
17160 |
|
17161 | function Demo4(props) {
|
17162 | _classCallCheck(this, Demo4);
|
17163 |
|
17164 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
17165 |
|
17166 | _this.state = {
|
17167 | selectedValue: 'orange',
|
17168 | selectedValue2: 'apple'
|
17169 | };
|
17170 | return _this;
|
17171 | }
|
17172 |
|
17173 | Demo4.prototype.handleChange = function handleChange(value) {
|
17174 | this.setState({ selectedValue: value });
|
17175 | };
|
17176 |
|
17177 | Demo4.prototype.handleChange2 = function handleChange2(value) {
|
17178 | this.setState({ selectedValue2: value });
|
17179 | };
|
17180 |
|
17181 | Demo4.prototype.render = function render() {
|
17182 | return _react2['default'].createElement(
|
17183 | 'div',
|
17184 | null,
|
17185 | _react2['default'].createElement(
|
17186 | _src2['default'].RadioGroup,
|
17187 | {
|
17188 | name: 'fruit',
|
17189 | selectedValue: this.state.selectedValue,
|
17190 | onChange: this.handleChange.bind(this) },
|
17191 | _react2['default'].createElement(
|
17192 | _src2['default'].RadioButton,
|
17193 | { value: 'apple' },
|
17194 | 'apple'
|
17195 | ),
|
17196 | _react2['default'].createElement(
|
17197 | _src2['default'].RadioButton,
|
17198 | { value: 'banana' },
|
17199 | 'banana'
|
17200 | ),
|
17201 | _react2['default'].createElement(
|
17202 | _src2['default'].RadioButton,
|
17203 | { value: 'orange' },
|
17204 | 'orange'
|
17205 | )
|
17206 | ),
|
17207 | _react2['default'].createElement(
|
17208 | 'div',
|
17209 | { style: { marginTop: 16 } },
|
17210 | _react2['default'].createElement(
|
17211 | _src2['default'].RadioGroup,
|
17212 | {
|
17213 | selectedValue: this.state.selectedValue2,
|
17214 | onChange: this.handleChange2.bind(this) },
|
17215 | _react2['default'].createElement(
|
17216 | _src2['default'].RadioButton,
|
17217 | { value: 'apple' },
|
17218 | 'apple'
|
17219 | ),
|
17220 | _react2['default'].createElement(
|
17221 | _src2['default'].RadioButton,
|
17222 | { value: 'banana', disabled: true },
|
17223 | 'banana'
|
17224 | ),
|
17225 | _react2['default'].createElement(
|
17226 | _src2['default'].RadioButton,
|
17227 | { value: 'orange' },
|
17228 | 'orange'
|
17229 | )
|
17230 | )
|
17231 | ),
|
17232 | _react2['default'].createElement(
|
17233 | 'div',
|
17234 | { style: { marginTop: 16 } },
|
17235 | _react2['default'].createElement(
|
17236 | _src2['default'].RadioGroup,
|
17237 | { selectedValue: 'apple' },
|
17238 | _react2['default'].createElement(
|
17239 | _src2['default'].RadioButton,
|
17240 | { value: 'apple', disabled: true },
|
17241 | 'apple'
|
17242 | ),
|
17243 | _react2['default'].createElement(
|
17244 | _src2['default'].RadioButton,
|
17245 | { value: 'banana', disabled: true },
|
17246 | 'banana'
|
17247 | ),
|
17248 | _react2['default'].createElement(
|
17249 | _src2['default'].RadioButton,
|
17250 | { value: 'orange', disabled: true },
|
17251 | 'orange'
|
17252 | )
|
17253 | )
|
17254 | )
|
17255 | );
|
17256 | };
|
17257 |
|
17258 | return Demo4;
|
17259 | }(_react.Component);
|
17260 |
|
17261 | ;
|
17262 |
|
17263 | exports['default'] = Demo4;
|
17264 | module.exports = exports['default'];
|
17265 |
|
17266 | }),
|
17267 |
|
17268 | (function(module, exports, __webpack_require__) {
|
17269 |
|
17270 | 'use strict';
|
17271 |
|
17272 | Object.defineProperty(exports, "__esModule", {
|
17273 | value: true
|
17274 | });
|
17275 |
|
17276 | var _react = __webpack_require__(1);
|
17277 |
|
17278 | var _react2 = _interopRequireDefault(_react);
|
17279 |
|
17280 | var _src = __webpack_require__(157);
|
17281 |
|
17282 | var _src2 = _interopRequireDefault(_src);
|
17283 |
|
17284 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
17285 |
|
17286 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
17287 |
|
17288 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
17289 |
|
17290 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
17291 |
|
17292 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } |
17293 |
|
17294 |
|
17295 |
|
17296 |
|
17297 | var Demo1 = function (_Component) {
|
17298 | _inherits(Demo1, _Component);
|
17299 |
|
17300 | function Demo1(props) {
|
17301 | _classCallCheck(this, Demo1);
|
17302 |
|
17303 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
17304 |
|
17305 | _this.state = {
|
17306 | selectedValue: '1'
|
17307 | };
|
17308 | return _this;
|
17309 | }
|
17310 |
|
17311 | Demo1.prototype.handleChange = function handleChange(value) {
|
17312 | this.setState({ selectedValue: value });
|
17313 | };
|
17314 |
|
17315 | Demo1.prototype.render = function render() {
|
17316 | return _react2['default'].createElement(
|
17317 | _src2['default'].RadioGroup,
|
17318 | {
|
17319 | name: 'fruits',
|
17320 | selectedValue: this.state.selectedValue,
|
17321 | onChange: this.handleChange.bind(this) },
|
17322 | _react2['default'].createElement(
|
17323 | _src2['default'],
|
17324 | { value: '1', inverse: true },
|
17325 | '\u82F9\u679C'
|
17326 | ),
|
17327 | _react2['default'].createElement(
|
17328 | _src2['default'],
|
17329 | { value: '2', inverse: true },
|
17330 | '\u9999\u8549'
|
17331 | ),
|
17332 | _react2['default'].createElement(
|
17333 | _src2['default'],
|
17334 | { value: '3', inverse: true },
|
17335 | '\u8461\u8404'
|
17336 | )
|
17337 | );
|
17338 | };
|
17339 |
|
17340 | return Demo1;
|
17341 | }(_react.Component);
|
17342 |
|
17343 | ;
|
17344 |
|
17345 | exports['default'] = Demo1;
|
17346 | module.exports = exports['default'];
|
17347 |
|
17348 | })
|
17349 | ]);
|
17350 |
|
\ | No newline at end of file |