UNPKG

332 kBJavaScriptView Raw
1/******/ (function(modules) { // webpackBootstrap
2/******/ // The module cache
3/******/ var installedModules = {};
4/******/
5/******/ // The require function
6/******/ function __webpack_require__(moduleId) {
7/******/
8/******/ // Check if module is in cache
9/******/ if(installedModules[moduleId])
10/******/ return installedModules[moduleId].exports;
11/******/
12/******/ // Create a new module (and put it into the cache)
13/******/ var module = installedModules[moduleId] = {
14/******/ exports: {},
15/******/ id: moduleId,
16/******/ loaded: false
17/******/ };
18/******/
19/******/ // Execute the module function
20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21/******/
22/******/ // Flag the module as loaded
23/******/ module.loaded = true;
24/******/
25/******/ // Return the exports of the module
26/******/ return module.exports;
27/******/ }
28/******/
29/******/
30/******/ // expose the modules object (__webpack_modules__)
31/******/ __webpack_require__.m = modules;
32/******/
33/******/ // expose the module cache
34/******/ __webpack_require__.c = installedModules;
35/******/
36/******/ // __webpack_public_path__
37/******/ __webpack_require__.p = "";
38/******/
39/******/ // Load entry module and return exports
40/******/ return __webpack_require__(0);
41/******/ })
42/************************************************************************/
43/******/ ([
44/* 0 */
45/***/ (function(module, exports, __webpack_require__) {
46
47 'use strict';
48
49 var _beeLayout = __webpack_require__(1);
50
51 var _beePanel = __webpack_require__(8);
52
53 var _beeButton = __webpack_require__(78);
54
55 var _beeButton2 = _interopRequireDefault(_beeButton);
56
57 var _react = __webpack_require__(4);
58
59 var _react2 = _interopRequireDefault(_react);
60
61 var _reactDom = __webpack_require__(12);
62
63 var _reactDom2 = _interopRequireDefault(_reactDom);
64
65 var _src = __webpack_require__(80);
66
67 var _src2 = _interopRequireDefault(_src);
68
69 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
70
71 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; }
72
73 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
74
75 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; }
76
77 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); }
78
79 var CARET = _react2['default'].createElement('i', { className: 'uf uf-arrow-down' });
80
81 var CARETUP = _react2['default'].createElement('i', { className: 'uf uf-arrow-up' });
82
83 var Demo1 = __webpack_require__(83);var Demo2 = __webpack_require__(84);var DemoArray = [{ "example": _react2['default'].createElement(Demo1, null), "title": " 单个图片查看", "code": "/**\n*\n* @title 单个图片查看\n* @description 单个图片查看\n*\n*/\nimport React, { Component } from 'react';\nimport { Viewer } from 'tinper-bee';\n\nclass Demo1 extends Component {\n\n shown=(e)=>{\n console.log(e,'shwon')\n }\n hidden=(e)=>{\n console.log(e,'hidden')\n }\n render () {\n return (\n <Viewer shown={this.shown} hidden={this.hidden}>\n <img id=\"image\" src='http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-1-min.jpg' alt=\"Picture\"/>\n </Viewer>\n )\n }\n}\n", "desc": " 单个图片查看" }, { "example": _react2['default'].createElement(Demo2, null), "title": " 图片列表查看", "code": "/**\n*\n* @title 图片列表查看\n* @description 图片列表查看。 img 的 data-original 写高清大图地址。src写缩略图地址\n*\n*/\nimport React, { Component } from 'react';\nimport { Viewer } from 'tinper-bee';\n\nclass Demo2 extends Component {\n\n render () {\n return (\n <Viewer>\n <div>\n <img data-original=\"http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-5-min.jpg\" src='http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-1-min.jpg' alt=\"Picture\"/>\n <img data-original=\"http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-4-min.jpg\" src='http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-2-min.jpg' alt=\"Picture\"/>\n <img data-original=\"http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-3-min.jpg\" src='http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-3-min.jpg' alt=\"Picture\"/>\n <img data-original=\"http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-2-min.jpg\" src='http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-4-min.jpg' alt=\"Picture\"/>\n <img data-original=\"http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-1-min.jpg\" src='http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-5-min.jpg' alt=\"Picture\"/>\n </div>\n </Viewer>\n )\n }\n}\n", "desc": " 图片列表查看。 img 的 data-original 写高清大图地址。src写缩略图地址" }];
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.state = {
94 open: false
95 };
96 _this.handleClick = _this.handleClick.bind(_this);
97 return _this;
98 }
99
100 Demo.prototype.handleClick = function handleClick() {
101 this.setState({ open: !this.state.open });
102 };
103
104 Demo.prototype.render = function render() {
105 var _props = this.props,
106 title = _props.title,
107 example = _props.example,
108 code = _props.code,
109 desc = _props.desc;
110
111 var caret = this.state.open ? CARETUP : CARET;
112 var text = this.state.open ? "隐藏代码" : "查看代码";
113
114 var footer = _react2['default'].createElement(
115 _beeButton2['default'],
116 { shape: 'block', onClick: this.handleClick },
117 caret,
118 text
119 );
120 return _react2['default'].createElement(
121 _beeLayout.Col,
122 { md: 12 },
123 _react2['default'].createElement(
124 'h3',
125 null,
126 title
127 ),
128 _react2['default'].createElement(
129 'p',
130 null,
131 desc
132 ),
133 _react2['default'].createElement(
134 _beePanel.Panel,
135 { collapsible: true, headerContent: true, expanded: this.state.open, colors: 'bordered', header: example, footer: footer, footerStyle: { padding: 0 } },
136 _react2['default'].createElement(
137 'pre',
138 null,
139 _react2['default'].createElement(
140 'code',
141 { className: 'hljs javascript' },
142 code
143 )
144 )
145 )
146 );
147 };
148
149 return Demo;
150 }(_react.Component);
151
152 var DemoGroup = function (_Component2) {
153 _inherits(DemoGroup, _Component2);
154
155 function DemoGroup(props) {
156 _classCallCheck(this, DemoGroup);
157
158 return _possibleConstructorReturn(this, _Component2.call(this, props));
159 }
160
161 DemoGroup.prototype.render = function render() {
162 return _react2['default'].createElement(
163 _beeLayout.Row,
164 null,
165 DemoArray.map(function (child, index) {
166
167 return _react2['default'].createElement(Demo, { example: child.example, title: child.title, code: child.code, desc: child.desc, key: index });
168 })
169 );
170 };
171
172 return DemoGroup;
173 }(_react.Component);
174
175 _reactDom2['default'].render(_react2['default'].createElement(DemoGroup, null), document.getElementById('tinperBeeDemo'));
176
177/***/ }),
178/* 1 */
179/***/ (function(module, exports, __webpack_require__) {
180
181 'use strict';
182
183 Object.defineProperty(exports, "__esModule", {
184 value: true
185 });
186 exports.Con = exports.Row = exports.Col = undefined;
187
188 var _Col2 = __webpack_require__(2);
189
190 var _Col3 = _interopRequireDefault(_Col2);
191
192 var _Row2 = __webpack_require__(6);
193
194 var _Row3 = _interopRequireDefault(_Row2);
195
196 var _Layout = __webpack_require__(7);
197
198 var _Layout2 = _interopRequireDefault(_Layout);
199
200 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
201
202 exports.Col = _Col3["default"];
203 exports.Row = _Row3["default"];
204 exports.Con = _Layout2["default"];
205
206/***/ }),
207/* 2 */
208/***/ (function(module, exports, __webpack_require__) {
209
210 'use strict';
211
212 Object.defineProperty(exports, "__esModule", {
213 value: true
214 });
215
216 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; };
217
218 var _classnames = __webpack_require__(3);
219
220 var _classnames2 = _interopRequireDefault(_classnames);
221
222 var _react = __webpack_require__(4);
223
224 var _react2 = _interopRequireDefault(_react);
225
226 var _propTypes = __webpack_require__(5);
227
228 var _propTypes2 = _interopRequireDefault(_propTypes);
229
230 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
231
232 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; }
233
234 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; }
235
236 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
237
238 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; }
239
240 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); }
241
242 var propTypes = {
243 componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string]),
244
245 /**
246 * xs显示列数
247 */
248 xs: _propTypes2["default"].number,
249 /**
250 * sm显示列数
251 */
252 sm: _propTypes2["default"].number,
253 /**
254 * md显示列数
255 */
256 md: _propTypes2["default"].number,
257 /**
258 * lg显示列数
259 */
260 lg: _propTypes2["default"].number,
261 /**
262 * xs偏移列数
263 */
264 xsOffset: _propTypes2["default"].number,
265 /**
266 * sm偏移列数
267 */
268 smOffset: _propTypes2["default"].number,
269 /**
270 * md偏移列数
271 */
272 mdOffset: _propTypes2["default"].number,
273 /**
274 * lg偏移列数
275 */
276 lgOffset: _propTypes2["default"].number,
277 /**
278 * xs右偏移列数
279 */
280 xsPush: _propTypes2["default"].number,
281 /**
282 * sm右偏移列数
283 */
284 smPush: _propTypes2["default"].number,
285 /**
286 * md右偏移列数
287 */
288 mdPush: _propTypes2["default"].number,
289 /**
290 * lg右偏移列数
291 */
292 lgPush: _propTypes2["default"].number,
293 /**
294 * xs左偏移列数
295 */
296 xsPull: _propTypes2["default"].number,
297 /**
298 * sm左偏移列数
299 */
300 smPull: _propTypes2["default"].number,
301 /**
302 * md左偏移列数
303 */
304 mdPull: _propTypes2["default"].number,
305 /**
306 * lg左偏移列数
307 */
308 lgPull: _propTypes2["default"].number
309 };
310
311 var defaultProps = {
312 componentClass: 'div',
313 clsPrefix: 'u-col'
314 };
315
316 var DEVICE_SIZES = ['lg', 'md', 'sm', 'xs'];
317
318 var Col = function (_Component) {
319 _inherits(Col, _Component);
320
321 function Col() {
322 _classCallCheck(this, Col);
323
324 return _possibleConstructorReturn(this, _Component.apply(this, arguments));
325 }
326
327 Col.prototype.render = function render() {
328 var _props = this.props,
329 Component = _props.componentClass,
330 className = _props.className,
331 clsPrefix = _props.clsPrefix,
332 others = _objectWithoutProperties(_props, ['componentClass', 'className', 'clsPrefix']);
333
334 var tbClass = [];
335 /**
336 * 对传入props做样式转化
337 * @type {[type]}
338 */
339 DEVICE_SIZES.forEach(function (size) {
340 function popProp(propSuffix, modifier) {
341 var propName = '' + size + propSuffix;
342 var propValue = others[propName];
343
344 if (propValue != undefined && propValue != null) {
345 tbClass.push(clsPrefix + '-' + size + modifier + '-' + propValue);
346 }
347
348 delete others[propName];
349 }
350
351 popProp('', '');
352 popProp('Offset', '-offset');
353 popProp('Push', '-push');
354 popProp('Pull', '-pull');
355 });
356
357 return _react2["default"].createElement(
358 Component,
359 _extends({
360 className: (0, _classnames2["default"])(tbClass, className)
361 }, others),
362 this.props.children
363 );
364 };
365
366 return Col;
367 }(_react.Component);
368
369 Col.defaultProps = defaultProps;
370 Col.propTypes = propTypes;
371
372 exports["default"] = Col;
373 module.exports = exports['default'];
374
375/***/ }),
376/* 3 */
377/***/ (function(module, exports, __webpack_require__) {
378
379 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
380 Copyright (c) 2017 Jed Watson.
381 Licensed under the MIT License (MIT), see
382 http://jedwatson.github.io/classnames
383 */
384 /* global define */
385
386 (function () {
387 'use strict';
388
389 var hasOwn = {}.hasOwnProperty;
390
391 function classNames () {
392 var classes = [];
393
394 for (var i = 0; i < arguments.length; i++) {
395 var arg = arguments[i];
396 if (!arg) continue;
397
398 var argType = typeof arg;
399
400 if (argType === 'string' || argType === 'number') {
401 classes.push(arg);
402 } else if (Array.isArray(arg) && arg.length) {
403 var inner = classNames.apply(null, arg);
404 if (inner) {
405 classes.push(inner);
406 }
407 } else if (argType === 'object') {
408 for (var key in arg) {
409 if (hasOwn.call(arg, key) && arg[key]) {
410 classes.push(key);
411 }
412 }
413 }
414 }
415
416 return classes.join(' ');
417 }
418
419 if (typeof module !== 'undefined' && module.exports) {
420 classNames.default = classNames;
421 module.exports = classNames;
422 } else if (true) {
423 // register as 'classnames', consistent with npm package name
424 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
425 return classNames;
426 }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
427 } else {
428 window.classNames = classNames;
429 }
430 }());
431
432
433/***/ }),
434/* 4 */
435/***/ (function(module, exports) {
436
437 module.exports = React;
438
439/***/ }),
440/* 5 */
441/***/ (function(module, exports) {
442
443 module.exports = PropTypes;
444
445/***/ }),
446/* 6 */
447/***/ (function(module, exports, __webpack_require__) {
448
449 'use strict';
450
451 Object.defineProperty(exports, "__esModule", {
452 value: true
453 });
454
455 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; };
456
457 var _classnames = __webpack_require__(3);
458
459 var _classnames2 = _interopRequireDefault(_classnames);
460
461 var _react = __webpack_require__(4);
462
463 var _react2 = _interopRequireDefault(_react);
464
465 var _propTypes = __webpack_require__(5);
466
467 var _propTypes2 = _interopRequireDefault(_propTypes);
468
469 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
470
471 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; }
472
473 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; }
474
475 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
476
477 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; }
478
479 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); }
480
481 var propTypes = {
482 componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string])
483 };
484
485 var defaultProps = {
486 componentClass: 'div',
487 clsPrefix: 'u-row'
488 };
489
490 var Row = function (_Component) {
491 _inherits(Row, _Component);
492
493 function Row() {
494 _classCallCheck(this, Row);
495
496 return _possibleConstructorReturn(this, _Component.apply(this, arguments));
497 }
498
499 Row.prototype.render = function render() {
500 var _props = this.props,
501 Component = _props.componentClass,
502 clsPrefix = _props.clsPrefix,
503 className = _props.className,
504 others = _objectWithoutProperties(_props, ['componentClass', 'clsPrefix', 'className']);
505
506 var bsclass = '' + clsPrefix;
507
508 return _react2["default"].createElement(
509 Component,
510 _extends({}, others, {
511 className: (0, _classnames2["default"])(bsclass, className)
512 }),
513 this.props.children
514 );
515 };
516
517 return Row;
518 }(_react.Component);
519
520 Row.propTypes = propTypes;
521 Row.defaultProps = defaultProps;
522
523 exports["default"] = Row;
524 module.exports = exports['default'];
525
526/***/ }),
527/* 7 */
528/***/ (function(module, exports, __webpack_require__) {
529
530 'use strict';
531
532 Object.defineProperty(exports, "__esModule", {
533 value: true
534 });
535
536 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; };
537
538 var _classnames = __webpack_require__(3);
539
540 var _classnames2 = _interopRequireDefault(_classnames);
541
542 var _react = __webpack_require__(4);
543
544 var _react2 = _interopRequireDefault(_react);
545
546 var _propTypes = __webpack_require__(5);
547
548 var _propTypes2 = _interopRequireDefault(_propTypes);
549
550 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
551
552 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; }
553
554 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; }
555
556 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; }
557
558 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
559
560 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; }
561
562 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); }
563
564 var propTypes = {
565 /**
566 * Adds `container-fluid` class.
567 */
568 fluid: _propTypes2["default"].bool,
569 /**
570 * You can use a custom element for this component
571 */
572 componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string])
573 };
574
575 var defaultProps = {
576 componentClass: 'div',
577 fluid: false,
578 clsPrefix: 'u-container'
579 };
580
581 var Con = function (_React$Component) {
582 _inherits(Con, _React$Component);
583
584 function Con() {
585 _classCallCheck(this, Con);
586
587 return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
588 }
589
590 Con.prototype.render = function render() {
591 var _tbclass;
592
593 var _props = this.props,
594 fluid = _props.fluid,
595 Component = _props.componentClass,
596 clsPrefix = _props.clsPrefix,
597 className = _props.className,
598 others = _objectWithoutProperties(_props, ['fluid', 'componentClass', 'clsPrefix', 'className']);
599
600 var tbclass = (_tbclass = {}, _defineProperty(_tbclass, '' + clsPrefix, !fluid), _defineProperty(_tbclass, clsPrefix + '-fluid', fluid), _tbclass);
601
602 return _react2["default"].createElement(
603 Component,
604 _extends({}, others, {
605 className: (0, _classnames2["default"])(tbclass, className)
606 }),
607 this.props.children
608 );
609 };
610
611 return Con;
612 }(_react2["default"].Component);
613
614 Con.propTypes = propTypes;
615 Con.defaultProps = defaultProps;
616
617 exports["default"] = Con;
618 module.exports = exports['default'];
619
620/***/ }),
621/* 8 */
622/***/ (function(module, exports, __webpack_require__) {
623
624 'use strict';
625
626 Object.defineProperty(exports, "__esModule", {
627 value: true
628 });
629 exports.PanelGroup = exports.Panel = undefined;
630
631 var _Panel2 = __webpack_require__(9);
632
633 var _Panel3 = _interopRequireDefault(_Panel2);
634
635 var _PanelGroup2 = __webpack_require__(77);
636
637 var _PanelGroup3 = _interopRequireDefault(_PanelGroup2);
638
639 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
640
641 exports.Panel = _Panel3["default"];
642 exports.PanelGroup = _PanelGroup3["default"];
643
644/***/ }),
645/* 9 */
646/***/ (function(module, exports, __webpack_require__) {
647
648 'use strict';
649
650 Object.defineProperty(exports, "__esModule", {
651 value: true
652 });
653
654 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; };
655
656 var _classnames = __webpack_require__(3);
657
658 var _classnames2 = _interopRequireDefault(_classnames);
659
660 var _react = __webpack_require__(4);
661
662 var _react2 = _interopRequireDefault(_react);
663
664 var _beeTransition = __webpack_require__(10);
665
666 var _beeMessage = __webpack_require__(65);
667
668 var _beeMessage2 = _interopRequireDefault(_beeMessage);
669
670 var _propTypes = __webpack_require__(5);
671
672 var _propTypes2 = _interopRequireDefault(_propTypes);
673
674 var _copyToClipboard = __webpack_require__(75);
675
676 var _copyToClipboard2 = _interopRequireDefault(_copyToClipboard);
677
678 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
679
680 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; }
681
682 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; }
683
684 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; }
685
686 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
687
688 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; }
689
690 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); }
691
692 var propTypes = {
693 //是否添加折叠
694 collapsible: _propTypes2["default"].bool,
695 onSelect: _propTypes2["default"].func,
696 //头部组件
697 header: _propTypes2["default"].node,
698 headerStyle: _propTypes2["default"].object,
699 id: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
700 headerContent: _propTypes2["default"].bool,
701 //footer组件
702 footer: _propTypes2["default"].node,
703 footerStyle: _propTypes2["default"].object,
704 //默认是否打开
705 defaultExpanded: _propTypes2["default"].bool,
706 //是否打开
707 expanded: _propTypes2["default"].bool,
708 //每个panel的标记
709 eventKey: _propTypes2["default"].any,
710 headerRole: _propTypes2["default"].string,
711 panelRole: _propTypes2["default"].string,
712 //颜色
713 colors: _propTypes2["default"].oneOf(['primary', 'accent', 'success', 'info', 'warning', 'danger', 'default', 'bordered']),
714
715 // From Collapse.的扩展动画
716 onEnter: _propTypes2["default"].func,
717 onEntering: _propTypes2["default"].func,
718 onEntered: _propTypes2["default"].func,
719 onExit: _propTypes2["default"].func,
720 onExiting: _propTypes2["default"].func,
721 onExited: _propTypes2["default"].func,
722 //是否可复制内容
723 copyable: _propTypes2["default"].bool
724 };
725
726 var defaultProps = {
727 defaultExpanded: false,
728 clsPrefix: "u-panel",
729 colors: "default"
730 };
731
732 var Panel = function (_React$Component) {
733 _inherits(Panel, _React$Component);
734
735 function Panel(props, context) {
736 _classCallCheck(this, Panel);
737
738 var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
739
740 _this.handleClickTitle = _this.handleClickTitle.bind(_this);
741
742 _this.state = {
743 expanded: _this.props.defaultExpanded
744 };
745 return _this;
746 }
747
748 //头部点击事件
749
750
751 Panel.prototype.handleClickTitle = function handleClickTitle(e) {
752 // 不让事件进入事件池
753 e.persist();
754 e.selected = true;
755
756 if (this.props.onSelect) {
757 this.props.onSelect(this.props.eventKey, e);
758 } else {
759 e.preventDefault();
760 }
761
762 if (e.selected) {
763 this.setState({ expanded: !this.state.expanded });
764 }
765 };
766
767 //渲染panelheader
768
769
770 Panel.prototype.renderHeader = function renderHeader(collapsible, header, id, role, expanded, clsPrefix) {
771 var titleClassName = clsPrefix + '-title';
772
773 if (!collapsible) {
774 if (!_react2["default"].isValidElement(header)) {
775 return header;
776 }
777
778 return (0, _react.cloneElement)(header, {
779 className: (0, _classnames2["default"])(header.props.className, titleClassName)
780 });
781 }
782
783 if (!_react2["default"].isValidElement(header)) {
784 return _react2["default"].createElement(
785 'h4',
786 { role: 'presentation', className: titleClassName },
787 this.renderAnchor(header, id, role, expanded)
788 );
789 }
790 if (this.props.headerContent) {
791 return (0, _react.cloneElement)(header, {
792 className: (0, _classnames2["default"])(header.props.className, titleClassName)
793 });
794 }
795
796 return (0, _react.cloneElement)(header, {
797 className: (0, _classnames2["default"])(header.props.className, titleClassName),
798 children: this.renderAnchor(header.props.children, id, role, expanded)
799 });
800 };
801
802 //如果使用链接,渲染为a标签
803
804
805 Panel.prototype.renderAnchor = function renderAnchor(header, id, role, expanded) {
806 return _react2["default"].createElement(
807 'a',
808 {
809 role: role,
810 href: id && '#' + id,
811 'aria-controls': id,
812 'aria-expanded': expanded,
813 'aria-selected': expanded,
814 className: expanded ? null : 'collapsed'
815 },
816 header
817 );
818 };
819
820 //复制代码,弹出提示信息
821
822
823 Panel.prototype.copyDemo = function copyDemo(e) {
824 var panelTarget = e.target.parentNode;
825 var clipBoardContent = panelTarget.firstChild.innerText;
826 (0, _copyToClipboard2["default"])(clipBoardContent);
827 _beeMessage2["default"].create({ content: '复制成功!', color: 'success', duration: 2 });
828 };
829
830 //如果有折叠动画,渲染折叠动画
831
832
833 Panel.prototype.renderCollapsibleBody = function renderCollapsibleBody(id, expanded, role, children, clsPrefix, copyable, animationHooks) {
834 return _react2["default"].createElement(
835 _beeTransition.Collapse,
836 _extends({ 'in': expanded }, animationHooks),
837 _react2["default"].createElement(
838 'div',
839 {
840 id: id,
841 role: role,
842 className: clsPrefix + '-collapse',
843 'aria-hidden': !expanded
844 },
845 this.renderBody(children, clsPrefix, copyable)
846 )
847 );
848 };
849
850 //渲染panelbody
851
852
853 Panel.prototype.renderBody = function renderBody(rawChildren, clsPrefix, copyable) {
854 var self = this;
855 var children = [];
856 var bodyChildren = [];
857
858 var bodyClassName = clsPrefix + '-body';
859 //添加到body的children中
860 function maybeAddBody(self) {
861 if (!bodyChildren.length) {
862 return;
863 }
864 // 给子组件添加key,为了之后触发事件时使用
865 children.push(_react2["default"].createElement(
866 'div',
867 { key: children.length, className: bodyClassName },
868 bodyChildren,
869 copyable && _react2["default"].createElement('i', { className: 'uf uf-files-o', onClick: self.copyDemo })
870 ));
871 bodyChildren = [];
872 }
873
874 //转换为数组,方便复用
875 _react2["default"].Children.toArray(rawChildren).forEach(function (child) {
876 if (_react2["default"].isValidElement(child) && child.props.fill) {
877 maybeAddBody(self);
878
879 //将标示fill设置为undefined
880 children.push((0, _react.cloneElement)(child, { fill: undefined }));
881
882 return;
883 }
884 bodyChildren.push(child);
885 });
886
887 maybeAddBody(self);
888
889 return children;
890 };
891
892 Panel.prototype.render = function render() {
893 var _props = this.props,
894 collapsible = _props.collapsible,
895 header = _props.header,
896 id = _props.id,
897 footer = _props.footer,
898 propsExpanded = _props.expanded,
899 footerStyle = _props.footerStyle,
900 headerStyle = _props.headerStyle,
901 headerRole = _props.headerRole,
902 panelRole = _props.panelRole,
903 className = _props.className,
904 colors = _props.colors,
905 children = _props.children,
906 onEnter = _props.onEnter,
907 onEntering = _props.onEntering,
908 onEntered = _props.onEntered,
909 clsPrefix = _props.clsPrefix,
910 onExit = _props.onExit,
911 headerContent = _props.headerContent,
912 onExiting = _props.onExiting,
913 onExited = _props.onExited,
914 defaultExpanded = _props.defaultExpanded,
915 eventKey = _props.eventKey,
916 onSelect = _props.onSelect,
917 copyable = _props.copyable,
918 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']);
919
920 var expanded = propsExpanded != null ? propsExpanded : this.state.expanded;
921
922 var classes = {};
923 classes['' + clsPrefix] = true;
924 classes[clsPrefix + '-' + colors] = true;
925
926 var headerClass = _defineProperty({}, clsPrefix + '-heading', true);
927
928 copyable === false ? false : true;
929 return _react2["default"].createElement(
930 'div',
931 _extends({}, props, {
932 className: (0, _classnames2["default"])(className, classes),
933 id: collapsible ? null : id
934 }),
935 header && _react2["default"].createElement(
936 'div',
937 { className: (0, _classnames2["default"])(headerClass), style: headerStyle, onClick: this.handleClickTitle },
938 this.renderHeader(collapsible, header, id, headerRole, expanded, clsPrefix)
939 ),
940 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),
941 footer && _react2["default"].createElement(
942 'div',
943 { className: clsPrefix + '-footer', style: footerStyle },
944 footer
945 )
946 );
947 };
948
949 return Panel;
950 }(_react2["default"].Component);
951
952 Panel.propTypes = propTypes;
953 Panel.defaultProps = defaultProps;
954
955 exports["default"] = Panel;
956 module.exports = exports['default'];
957
958/***/ }),
959/* 10 */
960/***/ (function(module, exports, __webpack_require__) {
961
962 'use strict';
963
964 Object.defineProperty(exports, "__esModule", {
965 value: true
966 });
967 exports.Fade = exports.Collapse = exports.Transition = undefined;
968
969 var _Transition2 = __webpack_require__(11);
970
971 var _Transition3 = _interopRequireDefault(_Transition2);
972
973 var _Collapse2 = __webpack_require__(17);
974
975 var _Collapse3 = _interopRequireDefault(_Collapse2);
976
977 var _Fade2 = __webpack_require__(64);
978
979 var _Fade3 = _interopRequireDefault(_Fade2);
980
981 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
982
983 exports.Transition = _Transition3["default"];
984 exports.Collapse = _Collapse3["default"];
985 exports.Fade = _Fade3["default"];
986
987/***/ }),
988/* 11 */
989/***/ (function(module, exports, __webpack_require__) {
990
991 'use strict';
992
993 Object.defineProperty(exports, "__esModule", {
994 value: true
995 });
996 exports.EXITING = exports.ENTERED = exports.ENTERING = exports.EXITED = exports.UNMOUNTED = undefined;
997
998 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; };
999
1000 var _react = __webpack_require__(4);
1001
1002 var _react2 = _interopRequireDefault(_react);
1003
1004 var _reactDom = __webpack_require__(12);
1005
1006 var _reactDom2 = _interopRequireDefault(_reactDom);
1007
1008 var _properties = __webpack_require__(13);
1009
1010 var _properties2 = _interopRequireDefault(_properties);
1011
1012 var _on = __webpack_require__(16);
1013
1014 var _on2 = _interopRequireDefault(_on);
1015
1016 var _classnames = __webpack_require__(3);
1017
1018 var _classnames2 = _interopRequireDefault(_classnames);
1019
1020 var _propTypes = __webpack_require__(5);
1021
1022 var _propTypes2 = _interopRequireDefault(_propTypes);
1023
1024 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
1025
1026 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; }
1027
1028 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; }
1029
1030 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1031
1032 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; }
1033
1034 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); }
1035
1036 var transitionEndEvent = _properties2["default"].end;
1037
1038 //设置状态码
1039 var UNMOUNTED = exports.UNMOUNTED = 0;
1040 var EXITED = exports.EXITED = 1;
1041 var ENTERING = exports.ENTERING = 2;
1042 var ENTERED = exports.ENTERED = 3;
1043 var EXITING = exports.EXITING = 4;
1044
1045 var propTypes = {
1046 /**
1047 * 是否触发动画
1048 */
1049 "in": _propTypes2["default"].bool,
1050
1051 /**
1052 * 不显示的时候是否移除组件
1053 */
1054 unmountOnExit: _propTypes2["default"].bool,
1055
1056 /**
1057 * 如果设置为默认显示,挂载时显示动画
1058 */
1059 transitionAppear: _propTypes2["default"].bool,
1060
1061 /**
1062 * 设置超时时间,防止出现问题,可设置为>=动画时间
1063 */
1064 timeout: _propTypes2["default"].number,
1065
1066 /**
1067 * 退出组件时添加的class
1068 */
1069 exitedClassName: _propTypes2["default"].string,
1070 /**
1071 * 退出组件中添加的class
1072 */
1073 exitingClassName: _propTypes2["default"].string,
1074 /**
1075 * 进入动画后添加的class
1076 */
1077 enteredClassName: _propTypes2["default"].string,
1078 /**
1079 * 进入动画时添加的class
1080 */
1081 enteringClassName: _propTypes2["default"].string,
1082
1083 /**
1084 * 进入动画开始时的钩子函数
1085 */
1086 onEnter: _propTypes2["default"].func,
1087 /**
1088 * 进入动画中的钩子函数
1089 */
1090 onEntering: _propTypes2["default"].func,
1091 /**
1092 * 进入动画后的钩子函数
1093 */
1094 onEntered: _propTypes2["default"].func,
1095 /**
1096 * 退出动画开始时的钩子函数
1097 */
1098 onExit: _propTypes2["default"].func,
1099 /**
1100 * 退出动画中的钩子函数
1101 */
1102 onExiting: _propTypes2["default"].func,
1103 /**
1104 * 退出动画后的钩子函数
1105 */
1106 onExited: _propTypes2["default"].func
1107 };
1108
1109 function noop() {}
1110
1111 var defaultProps = {
1112 "in": false,
1113 unmountOnExit: false,
1114 transitionAppear: false,
1115 timeout: 5000,
1116 onEnter: noop,
1117 onEntering: noop,
1118 onEntered: noop,
1119 onExit: noop,
1120 onExiting: noop,
1121 onExited: noop
1122 };
1123
1124 /**
1125 * 动画组件
1126 */
1127
1128 var Transition = function (_Component) {
1129 _inherits(Transition, _Component);
1130
1131 function Transition(props, context) {
1132 _classCallCheck(this, Transition);
1133
1134 var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
1135
1136 var initialStatus = void 0;
1137 if (props["in"]) {
1138 // 在componentdidmount时开始执行动画
1139 initialStatus = props.transitionAppear ? EXITED : ENTERED;
1140 } else {
1141 initialStatus = props.unmountOnExit ? UNMOUNTED : EXITED;
1142 }
1143 _this.state = { status: initialStatus };
1144
1145 _this.nextCallback = null;
1146 return _this;
1147 }
1148
1149 Transition.prototype.componentDidMount = function componentDidMount() {
1150 if (this.props.transitionAppear && this.props["in"]) {
1151 this.performEnter(this.props);
1152 }
1153 };
1154
1155 Transition.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
1156 if (nextProps["in"] && this.props.unmountOnExit) {
1157 if (this.state.status === UNMOUNTED) {
1158 // 在componentDidUpdate执行动画.
1159 this.setState({ status: EXITED });
1160 }
1161 } else {
1162 this._needsUpdate = true;
1163 }
1164 };
1165
1166 Transition.prototype.componentDidUpdate = function componentDidUpdate() {
1167 var status = this.state.status;
1168
1169 if (this.props.unmountOnExit && status === EXITED) {
1170 // 当使用unmountOnExit时,exited为exiting和unmont的过渡状态
1171 if (this.props["in"]) {
1172 this.performEnter(this.props);
1173 } else {
1174 this.setState({ status: UNMOUNTED });
1175 }
1176
1177 return;
1178 }
1179
1180 // 确保只响应prop变化
1181 if (this._needsUpdate) {
1182 this._needsUpdate = false;
1183
1184 if (this.props["in"]) {
1185 if (status === EXITING) {
1186 this.performEnter(this.props);
1187 } else if (status === EXITED) {
1188 this.performEnter(this.props);
1189 }
1190 // 其他,当我们已经输入或输出
1191 } else {
1192 if (status === ENTERING || status === ENTERED) {
1193 this.performExit(this.props);
1194 }
1195 // 我们已经输入或输出完成
1196 }
1197 }
1198 };
1199
1200 Transition.prototype.componentWillUnmount = function componentWillUnmount() {
1201 this.cancelNextCallback();
1202 };
1203
1204 Transition.prototype.performEnter = function performEnter(props) {
1205 var _this2 = this;
1206
1207 this.cancelNextCallback();
1208 var node = _reactDom2["default"].findDOMNode(this);
1209
1210 // 这里接收新props
1211 props.onEnter(node);
1212
1213 this.safeSetState({ status: ENTERING }, function () {
1214 _this2.props.onEntering(node);
1215
1216 _this2.onTransitionEnd(node, function () {
1217 _this2.safeSetState({ status: ENTERED }, function () {
1218 _this2.props.onEntered(node);
1219 });
1220 });
1221 });
1222 };
1223
1224 Transition.prototype.performExit = function performExit(props) {
1225 var _this3 = this;
1226
1227 this.cancelNextCallback();
1228 var node = _reactDom2["default"].findDOMNode(this);
1229
1230 props.onExit(node);
1231
1232 this.safeSetState({ status: EXITING }, function () {
1233 _this3.props.onExiting(node);
1234
1235 _this3.onTransitionEnd(node, function () {
1236 _this3.safeSetState({ status: EXITED }, function () {
1237 _this3.props.onExited(node);
1238 });
1239 });
1240 });
1241 };
1242
1243 Transition.prototype.cancelNextCallback = function cancelNextCallback() {
1244 if (this.nextCallback !== null) {
1245 this.nextCallback.cancel();
1246 this.nextCallback = null;
1247 }
1248 };
1249
1250 Transition.prototype.safeSetState = function safeSetState(nextState, callback) {
1251 // 确保在组件销毁后挂起的setState被消除
1252 this.setState(nextState, this.setNextCallback(callback));
1253 };
1254
1255 Transition.prototype.setNextCallback = function setNextCallback(callback) {
1256 var _this4 = this;
1257
1258 var active = true;
1259
1260 this.nextCallback = function (event) {
1261 if (active) {
1262 active = false;
1263 _this4.nextCallback = null;
1264
1265 callback(event);
1266 }
1267 };
1268
1269 this.nextCallback.cancel = function () {
1270 active = false;
1271 };
1272
1273 return this.nextCallback;
1274 };
1275
1276 Transition.prototype.onTransitionEnd = function onTransitionEnd(node, handler) {
1277 this.setNextCallback(handler);
1278
1279 if (node) {
1280 if (transitionEndEvent == undefined) {
1281 this.nextCallback();
1282 } else {
1283 (0, _on2["default"])(node, transitionEndEvent, this.nextCallback);
1284 }
1285 setTimeout(this.nextCallback, this.props.timeout);
1286 } else {
1287 setTimeout(this.nextCallback, 0);
1288 }
1289 };
1290
1291 Transition.prototype.render = function render() {
1292 var status = this.state.status;
1293 if (status === UNMOUNTED) {
1294 return null;
1295 }
1296
1297 var _props = this.props,
1298 children = _props.children,
1299 className = _props.className,
1300 childProps = _objectWithoutProperties(_props, ['children', 'className']);
1301
1302 Object.keys(Transition.propTypes).forEach(function (key) {
1303 return delete childProps[key];
1304 });
1305
1306 var transitionClassName = void 0;
1307 if (status === EXITED) {
1308 transitionClassName = this.props.exitedClassName;
1309 } else if (status === ENTERING) {
1310 transitionClassName = this.props.enteringClassName;
1311 } else if (status === ENTERED) {
1312 transitionClassName = this.props.enteredClassName;
1313 } else if (status === EXITING) {
1314 transitionClassName = this.props.exitingClassName;
1315 }
1316
1317 var child = _react2["default"].Children.only(children);
1318 return _react2["default"].cloneElement(child, _extends({}, childProps, {
1319 className: (0, _classnames2["default"])(child.props.className, className, transitionClassName)
1320 }));
1321 };
1322
1323 return Transition;
1324 }(_react.Component);
1325
1326 Transition.propTypes = propTypes;
1327
1328 Transition.defaultProps = defaultProps;
1329
1330 exports["default"] = Transition;
1331
1332/***/ }),
1333/* 12 */
1334/***/ (function(module, exports) {
1335
1336 module.exports = ReactDOM;
1337
1338/***/ }),
1339/* 13 */
1340/***/ (function(module, exports, __webpack_require__) {
1341
1342 "use strict";
1343
1344 var _interopRequireDefault = __webpack_require__(14);
1345
1346 exports.__esModule = true;
1347 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;
1348
1349 var _inDOM = _interopRequireDefault(__webpack_require__(15));
1350
1351 var transform = 'transform';
1352 exports.transform = transform;
1353 var prefix, transitionEnd, animationEnd;
1354 exports.animationEnd = animationEnd;
1355 exports.transitionEnd = transitionEnd;
1356 var transitionProperty, transitionDuration, transitionTiming, transitionDelay;
1357 exports.transitionDelay = transitionDelay;
1358 exports.transitionTiming = transitionTiming;
1359 exports.transitionDuration = transitionDuration;
1360 exports.transitionProperty = transitionProperty;
1361 var animationName, animationDuration, animationTiming, animationDelay;
1362 exports.animationDelay = animationDelay;
1363 exports.animationTiming = animationTiming;
1364 exports.animationDuration = animationDuration;
1365 exports.animationName = animationName;
1366
1367 if (_inDOM.default) {
1368 var _getTransitionPropert = getTransitionProperties();
1369
1370 prefix = _getTransitionPropert.prefix;
1371 exports.transitionEnd = transitionEnd = _getTransitionPropert.transitionEnd;
1372 exports.animationEnd = animationEnd = _getTransitionPropert.animationEnd;
1373 exports.transform = transform = prefix + "-" + transform;
1374 exports.transitionProperty = transitionProperty = prefix + "-transition-property";
1375 exports.transitionDuration = transitionDuration = prefix + "-transition-duration";
1376 exports.transitionDelay = transitionDelay = prefix + "-transition-delay";
1377 exports.transitionTiming = transitionTiming = prefix + "-transition-timing-function";
1378 exports.animationName = animationName = prefix + "-animation-name";
1379 exports.animationDuration = animationDuration = prefix + "-animation-duration";
1380 exports.animationTiming = animationTiming = prefix + "-animation-delay";
1381 exports.animationDelay = animationDelay = prefix + "-animation-timing-function";
1382 }
1383
1384 var _default = {
1385 transform: transform,
1386 end: transitionEnd,
1387 property: transitionProperty,
1388 timing: transitionTiming,
1389 delay: transitionDelay,
1390 duration: transitionDuration
1391 };
1392 exports.default = _default;
1393
1394 function getTransitionProperties() {
1395 var style = document.createElement('div').style;
1396 var vendorMap = {
1397 O: function O(e) {
1398 return "o" + e.toLowerCase();
1399 },
1400 Moz: function Moz(e) {
1401 return e.toLowerCase();
1402 },
1403 Webkit: function Webkit(e) {
1404 return "webkit" + e;
1405 },
1406 ms: function ms(e) {
1407 return "MS" + e;
1408 }
1409 };
1410 var vendors = Object.keys(vendorMap);
1411 var transitionEnd, animationEnd;
1412 var prefix = '';
1413
1414 for (var i = 0; i < vendors.length; i++) {
1415 var vendor = vendors[i];
1416
1417 if (vendor + "TransitionProperty" in style) {
1418 prefix = "-" + vendor.toLowerCase();
1419 transitionEnd = vendorMap[vendor]('TransitionEnd');
1420 animationEnd = vendorMap[vendor]('AnimationEnd');
1421 break;
1422 }
1423 }
1424
1425 if (!transitionEnd && 'transitionProperty' in style) transitionEnd = 'transitionend';
1426 if (!animationEnd && 'animationName' in style) animationEnd = 'animationend';
1427 style = null;
1428 return {
1429 animationEnd: animationEnd,
1430 transitionEnd: transitionEnd,
1431 prefix: prefix
1432 };
1433 }
1434
1435/***/ }),
1436/* 14 */
1437/***/ (function(module, exports) {
1438
1439 function _interopRequireDefault(obj) {
1440 return obj && obj.__esModule ? obj : {
1441 default: obj
1442 };
1443 }
1444
1445 module.exports = _interopRequireDefault;
1446
1447/***/ }),
1448/* 15 */
1449/***/ (function(module, exports) {
1450
1451 "use strict";
1452
1453 exports.__esModule = true;
1454 exports.default = void 0;
1455
1456 var _default = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
1457
1458 exports.default = _default;
1459 module.exports = exports["default"];
1460
1461/***/ }),
1462/* 16 */
1463/***/ (function(module, exports, __webpack_require__) {
1464
1465 "use strict";
1466
1467 var _interopRequireDefault = __webpack_require__(14);
1468
1469 exports.__esModule = true;
1470 exports.default = void 0;
1471
1472 var _inDOM = _interopRequireDefault(__webpack_require__(15));
1473
1474 var on = function on() {};
1475
1476 if (_inDOM.default) {
1477 on = function () {
1478 if (document.addEventListener) return function (node, eventName, handler, capture) {
1479 return node.addEventListener(eventName, handler, capture || false);
1480 };else if (document.attachEvent) return function (node, eventName, handler) {
1481 return node.attachEvent('on' + eventName, function (e) {
1482 e = e || window.event;
1483 e.target = e.target || e.srcElement;
1484 e.currentTarget = node;
1485 handler.call(node, e);
1486 });
1487 };
1488 }();
1489 }
1490
1491 var _default = on;
1492 exports.default = _default;
1493 module.exports = exports["default"];
1494
1495/***/ }),
1496/* 17 */
1497/***/ (function(module, exports, __webpack_require__) {
1498
1499 'use strict';
1500
1501 Object.defineProperty(exports, "__esModule", {
1502 value: true
1503 });
1504
1505 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; };
1506
1507 var _classnames = __webpack_require__(3);
1508
1509 var _classnames2 = _interopRequireDefault(_classnames);
1510
1511 var _style = __webpack_require__(18);
1512
1513 var _style2 = _interopRequireDefault(_style);
1514
1515 var _react = __webpack_require__(4);
1516
1517 var _react2 = _interopRequireDefault(_react);
1518
1519 var _propTypes = __webpack_require__(5);
1520
1521 var _propTypes2 = _interopRequireDefault(_propTypes);
1522
1523 var _Transition = __webpack_require__(11);
1524
1525 var _Transition2 = _interopRequireDefault(_Transition);
1526
1527 var _capitalize = __webpack_require__(26);
1528
1529 var _capitalize2 = _interopRequireDefault(_capitalize);
1530
1531 var _tinperBeeCore = __webpack_require__(27);
1532
1533 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
1534
1535 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; }
1536
1537 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; }
1538
1539 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1540
1541 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; }
1542
1543 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); }
1544
1545 var MARGINS = {
1546 height: ['marginTop', 'marginBottom'],
1547 width: ['marginLeft', 'marginRight']
1548 };
1549
1550 // reading a dimension prop will cause the browser to recalculate,
1551 // which will let our animations work
1552 function triggerBrowserReflow(node) {
1553 node.offsetHeight; // eslint-disable-line no-unused-expressions
1554 }
1555
1556 function getDimensionValue(dimension, elem) {
1557 var value = elem['offset' + (0, _capitalize2["default"])(dimension)];
1558 var margins = MARGINS[dimension];
1559
1560 return value + parseInt((0, _style2["default"])(elem, margins[0]), 10) + parseInt((0, _style2["default"])(elem, margins[1]), 10);
1561 }
1562
1563 var propTypes = {
1564 /**
1565 * Show the component; triggers the expand or collapse animation
1566 */
1567 "in": _propTypes2["default"].bool,
1568
1569 /**
1570 * Unmount the component (remove it from the DOM) when it is collapsed
1571 */
1572 unmountOnExit: _propTypes2["default"].bool,
1573
1574 /**
1575 * Run the expand animation when the component mounts, if it is initially
1576 * shown
1577 */
1578 transitionAppear: _propTypes2["default"].bool,
1579
1580 /**
1581 * Duration of the collapse animation in milliseconds, to ensure that
1582 * finishing callbacks are fired even if the original browser transition end
1583 * events are canceled
1584 */
1585 timeout: _propTypes2["default"].number,
1586
1587 /**
1588 * Callback fired before the component expands
1589 */
1590 onEnter: _propTypes2["default"].func,
1591 /**
1592 * Callback fired after the component starts to expand
1593 */
1594 onEntering: _propTypes2["default"].func,
1595 /**
1596 * Callback fired after the component has expanded
1597 */
1598 onEntered: _propTypes2["default"].func,
1599 /**
1600 * Callback fired before the component collapses
1601 */
1602 onExit: _propTypes2["default"].func,
1603 /**
1604 * Callback fired after the component starts to collapse
1605 */
1606 onExiting: _propTypes2["default"].func,
1607 /**
1608 * Callback fired after the component has collapsed
1609 */
1610 onExited: _propTypes2["default"].func,
1611
1612 /**
1613 * The dimension used when collapsing, or a function that returns the
1614 * dimension
1615 *
1616 * _Note: Bootstrap only partially supports 'width'!
1617 * You will need to supply your own CSS animation for the `.width` CSS class._
1618 */
1619 dimension: _propTypes2["default"].oneOfType([_propTypes2["default"].oneOf(['height', 'width']), _propTypes2["default"].func]),
1620
1621 /**
1622 * Function that returns the height or width of the animating DOM node
1623 *
1624 * Allows for providing some custom logic for how much the Collapse component
1625 * should animate in its specified dimension. Called with the current
1626 * dimension prop value and the DOM node.
1627 */
1628 getDimensionValue: _propTypes2["default"].func,
1629
1630 /**
1631 * ARIA role of collapsible element
1632 */
1633 role: _propTypes2["default"].string
1634 };
1635
1636 var defaultProps = {
1637 "in": false,
1638 timeout: 300,
1639 unmountOnExit: false,
1640 transitionAppear: false,
1641
1642 dimension: 'height',
1643 getDimensionValue: getDimensionValue
1644 };
1645
1646 var Collapse = function (_React$Component) {
1647 _inherits(Collapse, _React$Component);
1648
1649 function Collapse(props, context) {
1650 _classCallCheck(this, Collapse);
1651
1652 var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
1653
1654 _this.handleEnter = _this.handleEnter.bind(_this);
1655 _this.handleEntering = _this.handleEntering.bind(_this);
1656 _this.handleEntered = _this.handleEntered.bind(_this);
1657 _this.handleExit = _this.handleExit.bind(_this);
1658 _this.handleExiting = _this.handleExiting.bind(_this);
1659 return _this;
1660 }
1661
1662 /* -- Expanding -- */
1663
1664
1665 Collapse.prototype.handleEnter = function handleEnter(elem) {
1666 var dimension = this._dimension();
1667 elem.style[dimension] = '0';
1668 };
1669
1670 Collapse.prototype.handleEntering = function handleEntering(elem) {
1671 var dimension = this._dimension();
1672 elem.style[dimension] = this._getScrollDimensionValue(elem, dimension);
1673 };
1674
1675 Collapse.prototype.handleEntered = function handleEntered(elem) {
1676 var dimension = this._dimension();
1677 elem.style[dimension] = null;
1678 };
1679
1680 /* -- Collapsing -- */
1681
1682
1683 Collapse.prototype.handleExit = function handleExit(elem) {
1684 var dimension = this._dimension();
1685 elem.style[dimension] = this.props.getDimensionValue(dimension, elem) + 'px';
1686 triggerBrowserReflow(elem);
1687 };
1688
1689 Collapse.prototype.handleExiting = function handleExiting(elem) {
1690 var dimension = this._dimension();
1691 elem.style[dimension] = '0';
1692 };
1693
1694 Collapse.prototype._dimension = function _dimension() {
1695 return typeof this.props.dimension === 'function' ? this.props.dimension() : this.props.dimension;
1696 };
1697
1698 // for testing
1699
1700
1701 Collapse.prototype._getScrollDimensionValue = function _getScrollDimensionValue(elem, dimension) {
1702 return elem['scroll' + (0, _capitalize2["default"])(dimension)] + 'px';
1703 };
1704
1705 Collapse.prototype.render = function render() {
1706 var _props = this.props,
1707 onEnter = _props.onEnter,
1708 onEntering = _props.onEntering,
1709 onEntered = _props.onEntered,
1710 onExit = _props.onExit,
1711 onExiting = _props.onExiting,
1712 className = _props.className,
1713 props = _objectWithoutProperties(_props, ['onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'className']);
1714
1715 delete props.dimension;
1716 delete props.getDimensionValue;
1717
1718 var handleEnter = (0, _tinperBeeCore.createChainedFunction)(this.handleEnter, onEnter);
1719 var handleEntering = (0, _tinperBeeCore.createChainedFunction)(this.handleEntering, onEntering);
1720 var handleEntered = (0, _tinperBeeCore.createChainedFunction)(this.handleEntered, onEntered);
1721 var handleExit = (0, _tinperBeeCore.createChainedFunction)(this.handleExit, onExit);
1722 var handleExiting = (0, _tinperBeeCore.createChainedFunction)(this.handleExiting, onExiting);
1723
1724 var classes = {
1725 width: this._dimension() === 'width'
1726 };
1727
1728 return _react2["default"].createElement(_Transition2["default"], _extends({}, props, {
1729 'aria-expanded': props.role ? props["in"] : null,
1730 className: (0, _classnames2["default"])(className, classes),
1731 exitedClassName: 'collapse',
1732 exitingClassName: 'collapsing',
1733 enteredClassName: 'collapse in',
1734 enteringClassName: 'collapsing',
1735 onEnter: handleEnter,
1736 onEntering: handleEntering,
1737 onEntered: handleEntered,
1738 onExit: handleExit,
1739 onExiting: handleExiting
1740 }));
1741 };
1742
1743 return Collapse;
1744 }(_react2["default"].Component);
1745
1746 Collapse.propTypes = propTypes;
1747 Collapse.defaultProps = defaultProps;
1748
1749 exports["default"] = Collapse;
1750 module.exports = exports['default'];
1751
1752/***/ }),
1753/* 18 */
1754/***/ (function(module, exports, __webpack_require__) {
1755
1756 "use strict";
1757
1758 var _interopRequireDefault = __webpack_require__(14);
1759
1760 exports.__esModule = true;
1761 exports.default = style;
1762
1763 var _camelizeStyle = _interopRequireDefault(__webpack_require__(19));
1764
1765 var _hyphenateStyle = _interopRequireDefault(__webpack_require__(21));
1766
1767 var _getComputedStyle2 = _interopRequireDefault(__webpack_require__(23));
1768
1769 var _removeStyle = _interopRequireDefault(__webpack_require__(24));
1770
1771 var _properties = __webpack_require__(13);
1772
1773 var _isTransform = _interopRequireDefault(__webpack_require__(25));
1774
1775 function style(node, property, value) {
1776 var css = '';
1777 var transforms = '';
1778 var props = property;
1779
1780 if (typeof property === 'string') {
1781 if (value === undefined) {
1782 return node.style[(0, _camelizeStyle.default)(property)] || (0, _getComputedStyle2.default)(node).getPropertyValue((0, _hyphenateStyle.default)(property));
1783 } else {
1784 (props = {})[property] = value;
1785 }
1786 }
1787
1788 Object.keys(props).forEach(function (key) {
1789 var value = props[key];
1790
1791 if (!value && value !== 0) {
1792 (0, _removeStyle.default)(node, (0, _hyphenateStyle.default)(key));
1793 } else if ((0, _isTransform.default)(key)) {
1794 transforms += key + "(" + value + ") ";
1795 } else {
1796 css += (0, _hyphenateStyle.default)(key) + ": " + value + ";";
1797 }
1798 });
1799
1800 if (transforms) {
1801 css += _properties.transform + ": " + transforms + ";";
1802 }
1803
1804 node.style.cssText += ';' + css;
1805 }
1806
1807 module.exports = exports["default"];
1808
1809/***/ }),
1810/* 19 */
1811/***/ (function(module, exports, __webpack_require__) {
1812
1813 "use strict";
1814
1815 var _interopRequireDefault = __webpack_require__(14);
1816
1817 exports.__esModule = true;
1818 exports.default = camelizeStyleName;
1819
1820 var _camelize = _interopRequireDefault(__webpack_require__(20));
1821
1822 /**
1823 * Copyright 2014-2015, Facebook, Inc.
1824 * All rights reserved.
1825 * https://github.com/facebook/react/blob/2aeb8a2a6beb00617a4217f7f8284924fa2ad819/src/vendor/core/camelizeStyleName.js
1826 */
1827 var msPattern = /^-ms-/;
1828
1829 function camelizeStyleName(string) {
1830 return (0, _camelize.default)(string.replace(msPattern, 'ms-'));
1831 }
1832
1833 module.exports = exports["default"];
1834
1835/***/ }),
1836/* 20 */
1837/***/ (function(module, exports) {
1838
1839 "use strict";
1840
1841 exports.__esModule = true;
1842 exports.default = camelize;
1843 var rHyphen = /-(.)/g;
1844
1845 function camelize(string) {
1846 return string.replace(rHyphen, function (_, chr) {
1847 return chr.toUpperCase();
1848 });
1849 }
1850
1851 module.exports = exports["default"];
1852
1853/***/ }),
1854/* 21 */
1855/***/ (function(module, exports, __webpack_require__) {
1856
1857 "use strict";
1858
1859 var _interopRequireDefault = __webpack_require__(14);
1860
1861 exports.__esModule = true;
1862 exports.default = hyphenateStyleName;
1863
1864 var _hyphenate = _interopRequireDefault(__webpack_require__(22));
1865
1866 /**
1867 * Copyright 2013-2014, Facebook, Inc.
1868 * All rights reserved.
1869 * https://github.com/facebook/react/blob/2aeb8a2a6beb00617a4217f7f8284924fa2ad819/src/vendor/core/hyphenateStyleName.js
1870 */
1871 var msPattern = /^ms-/;
1872
1873 function hyphenateStyleName(string) {
1874 return (0, _hyphenate.default)(string).replace(msPattern, '-ms-');
1875 }
1876
1877 module.exports = exports["default"];
1878
1879/***/ }),
1880/* 22 */
1881/***/ (function(module, exports) {
1882
1883 "use strict";
1884
1885 exports.__esModule = true;
1886 exports.default = hyphenate;
1887 var rUpper = /([A-Z])/g;
1888
1889 function hyphenate(string) {
1890 return string.replace(rUpper, '-$1').toLowerCase();
1891 }
1892
1893 module.exports = exports["default"];
1894
1895/***/ }),
1896/* 23 */
1897/***/ (function(module, exports, __webpack_require__) {
1898
1899 "use strict";
1900
1901 var _interopRequireDefault = __webpack_require__(14);
1902
1903 exports.__esModule = true;
1904 exports.default = _getComputedStyle;
1905
1906 var _camelizeStyle = _interopRequireDefault(__webpack_require__(19));
1907
1908 var rposition = /^(top|right|bottom|left)$/;
1909 var rnumnonpx = /^([+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|))(?!px)[a-z%]+$/i;
1910
1911 function _getComputedStyle(node) {
1912 if (!node) throw new TypeError('No Element passed to `getComputedStyle()`');
1913 var doc = node.ownerDocument;
1914 return 'defaultView' in doc ? doc.defaultView.opener ? node.ownerDocument.defaultView.getComputedStyle(node, null) : window.getComputedStyle(node, null) : {
1915 //ie 8 "magic" from: https://github.com/jquery/jquery/blob/1.11-stable/src/css/curCSS.js#L72
1916 getPropertyValue: function getPropertyValue(prop) {
1917 var style = node.style;
1918 prop = (0, _camelizeStyle.default)(prop);
1919 if (prop == 'float') prop = 'styleFloat';
1920 var current = node.currentStyle[prop] || null;
1921 if (current == null && style && style[prop]) current = style[prop];
1922
1923 if (rnumnonpx.test(current) && !rposition.test(prop)) {
1924 // Remember the original values
1925 var left = style.left;
1926 var runStyle = node.runtimeStyle;
1927 var rsLeft = runStyle && runStyle.left; // Put in the new values to get a computed value out
1928
1929 if (rsLeft) runStyle.left = node.currentStyle.left;
1930 style.left = prop === 'fontSize' ? '1em' : current;
1931 current = style.pixelLeft + 'px'; // Revert the changed values
1932
1933 style.left = left;
1934 if (rsLeft) runStyle.left = rsLeft;
1935 }
1936
1937 return current;
1938 }
1939 };
1940 }
1941
1942 module.exports = exports["default"];
1943
1944/***/ }),
1945/* 24 */
1946/***/ (function(module, exports) {
1947
1948 "use strict";
1949
1950 exports.__esModule = true;
1951 exports.default = removeStyle;
1952
1953 function removeStyle(node, key) {
1954 return 'removeProperty' in node.style ? node.style.removeProperty(key) : node.style.removeAttribute(key);
1955 }
1956
1957 module.exports = exports["default"];
1958
1959/***/ }),
1960/* 25 */
1961/***/ (function(module, exports) {
1962
1963 "use strict";
1964
1965 exports.__esModule = true;
1966 exports.default = isTransform;
1967 var supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;
1968
1969 function isTransform(property) {
1970 return !!(property && supportedTransforms.test(property));
1971 }
1972
1973 module.exports = exports["default"];
1974
1975/***/ }),
1976/* 26 */
1977/***/ (function(module, exports) {
1978
1979 "use strict";
1980
1981 Object.defineProperty(exports, "__esModule", {
1982 value: true
1983 });
1984 exports["default"] = capitalize;
1985 function capitalize(string) {
1986 return "" + string.charAt(0).toUpperCase() + string.slice(1);
1987 }
1988 module.exports = exports["default"];
1989
1990/***/ }),
1991/* 27 */
1992/***/ (function(module, exports, __webpack_require__) {
1993
1994 'use strict';
1995
1996 exports.__esModule = true;
1997 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;
1998
1999 var _all2 = __webpack_require__(28);
2000
2001 var _all3 = _interopRequireDefault(_all2);
2002
2003 var _componentOrElement2 = __webpack_require__(30);
2004
2005 var _componentOrElement3 = _interopRequireDefault(_componentOrElement2);
2006
2007 var _deprecated2 = __webpack_require__(31);
2008
2009 var _deprecated3 = _interopRequireDefault(_deprecated2);
2010
2011 var _elementType2 = __webpack_require__(34);
2012
2013 var _elementType3 = _interopRequireDefault(_elementType2);
2014
2015 var _isRequiredForA11y2 = __webpack_require__(35);
2016
2017 var _isRequiredForA11y3 = _interopRequireDefault(_isRequiredForA11y2);
2018
2019 var _splitComponent2 = __webpack_require__(36);
2020
2021 var _splitComponent3 = _interopRequireDefault(_splitComponent2);
2022
2023 var _createChainedFunction2 = __webpack_require__(37);
2024
2025 var _createChainedFunction3 = _interopRequireDefault(_createChainedFunction2);
2026
2027 var _keyCode = __webpack_require__(38);
2028
2029 var _keyCode2 = _interopRequireDefault(_keyCode);
2030
2031 var _contains2 = __webpack_require__(39);
2032
2033 var _contains3 = _interopRequireDefault(_contains2);
2034
2035 var _addEventListener2 = __webpack_require__(40);
2036
2037 var _addEventListener3 = _interopRequireDefault(_addEventListener2);
2038
2039 var _cssAnimation2 = __webpack_require__(45);
2040
2041 var _cssAnimation3 = _interopRequireDefault(_cssAnimation2);
2042
2043 var _toArray2 = __webpack_require__(49);
2044
2045 var _toArray3 = _interopRequireDefault(_toArray2);
2046
2047 var _Align2 = __webpack_require__(50);
2048
2049 var _Align3 = _interopRequireDefault(_Align2);
2050
2051 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2052
2053 exports.all = _all3.default;
2054 exports.componentOrElement = _componentOrElement3.default;
2055 exports.deprecated = _deprecated3.default;
2056 exports.elementType = _elementType3.default;
2057 exports.isRequiredForA11y = _isRequiredForA11y3.default;
2058 exports.splitComponent = _splitComponent3.default;
2059 exports.createChainedFunction = _createChainedFunction3.default;
2060 exports.KeyCode = _keyCode2.default;
2061 exports.contains = _contains3.default;
2062 exports.addEventListener = _addEventListener3.default;
2063 exports.cssAnimation = _cssAnimation3.default;
2064 exports.toArray = _toArray3.default;
2065 //export getContainerRenderMixin from './getContainerRenderMixin';
2066
2067 exports.Align = _Align3.default;
2068
2069/***/ }),
2070/* 28 */
2071/***/ (function(module, exports, __webpack_require__) {
2072
2073 'use strict';
2074
2075 exports.__esModule = true;
2076 exports.default = all;
2077
2078 var _createChainableTypeChecker = __webpack_require__(29);
2079
2080 var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);
2081
2082 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2083
2084 function all() {
2085 for (var _len = arguments.length, validators = Array(_len), _key = 0; _key < _len; _key++) {
2086 validators[_key] = arguments[_key];
2087 }
2088
2089 function allPropTypes() {
2090 for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
2091 args[_key2] = arguments[_key2];
2092 }
2093
2094 var error = null;
2095
2096 validators.forEach(function (validator) {
2097 if (error != null) {
2098 return;
2099 }
2100
2101 var result = validator.apply(undefined, args);
2102 if (result != null) {
2103 error = result;
2104 }
2105 });
2106
2107 return error;
2108 }
2109
2110 return (0, _createChainableTypeChecker2.default)(allPropTypes);
2111 }
2112
2113/***/ }),
2114/* 29 */
2115/***/ (function(module, exports) {
2116
2117 'use strict';
2118
2119 exports.__esModule = true;
2120 exports.default = createChainableTypeChecker;
2121 /**
2122 * Copyright 2013-present, Facebook, Inc.
2123 * All rights reserved.
2124 *
2125 * This source code is licensed under the BSD-style license found in the
2126 * LICENSE file in the root directory of this source tree. An additional grant
2127 * of patent rights can be found in the PATENTS file in the same directory.
2128 */
2129
2130 // Mostly taken from ReactPropTypes.
2131
2132 function createChainableTypeChecker(validate) {
2133 function checkType(isRequired, props, propName, componentName, location, propFullName) {
2134 var componentNameSafe = componentName || '<<anonymous>>';
2135 var propFullNameSafe = propFullName || propName;
2136
2137 if (props[propName] == null) {
2138 if (isRequired) {
2139 return new Error('Required ' + location + ' `' + propFullNameSafe + '` was not specified ' + ('in `' + componentNameSafe + '`.'));
2140 }
2141
2142 return null;
2143 }
2144
2145 for (var _len = arguments.length, args = Array(_len > 6 ? _len - 6 : 0), _key = 6; _key < _len; _key++) {
2146 args[_key - 6] = arguments[_key];
2147 }
2148
2149 return validate.apply(undefined, [props, propName, componentNameSafe, location, propFullNameSafe].concat(args));
2150 }
2151
2152 var chainedCheckType = checkType.bind(null, false);
2153 chainedCheckType.isRequired = checkType.bind(null, true);
2154
2155 return chainedCheckType;
2156 }
2157
2158/***/ }),
2159/* 30 */
2160/***/ (function(module, exports, __webpack_require__) {
2161
2162 'use strict';
2163
2164 exports.__esModule = true;
2165
2166 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; };
2167
2168 var _react = __webpack_require__(4);
2169
2170 var _react2 = _interopRequireDefault(_react);
2171
2172 var _createChainableTypeChecker = __webpack_require__(29);
2173
2174 var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);
2175
2176 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2177
2178 function validate(props, propName, componentName, location, propFullName) {
2179 var propValue = props[propName];
2180 var propType = typeof propValue === 'undefined' ? 'undefined' : _typeof(propValue);
2181
2182 if (_react2.default.isValidElement(propValue)) {
2183 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.');
2184 }
2185
2186 if ((propType !== 'object' || typeof propValue.render !== 'function') && propValue.nodeType !== 1) {
2187 return new Error('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected a ReactComponent or a ') + 'DOMElement.');
2188 }
2189
2190 return null;
2191 }
2192
2193 exports.default = (0, _createChainableTypeChecker2.default)(validate);
2194
2195/***/ }),
2196/* 31 */
2197/***/ (function(module, exports, __webpack_require__) {
2198
2199 'use strict';
2200
2201 exports.__esModule = true;
2202 exports.default = deprecated;
2203
2204 var _warning = __webpack_require__(32);
2205
2206 var _warning2 = _interopRequireDefault(_warning);
2207
2208 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2209
2210 var warned = {};
2211
2212 function deprecated(validator, reason) {
2213 return function validate(props, propName, componentName, location, propFullName) {
2214 var componentNameSafe = componentName || '<<anonymous>>';
2215 var propFullNameSafe = propFullName || propName;
2216
2217 if (props[propName] != null) {
2218 var messageKey = componentName + '.' + propName;
2219
2220 (0, _warning2.default)(warned[messageKey], 'The ' + location + ' `' + propFullNameSafe + '` of ' + ('`' + componentNameSafe + '` is deprecated. ' + reason + '.'));
2221
2222 warned[messageKey] = true;
2223 }
2224
2225 for (var _len = arguments.length, args = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {
2226 args[_key - 5] = arguments[_key];
2227 }
2228
2229 return validator.apply(undefined, [props, propName, componentName, location, propFullName].concat(args));
2230 };
2231 }
2232
2233 /* eslint-disable no-underscore-dangle */
2234 function _resetWarned() {
2235 warned = {};
2236 }
2237
2238 deprecated._resetWarned = _resetWarned;
2239 /* eslint-enable no-underscore-dangle */
2240
2241/***/ }),
2242/* 32 */
2243/***/ (function(module, exports, __webpack_require__) {
2244
2245 /* WEBPACK VAR INJECTION */(function(process) {/**
2246 * Copyright 2014-2015, Facebook, Inc.
2247 * All rights reserved.
2248 *
2249 * This source code is licensed under the BSD-style license found in the
2250 * LICENSE file in the root directory of this source tree. An additional grant
2251 * of patent rights can be found in the PATENTS file in the same directory.
2252 */
2253
2254 'use strict';
2255
2256 /**
2257 * Similar to invariant but only logs a warning if the condition is not met.
2258 * This can be used to log issues in development environments in critical
2259 * paths. Removing the logging code for production environments will keep the
2260 * same logic and follow the same code paths.
2261 */
2262
2263 var warning = function() {};
2264
2265 if (process.env.NODE_ENV !== 'production') {
2266 warning = function(condition, format, args) {
2267 var len = arguments.length;
2268 args = new Array(len > 2 ? len - 2 : 0);
2269 for (var key = 2; key < len; key++) {
2270 args[key - 2] = arguments[key];
2271 }
2272 if (format === undefined) {
2273 throw new Error(
2274 '`warning(condition, format, ...args)` requires a warning ' +
2275 'message argument'
2276 );
2277 }
2278
2279 if (format.length < 10 || (/^[s\W]*$/).test(format)) {
2280 throw new Error(
2281 'The warning format should be able to uniquely identify this ' +
2282 'warning. Please, use a more descriptive format than: ' + format
2283 );
2284 }
2285
2286 if (!condition) {
2287 var argIndex = 0;
2288 var message = 'Warning: ' +
2289 format.replace(/%s/g, function() {
2290 return args[argIndex++];
2291 });
2292 if (typeof console !== 'undefined') {
2293 console.error(message);
2294 }
2295 try {
2296 // This error was thrown as a convenience so that you can use this stack
2297 // to find the callsite that caused this warning to fire.
2298 throw new Error(message);
2299 } catch(x) {}
2300 }
2301 };
2302 }
2303
2304 module.exports = warning;
2305
2306 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(33)))
2307
2308/***/ }),
2309/* 33 */
2310/***/ (function(module, exports) {
2311
2312 // shim for using process in browser
2313 var process = module.exports = {};
2314
2315 // cached from whatever global is present so that test runners that stub it
2316 // don't break things. But we need to wrap it in a try catch in case it is
2317 // wrapped in strict mode code which doesn't define any globals. It's inside a
2318 // function because try/catches deoptimize in certain engines.
2319
2320 var cachedSetTimeout;
2321 var cachedClearTimeout;
2322
2323 function defaultSetTimout() {
2324 throw new Error('setTimeout has not been defined');
2325 }
2326 function defaultClearTimeout () {
2327 throw new Error('clearTimeout has not been defined');
2328 }
2329 (function () {
2330 try {
2331 if (typeof setTimeout === 'function') {
2332 cachedSetTimeout = setTimeout;
2333 } else {
2334 cachedSetTimeout = defaultSetTimout;
2335 }
2336 } catch (e) {
2337 cachedSetTimeout = defaultSetTimout;
2338 }
2339 try {
2340 if (typeof clearTimeout === 'function') {
2341 cachedClearTimeout = clearTimeout;
2342 } else {
2343 cachedClearTimeout = defaultClearTimeout;
2344 }
2345 } catch (e) {
2346 cachedClearTimeout = defaultClearTimeout;
2347 }
2348 } ())
2349 function runTimeout(fun) {
2350 if (cachedSetTimeout === setTimeout) {
2351 //normal enviroments in sane situations
2352 return setTimeout(fun, 0);
2353 }
2354 // if setTimeout wasn't available but was latter defined
2355 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
2356 cachedSetTimeout = setTimeout;
2357 return setTimeout(fun, 0);
2358 }
2359 try {
2360 // when when somebody has screwed with setTimeout but no I.E. maddness
2361 return cachedSetTimeout(fun, 0);
2362 } catch(e){
2363 try {
2364 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
2365 return cachedSetTimeout.call(null, fun, 0);
2366 } catch(e){
2367 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
2368 return cachedSetTimeout.call(this, fun, 0);
2369 }
2370 }
2371
2372
2373 }
2374 function runClearTimeout(marker) {
2375 if (cachedClearTimeout === clearTimeout) {
2376 //normal enviroments in sane situations
2377 return clearTimeout(marker);
2378 }
2379 // if clearTimeout wasn't available but was latter defined
2380 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
2381 cachedClearTimeout = clearTimeout;
2382 return clearTimeout(marker);
2383 }
2384 try {
2385 // when when somebody has screwed with setTimeout but no I.E. maddness
2386 return cachedClearTimeout(marker);
2387 } catch (e){
2388 try {
2389 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
2390 return cachedClearTimeout.call(null, marker);
2391 } catch (e){
2392 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
2393 // Some versions of I.E. have different rules for clearTimeout vs setTimeout
2394 return cachedClearTimeout.call(this, marker);
2395 }
2396 }
2397
2398
2399
2400 }
2401 var queue = [];
2402 var draining = false;
2403 var currentQueue;
2404 var queueIndex = -1;
2405
2406 function cleanUpNextTick() {
2407 if (!draining || !currentQueue) {
2408 return;
2409 }
2410 draining = false;
2411 if (currentQueue.length) {
2412 queue = currentQueue.concat(queue);
2413 } else {
2414 queueIndex = -1;
2415 }
2416 if (queue.length) {
2417 drainQueue();
2418 }
2419 }
2420
2421 function drainQueue() {
2422 if (draining) {
2423 return;
2424 }
2425 var timeout = runTimeout(cleanUpNextTick);
2426 draining = true;
2427
2428 var len = queue.length;
2429 while(len) {
2430 currentQueue = queue;
2431 queue = [];
2432 while (++queueIndex < len) {
2433 if (currentQueue) {
2434 currentQueue[queueIndex].run();
2435 }
2436 }
2437 queueIndex = -1;
2438 len = queue.length;
2439 }
2440 currentQueue = null;
2441 draining = false;
2442 runClearTimeout(timeout);
2443 }
2444
2445 process.nextTick = function (fun) {
2446 var args = new Array(arguments.length - 1);
2447 if (arguments.length > 1) {
2448 for (var i = 1; i < arguments.length; i++) {
2449 args[i - 1] = arguments[i];
2450 }
2451 }
2452 queue.push(new Item(fun, args));
2453 if (queue.length === 1 && !draining) {
2454 runTimeout(drainQueue);
2455 }
2456 };
2457
2458 // v8 likes predictible objects
2459 function Item(fun, array) {
2460 this.fun = fun;
2461 this.array = array;
2462 }
2463 Item.prototype.run = function () {
2464 this.fun.apply(null, this.array);
2465 };
2466 process.title = 'browser';
2467 process.browser = true;
2468 process.env = {};
2469 process.argv = [];
2470 process.version = ''; // empty string to avoid regexp issues
2471 process.versions = {};
2472
2473 function noop() {}
2474
2475 process.on = noop;
2476 process.addListener = noop;
2477 process.once = noop;
2478 process.off = noop;
2479 process.removeListener = noop;
2480 process.removeAllListeners = noop;
2481 process.emit = noop;
2482 process.prependListener = noop;
2483 process.prependOnceListener = noop;
2484
2485 process.listeners = function (name) { return [] }
2486
2487 process.binding = function (name) {
2488 throw new Error('process.binding is not supported');
2489 };
2490
2491 process.cwd = function () { return '/' };
2492 process.chdir = function (dir) {
2493 throw new Error('process.chdir is not supported');
2494 };
2495 process.umask = function() { return 0; };
2496
2497
2498/***/ }),
2499/* 34 */
2500/***/ (function(module, exports, __webpack_require__) {
2501
2502 'use strict';
2503
2504 exports.__esModule = true;
2505
2506 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; };
2507
2508 var _react = __webpack_require__(4);
2509
2510 var _react2 = _interopRequireDefault(_react);
2511
2512 var _createChainableTypeChecker = __webpack_require__(29);
2513
2514 var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);
2515
2516 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2517
2518 function elementType(props, propName, componentName, location, propFullName) {
2519 var propValue = props[propName];
2520 var propType = typeof propValue === 'undefined' ? 'undefined' : _typeof(propValue);
2521
2522 if (_react2.default.isValidElement(propValue)) {
2523 return new Error('Invalid ' + location + ' `' + propFullName + '` of type ReactElement ' + ('supplied to `' + componentName + '`, expected an element type (a string ') + 'or a ReactClass).');
2524 }
2525
2526 if (propType !== 'function' && propType !== 'string') {
2527 return new Error('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected an element type (a string ') + 'or a ReactClass).');
2528 }
2529
2530 return null;
2531 }
2532
2533 exports.default = (0, _createChainableTypeChecker2.default)(elementType);
2534
2535/***/ }),
2536/* 35 */
2537/***/ (function(module, exports) {
2538
2539 'use strict';
2540
2541 exports.__esModule = true;
2542 exports.default = isRequiredForA11y;
2543 function isRequiredForA11y(validator) {
2544 return function validate(props, propName, componentName, location, propFullName) {
2545 var componentNameSafe = componentName || '<<anonymous>>';
2546 var propFullNameSafe = propFullName || propName;
2547
2548 if (props[propName] == null) {
2549 return new Error('The ' + location + ' `' + propFullNameSafe + '` is required to make ' + ('`' + componentNameSafe + '` accessible for users of assistive ') + 'technologies such as screen readers.');
2550 }
2551
2552 for (var _len = arguments.length, args = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {
2553 args[_key - 5] = arguments[_key];
2554 }
2555
2556 return validator.apply(undefined, [props, propName, componentName, location, propFullName].concat(args));
2557 };
2558 }
2559
2560/***/ }),
2561/* 36 */
2562/***/ (function(module, exports) {
2563
2564 "use strict";
2565
2566 exports.__esModule = true;
2567 exports.default = splitComponentProps;
2568 function _objectEntries(obj) {
2569 var entries = [];
2570 var keys = Object.keys(obj);
2571
2572 for (var k = 0; k < keys.length; ++k) {
2573 entries.push([keys[k], obj[keys[k]]]);
2574 }return entries;
2575 }
2576
2577 /**
2578 * 分割要传入父元素和子元素的props
2579 * @param {[object]} props 传入的属性
2580 * @param {[reactElement]} Component 组件
2581 * @return {[array]} 返回数组,第一个元素为父元素props对象,第二个子元素props对象
2582 */
2583 function splitComponentProps(props, Component) {
2584 var componentPropTypes = Component.propTypes;
2585
2586 var parentProps = {};
2587 var childProps = {};
2588
2589 _objectEntries(props).forEach(function (_ref) {
2590 var propName = _ref[0],
2591 propValue = _ref[1];
2592
2593 if (componentPropTypes[propName]) {
2594 parentProps[propName] = propValue;
2595 } else {
2596 childProps[propName] = propValue;
2597 }
2598 });
2599
2600 return [parentProps, childProps];
2601 }
2602
2603/***/ }),
2604/* 37 */
2605/***/ (function(module, exports) {
2606
2607 'use strict';
2608
2609 exports.__esModule = true;
2610 function createChainedFunction() {
2611 for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
2612 funcs[_key] = arguments[_key];
2613 }
2614
2615 return funcs.filter(function (f) {
2616 return f != null;
2617 }).reduce(function (acc, f) {
2618 if (typeof f !== 'function') {
2619 throw new Error('Invalid Argument Type, must only provide functions, undefined, or null.');
2620 }
2621
2622 if (acc === null) {
2623 return f;
2624 }
2625
2626 return function chainedFunction() {
2627 for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
2628 args[_key2] = arguments[_key2];
2629 }
2630
2631 acc.apply(this, args);
2632 f.apply(this, args);
2633 };
2634 }, null);
2635 }
2636 exports.default = createChainedFunction;
2637
2638/***/ }),
2639/* 38 */
2640/***/ (function(module, exports) {
2641
2642 'use strict';
2643
2644 /**
2645 * @ignore
2646 * some key-codes definition and utils from closure-library
2647 * @author yiminghe@gmail.com
2648 */
2649
2650 var KeyCode = {
2651 /**
2652 * MAC_ENTER
2653 */
2654 MAC_ENTER: 3,
2655 /**
2656 * BACKSPACE
2657 */
2658 BACKSPACE: 8,
2659 /**
2660 * TAB
2661 */
2662 TAB: 9,
2663 /**
2664 * NUMLOCK on FF/Safari Mac
2665 */
2666 NUM_CENTER: 12, // NUMLOCK on FF/Safari Mac
2667 /**
2668 * ENTER
2669 */
2670 ENTER: 13,
2671 /**
2672 * SHIFT
2673 */
2674 SHIFT: 16,
2675 /**
2676 * CTRL
2677 */
2678 CTRL: 17,
2679 /**
2680 * ALT
2681 */
2682 ALT: 18,
2683 /**
2684 * PAUSE
2685 */
2686 PAUSE: 19,
2687 /**
2688 * CAPS_LOCK
2689 */
2690 CAPS_LOCK: 20,
2691 /**
2692 * ESC
2693 */
2694 ESC: 27,
2695 /**
2696 * SPACE
2697 */
2698 SPACE: 32,
2699 /**
2700 * PAGE_UP
2701 */
2702 PAGE_UP: 33, // also NUM_NORTH_EAST
2703 /**
2704 * PAGE_DOWN
2705 */
2706 PAGE_DOWN: 34, // also NUM_SOUTH_EAST
2707 /**
2708 * END
2709 */
2710 END: 35, // also NUM_SOUTH_WEST
2711 /**
2712 * HOME
2713 */
2714 HOME: 36, // also NUM_NORTH_WEST
2715 /**
2716 * LEFT
2717 */
2718 LEFT: 37, // also NUM_WEST
2719 /**
2720 * UP
2721 */
2722 UP: 38, // also NUM_NORTH
2723 /**
2724 * RIGHT
2725 */
2726 RIGHT: 39, // also NUM_EAST
2727 /**
2728 * DOWN
2729 */
2730 DOWN: 40, // also NUM_SOUTH
2731 /**
2732 * PRINT_SCREEN
2733 */
2734 PRINT_SCREEN: 44,
2735 /**
2736 * INSERT
2737 */
2738 INSERT: 45, // also NUM_INSERT
2739 /**
2740 * DELETE
2741 */
2742 DELETE: 46, // also NUM_DELETE
2743 /**
2744 * ZERO
2745 */
2746 ZERO: 48,
2747 /**
2748 * ONE
2749 */
2750 ONE: 49,
2751 /**
2752 * TWO
2753 */
2754 TWO: 50,
2755 /**
2756 * THREE
2757 */
2758 THREE: 51,
2759 /**
2760 * FOUR
2761 */
2762 FOUR: 52,
2763 /**
2764 * FIVE
2765 */
2766 FIVE: 53,
2767 /**
2768 * SIX
2769 */
2770 SIX: 54,
2771 /**
2772 * SEVEN
2773 */
2774 SEVEN: 55,
2775 /**
2776 * EIGHT
2777 */
2778 EIGHT: 56,
2779 /**
2780 * NINE
2781 */
2782 NINE: 57,
2783 /**
2784 * QUESTION_MARK
2785 */
2786 QUESTION_MARK: 63, // needs localization
2787 /**
2788 * A
2789 */
2790 A: 65,
2791 /**
2792 * B
2793 */
2794 B: 66,
2795 /**
2796 * C
2797 */
2798 C: 67,
2799 /**
2800 * D
2801 */
2802 D: 68,
2803 /**
2804 * E
2805 */
2806 E: 69,
2807 /**
2808 * F
2809 */
2810 F: 70,
2811 /**
2812 * G
2813 */
2814 G: 71,
2815 /**
2816 * H
2817 */
2818 H: 72,
2819 /**
2820 * I
2821 */
2822 I: 73,
2823 /**
2824 * J
2825 */
2826 J: 74,
2827 /**
2828 * K
2829 */
2830 K: 75,
2831 /**
2832 * L
2833 */
2834 L: 76,
2835 /**
2836 * M
2837 */
2838 M: 77,
2839 /**
2840 * N
2841 */
2842 N: 78,
2843 /**
2844 * O
2845 */
2846 O: 79,
2847 /**
2848 * P
2849 */
2850 P: 80,
2851 /**
2852 * Q
2853 */
2854 Q: 81,
2855 /**
2856 * R
2857 */
2858 R: 82,
2859 /**
2860 * S
2861 */
2862 S: 83,
2863 /**
2864 * T
2865 */
2866 T: 84,
2867 /**
2868 * U
2869 */
2870 U: 85,
2871 /**
2872 * V
2873 */
2874 V: 86,
2875 /**
2876 * W
2877 */
2878 W: 87,
2879 /**
2880 * X
2881 */
2882 X: 88,
2883 /**
2884 * Y
2885 */
2886 Y: 89,
2887 /**
2888 * Z
2889 */
2890 Z: 90,
2891 /**
2892 * META
2893 */
2894 META: 91, // WIN_KEY_LEFT
2895 /**
2896 * WIN_KEY_RIGHT
2897 */
2898 WIN_KEY_RIGHT: 92,
2899 /**
2900 * CONTEXT_MENU
2901 */
2902 CONTEXT_MENU: 93,
2903 /**
2904 * NUM_ZERO
2905 */
2906 NUM_ZERO: 96,
2907 /**
2908 * NUM_ONE
2909 */
2910 NUM_ONE: 97,
2911 /**
2912 * NUM_TWO
2913 */
2914 NUM_TWO: 98,
2915 /**
2916 * NUM_THREE
2917 */
2918 NUM_THREE: 99,
2919 /**
2920 * NUM_FOUR
2921 */
2922 NUM_FOUR: 100,
2923 /**
2924 * NUM_FIVE
2925 */
2926 NUM_FIVE: 101,
2927 /**
2928 * NUM_SIX
2929 */
2930 NUM_SIX: 102,
2931 /**
2932 * NUM_SEVEN
2933 */
2934 NUM_SEVEN: 103,
2935 /**
2936 * NUM_EIGHT
2937 */
2938 NUM_EIGHT: 104,
2939 /**
2940 * NUM_NINE
2941 */
2942 NUM_NINE: 105,
2943 /**
2944 * NUM_MULTIPLY
2945 */
2946 NUM_MULTIPLY: 106,
2947 /**
2948 * NUM_PLUS
2949 */
2950 NUM_PLUS: 107,
2951 /**
2952 * NUM_MINUS
2953 */
2954 NUM_MINUS: 109,
2955 /**
2956 * NUM_PERIOD
2957 */
2958 NUM_PERIOD: 110,
2959 /**
2960 * NUM_DIVISION
2961 */
2962 NUM_DIVISION: 111,
2963 /**
2964 * F1
2965 */
2966 F1: 112,
2967 /**
2968 * F2
2969 */
2970 F2: 113,
2971 /**
2972 * F3
2973 */
2974 F3: 114,
2975 /**
2976 * F4
2977 */
2978 F4: 115,
2979 /**
2980 * F5
2981 */
2982 F5: 116,
2983 /**
2984 * F6
2985 */
2986 F6: 117,
2987 /**
2988 * F7
2989 */
2990 F7: 118,
2991 /**
2992 * F8
2993 */
2994 F8: 119,
2995 /**
2996 * F9
2997 */
2998 F9: 120,
2999 /**
3000 * F10
3001 */
3002 F10: 121,
3003 /**
3004 * F11
3005 */
3006 F11: 122,
3007 /**
3008 * F12
3009 */
3010 F12: 123,
3011 /**
3012 * NUMLOCK
3013 */
3014 NUMLOCK: 144,
3015 /**
3016 * SEMICOLON
3017 */
3018 SEMICOLON: 186, // needs localization
3019 /**
3020 * DASH
3021 */
3022 DASH: 189, // needs localization
3023 /**
3024 * EQUALS
3025 */
3026 EQUALS: 187, // needs localization
3027 /**
3028 * COMMA
3029 */
3030 COMMA: 188, // needs localization
3031 /**
3032 * PERIOD
3033 */
3034 PERIOD: 190, // needs localization
3035 /**
3036 * SLASH
3037 */
3038 SLASH: 191, // needs localization
3039 /**
3040 * APOSTROPHE
3041 */
3042 APOSTROPHE: 192, // needs localization
3043 /**
3044 * SINGLE_QUOTE
3045 */
3046 SINGLE_QUOTE: 222, // needs localization
3047 /**
3048 * OPEN_SQUARE_BRACKET
3049 */
3050 OPEN_SQUARE_BRACKET: 219, // needs localization
3051 /**
3052 * BACKSLASH
3053 */
3054 BACKSLASH: 220, // needs localization
3055 /**
3056 * CLOSE_SQUARE_BRACKET
3057 */
3058 CLOSE_SQUARE_BRACKET: 221, // needs localization
3059 /**
3060 * WIN_KEY
3061 */
3062 WIN_KEY: 224,
3063 /**
3064 * MAC_FF_META
3065 */
3066 MAC_FF_META: 224, // Firefox (Gecko) fires this for the meta key instead of 91
3067 /**
3068 * WIN_IME
3069 */
3070 WIN_IME: 229
3071 };
3072
3073 /*
3074 whether text and modified key is entered at the same time.
3075 */
3076 KeyCode.isTextModifyingKeyEvent = function isTextModifyingKeyEvent(e) {
3077 var keyCode = e.keyCode;
3078 if (e.altKey && !e.ctrlKey || e.metaKey ||
3079 // Function keys don't generate text
3080 keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) {
3081 return false;
3082 }
3083
3084 // The following keys are quite harmless, even in combination with
3085 // CTRL, ALT or SHIFT.
3086 switch (keyCode) {
3087 case KeyCode.ALT:
3088 case KeyCode.CAPS_LOCK:
3089 case KeyCode.CONTEXT_MENU:
3090 case KeyCode.CTRL:
3091 case KeyCode.DOWN:
3092 case KeyCode.END:
3093 case KeyCode.ESC:
3094 case KeyCode.HOME:
3095 case KeyCode.INSERT:
3096 case KeyCode.LEFT:
3097 case KeyCode.MAC_FF_META:
3098 case KeyCode.META:
3099 case KeyCode.NUMLOCK:
3100 case KeyCode.NUM_CENTER:
3101 case KeyCode.PAGE_DOWN:
3102 case KeyCode.PAGE_UP:
3103 case KeyCode.PAUSE:
3104 case KeyCode.PRINT_SCREEN:
3105 case KeyCode.RIGHT:
3106 case KeyCode.SHIFT:
3107 case KeyCode.UP:
3108 case KeyCode.WIN_KEY:
3109 case KeyCode.WIN_KEY_RIGHT:
3110 return false;
3111 default:
3112 return true;
3113 }
3114 };
3115
3116 /*
3117 whether character is entered.
3118 */
3119 KeyCode.isCharacterKey = function isCharacterKey(keyCode) {
3120 if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) {
3121 return true;
3122 }
3123
3124 if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) {
3125 return true;
3126 }
3127
3128 if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) {
3129 return true;
3130 }
3131
3132 // Safari sends zero key code for non-latin characters.
3133 if (window.navigation.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) {
3134 return true;
3135 }
3136
3137 switch (keyCode) {
3138 case KeyCode.SPACE:
3139 case KeyCode.QUESTION_MARK:
3140 case KeyCode.NUM_PLUS:
3141 case KeyCode.NUM_MINUS:
3142 case KeyCode.NUM_PERIOD:
3143 case KeyCode.NUM_DIVISION:
3144 case KeyCode.SEMICOLON:
3145 case KeyCode.DASH:
3146 case KeyCode.EQUALS:
3147 case KeyCode.COMMA:
3148 case KeyCode.PERIOD:
3149 case KeyCode.SLASH:
3150 case KeyCode.APOSTROPHE:
3151 case KeyCode.SINGLE_QUOTE:
3152 case KeyCode.OPEN_SQUARE_BRACKET:
3153 case KeyCode.BACKSLASH:
3154 case KeyCode.CLOSE_SQUARE_BRACKET:
3155 return true;
3156 default:
3157 return false;
3158 }
3159 };
3160
3161 module.exports = KeyCode;
3162
3163/***/ }),
3164/* 39 */
3165/***/ (function(module, exports) {
3166
3167 "use strict";
3168
3169 exports.__esModule = true;
3170 exports.default = contains;
3171 function contains(root, n) {
3172 var node = n;
3173 while (node) {
3174 if (node === root) {
3175 return true;
3176 }
3177 node = node.parentNode;
3178 }
3179
3180 return false;
3181 }
3182
3183/***/ }),
3184/* 40 */
3185/***/ (function(module, exports, __webpack_require__) {
3186
3187 'use strict';
3188
3189 exports.__esModule = true;
3190 exports.default = addEventListenerWrap;
3191
3192 var _addDomEventListener = __webpack_require__(41);
3193
3194 var _addDomEventListener2 = _interopRequireDefault(_addDomEventListener);
3195
3196 var _reactDom = __webpack_require__(12);
3197
3198 var _reactDom2 = _interopRequireDefault(_reactDom);
3199
3200 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3201
3202 function addEventListenerWrap(target, eventType, cb) {
3203 /* eslint camelcase: 2 */
3204 var callback = _reactDom2.default.unstable_batchedUpdates ? function run(e) {
3205 _reactDom2.default.unstable_batchedUpdates(cb, e);
3206 } : cb;
3207 return (0, _addDomEventListener2.default)(target, eventType, callback);
3208 }
3209
3210/***/ }),
3211/* 41 */
3212/***/ (function(module, exports, __webpack_require__) {
3213
3214 'use strict';
3215
3216 Object.defineProperty(exports, '__esModule', {
3217 value: true
3218 });
3219 exports['default'] = addEventListener;
3220
3221 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
3222
3223 var _EventObject = __webpack_require__(42);
3224
3225 var _EventObject2 = _interopRequireDefault(_EventObject);
3226
3227 function addEventListener(target, eventType, callback, option) {
3228 function wrapCallback(e) {
3229 var ne = new _EventObject2['default'](e);
3230 callback.call(target, ne);
3231 }
3232
3233 if (target.addEventListener) {
3234 var _ret = (function () {
3235 var useCapture = false;
3236 if (typeof option === 'object') {
3237 useCapture = option.capture || false;
3238 } else if (typeof option === 'boolean') {
3239 useCapture = option;
3240 }
3241
3242 target.addEventListener(eventType, wrapCallback, option || false);
3243
3244 return {
3245 v: {
3246 remove: function remove() {
3247 target.removeEventListener(eventType, wrapCallback, useCapture);
3248 }
3249 }
3250 };
3251 })();
3252
3253 if (typeof _ret === 'object') return _ret.v;
3254 } else if (target.attachEvent) {
3255 target.attachEvent('on' + eventType, wrapCallback);
3256 return {
3257 remove: function remove() {
3258 target.detachEvent('on' + eventType, wrapCallback);
3259 }
3260 };
3261 }
3262 }
3263
3264 module.exports = exports['default'];
3265
3266/***/ }),
3267/* 42 */
3268/***/ (function(module, exports, __webpack_require__) {
3269
3270 /**
3271 * @ignore
3272 * event object for dom
3273 * @author yiminghe@gmail.com
3274 */
3275
3276 'use strict';
3277
3278 Object.defineProperty(exports, '__esModule', {
3279 value: true
3280 });
3281
3282 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
3283
3284 var _EventBaseObject = __webpack_require__(43);
3285
3286 var _EventBaseObject2 = _interopRequireDefault(_EventBaseObject);
3287
3288 var _objectAssign = __webpack_require__(44);
3289
3290 var _objectAssign2 = _interopRequireDefault(_objectAssign);
3291
3292 var TRUE = true;
3293 var FALSE = false;
3294 var commonProps = ['altKey', 'bubbles', 'cancelable', 'ctrlKey', 'currentTarget', 'eventPhase', 'metaKey', 'shiftKey', 'target', 'timeStamp', 'view', 'type'];
3295
3296 function isNullOrUndefined(w) {
3297 return w === null || w === undefined;
3298 }
3299
3300 var eventNormalizers = [{
3301 reg: /^key/,
3302 props: ['char', 'charCode', 'key', 'keyCode', 'which'],
3303 fix: function fix(event, nativeEvent) {
3304 if (isNullOrUndefined(event.which)) {
3305 event.which = !isNullOrUndefined(nativeEvent.charCode) ? nativeEvent.charCode : nativeEvent.keyCode;
3306 }
3307
3308 // add metaKey to non-Mac browsers (use ctrl for PC 's and Meta for Macs)
3309 if (event.metaKey === undefined) {
3310 event.metaKey = event.ctrlKey;
3311 }
3312 }
3313 }, {
3314 reg: /^touch/,
3315 props: ['touches', 'changedTouches', 'targetTouches']
3316 }, {
3317 reg: /^hashchange$/,
3318 props: ['newURL', 'oldURL']
3319 }, {
3320 reg: /^gesturechange$/i,
3321 props: ['rotation', 'scale']
3322 }, {
3323 reg: /^(mousewheel|DOMMouseScroll)$/,
3324 props: [],
3325 fix: function fix(event, nativeEvent) {
3326 var deltaX = undefined;
3327 var deltaY = undefined;
3328 var delta = undefined;
3329 var wheelDelta = nativeEvent.wheelDelta;
3330 var axis = nativeEvent.axis;
3331 var wheelDeltaY = nativeEvent.wheelDeltaY;
3332 var wheelDeltaX = nativeEvent.wheelDeltaX;
3333 var detail = nativeEvent.detail;
3334
3335 // ie/webkit
3336 if (wheelDelta) {
3337 delta = wheelDelta / 120;
3338 }
3339
3340 // gecko
3341 if (detail) {
3342 // press control e.detail == 1 else e.detail == 3
3343 delta = 0 - (detail % 3 === 0 ? detail / 3 : detail);
3344 }
3345
3346 // Gecko
3347 if (axis !== undefined) {
3348 if (axis === event.HORIZONTAL_AXIS) {
3349 deltaY = 0;
3350 deltaX = 0 - delta;
3351 } else if (axis === event.VERTICAL_AXIS) {
3352 deltaX = 0;
3353 deltaY = delta;
3354 }
3355 }
3356
3357 // Webkit
3358 if (wheelDeltaY !== undefined) {
3359 deltaY = wheelDeltaY / 120;
3360 }
3361 if (wheelDeltaX !== undefined) {
3362 deltaX = -1 * wheelDeltaX / 120;
3363 }
3364
3365 // 默认 deltaY (ie)
3366 if (!deltaX && !deltaY) {
3367 deltaY = delta;
3368 }
3369
3370 if (deltaX !== undefined) {
3371 /**
3372 * deltaX of mousewheel event
3373 * @property deltaX
3374 * @member Event.DomEvent.Object
3375 */
3376 event.deltaX = deltaX;
3377 }
3378
3379 if (deltaY !== undefined) {
3380 /**
3381 * deltaY of mousewheel event
3382 * @property deltaY
3383 * @member Event.DomEvent.Object
3384 */
3385 event.deltaY = deltaY;
3386 }
3387
3388 if (delta !== undefined) {
3389 /**
3390 * delta of mousewheel event
3391 * @property delta
3392 * @member Event.DomEvent.Object
3393 */
3394 event.delta = delta;
3395 }
3396 }
3397 }, {
3398 reg: /^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i,
3399 props: ['buttons', 'clientX', 'clientY', 'button', 'offsetX', 'relatedTarget', 'which', 'fromElement', 'toElement', 'offsetY', 'pageX', 'pageY', 'screenX', 'screenY'],
3400 fix: function fix(event, nativeEvent) {
3401 var eventDoc = undefined;
3402 var doc = undefined;
3403 var body = undefined;
3404 var target = event.target;
3405 var button = nativeEvent.button;
3406
3407 // Calculate pageX/Y if missing and clientX/Y available
3408 if (target && isNullOrUndefined(event.pageX) && !isNullOrUndefined(nativeEvent.clientX)) {
3409 eventDoc = target.ownerDocument || document;
3410 doc = eventDoc.documentElement;
3411 body = eventDoc.body;
3412 event.pageX = nativeEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
3413 event.pageY = nativeEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
3414 }
3415
3416 // which for click: 1 === left; 2 === middle; 3 === right
3417 // do not use button
3418 if (!event.which && button !== undefined) {
3419 if (button & 1) {
3420 event.which = 1;
3421 } else if (button & 2) {
3422 event.which = 3;
3423 } else if (button & 4) {
3424 event.which = 2;
3425 } else {
3426 event.which = 0;
3427 }
3428 }
3429
3430 // add relatedTarget, if necessary
3431 if (!event.relatedTarget && event.fromElement) {
3432 event.relatedTarget = event.fromElement === target ? event.toElement : event.fromElement;
3433 }
3434
3435 return event;
3436 }
3437 }];
3438
3439 function retTrue() {
3440 return TRUE;
3441 }
3442
3443 function retFalse() {
3444 return FALSE;
3445 }
3446
3447 function DomEventObject(nativeEvent) {
3448 var type = nativeEvent.type;
3449
3450 var isNative = typeof nativeEvent.stopPropagation === 'function' || typeof nativeEvent.cancelBubble === 'boolean';
3451
3452 _EventBaseObject2['default'].call(this);
3453
3454 this.nativeEvent = nativeEvent;
3455
3456 // in case dom event has been mark as default prevented by lower dom node
3457 var isDefaultPrevented = retFalse;
3458 if ('defaultPrevented' in nativeEvent) {
3459 isDefaultPrevented = nativeEvent.defaultPrevented ? retTrue : retFalse;
3460 } else if ('getPreventDefault' in nativeEvent) {
3461 // https://bugzilla.mozilla.org/show_bug.cgi?id=691151
3462 isDefaultPrevented = nativeEvent.getPreventDefault() ? retTrue : retFalse;
3463 } else if ('returnValue' in nativeEvent) {
3464 isDefaultPrevented = nativeEvent.returnValue === FALSE ? retTrue : retFalse;
3465 }
3466
3467 this.isDefaultPrevented = isDefaultPrevented;
3468
3469 var fixFns = [];
3470 var fixFn = undefined;
3471 var l = undefined;
3472 var prop = undefined;
3473 var props = commonProps.concat();
3474
3475 eventNormalizers.forEach(function (normalizer) {
3476 if (type.match(normalizer.reg)) {
3477 props = props.concat(normalizer.props);
3478 if (normalizer.fix) {
3479 fixFns.push(normalizer.fix);
3480 }
3481 }
3482 });
3483
3484 l = props.length;
3485
3486 // clone properties of the original event object
3487 while (l) {
3488 prop = props[--l];
3489 this[prop] = nativeEvent[prop];
3490 }
3491
3492 // fix target property, if necessary
3493 if (!this.target && isNative) {
3494 this.target = nativeEvent.srcElement || document; // srcElement might not be defined either
3495 }
3496
3497 // check if target is a text node (safari)
3498 if (this.target && this.target.nodeType === 3) {
3499 this.target = this.target.parentNode;
3500 }
3501
3502 l = fixFns.length;
3503
3504 while (l) {
3505 fixFn = fixFns[--l];
3506 fixFn(this, nativeEvent);
3507 }
3508
3509 this.timeStamp = nativeEvent.timeStamp || Date.now();
3510 }
3511
3512 var EventBaseObjectProto = _EventBaseObject2['default'].prototype;
3513
3514 (0, _objectAssign2['default'])(DomEventObject.prototype, EventBaseObjectProto, {
3515 constructor: DomEventObject,
3516
3517 preventDefault: function preventDefault() {
3518 var e = this.nativeEvent;
3519
3520 // if preventDefault exists run it on the original event
3521 if (e.preventDefault) {
3522 e.preventDefault();
3523 } else {
3524 // otherwise set the returnValue property of the original event to FALSE (IE)
3525 e.returnValue = FALSE;
3526 }
3527
3528 EventBaseObjectProto.preventDefault.call(this);
3529 },
3530
3531 stopPropagation: function stopPropagation() {
3532 var e = this.nativeEvent;
3533
3534 // if stopPropagation exists run it on the original event
3535 if (e.stopPropagation) {
3536 e.stopPropagation();
3537 } else {
3538 // otherwise set the cancelBubble property of the original event to TRUE (IE)
3539 e.cancelBubble = TRUE;
3540 }
3541
3542 EventBaseObjectProto.stopPropagation.call(this);
3543 }
3544 });
3545
3546 exports['default'] = DomEventObject;
3547 module.exports = exports['default'];
3548
3549/***/ }),
3550/* 43 */
3551/***/ (function(module, exports) {
3552
3553 /**
3554 * @ignore
3555 * base event object for custom and dom event.
3556 * @author yiminghe@gmail.com
3557 */
3558
3559 "use strict";
3560
3561 Object.defineProperty(exports, "__esModule", {
3562 value: true
3563 });
3564 function returnFalse() {
3565 return false;
3566 }
3567
3568 function returnTrue() {
3569 return true;
3570 }
3571
3572 function EventBaseObject() {
3573 this.timeStamp = Date.now();
3574 this.target = undefined;
3575 this.currentTarget = undefined;
3576 }
3577
3578 EventBaseObject.prototype = {
3579 isEventObject: 1,
3580
3581 constructor: EventBaseObject,
3582
3583 isDefaultPrevented: returnFalse,
3584
3585 isPropagationStopped: returnFalse,
3586
3587 isImmediatePropagationStopped: returnFalse,
3588
3589 preventDefault: function preventDefault() {
3590 this.isDefaultPrevented = returnTrue;
3591 },
3592
3593 stopPropagation: function stopPropagation() {
3594 this.isPropagationStopped = returnTrue;
3595 },
3596
3597 stopImmediatePropagation: function stopImmediatePropagation() {
3598 this.isImmediatePropagationStopped = returnTrue;
3599 // fixed 1.2
3600 // call stopPropagation implicitly
3601 this.stopPropagation();
3602 },
3603
3604 halt: function halt(immediate) {
3605 if (immediate) {
3606 this.stopImmediatePropagation();
3607 } else {
3608 this.stopPropagation();
3609 }
3610 this.preventDefault();
3611 }
3612 };
3613
3614 exports["default"] = EventBaseObject;
3615 module.exports = exports["default"];
3616
3617/***/ }),
3618/* 44 */
3619/***/ (function(module, exports) {
3620
3621 /*
3622 object-assign
3623 (c) Sindre Sorhus
3624 @license MIT
3625 */
3626
3627 'use strict';
3628 /* eslint-disable no-unused-vars */
3629 var getOwnPropertySymbols = Object.getOwnPropertySymbols;
3630 var hasOwnProperty = Object.prototype.hasOwnProperty;
3631 var propIsEnumerable = Object.prototype.propertyIsEnumerable;
3632
3633 function toObject(val) {
3634 if (val === null || val === undefined) {
3635 throw new TypeError('Object.assign cannot be called with null or undefined');
3636 }
3637
3638 return Object(val);
3639 }
3640
3641 function shouldUseNative() {
3642 try {
3643 if (!Object.assign) {
3644 return false;
3645 }
3646
3647 // Detect buggy property enumeration order in older V8 versions.
3648
3649 // https://bugs.chromium.org/p/v8/issues/detail?id=4118
3650 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
3651 test1[5] = 'de';
3652 if (Object.getOwnPropertyNames(test1)[0] === '5') {
3653 return false;
3654 }
3655
3656 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
3657 var test2 = {};
3658 for (var i = 0; i < 10; i++) {
3659 test2['_' + String.fromCharCode(i)] = i;
3660 }
3661 var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
3662 return test2[n];
3663 });
3664 if (order2.join('') !== '0123456789') {
3665 return false;
3666 }
3667
3668 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
3669 var test3 = {};
3670 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
3671 test3[letter] = letter;
3672 });
3673 if (Object.keys(Object.assign({}, test3)).join('') !==
3674 'abcdefghijklmnopqrst') {
3675 return false;
3676 }
3677
3678 return true;
3679 } catch (err) {
3680 // We don't expect any of the above to throw, but better to be safe.
3681 return false;
3682 }
3683 }
3684
3685 module.exports = shouldUseNative() ? Object.assign : function (target, source) {
3686 var from;
3687 var to = toObject(target);
3688 var symbols;
3689
3690 for (var s = 1; s < arguments.length; s++) {
3691 from = Object(arguments[s]);
3692
3693 for (var key in from) {
3694 if (hasOwnProperty.call(from, key)) {
3695 to[key] = from[key];
3696 }
3697 }
3698
3699 if (getOwnPropertySymbols) {
3700 symbols = getOwnPropertySymbols(from);
3701 for (var i = 0; i < symbols.length; i++) {
3702 if (propIsEnumerable.call(from, symbols[i])) {
3703 to[symbols[i]] = from[symbols[i]];
3704 }
3705 }
3706 }
3707 }
3708
3709 return to;
3710 };
3711
3712
3713/***/ }),
3714/* 45 */
3715/***/ (function(module, exports, __webpack_require__) {
3716
3717 'use strict';
3718
3719 exports.__esModule = true;
3720
3721 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; };
3722
3723 var _Event = __webpack_require__(46);
3724
3725 var _Event2 = _interopRequireDefault(_Event);
3726
3727 var _componentClasses = __webpack_require__(47);
3728
3729 var _componentClasses2 = _interopRequireDefault(_componentClasses);
3730
3731 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3732
3733 var isCssAnimationSupported = _Event2.default.endEvents.length !== 0;
3734
3735
3736 var capitalPrefixes = ['Webkit', 'Moz', 'O',
3737 // ms is special .... !
3738 'ms'];
3739 var prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', ''];
3740
3741 function getStyleProperty(node, name) {
3742 var style = window.getComputedStyle(node);
3743
3744 var ret = '';
3745 for (var i = 0; i < prefixes.length; i++) {
3746 ret = style.getPropertyValue(prefixes[i] + name);
3747 if (ret) {
3748 break;
3749 }
3750 }
3751 return ret;
3752 }
3753
3754 function fixBrowserByTimeout(node) {
3755 if (isCssAnimationSupported) {
3756 var transitionDelay = parseFloat(getStyleProperty(node, 'transition-delay')) || 0;
3757 var transitionDuration = parseFloat(getStyleProperty(node, 'transition-duration')) || 0;
3758 var animationDelay = parseFloat(getStyleProperty(node, 'animation-delay')) || 0;
3759 var animationDuration = parseFloat(getStyleProperty(node, 'animation-duration')) || 0;
3760 var time = Math.max(transitionDuration + transitionDelay, animationDuration + animationDelay);
3761 // sometimes, browser bug
3762 node.rcEndAnimTimeout = setTimeout(function () {
3763 node.rcEndAnimTimeout = null;
3764 if (node.rcEndListener) {
3765 node.rcEndListener();
3766 }
3767 }, time * 1000 + 200);
3768 }
3769 }
3770
3771 function clearBrowserBugTimeout(node) {
3772 if (node.rcEndAnimTimeout) {
3773 clearTimeout(node.rcEndAnimTimeout);
3774 node.rcEndAnimTimeout = null;
3775 }
3776 }
3777
3778 var cssAnimation = function cssAnimation(node, transitionName, endCallback) {
3779 var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object';
3780 var className = nameIsObj ? transitionName.name : transitionName;
3781 var activeClassName = nameIsObj ? transitionName.active : transitionName + '-active';
3782 var end = endCallback;
3783 var start = void 0;
3784 var active = void 0;
3785 var nodeClasses = (0, _componentClasses2.default)(node);
3786
3787 if (endCallback && Object.prototype.toString.call(endCallback) === '[object Object]') {
3788 end = endCallback.end;
3789 start = endCallback.start;
3790 active = endCallback.active;
3791 }
3792
3793 if (node.rcEndListener) {
3794 node.rcEndListener();
3795 }
3796
3797 node.rcEndListener = function (e) {
3798 if (e && e.target !== node) {
3799 return;
3800 }
3801
3802 if (node.rcAnimTimeout) {
3803 clearTimeout(node.rcAnimTimeout);
3804 node.rcAnimTimeout = null;
3805 }
3806
3807 clearBrowserBugTimeout(node);
3808
3809 nodeClasses.remove(className);
3810 nodeClasses.remove(activeClassName);
3811
3812 _Event2.default.removeEndEventListener(node, node.rcEndListener);
3813 node.rcEndListener = null;
3814
3815 // Usually this optional end is used for informing an owner of
3816 // a leave animation and telling it to remove the child.
3817 if (end) {
3818 end();
3819 }
3820 };
3821
3822 _Event2.default.addEndEventListener(node, node.rcEndListener);
3823
3824 if (start) {
3825 start();
3826 }
3827 nodeClasses.add(className);
3828
3829 node.rcAnimTimeout = setTimeout(function () {
3830 node.rcAnimTimeout = null;
3831 nodeClasses.add(activeClassName);
3832 if (active) {
3833 setTimeout(active, 0);
3834 }
3835 fixBrowserByTimeout(node);
3836 // 30ms for firefox
3837 }, 30);
3838
3839 return {
3840 stop: function stop() {
3841 if (node.rcEndListener) {
3842 node.rcEndListener();
3843 }
3844 }
3845 };
3846 };
3847
3848 cssAnimation.style = function (node, style, callback) {
3849 if (node.rcEndListener) {
3850 node.rcEndListener();
3851 }
3852
3853 node.rcEndListener = function (e) {
3854 if (e && e.target !== node) {
3855 return;
3856 }
3857
3858 if (node.rcAnimTimeout) {
3859 clearTimeout(node.rcAnimTimeout);
3860 node.rcAnimTimeout = null;
3861 }
3862
3863 clearBrowserBugTimeout(node);
3864
3865 _Event2.default.removeEndEventListener(node, node.rcEndListener);
3866 node.rcEndListener = null;
3867
3868 // Usually this optional callback is used for informing an owner of
3869 // a leave animation and telling it to remove the child.
3870 if (callback) {
3871 callback();
3872 }
3873 };
3874
3875 _Event2.default.addEndEventListener(node, node.rcEndListener);
3876
3877 node.rcAnimTimeout = setTimeout(function () {
3878 for (var s in style) {
3879 if (style.hasOwnProperty(s)) {
3880 node.style[s] = style[s];
3881 }
3882 }
3883 node.rcAnimTimeout = null;
3884 fixBrowserByTimeout(node);
3885 }, 0);
3886 };
3887
3888 cssAnimation.setTransition = function (node, p, value) {
3889 var property = p;
3890 var v = value;
3891 if (value === undefined) {
3892 v = property;
3893 property = '';
3894 }
3895 property = property || '';
3896 capitalPrefixes.forEach(function (prefix) {
3897 node.style[prefix + 'Transition' + property] = v;
3898 });
3899 };
3900
3901 cssAnimation.isCssAnimationSupported = isCssAnimationSupported;
3902
3903 exports.default = cssAnimation;
3904
3905/***/ }),
3906/* 46 */
3907/***/ (function(module, exports) {
3908
3909 'use strict';
3910
3911 exports.__esModule = true;
3912 var EVENT_NAME_MAP = {
3913 transitionend: {
3914 transition: 'transitionend',
3915 WebkitTransition: 'webkitTransitionEnd',
3916 MozTransition: 'mozTransitionEnd',
3917 OTransition: 'oTransitionEnd',
3918 msTransition: 'MSTransitionEnd'
3919 },
3920
3921 animationend: {
3922 animation: 'animationend',
3923 WebkitAnimation: 'webkitAnimationEnd',
3924 MozAnimation: 'mozAnimationEnd',
3925 OAnimation: 'oAnimationEnd',
3926 msAnimation: 'MSAnimationEnd'
3927 }
3928 };
3929
3930 var endEvents = [];
3931
3932 function detectEvents() {
3933 var testEl = document.createElement('div');
3934 var style = testEl.style;
3935
3936 if (!('AnimationEvent' in window)) {
3937 delete EVENT_NAME_MAP.animationend.animation;
3938 }
3939
3940 if (!('TransitionEvent' in window)) {
3941 delete EVENT_NAME_MAP.transitionend.transition;
3942 }
3943
3944 for (var baseEventName in EVENT_NAME_MAP) {
3945 if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) {
3946 var baseEvents = EVENT_NAME_MAP[baseEventName];
3947 for (var styleName in baseEvents) {
3948 if (styleName in style) {
3949 endEvents.push(baseEvents[styleName]);
3950 break;
3951 }
3952 }
3953 }
3954 }
3955 }
3956
3957 if (typeof window !== 'undefined' && typeof document !== 'undefined') {
3958 detectEvents();
3959 }
3960
3961 function addEventListener(node, eventName, eventListener) {
3962 node.addEventListener(eventName, eventListener, false);
3963 }
3964
3965 function removeEventListener(node, eventName, eventListener) {
3966 node.removeEventListener(eventName, eventListener, false);
3967 }
3968
3969 var TransitionEvents = {
3970 addEndEventListener: function addEndEventListener(node, eventListener) {
3971 if (endEvents.length === 0) {
3972 window.setTimeout(eventListener, 0);
3973 return;
3974 }
3975 endEvents.forEach(function (endEvent) {
3976 addEventListener(node, endEvent, eventListener);
3977 });
3978 },
3979
3980
3981 endEvents: endEvents,
3982
3983 removeEndEventListener: function removeEndEventListener(node, eventListener) {
3984 if (endEvents.length === 0) {
3985 return;
3986 }
3987 endEvents.forEach(function (endEvent) {
3988 removeEventListener(node, endEvent, eventListener);
3989 });
3990 }
3991 };
3992
3993 exports.default = TransitionEvents;
3994
3995/***/ }),
3996/* 47 */
3997/***/ (function(module, exports, __webpack_require__) {
3998
3999 /**
4000 * Module dependencies.
4001 */
4002
4003 try {
4004 var index = __webpack_require__(48);
4005 } catch (err) {
4006 var index = __webpack_require__(48);
4007 }
4008
4009 /**
4010 * Whitespace regexp.
4011 */
4012
4013 var re = /\s+/;
4014
4015 /**
4016 * toString reference.
4017 */
4018
4019 var toString = Object.prototype.toString;
4020
4021 /**
4022 * Wrap `el` in a `ClassList`.
4023 *
4024 * @param {Element} el
4025 * @return {ClassList}
4026 * @api public
4027 */
4028
4029 module.exports = function(el){
4030 return new ClassList(el);
4031 };
4032
4033 /**
4034 * Initialize a new ClassList for `el`.
4035 *
4036 * @param {Element} el
4037 * @api private
4038 */
4039
4040 function ClassList(el) {
4041 if (!el || !el.nodeType) {
4042 throw new Error('A DOM element reference is required');
4043 }
4044 this.el = el;
4045 this.list = el.classList;
4046 }
4047
4048 /**
4049 * Add class `name` if not already present.
4050 *
4051 * @param {String} name
4052 * @return {ClassList}
4053 * @api public
4054 */
4055
4056 ClassList.prototype.add = function(name){
4057 // classList
4058 if (this.list) {
4059 this.list.add(name);
4060 return this;
4061 }
4062
4063 // fallback
4064 var arr = this.array();
4065 var i = index(arr, name);
4066 if (!~i) arr.push(name);
4067 this.el.className = arr.join(' ');
4068 return this;
4069 };
4070
4071 /**
4072 * Remove class `name` when present, or
4073 * pass a regular expression to remove
4074 * any which match.
4075 *
4076 * @param {String|RegExp} name
4077 * @return {ClassList}
4078 * @api public
4079 */
4080
4081 ClassList.prototype.remove = function(name){
4082 if ('[object RegExp]' == toString.call(name)) {
4083 return this.removeMatching(name);
4084 }
4085
4086 // classList
4087 if (this.list) {
4088 this.list.remove(name);
4089 return this;
4090 }
4091
4092 // fallback
4093 var arr = this.array();
4094 var i = index(arr, name);
4095 if (~i) arr.splice(i, 1);
4096 this.el.className = arr.join(' ');
4097 return this;
4098 };
4099
4100 /**
4101 * Remove all classes matching `re`.
4102 *
4103 * @param {RegExp} re
4104 * @return {ClassList}
4105 * @api private
4106 */
4107
4108 ClassList.prototype.removeMatching = function(re){
4109 var arr = this.array();
4110 for (var i = 0; i < arr.length; i++) {
4111 if (re.test(arr[i])) {
4112 this.remove(arr[i]);
4113 }
4114 }
4115 return this;
4116 };
4117
4118 /**
4119 * Toggle class `name`, can force state via `force`.
4120 *
4121 * For browsers that support classList, but do not support `force` yet,
4122 * the mistake will be detected and corrected.
4123 *
4124 * @param {String} name
4125 * @param {Boolean} force
4126 * @return {ClassList}
4127 * @api public
4128 */
4129
4130 ClassList.prototype.toggle = function(name, force){
4131 // classList
4132 if (this.list) {
4133 if ("undefined" !== typeof force) {
4134 if (force !== this.list.toggle(name, force)) {
4135 this.list.toggle(name); // toggle again to correct
4136 }
4137 } else {
4138 this.list.toggle(name);
4139 }
4140 return this;
4141 }
4142
4143 // fallback
4144 if ("undefined" !== typeof force) {
4145 if (!force) {
4146 this.remove(name);
4147 } else {
4148 this.add(name);
4149 }
4150 } else {
4151 if (this.has(name)) {
4152 this.remove(name);
4153 } else {
4154 this.add(name);
4155 }
4156 }
4157
4158 return this;
4159 };
4160
4161 /**
4162 * Return an array of classes.
4163 *
4164 * @return {Array}
4165 * @api public
4166 */
4167
4168 ClassList.prototype.array = function(){
4169 var className = this.el.getAttribute('class') || '';
4170 var str = className.replace(/^\s+|\s+$/g, '');
4171 var arr = str.split(re);
4172 if ('' === arr[0]) arr.shift();
4173 return arr;
4174 };
4175
4176 /**
4177 * Check if class `name` is present.
4178 *
4179 * @param {String} name
4180 * @return {ClassList}
4181 * @api public
4182 */
4183
4184 ClassList.prototype.has =
4185 ClassList.prototype.contains = function(name){
4186 return this.list
4187 ? this.list.contains(name)
4188 : !! ~index(this.array(), name);
4189 };
4190
4191
4192/***/ }),
4193/* 48 */
4194/***/ (function(module, exports) {
4195
4196 module.exports = function(arr, obj){
4197 if (arr.indexOf) return arr.indexOf(obj);
4198 for (var i = 0; i < arr.length; ++i) {
4199 if (arr[i] === obj) return i;
4200 }
4201 return -1;
4202 };
4203
4204/***/ }),
4205/* 49 */
4206/***/ (function(module, exports, __webpack_require__) {
4207
4208 'use strict';
4209
4210 exports.__esModule = true;
4211 exports.default = toArray;
4212
4213 var _react = __webpack_require__(4);
4214
4215 var _react2 = _interopRequireDefault(_react);
4216
4217 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4218
4219 function toArray(children) {
4220 var ret = [];
4221 _react2.default.Children.forEach(children, function (c) {
4222 ret.push(c);
4223 });
4224 return ret;
4225 }
4226
4227/***/ }),
4228/* 50 */
4229/***/ (function(module, exports, __webpack_require__) {
4230
4231 'use strict';
4232
4233 exports.__esModule = true;
4234
4235 var _react = __webpack_require__(4);
4236
4237 var _react2 = _interopRequireDefault(_react);
4238
4239 var _propTypes = __webpack_require__(5);
4240
4241 var _propTypes2 = _interopRequireDefault(_propTypes);
4242
4243 var _reactDom = __webpack_require__(12);
4244
4245 var _reactDom2 = _interopRequireDefault(_reactDom);
4246
4247 var _domAlign = __webpack_require__(51);
4248
4249 var _domAlign2 = _interopRequireDefault(_domAlign);
4250
4251 var _addEventListener = __webpack_require__(40);
4252
4253 var _addEventListener2 = _interopRequireDefault(_addEventListener);
4254
4255 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4256
4257 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4258
4259 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; }
4260
4261 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; }
4262
4263 //import isWindow from './isWindow';
4264
4265 function isWindow(obj) {
4266 /* eslint no-eq-null: 0 */
4267 /* eslint eqeqeq: 0 */
4268 return obj != null && obj == obj.window;
4269 }
4270
4271 function buffer(fn, ms) {
4272 var timer = void 0;
4273
4274 function clear() {
4275 if (timer) {
4276 clearTimeout(timer);
4277 timer = null;
4278 }
4279 }
4280
4281 function bufferFn() {
4282 clear();
4283 timer = setTimeout(fn, ms);
4284 }
4285
4286 bufferFn.clear = clear;
4287
4288 return bufferFn;
4289 }
4290
4291 var propTypes = {
4292 childrenProps: _propTypes2.default.object,
4293 align: _propTypes2.default.object.isRequired,
4294 target: _propTypes2.default.func,
4295 onAlign: _propTypes2.default.func,
4296 monitorBufferTime: _propTypes2.default.number,
4297 monitorWindowResize: _propTypes2.default.bool,
4298 disabled: _propTypes2.default.bool,
4299 children: _propTypes2.default.any
4300 };
4301
4302 var defaultProps = {
4303 target: function target() {
4304 return window;
4305 },
4306 onAlign: function onAlign() {},
4307
4308 monitorBufferTime: 50,
4309 monitorWindowResize: false,
4310 disabled: false
4311 };
4312
4313 var Align = function (_React$Component) {
4314 _inherits(Align, _React$Component);
4315
4316 function Align(props) {
4317 _classCallCheck(this, Align);
4318
4319 var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
4320
4321 _initialiseProps.call(_this);
4322
4323 return _this;
4324 }
4325
4326 Align.prototype.componentDidMount = function componentDidMount() {
4327 var props = this.props;
4328 // if parent ref not attached .... use document.getElementById
4329 this.forceAlign();
4330 if (!props.disabled && props.monitorWindowResize) {
4331 this.startMonitorWindowResize();
4332 }
4333 };
4334
4335 Align.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
4336 var reAlign = false;
4337 var props = this.props;
4338
4339 if (!props.disabled) {
4340 if (prevProps.disabled || prevProps.align !== props.align) {
4341 reAlign = true;
4342 } else {
4343 var lastTarget = prevProps.target();
4344 var currentTarget = props.target();
4345 if (isWindow(lastTarget) && isWindow(currentTarget)) {
4346 reAlign = false;
4347 } else if (lastTarget !== currentTarget) {
4348 reAlign = true;
4349 }
4350 }
4351 }
4352
4353 if (reAlign) {
4354 this.forceAlign();
4355 }
4356
4357 if (props.monitorWindowResize && !props.disabled) {
4358 this.startMonitorWindowResize();
4359 } else {
4360 this.stopMonitorWindowResize();
4361 }
4362 };
4363
4364 Align.prototype.componentWillUnmount = function componentWillUnmount() {
4365 this.stopMonitorWindowResize();
4366 };
4367
4368 Align.prototype.render = function render() {
4369 var _props = this.props,
4370 childrenProps = _props.childrenProps,
4371 children = _props.children;
4372
4373 var child = _react2.default.Children.only(children);
4374 if (childrenProps) {
4375 var newProps = {};
4376 for (var prop in childrenProps) {
4377 if (childrenProps.hasOwnProperty(prop)) {
4378 newProps[prop] = this.props[childrenProps[prop]];
4379 }
4380 }
4381 return _react2.default.cloneElement(child, newProps);
4382 }
4383 return child;
4384 };
4385
4386 return Align;
4387 }(_react2.default.Component);
4388
4389 var _initialiseProps = function _initialiseProps() {
4390 var _this2 = this;
4391
4392 this.startMonitorWindowResize = function () {
4393 if (!_this2.resizeHandler) {
4394 _this2.bufferMonitor = buffer(_this2.forceAlign, _this2.props.monitorBufferTime);
4395 _this2.resizeHandler = (0, _addEventListener2.default)(window, 'resize', _this2.bufferMonitor);
4396 }
4397 };
4398
4399 this.stopMonitorWindowResize = function () {
4400 if (_this2.resizeHandler) {
4401 _this2.bufferMonitor.clear();
4402 _this2.resizeHandler.remove();
4403 _this2.resizeHandler = null;
4404 }
4405 };
4406
4407 this.forceAlign = function () {
4408 var props = _this2.props;
4409 if (!props.disabled) {
4410 var source = _reactDom2.default.findDOMNode(_this2);
4411 props.onAlign(source, (0, _domAlign2.default)(source, props.target(), props.align));
4412 }
4413 };
4414 };
4415
4416 ;
4417
4418 Align.defaultProps = defaultProps;
4419 Align.propTypes = propTypes;
4420
4421 exports.default = Align;
4422
4423/***/ }),
4424/* 51 */
4425/***/ (function(module, exports, __webpack_require__) {
4426
4427 'use strict';
4428
4429 Object.defineProperty(exports, "__esModule", {
4430 value: true
4431 });
4432 exports.alignPoint = exports.alignElement = undefined;
4433
4434 var _alignElement = __webpack_require__(52);
4435
4436 var _alignElement2 = _interopRequireDefault(_alignElement);
4437
4438 var _alignPoint = __webpack_require__(63);
4439
4440 var _alignPoint2 = _interopRequireDefault(_alignPoint);
4441
4442 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
4443
4444 exports.alignElement = _alignElement2['default'];
4445 exports.alignPoint = _alignPoint2['default'];
4446 exports['default'] = _alignElement2['default'];
4447
4448/***/ }),
4449/* 52 */
4450/***/ (function(module, exports, __webpack_require__) {
4451
4452 'use strict';
4453
4454 Object.defineProperty(exports, "__esModule", {
4455 value: true
4456 });
4457
4458 var _align = __webpack_require__(53);
4459
4460 var _align2 = _interopRequireDefault(_align);
4461
4462 var _getOffsetParent = __webpack_require__(57);
4463
4464 var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent);
4465
4466 var _getVisibleRectForElement = __webpack_require__(56);
4467
4468 var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement);
4469
4470 var _getRegion = __webpack_require__(60);
4471
4472 var _getRegion2 = _interopRequireDefault(_getRegion);
4473
4474 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
4475
4476 function isOutOfVisibleRect(target) {
4477 var visibleRect = (0, _getVisibleRectForElement2['default'])(target);
4478 var targetRegion = (0, _getRegion2['default'])(target);
4479
4480 return !visibleRect || targetRegion.left + targetRegion.width <= visibleRect.left || targetRegion.top + targetRegion.height <= visibleRect.top || targetRegion.left >= visibleRect.right || targetRegion.top >= visibleRect.bottom;
4481 }
4482
4483 function alignElement(el, refNode, align) {
4484 var target = align.target || refNode;
4485 var refNodeRegion = (0, _getRegion2['default'])(target);
4486
4487 var isTargetNotOutOfVisible = !isOutOfVisibleRect(target);
4488
4489 return (0, _align2['default'])(el, refNodeRegion, align, isTargetNotOutOfVisible);
4490 }
4491
4492 alignElement.__getOffsetParent = _getOffsetParent2['default'];
4493
4494 alignElement.__getVisibleRectForElement = _getVisibleRectForElement2['default'];
4495
4496 exports['default'] = alignElement;
4497 module.exports = exports['default'];
4498
4499/***/ }),
4500/* 53 */
4501/***/ (function(module, exports, __webpack_require__) {
4502
4503 'use strict';
4504
4505 Object.defineProperty(exports, "__esModule", {
4506 value: true
4507 });
4508
4509 var _utils = __webpack_require__(54);
4510
4511 var _utils2 = _interopRequireDefault(_utils);
4512
4513 var _getVisibleRectForElement = __webpack_require__(56);
4514
4515 var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement);
4516
4517 var _adjustForViewport = __webpack_require__(59);
4518
4519 var _adjustForViewport2 = _interopRequireDefault(_adjustForViewport);
4520
4521 var _getRegion = __webpack_require__(60);
4522
4523 var _getRegion2 = _interopRequireDefault(_getRegion);
4524
4525 var _getElFuturePos = __webpack_require__(61);
4526
4527 var _getElFuturePos2 = _interopRequireDefault(_getElFuturePos);
4528
4529 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
4530
4531 // http://yiminghe.iteye.com/blog/1124720
4532
4533 function isFailX(elFuturePos, elRegion, visibleRect) {
4534 return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;
4535 } /**
4536 * align dom node flexibly
4537 * @author yiminghe@gmail.com
4538 */
4539
4540 function isFailY(elFuturePos, elRegion, visibleRect) {
4541 return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom;
4542 }
4543
4544 function isCompleteFailX(elFuturePos, elRegion, visibleRect) {
4545 return elFuturePos.left > visibleRect.right || elFuturePos.left + elRegion.width < visibleRect.left;
4546 }
4547
4548 function isCompleteFailY(elFuturePos, elRegion, visibleRect) {
4549 return elFuturePos.top > visibleRect.bottom || elFuturePos.top + elRegion.height < visibleRect.top;
4550 }
4551
4552 function flip(points, reg, map) {
4553 var ret = [];
4554 _utils2['default'].each(points, function (p) {
4555 ret.push(p.replace(reg, function (m) {
4556 return map[m];
4557 }));
4558 });
4559 return ret;
4560 }
4561
4562 function flipOffset(offset, index) {
4563 offset[index] = -offset[index];
4564 return offset;
4565 }
4566
4567 function convertOffset(str, offsetLen) {
4568 var n = void 0;
4569 if (/%$/.test(str)) {
4570 n = parseInt(str.substring(0, str.length - 1), 10) / 100 * offsetLen;
4571 } else {
4572 n = parseInt(str, 10);
4573 }
4574 return n || 0;
4575 }
4576
4577 function normalizeOffset(offset, el) {
4578 offset[0] = convertOffset(offset[0], el.width);
4579 offset[1] = convertOffset(offset[1], el.height);
4580 }
4581
4582 /**
4583 * @param el
4584 * @param tgtRegion 参照节点所占的区域: { left, top, width, height }
4585 * @param align
4586 */
4587 function doAlign(el, tgtRegion, align, isTgtRegionVisible) {
4588 var points = align.points;
4589 var offset = align.offset || [0, 0];
4590 var targetOffset = align.targetOffset || [0, 0];
4591 var overflow = align.overflow;
4592 var source = align.source || el;
4593 offset = [].concat(offset);
4594 targetOffset = [].concat(targetOffset);
4595 overflow = overflow || {};
4596 var newOverflowCfg = {};
4597 var fail = 0;
4598 // 当前节点可以被放置的显示区域
4599 var visibleRect = (0, _getVisibleRectForElement2['default'])(source);
4600 // 当前节点所占的区域, left/top/width/height
4601 var elRegion = (0, _getRegion2['default'])(source);
4602 // 将 offset 转换成数值,支持百分比
4603 normalizeOffset(offset, elRegion);
4604 normalizeOffset(targetOffset, tgtRegion);
4605 // 当前节点将要被放置的位置
4606 var elFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, points, offset, targetOffset);
4607 // 当前节点将要所处的区域
4608 var newElRegion = _utils2['default'].merge(elRegion, elFuturePos);
4609
4610 // 如果可视区域不能完全放置当前节点时允许调整
4611 if (visibleRect && (overflow.adjustX || overflow.adjustY) && isTgtRegionVisible) {
4612 if (overflow.adjustX) {
4613 // 如果横向不能放下
4614 if (isFailX(elFuturePos, elRegion, visibleRect)) {
4615 // 对齐位置反下
4616 var newPoints = flip(points, /[lr]/ig, {
4617 l: 'r',
4618 r: 'l'
4619 });
4620 // 偏移量也反下
4621 var newOffset = flipOffset(offset, 0);
4622 var newTargetOffset = flipOffset(targetOffset, 0);
4623 var newElFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, newPoints, newOffset, newTargetOffset);
4624
4625 if (!isCompleteFailX(newElFuturePos, elRegion, visibleRect)) {
4626 fail = 1;
4627 points = newPoints;
4628 offset = newOffset;
4629 targetOffset = newTargetOffset;
4630 }
4631 }
4632 }
4633
4634 if (overflow.adjustY) {
4635 // 如果纵向不能放下
4636 if (isFailY(elFuturePos, elRegion, visibleRect)) {
4637 // 对齐位置反下
4638 var _newPoints = flip(points, /[tb]/ig, {
4639 t: 'b',
4640 b: 't'
4641 });
4642 // 偏移量也反下
4643 var _newOffset = flipOffset(offset, 1);
4644 var _newTargetOffset = flipOffset(targetOffset, 1);
4645 var _newElFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, _newPoints, _newOffset, _newTargetOffset);
4646
4647 if (!isCompleteFailY(_newElFuturePos, elRegion, visibleRect)) {
4648 fail = 1;
4649 points = _newPoints;
4650 offset = _newOffset;
4651 targetOffset = _newTargetOffset;
4652 }
4653 }
4654 }
4655
4656 // 如果失败,重新计算当前节点将要被放置的位置
4657 if (fail) {
4658 elFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, points, offset, targetOffset);
4659 _utils2['default'].mix(newElRegion, elFuturePos);
4660 }
4661 var isStillFailX = isFailX(elFuturePos, elRegion, visibleRect);
4662 var isStillFailY = isFailY(elFuturePos, elRegion, visibleRect);
4663 // 检查反下后的位置是否可以放下了,如果仍然放不下:
4664 // 1. 复原修改过的定位参数
4665 if (isStillFailX || isStillFailY) {
4666 points = align.points;
4667 offset = align.offset || [0, 0];
4668 targetOffset = align.targetOffset || [0, 0];
4669 }
4670 // 2. 只有指定了可以调整当前方向才调整
4671 newOverflowCfg.adjustX = overflow.adjustX && isStillFailX;
4672 newOverflowCfg.adjustY = overflow.adjustY && isStillFailY;
4673
4674 // 确实要调整,甚至可能会调整高度宽度
4675 if (newOverflowCfg.adjustX || newOverflowCfg.adjustY) {
4676 newElRegion = (0, _adjustForViewport2['default'])(elFuturePos, elRegion, visibleRect, newOverflowCfg);
4677 }
4678 }
4679
4680 // need judge to in case set fixed with in css on height auto element
4681 if (newElRegion.width !== elRegion.width) {
4682 _utils2['default'].css(source, 'width', _utils2['default'].width(source) + newElRegion.width - elRegion.width);
4683 }
4684
4685 if (newElRegion.height !== elRegion.height) {
4686 _utils2['default'].css(source, 'height', _utils2['default'].height(source) + newElRegion.height - elRegion.height);
4687 }
4688
4689 // https://github.com/kissyteam/kissy/issues/190
4690 // 相对于屏幕位置没变,而 left/top 变了
4691 // 例如 <div 'relative'><el absolute></div>
4692 _utils2['default'].offset(source, {
4693 left: newElRegion.left,
4694 top: newElRegion.top
4695 }, {
4696 useCssRight: align.useCssRight,
4697 useCssBottom: align.useCssBottom,
4698 useCssTransform: align.useCssTransform,
4699 ignoreShake: align.ignoreShake
4700 });
4701
4702 return {
4703 points: points,
4704 offset: offset,
4705 targetOffset: targetOffset,
4706 overflow: newOverflowCfg
4707 };
4708 }
4709
4710 exports['default'] = doAlign;
4711 /**
4712 * 2012-04-26 yiminghe@gmail.com
4713 * - 优化智能对齐算法
4714 * - 慎用 resizeXX
4715 *
4716 * 2011-07-13 yiminghe@gmail.com note:
4717 * - 增加智能对齐,以及大小调整选项
4718 **/
4719
4720 module.exports = exports['default'];
4721
4722/***/ }),
4723/* 54 */
4724/***/ (function(module, exports, __webpack_require__) {
4725
4726 'use strict';
4727
4728 Object.defineProperty(exports, "__esModule", {
4729 value: true
4730 });
4731
4732 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; };
4733
4734 var _propertyUtils = __webpack_require__(55);
4735
4736 var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source;
4737
4738 var getComputedStyleX = void 0;
4739
4740 // https://stackoverflow.com/a/3485654/3040605
4741 function forceRelayout(elem) {
4742 var originalStyle = elem.style.display;
4743 elem.style.display = 'none';
4744 elem.offsetHeight; // eslint-disable-line
4745 elem.style.display = originalStyle;
4746 }
4747
4748 function css(el, name, v) {
4749 var value = v;
4750 if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
4751 for (var i in name) {
4752 if (name.hasOwnProperty(i)) {
4753 css(el, i, name[i]);
4754 }
4755 }
4756 return undefined;
4757 }
4758 if (typeof value !== 'undefined') {
4759 if (typeof value === 'number') {
4760 value = value + 'px';
4761 }
4762 el.style[name] = value;
4763 return undefined;
4764 }
4765 return getComputedStyleX(el, name);
4766 }
4767
4768 function getClientPosition(elem) {
4769 var box = void 0;
4770 var x = void 0;
4771 var y = void 0;
4772 var doc = elem.ownerDocument;
4773 var body = doc.body;
4774 var docElem = doc && doc.documentElement;
4775 // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式
4776 box = elem.getBoundingClientRect();
4777
4778 // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop
4779 // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确
4780 // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin
4781
4782 x = box.left;
4783 y = box.top;
4784
4785 // In IE, most of the time, 2 extra pixels are added to the top and left
4786 // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and
4787 // IE6 standards mode, this border can be overridden by setting the
4788 // document element's border to zero -- thus, we cannot rely on the
4789 // offset always being 2 pixels.
4790
4791 // In quirks mode, the offset can be determined by querying the body's
4792 // clientLeft/clientTop, but in standards mode, it is found by querying
4793 // the document element's clientLeft/clientTop. Since we already called
4794 // getClientBoundingRect we have already forced a reflow, so it is not
4795 // too expensive just to query them all.
4796
4797 // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的
4798 // 窗口边框标准是设 documentElement ,quirks 时设置 body
4799 // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去
4800 // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置
4801 // 标准 ie 下 docElem.clientTop 就是 border-top
4802 // ie7 html 即窗口边框改变不了。永远为 2
4803 // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0
4804
4805 x -= docElem.clientLeft || body.clientLeft || 0;
4806 y -= docElem.clientTop || body.clientTop || 0;
4807
4808 return {
4809 left: x,
4810 top: y
4811 };
4812 }
4813
4814 function getScroll(w, top) {
4815 var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];
4816 var method = 'scroll' + (top ? 'Top' : 'Left');
4817 if (typeof ret !== 'number') {
4818 var d = w.document;
4819 // ie6,7,8 standard mode
4820 ret = d.documentElement[method];
4821 if (typeof ret !== 'number') {
4822 // quirks mode
4823 ret = d.body[method];
4824 }
4825 }
4826 return ret;
4827 }
4828
4829 function getScrollLeft(w) {
4830 return getScroll(w);
4831 }
4832
4833 function getScrollTop(w) {
4834 return getScroll(w, true);
4835 }
4836
4837 function getOffset(el) {
4838 var pos = getClientPosition(el);
4839 var doc = el.ownerDocument;
4840 var w = doc.defaultView || doc.parentWindow;
4841 pos.left += getScrollLeft(w);
4842 pos.top += getScrollTop(w);
4843 return pos;
4844 }
4845
4846 /**
4847 * A crude way of determining if an object is a window
4848 * @member util
4849 */
4850 function isWindow(obj) {
4851 // must use == for ie8
4852 /* eslint eqeqeq:0 */
4853 return obj !== null && obj !== undefined && obj == obj.window;
4854 }
4855
4856 function getDocument(node) {
4857 if (isWindow(node)) {
4858 return node.document;
4859 }
4860 if (node.nodeType === 9) {
4861 return node;
4862 }
4863 return node.ownerDocument;
4864 }
4865
4866 function _getComputedStyle(elem, name, cs) {
4867 var computedStyle = cs;
4868 var val = '';
4869 var d = getDocument(elem);
4870 computedStyle = computedStyle || d.defaultView.getComputedStyle(elem, null);
4871
4872 // https://github.com/kissyteam/kissy/issues/61
4873 if (computedStyle) {
4874 val = computedStyle.getPropertyValue(name) || computedStyle[name];
4875 }
4876
4877 return val;
4878 }
4879
4880 var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i');
4881 var RE_POS = /^(top|right|bottom|left)$/;
4882 var CURRENT_STYLE = 'currentStyle';
4883 var RUNTIME_STYLE = 'runtimeStyle';
4884 var LEFT = 'left';
4885 var PX = 'px';
4886
4887 function _getComputedStyleIE(elem, name) {
4888 // currentStyle maybe null
4889 // http://msdn.microsoft.com/en-us/library/ms535231.aspx
4890 var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];
4891
4892 // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值
4893 // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19
4894 // 在 ie 下不对,需要直接用 offset 方式
4895 // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了
4896
4897 // From the awesome hack by Dean Edwards
4898 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
4899 // If we're not dealing with a regular pixel number
4900 // but a number that has a weird ending, we need to convert it to pixels
4901 // exclude left right for relativity
4902 if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {
4903 // Remember the original values
4904 var style = elem.style;
4905 var left = style[LEFT];
4906 var rsLeft = elem[RUNTIME_STYLE][LEFT];
4907
4908 // prevent flashing of content
4909 elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];
4910
4911 // Put in the new values to get a computed value out
4912 style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;
4913 ret = style.pixelLeft + PX;
4914
4915 // Revert the changed values
4916 style[LEFT] = left;
4917
4918 elem[RUNTIME_STYLE][LEFT] = rsLeft;
4919 }
4920 return ret === '' ? 'auto' : ret;
4921 }
4922
4923 if (typeof window !== 'undefined') {
4924 getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;
4925 }
4926
4927 function getOffsetDirection(dir, option) {
4928 if (dir === 'left') {
4929 return option.useCssRight ? 'right' : dir;
4930 }
4931 return option.useCssBottom ? 'bottom' : dir;
4932 }
4933
4934 function oppositeOffsetDirection(dir) {
4935 if (dir === 'left') {
4936 return 'right';
4937 } else if (dir === 'right') {
4938 return 'left';
4939 } else if (dir === 'top') {
4940 return 'bottom';
4941 } else if (dir === 'bottom') {
4942 return 'top';
4943 }
4944 }
4945
4946 // 设置 elem 相对 elem.ownerDocument 的坐标
4947 function setLeftTop(elem, offset, option) {
4948 // set position first, in-case top/left are set even on static elem
4949 if (css(elem, 'position') === 'static') {
4950 elem.style.position = 'relative';
4951 }
4952 var presetH = -999;
4953 var presetV = -999;
4954 var horizontalProperty = getOffsetDirection('left', option);
4955 var verticalProperty = getOffsetDirection('top', option);
4956 var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty);
4957 var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty);
4958
4959 if (horizontalProperty !== 'left') {
4960 presetH = 999;
4961 }
4962
4963 if (verticalProperty !== 'top') {
4964 presetV = 999;
4965 }
4966 var originalTransition = '';
4967 var originalOffset = getOffset(elem);
4968 if ('left' in offset || 'top' in offset) {
4969 originalTransition = (0, _propertyUtils.getTransitionProperty)(elem) || '';
4970 (0, _propertyUtils.setTransitionProperty)(elem, 'none');
4971 }
4972 if ('left' in offset) {
4973 elem.style[oppositeHorizontalProperty] = '';
4974 elem.style[horizontalProperty] = presetH + 'px';
4975 }
4976 if ('top' in offset) {
4977 elem.style[oppositeVerticalProperty] = '';
4978 elem.style[verticalProperty] = presetV + 'px';
4979 }
4980 // force relayout
4981 forceRelayout(elem);
4982 var old = getOffset(elem);
4983 var originalStyle = {};
4984 for (var key in offset) {
4985 if (offset.hasOwnProperty(key)) {
4986 var dir = getOffsetDirection(key, option);
4987 var preset = key === 'left' ? presetH : presetV;
4988 var off = originalOffset[key] - old[key];
4989 if (dir === key) {
4990 originalStyle[dir] = preset + off;
4991 } else {
4992 originalStyle[dir] = preset - off;
4993 }
4994 }
4995 }
4996 css(elem, originalStyle);
4997 // force relayout
4998 forceRelayout(elem);
4999 if ('left' in offset || 'top' in offset) {
5000 (0, _propertyUtils.setTransitionProperty)(elem, originalTransition);
5001 }
5002 var ret = {};
5003 for (var _key in offset) {
5004 if (offset.hasOwnProperty(_key)) {
5005 var _dir = getOffsetDirection(_key, option);
5006 var _off = offset[_key] - originalOffset[_key];
5007 if (_key === _dir) {
5008 ret[_dir] = originalStyle[_dir] + _off;
5009 } else {
5010 ret[_dir] = originalStyle[_dir] - _off;
5011 }
5012 }
5013 }
5014 css(elem, ret);
5015 }
5016
5017 function setTransform(elem, offset) {
5018 var originalOffset = getOffset(elem);
5019 var originalXY = (0, _propertyUtils.getTransformXY)(elem);
5020 var resultXY = { x: originalXY.x, y: originalXY.y };
5021 if ('left' in offset) {
5022 resultXY.x = originalXY.x + offset.left - originalOffset.left;
5023 }
5024 if ('top' in offset) {
5025 resultXY.y = originalXY.y + offset.top - originalOffset.top;
5026 }
5027 (0, _propertyUtils.setTransformXY)(elem, resultXY);
5028 }
5029
5030 function setOffset(elem, offset, option) {
5031 if (option.ignoreShake) {
5032 var oriOffset = getOffset(elem);
5033
5034 var oLeft = oriOffset.left.toFixed(0);
5035 var oTop = oriOffset.top.toFixed(0);
5036 var tLeft = offset.left.toFixed(0);
5037 var tTop = offset.top.toFixed(0);
5038
5039 if (oLeft === tLeft && oTop === tTop) {
5040 return;
5041 }
5042 }
5043
5044 if (option.useCssRight || option.useCssBottom) {
5045 setLeftTop(elem, offset, option);
5046 } else if (option.useCssTransform && (0, _propertyUtils.getTransformName)() in document.body.style) {
5047 setTransform(elem, offset, option);
5048 } else {
5049 setLeftTop(elem, offset, option);
5050 }
5051 }
5052
5053 function each(arr, fn) {
5054 for (var i = 0; i < arr.length; i++) {
5055 fn(arr[i]);
5056 }
5057 }
5058
5059 function isBorderBoxFn(elem) {
5060 return getComputedStyleX(elem, 'boxSizing') === 'border-box';
5061 }
5062
5063 var BOX_MODELS = ['margin', 'border', 'padding'];
5064 var CONTENT_INDEX = -1;
5065 var PADDING_INDEX = 2;
5066 var BORDER_INDEX = 1;
5067 var MARGIN_INDEX = 0;
5068
5069 function swap(elem, options, callback) {
5070 var old = {};
5071 var style = elem.style;
5072 var name = void 0;
5073
5074 // Remember the old values, and insert the new ones
5075 for (name in options) {
5076 if (options.hasOwnProperty(name)) {
5077 old[name] = style[name];
5078 style[name] = options[name];
5079 }
5080 }
5081
5082 callback.call(elem);
5083
5084 // Revert the old values
5085 for (name in options) {
5086 if (options.hasOwnProperty(name)) {
5087 style[name] = old[name];
5088 }
5089 }
5090 }
5091
5092 function getPBMWidth(elem, props, which) {
5093 var value = 0;
5094 var prop = void 0;
5095 var j = void 0;
5096 var i = void 0;
5097 for (j = 0; j < props.length; j++) {
5098 prop = props[j];
5099 if (prop) {
5100 for (i = 0; i < which.length; i++) {
5101 var cssProp = void 0;
5102 if (prop === 'border') {
5103 cssProp = '' + prop + which[i] + 'Width';
5104 } else {
5105 cssProp = prop + which[i];
5106 }
5107 value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;
5108 }
5109 }
5110 }
5111 return value;
5112 }
5113
5114 var domUtils = {};
5115
5116 each(['Width', 'Height'], function (name) {
5117 domUtils['doc' + name] = function (refWin) {
5118 var d = refWin.document;
5119 return Math.max(
5120 // firefox chrome documentElement.scrollHeight< body.scrollHeight
5121 // ie standard mode : documentElement.scrollHeight> body.scrollHeight
5122 d.documentElement['scroll' + name],
5123 // quirks : documentElement.scrollHeight 最大等于可视窗口多一点?
5124 d.body['scroll' + name], domUtils['viewport' + name](d));
5125 };
5126
5127 domUtils['viewport' + name] = function (win) {
5128 // pc browser includes scrollbar in window.innerWidth
5129 var prop = 'client' + name;
5130 var doc = win.document;
5131 var body = doc.body;
5132 var documentElement = doc.documentElement;
5133 var documentElementProp = documentElement[prop];
5134 // 标准模式取 documentElement
5135 // backcompat 取 body
5136 return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;
5137 };
5138 });
5139
5140 /*
5141 得到元素的大小信息
5142 @param elem
5143 @param name
5144 @param {String} [extra] 'padding' : (css width) + padding
5145 'border' : (css width) + padding + border
5146 'margin' : (css width) + padding + border + margin
5147 */
5148 function getWH(elem, name, ex) {
5149 var extra = ex;
5150 if (isWindow(elem)) {
5151 return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);
5152 } else if (elem.nodeType === 9) {
5153 return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);
5154 }
5155 var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
5156 var borderBoxValue = name === 'width' ? elem.getBoundingClientRect().width : elem.getBoundingClientRect().height;
5157 var computedStyle = getComputedStyleX(elem);
5158 var isBorderBox = isBorderBoxFn(elem, computedStyle);
5159 var cssBoxValue = 0;
5160 if (borderBoxValue === null || borderBoxValue === undefined || borderBoxValue <= 0) {
5161 borderBoxValue = undefined;
5162 // Fall back to computed then un computed css if necessary
5163 cssBoxValue = getComputedStyleX(elem, name);
5164 if (cssBoxValue === null || cssBoxValue === undefined || Number(cssBoxValue) < 0) {
5165 cssBoxValue = elem.style[name] || 0;
5166 }
5167 // Normalize '', auto, and prepare for extra
5168 cssBoxValue = parseFloat(cssBoxValue) || 0;
5169 }
5170 if (extra === undefined) {
5171 extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;
5172 }
5173 var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;
5174 var val = borderBoxValue || cssBoxValue;
5175 if (extra === CONTENT_INDEX) {
5176 if (borderBoxValueOrIsBorderBox) {
5177 return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);
5178 }
5179 return cssBoxValue;
5180 } else if (borderBoxValueOrIsBorderBox) {
5181 if (extra === BORDER_INDEX) {
5182 return val;
5183 }
5184 return val + (extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle));
5185 }
5186 return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);
5187 }
5188
5189 var cssShow = {
5190 position: 'absolute',
5191 visibility: 'hidden',
5192 display: 'block'
5193 };
5194
5195 // fix #119 : https://github.com/kissyteam/kissy/issues/119
5196 function getWHIgnoreDisplay() {
5197 for (var _len = arguments.length, args = Array(_len), _key2 = 0; _key2 < _len; _key2++) {
5198 args[_key2] = arguments[_key2];
5199 }
5200
5201 var val = void 0;
5202 var elem = args[0];
5203 // in case elem is window
5204 // elem.offsetWidth === undefined
5205 if (elem.offsetWidth !== 0) {
5206 val = getWH.apply(undefined, args);
5207 } else {
5208 swap(elem, cssShow, function () {
5209 val = getWH.apply(undefined, args);
5210 });
5211 }
5212 return val;
5213 }
5214
5215 each(['width', 'height'], function (name) {
5216 var first = name.charAt(0).toUpperCase() + name.slice(1);
5217 domUtils['outer' + first] = function (el, includeMargin) {
5218 return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);
5219 };
5220 var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
5221
5222 domUtils[name] = function (elem, v) {
5223 var val = v;
5224 if (val !== undefined) {
5225 if (elem) {
5226 var computedStyle = getComputedStyleX(elem);
5227 var isBorderBox = isBorderBoxFn(elem);
5228 if (isBorderBox) {
5229 val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);
5230 }
5231 return css(elem, name, val);
5232 }
5233 return undefined;
5234 }
5235 return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);
5236 };
5237 });
5238
5239 function mix(to, from) {
5240 for (var i in from) {
5241 if (from.hasOwnProperty(i)) {
5242 to[i] = from[i];
5243 }
5244 }
5245 return to;
5246 }
5247
5248 var utils = {
5249 getWindow: function getWindow(node) {
5250 if (node && node.document && node.setTimeout) {
5251 return node;
5252 }
5253 var doc = node.ownerDocument || node;
5254 return doc.defaultView || doc.parentWindow;
5255 },
5256
5257 getDocument: getDocument,
5258 offset: function offset(el, value, option) {
5259 if (typeof value !== 'undefined') {
5260 setOffset(el, value, option || {});
5261 } else {
5262 return getOffset(el);
5263 }
5264 },
5265
5266 isWindow: isWindow,
5267 each: each,
5268 css: css,
5269 clone: function clone(obj) {
5270 var i = void 0;
5271 var ret = {};
5272 for (i in obj) {
5273 if (obj.hasOwnProperty(i)) {
5274 ret[i] = obj[i];
5275 }
5276 }
5277 var overflow = obj.overflow;
5278 if (overflow) {
5279 for (i in obj) {
5280 if (obj.hasOwnProperty(i)) {
5281 ret.overflow[i] = obj.overflow[i];
5282 }
5283 }
5284 }
5285 return ret;
5286 },
5287
5288 mix: mix,
5289 getWindowScrollLeft: function getWindowScrollLeft(w) {
5290 return getScrollLeft(w);
5291 },
5292 getWindowScrollTop: function getWindowScrollTop(w) {
5293 return getScrollTop(w);
5294 },
5295 merge: function merge() {
5296 var ret = {};
5297
5298 for (var _len2 = arguments.length, args = Array(_len2), _key3 = 0; _key3 < _len2; _key3++) {
5299 args[_key3] = arguments[_key3];
5300 }
5301
5302 for (var i = 0; i < args.length; i++) {
5303 utils.mix(ret, args[i]);
5304 }
5305 return ret;
5306 },
5307
5308 viewportWidth: 0,
5309 viewportHeight: 0
5310 };
5311
5312 mix(utils, domUtils);
5313
5314 exports['default'] = utils;
5315 module.exports = exports['default'];
5316
5317/***/ }),
5318/* 55 */
5319/***/ (function(module, exports) {
5320
5321 'use strict';
5322
5323 Object.defineProperty(exports, "__esModule", {
5324 value: true
5325 });
5326 exports.getTransformName = getTransformName;
5327 exports.setTransitionProperty = setTransitionProperty;
5328 exports.getTransitionProperty = getTransitionProperty;
5329 exports.getTransformXY = getTransformXY;
5330 exports.setTransformXY = setTransformXY;
5331 var vendorPrefix = void 0;
5332
5333 var jsCssMap = {
5334 Webkit: '-webkit-',
5335 Moz: '-moz-',
5336 // IE did it wrong again ...
5337 ms: '-ms-',
5338 O: '-o-'
5339 };
5340
5341 function getVendorPrefix() {
5342 if (vendorPrefix !== undefined) {
5343 return vendorPrefix;
5344 }
5345 vendorPrefix = '';
5346 var style = document.createElement('p').style;
5347 var testProp = 'Transform';
5348 for (var key in jsCssMap) {
5349 if (key + testProp in style) {
5350 vendorPrefix = key;
5351 }
5352 }
5353 return vendorPrefix;
5354 }
5355
5356 function getTransitionName() {
5357 return getVendorPrefix() ? getVendorPrefix() + 'TransitionProperty' : 'transitionProperty';
5358 }
5359
5360 function getTransformName() {
5361 return getVendorPrefix() ? getVendorPrefix() + 'Transform' : 'transform';
5362 }
5363
5364 function setTransitionProperty(node, value) {
5365 var name = getTransitionName();
5366 if (name) {
5367 node.style[name] = value;
5368 if (name !== 'transitionProperty') {
5369 node.style.transitionProperty = value;
5370 }
5371 }
5372 }
5373
5374 function setTransform(node, value) {
5375 var name = getTransformName();
5376 if (name) {
5377 node.style[name] = value;
5378 if (name !== 'transform') {
5379 node.style.transform = value;
5380 }
5381 }
5382 }
5383
5384 function getTransitionProperty(node) {
5385 return node.style.transitionProperty || node.style[getTransitionName()];
5386 }
5387
5388 function getTransformXY(node) {
5389 var style = window.getComputedStyle(node, null);
5390 var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());
5391 if (transform && transform !== 'none') {
5392 var matrix = transform.replace(/[^0-9\-.,]/g, '').split(',');
5393 return { x: parseFloat(matrix[12] || matrix[4], 0), y: parseFloat(matrix[13] || matrix[5], 0) };
5394 }
5395 return {
5396 x: 0,
5397 y: 0
5398 };
5399 }
5400
5401 var matrix2d = /matrix\((.*)\)/;
5402 var matrix3d = /matrix3d\((.*)\)/;
5403
5404 function setTransformXY(node, xy) {
5405 var style = window.getComputedStyle(node, null);
5406 var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());
5407 if (transform && transform !== 'none') {
5408 var arr = void 0;
5409 var match2d = transform.match(matrix2d);
5410 if (match2d) {
5411 match2d = match2d[1];
5412 arr = match2d.split(',').map(function (item) {
5413 return parseFloat(item, 10);
5414 });
5415 arr[4] = xy.x;
5416 arr[5] = xy.y;
5417 setTransform(node, 'matrix(' + arr.join(',') + ')');
5418 } else {
5419 var match3d = transform.match(matrix3d)[1];
5420 arr = match3d.split(',').map(function (item) {
5421 return parseFloat(item, 10);
5422 });
5423 arr[12] = xy.x;
5424 arr[13] = xy.y;
5425 setTransform(node, 'matrix3d(' + arr.join(',') + ')');
5426 }
5427 } else {
5428 setTransform(node, 'translateX(' + xy.x + 'px) translateY(' + xy.y + 'px) translateZ(0)');
5429 }
5430 }
5431
5432/***/ }),
5433/* 56 */
5434/***/ (function(module, exports, __webpack_require__) {
5435
5436 'use strict';
5437
5438 Object.defineProperty(exports, "__esModule", {
5439 value: true
5440 });
5441
5442 var _utils = __webpack_require__(54);
5443
5444 var _utils2 = _interopRequireDefault(_utils);
5445
5446 var _getOffsetParent = __webpack_require__(57);
5447
5448 var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent);
5449
5450 var _isAncestorFixed = __webpack_require__(58);
5451
5452 var _isAncestorFixed2 = _interopRequireDefault(_isAncestorFixed);
5453
5454 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
5455
5456 /**
5457 * 获得元素的显示部分的区域
5458 */
5459 function getVisibleRectForElement(element) {
5460 var visibleRect = {
5461 left: 0,
5462 right: Infinity,
5463 top: 0,
5464 bottom: Infinity
5465 };
5466 var el = (0, _getOffsetParent2['default'])(element);
5467 var doc = _utils2['default'].getDocument(element);
5468 var win = doc.defaultView || doc.parentWindow;
5469 var body = doc.body;
5470 var documentElement = doc.documentElement;
5471
5472 // Determine the size of the visible rect by climbing the dom accounting for
5473 // all scrollable containers.
5474 while (el) {
5475 // clientWidth is zero for inline block elements in ie.
5476 if ((navigator.userAgent.indexOf('MSIE') === -1 || el.clientWidth !== 0) &&
5477 // body may have overflow set on it, yet we still get the entire
5478 // viewport. In some browsers, el.offsetParent may be
5479 // document.documentElement, so check for that too.
5480 el !== body && el !== documentElement && _utils2['default'].css(el, 'overflow') !== 'visible') {
5481 var pos = _utils2['default'].offset(el);
5482 // add border
5483 pos.left += el.clientLeft;
5484 pos.top += el.clientTop;
5485 visibleRect.top = Math.max(visibleRect.top, pos.top);
5486 visibleRect.right = Math.min(visibleRect.right,
5487 // consider area without scrollBar
5488 pos.left + el.clientWidth);
5489 visibleRect.bottom = Math.min(visibleRect.bottom, pos.top + el.clientHeight);
5490 visibleRect.left = Math.max(visibleRect.left, pos.left);
5491 } else if (el === body || el === documentElement) {
5492 break;
5493 }
5494 el = (0, _getOffsetParent2['default'])(el);
5495 }
5496
5497 // Set element position to fixed
5498 // make sure absolute element itself don't affect it's visible area
5499 // https://github.com/ant-design/ant-design/issues/7601
5500 var originalPosition = null;
5501 if (!_utils2['default'].isWindow(element) && element.nodeType !== 9) {
5502 originalPosition = element.style.position;
5503 var position = _utils2['default'].css(element, 'position');
5504 if (position === 'absolute') {
5505 element.style.position = 'fixed';
5506 }
5507 }
5508
5509 var scrollX = _utils2['default'].getWindowScrollLeft(win);
5510 var scrollY = _utils2['default'].getWindowScrollTop(win);
5511 var viewportWidth = _utils2['default'].viewportWidth(win);
5512 var viewportHeight = _utils2['default'].viewportHeight(win);
5513 var documentWidth = documentElement.scrollWidth;
5514 var documentHeight = documentElement.scrollHeight;
5515
5516 // Reset element position after calculate the visible area
5517 if (element.style) {
5518 element.style.position = originalPosition;
5519 }
5520
5521 if ((0, _isAncestorFixed2['default'])(element)) {
5522 // Clip by viewport's size.
5523 visibleRect.left = Math.max(visibleRect.left, scrollX);
5524 visibleRect.top = Math.max(visibleRect.top, scrollY);
5525 visibleRect.right = Math.min(visibleRect.right, scrollX + viewportWidth);
5526 visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + viewportHeight);
5527 } else {
5528 // Clip by document's size.
5529 var maxVisibleWidth = Math.max(documentWidth, scrollX + viewportWidth);
5530 visibleRect.right = Math.min(visibleRect.right, maxVisibleWidth);
5531
5532 var maxVisibleHeight = Math.max(documentHeight, scrollY + viewportHeight);
5533 visibleRect.bottom = Math.min(visibleRect.bottom, maxVisibleHeight);
5534 }
5535
5536 return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null;
5537 }
5538
5539 exports['default'] = getVisibleRectForElement;
5540 module.exports = exports['default'];
5541
5542/***/ }),
5543/* 57 */
5544/***/ (function(module, exports, __webpack_require__) {
5545
5546 'use strict';
5547
5548 Object.defineProperty(exports, "__esModule", {
5549 value: true
5550 });
5551
5552 var _utils = __webpack_require__(54);
5553
5554 var _utils2 = _interopRequireDefault(_utils);
5555
5556 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
5557
5558 /**
5559 * 得到会导致元素显示不全的祖先元素
5560 */
5561
5562 function getOffsetParent(element) {
5563 if (_utils2['default'].isWindow(element) || element.nodeType === 9) {
5564 return null;
5565 }
5566 // ie 这个也不是完全可行
5567 /*
5568 <div style="width: 50px;height: 100px;overflow: hidden">
5569 <div style="width: 50px;height: 100px;position: relative;" id="d6">
5570 元素 6 高 100px 宽 50px<br/>
5571 </div>
5572 </div>
5573 */
5574 // element.offsetParent does the right thing in ie7 and below. Return parent with layout!
5575 // In other browsers it only includes elements with position absolute, relative or
5576 // fixed, not elements with overflow set to auto or scroll.
5577 // if (UA.ie && ieMode < 8) {
5578 // return element.offsetParent;
5579 // }
5580 // 统一的 offsetParent 方法
5581 var doc = _utils2['default'].getDocument(element);
5582 var body = doc.body;
5583 var parent = void 0;
5584 var positionStyle = _utils2['default'].css(element, 'position');
5585 var skipStatic = positionStyle === 'fixed' || positionStyle === 'absolute';
5586
5587 if (!skipStatic) {
5588 return element.nodeName.toLowerCase() === 'html' ? null : element.parentNode;
5589 }
5590
5591 for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) {
5592 positionStyle = _utils2['default'].css(parent, 'position');
5593 if (positionStyle !== 'static') {
5594 return parent;
5595 }
5596 }
5597 return null;
5598 }
5599
5600 exports['default'] = getOffsetParent;
5601 module.exports = exports['default'];
5602
5603/***/ }),
5604/* 58 */
5605/***/ (function(module, exports, __webpack_require__) {
5606
5607 'use strict';
5608
5609 Object.defineProperty(exports, "__esModule", {
5610 value: true
5611 });
5612 exports['default'] = isAncestorFixed;
5613
5614 var _utils = __webpack_require__(54);
5615
5616 var _utils2 = _interopRequireDefault(_utils);
5617
5618 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
5619
5620 function isAncestorFixed(element) {
5621 if (_utils2['default'].isWindow(element) || element.nodeType === 9) {
5622 return false;
5623 }
5624
5625 var doc = _utils2['default'].getDocument(element);
5626 var body = doc.body;
5627 var parent = null;
5628 for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) {
5629 var positionStyle = _utils2['default'].css(parent, 'position');
5630 if (positionStyle === 'fixed') {
5631 return true;
5632 }
5633 }
5634 return false;
5635 }
5636 module.exports = exports['default'];
5637
5638/***/ }),
5639/* 59 */
5640/***/ (function(module, exports, __webpack_require__) {
5641
5642 'use strict';
5643
5644 Object.defineProperty(exports, "__esModule", {
5645 value: true
5646 });
5647
5648 var _utils = __webpack_require__(54);
5649
5650 var _utils2 = _interopRequireDefault(_utils);
5651
5652 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
5653
5654 function adjustForViewport(elFuturePos, elRegion, visibleRect, overflow) {
5655 var pos = _utils2['default'].clone(elFuturePos);
5656 var size = {
5657 width: elRegion.width,
5658 height: elRegion.height
5659 };
5660
5661 if (overflow.adjustX && pos.left < visibleRect.left) {
5662 pos.left = visibleRect.left;
5663 }
5664
5665 // Left edge inside and right edge outside viewport, try to resize it.
5666 if (overflow.resizeWidth && pos.left >= visibleRect.left && pos.left + size.width > visibleRect.right) {
5667 size.width -= pos.left + size.width - visibleRect.right;
5668 }
5669
5670 // Right edge outside viewport, try to move it.
5671 if (overflow.adjustX && pos.left + size.width > visibleRect.right) {
5672 // 保证左边界和可视区域左边界对齐
5673 pos.left = Math.max(visibleRect.right - size.width, visibleRect.left);
5674 }
5675
5676 // Top edge outside viewport, try to move it.
5677 if (overflow.adjustY && pos.top < visibleRect.top) {
5678 pos.top = visibleRect.top;
5679 }
5680
5681 // Top edge inside and bottom edge outside viewport, try to resize it.
5682 if (overflow.resizeHeight && pos.top >= visibleRect.top && pos.top + size.height > visibleRect.bottom) {
5683 size.height -= pos.top + size.height - visibleRect.bottom;
5684 }
5685
5686 // Bottom edge outside viewport, try to move it.
5687 if (overflow.adjustY && pos.top + size.height > visibleRect.bottom) {
5688 // 保证上边界和可视区域上边界对齐
5689 pos.top = Math.max(visibleRect.bottom - size.height, visibleRect.top);
5690 }
5691
5692 return _utils2['default'].mix(pos, size);
5693 }
5694
5695 exports['default'] = adjustForViewport;
5696 module.exports = exports['default'];
5697
5698/***/ }),
5699/* 60 */
5700/***/ (function(module, exports, __webpack_require__) {
5701
5702 'use strict';
5703
5704 Object.defineProperty(exports, "__esModule", {
5705 value: true
5706 });
5707
5708 var _utils = __webpack_require__(54);
5709
5710 var _utils2 = _interopRequireDefault(_utils);
5711
5712 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
5713
5714 function getRegion(node) {
5715 var offset = void 0;
5716 var w = void 0;
5717 var h = void 0;
5718 if (!_utils2['default'].isWindow(node) && node.nodeType !== 9) {
5719 offset = _utils2['default'].offset(node);
5720 w = _utils2['default'].outerWidth(node);
5721 h = _utils2['default'].outerHeight(node);
5722 } else {
5723 var win = _utils2['default'].getWindow(node);
5724 offset = {
5725 left: _utils2['default'].getWindowScrollLeft(win),
5726 top: _utils2['default'].getWindowScrollTop(win)
5727 };
5728 w = _utils2['default'].viewportWidth(win);
5729 h = _utils2['default'].viewportHeight(win);
5730 }
5731 offset.width = w;
5732 offset.height = h;
5733 return offset;
5734 }
5735
5736 exports['default'] = getRegion;
5737 module.exports = exports['default'];
5738
5739/***/ }),
5740/* 61 */
5741/***/ (function(module, exports, __webpack_require__) {
5742
5743 'use strict';
5744
5745 Object.defineProperty(exports, "__esModule", {
5746 value: true
5747 });
5748
5749 var _getAlignOffset = __webpack_require__(62);
5750
5751 var _getAlignOffset2 = _interopRequireDefault(_getAlignOffset);
5752
5753 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
5754
5755 function getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) {
5756 var p1 = (0, _getAlignOffset2['default'])(refNodeRegion, points[1]);
5757 var p2 = (0, _getAlignOffset2['default'])(elRegion, points[0]);
5758 var diff = [p2.left - p1.left, p2.top - p1.top];
5759
5760 return {
5761 left: elRegion.left - diff[0] + offset[0] - targetOffset[0],
5762 top: elRegion.top - diff[1] + offset[1] - targetOffset[1]
5763 };
5764 }
5765
5766 exports['default'] = getElFuturePos;
5767 module.exports = exports['default'];
5768
5769/***/ }),
5770/* 62 */
5771/***/ (function(module, exports) {
5772
5773 'use strict';
5774
5775 Object.defineProperty(exports, "__esModule", {
5776 value: true
5777 });
5778 /**
5779 * 获取 node 上的 align 对齐点 相对于页面的坐标
5780 */
5781
5782 function getAlignOffset(region, align) {
5783 var V = align.charAt(0);
5784 var H = align.charAt(1);
5785 var w = region.width;
5786 var h = region.height;
5787
5788 var x = region.left;
5789 var y = region.top;
5790
5791 if (V === 'c') {
5792 y += h / 2;
5793 } else if (V === 'b') {
5794 y += h;
5795 }
5796
5797 if (H === 'c') {
5798 x += w / 2;
5799 } else if (H === 'r') {
5800 x += w;
5801 }
5802
5803 return {
5804 left: x,
5805 top: y
5806 };
5807 }
5808
5809 exports['default'] = getAlignOffset;
5810 module.exports = exports['default'];
5811
5812/***/ }),
5813/* 63 */
5814/***/ (function(module, exports, __webpack_require__) {
5815
5816 'use strict';
5817
5818 Object.defineProperty(exports, "__esModule", {
5819 value: true
5820 });
5821
5822 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; };
5823
5824 var _utils = __webpack_require__(54);
5825
5826 var _utils2 = _interopRequireDefault(_utils);
5827
5828 var _align = __webpack_require__(53);
5829
5830 var _align2 = _interopRequireDefault(_align);
5831
5832 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
5833
5834 /**
5835 * `tgtPoint`: { pageX, pageY } or { clientX, clientY }.
5836 * If client position provided, will internal convert to page position.
5837 */
5838
5839 function alignPoint(el, tgtPoint, align) {
5840 var pageX = void 0;
5841 var pageY = void 0;
5842
5843 var doc = _utils2['default'].getDocument(el);
5844 var win = doc.defaultView || doc.parentWindow;
5845
5846 var scrollX = _utils2['default'].getWindowScrollLeft(win);
5847 var scrollY = _utils2['default'].getWindowScrollTop(win);
5848 var viewportWidth = _utils2['default'].viewportWidth(win);
5849 var viewportHeight = _utils2['default'].viewportHeight(win);
5850
5851 if ('pageX' in tgtPoint) {
5852 pageX = tgtPoint.pageX;
5853 } else {
5854 pageX = scrollX + tgtPoint.clientX;
5855 }
5856
5857 if ('pageY' in tgtPoint) {
5858 pageY = tgtPoint.pageY;
5859 } else {
5860 pageY = scrollY + tgtPoint.clientY;
5861 }
5862
5863 var tgtRegion = {
5864 left: pageX,
5865 top: pageY,
5866 width: 0,
5867 height: 0
5868 };
5869
5870 var pointInView = pageX >= 0 && pageX <= scrollX + viewportWidth && pageY >= 0 && pageY <= scrollY + viewportHeight;
5871
5872 // Provide default target point
5873 var points = [align.points[0], 'cc'];
5874
5875 return (0, _align2['default'])(el, tgtRegion, _extends({}, align, { points: points }), pointInView);
5876 }
5877
5878 exports['default'] = alignPoint;
5879 module.exports = exports['default'];
5880
5881/***/ }),
5882/* 64 */
5883/***/ (function(module, exports, __webpack_require__) {
5884
5885 'use strict';
5886
5887 Object.defineProperty(exports, "__esModule", {
5888 value: true
5889 });
5890
5891 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; };
5892
5893 var _classnames = __webpack_require__(3);
5894
5895 var _classnames2 = _interopRequireDefault(_classnames);
5896
5897 var _react = __webpack_require__(4);
5898
5899 var _react2 = _interopRequireDefault(_react);
5900
5901 var _propTypes = __webpack_require__(5);
5902
5903 var _propTypes2 = _interopRequireDefault(_propTypes);
5904
5905 var _Transition = __webpack_require__(11);
5906
5907 var _Transition2 = _interopRequireDefault(_Transition);
5908
5909 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
5910
5911 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; }
5912
5913 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5914
5915 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; }
5916
5917 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); }
5918
5919 var propTypes = {
5920 /**
5921 * Show the component; triggers the fade in or fade out animation
5922 */
5923 "in": _propTypes2["default"].bool,
5924
5925 /**
5926 * Unmount the component (remove it from the DOM) when it is faded out
5927 */
5928 unmountOnExit: _propTypes2["default"].bool,
5929
5930 /**
5931 * Run the fade in animation when the component mounts, if it is initially
5932 * shown
5933 */
5934 transitionAppear: _propTypes2["default"].bool,
5935
5936 /**
5937 * Duration of the fade animation in milliseconds, to ensure that finishing
5938 * callbacks are fired even if the original browser transition end events are
5939 * canceled
5940 */
5941 timeout: _propTypes2["default"].number,
5942
5943 /**
5944 * Callback fired before the component fades in
5945 */
5946 onEnter: _propTypes2["default"].func,
5947 /**
5948 * Callback fired after the component starts to fade in
5949 */
5950 onEntering: _propTypes2["default"].func,
5951 /**
5952 * Callback fired after the has component faded in
5953 */
5954 onEntered: _propTypes2["default"].func,
5955 /**
5956 * Callback fired before the component fades out
5957 */
5958 onExit: _propTypes2["default"].func,
5959 /**
5960 * Callback fired after the component starts to fade out
5961 */
5962 onExiting: _propTypes2["default"].func,
5963 /**
5964 * Callback fired after the component has faded out
5965 */
5966 onExited: _propTypes2["default"].func
5967 };
5968
5969 var defaultProps = {
5970 "in": false,
5971 timeout: 300,
5972 unmountOnExit: false,
5973 transitionAppear: false
5974 };
5975
5976 var Fade = function (_React$Component) {
5977 _inherits(Fade, _React$Component);
5978
5979 function Fade() {
5980 _classCallCheck(this, Fade);
5981
5982 return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
5983 }
5984
5985 Fade.prototype.render = function render() {
5986 return _react2["default"].createElement(_Transition2["default"], _extends({}, this.props, {
5987 className: (0, _classnames2["default"])(this.props.className, 'fade'),
5988 enteredClassName: 'in',
5989 enteringClassName: 'in'
5990 }));
5991 };
5992
5993 return Fade;
5994 }(_react2["default"].Component);
5995
5996 Fade.propTypes = propTypes;
5997 Fade.defaultProps = defaultProps;
5998
5999 exports["default"] = Fade;
6000 module.exports = exports['default'];
6001
6002/***/ }),
6003/* 65 */
6004/***/ (function(module, exports, __webpack_require__) {
6005
6006 'use strict';
6007
6008 Object.defineProperty(exports, "__esModule", {
6009 value: true
6010 });
6011
6012 var _Message = __webpack_require__(66);
6013
6014 var _Message2 = _interopRequireDefault(_Message);
6015
6016 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
6017
6018 exports["default"] = _Message2["default"];
6019 module.exports = exports['default'];
6020
6021/***/ }),
6022/* 66 */
6023/***/ (function(module, exports, __webpack_require__) {
6024
6025 'use strict';
6026
6027 Object.defineProperty(exports, "__esModule", {
6028 value: true
6029 });
6030
6031 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; };
6032
6033 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; };
6034
6035 var _react = __webpack_require__(4);
6036
6037 var _react2 = _interopRequireDefault(_react);
6038
6039 var _beeNotification = __webpack_require__(67);
6040
6041 var _beeNotification2 = _interopRequireDefault(_beeNotification);
6042
6043 var _classnames = __webpack_require__(3);
6044
6045 var _classnames2 = _interopRequireDefault(_classnames);
6046
6047 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
6048
6049 var defaultDuration = 1.5;
6050 var defaultTop = 0;
6051 var defaultBottom = 48;
6052 var bottom = 90;
6053 var padding = 30;
6054 var width = 200;
6055 var messageInstance = void 0;
6056 var key = 1;
6057 var clsPrefix = 'u-message';
6058 var noop = function noop() {};
6059
6060 var positionObj = {
6061 "top": {
6062 messageStyle: {
6063 width: "100%"
6064 },
6065 notificationStyle: {
6066 top: defaultTop,
6067 width: "100%"
6068 },
6069 transitionName: 'top'
6070 },
6071 "bottom": {
6072 messageStyle: {
6073 width: "100%"
6074 },
6075 notificationStyle: {
6076 bottom: defaultBottom,
6077 width: "100%"
6078 },
6079 transitionName: 'bottom'
6080 },
6081 "topRight": {
6082 messageStyle: {
6083 width: width
6084 },
6085 notificationStyle: {
6086 top: padding,
6087 right: padding,
6088 width: width
6089 },
6090 transitionName: 'right'
6091 },
6092 "bottomRight": {
6093 messageStyle: {
6094 width: width
6095 },
6096 notificationStyle: {
6097 bottom: bottom,
6098 right: padding,
6099 width: width
6100 },
6101 transitionName: 'right'
6102 },
6103 "topLeft": {
6104 messageStyle: {
6105 width: width
6106 },
6107 notificationStyle: {
6108 top: padding,
6109 left: padding,
6110 width: width
6111 },
6112 transitionName: 'left'
6113 },
6114 "bottomLeft": {
6115 messageStyle: {
6116 width: width
6117 },
6118 notificationStyle: {
6119 bottom: bottom,
6120 left: padding,
6121 width: width
6122 },
6123 transitionName: 'left'
6124 }
6125 };
6126
6127 function getMessageInstance() {
6128 var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'top';
6129 var callback = arguments[1];
6130
6131 if (messageInstance) {
6132 callback(messageInstance);
6133 return;
6134 }
6135 var style = positionObj[position].notificationStyle;
6136 _beeNotification2["default"].newInstance({
6137 clsPrefix: clsPrefix,
6138 transitionName: clsPrefix + '-' + positionObj[position].transitionName,
6139 style: style, // 覆盖原来的样式
6140 position: ''
6141 }, function (instance) {
6142 messageInstance = instance;
6143 callback(instance);
6144 });
6145 }
6146
6147 function notice(content, duration, type, onClose, position, style) {
6148 var iconType = {
6149 info: 'uf uf-i-c-2',
6150 success: 'uf uf-correct',
6151 danger: 'uf uf-close-c',
6152 warning: 'uf uf-exc-t',
6153 light: 'uf uf-notification',
6154 dark: 'uf uf-bubble',
6155 news: 'uf uf-bell',
6156 infolight: 'uf uf-i-c-2',
6157 successlight: 'uf uf-correct',
6158 dangerlight: 'uf uf-close-c',
6159 warninglight: 'uf uf-exc-t'
6160 }[type];
6161
6162 var positionStyle = positionObj[position].messageStyle;
6163
6164 getMessageInstance(position, function (instance) {
6165 instance.notice({
6166 key: key,
6167 duration: duration,
6168 color: type,
6169 style: _extends({}, positionStyle, style),
6170 content: _react2["default"].createElement(
6171 'div',
6172 null,
6173 _react2["default"].createElement(
6174 'div',
6175 { className: clsPrefix + '-notice-description-icon' },
6176 _react2["default"].createElement('i', { className: (0, _classnames2["default"])(iconType) })
6177 ),
6178 _react2["default"].createElement(
6179 'div',
6180 { className: clsPrefix + '-notice-description-content' },
6181 content
6182 )
6183 ),
6184 onClose: onClose
6185 });
6186 });
6187 return function () {
6188 var target = key++;
6189 return function () {
6190 if (messageInstance) {
6191 messageInstance.removeNotice(target);
6192 }
6193 };
6194 }();
6195 }
6196
6197 exports["default"] = {
6198 create: function create(obj) {
6199 var content = obj.content || '';
6200 var duration = _typeof(obj.duration) == undefined ? defaultDuration : obj.duration;
6201 var color = obj.color || 'dark';
6202 var onClose = obj.onClose || noop;
6203 var position = obj.position || "top";
6204 var style = obj.style || {};
6205 return notice(content, duration, color, onClose, position, style);
6206 },
6207 config: function config(options) {
6208 if (options.top !== undefined) {
6209 defaultTop = options.top;
6210 }
6211 if (options.duration !== undefined) {
6212 defaultDuration = options.duration;
6213 }
6214 if (options.clsPrefix !== undefined) {
6215 clsPrefix = options.clsPrefix;
6216 }
6217 if (options.defaultBottom !== undefined) {
6218 defaultBottom = options.defaultBottom;
6219 }
6220 if (options.bottom !== undefined) {
6221 bottom = options.bottom;
6222 }
6223 if (options.width !== undefined) {
6224 bottom = options.width;
6225 }
6226 },
6227 destroy: function destroy() {
6228 if (messageInstance) {
6229 messageInstance.destroy();
6230 messageInstance = null;
6231 }
6232 }
6233 };
6234 module.exports = exports['default'];
6235
6236/***/ }),
6237/* 67 */
6238/***/ (function(module, exports, __webpack_require__) {
6239
6240 'use strict';
6241
6242 Object.defineProperty(exports, "__esModule", {
6243 value: true
6244 });
6245
6246 var _Notification = __webpack_require__(68);
6247
6248 var _Notification2 = _interopRequireDefault(_Notification);
6249
6250 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
6251
6252 exports["default"] = _Notification2["default"];
6253 module.exports = exports['default'];
6254
6255/***/ }),
6256/* 68 */
6257/***/ (function(module, exports, __webpack_require__) {
6258
6259 'use strict';
6260
6261 Object.defineProperty(exports, "__esModule", {
6262 value: true
6263 });
6264
6265 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; };
6266
6267 var _react = __webpack_require__(4);
6268
6269 var _react2 = _interopRequireDefault(_react);
6270
6271 var _propTypes = __webpack_require__(5);
6272
6273 var _propTypes2 = _interopRequireDefault(_propTypes);
6274
6275 var _reactDom = __webpack_require__(12);
6276
6277 var _reactDom2 = _interopRequireDefault(_reactDom);
6278
6279 var _beeAnimate = __webpack_require__(69);
6280
6281 var _beeAnimate2 = _interopRequireDefault(_beeAnimate);
6282
6283 var _createChainedFunction = __webpack_require__(37);
6284
6285 var _createChainedFunction2 = _interopRequireDefault(_createChainedFunction);
6286
6287 var _classnames = __webpack_require__(3);
6288
6289 var _classnames2 = _interopRequireDefault(_classnames);
6290
6291 var _Notice = __webpack_require__(74);
6292
6293 var _Notice2 = _interopRequireDefault(_Notice);
6294
6295 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
6296
6297 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; }
6298
6299 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; }
6300
6301 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6302
6303 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; }
6304
6305 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); }
6306
6307 var seed = 0;
6308 var now = Date.now();
6309
6310 function getUuid() {
6311 return 'uNotification_' + now + '_' + seed++;
6312 }
6313
6314 var propTypes = {
6315 show: _propTypes2["default"].bool,
6316 clsPrefix: _propTypes2["default"].string,
6317 style: _propTypes2["default"].object,
6318 position: _propTypes2["default"].oneOf(['topRight', 'bottomRight', '']),
6319 transitionName: _propTypes2["default"].string,
6320 animation: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object])
6321 };
6322
6323 var defaultProps = {
6324 clsPrefix: 'u-notification',
6325 animation: 'fade',
6326 position: 'topRight'
6327 };
6328
6329 var Notification = function (_Component) {
6330 _inherits(Notification, _Component);
6331
6332 function Notification(props) {
6333 _classCallCheck(this, Notification);
6334
6335 var _this = _possibleConstructorReturn(this, _Component.call(this, props));
6336
6337 _this.state = {
6338 notices: []
6339 };
6340 _this.add = _this.add.bind(_this);
6341 _this.remove = _this.remove.bind(_this);
6342
6343 return _this;
6344 }
6345
6346 Notification.prototype.getTransitionName = function getTransitionName() {
6347 var props = this.props;
6348 var transitionName = props.transitionName;
6349 if (!transitionName && props.animation) {
6350 transitionName = props.clsPrefix + '-' + props.animation;
6351 }
6352 return transitionName;
6353 };
6354
6355 Notification.prototype.add = function add(notice) {
6356 var key = notice.key = notice.key || getUuid();
6357 this.setState(function (previousState) {
6358 var notices = previousState.notices;
6359 if (!notices.filter(function (v) {
6360 return v.key === key;
6361 }).length) {
6362 return {
6363 notices: notices.concat(notice)
6364 };
6365 }
6366 });
6367 };
6368
6369 Notification.prototype.remove = function remove(key) {
6370 this.setState(function (previousState) {
6371 return {
6372 notices: previousState.notices.filter(function (notice) {
6373 return notice.key !== key;
6374 })
6375 };
6376 });
6377 };
6378
6379 Notification.prototype.render = function render() {
6380 var _this2 = this,
6381 _classes;
6382
6383 var _props = this.props,
6384 clsPrefix = _props.clsPrefix,
6385 className = _props.className,
6386 position = _props.position,
6387 style = _props.style;
6388
6389 var noticeNodes = this.state.notices.map(function (notice) {
6390 var onClose = (0, _createChainedFunction2["default"])(_this2.remove.bind(_this2, notice.key), notice.onClose);
6391 return _react2["default"].createElement(
6392 _Notice2["default"],
6393 _extends({
6394 clsPrefix: clsPrefix
6395 }, notice, {
6396 onClose: onClose
6397 }),
6398 notice.content
6399 );
6400 });
6401 var classes = (_classes = {}, _defineProperty(_classes, clsPrefix, 1), _defineProperty(_classes, className, !!className), _classes);
6402 if (position) {
6403 classes[clsPrefix + '-' + position] = !!position;
6404 }
6405
6406 return _react2["default"].createElement(
6407 'div',
6408 { className: (0, _classnames2["default"])(className, classes), style: style },
6409 _react2["default"].createElement(
6410 _beeAnimate2["default"],
6411 { transitionName: this.getTransitionName() },
6412 noticeNodes
6413 )
6414 );
6415 };
6416
6417 return Notification;
6418 }(_react.Component);
6419
6420 ;
6421
6422 Notification.propTypes = propTypes;
6423 Notification.defaultProps = defaultProps;
6424
6425 Notification.newInstance = function newNotificationInstance(properties, callback) {
6426 if (typeof callback !== 'function') {
6427 console.error('You must introduce callback as the second parameter of Notification.newInstance().');
6428 return;
6429 }
6430 var props = properties || {};
6431 var div = document.createElement('div');
6432 document.body.appendChild(div);
6433
6434 var called = false;
6435 function ref(notification) {
6436 if (called) {
6437 return;
6438 }
6439 called = true;
6440 callback({
6441 notice: function notice(noticeProps) {
6442 notification.add(noticeProps);
6443 },
6444 removeNotice: function removeNotice(key) {
6445 notification.remove(key);
6446 },
6447
6448 component: notification,
6449 destroy: function destroy() {
6450 _reactDom2["default"].unmountComponentAtNode(div);
6451 document.body.removeChild(div);
6452 }
6453 });
6454 }
6455 _reactDom2["default"].render(_react2["default"].createElement(Notification, _extends({}, props, { ref: ref })), div);
6456 };
6457
6458 exports["default"] = Notification;
6459 module.exports = exports['default'];
6460
6461/***/ }),
6462/* 69 */
6463/***/ (function(module, exports, __webpack_require__) {
6464
6465 'use strict';
6466
6467 Object.defineProperty(exports, "__esModule", {
6468 value: true
6469 });
6470
6471 var _Animate = __webpack_require__(70);
6472
6473 var _Animate2 = _interopRequireDefault(_Animate);
6474
6475 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
6476
6477 exports["default"] = _Animate2["default"];
6478 module.exports = exports['default'];
6479
6480/***/ }),
6481/* 70 */
6482/***/ (function(module, exports, __webpack_require__) {
6483
6484 'use strict';
6485
6486 Object.defineProperty(exports, "__esModule", {
6487 value: true
6488 });
6489
6490 var _react = __webpack_require__(4);
6491
6492 var _react2 = _interopRequireDefault(_react);
6493
6494 var _propTypes = __webpack_require__(5);
6495
6496 var _propTypes2 = _interopRequireDefault(_propTypes);
6497
6498 var _ChildrenUtils = __webpack_require__(71);
6499
6500 var _AnimateChild = __webpack_require__(72);
6501
6502 var _AnimateChild2 = _interopRequireDefault(_AnimateChild);
6503
6504 var _util = __webpack_require__(73);
6505
6506 var _util2 = _interopRequireDefault(_util);
6507
6508 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
6509
6510 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; }
6511
6512 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; }
6513
6514 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6515
6516 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; }
6517
6518 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); }
6519
6520 var defaultKey = 'u_animate_' + Date.now();
6521
6522
6523 function getChildrenFromProps(props) {
6524 var children = props.children;
6525 if (_react2["default"].isValidElement(children)) {
6526 if (!children.key) {
6527 return _react2["default"].cloneElement(children, {
6528 key: defaultKey
6529 });
6530 }
6531 }
6532 return children;
6533 }
6534
6535 function noop() {}
6536
6537 var propTypes = {
6538 component: _propTypes2["default"].any,
6539 animation: _propTypes2["default"].object,
6540 transitionName: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]),
6541 transitionEnter: _propTypes2["default"].bool,
6542 transitionAppear: _propTypes2["default"].bool,
6543 exclusive: _propTypes2["default"].bool,
6544 transitionLeave: _propTypes2["default"].bool,
6545 onEnd: _propTypes2["default"].func,
6546 onEnter: _propTypes2["default"].func,
6547 onLeave: _propTypes2["default"].func,
6548 onAppear: _propTypes2["default"].func,
6549 showProp: _propTypes2["default"].string
6550 };
6551
6552 var defaultProps = {
6553 animation: {},
6554 component: 'span',
6555 transitionEnter: true,
6556 transitionLeave: true,
6557 transitionAppear: false,
6558 onEnd: noop,
6559 onEnter: noop,
6560 onLeave: noop,
6561 onAppear: noop
6562 };
6563
6564 var Animate = function (_Component) {
6565 _inherits(Animate, _Component);
6566
6567 function Animate(props) {
6568 _classCallCheck(this, Animate);
6569
6570 var _this = _possibleConstructorReturn(this, _Component.call(this, props));
6571
6572 _this.currentlyAnimatingKeys = {};
6573 _this.keysToEnter = [];
6574 _this.keysToLeave = [];
6575 _this.state = {
6576 children: (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(_this.props))
6577 };
6578
6579 _this.performEnter = _this.performEnter.bind(_this);
6580 _this.performAppear = _this.performAppear.bind(_this);
6581 _this.handleDoneAdding = _this.handleDoneAdding.bind(_this);
6582 _this.performLeave = _this.performLeave.bind(_this);
6583
6584 _this.performLeave = _this.performLeave.bind(_this);
6585 _this.handleDoneLeaving = _this.handleDoneLeaving.bind(_this);
6586 _this.isValidChildByKey = _this.isValidChildByKey.bind(_this);
6587 _this.stop = _this.stop.bind(_this);
6588 return _this;
6589 }
6590
6591 Animate.prototype.componentDidMount = function componentDidMount() {
6592 var _this2 = this;
6593
6594 this.mounted = true;
6595 var showProp = this.props.showProp;
6596 var children = this.state.children;
6597 if (showProp) {
6598 children = children.filter(function (child) {
6599 return !!child.props[showProp];
6600 });
6601 }
6602 children.forEach(function (child) {
6603 if (child) {
6604 _this2.performAppear(child.key);
6605 }
6606 });
6607 };
6608
6609 Animate.prototype.componentWillUnmount = function componentWillUnmount() {
6610 this.mounted = false;
6611 };
6612
6613 Animate.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
6614 var _this3 = this;
6615
6616 this.nextProps = nextProps;
6617 var nextChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(nextProps));
6618 var props = this.props;
6619 // exclusive needs immediate response
6620 if (props.exclusive) {
6621 Object.keys(this.currentlyAnimatingKeys).forEach(function (key) {
6622 _this3.stop(key);
6623 });
6624 }
6625 var showProp = props.showProp;
6626 var currentlyAnimatingKeys = this.currentlyAnimatingKeys;
6627 // last props children if exclusive
6628 var currentChildren = props.exclusive ? (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)) : this.state.children;
6629 // in case destroy in showProp mode
6630 var newChildren = [];
6631 if (showProp) {
6632 currentChildren.forEach(function (currentChild) {
6633 var nextChild = currentChild && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, currentChild.key);
6634 var newChild = void 0;
6635 if ((!nextChild || !nextChild.props[showProp]) && currentChild.props[showProp]) {
6636 newChild = _react2["default"].cloneElement(nextChild || currentChild, _defineProperty({}, showProp, true));
6637 } else {
6638 newChild = nextChild;
6639 }
6640 if (newChild) {
6641 newChildren.push(newChild);
6642 }
6643 });
6644 nextChildren.forEach(function (nextChild) {
6645 if (!nextChild || !(0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, nextChild.key)) {
6646 newChildren.push(nextChild);
6647 }
6648 });
6649 } else {
6650 newChildren = (0, _ChildrenUtils.mergeChildren)(currentChildren, nextChildren);
6651 }
6652
6653 // need render to avoid update
6654 this.setState({
6655 children: newChildren
6656 });
6657
6658 nextChildren.forEach(function (child) {
6659 var key = child && child.key;
6660 if (child && currentlyAnimatingKeys[key]) {
6661 return;
6662 }
6663 var hasPrev = child && (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key);
6664 if (showProp) {
6665 var showInNext = child.props[showProp];
6666 if (hasPrev) {
6667 var showInNow = (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp);
6668 if (!showInNow && showInNext) {
6669 _this3.keysToEnter.push(key);
6670 }
6671 } else if (showInNext) {
6672 _this3.keysToEnter.push(key);
6673 }
6674 } else if (!hasPrev) {
6675 _this3.keysToEnter.push(key);
6676 }
6677 });
6678
6679 currentChildren.forEach(function (child) {
6680 var key = child && child.key;
6681 if (child && currentlyAnimatingKeys[key]) {
6682 return;
6683 }
6684 var hasNext = child && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, key);
6685 if (showProp) {
6686 var showInNow = child.props[showProp];
6687 if (hasNext) {
6688 var showInNext = (0, _ChildrenUtils.findShownChildInChildrenByKey)(nextChildren, key, showProp);
6689 if (!showInNext && showInNow) {
6690 _this3.keysToLeave.push(key);
6691 }
6692 } else if (showInNow) {
6693 _this3.keysToLeave.push(key);
6694 }
6695 } else if (!hasNext) {
6696 _this3.keysToLeave.push(key);
6697 }
6698 });
6699 };
6700
6701 Animate.prototype.componentDidUpdate = function componentDidUpdate() {
6702 var keysToEnter = this.keysToEnter;
6703 this.keysToEnter = [];
6704 keysToEnter.forEach(this.performEnter);
6705 var keysToLeave = this.keysToLeave;
6706 this.keysToLeave = [];
6707 keysToLeave.forEach(this.performLeave);
6708 };
6709
6710 Animate.prototype.performEnter = function performEnter(key) {
6711 // may already remove by exclusive
6712 if (this.refs[key]) {
6713 this.currentlyAnimatingKeys[key] = true;
6714 this.refs[key].componentWillEnter(this.handleDoneAdding.bind(this, key, 'enter'));
6715 }
6716 };
6717
6718 Animate.prototype.performAppear = function performAppear(key) {
6719 if (this.refs[key]) {
6720 this.currentlyAnimatingKeys[key] = true;
6721 this.refs[key].componentWillAppear(this.handleDoneAdding.bind(this, key, 'appear'));
6722 }
6723 };
6724
6725 Animate.prototype.handleDoneAdding = function handleDoneAdding(key, type) {
6726 var props = this.props;
6727 delete this.currentlyAnimatingKeys[key];
6728 // if update on exclusive mode, skip check
6729 if (props.exclusive && props !== this.nextProps) {
6730 return;
6731 }
6732 var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props));
6733 if (!this.isValidChildByKey(currentChildren, key)) {
6734 // exclusive will not need this
6735 this.performLeave(key);
6736 } else {
6737 if (type === 'appear') {
6738 if (_util2["default"].allowAppearCallback(props)) {
6739 props.onAppear(key);
6740 props.onEnd(key, true);
6741 }
6742 } else {
6743 if (_util2["default"].allowEnterCallback(props)) {
6744 props.onEnter(key);
6745 props.onEnd(key, true);
6746 }
6747 }
6748 }
6749 };
6750
6751 Animate.prototype.performLeave = function performLeave(key) {
6752 // may already remove by exclusive
6753 if (this.refs[key]) {
6754 this.currentlyAnimatingKeys[key] = true;
6755 this.refs[key].componentWillLeave(this.handleDoneLeaving.bind(this, key));
6756 }
6757 };
6758
6759 Animate.prototype.handleDoneLeaving = function handleDoneLeaving(key) {
6760 var props = this.props;
6761 delete this.currentlyAnimatingKeys[key];
6762 // if update on exclusive mode, skip check
6763 if (props.exclusive && props !== this.nextProps) {
6764 return;
6765 }
6766 var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props));
6767 // in case state change is too fast
6768 if (this.isValidChildByKey(currentChildren, key)) {
6769 this.performEnter(key);
6770 } else {
6771 var end = function end() {
6772 if (_util2["default"].allowLeaveCallback(props)) {
6773 props.onLeave(key);
6774 props.onEnd(key, false);
6775 }
6776 };
6777 /* eslint react/no-is-mounted:0 */
6778 if (this.mounted && !(0, _ChildrenUtils.isSameChildren)(this.state.children, currentChildren, props.showProp)) {
6779 this.setState({
6780 children: currentChildren
6781 }, end);
6782 } else {
6783 end();
6784 }
6785 }
6786 };
6787
6788 Animate.prototype.isValidChildByKey = function isValidChildByKey(currentChildren, key) {
6789 var showProp = this.props.showProp;
6790 if (showProp) {
6791 return (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp);
6792 }
6793 return (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key);
6794 };
6795
6796 Animate.prototype.stop = function stop(key) {
6797 delete this.currentlyAnimatingKeys[key];
6798 var component = this.refs[key];
6799 if (component) {
6800 component.stop();
6801 }
6802 };
6803
6804 Animate.prototype.render = function render() {
6805 var props = this.props;
6806 this.nextProps = props;
6807 var stateChildren = this.state.children;
6808 var children = null;
6809 if (stateChildren) {
6810 children = stateChildren.map(function (child) {
6811 if (child === null || child === undefined) {
6812 return child;
6813 }
6814 if (!child.key) {
6815 throw new Error('must set key for <rc-animate> children');
6816 }
6817 return _react2["default"].createElement(
6818 _AnimateChild2["default"],
6819 {
6820 key: child.key,
6821 ref: child.key,
6822 animation: props.animation,
6823 transitionName: props.transitionName,
6824 transitionEnter: props.transitionEnter,
6825 transitionAppear: props.transitionAppear,
6826 transitionLeave: props.transitionLeave
6827 },
6828 child
6829 );
6830 });
6831 }
6832 var Component = props.component;
6833 if (Component) {
6834 var passedProps = props;
6835 if (typeof Component === 'string') {
6836 passedProps = {
6837 className: props.className,
6838 style: props.style
6839 };
6840 }
6841 return _react2["default"].createElement(
6842 Component,
6843 passedProps,
6844 children
6845 );
6846 }
6847 return children[0] || null;
6848 };
6849
6850 return Animate;
6851 }(_react.Component);
6852
6853 ;
6854 Animate.defaultProps = defaultProps;
6855 Animate.propTypes = Animate.propTypes;
6856
6857 exports["default"] = Animate;
6858 module.exports = exports['default'];
6859
6860/***/ }),
6861/* 71 */
6862/***/ (function(module, exports, __webpack_require__) {
6863
6864 'use strict';
6865
6866 Object.defineProperty(exports, "__esModule", {
6867 value: true
6868 });
6869 exports.toArrayChildren = toArrayChildren;
6870 exports.findChildInChildrenByKey = findChildInChildrenByKey;
6871 exports.findShownChildInChildrenByKey = findShownChildInChildrenByKey;
6872 exports.findHiddenChildInChildrenByKey = findHiddenChildInChildrenByKey;
6873 exports.isSameChildren = isSameChildren;
6874 exports.mergeChildren = mergeChildren;
6875
6876 var _react = __webpack_require__(4);
6877
6878 var _react2 = _interopRequireDefault(_react);
6879
6880 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
6881
6882 function toArrayChildren(children) {
6883 var ret = [];
6884 _react2["default"].Children.forEach(children, function (child) {
6885 ret.push(child);
6886 });
6887 return ret;
6888 }
6889
6890 function findChildInChildrenByKey(children, key) {
6891 var ret = null;
6892 if (children) {
6893 children.forEach(function (child) {
6894 if (ret) {
6895 return;
6896 }
6897 if (child && child.key === key) {
6898 ret = child;
6899 }
6900 });
6901 }
6902 return ret;
6903 }
6904
6905 function findShownChildInChildrenByKey(children, key, showProp) {
6906 var ret = null;
6907 if (children) {
6908 children.forEach(function (child) {
6909 if (child && child.key === key && child.props[showProp]) {
6910 if (ret) {
6911 throw new Error('two child with same key for <rc-animate> children');
6912 }
6913 ret = child;
6914 }
6915 });
6916 }
6917 return ret;
6918 }
6919
6920 function findHiddenChildInChildrenByKey(children, key, showProp) {
6921 var found = 0;
6922 if (children) {
6923 children.forEach(function (child) {
6924 if (found) {
6925 return;
6926 }
6927 found = child && child.key === key && !child.props[showProp];
6928 });
6929 }
6930 return found;
6931 }
6932
6933 function isSameChildren(c1, c2, showProp) {
6934 var same = c1.length === c2.length;
6935 if (same) {
6936 c1.forEach(function (child, index) {
6937 var child2 = c2[index];
6938 if (child && child2) {
6939 if (child && !child2 || !child && child2) {
6940 same = false;
6941 } else if (child.key !== child2.key) {
6942 same = false;
6943 } else if (showProp && child.props[showProp] !== child2.props[showProp]) {
6944 same = false;
6945 }
6946 }
6947 });
6948 }
6949 return same;
6950 }
6951
6952 function mergeChildren(prev, next) {
6953 var ret = [];
6954
6955 // For each key of `next`, the list of keys to insert before that key in
6956 // the combined list
6957 var nextChildrenPending = {};
6958 var pendingChildren = [];
6959 prev.forEach(function (child) {
6960 if (child && findChildInChildrenByKey(next, child.key)) {
6961 if (pendingChildren.length) {
6962 nextChildrenPending[child.key] = pendingChildren;
6963 pendingChildren = [];
6964 }
6965 } else {
6966 pendingChildren.push(child);
6967 }
6968 });
6969
6970 next.forEach(function (child) {
6971 if (child && nextChildrenPending.hasOwnProperty(child.key)) {
6972 ret = ret.concat(nextChildrenPending[child.key]);
6973 }
6974 ret.push(child);
6975 });
6976
6977 ret = ret.concat(pendingChildren);
6978
6979 return ret;
6980 }
6981
6982/***/ }),
6983/* 72 */
6984/***/ (function(module, exports, __webpack_require__) {
6985
6986 'use strict';
6987
6988 Object.defineProperty(exports, "__esModule", {
6989 value: true
6990 });
6991
6992 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; };
6993
6994 var _react = __webpack_require__(4);
6995
6996 var _react2 = _interopRequireDefault(_react);
6997
6998 var _propTypes = __webpack_require__(5);
6999
7000 var _propTypes2 = _interopRequireDefault(_propTypes);
7001
7002 var _reactDom = __webpack_require__(12);
7003
7004 var _reactDom2 = _interopRequireDefault(_reactDom);
7005
7006 var _tinperBeeCore = __webpack_require__(27);
7007
7008 var _util = __webpack_require__(73);
7009
7010 var _util2 = _interopRequireDefault(_util);
7011
7012 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
7013
7014 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; }
7015
7016 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
7017
7018 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; }
7019
7020 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); }
7021
7022 var transitionMap = {
7023 enter: 'transitionEnter',
7024 appear: 'transitionAppear',
7025 leave: 'transitionLeave'
7026 };
7027
7028 var propTypes = {
7029 children: _propTypes2["default"].any
7030 };
7031
7032 var AnimateChild = function (_Component) {
7033 _inherits(AnimateChild, _Component);
7034
7035 function AnimateChild(props) {
7036 _classCallCheck(this, AnimateChild);
7037
7038 var _this = _possibleConstructorReturn(this, _Component.call(this, props));
7039
7040 _this.transition = _this.transition.bind(_this);
7041 _this.stop = _this.stop.bind(_this);
7042 return _this;
7043 }
7044
7045 AnimateChild.prototype.componentWillUnmount = function componentWillUnmount() {
7046 this.stop();
7047 };
7048
7049 AnimateChild.prototype.componentWillEnter = function componentWillEnter(done) {
7050 if (_util2["default"].isEnterSupported(this.props)) {
7051 this.transition('enter', done);
7052 } else {
7053 done();
7054 }
7055 };
7056
7057 AnimateChild.prototype.componentWillAppear = function componentWillAppear(done) {
7058 if (_util2["default"].isAppearSupported(this.props)) {
7059 this.transition('appear', done);
7060 } else {
7061 done();
7062 }
7063 };
7064
7065 AnimateChild.prototype.componentWillLeave = function componentWillLeave(done) {
7066 if (_util2["default"].isLeaveSupported(this.props)) {
7067 this.transition('leave', done);
7068 } else {
7069 // always sync, do not interupt with react component life cycle
7070 // update hidden -> animate hidden ->
7071 // didUpdate -> animate leave -> unmount (if animate is none)
7072 done();
7073 }
7074 };
7075
7076 AnimateChild.prototype.transition = function transition(animationType, finishCallback) {
7077 var _this2 = this;
7078
7079 var node = _reactDom2["default"].findDOMNode(this);
7080 var props = this.props;
7081 var transitionName = props.transitionName;
7082 var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object';
7083 this.stop();
7084 var end = function end() {
7085 _this2.stopper = null;
7086 finishCallback();
7087 };
7088 if ((_tinperBeeCore.cssAnimation.isCssAnimationSupported || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) {
7089 var name = nameIsObj ? transitionName[animationType] : transitionName + '-' + animationType;
7090 var activeName = name + '-active';
7091 if (nameIsObj && transitionName[animationType + 'Active']) {
7092 activeName = transitionName[animationType + 'Active'];
7093 }
7094 this.stopper = (0, _tinperBeeCore.cssAnimation)(node, {
7095 name: name,
7096 active: activeName
7097 }, end);
7098 } else {
7099 this.stopper = props.animation[animationType](node, end);
7100 }
7101 };
7102
7103 AnimateChild.prototype.stop = function stop() {
7104 var stopper = this.stopper;
7105 if (stopper) {
7106 this.stopper = null;
7107 stopper.stop();
7108 }
7109 };
7110
7111 AnimateChild.prototype.render = function render() {
7112 return this.props.children;
7113 };
7114
7115 return AnimateChild;
7116 }(_react.Component);
7117
7118 ;
7119
7120 AnimateChild.propTypes = propTypes;
7121
7122 exports["default"] = AnimateChild;
7123 module.exports = exports['default'];
7124
7125/***/ }),
7126/* 73 */
7127/***/ (function(module, exports) {
7128
7129 "use strict";
7130
7131 Object.defineProperty(exports, "__esModule", {
7132 value: true
7133 });
7134 var util = {
7135 isAppearSupported: function isAppearSupported(props) {
7136 return props.transitionName && props.transitionAppear || props.animation.appear;
7137 },
7138 isEnterSupported: function isEnterSupported(props) {
7139 return props.transitionName && props.transitionEnter || props.animation.enter;
7140 },
7141 isLeaveSupported: function isLeaveSupported(props) {
7142 return props.transitionName && props.transitionLeave || props.animation.leave;
7143 },
7144 allowAppearCallback: function allowAppearCallback(props) {
7145 return props.transitionAppear || props.animation.appear;
7146 },
7147 allowEnterCallback: function allowEnterCallback(props) {
7148 return props.transitionEnter || props.animation.enter;
7149 },
7150 allowLeaveCallback: function allowLeaveCallback(props) {
7151 return props.transitionLeave || props.animation.leave;
7152 }
7153 };
7154 exports["default"] = util;
7155 module.exports = exports["default"];
7156
7157/***/ }),
7158/* 74 */
7159/***/ (function(module, exports, __webpack_require__) {
7160
7161 'use strict';
7162
7163 Object.defineProperty(exports, "__esModule", {
7164 value: true
7165 });
7166
7167 var _react = __webpack_require__(4);
7168
7169 var _react2 = _interopRequireDefault(_react);
7170
7171 var _classnames = __webpack_require__(3);
7172
7173 var _classnames2 = _interopRequireDefault(_classnames);
7174
7175 var _propTypes = __webpack_require__(5);
7176
7177 var _propTypes2 = _interopRequireDefault(_propTypes);
7178
7179 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
7180
7181 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; }
7182
7183 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; }
7184
7185 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
7186
7187 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; }
7188
7189 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); }
7190
7191 var propTypes = {
7192 duration: _propTypes2["default"].number,
7193 onClose: _propTypes2["default"].func,
7194 children: _propTypes2["default"].any,
7195 color: _propTypes2["default"].oneOf(['info', 'success', 'danger', 'warning', 'light', 'dark', 'news', 'infolight', 'successlight', 'dangerlight', 'warninglight']),
7196 title: _propTypes2["default"].any
7197 };
7198
7199 function noop() {}
7200
7201 var defaultProps = {
7202 onEnd: noop,
7203 onClose: noop,
7204 duration: 4.5,
7205 closable: true
7206 };
7207
7208 var Notice = function (_React$Component) {
7209 _inherits(Notice, _React$Component);
7210
7211 function Notice(props) {
7212 _classCallCheck(this, Notice);
7213
7214 var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
7215
7216 _this.clearCloseTimer = _this.clearCloseTimer.bind(_this);
7217 _this.close = _this.close.bind(_this);
7218 return _this;
7219 }
7220
7221 Notice.prototype.componentDidMount = function componentDidMount() {
7222 var _this2 = this;
7223
7224 if (this.props.duration) {
7225 this.closeTimer = setTimeout(function () {
7226 _this2.close();
7227 }, this.props.duration * 1000);
7228 }
7229 };
7230
7231 Notice.prototype.componentWillUnmount = function componentWillUnmount() {
7232 this.clearCloseTimer();
7233 };
7234
7235 Notice.prototype.clearCloseTimer = function clearCloseTimer() {
7236 if (this.closeTimer) {
7237 clearTimeout(this.closeTimer);
7238 this.closeTimer = null;
7239 }
7240 };
7241
7242 Notice.prototype.close = function close() {
7243 this.clearCloseTimer();
7244 this.props.onClose();
7245 };
7246
7247 Notice.prototype.render = function render() {
7248 var _classes;
7249
7250 var _props = this.props,
7251 closable = _props.closable,
7252 clsPrefix = _props.clsPrefix,
7253 className = _props.className,
7254 style = _props.style,
7255 children = _props.children,
7256 color = _props.color,
7257 title = _props.title;
7258
7259 var componentClass = clsPrefix + '-notice';
7260 var classes = (_classes = {}, _defineProperty(_classes, '' + componentClass, 1), _defineProperty(_classes, componentClass + '-closable', closable), _defineProperty(_classes, className, !!className), _classes);
7261 if (color) {
7262 classes[componentClass + '-' + color] = true;
7263 }
7264 return _react2["default"].createElement(
7265 'div',
7266 { className: (0, _classnames2["default"])(classes), style: style, onClick: this.close },
7267 _react2["default"].createElement(
7268 'div',
7269 { className: componentClass + '-content' },
7270 title && _react2["default"].createElement(
7271 'div',
7272 { className: componentClass + '-title' },
7273 title
7274 ),
7275 _react2["default"].createElement(
7276 'div',
7277 { className: componentClass + '-description' },
7278 children
7279 )
7280 ),
7281 closable ? _react2["default"].createElement(
7282 'a',
7283 { tabIndex: '0', onClick: this.close, className: componentClass + '-close' },
7284 _react2["default"].createElement('span', { className: componentClass + '-close-x' })
7285 ) : null
7286 );
7287 };
7288
7289 return Notice;
7290 }(_react2["default"].Component);
7291
7292 ;
7293
7294 Notice.propTypes = propTypes;
7295 Notice.defaultProps = defaultProps;
7296
7297 exports["default"] = Notice;
7298 module.exports = exports['default'];
7299
7300/***/ }),
7301/* 75 */
7302/***/ (function(module, exports, __webpack_require__) {
7303
7304 'use strict';
7305
7306 var deselectCurrent = __webpack_require__(76);
7307
7308 var defaultMessage = 'Copy to clipboard: #{key}, Enter';
7309
7310 function format(message) {
7311 var copyKey = (/mac os x/i.test(navigator.userAgent) ? '⌘' : 'Ctrl') + '+C';
7312 return message.replace(/#{\s*key\s*}/g, copyKey);
7313 }
7314
7315 function copy(text, options) {
7316 var debug, message, reselectPrevious, range, selection, mark, success = false;
7317 if (!options) { options = {}; }
7318 debug = options.debug || false;
7319 try {
7320 reselectPrevious = deselectCurrent();
7321
7322 range = document.createRange();
7323 selection = document.getSelection();
7324
7325 mark = document.createElement('span');
7326 mark.textContent = text;
7327 // reset user styles for span element
7328 mark.style.all = 'unset';
7329 // prevents scrolling to the end of the page
7330 mark.style.position = 'fixed';
7331 mark.style.top = 0;
7332 mark.style.clip = 'rect(0, 0, 0, 0)';
7333 // used to preserve spaces and line breaks
7334 mark.style.whiteSpace = 'pre';
7335 // do not inherit user-select (it may be `none`)
7336 mark.style.webkitUserSelect = 'text';
7337 mark.style.MozUserSelect = 'text';
7338 mark.style.msUserSelect = 'text';
7339 mark.style.userSelect = 'text';
7340
7341 document.body.appendChild(mark);
7342
7343 range.selectNode(mark);
7344 selection.addRange(range);
7345
7346 var successful = document.execCommand('copy');
7347 if (!successful) {
7348 throw new Error('copy command was unsuccessful');
7349 }
7350 success = true;
7351 } catch (err) {
7352 debug && console.error('unable to copy using execCommand: ', err);
7353 debug && console.warn('trying IE specific stuff');
7354 try {
7355 window.clipboardData.setData('text', text);
7356 success = true;
7357 } catch (err) {
7358 debug && console.error('unable to copy using clipboardData: ', err);
7359 debug && console.error('falling back to prompt');
7360 message = format('message' in options ? options.message : defaultMessage);
7361 window.prompt(message, text);
7362 }
7363 } finally {
7364 if (selection) {
7365 if (typeof selection.removeRange == 'function') {
7366 selection.removeRange(range);
7367 } else {
7368 selection.removeAllRanges();
7369 }
7370 }
7371
7372 if (mark) {
7373 document.body.removeChild(mark);
7374 }
7375 reselectPrevious();
7376 }
7377
7378 return success;
7379 }
7380
7381 module.exports = copy;
7382
7383
7384/***/ }),
7385/* 76 */
7386/***/ (function(module, exports) {
7387
7388
7389 module.exports = function () {
7390 var selection = document.getSelection();
7391 if (!selection.rangeCount) {
7392 return function () {};
7393 }
7394 var active = document.activeElement;
7395
7396 var ranges = [];
7397 for (var i = 0; i < selection.rangeCount; i++) {
7398 ranges.push(selection.getRangeAt(i));
7399 }
7400
7401 switch (active.tagName.toUpperCase()) { // .toUpperCase handles XHTML
7402 case 'INPUT':
7403 case 'TEXTAREA':
7404 active.blur();
7405 break;
7406
7407 default:
7408 active = null;
7409 break;
7410 }
7411
7412 selection.removeAllRanges();
7413 return function () {
7414 selection.type === 'Caret' &&
7415 selection.removeAllRanges();
7416
7417 if (!selection.rangeCount) {
7418 ranges.forEach(function(range) {
7419 selection.addRange(range);
7420 });
7421 }
7422
7423 active &&
7424 active.focus();
7425 };
7426 };
7427
7428
7429/***/ }),
7430/* 77 */
7431/***/ (function(module, exports, __webpack_require__) {
7432
7433 'use strict';
7434
7435 Object.defineProperty(exports, "__esModule", {
7436 value: true
7437 });
7438
7439 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; };
7440
7441 var _classnames = __webpack_require__(3);
7442
7443 var _classnames2 = _interopRequireDefault(_classnames);
7444
7445 var _react = __webpack_require__(4);
7446
7447 var _react2 = _interopRequireDefault(_react);
7448
7449 var _propTypes = __webpack_require__(5);
7450
7451 var _propTypes2 = _interopRequireDefault(_propTypes);
7452
7453 var _tinperBeeCore = __webpack_require__(27);
7454
7455 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
7456
7457 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; }
7458
7459 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; }
7460
7461 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
7462
7463 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; }
7464
7465 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); }
7466
7467 var propTypes = {
7468 //是否是手风琴效果
7469 accordion: _propTypes2["default"].bool,
7470 //激活的项
7471 activeKey: _propTypes2["default"].any,
7472 //默认的激活的项
7473 defaultActiveKey: _propTypes2["default"].any,
7474 //选中函数
7475 onSelect: _propTypes2["default"].func,
7476 role: _propTypes2["default"].string
7477 };
7478
7479 var defaultProps = {
7480 accordion: false,
7481 clsPrefix: 'u-panel-group'
7482 };
7483
7484 // TODO: Use uncontrollable.
7485
7486 var PanelGroup = function (_React$Component) {
7487 _inherits(PanelGroup, _React$Component);
7488
7489 function PanelGroup(props, context) {
7490 _classCallCheck(this, PanelGroup);
7491
7492 var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
7493
7494 _this.handleSelect = _this.handleSelect.bind(_this);
7495
7496 _this.state = {
7497 activeKey: props.defaultActiveKey
7498 };
7499 return _this;
7500 }
7501
7502 PanelGroup.prototype.handleSelect = function handleSelect(key, e) {
7503 e.preventDefault();
7504
7505 if (this.props.onSelect) {
7506 this.props.onSelect(key, e);
7507 }
7508
7509 if (this.state.activeKey === key) {
7510 key = null;
7511 }
7512
7513 this.setState({ activeKey: key });
7514 };
7515
7516 PanelGroup.prototype.render = function render() {
7517 var _this2 = this;
7518
7519 var _props = this.props,
7520 accordion = _props.accordion,
7521 propsActiveKey = _props.activeKey,
7522 className = _props.className,
7523 children = _props.children,
7524 defaultActiveKey = _props.defaultActiveKey,
7525 onSelect = _props.onSelect,
7526 style = _props.style,
7527 clsPrefix = _props.clsPrefix,
7528 others = _objectWithoutProperties(_props, ['accordion', 'activeKey', 'className', 'children', 'defaultActiveKey', 'onSelect', 'style', 'clsPrefix']);
7529
7530 var activeKey = void 0;
7531 if (accordion) {
7532 activeKey = propsActiveKey != null ? propsActiveKey : this.state.activeKey;
7533 others.role = others.role || 'tablist';
7534 }
7535
7536 var classes = {};
7537 classes['' + clsPrefix] = true;
7538
7539 return _react2["default"].createElement(
7540 'div',
7541 _extends({}, others, {
7542 className: (0, _classnames2["default"])(className, classes)
7543 }),
7544 _react2["default"].Children.map(children, function (child) {
7545 if (!_react2["default"].isValidElement(child)) {
7546 return child;
7547 }
7548 var childProps = {
7549 style: child.props.style
7550 };
7551
7552 if (accordion) {
7553 _extends(childProps, {
7554 headerRole: 'tab',
7555 panelRole: 'tabpanel',
7556 collapsible: true,
7557 expanded: child.props.eventKey === activeKey,
7558 onSelect: (0, _tinperBeeCore.createChainedFunction)(_this2.handleSelect, child.props.onSelect)
7559 });
7560 }
7561
7562 return (0, _react.cloneElement)(child, childProps);
7563 })
7564 );
7565 };
7566
7567 return PanelGroup;
7568 }(_react2["default"].Component);
7569
7570 PanelGroup.propTypes = propTypes;
7571 PanelGroup.defaultProps = defaultProps;
7572
7573 exports["default"] = PanelGroup;
7574 module.exports = exports['default'];
7575
7576/***/ }),
7577/* 78 */
7578/***/ (function(module, exports, __webpack_require__) {
7579
7580 'use strict';
7581
7582 Object.defineProperty(exports, "__esModule", {
7583 value: true
7584 });
7585
7586 var _Button = __webpack_require__(79);
7587
7588 var _Button2 = _interopRequireDefault(_Button);
7589
7590 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
7591
7592 exports["default"] = _Button2["default"];
7593 module.exports = exports['default'];
7594
7595/***/ }),
7596/* 79 */
7597/***/ (function(module, exports, __webpack_require__) {
7598
7599 'use strict';
7600
7601 Object.defineProperty(exports, "__esModule", {
7602 value: true
7603 });
7604
7605 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; };
7606
7607 var _react = __webpack_require__(4);
7608
7609 var _react2 = _interopRequireDefault(_react);
7610
7611 var _reactDom = __webpack_require__(12);
7612
7613 var _reactDom2 = _interopRequireDefault(_reactDom);
7614
7615 var _propTypes = __webpack_require__(5);
7616
7617 var _propTypes2 = _interopRequireDefault(_propTypes);
7618
7619 var _classnames = __webpack_require__(3);
7620
7621 var _classnames2 = _interopRequireDefault(_classnames);
7622
7623 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
7624
7625 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; }
7626
7627 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; }
7628
7629 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
7630
7631 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; }
7632
7633 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); }
7634
7635 var propTypes = {
7636 /**
7637 * @title 尺寸
7638 */
7639 size: _propTypes2["default"].oneOf(['sm', 'xg', 'lg']),
7640 /**
7641 * @title 样式
7642 */
7643 style: _propTypes2["default"].object,
7644 /**
7645 * @title 形状
7646 */
7647 shape: _propTypes2["default"].oneOf(['block', 'round', 'border', 'squared', 'floating', 'pillRight', 'pillLeft', 'icon']),
7648
7649 bordered: _propTypes2["default"].bool,
7650 /**
7651 * @title 类型
7652 */
7653 colors: _propTypes2["default"].oneOf(['primary', 'accent', 'success', 'info', 'warning', 'danger', 'default']),
7654 /**
7655 * @title 是否禁用
7656 * @veIgnore
7657 */
7658 disabled: _propTypes2["default"].bool,
7659 /**
7660 * @title 类名
7661 * @veIgnore
7662 */
7663 className: _propTypes2["default"].string,
7664
7665 /**
7666 * @title <button> 的 type
7667 * @veIgnore
7668 */
7669 htmlType: _propTypes2["default"].oneOf(['submit', 'button', 'reset']),
7670 isSubmit: _propTypes2["default"].bool //是否作为form的提交按钮
7671 };
7672
7673 var defaultProps = {
7674 disabled: false,
7675 htmlType: 'button',
7676 clsPrefix: 'u-button',
7677 bordered: false,
7678 isSubmit: false
7679 };
7680
7681 var sizeMap = {
7682 sm: 'sm',
7683 xg: 'xg',
7684 lg: 'lg'
7685 },
7686 colorsMap = {
7687 primary: 'primary',
7688 accent: 'accent',
7689 success: 'success',
7690 info: 'info',
7691 warning: 'warning',
7692 danger: 'danger'
7693 },
7694 shapeMap = {
7695 block: 'block',
7696 round: 'round',
7697 border: 'border',
7698 squared: 'squared',
7699 floating: 'floating',
7700 pillRight: 'pill-right',
7701 pillLeft: 'pill-left',
7702 icon: 'icon'
7703 };
7704
7705 var Button = function (_Component) {
7706 _inherits(Button, _Component);
7707
7708 function Button(props) {
7709 _classCallCheck(this, Button);
7710
7711 return _possibleConstructorReturn(this, _Component.call(this, props));
7712 }
7713
7714 Button.prototype.render = function render() {
7715 var _props = this.props,
7716 colors = _props.colors,
7717 shape = _props.shape,
7718 disabled = _props.disabled,
7719 className = _props.className,
7720 size = _props.size,
7721 bordered = _props.bordered,
7722 children = _props.children,
7723 htmlType = _props.htmlType,
7724 clsPrefix = _props.clsPrefix,
7725 isSubmit = _props.isSubmit,
7726 others = _objectWithoutProperties(_props, ['colors', 'shape', 'disabled', 'className', 'size', 'bordered', 'children', 'htmlType', 'clsPrefix', 'isSubmit']);
7727
7728 var clsObj = {};
7729 if (className) {
7730 clsObj[className] = true;
7731 }
7732 if (sizeMap[size]) {
7733 clsObj[clsPrefix + '-' + sizeMap[size]] = true;
7734 }
7735
7736 if (shapeMap[shape]) {
7737 clsObj[clsPrefix + '-' + shapeMap[shape]] = true;
7738 }
7739 if (colorsMap[colors]) {
7740 clsObj[clsPrefix + '-' + colorsMap[colors]] = true;
7741 }
7742 //clsObj[`${clsPrefix}-border`] = bordered;
7743 var classes = (0, _classnames2["default"])(clsPrefix, clsObj);
7744 return _react2["default"].createElement(
7745 'button',
7746 _extends({
7747 type: htmlType,
7748 className: classes,
7749 disabled: disabled
7750 }, others),
7751 this.props.children
7752 );
7753 };
7754
7755 return Button;
7756 }(_react.Component);
7757
7758 Button.propTypes = propTypes;
7759 Button.defaultProps = defaultProps;
7760
7761 exports["default"] = Button;
7762 module.exports = exports['default'];
7763
7764/***/ }),
7765/* 80 */
7766/***/ (function(module, exports, __webpack_require__) {
7767
7768 'use strict';
7769
7770 Object.defineProperty(exports, "__esModule", {
7771 value: true
7772 });
7773
7774 var _Viewer = __webpack_require__(81);
7775
7776 var _Viewer2 = _interopRequireDefault(_Viewer);
7777
7778 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
7779
7780 exports['default'] = _Viewer2['default'];
7781 module.exports = exports['default'];
7782
7783/***/ }),
7784/* 81 */
7785/***/ (function(module, exports, __webpack_require__) {
7786
7787 'use strict';
7788
7789 Object.defineProperty(exports, "__esModule", {
7790 value: true
7791 });
7792
7793 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; };
7794
7795 var _react = __webpack_require__(4);
7796
7797 var _react2 = _interopRequireDefault(_react);
7798
7799 var _reactDom = __webpack_require__(12);
7800
7801 var _reactDom2 = _interopRequireDefault(_reactDom);
7802
7803 var _propTypes = __webpack_require__(5);
7804
7805 var _propTypes2 = _interopRequireDefault(_propTypes);
7806
7807 var _viewerjs = __webpack_require__(82);
7808
7809 var _viewerjs2 = _interopRequireDefault(_viewerjs);
7810
7811 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
7812
7813 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; }
7814
7815 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
7816
7817 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; }
7818
7819 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); }
7820
7821 var propTypes = {
7822 ready: _propTypes2['default'].func,
7823 show: _propTypes2['default'].func,
7824 shown: _propTypes2['default'].func,
7825 hide: _propTypes2['default'].func,
7826 hidden: _propTypes2['default'].func,
7827 view: _propTypes2['default'].func,
7828 viewed: _propTypes2['default'].func,
7829 zoom: _propTypes2['default'].func,
7830 zoomed: _propTypes2['default'].func
7831 };
7832 var defaultProps = {
7833 ready: function ready() {},
7834 show: function show() {},
7835 shown: function shown() {},
7836 hide: function hide() {},
7837 hidden: function hidden() {},
7838 view: function view() {},
7839 viewed: function viewed() {},
7840 zoom: function zoom() {},
7841 zoomed: function zoomed() {}
7842 };
7843
7844 var Viewer = function (_Component) {
7845 _inherits(Viewer, _Component);
7846
7847 function Viewer(props) {
7848 _classCallCheck(this, Viewer);
7849
7850 return _possibleConstructorReturn(this, _Component.call(this, props));
7851 }
7852
7853 Viewer.prototype.componentDidMount = function componentDidMount() {
7854 this.viewerCase = new _viewerjs2['default'](_reactDom2['default'].findDOMNode(this.refs.views), _extends({
7855 url: 'data-original'
7856 }, this.props));
7857 };
7858
7859 Viewer.prototype.componentWillUnmount = function componentWillUnmount() {
7860 this.viewerCase.destroy();
7861 };
7862
7863 Viewer.prototype.render = function render() {
7864 return _react2['default'].createElement(
7865 'div',
7866 null,
7867 _react2['default'].cloneElement(this.props.children, {
7868 ref: 'views'
7869 })
7870 );
7871 };
7872
7873 return Viewer;
7874 }(_react.Component);
7875
7876 ;
7877
7878 Viewer.propTypes = propTypes;
7879 Viewer.defaultProps = defaultProps;
7880
7881 exports['default'] = Viewer;
7882 module.exports = exports['default'];
7883
7884/***/ }),
7885/* 82 */
7886/***/ (function(module, exports) {
7887
7888 /*!
7889 * Viewer.js v1.3.0
7890 * https://fengyuanchen.github.io/viewerjs
7891 *
7892 * Copyright 2015-present Chen Fengyuan
7893 * Released under the MIT license
7894 *
7895 * Date: 2018-10-25T12:41:54.899Z
7896 */
7897
7898 'use strict';
7899
7900 function _typeof(obj) {
7901 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
7902 _typeof = function (obj) {
7903 return typeof obj;
7904 };
7905 } else {
7906 _typeof = function (obj) {
7907 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
7908 };
7909 }
7910
7911 return _typeof(obj);
7912 }
7913
7914 function _classCallCheck(instance, Constructor) {
7915 if (!(instance instanceof Constructor)) {
7916 throw new TypeError("Cannot call a class as a function");
7917 }
7918 }
7919
7920 function _defineProperties(target, props) {
7921 for (var i = 0; i < props.length; i++) {
7922 var descriptor = props[i];
7923 descriptor.enumerable = descriptor.enumerable || false;
7924 descriptor.configurable = true;
7925 if ("value" in descriptor) descriptor.writable = true;
7926 Object.defineProperty(target, descriptor.key, descriptor);
7927 }
7928 }
7929
7930 function _createClass(Constructor, protoProps, staticProps) {
7931 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
7932 if (staticProps) _defineProperties(Constructor, staticProps);
7933 return Constructor;
7934 }
7935
7936 var DEFAULTS = {
7937 /**
7938 * Enable a modal backdrop, specify `static` for a backdrop
7939 * which doesn't close the modal on click.
7940 * @type {boolean}
7941 */
7942 backdrop: true,
7943
7944 /**
7945 * Show the button on the top-right of the viewer.
7946 * @type {boolean}
7947 */
7948 button: true,
7949
7950 /**
7951 * Show the navbar.
7952 * @type {boolean | number}
7953 */
7954 navbar: true,
7955
7956 /**
7957 * Specify the visibility and the content of the title.
7958 * @type {boolean | number | Function | Array}
7959 */
7960 title: true,
7961
7962 /**
7963 * Show the toolbar.
7964 * @type {boolean | number | Object}
7965 */
7966 toolbar: true,
7967
7968 /**
7969 * Custom class name(s) to add to the viewer's root element.
7970 * @type {string}
7971 */
7972 className: '',
7973
7974 /**
7975 * Define where to put the viewer in modal mode.
7976 * @type {string | Element}
7977 */
7978 container: 'body',
7979
7980 /**
7981 * Filter the images for viewing. Return true if the image is viewable.
7982 * @type {Function}
7983 */
7984 filter: null,
7985
7986 /**
7987 * Enable to request fullscreen when play.
7988 * @type {boolean}
7989 */
7990 fullscreen: true,
7991
7992 /**
7993 * Define the initial index of image for viewing.
7994 * @type {number}
7995 */
7996 initialViewIndex: 0,
7997
7998 /**
7999 * Enable inline mode.
8000 * @type {boolean}
8001 */
8002 inline: false,
8003
8004 /**
8005 * The amount of time to delay between automatically cycling an image when playing.
8006 * @type {number}
8007 */
8008 interval: 5000,
8009
8010 /**
8011 * Enable keyboard support.
8012 * @type {boolean}
8013 */
8014 keyboard: true,
8015
8016 /**
8017 * Indicate if show a loading spinner when load image or not.
8018 * @type {boolean}
8019 */
8020 loading: true,
8021
8022 /**
8023 * Indicate if enable loop viewing or not.
8024 * @type {boolean}
8025 */
8026 loop: true,
8027
8028 /**
8029 * Min width of the viewer in inline mode.
8030 * @type {number}
8031 */
8032 minWidth: 200,
8033
8034 /**
8035 * Min height of the viewer in inline mode.
8036 * @type {number}
8037 */
8038 minHeight: 100,
8039
8040 /**
8041 * Enable to move the image.
8042 * @type {boolean}
8043 */
8044 movable: true,
8045
8046 /**
8047 * Enable to zoom the image.
8048 * @type {boolean}
8049 */
8050 zoomable: true,
8051
8052 /**
8053 * Enable to rotate the image.
8054 * @type {boolean}
8055 */
8056 rotatable: true,
8057
8058 /**
8059 * Enable to scale the image.
8060 * @type {boolean}
8061 */
8062 scalable: true,
8063
8064 /**
8065 * Indicate if toggle the image size between its natural size
8066 * and initial size when double click on the image or not.
8067 * @type {boolean}
8068 */
8069 toggleOnDblclick: true,
8070
8071 /**
8072 * Show the tooltip with image ratio (percentage) when zoom in or zoom out.
8073 * @type {boolean}
8074 */
8075 tooltip: true,
8076
8077 /**
8078 * Enable CSS3 Transition for some special elements.
8079 * @type {boolean}
8080 */
8081 transition: true,
8082
8083 /**
8084 * Define the CSS `z-index` value of viewer in modal mode.
8085 * @type {number}
8086 */
8087 zIndex: 2015,
8088
8089 /**
8090 * Define the CSS `z-index` value of viewer in inline mode.
8091 * @type {number}
8092 */
8093 zIndexInline: 0,
8094
8095 /**
8096 * Define the ratio when zoom the image by wheeling mouse.
8097 * @type {number}
8098 */
8099 zoomRatio: 0.1,
8100
8101 /**
8102 * Define the min ratio of the image when zoom out.
8103 * @type {number}
8104 */
8105 minZoomRatio: 0.01,
8106
8107 /**
8108 * Define the max ratio of the image when zoom in.
8109 * @type {number}
8110 */
8111 maxZoomRatio: 100,
8112
8113 /**
8114 * Define where to get the original image URL for viewing.
8115 * @type {string | Function}
8116 */
8117 url: 'src',
8118
8119 /**
8120 * Event shortcuts.
8121 * @type {Function}
8122 */
8123 ready: null,
8124 show: null,
8125 shown: null,
8126 hide: null,
8127 hidden: null,
8128 view: null,
8129 viewed: null,
8130 zoom: null,
8131 zoomed: null
8132 };
8133
8134 var TEMPLATE = '<div class="viewer-container" touch-action="none">' + '<div class="viewer-canvas"></div>' + '<div class="viewer-footer">' + '<div class="viewer-title"></div>' + '<div class="viewer-toolbar"></div>' + '<div class="viewer-navbar">' + '<ul class="viewer-list"></ul>' + '</div>' + '</div>' + '<div class="viewer-tooltip"></div>' + '<div role="button" class="viewer-button" data-viewer-action="mix"></div>' + '<div class="viewer-player"></div>' + '</div>';
8135
8136 var IN_BROWSER = typeof window !== 'undefined';
8137 var WINDOW = IN_BROWSER ? window : {};
8138 var NAMESPACE = 'viewer'; // Actions
8139
8140 var ACTION_MOVE = 'move';
8141 var ACTION_SWITCH = 'switch';
8142 var ACTION_ZOOM = 'zoom'; // Classes
8143
8144 var CLASS_ACTIVE = "".concat(NAMESPACE, "-active");
8145 var CLASS_CLOSE = "".concat(NAMESPACE, "-close");
8146 var CLASS_FADE = "".concat(NAMESPACE, "-fade");
8147 var CLASS_FIXED = "".concat(NAMESPACE, "-fixed");
8148 var CLASS_FULLSCREEN = "".concat(NAMESPACE, "-fullscreen");
8149 var CLASS_FULLSCREEN_EXIT = "".concat(NAMESPACE, "-fullscreen-exit");
8150 var CLASS_HIDE = "".concat(NAMESPACE, "-hide");
8151 var CLASS_HIDE_MD_DOWN = "".concat(NAMESPACE, "-hide-md-down");
8152 var CLASS_HIDE_SM_DOWN = "".concat(NAMESPACE, "-hide-sm-down");
8153 var CLASS_HIDE_XS_DOWN = "".concat(NAMESPACE, "-hide-xs-down");
8154 var CLASS_IN = "".concat(NAMESPACE, "-in");
8155 var CLASS_INVISIBLE = "".concat(NAMESPACE, "-invisible");
8156 var CLASS_LOADING = "".concat(NAMESPACE, "-loading");
8157 var CLASS_MOVE = "".concat(NAMESPACE, "-move");
8158 var CLASS_OPEN = "".concat(NAMESPACE, "-open");
8159 var CLASS_SHOW = "".concat(NAMESPACE, "-show");
8160 var CLASS_TRANSITION = "".concat(NAMESPACE, "-transition"); // Events
8161
8162 var EVENT_CLICK = 'click';
8163 var EVENT_DBLCLICK = 'dblclick';
8164 var EVENT_DRAG_START = 'dragstart';
8165 var EVENT_HIDDEN = 'hidden';
8166 var EVENT_HIDE = 'hide';
8167 var EVENT_KEY_DOWN = 'keydown';
8168 var EVENT_LOAD = 'load';
8169 var EVENT_POINTER_DOWN = WINDOW.PointerEvent ? 'pointerdown' : 'touchstart mousedown';
8170 var EVENT_POINTER_MOVE = WINDOW.PointerEvent ? 'pointermove' : 'touchmove mousemove';
8171 var EVENT_POINTER_UP = WINDOW.PointerEvent ? 'pointerup pointercancel' : 'touchend touchcancel mouseup';
8172 var EVENT_READY = 'ready';
8173 var EVENT_RESIZE = 'resize';
8174 var EVENT_SHOW = 'show';
8175 var EVENT_SHOWN = 'shown';
8176 var EVENT_TRANSITION_END = 'transitionend';
8177 var EVENT_VIEW = 'view';
8178 var EVENT_VIEWED = 'viewed';
8179 var EVENT_WHEEL = 'wheel mousewheel DOMMouseScroll';
8180 var EVENT_ZOOM = 'zoom';
8181 var EVENT_ZOOMED = 'zoomed'; // Data keys
8182
8183 var DATA_ACTION = "".concat(NAMESPACE, "Action");
8184 var BUTTONS = ['zoom-in', 'zoom-out', 'one-to-one', 'reset', 'prev', 'play', 'next', 'rotate-left', 'rotate-right', 'flip-horizontal', 'flip-vertical']; // RegExps
8185
8186 var REGEXP_SPACES = /\s\s*/;
8187
8188 /**
8189 * Check if the given value is a string.
8190 * @param {*} value - The value to check.
8191 * @returns {boolean} Returns `true` if the given value is a string, else `false`.
8192 */
8193
8194 function isString(value) {
8195 return typeof value === 'string';
8196 }
8197 /**
8198 * Check if the given value is not a number.
8199 */
8200
8201 var isNaN = Number.isNaN || WINDOW.isNaN;
8202 /**
8203 * Check if the given value is a number.
8204 * @param {*} value - The value to check.
8205 * @returns {boolean} Returns `true` if the given value is a number, else `false`.
8206 */
8207
8208 function isNumber(value) {
8209 return typeof value === 'number' && !isNaN(value);
8210 }
8211 /**
8212 * Check if the given value is undefined.
8213 * @param {*} value - The value to check.
8214 * @returns {boolean} Returns `true` if the given value is undefined, else `false`.
8215 */
8216
8217 function isUndefined(value) {
8218 return typeof value === 'undefined';
8219 }
8220 /**
8221 * Check if the given value is an object.
8222 * @param {*} value - The value to check.
8223 * @returns {boolean} Returns `true` if the given value is an object, else `false`.
8224 */
8225
8226 function isObject(value) {
8227 return _typeof(value) === 'object' && value !== null;
8228 }
8229 var hasOwnProperty = Object.prototype.hasOwnProperty;
8230 /**
8231 * Check if the given value is a plain object.
8232 * @param {*} value - The value to check.
8233 * @returns {boolean} Returns `true` if the given value is a plain object, else `false`.
8234 */
8235
8236 function isPlainObject(value) {
8237 if (!isObject(value)) {
8238 return false;
8239 }
8240
8241 try {
8242 var _constructor = value.constructor;
8243 var prototype = _constructor.prototype;
8244 return _constructor && prototype && hasOwnProperty.call(prototype, 'isPrototypeOf');
8245 } catch (e) {
8246 return false;
8247 }
8248 }
8249 /**
8250 * Check if the given value is a function.
8251 * @param {*} value - The value to check.
8252 * @returns {boolean} Returns `true` if the given value is a function, else `false`.
8253 */
8254
8255 function isFunction(value) {
8256 return typeof value === 'function';
8257 }
8258 /**
8259 * Iterate the given data.
8260 * @param {*} data - The data to iterate.
8261 * @param {Function} callback - The process function for each element.
8262 * @returns {*} The original data.
8263 */
8264
8265 function forEach(data, callback) {
8266 if (data && isFunction(callback)) {
8267 if (Array.isArray(data) || isNumber(data.length)
8268 /* array-like */
8269 ) {
8270 var length = data.length;
8271 var i;
8272
8273 for (i = 0; i < length; i += 1) {
8274 if (callback.call(data, data[i], i, data) === false) {
8275 break;
8276 }
8277 }
8278 } else if (isObject(data)) {
8279 Object.keys(data).forEach(function (key) {
8280 callback.call(data, data[key], key, data);
8281 });
8282 }
8283 }
8284
8285 return data;
8286 }
8287 /**
8288 * Extend the given object.
8289 * @param {*} obj - The object to be extended.
8290 * @param {*} args - The rest objects which will be merged to the first object.
8291 * @returns {Object} The extended object.
8292 */
8293
8294 var assign = Object.assign || function assign(obj) {
8295 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
8296 args[_key - 1] = arguments[_key];
8297 }
8298
8299 if (isObject(obj) && args.length > 0) {
8300 args.forEach(function (arg) {
8301 if (isObject(arg)) {
8302 Object.keys(arg).forEach(function (key) {
8303 obj[key] = arg[key];
8304 });
8305 }
8306 });
8307 }
8308
8309 return obj;
8310 };
8311 var REGEXP_SUFFIX = /^(?:width|height|left|top|marginLeft|marginTop)$/;
8312 /**
8313 * Apply styles to the given element.
8314 * @param {Element} element - The target element.
8315 * @param {Object} styles - The styles for applying.
8316 */
8317
8318 function setStyle(element, styles) {
8319 var style = element.style;
8320 forEach(styles, function (value, property) {
8321 if (REGEXP_SUFFIX.test(property) && isNumber(value)) {
8322 value += 'px';
8323 }
8324
8325 style[property] = value;
8326 });
8327 }
8328 /**
8329 * Check if the given element has a special class.
8330 * @param {Element} element - The element to check.
8331 * @param {string} value - The class to search.
8332 * @returns {boolean} Returns `true` if the special class was found.
8333 */
8334
8335 function hasClass(element, value) {
8336 return element.classList ? element.classList.contains(value) : element.className.indexOf(value) > -1;
8337 }
8338 /**
8339 * Add classes to the given element.
8340 * @param {Element} element - The target element.
8341 * @param {string} value - The classes to be added.
8342 */
8343
8344 function addClass(element, value) {
8345 if (!value) {
8346 return;
8347 }
8348
8349 if (isNumber(element.length)) {
8350 forEach(element, function (elem) {
8351 addClass(elem, value);
8352 });
8353 return;
8354 }
8355
8356 if (element.classList) {
8357 element.classList.add(value);
8358 return;
8359 }
8360
8361 var className = element.className.trim();
8362
8363 if (!className) {
8364 element.className = value;
8365 } else if (className.indexOf(value) < 0) {
8366 element.className = "".concat(className, " ").concat(value);
8367 }
8368 }
8369 /**
8370 * Remove classes from the given element.
8371 * @param {Element} element - The target element.
8372 * @param {string} value - The classes to be removed.
8373 */
8374
8375 function removeClass(element, value) {
8376 if (!value) {
8377 return;
8378 }
8379
8380 if (isNumber(element.length)) {
8381 forEach(element, function (elem) {
8382 removeClass(elem, value);
8383 });
8384 return;
8385 }
8386
8387 if (element.classList) {
8388 element.classList.remove(value);
8389 return;
8390 }
8391
8392 if (element.className.indexOf(value) >= 0) {
8393 element.className = element.className.replace(value, '');
8394 }
8395 }
8396 /**
8397 * Add or remove classes from the given element.
8398 * @param {Element} element - The target element.
8399 * @param {string} value - The classes to be toggled.
8400 * @param {boolean} added - Add only.
8401 */
8402
8403 function toggleClass(element, value, added) {
8404 if (!value) {
8405 return;
8406 }
8407
8408 if (isNumber(element.length)) {
8409 forEach(element, function (elem) {
8410 toggleClass(elem, value, added);
8411 });
8412 return;
8413 } // IE10-11 doesn't support the second parameter of `classList.toggle`
8414
8415
8416 if (added) {
8417 addClass(element, value);
8418 } else {
8419 removeClass(element, value);
8420 }
8421 }
8422 var REGEXP_HYPHENATE = /([a-z\d])([A-Z])/g;
8423 /**
8424 * Transform the given string from camelCase to kebab-case
8425 * @param {string} value - The value to transform.
8426 * @returns {string} The transformed value.
8427 */
8428
8429 function hyphenate(value) {
8430 return value.replace(REGEXP_HYPHENATE, '$1-$2').toLowerCase();
8431 }
8432 /**
8433 * Get data from the given element.
8434 * @param {Element} element - The target element.
8435 * @param {string} name - The data key to get.
8436 * @returns {string} The data value.
8437 */
8438
8439 function getData(element, name) {
8440 if (isObject(element[name])) {
8441 return element[name];
8442 }
8443
8444 if (element.dataset) {
8445 return element.dataset[name];
8446 }
8447
8448 return element.getAttribute("data-".concat(hyphenate(name)));
8449 }
8450 /**
8451 * Set data to the given element.
8452 * @param {Element} element - The target element.
8453 * @param {string} name - The data key to set.
8454 * @param {string} data - The data value.
8455 */
8456
8457 function setData(element, name, data) {
8458 if (isObject(data)) {
8459 element[name] = data;
8460 } else if (element.dataset) {
8461 element.dataset[name] = data;
8462 } else {
8463 element.setAttribute("data-".concat(hyphenate(name)), data);
8464 }
8465 }
8466
8467 var onceSupported = function () {
8468 var supported = false;
8469
8470 if (IN_BROWSER) {
8471 var once = false;
8472
8473 var listener = function listener() {};
8474
8475 var options = Object.defineProperty({}, 'once', {
8476 get: function get() {
8477 supported = true;
8478 return once;
8479 },
8480
8481 /**
8482 * This setter can fix a `TypeError` in strict mode
8483 * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Getter_only}
8484 * @param {boolean} value - The value to set
8485 */
8486 set: function set(value) {
8487 once = value;
8488 }
8489 });
8490 WINDOW.addEventListener('test', listener, options);
8491 WINDOW.removeEventListener('test', listener, options);
8492 }
8493
8494 return supported;
8495 }();
8496 /**
8497 * Remove event listener from the target element.
8498 * @param {Element} element - The event target.
8499 * @param {string} type - The event type(s).
8500 * @param {Function} listener - The event listener.
8501 * @param {Object} options - The event options.
8502 */
8503
8504
8505 function removeListener(element, type, listener) {
8506 var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
8507 var handler = listener;
8508 type.trim().split(REGEXP_SPACES).forEach(function (event) {
8509 if (!onceSupported) {
8510 var listeners = element.listeners;
8511
8512 if (listeners && listeners[event] && listeners[event][listener]) {
8513 handler = listeners[event][listener];
8514 delete listeners[event][listener];
8515
8516 if (Object.keys(listeners[event]).length === 0) {
8517 delete listeners[event];
8518 }
8519
8520 if (Object.keys(listeners).length === 0) {
8521 delete element.listeners;
8522 }
8523 }
8524 }
8525
8526 element.removeEventListener(event, handler, options);
8527 });
8528 }
8529 /**
8530 * Add event listener to the target element.
8531 * @param {Element} element - The event target.
8532 * @param {string} type - The event type(s).
8533 * @param {Function} listener - The event listener.
8534 * @param {Object} options - The event options.
8535 */
8536
8537 function addListener(element, type, listener) {
8538 var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
8539 var _handler = listener;
8540 type.trim().split(REGEXP_SPACES).forEach(function (event) {
8541 if (options.once && !onceSupported) {
8542 var _element$listeners = element.listeners,
8543 listeners = _element$listeners === void 0 ? {} : _element$listeners;
8544
8545 _handler = function handler() {
8546 delete listeners[event][listener];
8547 element.removeEventListener(event, _handler, options);
8548
8549 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
8550 args[_key2] = arguments[_key2];
8551 }
8552
8553 listener.apply(element, args);
8554 };
8555
8556 if (!listeners[event]) {
8557 listeners[event] = {};
8558 }
8559
8560 if (listeners[event][listener]) {
8561 element.removeEventListener(event, listeners[event][listener], options);
8562 }
8563
8564 listeners[event][listener] = _handler;
8565 element.listeners = listeners;
8566 }
8567
8568 element.addEventListener(event, _handler, options);
8569 });
8570 }
8571 /**
8572 * Dispatch event on the target element.
8573 * @param {Element} element - The event target.
8574 * @param {string} type - The event type(s).
8575 * @param {Object} data - The additional event data.
8576 * @returns {boolean} Indicate if the event is default prevented or not.
8577 */
8578
8579 function dispatchEvent(element, type, data) {
8580 var event; // Event and CustomEvent on IE9-11 are global objects, not constructors
8581
8582 if (isFunction(Event) && isFunction(CustomEvent)) {
8583 event = new CustomEvent(type, {
8584 detail: data,
8585 bubbles: true,
8586 cancelable: true
8587 });
8588 } else {
8589 event = document.createEvent('CustomEvent');
8590 event.initCustomEvent(type, true, true, data);
8591 }
8592
8593 return element.dispatchEvent(event);
8594 }
8595 /**
8596 * Get the offset base on the document.
8597 * @param {Element} element - The target element.
8598 * @returns {Object} The offset data.
8599 */
8600
8601 function getOffset(element) {
8602 var box = element.getBoundingClientRect();
8603 return {
8604 left: box.left + (window.pageXOffset - document.documentElement.clientLeft),
8605 top: box.top + (window.pageYOffset - document.documentElement.clientTop)
8606 };
8607 }
8608 /**
8609 * Get transforms base on the given object.
8610 * @param {Object} obj - The target object.
8611 * @returns {string} A string contains transform values.
8612 */
8613
8614 function getTransforms(_ref) {
8615 var rotate = _ref.rotate,
8616 scaleX = _ref.scaleX,
8617 scaleY = _ref.scaleY,
8618 translateX = _ref.translateX,
8619 translateY = _ref.translateY;
8620 var values = [];
8621
8622 if (isNumber(translateX) && translateX !== 0) {
8623 values.push("translateX(".concat(translateX, "px)"));
8624 }
8625
8626 if (isNumber(translateY) && translateY !== 0) {
8627 values.push("translateY(".concat(translateY, "px)"));
8628 } // Rotate should come first before scale to match orientation transform
8629
8630
8631 if (isNumber(rotate) && rotate !== 0) {
8632 values.push("rotate(".concat(rotate, "deg)"));
8633 }
8634
8635 if (isNumber(scaleX) && scaleX !== 1) {
8636 values.push("scaleX(".concat(scaleX, ")"));
8637 }
8638
8639 if (isNumber(scaleY) && scaleY !== 1) {
8640 values.push("scaleY(".concat(scaleY, ")"));
8641 }
8642
8643 var transform = values.length ? values.join(' ') : 'none';
8644 return {
8645 WebkitTransform: transform,
8646 msTransform: transform,
8647 transform: transform
8648 };
8649 }
8650 /**
8651 * Get an image name from an image url.
8652 * @param {string} url - The target url.
8653 * @example
8654 * // picture.jpg
8655 * getImageNameFromURL('http://domain.com/path/to/picture.jpg?size=1280×960')
8656 * @returns {string} A string contains the image name.
8657 */
8658
8659 function getImageNameFromURL(url) {
8660 return isString(url) ? url.replace(/^.*\//, '').replace(/[?&#].*$/, '') : '';
8661 }
8662 var IS_SAFARI = WINDOW.navigator && /(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(WINDOW.navigator.userAgent);
8663 /**
8664 * Get an image's natural sizes.
8665 * @param {string} image - The target image.
8666 * @param {Function} callback - The callback function.
8667 * @returns {HTMLImageElement} The new image.
8668 */
8669
8670 function getImageNaturalSizes(image, callback) {
8671 var newImage = document.createElement('img'); // Modern browsers (except Safari)
8672
8673 if (image.naturalWidth && !IS_SAFARI) {
8674 callback(image.naturalWidth, image.naturalHeight);
8675 return newImage;
8676 }
8677
8678 var body = document.body || document.documentElement;
8679
8680 newImage.onload = function () {
8681 callback(newImage.width, newImage.height);
8682
8683 if (!IS_SAFARI) {
8684 body.removeChild(newImage);
8685 }
8686 };
8687
8688 newImage.src = image.src; // iOS Safari will convert the image automatically
8689 // with its orientation once append it into DOM
8690
8691 if (!IS_SAFARI) {
8692 newImage.style.cssText = 'left:0;' + 'max-height:none!important;' + 'max-width:none!important;' + 'min-height:0!important;' + 'min-width:0!important;' + 'opacity:0;' + 'position:absolute;' + 'top:0;' + 'z-index:-1;';
8693 body.appendChild(newImage);
8694 }
8695
8696 return newImage;
8697 }
8698 /**
8699 * Get the related class name of a responsive type number.
8700 * @param {string} type - The responsive type.
8701 * @returns {string} The related class name.
8702 */
8703
8704 function getResponsiveClass(type) {
8705 switch (type) {
8706 case 2:
8707 return CLASS_HIDE_XS_DOWN;
8708
8709 case 3:
8710 return CLASS_HIDE_SM_DOWN;
8711
8712 case 4:
8713 return CLASS_HIDE_MD_DOWN;
8714
8715 default:
8716 return '';
8717 }
8718 }
8719 /**
8720 * Get the max ratio of a group of pointers.
8721 * @param {string} pointers - The target pointers.
8722 * @returns {number} The result ratio.
8723 */
8724
8725 function getMaxZoomRatio(pointers) {
8726 var pointers2 = assign({}, pointers);
8727 var ratios = [];
8728 forEach(pointers, function (pointer, pointerId) {
8729 delete pointers2[pointerId];
8730 forEach(pointers2, function (pointer2) {
8731 var x1 = Math.abs(pointer.startX - pointer2.startX);
8732 var y1 = Math.abs(pointer.startY - pointer2.startY);
8733 var x2 = Math.abs(pointer.endX - pointer2.endX);
8734 var y2 = Math.abs(pointer.endY - pointer2.endY);
8735 var z1 = Math.sqrt(x1 * x1 + y1 * y1);
8736 var z2 = Math.sqrt(x2 * x2 + y2 * y2);
8737 var ratio = (z2 - z1) / z1;
8738 ratios.push(ratio);
8739 });
8740 });
8741 ratios.sort(function (a, b) {
8742 return Math.abs(a) < Math.abs(b);
8743 });
8744 return ratios[0];
8745 }
8746 /**
8747 * Get a pointer from an event object.
8748 * @param {Object} event - The target event object.
8749 * @param {boolean} endOnly - Indicates if only returns the end point coordinate or not.
8750 * @returns {Object} The result pointer contains start and/or end point coordinates.
8751 */
8752
8753 function getPointer(_ref2, endOnly) {
8754 var pageX = _ref2.pageX,
8755 pageY = _ref2.pageY;
8756 var end = {
8757 endX: pageX,
8758 endY: pageY
8759 };
8760 return endOnly ? end : assign({
8761 startX: pageX,
8762 startY: pageY
8763 }, end);
8764 }
8765 /**
8766 * Get the center point coordinate of a group of pointers.
8767 * @param {Object} pointers - The target pointers.
8768 * @returns {Object} The center point coordinate.
8769 */
8770
8771 function getPointersCenter(pointers) {
8772 var pageX = 0;
8773 var pageY = 0;
8774 var count = 0;
8775 forEach(pointers, function (_ref3) {
8776 var startX = _ref3.startX,
8777 startY = _ref3.startY;
8778 pageX += startX;
8779 pageY += startY;
8780 count += 1;
8781 });
8782 pageX /= count;
8783 pageY /= count;
8784 return {
8785 pageX: pageX,
8786 pageY: pageY
8787 };
8788 }
8789
8790 var render = {
8791 render: function render() {
8792 this.initContainer();
8793 this.initViewer();
8794 this.initList();
8795 this.renderViewer();
8796 },
8797 initContainer: function initContainer() {
8798 this.containerData = {
8799 width: window.innerWidth,
8800 height: window.innerHeight
8801 };
8802 },
8803 initViewer: function initViewer() {
8804 var options = this.options,
8805 parent = this.parent;
8806 var viewerData;
8807
8808 if (options.inline) {
8809 viewerData = {
8810 width: Math.max(parent.offsetWidth, options.minWidth),
8811 height: Math.max(parent.offsetHeight, options.minHeight)
8812 };
8813 this.parentData = viewerData;
8814 }
8815
8816 if (this.fulled || !viewerData) {
8817 viewerData = this.containerData;
8818 }
8819
8820 this.viewerData = assign({}, viewerData);
8821 },
8822 renderViewer: function renderViewer() {
8823 if (this.options.inline && !this.fulled) {
8824 setStyle(this.viewer, this.viewerData);
8825 }
8826 },
8827 initList: function initList() {
8828 var _this = this;
8829
8830 var element = this.element,
8831 options = this.options,
8832 list = this.list;
8833 var items = [];
8834 forEach(this.images, function (image, i) {
8835 var src = image.src;
8836 var alt = image.alt || getImageNameFromURL(src);
8837 var url = options.url;
8838
8839 if (isString(url)) {
8840 url = image.getAttribute(url);
8841 } else if (isFunction(url)) {
8842 url = url.call(_this, image);
8843 }
8844
8845 if (src || url) {
8846 items.push('<li>' + '<img' + " src=\"".concat(src || url, "\"") + ' role="button"' + ' data-viewer-action="view"' + " data-index=\"".concat(i, "\"") + " data-original-url=\"".concat(url || src, "\"") + " alt=\"".concat(alt, "\"") + '>' + '</li>');
8847 }
8848 });
8849 list.innerHTML = items.join('');
8850 this.items = list.getElementsByTagName('li');
8851 forEach(this.items, function (item) {
8852 var image = item.firstElementChild;
8853 setData(image, 'filled', true);
8854
8855 if (options.loading) {
8856 addClass(item, CLASS_LOADING);
8857 }
8858
8859 addListener(image, EVENT_LOAD, function (event) {
8860 if (options.loading) {
8861 removeClass(item, CLASS_LOADING);
8862 }
8863
8864 _this.loadImage(event);
8865 }, {
8866 once: true
8867 });
8868 });
8869
8870 if (options.transition) {
8871 addListener(element, EVENT_VIEWED, function () {
8872 addClass(list, CLASS_TRANSITION);
8873 }, {
8874 once: true
8875 });
8876 }
8877 },
8878 renderList: function renderList(index) {
8879 var i = index || this.index;
8880 var width = this.items[i].offsetWidth || 30;
8881 var outerWidth = width + 1; // 1 pixel of `margin-left` width
8882 // Place the active item in the center of the screen
8883
8884 setStyle(this.list, assign({
8885 width: outerWidth * this.length
8886 }, getTransforms({
8887 translateX: (this.viewerData.width - width) / 2 - outerWidth * i
8888 })));
8889 },
8890 resetList: function resetList() {
8891 var list = this.list;
8892 list.innerHTML = '';
8893 removeClass(list, CLASS_TRANSITION);
8894 setStyle(list, getTransforms({
8895 translateX: 0
8896 }));
8897 },
8898 initImage: function initImage(done) {
8899 var _this2 = this;
8900
8901 var options = this.options,
8902 image = this.image,
8903 viewerData = this.viewerData;
8904 var footerHeight = this.footer.offsetHeight;
8905 var viewerWidth = viewerData.width;
8906 var viewerHeight = Math.max(viewerData.height - footerHeight, footerHeight);
8907 var oldImageData = this.imageData || {};
8908 var sizingImage;
8909 this.imageInitializing = {
8910 abort: function abort() {
8911 sizingImage.onload = null;
8912 }
8913 };
8914 sizingImage = getImageNaturalSizes(image, function (naturalWidth, naturalHeight) {
8915 var aspectRatio = naturalWidth / naturalHeight;
8916 var width = viewerWidth;
8917 var height = viewerHeight;
8918 _this2.imageInitializing = false;
8919
8920 if (viewerHeight * aspectRatio > viewerWidth) {
8921 height = viewerWidth / aspectRatio;
8922 } else {
8923 width = viewerHeight * aspectRatio;
8924 }
8925
8926 width = Math.min(width * 0.9, naturalWidth);
8927 height = Math.min(height * 0.9, naturalHeight);
8928 var imageData = {
8929 naturalWidth: naturalWidth,
8930 naturalHeight: naturalHeight,
8931 aspectRatio: aspectRatio,
8932 ratio: width / naturalWidth,
8933 width: width,
8934 height: height,
8935 left: (viewerWidth - width) / 2,
8936 top: (viewerHeight - height) / 2
8937 };
8938 var initialImageData = assign({}, imageData);
8939
8940 if (options.rotatable) {
8941 imageData.rotate = oldImageData.rotate || 0;
8942 initialImageData.rotate = 0;
8943 }
8944
8945 if (options.scalable) {
8946 imageData.scaleX = oldImageData.scaleX || 1;
8947 imageData.scaleY = oldImageData.scaleY || 1;
8948 initialImageData.scaleX = 1;
8949 initialImageData.scaleY = 1;
8950 }
8951
8952 _this2.imageData = imageData;
8953 _this2.initialImageData = initialImageData;
8954
8955 if (done) {
8956 done();
8957 }
8958 });
8959 },
8960 renderImage: function renderImage(done) {
8961 var _this3 = this;
8962
8963 var image = this.image,
8964 imageData = this.imageData;
8965 setStyle(image, assign({
8966 width: imageData.width,
8967 height: imageData.height,
8968 marginLeft: imageData.left,
8969 marginTop: imageData.top
8970 }, getTransforms(imageData)));
8971
8972 if (done) {
8973 if ((this.viewing || this.zooming) && this.options.transition) {
8974 var onTransitionEnd = function onTransitionEnd() {
8975 _this3.imageRendering = false;
8976 done();
8977 };
8978
8979 this.imageRendering = {
8980 abort: function abort() {
8981 removeListener(image, EVENT_TRANSITION_END, onTransitionEnd);
8982 }
8983 };
8984 addListener(image, EVENT_TRANSITION_END, onTransitionEnd, {
8985 once: true
8986 });
8987 } else {
8988 done();
8989 }
8990 }
8991 },
8992 resetImage: function resetImage() {
8993 // this.image only defined after viewed
8994 if (this.viewing || this.viewed) {
8995 var image = this.image;
8996
8997 if (this.viewing) {
8998 this.viewing.abort();
8999 }
9000
9001 image.parentNode.removeChild(image);
9002 this.image = null;
9003 }
9004 }
9005 };
9006
9007 var events = {
9008 bind: function bind() {
9009 var canvas = this.canvas,
9010 element = this.element,
9011 viewer = this.viewer;
9012 addListener(viewer, EVENT_CLICK, this.onClick = this.click.bind(this));
9013 addListener(viewer, EVENT_WHEEL, this.onWheel = this.wheel.bind(this));
9014 addListener(viewer, EVENT_DRAG_START, this.onDragStart = this.dragstart.bind(this));
9015
9016 if (this.options.toggleOnDblclick) {
9017 addListener(canvas, EVENT_DBLCLICK, this.onDblclick = this.dblclick.bind(this));
9018 }
9019
9020 addListener(canvas, EVENT_POINTER_DOWN, this.onPointerDown = this.pointerdown.bind(this));
9021 addListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onPointerMove = this.pointermove.bind(this));
9022 addListener(element.ownerDocument, EVENT_POINTER_UP, this.onPointerUp = this.pointerup.bind(this));
9023 addListener(element.ownerDocument, EVENT_KEY_DOWN, this.onKeyDown = this.keydown.bind(this));
9024 addListener(window, EVENT_RESIZE, this.onResize = this.resize.bind(this));
9025 },
9026 unbind: function unbind() {
9027 var canvas = this.canvas,
9028 element = this.element,
9029 viewer = this.viewer;
9030 removeListener(viewer, EVENT_CLICK, this.onClick);
9031 removeListener(viewer, EVENT_WHEEL, this.onWheel);
9032 removeListener(viewer, EVENT_DRAG_START, this.onDragStart);
9033
9034 if (this.options.toggleOnDblclick) {
9035 removeListener(canvas, EVENT_DBLCLICK, this.onDblclick);
9036 }
9037
9038 removeListener(canvas, EVENT_POINTER_DOWN, this.onPointerDown);
9039 removeListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onPointerMove);
9040 removeListener(element.ownerDocument, EVENT_POINTER_UP, this.onPointerUp);
9041 removeListener(element.ownerDocument, EVENT_KEY_DOWN, this.onKeyDown);
9042 removeListener(window, EVENT_RESIZE, this.onResize);
9043 }
9044 };
9045
9046 var handlers = {
9047 click: function click(_ref) {
9048 var target = _ref.target;
9049 var options = this.options,
9050 imageData = this.imageData;
9051 var action = getData(target, DATA_ACTION);
9052
9053 switch (action) {
9054 case 'mix':
9055 if (this.played) {
9056 this.stop();
9057 } else if (options.inline) {
9058 if (this.fulled) {
9059 this.exit();
9060 } else {
9061 this.full();
9062 }
9063 } else {
9064 this.hide();
9065 }
9066
9067 break;
9068
9069 case 'hide':
9070 this.hide();
9071 break;
9072
9073 case 'view':
9074 this.view(getData(target, 'index'));
9075 break;
9076
9077 case 'zoom-in':
9078 this.zoom(0.1, true);
9079 break;
9080
9081 case 'zoom-out':
9082 this.zoom(-0.1, true);
9083 break;
9084
9085 case 'one-to-one':
9086 this.toggle();
9087 break;
9088
9089 case 'reset':
9090 this.reset();
9091 break;
9092
9093 case 'prev':
9094 this.prev(options.loop);
9095 break;
9096
9097 case 'play':
9098 this.play(options.fullscreen);
9099 break;
9100
9101 case 'next':
9102 this.next(options.loop);
9103 break;
9104
9105 case 'rotate-left':
9106 this.rotate(-90);
9107 break;
9108
9109 case 'rotate-right':
9110 this.rotate(90);
9111 break;
9112
9113 case 'flip-horizontal':
9114 this.scaleX(-imageData.scaleX || -1);
9115 break;
9116
9117 case 'flip-vertical':
9118 this.scaleY(-imageData.scaleY || -1);
9119 break;
9120
9121 default:
9122 if (this.played) {
9123 this.stop();
9124 }
9125
9126 }
9127 },
9128 dblclick: function dblclick(event) {
9129 if (event.target.parentElement === this.canvas) {
9130 this.toggle();
9131 }
9132 },
9133 load: function load() {
9134 var _this = this;
9135
9136 if (this.timeout) {
9137 clearTimeout(this.timeout);
9138 this.timeout = false;
9139 }
9140
9141 var element = this.element,
9142 options = this.options,
9143 image = this.image,
9144 index = this.index,
9145 viewerData = this.viewerData;
9146 removeClass(image, CLASS_INVISIBLE);
9147
9148 if (options.loading) {
9149 removeClass(this.canvas, CLASS_LOADING);
9150 }
9151
9152 image.style.cssText = 'height:0;' + "margin-left:".concat(viewerData.width / 2, "px;") + "margin-top:".concat(viewerData.height / 2, "px;") + 'max-width:none!important;' + 'position:absolute;' + 'width:0;';
9153 this.initImage(function () {
9154 toggleClass(image, CLASS_MOVE, options.movable);
9155 toggleClass(image, CLASS_TRANSITION, options.transition);
9156
9157 _this.renderImage(function () {
9158 _this.viewed = true;
9159 _this.viewing = false;
9160
9161 if (isFunction(options.viewed)) {
9162 addListener(element, EVENT_VIEWED, options.viewed, {
9163 once: true
9164 });
9165 }
9166
9167 dispatchEvent(element, EVENT_VIEWED, {
9168 originalImage: _this.images[index],
9169 index: index,
9170 image: image
9171 });
9172 });
9173 });
9174 },
9175 loadImage: function loadImage(e) {
9176 var image = e.target;
9177 var parent = image.parentNode;
9178 var parentWidth = parent.offsetWidth || 30;
9179 var parentHeight = parent.offsetHeight || 50;
9180 var filled = !!getData(image, 'filled');
9181 getImageNaturalSizes(image, function (naturalWidth, naturalHeight) {
9182 var aspectRatio = naturalWidth / naturalHeight;
9183 var width = parentWidth;
9184 var height = parentHeight;
9185
9186 if (parentHeight * aspectRatio > parentWidth) {
9187 if (filled) {
9188 width = parentHeight * aspectRatio;
9189 } else {
9190 height = parentWidth / aspectRatio;
9191 }
9192 } else if (filled) {
9193 height = parentWidth / aspectRatio;
9194 } else {
9195 width = parentHeight * aspectRatio;
9196 }
9197
9198 setStyle(image, assign({
9199 width: width,
9200 height: height
9201 }, getTransforms({
9202 translateX: (parentWidth - width) / 2,
9203 translateY: (parentHeight - height) / 2
9204 })));
9205 });
9206 },
9207 keydown: function keydown(e) {
9208 var options = this.options;
9209
9210 if (!this.fulled || !options.keyboard) {
9211 return;
9212 }
9213
9214 switch (e.keyCode || e.which || e.charCode) {
9215 // Escape
9216 case 27:
9217 if (this.played) {
9218 this.stop();
9219 } else if (options.inline) {
9220 if (this.fulled) {
9221 this.exit();
9222 }
9223 } else {
9224 this.hide();
9225 }
9226
9227 break;
9228 // Space
9229
9230 case 32:
9231 if (this.played) {
9232 this.stop();
9233 }
9234
9235 break;
9236 // ArrowLeft
9237
9238 case 37:
9239 this.prev(options.loop);
9240 break;
9241 // ArrowUp
9242
9243 case 38:
9244 // Prevent scroll on Firefox
9245 e.preventDefault(); // Zoom in
9246
9247 this.zoom(options.zoomRatio, true);
9248 break;
9249 // ArrowRight
9250
9251 case 39:
9252 this.next(options.loop);
9253 break;
9254 // ArrowDown
9255
9256 case 40:
9257 // Prevent scroll on Firefox
9258 e.preventDefault(); // Zoom out
9259
9260 this.zoom(-options.zoomRatio, true);
9261 break;
9262 // Ctrl + 0
9263
9264 case 48: // Fall through
9265 // Ctrl + 1
9266 // eslint-disable-next-line no-fallthrough
9267
9268 case 49:
9269 if (e.ctrlKey) {
9270 e.preventDefault();
9271 this.toggle();
9272 }
9273
9274 break;
9275
9276 default:
9277 }
9278 },
9279 dragstart: function dragstart(e) {
9280 if (e.target.tagName.toLowerCase() === 'img') {
9281 e.preventDefault();
9282 }
9283 },
9284 pointerdown: function pointerdown(e) {
9285 var options = this.options,
9286 pointers = this.pointers;
9287
9288 if (!this.viewed || this.showing || this.viewing || this.hiding) {
9289 return;
9290 } // This line is required for preventing page zooming in iOS browsers
9291
9292
9293 e.preventDefault();
9294
9295 if (e.changedTouches) {
9296 forEach(e.changedTouches, function (touch) {
9297 pointers[touch.identifier] = getPointer(touch);
9298 });
9299 } else {
9300 pointers[e.pointerId || 0] = getPointer(e);
9301 }
9302
9303 var action = options.movable ? ACTION_MOVE : false;
9304
9305 if (Object.keys(pointers).length > 1) {
9306 action = ACTION_ZOOM;
9307 } else if ((e.pointerType === 'touch' || e.type === 'touchstart') && this.isSwitchable()) {
9308 action = ACTION_SWITCH;
9309 }
9310
9311 if (options.transition && (action === ACTION_MOVE || action === ACTION_ZOOM)) {
9312 removeClass(this.image, CLASS_TRANSITION);
9313 }
9314
9315 this.action = action;
9316 },
9317 pointermove: function pointermove(e) {
9318 var pointers = this.pointers,
9319 action = this.action;
9320
9321 if (!this.viewed || !action) {
9322 return;
9323 }
9324
9325 e.preventDefault();
9326
9327 if (e.changedTouches) {
9328 forEach(e.changedTouches, function (touch) {
9329 // // The first parameter should not be undefined in some browsers
9330 assign(pointers[touch.identifier] || {}, getPointer(touch, true));
9331 });
9332 } else {
9333 assign(pointers[e.pointerId || 0] || {}, getPointer(e, true));
9334 }
9335
9336 this.change(e);
9337 },
9338 pointerup: function pointerup(e) {
9339 var action = this.action,
9340 pointers = this.pointers;
9341
9342 if (e.changedTouches) {
9343 forEach(e.changedTouches, function (touch) {
9344 delete pointers[touch.identifier];
9345 });
9346 } else {
9347 delete pointers[e.pointerId || 0];
9348 }
9349
9350 if (!action) {
9351 return;
9352 }
9353
9354 e.preventDefault();
9355
9356 if (this.options.transition && (action === ACTION_MOVE || action === ACTION_ZOOM)) {
9357 addClass(this.image, CLASS_TRANSITION);
9358 }
9359
9360 this.action = false;
9361 },
9362 resize: function resize() {
9363 var _this2 = this;
9364
9365 if (!this.isShown || this.hiding) {
9366 return;
9367 }
9368
9369 this.initContainer();
9370 this.initViewer();
9371 this.renderViewer();
9372 this.renderList();
9373
9374 if (this.viewed) {
9375 this.initImage(function () {
9376 _this2.renderImage();
9377 });
9378 }
9379
9380 if (this.played) {
9381 if (this.options.fullscreen && this.fulled && !document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) {
9382 this.stop();
9383 return;
9384 }
9385
9386 forEach(this.player.getElementsByTagName('img'), function (image) {
9387 addListener(image, EVENT_LOAD, _this2.loadImage.bind(_this2), {
9388 once: true
9389 });
9390 dispatchEvent(image, EVENT_LOAD);
9391 });
9392 }
9393 },
9394 wheel: function wheel(e) {
9395 var _this3 = this;
9396
9397 if (!this.viewed) {
9398 return;
9399 }
9400
9401 e.preventDefault(); // Limit wheel speed to prevent zoom too fast
9402
9403 if (this.wheeling) {
9404 return;
9405 }
9406
9407 this.wheeling = true;
9408 setTimeout(function () {
9409 _this3.wheeling = false;
9410 }, 50);
9411 var ratio = Number(this.options.zoomRatio) || 0.1;
9412 var delta = 1;
9413
9414 if (e.deltaY) {
9415 delta = e.deltaY > 0 ? 1 : -1;
9416 } else if (e.wheelDelta) {
9417 delta = -e.wheelDelta / 120;
9418 } else if (e.detail) {
9419 delta = e.detail > 0 ? 1 : -1;
9420 }
9421
9422 this.zoom(-delta * ratio, true, e);
9423 }
9424 };
9425
9426 var methods = {
9427 /** Show the viewer (only available in modal mode)
9428 * @param {boolean} [immediate=false] - Indicates if show the viewer immediately or not.
9429 * @returns {Viewer} this
9430 */
9431 show: function show() {
9432 var immediate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
9433 var element = this.element,
9434 options = this.options;
9435
9436 if (options.inline || this.showing || this.isShown || this.showing) {
9437 return this;
9438 }
9439
9440 if (!this.ready) {
9441 this.build();
9442
9443 if (this.ready) {
9444 this.show(immediate);
9445 }
9446
9447 return this;
9448 }
9449
9450 if (isFunction(options.show)) {
9451 addListener(element, EVENT_SHOW, options.show, {
9452 once: true
9453 });
9454 }
9455
9456 if (dispatchEvent(element, EVENT_SHOW) === false || !this.ready) {
9457 return this;
9458 }
9459
9460 if (this.hiding) {
9461 this.transitioning.abort();
9462 }
9463
9464 this.showing = true;
9465 this.open();
9466 var viewer = this.viewer;
9467 removeClass(viewer, CLASS_HIDE);
9468
9469 if (options.transition && !immediate) {
9470 var shown = this.shown.bind(this);
9471 this.transitioning = {
9472 abort: function abort() {
9473 removeListener(viewer, EVENT_TRANSITION_END, shown);
9474 removeClass(viewer, CLASS_IN);
9475 }
9476 };
9477 addClass(viewer, CLASS_TRANSITION); // Force reflow to enable CSS3 transition
9478 // eslint-disable-next-line
9479
9480 viewer.offsetWidth;
9481 addListener(viewer, EVENT_TRANSITION_END, shown, {
9482 once: true
9483 });
9484 addClass(viewer, CLASS_IN);
9485 } else {
9486 addClass(viewer, CLASS_IN);
9487 this.shown();
9488 }
9489
9490 return this;
9491 },
9492
9493 /**
9494 * Hide the viewer (only available in modal mode)
9495 * @param {boolean} [immediate=false] - Indicates if hide the viewer immediately or not.
9496 * @returns {Viewer} this
9497 */
9498 hide: function hide() {
9499 var immediate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
9500 var element = this.element,
9501 options = this.options;
9502
9503 if (options.inline || this.hiding || !(this.isShown || this.showing)) {
9504 return this;
9505 }
9506
9507 if (isFunction(options.hide)) {
9508 addListener(element, EVENT_HIDE, options.hide, {
9509 once: true
9510 });
9511 }
9512
9513 if (dispatchEvent(element, EVENT_HIDE) === false) {
9514 return this;
9515 }
9516
9517 if (this.showing) {
9518 this.transitioning.abort();
9519 }
9520
9521 this.hiding = true;
9522
9523 if (this.played) {
9524 this.stop();
9525 } else if (this.viewing) {
9526 this.viewing.abort();
9527 }
9528
9529 var viewer = this.viewer;
9530
9531 if (options.transition && !immediate) {
9532 var hidden = this.hidden.bind(this);
9533
9534 var hide = function hide() {
9535 addListener(viewer, EVENT_TRANSITION_END, hidden, {
9536 once: true
9537 });
9538 removeClass(viewer, CLASS_IN);
9539 };
9540
9541 this.transitioning = {
9542 abort: function abort() {
9543 if (this.viewed) {
9544 removeListener(this.image, EVENT_TRANSITION_END, hide);
9545 } else {
9546 removeListener(viewer, EVENT_TRANSITION_END, hidden);
9547 }
9548 }
9549 };
9550
9551 if (this.viewed) {
9552 addListener(this.image, EVENT_TRANSITION_END, hide, {
9553 once: true
9554 });
9555 this.zoomTo(0, false, false, true);
9556 } else {
9557 hide();
9558 }
9559 } else {
9560 removeClass(viewer, CLASS_IN);
9561 this.hidden();
9562 }
9563
9564 return this;
9565 },
9566
9567 /**
9568 * View one of the images with image's index
9569 * @param {number} index - The index of the image to view.
9570 * @returns {Viewer} this
9571 */
9572 view: function view() {
9573 var _this = this;
9574
9575 var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.options.initialViewIndex;
9576 index = Number(index) || 0;
9577
9578 if (!this.isShown) {
9579 this.index = index;
9580 return this.show();
9581 }
9582
9583 if (this.hiding || this.played || index < 0 || index >= this.length || this.viewed && index === this.index) {
9584 return this;
9585 }
9586
9587 if (this.viewing) {
9588 this.viewing.abort();
9589 }
9590
9591 var element = this.element,
9592 options = this.options,
9593 title = this.title,
9594 canvas = this.canvas;
9595 var item = this.items[index];
9596 var img = item.querySelector('img');
9597 var url = getData(img, 'originalUrl');
9598 var alt = img.getAttribute('alt');
9599 var image = document.createElement('img');
9600 image.src = url;
9601 image.alt = alt;
9602
9603 if (isFunction(options.view)) {
9604 addListener(element, EVENT_VIEW, options.view, {
9605 once: true
9606 });
9607 }
9608
9609 if (dispatchEvent(element, EVENT_VIEW, {
9610 originalImage: this.images[index],
9611 index: index,
9612 image: image
9613 }) === false || !this.isShown || this.hiding || this.played) {
9614 return this;
9615 }
9616
9617 this.image = image;
9618 removeClass(this.items[this.index], CLASS_ACTIVE);
9619 addClass(item, CLASS_ACTIVE);
9620 this.viewed = false;
9621 this.index = index;
9622 this.imageData = {};
9623 addClass(image, CLASS_INVISIBLE);
9624
9625 if (options.loading) {
9626 addClass(canvas, CLASS_LOADING);
9627 }
9628
9629 canvas.innerHTML = '';
9630 canvas.appendChild(image); // Center current item
9631
9632 this.renderList(); // Clear title
9633
9634 title.innerHTML = ''; // Generate title after viewed
9635
9636 var onViewed = function onViewed() {
9637 var imageData = _this.imageData;
9638 var render = Array.isArray(options.title) ? options.title[1] : options.title;
9639 title.innerHTML = isFunction(render) ? render.call(_this, image, imageData) : "".concat(alt, " (").concat(imageData.naturalWidth, " \xD7 ").concat(imageData.naturalHeight, ")");
9640 };
9641
9642 var onLoad;
9643 addListener(element, EVENT_VIEWED, onViewed, {
9644 once: true
9645 });
9646 this.viewing = {
9647 abort: function abort() {
9648 removeListener(element, EVENT_VIEWED, onViewed);
9649
9650 if (image.complete) {
9651 if (this.imageRendering) {
9652 this.imageRendering.abort();
9653 } else if (this.imageInitializing) {
9654 this.imageInitializing.abort();
9655 }
9656 } else {
9657 removeListener(image, EVENT_LOAD, onLoad);
9658
9659 if (this.timeout) {
9660 clearTimeout(this.timeout);
9661 }
9662 }
9663 }
9664 };
9665
9666 if (image.complete) {
9667 this.load();
9668 } else {
9669 addListener(image, EVENT_LOAD, onLoad = this.load.bind(this), {
9670 once: true
9671 });
9672
9673 if (this.timeout) {
9674 clearTimeout(this.timeout);
9675 } // Make the image visible if it fails to load within 1s
9676
9677
9678 this.timeout = setTimeout(function () {
9679 removeClass(image, CLASS_INVISIBLE);
9680 _this.timeout = false;
9681 }, 1000);
9682 }
9683
9684 return this;
9685 },
9686
9687 /**
9688 * View the previous image
9689 * @param {boolean} [loop=false] - Indicate if view the last one
9690 * when it is the first one at present.
9691 * @returns {Viewer} this
9692 */
9693 prev: function prev() {
9694 var loop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
9695 var index = this.index - 1;
9696
9697 if (index < 0) {
9698 index = loop ? this.length - 1 : 0;
9699 }
9700
9701 this.view(index);
9702 return this;
9703 },
9704
9705 /**
9706 * View the next image
9707 * @param {boolean} [loop=false] - Indicate if view the first one
9708 * when it is the last one at present.
9709 * @returns {Viewer} this
9710 */
9711 next: function next() {
9712 var loop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
9713 var maxIndex = this.length - 1;
9714 var index = this.index + 1;
9715
9716 if (index > maxIndex) {
9717 index = loop ? 0 : maxIndex;
9718 }
9719
9720 this.view(index);
9721 return this;
9722 },
9723
9724 /**
9725 * Move the image with relative offsets.
9726 * @param {number} offsetX - The relative offset distance on the x-axis.
9727 * @param {number} offsetY - The relative offset distance on the y-axis.
9728 * @returns {Viewer} this
9729 */
9730 move: function move(offsetX, offsetY) {
9731 var imageData = this.imageData;
9732 this.moveTo(isUndefined(offsetX) ? offsetX : imageData.left + Number(offsetX), isUndefined(offsetY) ? offsetY : imageData.top + Number(offsetY));
9733 return this;
9734 },
9735
9736 /**
9737 * Move the image to an absolute point.
9738 * @param {number} x - The x-axis coordinate.
9739 * @param {number} [y=x] - The y-axis coordinate.
9740 * @returns {Viewer} this
9741 */
9742 moveTo: function moveTo(x) {
9743 var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x;
9744 var imageData = this.imageData;
9745 x = Number(x);
9746 y = Number(y);
9747
9748 if (this.viewed && !this.played && this.options.movable) {
9749 var changed = false;
9750
9751 if (isNumber(x)) {
9752 imageData.left = x;
9753 changed = true;
9754 }
9755
9756 if (isNumber(y)) {
9757 imageData.top = y;
9758 changed = true;
9759 }
9760
9761 if (changed) {
9762 this.renderImage();
9763 }
9764 }
9765
9766 return this;
9767 },
9768
9769 /**
9770 * Zoom the image with a relative ratio.
9771 * @param {number} ratio - The target ratio.
9772 * @param {boolean} [hasTooltip=false] - Indicates if it has a tooltip or not.
9773 * @param {Event} [_originalEvent=null] - The original event if any.
9774 * @returns {Viewer} this
9775 */
9776 zoom: function zoom(ratio) {
9777 var hasTooltip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
9778
9779 var _originalEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
9780
9781 var imageData = this.imageData;
9782 ratio = Number(ratio);
9783
9784 if (ratio < 0) {
9785 ratio = 1 / (1 - ratio);
9786 } else {
9787 ratio = 1 + ratio;
9788 }
9789
9790 this.zoomTo(imageData.width * ratio / imageData.naturalWidth, hasTooltip, _originalEvent);
9791 return this;
9792 },
9793
9794 /**
9795 * Zoom the image to an absolute ratio.
9796 * @param {number} ratio - The target ratio.
9797 * @param {boolean} [hasTooltip=false] - Indicates if it has a tooltip or not.
9798 * @param {Event} [_originalEvent=null] - The original event if any.
9799 * @param {Event} [_zoomable=false] - Indicates if the current zoom is available or not.
9800 * @returns {Viewer} this
9801 */
9802 zoomTo: function zoomTo(ratio) {
9803 var _this2 = this;
9804
9805 var hasTooltip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
9806
9807 var _originalEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
9808
9809 var _zoomable = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
9810
9811 var element = this.element,
9812 options = this.options,
9813 pointers = this.pointers,
9814 imageData = this.imageData;
9815 ratio = Math.max(0, ratio);
9816
9817 if (isNumber(ratio) && this.viewed && !this.played && (_zoomable || options.zoomable)) {
9818 if (!_zoomable) {
9819 var minZoomRatio = Math.max(0.01, options.minZoomRatio);
9820 var maxZoomRatio = Math.min(100, options.maxZoomRatio);
9821 ratio = Math.min(Math.max(ratio, minZoomRatio), maxZoomRatio);
9822 }
9823
9824 if (_originalEvent && ratio > 0.95 && ratio < 1.05) {
9825 ratio = 1;
9826 }
9827
9828 var newWidth = imageData.naturalWidth * ratio;
9829 var newHeight = imageData.naturalHeight * ratio;
9830 var oldRatio = imageData.width / imageData.naturalWidth;
9831
9832 if (isFunction(options.zoom)) {
9833 addListener(element, EVENT_ZOOM, options.zoom, {
9834 once: true
9835 });
9836 }
9837
9838 if (dispatchEvent(element, EVENT_ZOOM, {
9839 ratio: ratio,
9840 oldRatio: oldRatio,
9841 originalEvent: _originalEvent
9842 }) === false) {
9843 return this;
9844 }
9845
9846 this.zooming = true;
9847
9848 if (_originalEvent) {
9849 var offset = getOffset(this.viewer);
9850 var center = pointers && Object.keys(pointers).length ? getPointersCenter(pointers) : {
9851 pageX: _originalEvent.pageX,
9852 pageY: _originalEvent.pageY
9853 }; // Zoom from the triggering point of the event
9854
9855 imageData.left -= (newWidth - imageData.width) * ((center.pageX - offset.left - imageData.left) / imageData.width);
9856 imageData.top -= (newHeight - imageData.height) * ((center.pageY - offset.top - imageData.top) / imageData.height);
9857 } else {
9858 // Zoom from the center of the image
9859 imageData.left -= (newWidth - imageData.width) / 2;
9860 imageData.top -= (newHeight - imageData.height) / 2;
9861 }
9862
9863 imageData.width = newWidth;
9864 imageData.height = newHeight;
9865 imageData.ratio = ratio;
9866 this.renderImage(function () {
9867 _this2.zooming = false;
9868
9869 if (isFunction(options.zoomed)) {
9870 addListener(element, EVENT_ZOOMED, options.zoomed, {
9871 once: true
9872 });
9873 }
9874
9875 dispatchEvent(element, EVENT_ZOOMED, {
9876 ratio: ratio,
9877 oldRatio: oldRatio,
9878 originalEvent: _originalEvent
9879 });
9880 });
9881
9882 if (hasTooltip) {
9883 this.tooltip();
9884 }
9885 }
9886
9887 return this;
9888 },
9889
9890 /**
9891 * Rotate the image with a relative degree.
9892 * @param {number} degree - The rotate degree.
9893 * @returns {Viewer} this
9894 */
9895 rotate: function rotate(degree) {
9896 this.rotateTo((this.imageData.rotate || 0) + Number(degree));
9897 return this;
9898 },
9899
9900 /**
9901 * Rotate the image to an absolute degree.
9902 * @param {number} degree - The rotate degree.
9903 * @returns {Viewer} this
9904 */
9905 rotateTo: function rotateTo(degree) {
9906 var imageData = this.imageData;
9907 degree = Number(degree);
9908
9909 if (isNumber(degree) && this.viewed && !this.played && this.options.rotatable) {
9910 imageData.rotate = degree;
9911 this.renderImage();
9912 }
9913
9914 return this;
9915 },
9916
9917 /**
9918 * Scale the image on the x-axis.
9919 * @param {number} scaleX - The scale ratio on the x-axis.
9920 * @returns {Viewer} this
9921 */
9922 scaleX: function scaleX(_scaleX) {
9923 this.scale(_scaleX, this.imageData.scaleY);
9924 return this;
9925 },
9926
9927 /**
9928 * Scale the image on the y-axis.
9929 * @param {number} scaleY - The scale ratio on the y-axis.
9930 * @returns {Viewer} this
9931 */
9932 scaleY: function scaleY(_scaleY) {
9933 this.scale(this.imageData.scaleX, _scaleY);
9934 return this;
9935 },
9936
9937 /**
9938 * Scale the image.
9939 * @param {number} scaleX - The scale ratio on the x-axis.
9940 * @param {number} [scaleY=scaleX] - The scale ratio on the y-axis.
9941 * @returns {Viewer} this
9942 */
9943 scale: function scale(scaleX) {
9944 var scaleY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scaleX;
9945 var imageData = this.imageData;
9946 scaleX = Number(scaleX);
9947 scaleY = Number(scaleY);
9948
9949 if (this.viewed && !this.played && this.options.scalable) {
9950 var changed = false;
9951
9952 if (isNumber(scaleX)) {
9953 imageData.scaleX = scaleX;
9954 changed = true;
9955 }
9956
9957 if (isNumber(scaleY)) {
9958 imageData.scaleY = scaleY;
9959 changed = true;
9960 }
9961
9962 if (changed) {
9963 this.renderImage();
9964 }
9965 }
9966
9967 return this;
9968 },
9969
9970 /**
9971 * Play the images
9972 * @param {boolean} [fullscreen=false] - Indicate if request fullscreen or not.
9973 * @returns {Viewer} this
9974 */
9975 play: function play() {
9976 var _this3 = this;
9977
9978 var fullscreen = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
9979
9980 if (!this.isShown || this.played) {
9981 return this;
9982 }
9983
9984 var options = this.options,
9985 player = this.player;
9986 var onLoad = this.loadImage.bind(this);
9987 var list = [];
9988 var total = 0;
9989 var index = 0;
9990 this.played = true;
9991 this.onLoadWhenPlay = onLoad;
9992
9993 if (fullscreen) {
9994 this.requestFullscreen();
9995 }
9996
9997 addClass(player, CLASS_SHOW);
9998 forEach(this.items, function (item, i) {
9999 var img = item.querySelector('img');
10000 var image = document.createElement('img');
10001 image.src = getData(img, 'originalUrl');
10002 image.alt = img.getAttribute('alt');
10003 total += 1;
10004 addClass(image, CLASS_FADE);
10005 toggleClass(image, CLASS_TRANSITION, options.transition);
10006
10007 if (hasClass(item, CLASS_ACTIVE)) {
10008 addClass(image, CLASS_IN);
10009 index = i;
10010 }
10011
10012 list.push(image);
10013 addListener(image, EVENT_LOAD, onLoad, {
10014 once: true
10015 });
10016 player.appendChild(image);
10017 });
10018
10019 if (isNumber(options.interval) && options.interval > 0) {
10020 var play = function play() {
10021 _this3.playing = setTimeout(function () {
10022 removeClass(list[index], CLASS_IN);
10023 index += 1;
10024 index = index < total ? index : 0;
10025 addClass(list[index], CLASS_IN);
10026 play();
10027 }, options.interval);
10028 };
10029
10030 if (total > 1) {
10031 play();
10032 }
10033 }
10034
10035 return this;
10036 },
10037 // Stop play
10038 stop: function stop() {
10039 var _this4 = this;
10040
10041 if (!this.played) {
10042 return this;
10043 }
10044
10045 var player = this.player;
10046 this.played = false;
10047 clearTimeout(this.playing);
10048 forEach(player.getElementsByTagName('img'), function (image) {
10049 removeListener(image, EVENT_LOAD, _this4.onLoadWhenPlay);
10050 });
10051 removeClass(player, CLASS_SHOW);
10052 player.innerHTML = '';
10053 this.exitFullscreen();
10054 return this;
10055 },
10056 // Enter modal mode (only available in inline mode)
10057 full: function full() {
10058 var _this5 = this;
10059
10060 var options = this.options,
10061 viewer = this.viewer,
10062 image = this.image,
10063 list = this.list;
10064
10065 if (!this.isShown || this.played || this.fulled || !options.inline) {
10066 return this;
10067 }
10068
10069 this.fulled = true;
10070 this.open();
10071 addClass(this.button, CLASS_FULLSCREEN_EXIT);
10072
10073 if (options.transition) {
10074 removeClass(list, CLASS_TRANSITION);
10075
10076 if (this.viewed) {
10077 removeClass(image, CLASS_TRANSITION);
10078 }
10079 }
10080
10081 addClass(viewer, CLASS_FIXED);
10082 viewer.setAttribute('style', '');
10083 setStyle(viewer, {
10084 zIndex: options.zIndex
10085 });
10086 this.initContainer();
10087 this.viewerData = assign({}, this.containerData);
10088 this.renderList();
10089
10090 if (this.viewed) {
10091 this.initImage(function () {
10092 _this5.renderImage(function () {
10093 if (options.transition) {
10094 setTimeout(function () {
10095 addClass(image, CLASS_TRANSITION);
10096 addClass(list, CLASS_TRANSITION);
10097 }, 0);
10098 }
10099 });
10100 });
10101 }
10102
10103 return this;
10104 },
10105 // Exit modal mode (only available in inline mode)
10106 exit: function exit() {
10107 var _this6 = this;
10108
10109 var options = this.options,
10110 viewer = this.viewer,
10111 image = this.image,
10112 list = this.list;
10113
10114 if (!this.isShown || this.played || !this.fulled || !options.inline) {
10115 return this;
10116 }
10117
10118 this.fulled = false;
10119 this.close();
10120 removeClass(this.button, CLASS_FULLSCREEN_EXIT);
10121
10122 if (options.transition) {
10123 removeClass(list, CLASS_TRANSITION);
10124
10125 if (this.viewed) {
10126 removeClass(image, CLASS_TRANSITION);
10127 }
10128 }
10129
10130 removeClass(viewer, CLASS_FIXED);
10131 setStyle(viewer, {
10132 zIndex: options.zIndexInline
10133 });
10134 this.viewerData = assign({}, this.parentData);
10135 this.renderViewer();
10136 this.renderList();
10137
10138 if (this.viewed) {
10139 this.initImage(function () {
10140 _this6.renderImage(function () {
10141 if (options.transition) {
10142 setTimeout(function () {
10143 addClass(image, CLASS_TRANSITION);
10144 addClass(list, CLASS_TRANSITION);
10145 }, 0);
10146 }
10147 });
10148 });
10149 }
10150
10151 return this;
10152 },
10153 // Show the current ratio of the image with percentage
10154 tooltip: function tooltip() {
10155 var _this7 = this;
10156
10157 var options = this.options,
10158 tooltipBox = this.tooltipBox,
10159 imageData = this.imageData;
10160
10161 if (!this.viewed || this.played || !options.tooltip) {
10162 return this;
10163 }
10164
10165 tooltipBox.textContent = "".concat(Math.round(imageData.ratio * 100), "%");
10166
10167 if (!this.tooltipping) {
10168 if (options.transition) {
10169 if (this.fading) {
10170 dispatchEvent(tooltipBox, EVENT_TRANSITION_END);
10171 }
10172
10173 addClass(tooltipBox, CLASS_SHOW);
10174 addClass(tooltipBox, CLASS_FADE);
10175 addClass(tooltipBox, CLASS_TRANSITION); // Force reflow to enable CSS3 transition
10176 // eslint-disable-next-line
10177
10178 tooltipBox.offsetWidth;
10179 addClass(tooltipBox, CLASS_IN);
10180 } else {
10181 addClass(tooltipBox, CLASS_SHOW);
10182 }
10183 } else {
10184 clearTimeout(this.tooltipping);
10185 }
10186
10187 this.tooltipping = setTimeout(function () {
10188 if (options.transition) {
10189 addListener(tooltipBox, EVENT_TRANSITION_END, function () {
10190 removeClass(tooltipBox, CLASS_SHOW);
10191 removeClass(tooltipBox, CLASS_FADE);
10192 removeClass(tooltipBox, CLASS_TRANSITION);
10193 _this7.fading = false;
10194 }, {
10195 once: true
10196 });
10197 removeClass(tooltipBox, CLASS_IN);
10198 _this7.fading = true;
10199 } else {
10200 removeClass(tooltipBox, CLASS_SHOW);
10201 }
10202
10203 _this7.tooltipping = false;
10204 }, 1000);
10205 return this;
10206 },
10207 // Toggle the image size between its natural size and initial size
10208 toggle: function toggle() {
10209 if (this.imageData.ratio === 1) {
10210 this.zoomTo(this.initialImageData.ratio, true);
10211 } else {
10212 this.zoomTo(1, true);
10213 }
10214
10215 return this;
10216 },
10217 // Reset the image to its initial state
10218 reset: function reset() {
10219 if (this.viewed && !this.played) {
10220 this.imageData = assign({}, this.initialImageData);
10221 this.renderImage();
10222 }
10223
10224 return this;
10225 },
10226 // Update viewer when images changed
10227 update: function update() {
10228 var element = this.element,
10229 options = this.options,
10230 isImg = this.isImg; // Destroy viewer if the target image was deleted
10231
10232 if (isImg && !element.parentNode) {
10233 return this.destroy();
10234 }
10235
10236 var images = [];
10237 forEach(isImg ? [element] : element.querySelectorAll('img'), function (image) {
10238 if (options.filter) {
10239 if (options.filter(image)) {
10240 images.push(image);
10241 }
10242 } else {
10243 images.push(image);
10244 }
10245 });
10246
10247 if (!images.length) {
10248 return this;
10249 }
10250
10251 this.images = images;
10252 this.length = images.length;
10253
10254 if (this.ready) {
10255 var indexes = [];
10256 forEach(this.items, function (item, i) {
10257 var img = item.querySelector('img');
10258 var image = images[i];
10259
10260 if (image) {
10261 if (image.src !== img.src) {
10262 indexes.push(i);
10263 }
10264 } else {
10265 indexes.push(i);
10266 }
10267 });
10268 setStyle(this.list, {
10269 width: 'auto'
10270 });
10271 this.initList();
10272
10273 if (this.isShown) {
10274 if (this.length) {
10275 if (this.viewed) {
10276 var index = indexes.indexOf(this.index);
10277
10278 if (index >= 0) {
10279 this.viewed = false;
10280 this.view(Math.max(this.index - (index + 1), 0));
10281 } else {
10282 addClass(this.items[this.index], CLASS_ACTIVE);
10283 }
10284 }
10285 } else {
10286 this.image = null;
10287 this.viewed = false;
10288 this.index = 0;
10289 this.imageData = {};
10290 this.canvas.innerHTML = '';
10291 this.title.innerHTML = '';
10292 }
10293 }
10294 } else {
10295 this.build();
10296 }
10297
10298 return this;
10299 },
10300 // Destroy the viewer
10301 destroy: function destroy() {
10302 var element = this.element,
10303 options = this.options;
10304
10305 if (!element[NAMESPACE]) {
10306 return this;
10307 }
10308
10309 this.destroyed = true;
10310
10311 if (this.ready) {
10312 if (this.played) {
10313 this.stop();
10314 }
10315
10316 if (options.inline) {
10317 if (this.fulled) {
10318 this.exit();
10319 }
10320
10321 this.unbind();
10322 } else if (this.isShown) {
10323 if (this.viewing) {
10324 if (this.imageRendering) {
10325 this.imageRendering.abort();
10326 } else if (this.imageInitializing) {
10327 this.imageInitializing.abort();
10328 }
10329 }
10330
10331 if (this.hiding) {
10332 this.transitioning.abort();
10333 }
10334
10335 this.hidden();
10336 } else if (this.showing) {
10337 this.transitioning.abort();
10338 this.hidden();
10339 }
10340
10341 this.ready = false;
10342 this.viewer.parentNode.removeChild(this.viewer);
10343 } else if (options.inline) {
10344 if (this.delaying) {
10345 this.delaying.abort();
10346 } else if (this.initializing) {
10347 this.initializing.abort();
10348 }
10349 }
10350
10351 if (!options.inline) {
10352 removeListener(element, EVENT_CLICK, this.onStart);
10353 }
10354
10355 element[NAMESPACE] = undefined;
10356 return this;
10357 }
10358 };
10359
10360 var others = {
10361 open: function open() {
10362 var body = this.body;
10363 addClass(body, CLASS_OPEN);
10364 body.style.paddingRight = "".concat(this.scrollbarWidth + (parseFloat(this.initialBodyPaddingRight) || 0), "px");
10365 },
10366 close: function close() {
10367 var body = this.body;
10368 removeClass(body, CLASS_OPEN);
10369 body.style.paddingRight = this.initialBodyPaddingRight;
10370 },
10371 shown: function shown() {
10372 var element = this.element,
10373 options = this.options;
10374 this.fulled = true;
10375 this.isShown = true;
10376 this.render();
10377 this.bind();
10378 this.showing = false;
10379
10380 if (isFunction(options.shown)) {
10381 addListener(element, EVENT_SHOWN, options.shown, {
10382 once: true
10383 });
10384 }
10385
10386 if (dispatchEvent(element, EVENT_SHOWN) === false) {
10387 return;
10388 }
10389
10390 if (this.ready && this.isShown && !this.hiding) {
10391 this.view(this.index);
10392 }
10393 },
10394 hidden: function hidden() {
10395 var element = this.element,
10396 options = this.options;
10397 this.fulled = false;
10398 this.viewed = false;
10399 this.isShown = false;
10400 this.close();
10401 this.unbind();
10402 addClass(this.viewer, CLASS_HIDE);
10403 this.resetList();
10404 this.resetImage();
10405 this.hiding = false;
10406
10407 if (!this.destroyed) {
10408 if (isFunction(options.hidden)) {
10409 addListener(element, EVENT_HIDDEN, options.hidden, {
10410 once: true
10411 });
10412 }
10413
10414 dispatchEvent(element, EVENT_HIDDEN);
10415 }
10416 },
10417 requestFullscreen: function requestFullscreen() {
10418 var document = this.element.ownerDocument;
10419
10420 if (this.fulled && !document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) {
10421 var documentElement = document.documentElement;
10422
10423 if (documentElement.requestFullscreen) {
10424 documentElement.requestFullscreen();
10425 } else if (documentElement.msRequestFullscreen) {
10426 documentElement.msRequestFullscreen();
10427 } else if (documentElement.mozRequestFullScreen) {
10428 documentElement.mozRequestFullScreen();
10429 } else if (documentElement.webkitRequestFullscreen) {
10430 documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
10431 }
10432 }
10433 },
10434 exitFullscreen: function exitFullscreen() {
10435 if (this.fulled) {
10436 var document = this.element.ownerDocument;
10437
10438 if (document.exitFullscreen) {
10439 document.exitFullscreen();
10440 } else if (document.msExitFullscreen) {
10441 document.msExitFullscreen();
10442 } else if (document.mozCancelFullScreen) {
10443 document.mozCancelFullScreen();
10444 } else if (document.webkitExitFullscreen) {
10445 document.webkitExitFullscreen();
10446 }
10447 }
10448 },
10449 change: function change(e) {
10450 var options = this.options,
10451 pointers = this.pointers;
10452 var pointer = pointers[Object.keys(pointers)[0]];
10453 var offsetX = pointer.endX - pointer.startX;
10454 var offsetY = pointer.endY - pointer.startY;
10455
10456 switch (this.action) {
10457 // Move the current image
10458 case ACTION_MOVE:
10459 this.move(offsetX, offsetY);
10460 break;
10461 // Zoom the current image
10462
10463 case ACTION_ZOOM:
10464 this.zoom(getMaxZoomRatio(pointers), false, e);
10465 break;
10466
10467 case ACTION_SWITCH:
10468 {
10469 this.action = 'switched';
10470 var absoluteOffsetX = Math.abs(offsetX);
10471
10472 if (absoluteOffsetX > 1 && absoluteOffsetX > Math.abs(offsetY)) {
10473 // Empty `pointers` as `touchend` event will not be fired after swiped in iOS browsers.
10474 this.pointers = {};
10475
10476 if (offsetX > 1) {
10477 this.prev(options.loop);
10478 } else if (offsetX < -1) {
10479 this.next(options.loop);
10480 }
10481 }
10482
10483 break;
10484 }
10485
10486 default:
10487 } // Override
10488
10489
10490 forEach(pointers, function (p) {
10491 p.startX = p.endX;
10492 p.startY = p.endY;
10493 });
10494 },
10495 isSwitchable: function isSwitchable() {
10496 var imageData = this.imageData,
10497 viewerData = this.viewerData;
10498 return this.length > 1 && imageData.left >= 0 && imageData.top >= 0 && imageData.width <= viewerData.width && imageData.height <= viewerData.height;
10499 }
10500 };
10501
10502 var AnotherViewer = WINDOW.Viewer;
10503
10504 var Viewer =
10505 /*#__PURE__*/
10506 function () {
10507 /**
10508 * Create a new Viewer.
10509 * @param {Element} element - The target element for viewing.
10510 * @param {Object} [options={}] - The configuration options.
10511 */
10512 function Viewer(element) {
10513 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
10514
10515 _classCallCheck(this, Viewer);
10516
10517 if (!element || element.nodeType !== 1) {
10518 throw new Error('The first argument is required and must be an element.');
10519 }
10520
10521 this.element = element;
10522 this.options = assign({}, DEFAULTS, isPlainObject(options) && options);
10523 this.action = false;
10524 this.fading = false;
10525 this.fulled = false;
10526 this.hiding = false;
10527 this.imageData = {};
10528 this.index = this.options.initialViewIndex;
10529 this.isImg = false;
10530 this.isShown = false;
10531 this.length = 0;
10532 this.played = false;
10533 this.playing = false;
10534 this.pointers = {};
10535 this.ready = false;
10536 this.showing = false;
10537 this.timeout = false;
10538 this.tooltipping = false;
10539 this.viewed = false;
10540 this.viewing = false;
10541 this.wheeling = false;
10542 this.zooming = false;
10543 this.init();
10544 }
10545
10546 _createClass(Viewer, [{
10547 key: "init",
10548 value: function init() {
10549 var _this = this;
10550
10551 var element = this.element,
10552 options = this.options;
10553
10554 if (element[NAMESPACE]) {
10555 return;
10556 }
10557
10558 element[NAMESPACE] = this;
10559 var isImg = element.tagName.toLowerCase() === 'img';
10560 var images = [];
10561 forEach(isImg ? [element] : element.querySelectorAll('img'), function (image) {
10562 if (isFunction(options.filter)) {
10563 if (options.filter.call(_this, image)) {
10564 images.push(image);
10565 }
10566 } else {
10567 images.push(image);
10568 }
10569 });
10570
10571 if (!images.length) {
10572 return;
10573 }
10574
10575 this.isImg = isImg;
10576 this.length = images.length;
10577 this.images = images;
10578 var ownerDocument = element.ownerDocument;
10579 var body = ownerDocument.body || ownerDocument.documentElement;
10580 this.body = body;
10581 this.scrollbarWidth = window.innerWidth - ownerDocument.documentElement.clientWidth;
10582 this.initialBodyPaddingRight = window.getComputedStyle(body).paddingRight; // Override `transition` option if it is not supported
10583
10584 if (isUndefined(document.createElement(NAMESPACE).style.transition)) {
10585 options.transition = false;
10586 }
10587
10588 if (options.inline) {
10589 var count = 0;
10590
10591 var progress = function progress() {
10592 count += 1;
10593
10594 if (count === _this.length) {
10595 var timeout;
10596 _this.initializing = false;
10597 _this.delaying = {
10598 abort: function abort() {
10599 clearTimeout(timeout);
10600 }
10601 }; // build asynchronously to keep `this.viewer` is accessible in `ready` event handler.
10602
10603 timeout = setTimeout(function () {
10604 _this.delaying = false;
10605
10606 _this.build();
10607 }, 0);
10608 }
10609 };
10610
10611 this.initializing = {
10612 abort: function abort() {
10613 forEach(images, function (image) {
10614 if (!image.complete) {
10615 removeListener(image, EVENT_LOAD, progress);
10616 }
10617 });
10618 }
10619 };
10620 forEach(images, function (image) {
10621 if (image.complete) {
10622 progress();
10623 } else {
10624 addListener(image, EVENT_LOAD, progress, {
10625 once: true
10626 });
10627 }
10628 });
10629 } else {
10630 addListener(element, EVENT_CLICK, this.onStart = function (_ref) {
10631 var target = _ref.target;
10632
10633 if (target.tagName.toLowerCase() === 'img' && (!isFunction(options.filter) || options.filter.call(_this, target))) {
10634 _this.view(_this.images.indexOf(target));
10635 }
10636 });
10637 }
10638 }
10639 }, {
10640 key: "build",
10641 value: function build() {
10642 if (this.ready) {
10643 return;
10644 }
10645
10646 var element = this.element,
10647 options = this.options;
10648 var parent = element.parentNode;
10649 var template = document.createElement('div');
10650 template.innerHTML = TEMPLATE;
10651 var viewer = template.querySelector(".".concat(NAMESPACE, "-container"));
10652 var title = viewer.querySelector(".".concat(NAMESPACE, "-title"));
10653 var toolbar = viewer.querySelector(".".concat(NAMESPACE, "-toolbar"));
10654 var navbar = viewer.querySelector(".".concat(NAMESPACE, "-navbar"));
10655 var button = viewer.querySelector(".".concat(NAMESPACE, "-button"));
10656 var canvas = viewer.querySelector(".".concat(NAMESPACE, "-canvas"));
10657 this.parent = parent;
10658 this.viewer = viewer;
10659 this.title = title;
10660 this.toolbar = toolbar;
10661 this.navbar = navbar;
10662 this.button = button;
10663 this.canvas = canvas;
10664 this.footer = viewer.querySelector(".".concat(NAMESPACE, "-footer"));
10665 this.tooltipBox = viewer.querySelector(".".concat(NAMESPACE, "-tooltip"));
10666 this.player = viewer.querySelector(".".concat(NAMESPACE, "-player"));
10667 this.list = viewer.querySelector(".".concat(NAMESPACE, "-list"));
10668 addClass(title, !options.title ? CLASS_HIDE : getResponsiveClass(Array.isArray(options.title) ? options.title[0] : options.title));
10669 addClass(navbar, !options.navbar ? CLASS_HIDE : getResponsiveClass(options.navbar));
10670 toggleClass(button, CLASS_HIDE, !options.button);
10671
10672 if (options.backdrop) {
10673 addClass(viewer, "".concat(NAMESPACE, "-backdrop"));
10674
10675 if (!options.inline && options.backdrop === true) {
10676 setData(canvas, DATA_ACTION, 'hide');
10677 }
10678 }
10679
10680 if (isString(options.className) && options.className) {
10681 // In case there are multiple class names
10682 options.className.split(REGEXP_SPACES).forEach(function (className) {
10683 addClass(viewer, className);
10684 });
10685 }
10686
10687 if (options.toolbar) {
10688 var list = document.createElement('ul');
10689 var custom = isPlainObject(options.toolbar);
10690 var zoomButtons = BUTTONS.slice(0, 3);
10691 var rotateButtons = BUTTONS.slice(7, 9);
10692 var scaleButtons = BUTTONS.slice(9);
10693
10694 if (!custom) {
10695 addClass(toolbar, getResponsiveClass(options.toolbar));
10696 }
10697
10698 forEach(custom ? options.toolbar : BUTTONS, function (value, index) {
10699 var deep = custom && isPlainObject(value);
10700 var name = custom ? hyphenate(index) : value;
10701 var show = deep && !isUndefined(value.show) ? value.show : value;
10702
10703 if (!show || !options.zoomable && zoomButtons.indexOf(name) !== -1 || !options.rotatable && rotateButtons.indexOf(name) !== -1 || !options.scalable && scaleButtons.indexOf(name) !== -1) {
10704 return;
10705 }
10706
10707 var size = deep && !isUndefined(value.size) ? value.size : value;
10708 var click = deep && !isUndefined(value.click) ? value.click : value;
10709 var item = document.createElement('li');
10710 item.setAttribute('role', 'button');
10711 addClass(item, "".concat(NAMESPACE, "-").concat(name));
10712
10713 if (!isFunction(click)) {
10714 setData(item, DATA_ACTION, name);
10715 }
10716
10717 if (isNumber(show)) {
10718 addClass(item, getResponsiveClass(show));
10719 }
10720
10721 if (['small', 'large'].indexOf(size) !== -1) {
10722 addClass(item, "".concat(NAMESPACE, "-").concat(size));
10723 } else if (name === 'play') {
10724 addClass(item, "".concat(NAMESPACE, "-large"));
10725 }
10726
10727 if (isFunction(click)) {
10728 addListener(item, EVENT_CLICK, click);
10729 }
10730
10731 list.appendChild(item);
10732 });
10733 toolbar.appendChild(list);
10734 } else {
10735 addClass(toolbar, CLASS_HIDE);
10736 }
10737
10738 if (!options.rotatable) {
10739 var rotates = toolbar.querySelectorAll('li[class*="rotate"]');
10740 addClass(rotates, CLASS_INVISIBLE);
10741 forEach(rotates, function (rotate) {
10742 toolbar.appendChild(rotate);
10743 });
10744 }
10745
10746 if (options.inline) {
10747 addClass(button, CLASS_FULLSCREEN);
10748 setStyle(viewer, {
10749 zIndex: options.zIndexInline
10750 });
10751
10752 if (window.getComputedStyle(parent).position === 'static') {
10753 setStyle(parent, {
10754 position: 'relative'
10755 });
10756 }
10757
10758 parent.insertBefore(viewer, element.nextSibling);
10759 } else {
10760 addClass(button, CLASS_CLOSE);
10761 addClass(viewer, CLASS_FIXED);
10762 addClass(viewer, CLASS_FADE);
10763 addClass(viewer, CLASS_HIDE);
10764 setStyle(viewer, {
10765 zIndex: options.zIndex
10766 });
10767 var container = options.container;
10768
10769 if (isString(container)) {
10770 container = element.ownerDocument.querySelector(container);
10771 }
10772
10773 if (!container) {
10774 container = this.body;
10775 }
10776
10777 container.appendChild(viewer);
10778 }
10779
10780 if (options.inline) {
10781 this.render();
10782 this.bind();
10783 this.isShown = true;
10784 }
10785
10786 this.ready = true;
10787
10788 if (isFunction(options.ready)) {
10789 addListener(element, EVENT_READY, options.ready, {
10790 once: true
10791 });
10792 }
10793
10794 if (dispatchEvent(element, EVENT_READY) === false) {
10795 this.ready = false;
10796 return;
10797 }
10798
10799 if (this.ready && options.inline) {
10800 this.view(this.index);
10801 }
10802 }
10803 /**
10804 * Get the no conflict viewer class.
10805 * @returns {Viewer} The viewer class.
10806 */
10807
10808 }], [{
10809 key: "noConflict",
10810 value: function noConflict() {
10811 window.Viewer = AnotherViewer;
10812 return Viewer;
10813 }
10814 /**
10815 * Change the default options.
10816 * @param {Object} options - The new default options.
10817 */
10818
10819 }, {
10820 key: "setDefaults",
10821 value: function setDefaults(options) {
10822 assign(DEFAULTS, isPlainObject(options) && options);
10823 }
10824 }]);
10825
10826 return Viewer;
10827 }();
10828
10829 assign(Viewer.prototype, render, events, handlers, methods, others);
10830
10831 module.exports = Viewer;
10832
10833
10834/***/ }),
10835/* 83 */
10836/***/ (function(module, exports, __webpack_require__) {
10837
10838 'use strict';
10839
10840 Object.defineProperty(exports, "__esModule", {
10841 value: true
10842 });
10843
10844 var _react = __webpack_require__(4);
10845
10846 var _react2 = _interopRequireDefault(_react);
10847
10848 var _src = __webpack_require__(80);
10849
10850 var _src2 = _interopRequireDefault(_src);
10851
10852 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
10853
10854 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; }
10855
10856 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10857
10858 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; }
10859
10860 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); } /**
10861 *
10862 * @title 单个图片查看
10863 * @description 单个图片查看
10864 *
10865 */
10866
10867
10868 var Demo1 = function (_Component) {
10869 _inherits(Demo1, _Component);
10870
10871 function Demo1() {
10872 var _temp, _this, _ret;
10873
10874 _classCallCheck(this, Demo1);
10875
10876 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
10877 args[_key] = arguments[_key];
10878 }
10879
10880 return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.shown = function (e) {
10881 console.log(e, 'shwon');
10882 }, _this.hidden = function (e) {
10883 console.log(e, 'hidden');
10884 }, _temp), _possibleConstructorReturn(_this, _ret);
10885 }
10886
10887 Demo1.prototype.render = function render() {
10888 return _react2['default'].createElement(
10889 _src2['default'],
10890 { shown: this.shown, hidden: this.hidden },
10891 _react2['default'].createElement('img', { id: 'image', src: 'http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-1-min.jpg', alt: 'Picture' })
10892 );
10893 };
10894
10895 return Demo1;
10896 }(_react.Component);
10897
10898 exports['default'] = Demo1;
10899 module.exports = exports['default'];
10900
10901/***/ }),
10902/* 84 */
10903/***/ (function(module, exports, __webpack_require__) {
10904
10905 'use strict';
10906
10907 Object.defineProperty(exports, "__esModule", {
10908 value: true
10909 });
10910
10911 var _react = __webpack_require__(4);
10912
10913 var _react2 = _interopRequireDefault(_react);
10914
10915 var _src = __webpack_require__(80);
10916
10917 var _src2 = _interopRequireDefault(_src);
10918
10919 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
10920
10921 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; }
10922
10923 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10924
10925 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; }
10926
10927 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); } /**
10928 *
10929 * @title 图片列表查看
10930 * @description 图片列表查看。 img 的 data-original 写高清大图地址。src写缩略图地址
10931 *
10932 */
10933
10934
10935 var Demo2 = function (_Component) {
10936 _inherits(Demo2, _Component);
10937
10938 function Demo2() {
10939 _classCallCheck(this, Demo2);
10940
10941 return _possibleConstructorReturn(this, _Component.apply(this, arguments));
10942 }
10943
10944 Demo2.prototype.render = function render() {
10945 return _react2['default'].createElement(
10946 _src2['default'],
10947 null,
10948 _react2['default'].createElement(
10949 'div',
10950 null,
10951 _react2['default'].createElement('img', { 'data-original': 'http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-5-min.jpg', src: 'http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-1-min.jpg', alt: 'Picture' }),
10952 _react2['default'].createElement('img', { 'data-original': 'http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-4-min.jpg', src: 'http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-2-min.jpg', alt: 'Picture' }),
10953 _react2['default'].createElement('img', { 'data-original': 'http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-3-min.jpg', src: 'http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-3-min.jpg', alt: 'Picture' }),
10954 _react2['default'].createElement('img', { 'data-original': 'http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-2-min.jpg', src: 'http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-4-min.jpg', alt: 'Picture' }),
10955 _react2['default'].createElement('img', { 'data-original': 'http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-1-min.jpg', src: 'http://design.yonyoucloud.com/static/bee.tinper.org-demo/swiper-demo-5-min.jpg', alt: 'Picture' })
10956 )
10957 );
10958 };
10959
10960 return Demo2;
10961 }(_react.Component);
10962
10963 exports['default'] = Demo2;
10964 module.exports = exports['default'];
10965
10966/***/ })
10967/******/ ]);
10968//# sourceMappingURL=demo.js.map
\No newline at end of file